import { jsx as i } from "@emotion/react/jsx-runtime";
import { useMemo as z } from "react";
import { IndicatorStyled as I, TextNumberStyled as V } from "../../../../slots/StepperSlot.js";
import { useStepper as C } from "../../../../hooks/useStepper/index.js";
import { Icon as m } from "@m4l/base";
import { pathIcons as r } from "../../../../icons.js";
import { useIsMobile as M } from "@m4l/graphics";
import { useEnvironment as _ } from "@m4l/core";
import { shallow as w } from "zustand/shallow";
import { useComponentSize as B } from "../../../../../../hooks/useComponentSize/index.js";
function J($) {
  const { step: n, currentStep: e, totalSteps: h, originalStepIndex: t } = $, { orientation: x, size: T, indicatorType: s, stepValidationStatus: a } = C(
    (o) => ({
      orientation: o.orientation,
      size: o.size,
      indicatorType: o.indicatorType,
      stepValidationStatus: o.stepValidationStatus
    }),
    w
  ), { host_static_assets: c, environment_assets: d } = _(), { currentSize: b } = B(T), p = M(), u = z(() => p ? "dot" : s, [p, s]), { isCompleted: S, isValidStep: l, hasBeenValidated: f } = z(() => {
    const o = e > t, y = a[t];
    return {
      isCompleted: o,
      isValidStep: y === !0,
      hasBeenValidated: y !== void 0
    };
  }, [e, t, a]), v = {
    size: b,
    currentStep: e,
    step: n,
    totalSteps: h,
    orientation: x,
    indicatorType: s,
    stepValidationStatus: a,
    originalStepIndex: t,
    isCompleted: S,
    isCurrent: e === t,
    isValidStep: l,
    hasBeenValidated: f
  };
  return /* @__PURE__ */ i(I, { ownerState: v, children: f && !l ? (
    // Mostrar error solo si ha sido validado y es inválido
    /* @__PURE__ */ i(
      m,
      {
        src: `${c}/${d}/${r.circleError}`,
        size: "small",
        color: "error.contrastText"
      }
    )
  ) : S && l ? (
    // Mostrar completado solo si está completado Y es válido
    /* @__PURE__ */ i(
      m,
      {
        src: `${c}/${d}/${u === "number" ? r.circleCheck : r.dotOutline}`,
        size: "small",
        color: "primary.semanticText"
      }
    )
  ) : (
    // Mostrar estado normal (número o dot) para pasos no validados o actuales
    /* @__PURE__ */ i(V, { variant: "bodyStandard", ownerState: v, children: u === "number" ? (
      // Solo mostrar número si el step es visible (step >= 0)
      n >= 0 ? n + 1 : ""
    ) : /* @__PURE__ */ i(
      m,
      {
        src: `${c}/${d}/${e === t ? r.dotSelected : r.dotOutline}`,
        size: "small",
        color: e === t ? "primary.semanticText" : "text.disabled"
      }
    ) })
  ) });
}
export {
  J as Indicator
};
