import{e as p,aa as _,a7 as g,B as x,x as P,ab as N,m,o as c,w as f,X as V,n as a,ac as h,am as w,a6 as b,ai as C,W as q,b as R,J as $}from"./BoB2h2qv.js";import{i as y}from"./CHIgUVhi.js";const n=100,[M,B]=N("ProgressRoot"),d=e=>typeof e=="number";function E(e,s){return y(e)||d(e)&&!Number.isNaN(e)&&e<=s&&e>=0?e:(console.error(`Invalid prop \`value\` of value \`${e}\` supplied to \`ProgressRoot\`. The \`value\` prop must be:
  - a positive number
  - less than the value passed to \`max\` (or ${n} if no \`max\` prop is set)
  - \`null\`  or \`undefined\` if the progress is indeterminate.

Defaulting to \`null\`.`),null)}function T(e){return d(e)&&!Number.isNaN(e)&&e>0?e:(console.error(`Invalid prop \`max\` of value \`${e}\` supplied to \`ProgressRoot\`. Only numbers greater than 0 are valid max values. Defaulting to \`${n}\`.`),n)}var I=p({__name:"ProgressRoot",props:{modelValue:{type:[Number,null],required:!1},max:{type:Number,required:!1,default:n},getValueLabel:{type:Function,required:!1,default:(e,s)=>d(e)?`${Math.round(e/s*n)}%`:void 0},getValueText:{type:Function,required:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["update:modelValue","update:max"],setup(e,{emit:s}){const t=e,i=s;_();const r=g(t,"modelValue",i,{passive:t.modelValue===void 0}),o=g(t,"max",i,{passive:t.max===void 0});x(()=>r.value,async l=>{const u=E(l,t.max);u!==l&&(await w(),r.value=u)},{immediate:!0}),x(()=>t.max,l=>{const u=T(t.max);u!==l&&(o.value=u)},{immediate:!0});const v=P(()=>y(r.value)?"indeterminate":r.value===o.value?"complete":"loading");return B({modelValue:r,max:o,progressState:v}),(l,u)=>(c(),m(a(h),{"as-child":l.asChild,as:l.as,"aria-valuemax":a(o),"aria-valuemin":0,"aria-valuenow":d(a(r))?a(r):void 0,"aria-valuetext":l.getValueText?.(a(r),a(o)),"aria-label":l.getValueLabel(a(r),a(o)),role:"progressbar","data-state":v.value,"data-value":a(r)??void 0,"data-max":a(o)},{default:f(()=>[V(l.$slots,"default",{modelValue:a(r)})]),_:3},8,["as-child","as","aria-valuemax","aria-valuenow","aria-valuetext","aria-label","data-state","data-value","data-max"]))}}),F=I,L=p({__name:"ProgressIndicator",props:{asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},setup(e){const s=e,t=M();return _(),(i,r)=>(c(),m(a(h),b(s,{"data-state":a(t).progressState.value,"data-value":a(t).modelValue?.value??void 0,"data-max":a(t).max.value}),{default:f(()=>[V(i.$slots,"default")]),_:3},16,["data-state","data-value","data-max"]))}}),S=L;const X=p({__name:"Progress",props:{modelValue:{default:0},max:{},getValueLabel:{},getValueText:{},asChild:{type:Boolean},as:{},class:{}},setup(e){const s=e,t=C(s,"class");return(i,r)=>(c(),m(a(F),b(a(t),{class:a(q)("relative h-4 w-full overflow-hidden rounded-full bg-secondary",s.class)}),{default:f(()=>[R(a(S),{class:"h-full w-full flex-1 bg-primary transition-all",style:$(`transform: translateX(-${100-(s.modelValue??0)}%);`)},null,8,["style"])]),_:1},16,["class"]))}});export{X as _};
