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