import { t as e } from "../../utils-B7XIe3qq.js";
import { t } from "../../dist-BCCeHAQm.js";
import "react";
import { jsx as n, jsxs as r } from "react/jsx-runtime";
//#region src/react/primitives/progress.tsx
var i = 2 * Math.PI * 16, a = t("relative w-full overflow-hidden rounded-full bg-surface-secondary", {
	variants: { size: {
		sm: "h-1",
		md: "h-2",
		lg: "h-3"
	} },
	defaultVariants: { size: "md" }
});
function o({ className: t, value: i, size: o = "md", label: s, showLabel: c = !1, indicatorClassName: l, secondaryLabel: u, ...d }) {
	let f = i == null, p = f ? 0 : Math.min(100, Math.max(0, i)), m = s ?? (f ? "" : `${String(p)}%`);
	return /* @__PURE__ */ r("div", {
		"data-slot": "progress",
		className: e("flex w-full flex-col gap-1", t),
		...d,
		children: [/* @__PURE__ */ r("div", {
			className: "flex w-full items-center gap-3",
			children: [/* @__PURE__ */ n("div", {
				role: "progressbar",
				"aria-valuemin": 0,
				"aria-valuemax": 100,
				"aria-valuenow": f ? void 0 : p,
				className: a({ size: o }),
				children: /* @__PURE__ */ n("div", {
					"data-slot": "progress-indicator",
					className: e("h-full rounded-full bg-primary transition-all duration-500 ease-out", f && "animate-progress-indeterminate w-1/3", l),
					style: f ? void 0 : { width: `${String(p)}%` }
				})
			}), c && m && /* @__PURE__ */ n("span", {
				className: "shrink-0 text-xs tabular-nums text-foreground-secondary",
				children: m
			})]
		}), u && /* @__PURE__ */ n("span", {
			"data-slot": "progress-secondary-label",
			className: "text-xs text-muted-foreground",
			children: u
		})]
	});
}
var s = {
	sm: {
		size: 28,
		strokeWidth: 3,
		textClass: "text-[8px]"
	},
	md: {
		size: 40,
		strokeWidth: 3,
		textClass: "text-[10px]"
	},
	lg: {
		size: 56,
		strokeWidth: 4,
		textClass: "text-xs"
	}
};
function c({ className: t, value: a, size: o = "md", label: c, showLabel: l = !1, indicatorClassName: u, ...d }) {
	let f = a == null, p = f ? 0 : Math.min(100, Math.max(0, a)), m = c ?? (f ? "" : `${String(p)}%`), h = f ? i * .75 : i * (1 - p / 100), g = s[o];
	return /* @__PURE__ */ r("div", {
		"data-slot": "circular-progress",
		role: "progressbar",
		"aria-valuemin": 0,
		"aria-valuemax": 100,
		"aria-valuenow": f ? void 0 : p,
		className: e("relative inline-flex items-center justify-center", t),
		style: {
			width: g.size,
			height: g.size
		},
		...d,
		children: [/* @__PURE__ */ r("svg", {
			viewBox: "0 0 36 36",
			className: e("size-full -rotate-90", f && "animate-spin"),
			children: [/* @__PURE__ */ n("circle", {
				cx: "18",
				cy: "18",
				r: "16",
				fill: "none",
				strokeWidth: g.strokeWidth,
				className: "stroke-surface-secondary"
			}), /* @__PURE__ */ n("circle", {
				cx: "18",
				cy: "18",
				r: "16",
				fill: "none",
				strokeWidth: g.strokeWidth,
				strokeLinecap: "round",
				strokeDasharray: i,
				strokeDashoffset: h,
				className: e("stroke-primary transition-[stroke-dashoffset] duration-500 ease-out", u)
			})]
		}), l && m && /* @__PURE__ */ n("span", {
			className: e("absolute font-medium tabular-nums text-foreground-secondary", g.textClass),
			children: m
		})]
	});
}
//#endregion
export { c as CircularProgress, o as Progress };

//# sourceMappingURL=progress.js.map