import*as e from"react";import{createContextScope as r}from"../../react-context/dist/index.js";import{Primitive as a}from"../../react-primitive/dist/index.js";import{jsx as t}from"react/jsx-runtime";var o="Progress",n=100,[i,s]=r(o),[u,l]=i(o),d=e.forwardRef(((e,r)=>{const{__scopeProgress:o,value:i=null,max:s,getValueLabel:l=p,...d}=e;!s&&0!==s||x(s)||console.error(`Invalid prop \`max\` of value \`${`${s}`}\` supplied to \`${"Progress"}\`. Only numbers greater than 0 are valid max values. Defaulting to \`100\`.`);const m=x(s)?s:n;null===i||g(i,m)||console.error(function(e,r){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${r}\`. The \`value\` prop must be:\n  - a positive number\n  - less than the value passed to \`max\` (or 100 if no \`max\` prop is set)\n  - \`null\` or \`undefined\` if the progress is indeterminate.\n\nDefaulting to \`null\`.`}(`${i}`,"Progress"));const v=g(i,m)?i:null,h=c(v)?l(v,m):void 0;return t(u,{scope:o,value:v,max:m,children:t(a.div,{"aria-valuemax":m,"aria-valuemin":0,"aria-valuenow":c(v)?v:void 0,"aria-valuetext":h,role:"progressbar","data-state":f(v,m),"data-value":v??void 0,"data-max":m,...d,ref:r})})}));d.displayName=o;var m="ProgressIndicator",v=e.forwardRef(((e,r)=>{const{__scopeProgress:o,...n}=e,i=l(m,o);return t(a.div,{"data-state":f(i.value,i.max),"data-value":i.value??void 0,"data-max":i.max,...n,ref:r})}));function p(e,r){return`${Math.round(e/r*100)}%`}function f(e,r){return null==e?"indeterminate":e===r?"complete":"loading"}function c(e){return"number"==typeof e}function x(e){return c(e)&&!isNaN(e)&&e>0}function g(e,r){return c(e)&&!isNaN(e)&&e<=r&&e>=0}v.displayName=m;var h=d,$=v;export{$ as Indicator,d as Progress,v as ProgressIndicator,h as Root,s as createProgressScope};
//# sourceMappingURL=index.js.map
