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