import{Br as e,C as t,E as n,H as r,Ht as i,O as a,Or as o,Pr as s,Ut as c,W as l,ar as u,cr as d,di as f,jr as p,lr as m,mi as h,nt as g,oi as _,or as v,p as y,pi as b,pr as x,sr as S,ti as C,ui as w,w as T}from"./style-QAnagFj5.js";var E=i({type:{type:String,default:`line`,values:[`line`,`circle`,`dashboard`]},percentage:{type:Number,default:0,validator:e=>e>=0&&e<=100},status:{type:String,default:``,values:[``,`success`,`exception`,`warning`]},indeterminate:Boolean,duration:{type:Number,default:3},strokeWidth:{type:Number,default:6},strokeLinecap:{type:c(String),default:`round`},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:c([String,Array,Function]),default:``},striped:Boolean,stripedFlow:Boolean,format:{type:c(Function),default:e=>`${e}%`}}),D=[`aria-valuenow`],O={viewBox:`0 0 100 100`},k=[`d`,`stroke`,`stroke-linecap`,`stroke-width`],A=[`d`,`stroke`,`opacity`,`stroke-linecap`,`stroke-width`],j={key:0},M=l(x({name:`ElProgress`,__name:`progress`,props:E,setup(i){let c={success:`#13ce66`,exception:`#ff4949`,warning:`#e6a23c`,default:`#20a0ff`},l=i,x=g(`progress`),E=u(()=>{let e={width:`${l.percentage}%`,animationDuration:`${l.duration}s`},t=G(l.percentage);return t.includes(`gradient`)?e.background=t:e.backgroundColor=t,e}),M=u(()=>(l.strokeWidth/l.width*100).toFixed(1)),N=u(()=>[`circle`,`dashboard`].includes(l.type)?Number.parseInt(`${50-Number.parseFloat(M.value)/2}`,10):0),P=u(()=>{let e=N.value,t=l.type===`dashboard`;return`
          M 50 50
          m 0 ${t?``:`-`}${e}
          a ${e} ${e} 0 1 1 0 ${t?`-`:``}${e*2}
          a ${e} ${e} 0 1 1 0 ${t?``:`-`}${e*2}
          `}),F=u(()=>2*Math.PI*N.value),I=u(()=>l.type===`dashboard`?.75:1),L=u(()=>`${-1*F.value*(1-I.value)/2}px`),R=u(()=>({strokeDasharray:`${F.value*I.value}px, ${F.value}px`,strokeDashoffset:L.value})),z=u(()=>({strokeDasharray:`${F.value*I.value*(l.percentage/100)}px, ${F.value}px`,strokeDashoffset:L.value,transition:`stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s`})),B=u(()=>{let e;return e=l.color?G(l.percentage):c[l.status]||c.default,e}),V=u(()=>l.status===`warning`?r:l.type===`line`?l.status===`success`?T:n:l.status===`success`?t:a),H=u(()=>l.type===`line`?12+l.strokeWidth*.4:l.width*.111111+2),U=u(()=>l.format(l.percentage));function W(e){let t=100/e.length;return e.map((e,n)=>w(e)?{color:e,percentage:(n+1)*t}:e).sort((e,t)=>e.percentage-t.percentage)}let G=e=>{let{color:t}=l;if(_(t))return t(e);if(w(t))return t;{let n=W(t);for(let t of n)if(t.percentage>e)return t.color;return n[n.length-1]?.color}};return(t,n)=>(o(),m(`div`,{class:f([C(x).b(),C(x).m(i.type),C(x).is(i.status),{[C(x).m(`without-text`)]:!i.showText,[C(x).m(`text-inside`)]:i.textInside}]),role:`progressbar`,"aria-valuenow":i.percentage,"aria-valuemin":`0`,"aria-valuemax":`100`},[i.type===`line`?(o(),m(`div`,{key:0,class:f(C(x).b(`bar`))},[v(`div`,{class:f(C(x).be(`bar`,`outer`)),style:b({height:`${i.strokeWidth}px`})},[v(`div`,{class:f([C(x).be(`bar`,`inner`),{[C(x).bem(`bar`,`inner`,`indeterminate`)]:i.indeterminate},{[C(x).bem(`bar`,`inner`,`striped`)]:i.striped},{[C(x).bem(`bar`,`inner`,`striped-flow`)]:i.stripedFlow}]),style:b(E.value)},[(i.showText||t.$slots.default)&&i.textInside?(o(),m(`div`,{key:0,class:f(C(x).be(`bar`,`innerText`))},[p(t.$slots,`default`,{percentage:i.percentage},()=>[v(`span`,null,h(U.value),1)])],2)):d(`v-if`,!0)],6)],6)],2)):(o(),m(`div`,{key:1,class:f(C(x).b(`circle`)),style:b({height:`${i.width}px`,width:`${i.width}px`})},[(o(),m(`svg`,O,[v(`path`,{class:f(C(x).be(`circle`,`track`)),d:P.value,stroke:`var(${C(x).cssVarName(`fill-color-light`)}, #e5e9f2)`,"stroke-linecap":i.strokeLinecap,"stroke-width":M.value,fill:`none`,style:b(R.value)},null,14,k),v(`path`,{class:f(C(x).be(`circle`,`path`)),d:P.value,stroke:B.value,fill:`none`,opacity:i.percentage?1:0,"stroke-linecap":i.strokeLinecap,"stroke-width":M.value,style:b(z.value)},null,14,A)]))],6)),(i.showText||t.$slots.default)&&!i.textInside?(o(),m(`div`,{key:2,class:f(C(x).e(`text`)),style:b({fontSize:`${H.value}px`})},[p(t.$slots,`default`,{percentage:i.percentage},()=>[i.status?(o(),S(C(y),{key:1},{default:e(()=>[(o(),S(s(V.value)))]),_:1})):(o(),m(`span`,j,h(U.value),1))])],6)):d(`v-if`,!0)],10,D))}}));export{M as t};