import { useState as o, useRef as c, useEffect as m, useMemo as s } from "react";
import { deepEqual as a } from "fast-equals";
import { ColumnInteractiveCheckFormatter as i } from "./formatter.js";
const f = (t) => (e, r) => e[t.column.key] === r, l = (t) => (e, r) => {
  const u = e[t.column.key], n = r[t.column.key];
  return u > n ? 1 : u < n ? -1 : 0;
}, h = (t) => {
  const [e, r] = o(t), u = c({ ...t });
  return m(() => {
    a(u.current, t) || (u.current = t, r(t));
  }, [t]), s(() => ({
    formatter: i(e),
    customFilter: f(e),
    customSort: l(e)
  }), [e]);
};
export {
  h as useColumnInteractiveCheck
};
