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