"use client";
import { j as e } from "./index.esm38.js";
import h from "./index.esm40.js";
import a from "./index.esm56.js";
import { Root as b } from "./index.esm8.js";
const $ = (t, o, l) => Math.min(Math.max(t, o), l), P = ({
  value: t,
  max: o = 100,
  segments: l = 10,
  size: u = "md",
  tone: g = "secondary",
  showValueLabel: p = !1,
  valueLabel: f,
  sequentialAnimation: n = !1,
  animationStepMs: x = 80,
  className: M,
  testId: v,
  "aria-label": j,
  ...y
}) => {
  const s = Math.max(1, Math.floor(o)), m = $(t, 0, s), c = Math.max(1, Math.floor(l)), N = m / s, i = Math.round(N * c), d = p ? f ?? `${Math.round(m)} / ${s}` : null;
  return /* @__PURE__ */ e.jsxs(b, { className: h(a.root, a[`root--${u}`], M), testId: v, ...y, children: [
    /* @__PURE__ */ e.jsx(
      "div",
      {
        className: a.track,
        role: "progressbar",
        "aria-label": j ?? "Progress",
        "aria-valuemin": 0,
        "aria-valuemax": s,
        "aria-valuenow": Math.round(m),
        children: /* @__PURE__ */ e.jsx("div", { className: a.segments, children: Array.from({ length: c }).map((B, r) => /* @__PURE__ */ e.jsx(
          "span",
          {
            className: h(
              a.segment,
              a[`segment--${g}`],
              r < i && a["segment--active"],
              n && r < i && a["segment--sequential"]
            ),
            style: n ? {
              "--segment-delay": `${r * x}ms`
            } : void 0,
            "aria-hidden": "true"
          },
          r
        )) })
      }
    ),
    d && /* @__PURE__ */ e.jsx("span", { className: a.valueLabel, children: d })
  ] });
};
P.displayName = "ProgressBar";
export {
  P as ProgressBar
};
//# sourceMappingURL=index.esm16.js.map
