import { jsxs as s, Fragment as f, jsx as r } from "@emotion/react/jsx-runtime";
import { useModuleDictionary as d } from "@m4l/core";
import { useMemo as u } from "react";
import { useFormContext as c, useWatch as _ } from "react-hook-form";
import { DATE_TIME_OPERATORS as O } from "../../../constants.js";
import { DYNAMIC_FILTER_DICTIONARY_ID as b, DICCTIONARY as a } from "../../../dictionary.js";
import { useDynamicFilterStore as T } from "../../../store/useDynamicFilterStore.js";
import { RHFAutocomplete as D } from "../../../../hook-form/RHFAutocomplete/RHFAutocomplete.js";
import { RHFDateTime as m } from "../../../../hook-form/RHFDateTime/RHFDateTime.js";
function y() {
  const { getLabel: o } = d(), { control: l } = c(), t = T((e) => e.popoverFilterData?.field)?.restritcOperatorsTo, i = _({
    control: l,
    name: "formValueOperator"
  }), p = u(
    () => O.map((e) => ({
      id: e,
      label: o(`${b}.operator_${e}`)
    })).filter((e) => t ? t.includes(e.id) : !0),
    [o, t]
  );
  return /* @__PURE__ */ s(f, { children: [
    /* @__PURE__ */ r(
      D,
      {
        type: "text",
        name: "formValueOperator",
        autoComplete: "off",
        options: p,
        getOptionLabel: (e) => e.label,
        isOptionEqualToValue: (e, n) => e.id === n.id,
        label: o(a.label_operator_date_time)
      }
    ),
    /* @__PURE__ */ r(
      m,
      {
        name: "formValueOperand1",
        label: o(a.label_operand1_date_time)
      }
    ),
    i && i.id === "b" && /* @__PURE__ */ r(
      m,
      {
        name: "formValueOperand2",
        label: o(a.label_operand2_date_time)
      }
    )
  ] });
}
export {
  y as DateTimeFilter
};
