import { jsxs as n, Fragment as c, jsx as p } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as f } from "@m4l/core";
import { useMemo as u } from "react";
import { SELECT_OPERATORS_MULTIPLE as O, SELECT_OPERATORS_SINGLE as _ } from "../../../constants.js";
import { DYNAMIC_FILTER_DICTIONARY_ID as d, DICCTIONARY as a } from "../../../dictionary.js";
import { useDynamicFilterStore as T } from "../../../store/useDynamicFilterStore.js";
import { RHFAutocomplete as E } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
import { RHFSelect as b } from "../../../../hook-form/RHFSelect/RHFSelect.js";
function y() {
  const { getLabel: o } = f(), r = T((e) => e.popoverFilterData?.field), i = r?.selectOptions, t = i?.multiple ?? !1, l = r?.restritcOperatorsTo, s = u(
    () => (t ? O : _).map((e) => ({
      id: e,
      label: o(`${d}.operator_${e}`)
    })).filter((e) => l ? l.includes(e.id) : !0),
    [o, t, l]
  );
  return /* @__PURE__ */ n(c, { children: [
    /* @__PURE__ */ p(
      E,
      {
        type: "text",
        name: "formValueOperator",
        autoComplete: "off",
        options: s,
        getOptionLabel: (e) => e.label,
        isOptionEqualToValue: (e, m) => e.id === m.id,
        label: o(a.label_select_operator)
      }
    ),
    /* @__PURE__ */ p(
      b,
      {
        ...i,
        options: r?.selectOptions?.options || [],
        name: t ? "formValueOperandsArray" : "formValueOperand1",
        label: o(t ? a.label_select_operands_array : a.label_select_operand1)
      }
    )
  ] });
}
export {
  y as SelectFilter
};
