import { jsx as a, jsxs as l, Fragment as p } from "@emotion/react/jsx-runtime";
import { useEnvironment as v, useModuleSkeleton as w } from "@m4l/core";
import z from "clsx";
import { LABEL_KEY_COMPONENT as _, classLabelRoot as k, LAB_SPECIFY as C } from "./constants.js";
import { useComponentSize as E } from "../../hooks/useComponentSize/index.js";
import { LabelRootStyled as x, TypographyStyled as I, TypographyMandatoryMessageStyled as j, IconHelperMessageStyled as A, SkeletonStyled as i } from "./slots/LabelSlots.js";
const P = (y) => {
  const { helperMessage: s, label: h, symbol: c, mandatory: m, mandatoryMessage: r, htmlFor: g, id: u, error: b, size: d = "medium", disabled: t, className: f } = y, { host_static_assets: M, environment_assets: L } = v(), N = w(), { currentSize: o } = E(d), S = typeof s == "string" && s.length > 0, n = o === "small" || o === "medium" ? o : "medium", e = {
    disabled: t,
    size: d
  };
  return /* @__PURE__ */ a(
    x,
    {
      "aria-label": _,
      ownerState: { ...e },
      htmlFor: g,
      id: u,
      children: N ? /* @__PURE__ */ l(p, { children: [
        /* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "rectangular", className: "SkeletonWidthLabel" }),
        m && /* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "circular", className: "MandatoryLabel" }),
        S && /* @__PURE__ */ a(i, { ownerState: { ...e }, variant: "circular", className: "HelperIconLabel" })
      ] }) : /* @__PURE__ */ l(p, { children: [
        /* @__PURE__ */ l(
          I,
          {
            className: z(k, C, "M4lclassCssSpecificity", f),
            ownerState: { ...e },
            variant: "bodyStandard",
            size: n,
            disabled: t,
            children: [
              h,
              c ? ` (${c})` : ""
            ]
          }
        ),
        m && /* @__PURE__ */ a(
          j,
          {
            ownerState: { ...e },
            variant: "bodyStandard",
            className: r ? "mandatoryMessage" : "mandatoryAsterisk",
            size: n,
            disabled: t,
            children: r || "*"
          }
        ),
        S && /* @__PURE__ */ a(
          A,
          {
            tooltipContent: s,
            ownerState: { ...e },
            placement: "right",
            size: n,
            className: b ? "helper-icon-error" : "helper-icon",
            disabled: t,
            src: `${M}/${L}/frontend/components/LabelMessage/assets/icons/infoSmall.svg`
          }
        )
      ] })
    }
  );
};
export {
  P as Label
};
