import{b as A,R as y,d as M,a as V,o as l,c as d,n as i,f as s,q as p,al as f,h as B,aa as N,g as P,e as D,w as O,r as R,E as j,j as o,cZ as q,b4 as J,bQ as Q,b5 as U,b6 as Z,bd as G,J as I,l as H}from"./index-BKKvzUDD.js";const K=A({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:y(String),default:"round"},textInside:Boolean,width:{type:Number,default:126},showText:{type:Boolean,default:!0},color:{type:y([String,Array,Function]),default:""},striped:Boolean,stripedFlow:Boolean,format:{type:y(Function),default:e=>`${e}%`}}),X=["aria-valuenow"],Y={viewBox:"0 0 100 100"},_=["d","stroke","stroke-linecap","stroke-width"],ee=["d","stroke","opacity","stroke-linecap","stroke-width"],te={key:0};var ae=M({name:"ElProgress",__name:"progress",props:K,setup(e){const k={success:"#13ce66",exception:"#ff4949",warning:"#e6a23c",default:"#20a0ff"},a=e,r=V("progress"),T=o(()=>{const t={width:`${a.percentage}%`,animationDuration:`${a.duration}s`},n=x(a.percentage);return n.includes("gradient")?t.background=n:t.backgroundColor=n,t}),v=o(()=>(a.strokeWidth/a.width*100).toFixed(1)),b=o(()=>["circle","dashboard"].includes(a.type)?Number.parseInt(`${50-Number.parseFloat(v.value)/2}`,10):0),m=o(()=>{const t=b.value,n=a.type==="dashboard";return`
          M 50 50
          m 0 ${n?"":"-"}${t}
          a ${t} ${t} 0 1 1 0 ${n?"-":""}${t*2}
          a ${t} ${t} 0 1 1 0 ${n?"":"-"}${t*2}
          `}),h=o(()=>2*Math.PI*b.value),g=o(()=>a.type==="dashboard"?.75:1),w=o(()=>`${-1*h.value*(1-g.value)/2}px`),C=o(()=>({strokeDasharray:`${h.value*g.value}px, ${h.value}px`,strokeDashoffset:w.value})),F=o(()=>({strokeDasharray:`${h.value*g.value*(a.percentage/100)}px, ${h.value}px`,strokeDashoffset:w.value,transition:"stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"})),E=o(()=>{let t;return a.color?t=x(a.percentage):t=k[a.status]||k.default,t}),W=o(()=>a.status==="warning"?q:a.type==="line"?a.status==="success"?J:Q:a.status==="success"?U:Z),z=o(()=>a.type==="line"?12+a.strokeWidth*.4:a.width*.111111+2),$=o(()=>a.format(a.percentage));function L(t){const n=100/t.length;return t.map((c,u)=>I(c)?{color:c,percentage:(u+1)*n}:c).sort((c,u)=>c.percentage-u.percentage)}const x=t=>{var c;const{color:n}=a;if(G(n))return n(t);if(I(n))return n;{const u=L(n);for(const S of u)if(S.percentage>t)return S.color;return(c=u[u.length-1])==null?void 0:c.color}};return(t,n)=>(l(),d("div",{class:i([s(r).b(),s(r).m(e.type),s(r).is(e.status),{[s(r).m("without-text")]:!e.showText,[s(r).m("text-inside")]:e.textInside}]),role:"progressbar","aria-valuenow":e.percentage,"aria-valuemin":"0","aria-valuemax":"100"},[e.type==="line"?(l(),d("div",{key:0,class:i(s(r).b("bar"))},[p("div",{class:i(s(r).be("bar","outer")),style:f({height:`${e.strokeWidth}px`})},[p("div",{class:i([s(r).be("bar","inner"),{[s(r).bem("bar","inner","indeterminate")]:e.indeterminate},{[s(r).bem("bar","inner","striped")]:e.striped},{[s(r).bem("bar","inner","striped-flow")]:e.stripedFlow}]),style:f(T.value)},[(e.showText||t.$slots.default)&&e.textInside?(l(),d("div",{key:0,class:i(s(r).be("bar","innerText"))},[B(t.$slots,"default",{percentage:e.percentage},()=>[p("span",null,N($.value),1)])],2)):P("v-if",!0)],6)],6)],2)):(l(),d("div",{key:1,class:i(s(r).b("circle")),style:f({height:`${e.width}px`,width:`${e.width}px`})},[(l(),d("svg",Y,[p("path",{class:i(s(r).be("circle","track")),d:m.value,stroke:`var(${s(r).cssVarName("fill-color-light")}, #e5e9f2)`,"stroke-linecap":e.strokeLinecap,"stroke-width":v.value,fill:"none",style:f(C.value)},null,14,_),p("path",{class:i(s(r).be("circle","path")),d:m.value,stroke:E.value,fill:"none",opacity:e.percentage?1:0,"stroke-linecap":e.strokeLinecap,"stroke-width":v.value,style:f(F.value)},null,14,ee)]))],6)),(e.showText||t.$slots.default)&&!e.textInside?(l(),d("div",{key:2,class:i(s(r).e("text")),style:f({fontSize:`${z.value}px`})},[B(t.$slots,"default",{percentage:e.percentage},()=>[e.status?(l(),D(s(j),{key:1},{default:O(()=>[(l(),D(R(W.value)))]),_:1})):(l(),d("span",te,N($.value),1))])],6)):P("v-if",!0)],10,X))}}),se=ae;const ne=H(se);export{ne as E};
