import { jsx as t, jsxs as h, Fragment as k } from "@emotion/react/jsx-runtime";
import { ActionIconButtonSkeletonStyled as x, ActionIconButtonStyled as C, IconTooltipMessageStyled as I, TextTooltipMessageStyled as v } from "../../slots/ActionsGroupSlots.js";
import { useEnvironment as g, useModuleSkeleton as T } from "@m4l/core";
import { ACTIONS_GROUP_ICONS as _ } from "../../icons.js";
import { actionsGroupStyles as l } from "../../ActionsGroup.styles.js";
import { Tooltip as w } from "@m4l/base";
import { useComponentSize as z } from "@m4l/graphics";
const D = (a) => {
  const { action: e, selected: n, ownerState: i, onChange: c, groupDisabled: r } = a, { iconUrl: d, onClick: p, disabled: o, label: s } = e, { host_static_assets: m, environment_assets: f } = g(), u = T(), { currentSize: S } = z(), b = () => {
    o || (c?.(e.id), p?.(e.id));
  };
  return u ? /* @__PURE__ */ t(x, { ownerState: { ...i } }) : /* @__PURE__ */ t(
    w,
    {
      arrow: !0,
      PopperProps: {
        modifiers: [
          {
            name: "offset",
            options: {
              offset: [0, 10]
            }
          }
        ]
      },
      slotProps: {
        tooltip: {
          /**
           * Estilos del tooltip.
           */
          sx: (y) => typeof l.tooltip == "function" ? l.tooltip({ theme: y }) : {}
        }
      },
      title: /* @__PURE__ */ h(k, { children: [
        (o || r) && /* @__PURE__ */ t(
          I,
          {
            variant: "text",
            size: "small",
            src: `${m}/${f}/${_.blocked}`
          }
        ),
        /* @__PURE__ */ t(v, { variant: "bodyStandard", children: s })
      ] }),
      children: /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
        C,
        {
          ownerState: { ...i, itemSelected: n, itemDisabled: o },
          size: S,
          src: d,
          onClick: b,
          disabled: o || r,
          variant: "text",
          color: n ? "primary" : "default",
          "aria-label": s,
          "aria-pressed": n
        }
      ) })
    }
  );
};
export {
  D as ActionIconButton
};
