import { useModuleDictionary as u } from "@m4l/core";
import { ActionsSortAscOutlined as a, ActionsSortDescOutlined as d } from "@m4l/icons";
import { useFormatter as p } from "@m4l/graphics";
import { useMemo as S } from "react";
import { useDynamicSortStore as D } from "../../store/useDynamicSortStore.js";
import { fieldFactory as v } from "../FieldTypes/fieldFactory.js";
function E(o) {
  const { getLabel: e } = u(), t = p(), { hidePopoverSort: r, removeSort: n, showPopoverSortForEdit: c } = D(
    (i) => i.actions
  ), l = o.operator === "asc" ? a : d, m = S(() => v().getLabels(o, e, t, o.field), [o, e, t]);
  function s() {
    r(!1), n(o.id);
  }
  function f(i) {
    r(!1), setTimeout(() => c(o), 10);
  }
  return {
    onDelete: s,
    onEditSort: f,
    iconFieldUrl: o.field?.urlIcon,
    labels: m,
    SortDirectionIcon: l
  };
}
export {
  E as default
};
