import { jsxs as u, jsx as o } from "@emotion/react/jsx-runtime";
import { forwardRef as d } from "react";
import { useModuleDictionary as A } from "@m4l/core";
import { ActionsCleanOutlined as y, ArrowRefreshCcwOutlined as C, ActionsSortOutlined as w } from "@m4l/icons";
import { getDynamicSortDictionary as h, DICCTIONARY as D } from "../../dictionary.js";
import R from "../DynamicSortBase/useDynamicSortBase.js";
import b from "./useSortActions.js";
import { ActionsStyled as k, ActionsClearButtonStyled as B, ActionsSubmitButtonStyled as O } from "../../slots/DynamicSortSlots.js";
const x = d((_, c) => {
  const {
    automatic: a,
    canShowRemoveAction: t,
    hasAppliedSorts: l,
    onClickClearSorts: m,
    onClickSort: p,
    sortButtonDictionaryTooltip: S,
    ownerState: r
  } = b(), { size: i, visibleRefresh: e, ownerState: { isDirty: n } } = R(), { getLabel: s } = A(), f = e && (l || n);
  return /* @__PURE__ */ u(k, { ref: c, ownerState: { ...r, isDirty: t, visibleRefresh: e }, children: [
    t && /* @__PURE__ */ o(
      B,
      {
        size: i,
        icon: /* @__PURE__ */ o(y, {}),
        onClick: m,
        tooltip: s(h(D.tooltip_clear_sort))
      }
    ),
    f && /* @__PURE__ */ o(
      O,
      {
        size: i,
        icon: a ? /* @__PURE__ */ o(C, {}) : /* @__PURE__ */ o(w, {}),
        "aria-label": "refresh",
        tooltip: s(S),
        onClick: p,
        ownerState: { ...r, isDirty: n }
      }
    )
  ] });
});
x.displayName = "SortActions";
export {
  x as default
};
