import { jsx as r, jsxs as c, Fragment as w } from "react/jsx-runtime";
import { useRef as C } from "react";
import { a as d } from "./Label-BPLFvUwR.es.js";
import { a as F } from "./ProgressBar-DByVsgd2.es.js";
import { createSlotRecipeContext as V, mergeRefs as j } from "@chakra-ui/react";
import { useSlotRecipe as H } from "@chakra-ui/react/styled-system";
import { e as D } from "./extract-style-props-CMyV-es-.es.js";
import { $ as G } from "./useObjectRef-CaJ5pgjX.es.js";
import { F as I } from "./flex-BqxAMF-7.es.js";
import { B as L } from "./box-DuBoAZvq.es.js";
const { withProvider: N, withContext: t } = /* @__PURE__ */ V({
  key: "nimbusProgressBar"
}), O = /* @__PURE__ */ N("div", "root"), q = /* @__PURE__ */ t("div", "track"), z = /* @__PURE__ */ t("div", "fill"), m = /* @__PURE__ */ t("span", "label"), f = /* @__PURE__ */ t("span", "value"), A = (l) => {
  const {
    ref: p,
    value: s,
    minValue: h = 0,
    maxValue: P = 100,
    isDynamic: u = !0,
    isIndeterminate: e,
    label: o,
    formatOptions: b = { style: "percent" },
    variant: g = "solid",
    layout: i = "stacked",
    colorPalette: x = "primary",
    ...B
  } = l, $ = H({ key: "nimbusProgressBar" }), [y, S] = $.splitVariantProps({
    variant: g,
    colorPalette: x,
    ...l
  }), [v] = D(S), R = C(null), k = G(j(R, p));
  return /* @__PURE__ */ r(
    O,
    {
      ...y,
      ...v,
      isDynamic: u,
      isIndeterminate: e,
      asChild: !0,
      children: /* @__PURE__ */ r(
        F,
        {
          ref: k,
          value: s,
          minValue: h,
          maxValue: P,
          isIndeterminate: e,
          formatOptions: b,
          ...B,
          children: ({ percentage: a, valueText: n }) => /* @__PURE__ */ c(w, { children: [
            i === "stacked" && /* @__PURE__ */ c(I, { children: [
              o && /* @__PURE__ */ r(m, { asChild: !0, children: /* @__PURE__ */ r(d, { children: o }) }),
              /* @__PURE__ */ r(L, { flexGrow: "1" }),
              o && s && /* @__PURE__ */ r(f, { children: n })
            ] }),
            i === "inline" && o && /* @__PURE__ */ r(m, { lineHeight: "1", asChild: !0, children: /* @__PURE__ */ r(d, { children: o }) }),
            /* @__PURE__ */ r(q, { children: /* @__PURE__ */ r(
              z,
              {
                style: { width: e ? "40%" : `${a}%` },
                "data-indeterminate": e,
                "data-complete": !e && a !== void 0 && a >= 100
              }
            ) }),
            i === "inline" && s && /* @__PURE__ */ r(f, { lineHeight: "1", children: n })
          ] })
        }
      )
    }
  );
};
A.displayName = "ProgressBar";
export {
  A as P
};
//# sourceMappingURL=progress-bar-DN8o_d_N.es.js.map
