import { useCallback as f } from "react";
const m = ({
  getConfigColumns: o,
  onChangeColumnsConfig: d
}) => ({
  onChangeColumnsOrder: f(
    (t, s, u) => {
      if (s === u)
        return;
      const n = o(t), i = n.findIndex(
        (e) => e.key === s
      ), l = n.findIndex(
        (e) => e.key === u
      ), r = [...n];
      r.splice(
        l,
        0,
        r.splice(i, 1)[0]
      );
      let c = 0;
      const C = r.map((e, x) => {
        const p = {
          ...e,
          index: x
        };
        return e.grouped && (p.groupOrder = c, c++), p;
      });
      d(t, C);
    },
    [o, d]
  )
});
export {
  m as useChangeColumnsOrder
};
