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