import{o as e}from"./rolldown-runtime.DAXXjFlN.js";import{r as t}from"./emotion-is-prop-valid.esm.CygBv61C.js";import{Q as n,X as r,Z as i,et as a,g as o,it as s,x as c}from"./Tooltip.DJg7muty.js";import{n as l,t as u}from"./useLabel.DF2fCezN.js";import{t as d}from"./useNumberFormatter.CHc999PL.js";function f(e){let{value:t=0,minValue:n=0,maxValue:r=100,valueLabel:i,isIndeterminate:a,formatOptions:l={style:`percent`}}=e,f=c(e,{labelable:!0}),{labelProps:p,fieldProps:m}=u({...e,labelElementType:`span`});t=o(t,n,r);let h=(t-n)/(r-n),g=d(l);if(!a&&!i){let e=l.style===`percent`?h:t;i=g.format(e)}return{progressBarProps:s(f,{...m,"aria-valuenow":a?void 0:t,"aria-valuemin":n,"aria-valuemax":r,"aria-valuetext":a?void 0:i,role:`progressbar`}),labelProps:p}}var p=e(t(),1),m=(0,p.createContext)(null),h=(0,p.forwardRef)(function(e,t){[e,t]=r(e,t,m);let{value:u=0,minValue:d=0,maxValue:h=100,isIndeterminate:g=!1}=e;u=o(u,d,h);let[_,v]=n(!e[`aria-label`]&&!e[`aria-labelledby`]),{progressBarProps:y,labelProps:b}=f({...e,label:v}),x=g?void 0:(u-d)/(h-d)*100,S=i({...e,defaultClassName:`react-aria-ProgressBar`,values:{percentage:x,valueText:y[`aria-valuetext`],isIndeterminate:g}}),C=c(e,{global:!0});return p.createElement(a.div,{...s(C,S,y),ref:t,slot:e.slot||void 0},p.createElement(l.Provider,{value:{...b,ref:_,elementType:`span`}},S.children))});export{m as n,h as t};