"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("vue"),O=require("../../_util/hooks/useRefs.js"),x=require("../../_util/props-util/initDefaultProps.js"),C=require("./common.js"),q=require("./types.js");let v=0;function j(t){return+t.replace("%","")}function V(t){return Array.isArray(t)?t:[t]}function N(t,k,g,l,u=0,$){const e=50-l/2;let r=0,o=-e,i=0,a=-2*e;switch($){case"left":r=-e,o=0,i=2*e,a=0;break;case"right":r=e,o=0,i=-2*e,a=0;break;case"bottom":o=e,a=2*e;break}const d=`M 50,50 m ${r},${o}
   a ${e},${e} 0 1 1 ${i},${-a}
   a ${e},${e} 0 1 1 ${-i},${a}`,n=Math.PI*2*e,c={stroke:g,strokeDasharray:`${k/100*(n-u)}px ${n}px`,strokeDashoffset:`-${u/2+t/100*(n-u)}px`,transition:"stroke-dashoffset .3s ease 0s, stroke-dasharray .3s ease 0s, stroke .3s, stroke-width .06s ease .3s, opacity .3s ease 0s"};return{pathString:d,pathStyle:c}}const w=s.defineComponent({compatConfig:{MODE:3},name:"VCCircle",props:x.default(q.propTypes,C.defaultProps),setup(t){v+=1;const k=s.ref(v),g=s.computed(()=>V(t.percent)),l=s.computed(()=>V(t.strokeColor)),[u,$]=O.default();C.useTransitionDuration($);const e=()=>{const{prefixCls:r,strokeWidth:o,strokeLinecap:i,gapDegree:a,gapPosition:d}=t;let n=0;return g.value.map((c,y)=>{const f=l.value[y]||l.value[l.value.length-1],b=Object.prototype.toString.call(f)==="[object Object]"?`url(#${r}-gradient-${k.value})`:"",{pathString:P,pathStyle:h}=N(n,c,f,o,a,d);n+=c;const m={key:y,d:P,stroke:b,"stroke-linecap":i,"stroke-width":o,opacity:c===0?0:1,"fill-opacity":"0",class:`${r}-circle-path`,style:h};return s.createVNode("path",{ref:u(y),...m},null)})};return()=>{const{prefixCls:r,strokeWidth:o,trailWidth:i,gapDegree:a,gapPosition:d,trailColor:n,strokeLinecap:c,strokeColor:y,...f}=t,{pathString:b,pathStyle:P}=N(0,100,n,o,a,d);delete f.percent;const h=l.value.find(p=>Object.prototype.toString.call(p)==="[object Object]"),m={d:b,stroke:n,"stroke-linecap":c,"stroke-width":i||o,"fill-opacity":"0",class:`${r}-circle-trail`,style:P};return s.createVNode("svg",{class:`${r}-circle`,viewBox:"0 0 100 100",...f},[h&&s.createVNode("defs",null,[s.createVNode("linearGradient",{id:`${r}-gradient-${k.value}`,x1:"100%",y1:"0%",x2:"0%",y2:"0%"},[Object.keys(h).sort((p,S)=>j(p)-j(S)).map((p,S)=>s.createVNode("stop",{key:S,offset:p,"stop-color":h[p]},null))])]),s.createVNode("path",m,null),e().reverse()])}}});exports.default=w;
