import{r as P,t as an}from"./path-WJo29M9I.js";import{a as Q,c as cn,d as _,f as q,i,l as H,n as on,p as sn,r as rn,s as tn,t as en,u as un}from"./math-7EMdGNhR.js";function yn(o){return o.innerRadius}function ln(o){return o.outerRadius}function fn(o){return o.startAngle}function pn(o){return o.endAngle}function xn(o){return o&&o.padAngle}function gn(o,h,C,b,v,d,F,e){var D=C-o,a=b-h,n=F-v,p=e-d,t=p*D-n*a;if(!(t*t<1e-12))return t=(n*(h-d)-p*(o-v))/t,[o+t*D,h+t*a]}function X(o,h,C,b,v,d,F){var e=o-C,D=h-b,a=(F?d:-d)/q(e*e+D*D),n=a*D,p=-a*e,t=o+n,c=h+p,y=C+n,l=b+p,I=(t+y)/2,s=(c+l)/2,x=y-t,f=l-c,T=x*x+f*f,k=v-d,A=t*l-y*c,E=(f<0?-1:1)*q(cn(0,k*k*T-A*A)),O=(A*f-x*E)/T,R=(-A*x-f*E)/T,S=(A*f+x*E)/T,g=(-A*x+f*E)/T,m=O-I,r=R-s,u=S-I,L=g-s;return m*m+r*r>u*u+L*L&&(O=S,R=g),{cx:O,cy:R,x01:-n,y01:-p,x11:O*(v/k-1),y11:R*(v/k-1)}}function mn(){var o=yn,h=ln,C=P(0),b=null,v=fn,d=pn,F=xn,e=null,D=an(a);function a(){var n,p,t=+o.apply(this,arguments),c=+h.apply(this,arguments),y=v.apply(this,arguments)-tn,l=d.apply(this,arguments)-tn,I=en(l-y),s=l>y;if(e||(e=n=D()),c<t&&(p=c,c=t,t=p),!(c>1e-12))e.moveTo(0,0);else if(I>sn-1e-12)e.moveTo(c*Q(y),c*_(y)),e.arc(0,0,c,y,l,!s),t>1e-12&&(e.moveTo(t*Q(l),t*_(l)),e.arc(0,0,t,l,y,s));else{var x=y,f=l,T=y,k=l,A=I,E=I,O=F.apply(this,arguments)/2,R=O>1e-12&&(b?+b.apply(this,arguments):q(t*t+c*c)),S=H(en(c-t)/2,+C.apply(this,arguments)),g=S,m=S,r,u;if(R>1e-12){var L=rn(R/t*_(O)),J=rn(R/c*_(O));(A-=L*2)>1e-12?(L*=s?1:-1,T+=L,k-=L):(A=0,T=k=(y+l)/2),(E-=J*2)>1e-12?(J*=s?1:-1,x+=J,f-=J):(E=0,x=f=(y+l)/2)}var Z=c*Q(x),j=c*_(x),M=t*Q(k),N=t*_(k);if(S>1e-12){var U=c*Q(f),W=c*_(f),Y=t*Q(T),G=t*_(T),w;if(I<un)if(w=gn(Z,j,Y,G,U,W,M,N)){var K=Z-w[0],z=j-w[1],B=U-w[0],$=W-w[1],V=1/_(on((K*B+z*$)/(q(K*K+z*z)*q(B*B+$*$)))/2),nn=q(w[0]*w[0]+w[1]*w[1]);g=H(S,(t-nn)/(V-1)),m=H(S,(c-nn)/(V+1))}else g=m=0}E>1e-12?m>1e-12?(r=X(Y,G,Z,j,c,m,s),u=X(U,W,M,N,c,m,s),e.moveTo(r.cx+r.x01,r.cy+r.y01),m<S?e.arc(r.cx,r.cy,m,i(r.y01,r.x01),i(u.y01,u.x01),!s):(e.arc(r.cx,r.cy,m,i(r.y01,r.x01),i(r.y11,r.x11),!s),e.arc(0,0,c,i(r.cy+r.y11,r.cx+r.x11),i(u.cy+u.y11,u.cx+u.x11),!s),e.arc(u.cx,u.cy,m,i(u.y11,u.x11),i(u.y01,u.x01),!s))):(e.moveTo(Z,j),e.arc(0,0,c,x,f,!s)):e.moveTo(Z,j),!(t>1e-12)||!(A>1e-12)?e.lineTo(M,N):g>1e-12?(r=X(M,N,U,W,t,-g,s),u=X(Z,j,Y,G,t,-g,s),e.lineTo(r.cx+r.x01,r.cy+r.y01),g<S?e.arc(r.cx,r.cy,g,i(r.y01,r.x01),i(u.y01,u.x01),!s):(e.arc(r.cx,r.cy,g,i(r.y01,r.x01),i(r.y11,r.x11),!s),e.arc(0,0,t,i(r.cy+r.y11,r.cx+r.x11),i(u.cy+u.y11,u.cx+u.x11),s),e.arc(u.cx,u.cy,g,i(u.y11,u.x11),i(u.y01,u.x01),!s))):e.arc(0,0,t,k,T,s)}if(e.closePath(),n)return e=null,n+""||null}return a.centroid=function(){var n=(+o.apply(this,arguments)+ +h.apply(this,arguments))/2,p=(+v.apply(this,arguments)+ +d.apply(this,arguments))/2-un/2;return[Q(p)*n,_(p)*n]},a.innerRadius=function(n){return arguments.length?(o=typeof n=="function"?n:P(+n),a):o},a.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:P(+n),a):h},a.cornerRadius=function(n){return arguments.length?(C=typeof n=="function"?n:P(+n),a):C},a.padRadius=function(n){return arguments.length?(b=n==null?null:typeof n=="function"?n:P(+n),a):b},a.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:P(+n),a):v},a.endAngle=function(n){return arguments.length?(d=typeof n=="function"?n:P(+n),a):d},a.padAngle=function(n){return arguments.length?(F=typeof n=="function"?n:P(+n),a):F},a.context=function(n){return arguments.length?(e=n??null,a):e},a}export{mn as t};
