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