import { useState as m, useRef as a, useEffect as f, useMemo as c } from "react";
import { deepEqual as d } from "fast-equals";
import { ColumnPointsFormatter as C } from "./formatter.js";
import { ColumnPointsGroupFormatter as P } from "./ColumnPointsGroupFormatter.js";
import { getFormatPoints as i } from "../../../formatters/PointsFormatter/PointsFormatter.js";
import { getColumnKey as u } from "../../helpers/shared/getColumnKey/getColumnKey.js";
const V = (t) => (e, r) => {
  const o = u(t.fieldValue), n = u(t.fieldUnit);
  return i(e, o, n).toLocaleLowerCase().includes(r.toLocaleLowerCase());
}, F = (t) => (e, r) => {
  const o = u(t.fieldValue), n = u(t.fieldUnit), s = i(e, o, n), l = i(r, o, n);
  return s > l ? 1 : s < l ? -1 : 0;
}, G = (t) => {
  const [e, r] = m(t), o = a({ ...t });
  return f(() => {
    d(o.current, t) || (o.current = t, r(t));
  }, [t]), c(() => ({
    formatter: C(e),
    renderGroupCell: P(e),
    customFilter: V(e),
    customSort: F(e)
  }), [e]);
};
export {
  G as useColumnPoints
};
