inventions / assets /arc-e9CDfmPt.js
admin08077's picture
Upload 39 files
07a53c5 verified
import{aL as ln,aM as an,aN as y,aa as tn,aO as W,aP as O,aQ as _,aR as un,a9 as N,aS as rn,aT as z,aU as o,aV as sn,aW as on,aX as fn}from"./index-BXIz7y_C.js";function cn(l){return l.innerRadius}function yn(l){return l.outerRadius}function gn(l){return l.startAngle}function mn(l){return l.endAngle}function pn(l){return l&&l.padAngle}function dn(l,h,D,S,v,R,Q,a){var E=D-l,i=S-h,n=Q-v,m=a-R,u=m*E-n*i;if(!(u*u<y))return u=(n*(h-R)-m*(l-v))/u,[l+u*E,h+u*i]}function J(l,h,D,S,v,R,Q){var a=l-D,E=h-S,i=(Q?R:-R)/z(a*a+E*E),n=i*E,m=-i*a,u=l+n,s=h+m,f=D+n,c=S+m,U=(u+f)/2,t=(s+c)/2,p=f-u,g=c-s,A=p*p+g*g,T=v-R,P=u*c-f*s,I=(g<0?-1:1)*z(fn(0,T*T*A-P*P)),L=(P*g-p*I)/A,M=(-P*p-g*I)/A,w=(P*g+p*I)/A,d=(-P*p+g*I)/A,x=L-U,e=M-t,r=w-U,V=d-t;return x*x+e*e>r*r+V*V&&(L=w,M=d),{cx:L,cy:M,x01:-n,y01:-m,x11:L*(v/T-1),y11:M*(v/T-1)}}function hn(){var l=cn,h=yn,D=N(0),S=null,v=gn,R=mn,Q=pn,a=null,E=ln(i);function i(){var n,m,u=+l.apply(this,arguments),s=+h.apply(this,arguments),f=v.apply(this,arguments)-an,c=R.apply(this,arguments)-an,U=un(c-f),t=c>f;if(a||(a=n=E()),s<u&&(m=s,s=u,u=m),!(s>y))a.moveTo(0,0);else if(U>tn-y)a.moveTo(s*W(f),s*O(f)),a.arc(0,0,s,f,c,!t),u>y&&(a.moveTo(u*W(c),u*O(c)),a.arc(0,0,u,c,f,t));else{var p=f,g=c,A=f,T=c,P=U,I=U,L=Q.apply(this,arguments)/2,M=L>y&&(S?+S.apply(this,arguments):z(u*u+s*s)),w=_(un(s-u)/2,+D.apply(this,arguments)),d=w,x=w,e,r;if(M>y){var V=sn(M/u*O(L)),B=sn(M/s*O(L));(P-=V*2)>y?(V*=t?1:-1,A+=V,T-=V):(P=0,A=T=(f+c)/2),(I-=B*2)>y?(B*=t?1:-1,p+=B,g-=B):(I=0,p=g=(f+c)/2)}var X=s*W(p),j=s*O(p),C=u*W(T),F=u*O(T);if(w>y){var G=s*W(g),H=s*O(g),K=u*W(A),Y=u*O(A),q;if(U<rn)if(q=dn(X,j,K,Y,G,H,C,F)){var Z=X-q[0],$=j-q[1],k=G-q[0],b=H-q[1],nn=1/O(on((Z*k+$*b)/(z(Z*Z+$*$)*z(k*k+b*b)))/2),en=z(q[0]*q[0]+q[1]*q[1]);d=_(w,(u-en)/(nn-1)),x=_(w,(s-en)/(nn+1))}else d=x=0}I>y?x>y?(e=J(K,Y,X,j,s,x,t),r=J(G,H,C,F,s,x,t),a.moveTo(e.cx+e.x01,e.cy+e.y01),x<w?a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,x,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,s,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),!t),a.arc(r.cx,r.cy,x,o(r.y11,r.x11),o(r.y01,r.x01),!t))):(a.moveTo(X,j),a.arc(0,0,s,p,g,!t)):a.moveTo(X,j),!(u>y)||!(P>y)?a.lineTo(C,F):d>y?(e=J(C,F,G,H,u,-d,t),r=J(X,j,K,Y,u,-d,t),a.lineTo(e.cx+e.x01,e.cy+e.y01),d<w?a.arc(e.cx,e.cy,d,o(e.y01,e.x01),o(r.y01,r.x01),!t):(a.arc(e.cx,e.cy,d,o(e.y01,e.x01),o(e.y11,e.x11),!t),a.arc(0,0,u,o(e.cy+e.y11,e.cx+e.x11),o(r.cy+r.y11,r.cx+r.x11),t),a.arc(r.cx,r.cy,d,o(r.y11,r.x11),o(r.y01,r.x01),!t))):a.arc(0,0,u,T,A,t)}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)+ +R.apply(this,arguments))/2-rn/2;return[W(m)*n,O(m)*n]},i.innerRadius=function(n){return arguments.length?(l=typeof n=="function"?n:N(+n),i):l},i.outerRadius=function(n){return arguments.length?(h=typeof n=="function"?n:N(+n),i):h},i.cornerRadius=function(n){return arguments.length?(D=typeof n=="function"?n:N(+n),i):D},i.padRadius=function(n){return arguments.length?(S=n==null?null:typeof n=="function"?n:N(+n),i):S},i.startAngle=function(n){return arguments.length?(v=typeof n=="function"?n:N(+n),i):v},i.endAngle=function(n){return arguments.length?(R=typeof n=="function"?n:N(+n),i):R},i.padAngle=function(n){return arguments.length?(Q=typeof n=="function"?n:N(+n),i):Q},i.context=function(n){return arguments.length?(a=n??null,i):a},i}export{hn as a};