import { jsx as a } from "@emotion/react/jsx-runtime";
import L, { useMemo as h } from "react";
import { useModuleDictionary as C, useEnvironment as F } from "@m4l/core";
import { LABEL_BOOLEAN_YES as u, LABEL_BOOLEAN_NO as d, LABEL_BOOLEAN_TRUE as S, LABEL_BOOLEAN_FALSE as y, LABEL_BOOLEAN_ACTIVE as I, LABEL_BOOLEAN_INACTIVE as v } from "./dictionary.js";
import m from "clsx";
import { getComponentSlotRoot as i } from "../../../utils/getComponentSlotRoot.js";
import { BOOLEAN_FORMATTER_KEY_COMPONENT as e } from "./constants.js";
import { getPropDataTestId as T } from "../../../test/getNameDataTestId.js";
import { BooleanFormatterRootStyled as k, BooleanFormatterIconStyled as R, BooleanFormatterIconCheckFalseStyled as g, BooleanFormatterChipStyled as M } from "./slots/BooleanFormatterSlots.js";
import { BooleanFormatterSlots as $ } from "./slots/BooleanFormatterEnum.js";
function O(r, t = !1, o) {
  return r === "string_yes_no" ? o(t ? u : d) : r === "string_true_false" ? o(t ? S : y) : r === "chip_active_inactive" ? o(t ? I : v) : r === "chip_yes_no" ? o(t ? u : d) : "";
}
function G(r) {
  const { presentationType: t, value: o = !1, Component: _ = k, dataTestId: A, className: n, componentProps: N } = r, { getLabel: s } = C(), { host_static_assets: f, environment_assets: l } = F(), p = `${f}/${l}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_true.svg`, E = `${f}/${l}/frontend/components/data_grid/components/boolean_formatter/assets/icons/check_false.svg`, c = { value: o }, B = h(() => t === "check" ? /* @__PURE__ */ a(
    o ? R : g,
    {
      ownerState: c,
      src: o ? p : E,
      className: m(i(e), n)
    }
  ) : t === "chip_active_inactive" || t === "chip_yes_no" ? /* @__PURE__ */ a(
    M,
    {
      label: O(t, o, s),
      ownerState: c,
      className: m(i(e), n),
      color: o ? "primary" : "default",
      opacity: !0,
      variant: "contained"
    }
  ) : O(t, o, s), [o, s, t, p, E]);
  return _ === L.Fragment ? B : /* @__PURE__ */ a(
    _,
    {
      className: m(i(e), n),
      ...T(e, $.root, A),
      role: "booleanStyled-role",
      ownerState: c,
      ...N,
      children: B
    }
  );
}
export {
  G as BooleanFormatter,
  O as getFormatBoolean
};
