"use client";
'use strict';

var classVarianceAuthority = require('class-variance-authority');
var clsx = require('clsx');
var tailwindMerge = require('tailwind-merge');
var jsxRuntime = require('react/jsx-runtime');

var __defProp = Object.defineProperty;
var __defProps = Object.defineProperties;
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
  for (var prop in b || (b = {}))
    if (__hasOwnProp.call(b, prop))
      __defNormalProp(a, prop, b[prop]);
  if (__getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(b)) {
      if (__propIsEnum.call(b, prop))
        __defNormalProp(a, prop, b[prop]);
    }
  return a;
};
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
var __objRest = (source, exclude) => {
  var target = {};
  for (var prop in source)
    if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
      target[prop] = source[prop];
  if (source != null && __getOwnPropSymbols)
    for (var prop of __getOwnPropSymbols(source)) {
      if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
        target[prop] = source[prop];
    }
  return target;
};
function cn(...inputs) {
  return tailwindMerge.twMerge(clsx.clsx(inputs));
}
var SEGMENT_COUNT = 10;
var progressBarVariants = classVarianceAuthority.cva("flex w-full flex-col gap-2", {
  variants: {
    variant: {
      linear: "",
      dashed: ""
    }
  },
  defaultVariants: {
    variant: "linear"
  }
});
function ProgressBar(_a) {
  var _b = _a, {
    className,
    variant = "linear",
    value = 0,
    label,
    caption,
    hideValue = false
  } = _b, props = __objRest(_b, [
    "className",
    "variant",
    "value",
    "label",
    "caption",
    "hideValue"
  ]);
  const clampedValue = Math.max(0, Math.min(100, value));
  return /* @__PURE__ */ jsxRuntime.jsxs(
    "div",
    __spreadProps(__spreadValues({
      role: "progressbar",
      "aria-valuenow": clampedValue,
      "aria-valuemin": 0,
      "aria-valuemax": 100,
      "aria-label": label != null ? label : "Progress",
      "data-slot": "progress-bar",
      className: cn(progressBarVariants({ variant }), className)
    }, props), {
      children: [
        (label || !hideValue) && /* @__PURE__ */ jsxRuntime.jsxs(ProgressBarHeader, { children: [
          label && /* @__PURE__ */ jsxRuntime.jsx(ProgressBarLabel, { children: label }),
          !hideValue && /* @__PURE__ */ jsxRuntime.jsxs(ProgressBarValue, { children: [
            clampedValue,
            "%"
          ] })
        ] }),
        variant === "dashed" ? /* @__PURE__ */ jsxRuntime.jsx(ProgressBarDashedTrack, { value: clampedValue }) : /* @__PURE__ */ jsxRuntime.jsx(ProgressBarLinearTrack, { value: clampedValue }),
        caption && /* @__PURE__ */ jsxRuntime.jsx(ProgressBarCaption, { children: caption })
      ]
    })
  );
}
function ProgressBarHeader(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadValues({
      "data-slot": "progress-bar-header",
      className: cn("flex w-full items-center justify-between", className)
    }, props)
  );
}
function ProgressBarLabel(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "span",
    __spreadValues({
      "data-slot": "progress-bar-label",
      className: cn(
        "text-sm font-medium leading-5 capitalize text-[var(--theme-text-primary,#111115)]",
        className
      )
    }, props)
  );
}
function ProgressBarValue(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "span",
    __spreadValues({
      "data-slot": "progress-bar-value",
      className: cn(
        "ml-auto text-sm font-normal leading-5 tabular-nums text-[var(--theme-text-secondary,#6f6f77)]",
        className
      )
    }, props)
  );
}
function ProgressBarLinearTrack(_a) {
  var _b = _a, {
    className,
    value
  } = _b, props = __objRest(_b, [
    "className",
    "value"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "progress-bar-track",
      className: cn(
        "relative h-1 w-full overflow-hidden rounded-full bg-muted",
        className
      )
    }, props), {
      children: /* @__PURE__ */ jsxRuntime.jsx(
        "div",
        {
          "data-slot": "progress-bar-indicator",
          className: "absolute inset-y-0 left-0 rounded-full bg-primary transition-all duration-300 ease-out",
          style: { width: `${value}%` }
        }
      )
    })
  );
}
function ProgressBarDashedTrack(_a) {
  var _b = _a, {
    className,
    value
  } = _b, props = __objRest(_b, [
    "className",
    "value"
  ]);
  const filledSegments = Math.round(value / 100 * SEGMENT_COUNT);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "div",
    __spreadProps(__spreadValues({
      "data-slot": "progress-bar-track",
      className: cn(
        "flex h-1 w-full items-center gap-1 overflow-hidden",
        className
      )
    }, props), {
      children: Array.from({ length: SEGMENT_COUNT }, (_, i) => /* @__PURE__ */ jsxRuntime.jsx(
        "div",
        {
          "data-slot": "progress-bar-segment",
          "data-filled": i < filledSegments || void 0,
          className: cn(
            "h-1 min-h-px min-w-px flex-1 rounded-full transition-colors duration-200",
            i < filledSegments ? "bg-primary" : "bg-muted"
          )
        },
        i
      ))
    })
  );
}
function ProgressBarCaption(_a) {
  var _b = _a, {
    className
  } = _b, props = __objRest(_b, [
    "className"
  ]);
  return /* @__PURE__ */ jsxRuntime.jsx(
    "p",
    __spreadValues({
      "data-slot": "progress-bar-caption",
      className: cn(
        "text-xs font-normal leading-4 text-[var(--theme-text-secondary,#6f6f77)]",
        className
      )
    }, props)
  );
}

exports.ProgressBar = ProgressBar;
exports.ProgressBarCaption = ProgressBarCaption;
exports.ProgressBarDashedTrack = ProgressBarDashedTrack;
exports.ProgressBarHeader = ProgressBarHeader;
exports.ProgressBarLabel = ProgressBarLabel;
exports.ProgressBarLinearTrack = ProgressBarLinearTrack;
exports.ProgressBarValue = ProgressBarValue;
exports.progressBarVariants = progressBarVariants;
//# sourceMappingURL=progress.cjs.map
//# sourceMappingURL=progress.cjs.map