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