!(function(){var E5=Object.defineProperty,B5=Object.defineProperties;var b5=Object.getOwnPropertyDescriptors;var oM=Object.getOwnPropertySymbols;var x5=Object.prototype.hasOwnProperty,C5=Object.prototype.propertyIsEnumerable;var QA=Math.pow,j1=(X,et,M)=>et in X?E5(X,et,{enumerable:!0,configurable:!0,writable:!0,value:M}):X[et]=M,ru=(X,et)=>{for(var M in et||(et={}))x5.call(et,M)&&j1(X,M,et[M]);if(oM)for(var M of oM(et))C5.call(et,M)&&j1(X,M,et[M]);return X},Y1=(X,et)=>B5(X,b5(et));var yr=(X,et,M)=>j1(X,typeof et!="symbol"?et+"":et,M);(self.webpackChunk=self.webpackChunk||[]).push([[7743],{32568:function(X,et,M){"use strict";M.d(et,{kJ:function(){return G0},RN:function(){return i5}});var O={};M.r(O),M.d(O,{add:function(){return Yh},adjoint:function(){return Lt},clone:function(){return Ee},copy:function(){return He},create:function(){return te},decompose:function(){return au},determinant:function(){return ee},equals:function(){return tv},exactEquals:function(){return Kr},frob:function(){return jh},fromQuat:function(){return _A},fromQuat2:function(){return ti},fromRotation:function(){return Xi},fromRotationTranslation:function(){return $r},fromRotationTranslationScale:function(){return co},fromRotationTranslationScaleOrigin:function(){return uo},fromScaling:function(){return Dn},fromTranslation:function(){return Tr},fromValues:function(){return je},fromXRotation:function(){return Ji},fromYRotation:function(){return fn},fromZRotation:function(){return wr},frustum:function(){return su},getRotation:function(){return Wo},getScaling:function(){return ks},getTranslation:function(){return Rn},identity:function(){return Ie},invert:function(){return on},lookAt:function(){return Zh},mul:function(){return ho},multiply:function(){return he},multiplyScalar:function(){return q0},multiplyScalarAndAdd:function(){return $0},ortho:function(){return lu},orthoNO:function(){return Au},orthoZO:function(){return cu},perspective:function(){return ou},perspectiveFromFieldOfView:function(){return za},perspectiveNO:function(){return Vl},perspectiveZO:function(){return Y0},rotate:function(){return Qn},rotateX:function(){return Zn},rotateY:function(){return qn},rotateZ:function(){return kr},scale:function(){return Jn},set:function(){return Wn},str:function(){return J0},sub:function(){return ev},subtract:function(){return uu},targetTo:function(){return X0},translate:function(){return se},transpose:function(){return De}});var W={};M.r(W),M.d(W,{circle:function(){return Lk},diamond:function(){return Nk},rect:function(){return Qk},simple:function(){return Pk},triangle:function(){return rx},triangleRect:function(){return Uk},vee:function(){return kk}});var H=M(33885),L=M(67732),I=M(83652),N=M(94480),P=M(22214),k=M(42403),U=M(42978),Z=M(37271),V=Z,Y=1e-6,nt=typeof Float32Array!="undefined"?Float32Array:Array,rt=Math.random,ft="zyx";function ct(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}function it(r){nt=r}var vt=Math.PI/180,gt=180/Math.PI;function yt(r){return r*vt}function mt(r){return r*gt}function Mt(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Y;return Math.abs(r-t)<=e*Math.max(1,Math.abs(r),Math.abs(t))}function Ct(){var r=new nt(3);return nt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Nt(r){var t=new nt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function qt(r){var t=r[0],e=r[1],n=r[2];return Math.sqrt(t*t+e*e+n*n)}function Gt(r,t,e){var n=new nt(3);return n[0]=r,n[1]=t,n[2]=e,n}function re(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function de(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function ue(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Me(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function Ve(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function dn(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r}function Xn(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r}function Xr(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r}function Vi(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r}function is(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r}function Ao(r,t){return r[0]=glMatrix.round(t[0]),r[1]=glMatrix.round(t[1]),r[2]=glMatrix.round(t[2]),r}function Ht(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function zt(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r}function Zt(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return Math.sqrt(e*e+n*n+i*i)}function Et(r,t){var e=t[0]-r[0],n=t[1]-r[1],i=t[2]-r[2];return e*e+n*n+i*i}function It(r){var t=r[0],e=r[1],n=r[2];return t*t+e*e+n*n}function Ut(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r}function ne(r,t){return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r}function be(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function _e(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Te(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],A=e[2];return r[0]=i*A-a*o,r[1]=a*s-n*A,r[2]=n*o-i*s,r}function rn(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function rr(r,t,e,n){var i=Math.acos(Math.min(Math.max(_e(t,e),-1),1)),a=Math.sin(i),s=Math.sin((1-n)*i)/a,o=Math.sin(n*i)/a;return r[0]=s*t[0]+o*e[0],r[1]=s*t[1]+o*e[1],r[2]=s*t[2]+o*e[2],r}function sr(r,t,e,n,i,a){var s=a*a,o=s*(2*a-3)+1,A=s*(a-2)+a,l=s*(a-1),c=s*(3-2*a);return r[0]=t[0]*o+e[0]*A+n[0]*l+i[0]*c,r[1]=t[1]*o+e[1]*A+n[1]*l+i[1]*c,r[2]=t[2]*o+e[2]*A+n[2]*l+i[2]*c,r}function Ge(r,t,e,n,i,a){var s=1-a,o=s*s,A=a*a,l=o*s,c=3*a*o,u=3*A*s,h=A*a;return r[0]=t[0]*l+e[0]*c+n[0]*u+i[0]*h,r[1]=t[1]*l+e[1]*c+n[1]*u+i[1]*h,r[2]=t[2]*l+e[2]*c+n[2]*u+i[2]*h,r}function Ke(r,t){t=t===void 0?1:t;var e=glMatrix.RANDOM()*2*Math.PI,n=glMatrix.RANDOM()*2-1,i=Math.sqrt(1-n*n)*t;return r[0]=Math.cos(e)*i,r[1]=Math.sin(e)*i,r[2]=n*t,r}function me(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function We(r,t,e){var n=t[0],i=t[1],a=t[2];return r[0]=n*e[0]+i*e[3]+a*e[6],r[1]=n*e[1]+i*e[4]+a*e[7],r[2]=n*e[2]+i*e[5]+a*e[8],r}function Gr(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],A=t[1],l=t[2],c=i*l-a*A,u=a*o-n*l,h=n*A-i*o;return c=c+c,u=u+u,h=h+h,r[0]=o+s*c+i*h-a*u,r[1]=A+s*u+a*c-n*h,r[2]=l+s*h+n*u-i*c,r}function Wi(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=a[0]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function pe(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=a[0]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function Ga(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2],a[0]=i[0]*Math.cos(n)-i[1]*Math.sin(n),a[1]=i[0]*Math.sin(n)+i[1]*Math.cos(n),a[2]=i[2],r[0]=a[0]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function Nr(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2],A=Math.sqrt((e*e+n*n+i*i)*(a*a+s*s+o*o)),l=A&&_e(r,t)/A;return Math.acos(Math.min(Math.max(l,-1),1))}function Mr(r){return r[0]=0,r[1]=0,r[2]=0,r}function di(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function as(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function Zi(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2];return Math.abs(e-a)<=Y*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=Y*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=Y*Math.max(1,Math.abs(i),Math.abs(o))}var ss=Me,Ii=null,Jr=null,ma=Zt,ya=null,aa=qt,wa=null,qr=function(){var r=Ct();return function(t,e,n,i,a,s){var o,A;for(e||(e=3),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;o0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function q(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]*t[3]}function x(r,t,e,n){var i=e[0]*n[1]-e[1]*n[0],a=e[0]*n[2]-e[2]*n[0],s=e[0]*n[3]-e[3]*n[0],o=e[1]*n[2]-e[2]*n[1],A=e[1]*n[3]-e[3]*n[1],l=e[2]*n[3]-e[3]*n[2],c=t[0],u=t[1],h=t[2],d=t[3];return r[0]=u*l-h*A+d*o,r[1]=-(c*l)+h*s-d*a,r[2]=c*A-u*s+d*i,r[3]=-(c*o)+u*a-h*i,r}function S(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r[3]=o+n*(e[3]-o),r}function y(r,t){t=t===void 0?1:t;var e,n,i,a,s,o,A;A=glMatrix.RANDOM(),e=A*2-1,n=(4*glMatrix.RANDOM()-2)*Math.sqrt(A*-A+A),s=e*e+n*n,A=glMatrix.RANDOM(),i=A*2-1,a=(4*glMatrix.RANDOM()-2)*Math.sqrt(A*-A+A),o=i*i+a*a;var l=Math.sqrt((1-s)/o);return r[0]=t*e,r[1]=t*n,r[2]=t*i*l,r[3]=t*a*l,r}function T(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3];return r[0]=e[0]*n+e[4]*i+e[8]*a+e[12]*s,r[1]=e[1]*n+e[5]*i+e[9]*a+e[13]*s,r[2]=e[2]*n+e[6]*i+e[10]*a+e[14]*s,r[3]=e[3]*n+e[7]*i+e[11]*a+e[15]*s,r}function R(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],A=t[1],l=t[2],c=i*l-a*A,u=a*o-n*l,h=n*A-i*o;return c=c+c,u=u+u,h=h+h,r[0]=o+s*c+i*h-a*u,r[1]=A+s*u+a*c-n*h,r[2]=l+s*h+n*u-i*c,r[3]=t[3],r}function st(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function ot(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function ut(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]}function ht(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=t[0],o=t[1],A=t[2],l=t[3];return Math.abs(e-s)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(n-o)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-A)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(A))&&Math.abs(a-l)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))}var kt=null,Bt=null,jt=null,ce=null,Kt=null,$t=null,Ce=null,St=function(){var r=or();return function(t,e,n,i,a,s){var o,A;for(e||(e=4),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;o0?(e[0]=(o*s+c*n+A*a-l*i)*2/u,e[1]=(A*s+c*i+l*n-o*a)*2/u,e[2]=(l*s+c*a+o*i-A*n)*2/u):(e[0]=(o*s+c*n+A*a-l*i)*2,e[1]=(A*s+c*i+l*n-o*a)*2,e[2]=(l*s+c*a+o*i-A*n)*2),$r(r,t,e),r}function Rn(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function ks(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],A=t[8],l=t[9],c=t[10];return r[0]=Math.sqrt(e*e+n*n+i*i),r[1]=Math.sqrt(a*a+s*s+o*o),r[2]=Math.sqrt(A*A+l*l+c*c),r}function Wo(r,t){var e=new nt(3);ks(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,A=t[2]*a,l=t[4]*n,c=t[5]*i,u=t[6]*a,h=t[8]*n,d=t[9]*i,f=t[10]*a,g=s+c+f,v=0;return g>0?(v=Math.sqrt(g+1)*2,r[3]=.25*v,r[0]=(u-d)/v,r[1]=(h-A)/v,r[2]=(o-l)/v):s>c&&s>f?(v=Math.sqrt(1+s-c-f)*2,r[3]=(u-d)/v,r[0]=.25*v,r[1]=(o+l)/v,r[2]=(h+A)/v):c>f?(v=Math.sqrt(1+c-s-f)*2,r[3]=(h-A)/v,r[0]=(o+l)/v,r[1]=.25*v,r[2]=(u+d)/v):(v=Math.sqrt(1+f-s-c)*2,r[3]=(o-l)/v,r[0]=(h+A)/v,r[1]=(u+d)/v,r[2]=.25*v),r}function au(r,t,e,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];var i=n[0],a=n[1],s=n[2],o=n[4],A=n[5],l=n[6],c=n[8],u=n[9],h=n[10];e[0]=Math.sqrt(i*i+a*a+s*s),e[1]=Math.sqrt(o*o+A*A+l*l),e[2]=Math.sqrt(c*c+u*u+h*h);var d=1/e[0],f=1/e[1],g=1/e[2],v=i*d,m=a*f,w=s*g,C=o*d,F=A*f,Q=l*g,D=c*d,K=u*f,G=h*g,J=v+F+G,$=0;return J>0?($=Math.sqrt(J+1)*2,r[3]=.25*$,r[0]=(Q-K)/$,r[1]=(D-w)/$,r[2]=(m-C)/$):v>F&&v>G?($=Math.sqrt(1+v-F-G)*2,r[3]=(Q-K)/$,r[0]=.25*$,r[1]=(m+C)/$,r[2]=(D+w)/$):F>G?($=Math.sqrt(1+F-v-G)*2,r[3]=(D-w)/$,r[0]=(m+C)/$,r[1]=.25*$,r[2]=(Q+K)/$):($=Math.sqrt(1+G-v-F)*2,r[3]=(m-C)/$,r[0]=(D+w)/$,r[1]=(Q+K)/$,r[2]=.25*$),r}function co(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],A=i+i,l=a+a,c=s+s,u=i*A,h=i*l,d=i*c,f=a*l,g=a*c,v=s*c,m=o*A,w=o*l,C=o*c,F=n[0],Q=n[1],D=n[2];return r[0]=(1-(f+v))*F,r[1]=(h+C)*F,r[2]=(d-w)*F,r[3]=0,r[4]=(h-C)*Q,r[5]=(1-(u+v))*Q,r[6]=(g+m)*Q,r[7]=0,r[8]=(d+w)*D,r[9]=(g-m)*D,r[10]=(1-(u+f))*D,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function uo(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],A=t[3],l=a+a,c=s+s,u=o+o,h=a*l,d=a*c,f=a*u,g=s*c,v=s*u,m=o*u,w=A*l,C=A*c,F=A*u,Q=n[0],D=n[1],K=n[2],G=i[0],J=i[1],$=i[2],at=(1-(g+m))*Q,At=(d+F)*Q,pt=(f-C)*Q,wt=(d-F)*D,bt=(1-(h+m))*D,Rt=(v+w)*D,Pt=(f+C)*K,xt=(v-w)*K,Ft=(1-(h+g))*K;return r[0]=at,r[1]=At,r[2]=pt,r[3]=0,r[4]=wt,r[5]=bt,r[6]=Rt,r[7]=0,r[8]=Pt,r[9]=xt,r[10]=Ft,r[11]=0,r[12]=e[0]+G-(at*G+wt*J+Pt*$),r[13]=e[1]+J-(At*G+bt*J+xt*$),r[14]=e[2]+$-(pt*G+Rt*J+Ft*$),r[15]=1,r}function _A(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,A=i+i,l=e*s,c=n*s,u=n*o,h=i*s,d=i*o,f=i*A,g=a*s,v=a*o,m=a*A;return r[0]=1-u-f,r[1]=c+m,r[2]=h-v,r[3]=0,r[4]=c-m,r[5]=1-l-f,r[6]=d+g,r[7]=0,r[8]=h+v,r[9]=d-g,r[10]=1-l-u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function su(r,t,e,n,i,a,s){var o=1/(e-t),A=1/(i-n),l=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*A,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*A,r[10]=(s+a)*l,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*l,r[15]=0,r}function Vl(r,t,e,n,i){var a=1/Math.tan(t/2);if(r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0){var s=1/(n-i);r[10]=(i+n)*s,r[14]=2*i*n*s}else r[10]=-1,r[14]=-2*n;return r}var ou=Vl;function Y0(r,t,e,n,i){var a=1/Math.tan(t/2);if(r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0){var s=1/(n-i);r[10]=i*s,r[14]=i*n*s}else r[10]=-1,r[14]=-n;return r}function za(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),A=2/(s+o),l=2/(i+a);return r[0]=A,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=-((s-o)*A*.5),r[9]=(i-a)*l*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function Au(r,t,e,n,i,a,s){var o=1/(t-e),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*l,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*A,r[14]=(s+a)*l,r[15]=1,r}var lu=Au;function cu(r,t,e,n,i,a,s){var o=1/(t-e),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=l,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*A,r[14]=a*l,r[15]=1,r}function Zh(r,t,e,n){var i,a,s,o,A,l,c,u,h,d,f=t[0],g=t[1],v=t[2],m=n[0],w=n[1],C=n[2],F=e[0],Q=e[1],D=e[2];return Math.abs(f-F)0&&(d=1/Math.sqrt(d),c*=d,u*=d,h*=d);var f=A*h-l*u,g=l*c-o*h,v=o*u-A*c;return d=f*f+g*g+v*v,d>0&&(d=1/Math.sqrt(d),f*=d,g*=d,v*=d),r[0]=f,r[1]=g,r[2]=v,r[3]=0,r[4]=u*v-h*g,r[5]=h*f-c*v,r[6]=c*g-u*f,r[7]=0,r[8]=c,r[9]=u,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function J0(r){return"mat4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+", "+r[9]+", "+r[10]+", "+r[11]+", "+r[12]+", "+r[13]+", "+r[14]+", "+r[15]+")"}function jh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]+r[3]*r[3]+r[4]*r[4]+r[5]*r[5]+r[6]*r[6]+r[7]*r[7]+r[8]*r[8]+r[9]*r[9]+r[10]*r[10]+r[11]*r[11]+r[12]*r[12]+r[13]*r[13]+r[14]*r[14]+r[15]*r[15])}function Yh(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r[9]=t[9]+e[9],r[10]=t[10]+e[10],r[11]=t[11]+e[11],r[12]=t[12]+e[12],r[13]=t[13]+e[13],r[14]=t[14]+e[14],r[15]=t[15]+e[15],r}function uu(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r[9]=t[9]-e[9],r[10]=t[10]-e[10],r[11]=t[11]-e[11],r[12]=t[12]-e[12],r[13]=t[13]-e[13],r[14]=t[14]-e[14],r[15]=t[15]-e[15],r}function q0(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r[9]=t[9]*e,r[10]=t[10]*e,r[11]=t[11]*e,r[12]=t[12]*e,r[13]=t[13]*e,r[14]=t[14]*e,r[15]=t[15]*e,r}function $0(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r[9]=t[9]+e[9]*n,r[10]=t[10]+e[10]*n,r[11]=t[11]+e[11]*n,r[12]=t[12]+e[12]*n,r[13]=t[13]+e[13]*n,r[14]=t[14]+e[14]*n,r[15]=t[15]+e[15]*n,r}function Kr(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]}function tv(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],A=r[6],l=r[7],c=r[8],u=r[9],h=r[10],d=r[11],f=r[12],g=r[13],v=r[14],m=r[15],w=t[0],C=t[1],F=t[2],Q=t[3],D=t[4],K=t[5],G=t[6],J=t[7],$=t[8],at=t[9],At=t[10],pt=t[11],wt=t[12],bt=t[13],Rt=t[14],Pt=t[15];return Math.abs(e-w)<=Y*Math.max(1,Math.abs(e),Math.abs(w))&&Math.abs(n-C)<=Y*Math.max(1,Math.abs(n),Math.abs(C))&&Math.abs(i-F)<=Y*Math.max(1,Math.abs(i),Math.abs(F))&&Math.abs(a-Q)<=Y*Math.max(1,Math.abs(a),Math.abs(Q))&&Math.abs(s-D)<=Y*Math.max(1,Math.abs(s),Math.abs(D))&&Math.abs(o-K)<=Y*Math.max(1,Math.abs(o),Math.abs(K))&&Math.abs(A-G)<=Y*Math.max(1,Math.abs(A),Math.abs(G))&&Math.abs(l-J)<=Y*Math.max(1,Math.abs(l),Math.abs(J))&&Math.abs(c-$)<=Y*Math.max(1,Math.abs(c),Math.abs($))&&Math.abs(u-at)<=Y*Math.max(1,Math.abs(u),Math.abs(at))&&Math.abs(h-At)<=Y*Math.max(1,Math.abs(h),Math.abs(At))&&Math.abs(d-pt)<=Y*Math.max(1,Math.abs(d),Math.abs(pt))&&Math.abs(f-wt)<=Y*Math.max(1,Math.abs(f),Math.abs(wt))&&Math.abs(g-bt)<=Y*Math.max(1,Math.abs(g),Math.abs(bt))&&Math.abs(v-Rt)<=Y*Math.max(1,Math.abs(v),Math.abs(Rt))&&Math.abs(m-Pt)<=Y*Math.max(1,Math.abs(m),Math.abs(Pt))}var ho=he,ev=uu;function Xh(){var r=new nt(9);return nt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function nv(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[4],r[4]=t[5],r[5]=t[6],r[6]=t[8],r[7]=t[9],r[8]=t[10],r}function q1(r){var t=new glMatrix.ARRAY_TYPE(9);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t}function hu(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r}function Wl(r,t,e,n,i,a,s,o,A){var l=new nt(9);return l[0]=r,l[1]=t,l[2]=e,l[3]=n,l[4]=i,l[5]=a,l[6]=s,l[7]=o,l[8]=A,l}function rv(r,t,e,n,i,a,s,o,A,l){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=A,r[8]=l,r}function $1(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function fo(r,t){if(r===t){var e=t[1],n=t[2],i=t[5];r[1]=t[3],r[2]=t[6],r[3]=e,r[5]=t[7],r[6]=n,r[7]=i}else r[0]=t[0],r[1]=t[3],r[2]=t[6],r[3]=t[1],r[4]=t[4],r[5]=t[7],r[6]=t[2],r[7]=t[5],r[8]=t[8];return r}function du(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8],u=c*s-o*l,h=-c*a+o*A,d=l*a-s*A,f=e*u+n*h+i*d;return f?(f=1/f,r[0]=u*f,r[1]=(-c*n+i*l)*f,r[2]=(o*n-i*s)*f,r[3]=h*f,r[4]=(c*e-i*A)*f,r[5]=(-o*e+i*a)*f,r[6]=d*f,r[7]=(-l*e+n*A)*f,r[8]=(s*e-n*a)*f,r):null}function Jh(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8];return r[0]=s*c-o*l,r[1]=i*l-n*c,r[2]=n*o-i*s,r[3]=o*A-a*c,r[4]=e*c-i*A,r[5]=i*a-e*o,r[6]=a*l-s*A,r[7]=n*A-e*l,r[8]=e*s-n*a,r}function tw(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],A=r[7],l=r[8];return t*(l*a-s*A)+e*(-l*i+s*o)+n*(A*i-a*o)}function ew(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=e[0],d=e[1],f=e[2],g=e[3],v=e[4],m=e[5],w=e[6],C=e[7],F=e[8];return r[0]=h*n+d*s+f*l,r[1]=h*i+d*o+f*c,r[2]=h*a+d*A+f*u,r[3]=g*n+v*s+m*l,r[4]=g*i+v*o+m*c,r[5]=g*a+v*A+m*u,r[6]=w*n+C*s+F*l,r[7]=w*i+C*o+F*c,r[8]=w*a+C*A+F*u,r}function nw(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=e[0],d=e[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=s,r[4]=o,r[5]=A,r[6]=h*n+d*s+l,r[7]=h*i+d*o+c,r[8]=h*a+d*A+u,r}function rw(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=Math.sin(e),d=Math.cos(e);return r[0]=d*n+h*s,r[1]=d*i+h*o,r[2]=d*a+h*A,r[3]=d*s-h*n,r[4]=d*o-h*i,r[5]=d*A-h*a,r[6]=l,r[7]=c,r[8]=u,r}function iw(r,t,e){var n=e[0],i=e[1];return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=i*t[3],r[4]=i*t[4],r[5]=i*t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r}function aw(r,t){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=1,r[5]=0,r[6]=t[0],r[7]=t[1],r[8]=1,r}function sw(r,t){var e=Math.sin(t),n=Math.cos(t);return r[0]=n,r[1]=e,r[2]=0,r[3]=-e,r[4]=n,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function ow(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=t[1],r[5]=0,r[6]=0,r[7]=0,r[8]=1,r}function Aw(r,t){return r[0]=t[0],r[1]=t[1],r[2]=0,r[3]=t[2],r[4]=t[3],r[5]=0,r[6]=t[4],r[7]=t[5],r[8]=1,r}function lw(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,A=i+i,l=e*s,c=n*s,u=n*o,h=i*s,d=i*o,f=i*A,g=a*s,v=a*o,m=a*A;return r[0]=1-u-f,r[3]=c-m,r[6]=h+v,r[1]=c+m,r[4]=1-l-f,r[7]=d-g,r[2]=h-v,r[5]=d+g,r[8]=1-l-u,r}function cw(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],f=t[12],g=t[13],v=t[14],m=t[15],w=e*o-n*s,C=e*A-i*s,F=e*l-a*s,Q=n*A-i*o,D=n*l-a*o,K=i*l-a*A,G=c*g-u*f,J=c*v-h*f,$=c*m-d*f,at=u*v-h*g,At=u*m-d*g,pt=h*m-d*v,wt=w*pt-C*At+F*at+Q*$-D*J+K*G;return wt?(wt=1/wt,r[0]=(o*pt-A*At+l*at)*wt,r[1]=(A*$-s*pt-l*J)*wt,r[2]=(s*At-o*$+l*G)*wt,r[3]=(i*At-n*pt-a*at)*wt,r[4]=(e*pt-i*$+a*J)*wt,r[5]=(n*$-e*At-a*G)*wt,r[6]=(g*K-v*D+m*Q)*wt,r[7]=(v*F-f*K-m*C)*wt,r[8]=(f*D-g*F+m*w)*wt,r):null}function uw(r,t,e){return r[0]=2/t,r[1]=0,r[2]=0,r[3]=0,r[4]=-2/e,r[5]=0,r[6]=-1,r[7]=1,r[8]=1,r}function fu(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function hw(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]+r[3]*r[3]+r[4]*r[4]+r[5]*r[5]+r[6]*r[6]+r[7]*r[7]+r[8]*r[8])}function dw(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r[3]=t[3]+e[3],r[4]=t[4]+e[4],r[5]=t[5]+e[5],r[6]=t[6]+e[6],r[7]=t[7]+e[7],r[8]=t[8]+e[8],r}function fw(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r[3]=t[3]-e[3],r[4]=t[4]-e[4],r[5]=t[5]-e[5],r[6]=t[6]-e[6],r[7]=t[7]-e[7],r[8]=t[8]-e[8],r}function gw(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r[3]=t[3]*e,r[4]=t[4]*e,r[5]=t[5]*e,r[6]=t[6]*e,r[7]=t[7]*e,r[8]=t[8]*e,r}function vw(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r}function pw(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]}function mw(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],A=r[6],l=r[7],c=r[8],u=t[0],h=t[1],d=t[2],f=t[3],g=t[4],v=t[5],m=t[6],w=t[7],C=t[8];return Math.abs(e-u)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(n-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-f)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-g)<=glMatrix.EPSILON*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(o-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(A-m)<=glMatrix.EPSILON*Math.max(1,Math.abs(A),Math.abs(m))&&Math.abs(l-w)<=glMatrix.EPSILON*Math.max(1,Math.abs(l),Math.abs(w))&&Math.abs(c-C)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(C))}var yw=null,qh=null;function Er(){var r=new nt(4);return nt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function iv(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function sa(r,t,e){e=e*.5;var n=Math.sin(e);return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=Math.cos(e),r}function HA(r,t){var e=Math.acos(t[3])*2,n=Math.sin(e/2);return n>glMatrix.EPSILON?(r[0]=t[0]/n,r[1]=t[1]/n,r[2]=t[2]/n):(r[0]=1,r[1]=0,r[2]=0),e}function $n(r,t){var e=Ps(r,t);return Math.acos(2*e*e-1)}function Qs(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],A=e[1],l=e[2],c=e[3];return r[0]=n*c+s*o+i*l-a*A,r[1]=i*c+s*A+a*o-n*l,r[2]=a*c+s*l+n*A-i*o,r[3]=s*c-n*o-i*A-a*l,r}function $h(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A+s*o,r[1]=i*A+a*o,r[2]=a*A-i*o,r[3]=s*A-n*o,r}function av(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A-a*o,r[1]=i*A+s*o,r[2]=a*A+n*o,r[3]=s*A-i*o,r}function GA(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A+i*o,r[1]=i*A-n*o,r[2]=a*A+s*o,r[3]=s*A-a*o,r}function os(r,t){var e=t[0],n=t[1],i=t[2];return r[0]=e,r[1]=n,r[2]=i,r[3]=Math.sqrt(Math.abs(1-e*e-n*n-i*i)),r}function sv(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=Math.sqrt(e*e+n*n+i*i),o=Math.exp(a),A=s>0?o*Math.sin(s)/s:0;return r[0]=e*A,r[1]=n*A,r[2]=i*A,r[3]=o*Math.cos(s),r}function Us(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=Math.sqrt(e*e+n*n+i*i),o=s>0?Math.atan2(s,a)/s:0;return r[0]=e*o,r[1]=n*o,r[2]=i*o,r[3]=.5*Math.log(e*e+n*n+i*i+a*a),r}function Qr(r,t,e){return Us(r,t),oa(r,r,e),sv(r,r),r}function Zl(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],A=e[0],l=e[1],c=e[2],u=e[3],h,d,f,g,v;return d=i*A+a*l+s*c+o*u,d<0&&(d=-d,A=-A,l=-l,c=-c,u=-u),1-d>Y?(h=Math.acos(d),f=Math.sin(h),g=Math.sin((1-n)*h)/f,v=Math.sin(n*h)/f):(g=1-n,v=n),r[0]=g*i+v*A,r[1]=g*a+v*l,r[2]=g*s+v*c,r[3]=g*o+v*u,r}function fi(r){var t=glMatrix.RANDOM(),e=glMatrix.RANDOM(),n=glMatrix.RANDOM(),i=Math.sqrt(1-t),a=Math.sqrt(t);return r[0]=i*Math.sin(2*Math.PI*e),r[1]=i*Math.cos(2*Math.PI*e),r[2]=a*Math.sin(2*Math.PI*n),r[3]=a*Math.cos(2*Math.PI*n),r}function KA(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e+n*n+i*i+a*a,o=s?1/s:0;return r[0]=-e*o,r[1]=-n*o,r[2]=-i*o,r[3]=a*o,r}function go(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r}function zA(r,t){var e=t[0]+t[4]+t[8],n;if(e>0)n=Math.sqrt(e+1),r[3]=.5*n,n=.5/n,r[0]=(t[5]-t[7])*n,r[1]=(t[6]-t[2])*n,r[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+s]-t[s*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[s]=(t[s*3+i]+t[i*3+s])*n}return r}function Gn(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:ft,a=Math.PI/360;t*=a,n*=a,e*=a;var s=Math.sin(t),o=Math.cos(t),A=Math.sin(e),l=Math.cos(e),c=Math.sin(n),u=Math.cos(n);switch(i){case"xyz":r[0]=s*l*u+o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u-s*A*c;break;case"xzy":r[0]=s*l*u-o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u+s*A*c;break;case"yxz":r[0]=s*l*u+o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u+s*A*c;break;case"yzx":r[0]=s*l*u+o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u-s*A*c;break;case"zxy":r[0]=s*l*u-o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u-s*A*c;break;case"zyx":r[0]=s*l*u-o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u+s*A*c;break;default:throw new Error("Unknown angle order "+i)}return r}function ov(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var Av=Ko,td=ji,VA=Yi,WA=lo,lv=Ka,gu=Qs,oa=Hl,Ps=q,vo=S,ei=Ea,po=null,cv=RA,uv=null,Zo=zl,hv=ut;function ww(r,t){return Math.abs(vec4.dot(r,t))>=1-glMatrix.EPSILON}var jl=function(){var r=Ct(),t=Gt(1,0,0),e=Gt(0,1,0);return function(n,i,a){var s=_e(i,a);return s<-.999999?(Te(r,t,i),aa(r)<1e-6&&Te(r,e,i),be(r,r),sa(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Te(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Zo(n,n))}}(),Ds=function(){var r=Er(),t=Er();return function(e,n,i,a,s,o){return Zl(r,n,s,o),Zl(t,i,a,o),Zl(e,r,t,2*o*(1-o)),e}}(),Ew=function(){var r=Xh();return function(t,e,n,i){return r[0]=n[0],r[3]=n[1],r[6]=n[2],r[1]=i[0],r[4]=i[1],r[7]=i[2],r[2]=-e[0],r[5]=-e[1],r[8]=-e[2],Zo(t,zA(t,r))}}();function vu(){var r=new nt(2);return nt!=Float32Array&&(r[0]=0,r[1]=0),r}function pu(r){var t=new glMatrix.ARRAY_TYPE(2);return t[0]=r[0],t[1]=r[1],t}function dv(r,t){var e=new glMatrix.ARRAY_TYPE(2);return e[0]=r,e[1]=t,e}function fv(r,t){return r[0]=t[0],r[1]=t[1],r}function gv(r,t,e){return r[0]=t,r[1]=e,r}function Va(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r}function vv(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r}function Bw(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r}function bw(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r}function mu(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r}function xw(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r}function pv(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r}function mv(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r}function yv(r,t){return r[0]=glMatrix.round(t[0]),r[1]=glMatrix.round(t[1]),r}function wv(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r}function Ev(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r}function Bv(r,t){var e=t[0]-r[0],n=t[1]-r[1];return Math.sqrt(e*e+n*n)}function bv(r,t){var e=t[0]-r[0],n=t[1]-r[1];return e*e+n*n}function xv(r){var t=r[0],e=r[1];return Math.sqrt(t*t+e*e)}function Cw(r){var t=r[0],e=r[1];return t*t+e*e}function yu(r,t){return r[0]=-t[0],r[1]=-t[1],r}function Sw(r,t){return r[0]=1/t[0],r[1]=1/t[1],r}function Cv(r,t){var e=t[0],n=t[1],i=e*e+n*n;return i>0&&(i=1/Math.sqrt(i)),r[0]=t[0]*i,r[1]=t[1]*i,r}function wu(r,t){return r[0]*t[0]+r[1]*t[1]}function Mw(r,t,e){var n=t[0]*e[1]-t[1]*e[0];return r[0]=r[1]=0,r[2]=n,r}function Sv(r,t,e,n){var i=t[0],a=t[1];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r}function Tw(r,t){t=t===void 0?1:t;var e=glMatrix.RANDOM()*2*Math.PI;return r[0]=Math.cos(e)*t,r[1]=Math.sin(e)*t,r}function Fw(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[2]*i,r[1]=e[1]*n+e[3]*i,r}function Ow(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[2]*i+e[4],r[1]=e[1]*n+e[3]*i+e[5],r}function Iw(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[3]*i+e[6],r[1]=e[1]*n+e[4]*i+e[7],r}function Lw(r,t,e){var n=t[0],i=t[1];return r[0]=e[0]*n+e[4]*i+e[12],r[1]=e[1]*n+e[5]*i+e[13],r}function ZA(r,t,e,n){var i=t[0]-e[0],a=t[1]-e[1],s=Math.sin(n),o=Math.cos(n);return r[0]=i*o-a*s+e[0],r[1]=i*s+a*o+e[1],r}function Nw(r,t){var e=r[0],n=r[1],i=t[0],a=t[1];return Math.abs(Math.atan2(n*i-e*a,e*i+n*a))}function kw(r,t){var e=r[0],n=r[1],i=t[0],a=t[1];return Math.atan2(e*a-n*i,e*i+n*a)}function Eu(r){return r[0]=0,r[1]=0,r}function Qw(r){return"vec2("+r[0]+", "+r[1]+")"}function Mv(r,t){return r[0]===t[0]&&r[1]===t[1]}function Uw(r,t){var e=r[0],n=r[1],i=t[0],a=t[1];return Math.abs(e-i)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(i))&&Math.abs(n-a)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(a))}var Pw=null,Bu=null,Dw=null,Rw=null,_w=null,Hw=null,bu=null,Gw=function(){var r=vu();return function(t,e,n,i,a,s){var o,A;for(e||(e=2),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;oe?e:r},hr=Tv,z=M(80813),jA={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function ed(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return jA[e]===t.length-1&&"achlmqstvz".includes(e)})}function nd(r){return ed(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function rd(r){return nd(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}var id={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function ad(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=jA[e]&&(e==="m"&&n.length>2?(r.segments.push([t].concat(n.splice(0,2))),e="l",t=t==="m"?"l":"L"):r.segments.push([t].concat(n.splice(0,jA[e]))),!!jA[e]););}function Fv(r){var t=r.index,e=r.pathValue,n=e.charCodeAt(t);if(n===48){r.param=0,r.index+=1;return}if(n===49){r.param=1,r.index+=1;return}r.err='[path-util]: invalid Arc flag "'.concat(e[t],'", expecting 0 or 1 at index ').concat(t)}function Yl(r){return r>=48&&r<=57||r===43||r===45||r===46}function jo(r){return r>=48&&r<=57}function Ov(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,A=!1,l;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(l=e.charCodeAt(i),(l===43||l===45)&&(i+=1,l=e.charCodeAt(i)),!jo(l)&&l!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(l!==46){if(a=l===48,i+=1,l=e.charCodeAt(i),a&&i=5760&&t.includes(r)}function Xl(r){for(var t=r.pathValue,e=r.max;r.index0;s-=1){if(xu(i)&&(s===3||s===4)?Fv(r):Ov(r),r.err.length)return;r.data.push(r.param),Xl(r),r.index=r.max||!Yl(e.charCodeAt(r.index)))break}ad(r)}var Lv=function(){function r(t){this.pathValue=t,this.segments=[],this.max=t.length,this.index=0,this.param=0,this.segmentStart=0,this.data=[],this.err=""}return r}();function Nv(r){if(ed(r))return[].concat(r);var t=new Lv(r);for(Xl(t);t.index=a)s={x:e,y:n};else{var o=Rs([r,t],[e,n],i/a),A=o[0],l=o[1];s={x:A,y:l}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function od(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),A=e*a-n*i<0?-1:1,l=A*Math.acos(s/o);return l}function Uv(r,t,e,n,i,a,s,o,A,l){var c=Math.abs,u=Math.sin,h=Math.cos,d=Math.sqrt,f=Math.PI,g=c(e),v=c(n),m=(i%360+360)%360,w=m*(f/180);if(r===o&&t===A)return{x:r,y:t};if(g===0||v===0)return Yo(r,t,o,A,l).point;var C=(r-o)/2,F=(t-A)/2,Q={x:h(w)*C+u(w)*F,y:-u(w)*C+h(w)*F},D=Math.pow(Q.x,2)/Math.pow(g,2)+Math.pow(Q.y,2)/Math.pow(v,2);D>1&&(g*=d(D),v*=d(D));var K=Math.pow(g,2)*Math.pow(v,2)-Math.pow(g,2)*Math.pow(Q.y,2)-Math.pow(v,2)*Math.pow(Q.x,2),G=Math.pow(g,2)*Math.pow(Q.y,2)+Math.pow(v,2)*Math.pow(Q.x,2),J=K/G;J=J<0?0:J;var $=(a!==s?1:-1)*d(J),at={x:$*(g*Q.y/v),y:$*(-(v*Q.x)/g)},At={x:h(w)*at.x-u(w)*at.y+(r+o)/2,y:u(w)*at.x+h(w)*at.y+(t+A)/2},pt={x:(Q.x-at.x)/g,y:(Q.y-at.y)/v},wt=od({x:1,y:0},pt),bt={x:(-Q.x-at.x)/g,y:(-Q.y-at.y)/v},Rt=od(pt,bt);!s&&Rt>0?Rt-=2*f:s&&Rt<0&&(Rt+=2*f),Rt%=2*f;var Pt=wt+Rt*l,xt=g*h(Pt),Ft=v*u(Pt),_t={x:h(w)*xt-u(w)*Ft+At.x,y:u(w)*xt+h(w)*Ft+At.y};return _t}function Pv(r,t,e,n,i,a,s,o,A,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,g=f===void 0?!0:f,v=c.sampleSize,m=v===void 0?30:v,w=typeof l=="number",C=r,F=t,Q=0,D=[C,F,Q],K=[C,F],G=0,J={x:0,y:0},$=[{x:C,y:F}];w&&l<=0&&(J={x:C,y:F});for(var at=0;at<=m;at+=1){if(G=at/m,u=Uv(r,t,e,n,i,a,s,o,A,G),C=u.x,F=u.y,d&&$.push({x:C,y:F}),g&&(Q+=Li(K,[C,F])),K=[C,F],w&&Q>=l&&l>D[2]){var At=(Q-l)/(Q-D[2]);J={x:K[0]*(1-At)+D[0]*At,y:K[1]*(1-At)+D[1]*At}}D=[C,F,Q]}return w&&l>=Q&&(J={x:o,y:A}),{length:Q,point:J,min:{x:Math.min.apply(null,$.map(function(pt){return pt.x})),y:Math.min.apply(null,$.map(function(pt){return pt.y}))},max:{x:Math.max.apply(null,$.map(function(pt){return pt.x})),y:Math.max.apply(null,$.map(function(pt){return pt.y}))}}}function Dv(r,t,e,n,i,a,s,o,A){var l=1-A;return{x:Math.pow(l,3)*r+3*Math.pow(l,2)*A*e+3*l*Math.pow(A,2)*i+Math.pow(A,3)*s,y:Math.pow(l,3)*t+3*Math.pow(l,2)*A*n+3*l*Math.pow(A,2)*a+Math.pow(A,3)*o}}function Ad(r,t,e,n,i,a,s,o,A,l){var c,u=l.bbox,h=u===void 0?!0:u,d=l.length,f=d===void 0?!0:d,g=l.sampleSize,v=g===void 0?10:g,m=typeof A=="number",w=r,C=t,F=0,Q=[w,C,F],D=[w,C],K=0,G={x:0,y:0},J=[{x:w,y:C}];m&&A<=0&&(G={x:w,y:C});for(var $=0;$<=v;$+=1){if(K=$/v,c=Dv(r,t,e,n,i,a,s,o,K),w=c.x,C=c.y,h&&J.push({x:w,y:C}),f&&(F+=Li(D,[w,C])),D=[w,C],m&&F>=A&&A>Q[2]){var at=(F-A)/(F-Q[2]);G={x:D[0]*(1-at)+Q[0]*at,y:D[1]*(1-at)+Q[1]*at}}Q=[w,C,F]}return m&&A>=F&&(G={x:s,y:o}),{length:F,point:G,min:{x:Math.min.apply(null,J.map(function(At){return At.x})),y:Math.min.apply(null,J.map(function(At){return At.y}))},max:{x:Math.max.apply(null,J.map(function(At){return At.x})),y:Math.max.apply(null,J.map(function(At){return At.y}))}}}function Rv(r,t,e,n,i,a,s){var o=1-s;return{x:Math.pow(o,2)*r+2*o*s*e+Math.pow(s,2)*i,y:Math.pow(o,2)*t+2*o*s*n+Math.pow(s,2)*a}}function _v(r,t,e,n,i,a,s,o){var A,l=o.bbox,c=l===void 0?!0:l,u=o.length,h=u===void 0?!0:u,d=o.sampleSize,f=d===void 0?10:d,g=typeof s=="number",v=r,m=t,w=0,C=[v,m,w],F=[v,m],Q=0,D={x:0,y:0},K=[{x:v,y:m}];g&&s<=0&&(D={x:v,y:m});for(var G=0;G<=f;G+=1){if(Q=G/f,A=Rv(r,t,e,n,i,a,Q),v=A.x,m=A.y,c&&K.push({x:v,y:m}),h&&(w+=Li(F,[v,m])),F=[v,m],g&&w>=s&&s>C[2]){var J=(w-s)/(w-C[2]);D={x:F[0]*(1-J)+C[0]*J,y:F[1]*(1-J)+C[1]*J}}C=[v,m,w]}return g&&s>=w&&(D={x:i,y:a}),{length:w,point:D,min:{x:Math.min.apply(null,K.map(function($){return $.x})),y:Math.min.apply(null,K.map(function($){return $.y}))},max:{x:Math.max.apply(null,K.map(function($){return $.x})),y:Math.max.apply(null,K.map(function($){return $.y}))}}}function ld(r,t,e){for(var n,i,a,s,o,A,l=ql(r),c=typeof t=="number",u,h=[],d,f=0,g=0,v=0,m=0,w,C=[],F=[],Q=0,D={x:0,y:0},K=D,G=D,J=D,$=0,at=0,At=l.length;at=t&&(J=G),F.push(K),C.push(D),$+=Q,A=d!=="Z"?w.slice(-2):[v,m],f=A[0],g=A[1];return c&&t>=$&&(J={x:f,y:g}),{length:$,point:J,min:{x:Math.min.apply(null,C.map(function(pt){return pt.x})),y:Math.min.apply(null,C.map(function(pt){return pt.y}))},max:{x:Math.max.apply(null,F.map(function(pt){return pt.x})),y:Math.max.apply(null,F.map(function(pt){return pt.y}))}}}function Hv(r,t){return ld(r,void 0,(0,z.pi)((0,z.pi)({},t),{bbox:!1,length:!0})).length}function Ni(r){return Array.isArray(r)}var $l=function(r){if(Ni(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};function tc(r){if(!Array.isArray(r))return-1/0;var t=r.length;if(!t)return-1/0;for(var e=r[0],n=1;n7){r[e].shift();for(var n=r[e],i=e;n.length;)t[e]="A",r.splice(i+=1,0,["C"].concat(n.splice(0,6)));r.splice(e,1)}}function Kv(r){return rd(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function ec(r,t,e){var n=r*Math.cos(e)-t*Math.sin(e),i=r*Math.sin(e)+t*Math.cos(e);return{x:n,y:i}}function nc(r,t,e,n,i,a,s,o,A,l){var c=r,u=t,h=e,d=n,f=o,g=A,v=Math.PI*120/180,m=Math.PI/180*(+i||0),w=[],C,F,Q,D,K;if(l)F=l[0],Q=l[1],D=l[2],K=l[3];else{C=ec(c,u,-m),c=C.x,u=C.y,C=ec(f,g,-m),f=C.x,g=C.y;var G=(c-f)/2,J=(u-g)/2,$=G*G/(h*h)+J*J/(d*d);$>1&&($=Math.sqrt($),h*=$,d*=$);var at=h*h,At=d*d,pt=(a===s?-1:1)*Math.sqrt(Math.abs((at*At-at*J*J-At*G*G)/(at*J*J+At*G*G)));D=pt*h*J/d+(c+f)/2,K=pt*-d*G/h+(u+g)/2,F=Math.asin(((u-K)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),Q=Math.asin(((g-K)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),F=cQ&&(F-=Math.PI*2),!s&&Q>F&&(Q-=Math.PI*2)}var wt=Q-F;if(Math.abs(wt)>v){var bt=Q,Rt=f,Pt=g;Q=F+v*(s&&Q>F?1:-1),f=D+h*Math.cos(Q),g=K+d*Math.sin(Q),w=nc(f,g,h,d,i,0,s,Rt,Pt,[Q,bt,D,K])}wt=Q-F;var xt=Math.cos(F),Ft=Math.sin(F),_t=Math.cos(Q),Xt=Math.sin(Q),ie=Math.tan(wt/4),le=4/3*h*ie,ve=4/3*d*ie,xe=[c,u],Qe=[c+le*Ft,u-ve*xt],Re=[f+le*Xt,g-ve*_t],nn=[f,g];if(Qe[0]=2*xe[0]-Qe[0],Qe[1]=2*xe[1]-Qe[1],l)return Qe.concat(Re,nn,w);w=Qe.concat(Re,nn,w);for(var mn=[],sn=0,er=w.length;snWv)return console.warn("Maximum recursion depth reached in equalizeSegments"),[r,t];var i=dd(r),a=dd(t),s=i.length,o=a.length,A=i.filter(function(m){return m.l}).length,l=a.filter(function(m){return m.l}).length,c=i.filter(function(m){return m.l}).reduce(function(m,w){var C=w.l;return m+C},0)/A||0,u=a.filter(function(m){return m.l}).reduce(function(m,w){var C=w.l;return m+C},0)/l||0,h=e||Math.max(s,o),d=[c,u],f=[h-s,h-o],g=0,v=[i,a].map(function(m,w){return m.l===h?m.map(function(C){return C.s}):m.map(function(C,F){return g=F&&f[w]&&C.l>=d[w],f[w]-=g?1:0,g?C.ss:[C.s]}).flat()});return v[0].length===v[1].length?v:fd(v[0],v[1],h,n+1)}function Ur(r,t,e,n,i,a,s,o){return 3*((o-t)*(e+i)-(s-r)*(n+a)+n*(r-i)-e*(t-a)+o*(i+r/3)-s*(a+t/3))/20}function jv(r){var t=0,e=0,n=0;return Cu(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],A=s[1],l=s[2],c=s[3],u=s[4],h=s[5];return n=Ur(t,e,o,A,l,c,u,h),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function gd(r){return jv(r)>=0}function Yv(r){var t=r.slice(1).map(function(e,n,i){return n?i[n-1].slice(-2).concat(e.slice(1)):r[0].slice(1).concat(e.slice(1))}).map(function(e){return e.map(function(n,i){return e[e.length-i-2*(1-i%2)]})}).reverse();return[["M"].concat(t[0].slice(0,2))].concat(t.map(function(e){return["C"].concat(e.slice(2))}))}function Xv(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function Jv(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,A;return s===0||r[o]&&r[o][0]==="M"?(A=r[o],["M"].concat(A.slice(-2))):(o>=t&&(o-=e),r[o])})})}function vd(r,t){var e=r.length-1,n=[],i=0,a=0,s=Jv(r);return s.forEach(function(o,A){r.slice(1).forEach(function(l,c){a+=Li(r[(A+c)%e].slice(-2),t[c%e].slice(-2))}),n[A]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}var qv=function(r){return r===void 0},Ye=qv,$v={}.toString,tp=function(r,t){return $v.call(r)==="[object "+t+"]"},pd=tp,ep=function(r){return pd(r,"Boolean")},Jo=ep;function Wt(r){return typeof r=="function"}var Br=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function np(r,t,e){return ld(r,t,(0,z.pi)((0,z.pi)({},e),{bbox:!1,length:!0})).point}var we=M(20068),Ba=M(58289);function rp(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=(0,Ba.Z)(r))!==null;);return r}function rc(){return rc=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=rp(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},rc.apply(null,arguments)}function _s(r,t,e,n){var i=rc((0,Ba.Z)(1&n?r.prototype:r),t,e);return 2&n&&typeof i=="function"?function(a){return i.apply(e,a)}:i}var ic=M(97047);function gi(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function ac(r,t){var e=Math.min.apply(Math,(0,N.Z)(r)),n=Math.min.apply(Math,(0,N.Z)(t)),i=Math.max.apply(Math,(0,N.Z)(r)),a=Math.max.apply(Math,(0,N.Z)(t));return{x:e,y:n,width:i-e,height:a-n}}function md(r){return(r+Math.PI*2)%(Math.PI*2)}function Hs(r,t){var e=Math.abs(r);return t>0?e:e*-1}function Su(r,t,e,n,i,a){var s=e,o=n;if(s===0||o===0)return{x:r,y:t};for(var A=i-r,l=a-t,c=Math.abs(A),u=Math.abs(l),h=s*s,d=o*o,f=Math.PI/4,g=0,v=0,m=0;m<4;m++){g=s*Math.cos(f),v=o*Math.sin(f);var w=(h-d)*Math.pow(Math.cos(f),3)/s,C=(d-h)*Math.pow(Math.sin(f),3)/o,F=g-w,Q=v-C,D=c-w,K=u-C,G=Math.hypot(Q,F),J=Math.hypot(K,D),$=G*Math.asin((F*K-Q*D)/(G*J)),at=$/Math.sqrt(h+d-g*g-v*v);f+=at,f=Math.min(Math.PI/2,Math.max(0,f))}return{x:r+Hs(g,A),y:t+Hs(v,l)}}function Mu(r,t,e,n,i,a,s,o){return-1*e*Math.cos(i)*Math.sin(o)-n*Math.sin(i)*Math.cos(o)}function ip(r,t,e,n,i,a,s,o){return-1*e*Math.sin(i)*Math.sin(o)+n*Math.cos(i)*Math.cos(o)}function yd(r,t,e){return Math.atan(-t/r*Math.tan(e))}function ap(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function Tu(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function sp(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function op(r,t,e,n){var i=Math.atan2(n*r,e*t);return(i+Math.PI*2)%(Math.PI*2)}function wd(r,t,e){return{x:r*Math.cos(e),y:t*Math.sin(e)}}function Ed(r,t,e){var n=Math.cos(e),i=Math.sin(e);return[r*n-t*i,r*i+t*n]}function Ap(r,t,e,n,i,a,s){for(var o=yd(e,n,i),A=1/0,l=-1/0,c=[a,s],u=-Math.PI*2;u<=Math.PI*2;u+=Math.PI){var h=o+u;al&&(l=f)}for(var g=ap(e,n,i),v=1/0,m=-1/0,w=[a,s],C=-Math.PI*2;C<=Math.PI*2;C+=Math.PI){var F=g+C;am&&(m=D)}return{x:A,y:v,width:l-A,height:m-v}}function Kw(r,t,e,n,i,a,s,o,A){var l=Ed(o-r,A-t,-i),c=_slicedToArray(l,2),u=c[0],h=c[1],d=Su(0,0,e,n,u,h),f=op(e,n,d.x,d.y);fs&&(d=wd(e,n,s));var g=Ed(d.x,d.y,i);return{x:g[0]+r,y:g[1]+t}}function zw(r,t,e,n,i,a,s,o){var A=(s-a)*o+a,l=Mu(r,t,e,n,i,a,s,A),c=ip(r,t,e,n,i,a,s,A);return md(Math.atan2(c,l))}var lp=1e-4;function Fu(r,t,e,n,i,a){var s=-1,o=1/0,A=[e,n],l=20;a&&a>200&&(l=a/10);for(var c=1/l,u=c/10,h=0;h<=l;h++){var d=h*c,f=[i.apply(void 0,(0,N.Z)(r.concat([d]))),i.apply(void 0,(0,N.Z)(t.concat([d])))],g=gi(A[0],A[1],f[0],f[1]);g=0&&Qo?gi(e,n,i,a):XA(r,t,e,n,i,a)}function XA(r,t,e,n,i,a){var s=[e-r,n-t];if(Mv(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];Cv(o,o);var A=[i-r,a-t];return Math.abs(wu(A,o))}function Ww(r,t,e,n){return Math.atan2(n-t,e-r)}function As(r,t,e,n,i){var a=1-i;return a*a*a*r+3*t*i*a*a+3*e*i*i*a+n*i*i*i}function sc(r,t,e,n,i){var a=1-i;return 3*(a*a*(t-r)+2*a*i*(e-t)+i*i*(n-e))}function Ou(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],A,l,c;if(Xo(i,0))Xo(a,0)||(A=-s/a,A>=0&&A<=1&&o.push(A));else{var u=a*a-4*i*s;Xo(u,0)?o.push(-a/(2*i)):u>0&&(c=Math.sqrt(u),A=(-a+c)/(2*i),l=(-a-c)/(2*i),A>=0&&A<=1&&o.push(A),l>=0&&l<=1&&o.push(l))}return o}function bd(r,t,e,n,i,a,s,o,A){var l=As(r,e,i,s,A),c=As(t,n,a,o,A),u=ba(r,t,e,n,A),h=ba(e,n,i,a,A),d=ba(i,a,s,o,A),f=ba(u.x,u.y,h.x,h.y,A),g=ba(h.x,h.y,d.x,d.y,A);return[[r,t,u.x,u.y,f.x,f.y,l,c],[l,c,g.x,g.y,d.x,d.y,s,o]]}function Iu(r,t,e,n,i,a,s,o,A){if(A===0)return cp([r,e,i,s],[t,n,a,o]);var l=bd(r,t,e,n,i,a,s,o,.5),c=[].concat(_toConsumableArray(l[0]),[A-1]),u=[].concat(_toConsumableArray(l[1]),[A-1]);return Iu.apply(void 0,_toConsumableArray(c))+Iu.apply(void 0,_toConsumableArray(u))}function xd(r,t,e,n,i,a,s,o){for(var A=[r,s],l=[t,o],c=Ou(r,e,i,s),u=Ou(t,n,a,o),h=0;h1||t<0||r.length<2)return null;var e=ku(r),n=e.segments,i=e.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,s=null,o=0;o=a&&t<=a+u){var h=(t-a)/u;s=ba(l[0],l[1],c[0],c[1],h);break}a+=u}return s}function Md(r,t){if(t>1||t<0||r.length<2)return 0;for(var e=ku(r),n=e.segments,i=e.totalLength,a=0,s=0,o=0;o=a&&t<=a+u){s=Math.atan2(c[1]-l[1],c[0]-l[0]);break}a+=u}return s}function Td(r,t,e){for(var n=1/0,i=0;i=0?[i]:[]}function Uu(r,t,e,n,i,a,s){var o=qo(r,e,i,s),A=qo(t,n,a,s),l=ba(r,t,e,n,s),c=ba(e,n,i,a,s);return[[r,t,l.x,l.y,o,A],[o,A,c.x,c.y,i,a]]}function lc(r,t,e,n,i,a,s){if(s===0)return(gi(r,t,e,n)+gi(e,n,i,a)+gi(r,t,i,a))/2;var o=Uu(r,t,e,n,i,a,.5),A=o[0],l=o[1];return A.push(s-1),l.push(s-1),lc.apply(void 0,_toConsumableArray(A))+lc.apply(void 0,_toConsumableArray(l))}function ni(r,t,e,n,i,a){var s=Fd(r,e,i)[0],o=Fd(t,n,a)[0],A=[r,i],l=[t,a];return s!==void 0&&A.push(qo(r,e,i,s)),o!==void 0&&l.push(qo(t,n,a,o)),ac(A,l)}function cc(r,t,e,n,i,a){return lc(r,t,e,n,i,a,3)}function fp(r,t,e,n,i,a,s,o){return Fu([r,e,i],[t,n,a],s,o,qo)}function gp(r,t,e,n,i,a,s,o){var A=fp(r,t,e,n,i,a,s,o);return gi(A.x,A.y,s,o)}var ri=M(75044),Wa=M(3202),Gs=M(19251),Za=M(75931);var Vt=function(r){return r.GROUP="g",r.FRAGMENT="fragment",r.CIRCLE="circle",r.ELLIPSE="ellipse",r.IMAGE="image",r.RECT="rect",r.LINE="line",r.POLYLINE="polyline",r.POLYGON="polygon",r.TEXT="text",r.PATH="path",r.HTML="html",r.MESH="mesh",r}({}),uc=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),ls=function(){function r(){(0,L.Z)(this,r),this.plugins=[]}return(0,I.Z)(r,[{key:"addRenderingPlugin",value:function(e){this.plugins.push(e),this.context.renderingPlugins.push(e)}},{key:"removeAllRenderingPlugins",value:function(){var e=this;this.plugins.forEach(function(n){var i=e.context.renderingPlugins.indexOf(n);i>=0&&e.context.renderingPlugins.splice(i,1)})}}])}(),vp=function(){function r(t){(0,L.Z)(this,r),this.clipSpaceNearZ=uc.NEGATIVE_ONE,this.plugins=[],this.config=(0,H.Z)({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return(0,I.Z)(r,[{key:"registerPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n===-1&&this.plugins.push(e)}},{key:"unregisterPlugin",value:function(e){var n=this.plugins.findIndex(function(i){return i===e});n>-1&&this.plugins.splice(n,1)}},{key:"getPlugins",value:function(){return this.plugins}},{key:"getPlugin",value:function(e){return this.plugins.find(function(n){return n.name===e})}},{key:"getConfig",value:function(){return this.config}},{key:"setConfig",value:function(e){Object.assign(this.config,e)}}])}(),Pu=ue,$o=re,Od=is,Id=Vi,Du=Ht,hc=ss,jn=function(){function r(){(0,L.Z)(this,r),this.center=[0,0,0],this.halfExtents=[0,0,0],this.min=[0,0,0],this.max=[0,0,0]}return(0,I.Z)(r,[{key:"update",value:function(e,n){$o(this.center,e),$o(this.halfExtents,n),hc(this.min,this.center,this.halfExtents),Pu(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){Pu(this.center,n,e),Du(this.center,this.center,.5),hc(this.halfExtents,n,e),Du(this.halfExtents,this.halfExtents,.5),$o(this.min,e),$o(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,A=o[0],l=o[1],c=o[2],u=i-A,h=i+A,d=a-l,f=a+l,g=s-c,v=s+c,m=e.center,w=m[0],C=m[1],F=m[2],Q=e.halfExtents,D=Q[0],K=Q[1],G=Q[2],J=w-D,$=w+D,at=C-K,At=C+K,pt=F-G,wt=F+G;Jh&&(h=$),atf&&(f=At),ptv&&(v=wt),n[0]=(u+h)*.5,n[1]=(d+f)*.5,n[2]=(g+v)*.5,o[0]=(h-u)*.5,o[1]=(f-d)*.5,o[2]=(v-g)*.5,this.min[0]=u,this.min[1]=d,this.min[2]=g,this.max[0]=h,this.max[1]=f,this.max[2]=v}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,A=n[0],l=n[4],c=n[8],u=n[1],h=n[5],d=n[9],f=n[2],g=n[6],v=n[10],m=Math.abs(A),w=Math.abs(l),C=Math.abs(c),F=Math.abs(u),Q=Math.abs(h),D=Math.abs(d),K=Math.abs(f),G=Math.abs(g),J=Math.abs(v);i[0]=n[12]+A*s[0]+l*s[1]+c*s[2],i[1]=n[13]+u*s[0]+h*s[1]+d*s[2],i[2]=n[14]+f*s[0]+g*s[1]+v*s[2],a[0]=m*o[0]+w*o[1]+C*o[2],a[1]=F*o[0]+Q*o[1]+D*o[2],a[2]=K*o[0]+G*o[1]+J*o[2],hc(this.min,i,a),Pu(this.max,i,a)}},{key:"intersects",value:function(e){var n=this.getMax(),i=this.getMin(),a=e.getMax(),s=e.getMin();return i[0]<=a[0]&&n[0]>=s[0]&&i[1]<=a[1]&&n[1]>=s[1]&&i[2]<=a[2]&&n[2]>=s[2]}},{key:"intersection",value:function(e){if(!this.intersects(e))return null;var n=new r,i=Od([0,0,0],this.getMin(),e.getMin()),a=Id([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?$o([0,0,0],this.min):e.pnVertexFlag===272?[this.min[0],this.min[1],this.max[2]]:e.pnVertexFlag===257?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===256?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===17?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===16?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===1?[this.max[0],this.max[1],this.min[2]]:[this.max[0],this.max[1],this.max[2]]}},{key:"getPositiveFarPoint",value:function(e){return e.pnVertexFlag===273?$o([0,0,0],this.max):e.pnVertexFlag===272?[this.max[0],this.max[1],this.min[2]]:e.pnVertexFlag===257?[this.max[0],this.min[1],this.max[2]]:e.pnVertexFlag===256?[this.max[0],this.min[1],this.min[2]]:e.pnVertexFlag===17?[this.min[0],this.max[1],this.max[2]]:e.pnVertexFlag===16?[this.min[0],this.max[1],this.min[2]]:e.pnVertexFlag===1?[this.min[0],this.min[1],this.max[2]]:[this.min[0],this.min[1],this.min[2]]}}],[{key:"isEmpty",value:function(e){return!e||e.halfExtents[0]===0&&e.halfExtents[1]===0&&e.halfExtents[2]===0}}])}(),pp=function(){function r(t,e){(0,L.Z)(this,r),this.distance=t||0,this.normal=e||Gt(0,1,0),this.updatePNVertexFlag()}return(0,I.Z)(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return _e(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/aa(this.normal);Ht(this.normal,this.normal,e),this.distance*=e}},{key:"intersectsLine",value:function(e,n,i){var a=this.distanceToPoint(e),s=this.distanceToPoint(n),o=a/(a-s),A=o>=0&&o<=1;return A&&i&&rn(i,e,n,o),A}}])}(),tA=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),mp=function(){function r(t){if((0,L.Z)(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new pp)}return(0,I.Z)(r,[{key:"extractFromVPMatrix",value:function(e){var n=(0,U.Z)(e,16),i=n[0],a=n[1],s=n[2],o=n[3],A=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],g=n[11],v=n[12],m=n[13],w=n[14],C=n[15];de(this.planes[0].normal,o-i,u-A,g-h),this.planes[0].distance=C-v,de(this.planes[1].normal,o+i,u+A,g+h),this.planes[1].distance=C+v,de(this.planes[2].normal,o+a,u+l,g+d),this.planes[2].distance=C+m,de(this.planes[3].normal,o-a,u-l,g-d),this.planes[3].distance=C-m,de(this.planes[4].normal,o-s,u-c,g-f),this.planes[4].distance=C-w,de(this.planes[5].normal,o+s,u+c,g+f),this.planes[5].distance=C+w,this.planes.forEach(function(F){F.normalize(),F.updatePNVertexFlag()})}}])}(),ii=function(){function r(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;(0,L.Z)(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return(0,I.Z)(r,[{key:"clone",value:function(){return new r(this.x,this.y)}},{key:"copyFrom",value:function(e){this.x=e.x,this.y=e.y}}])}(),cs=function(){function r(t,e,n,i){(0,L.Z)(this,r),this.x=t,this.y=e,this.width=n,this.height=i,this.left=t,this.right=t+n,this.top=e,this.bottom=e+i}return(0,I.Z)(r,[{key:"toJSON",value:function(){}}],[{key:"fromRect",value:function(e){return new r(e.x,e.y,e.width,e.height)}},{key:"applyTransform",value:function(e,n){var i=ji(e.x,e.y,0,1),a=ji(e.x+e.width,e.y,0,1),s=ji(e.x,e.y+e.height,0,1),o=ji(e.x+e.width,e.y+e.height,0,1),A=or(),l=or(),c=or(),u=or();T(A,i,n),T(l,a,n),T(c,s,n),T(u,o,n);var h=Math.min(A[0],l[0],c[0],u[0]),d=Math.min(A[1],l[1],c[1],u[1]),f=Math.max(A[0],l[0],c[0],u[0]),g=Math.max(A[1],l[1],c[1],u[1]);return r.fromRect({x:h,y:d,width:f-h,height:g-d})}}])}(),On="Method not implemented.",eA="Use document.documentElement instead.",Ld="Cannot append a destroyed element.";function Ks(r){return r===void 0?0:r>360||r<-360?r%360:r}var dc=Ct();function vi(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;return Array.isArray(r)&&r.length===3?n?Nt(r):re(dc,r):ye(r)?n?Gt(r,t,e):de(dc,r,t,e):n?Gt(r[0],r[1]||t,r[2]||e):de(dc,r[0],r[1]||t,r[2]||e)}var Nd=Math.PI/180;function Un(r){return r*Nd}var fc=180/Math.PI;function Bi(r){return r*fc}var kd=.9;function eE(r){return r%=400,r<0&&(r+=400),r*kd}function nE(r){return r/360}function Qd(r){return 360*r}var us=Math.PI/2;function Ru(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,A=i*i,l=a*a,c=s+o+A+l,u=e*a-n*i;return u>.499995*c?(r[0]=us,r[1]=2*Math.atan2(n,e),r[2]=0):u<-.499995*c?(r[0]=-us,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(A+l)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+A))),r}function gc(r,t){var e,n,i=ks(Ct(),t),a=(0,U.Z)(i,3),s=a[0],o=a[1],A=a[2],l=Math.asin(-t[2]/s);return l-us?(e=Math.atan2(t[6]/o,t[10]/A),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=l,r[2]=n,r}function _u(r,t){return t.length===16?gc(r,t):Ru(r,t)}function yp(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Wl(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function wp(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,A=2*a,l=e-t,c=n-i,u=A/l,h=A/c,d=(e+t)/l,f=(n+i)/c,g,v,m=s-a,w=s*a;return o?(g=-s/m,v=-w/m):(g=-(s+a)/m,v=-2*w/m),r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=d,r[9]=f,r[10]=g,r[11]=-1,r[12]=0,r[13]=0,r[14]=v,r[15]=0,r}function Ud(r){var t=r[0],e=r[1],n=r[3],i=r[4],a=Math.sqrt(t*t+e*e),s=Math.sqrt(n*n+i*i),o=t*i-e*n;if(o<0&&(tze[1][2]&&(a[0]=-a[0]),ze[0][2]>ze[2][0]&&(a[1]=-a[1]),ze[1][0]>ze[0][1]&&(a[2]=-a[2]),!0}function Dd(r,t){var e=t[15];if(e===0)return!1;for(var n=1/e,i=0;i<16;i++)r[i]=t[i]*n;return!0}function Ep(r,t){r[0][0]=t[0],r[0][1]=t[1],r[0][2]=t[2],r[1][0]=t[4],r[1][1]=t[5],r[1][2]=t[6],r[2][0]=t[8],r[2][1]=t[9],r[2][2]=t[10]}function rA(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var In=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),pc=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),$i=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),Rd={UPDATED:"updated"},Hu=2e-4,Gu=function(){function r(){(0,L.Z)(this,r),this.clipSpaceNearZ=uc.NEGATIVE_ONE,this.eventEmitter=new V,this.matrix=te(),this.right=Gt(1,0,0),this.up=Gt(0,1,0),this.forward=Gt(0,0,1),this.position=Gt(0,0,1),this.focalPoint=Gt(0,0,0),this.distanceVector=Gt(0,0,-1),this.distance=1,this.azimuth=0,this.elevation=0,this.roll=0,this.relAzimuth=0,this.relElevation=0,this.relRoll=0,this.dollyingStep=0,this.maxDistance=1/0,this.minDistance=-1/0,this.zoom=1,this.rotateWorld=!1,this.fov=30,this.near=.1,this.far=1e3,this.aspect=1,this.projectionMatrix=te(),this.projectionMatrixInverse=te(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=In.EXPLORING,this.trackingMode=pc.DEFAULT,this.projectionMode=$i.PERSPECTIVE,this.frustum=new mp,this.orthoMatrix=te()}return(0,I.Z)(r,[{key:"isOrtho",value:function(){return this.projectionMode===$i.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===In.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===In.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==In.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return on(te(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=Tr(te(),[e,n,0]);this.jitteredProjectionMatrix=he(te(),i,this.projectionMatrix)}},{key:"clearJitterProjectionMatrix",value:function(){this.jitteredProjectionMatrix=void 0}},{key:"setMatrix",value:function(e){return this.matrix=e,this._update(),this}},{key:"setProjectionMatrix",value:function(e){this.projectionMatrix=e}},{key:"setFov",value:function(e){return this.setPerspective(this.near,this.far,e,this.aspect),this}},{key:"setAspect",value:function(e){return this.setPerspective(this.near,this.far,this.fov,e),this}},{key:"setNear",value:function(e){return this.projectionMode===$i.PERSPECTIVE?this.setPerspective(e,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,e,this.far),this}},{key:"setFar",value:function(e){return this.projectionMode===$i.PERSPECTIVE?this.setPerspective(this.near,e,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,e),this}},{key:"setViewOffset",value:function(e,n,i,a,s,o){return this.aspect=e/n,this.view===void 0&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=n,this.view.offsetX=i,this.view.offsetY=a,this.view.width=s,this.view.height=o,this.projectionMode===$i.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"clearViewOffset",value:function(){return this.view!==void 0&&(this.view.enabled=!1),this.projectionMode===$i.PERSPECTIVE?this.setPerspective(this.near,this.far,this.fov,this.aspect):this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far),this}},{key:"setZoom",value:function(e){return this.zoom=e,this.projectionMode===$i.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===$i.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var A=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),l=A.x,c=A.y,u=Gt(l-a,c-s,0),h=_e(u,this.right)/qt(this.right),d=_e(u,this.up)/qt(this.up),f=this.getPosition(),g=(0,U.Z)(f,2),v=g[0],m=g[1],w=this.getFocalPoint(),C=(0,U.Z)(w,2),F=C[0],Q=C[1];return this.setPosition(v-h,m-d),this.setFocalPoint(F-h,Q-d),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=$i.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(Un(.5*this.fov))/this.zoom,A=2*o,l=this.aspect*A,c=-.5*l;if((s=this.view)!==null&&s!==void 0&&s.enabled){var u=this.view.fullWidth,h=this.view.fullHeight;c+=this.view.offsetX*l/u,o-=this.view.offsetY*A/h,l*=this.view.width/u,A*=this.view.height/h}return wp(this.projectionMatrix,c,c+l,o-A,o,e,this.far,this.clipSpaceNearZ===uc.ZERO),on(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var A;this.projectionMode=$i.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var l=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,h=(this.top+this.bottom)/2,d=u-l,f=u+l,g=h+c,v=h-c;if((A=this.view)!==null&&A!==void 0&&A.enabled){var m=(this.rright-this.left)/this.view.fullWidth/this.zoom,w=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=m*this.view.offsetX,f=d+m*this.view.width,g-=w*this.view.offsetY,v=g-w*this.view.height}return this.clipSpaceNearZ===uc.NEGATIVE_ONE?lu(this.projectionMatrix,d,f,g,v,s,o):cu(this.projectionMatrix,d,f,g,v,s,o),on(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=vi(e,n,i);return this._setPosition(a),this.setFocalPoint(this.focalPoint),this.triggerUpdate(),this}},{key:"setFocalPoint",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.focalPoint[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.focalPoint[2],a=Gt(0,1,0);if(this.focalPoint=vi(e,n,i),this.trackingMode===pc.CINEMATIC){var s=Me(Ct(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=qt(s),A=Bi(Math.asin(n/o)),l=90+Bi(Math.atan2(i,e)),c=te();qn(c,c,Un(l)),Zn(c,c,Un(A)),a=me(Ct(),[0,1,0],c)}return on(this.matrix,Zh(te(),this.position,this.focalPoint,a)),this._getAxes(),this._getDistance(),this._getAngles(),this.triggerUpdate(),this}},{key:"getDistance",value:function(){return this.distance}},{key:"getDistanceVector",value:function(){return this.distanceVector}},{key:"setDistance",value:function(e){if(this.distance===e||e<0)return this;this.distance=e,this.distance>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):e===8?lA(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?lA(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=qA.exec(r))?new ki(t[1],t[2],t[3],1):(t=bp.exec(r))?new ki(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xp.exec(r))?lA(t[1],t[2],t[3],t[4]):(t=Cp.exec(r))?lA(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Sp.exec(r))?bc(t[1],t[2]/100,t[3]/100,1):(t=Mp.exec(r))?bc(t[1],t[2]/100,t[3]/100,t[4]):yc.hasOwnProperty(r)?Ec(yc[r]):r==="transparent"?new ki(NaN,NaN,NaN,0):null}function Ec(r){return new ki(r>>16&255,r>>8&255,r&255,1)}function lA(r,t,e,n){return n<=0&&(r=t=e=NaN),new ki(r,t,e,n)}function Kd(r){return r instanceof oA||(r=wc(r)),r?(r=r.rgb(),new ki(r.r,r.g,r.b,r.opacity)):new ki}function Op(r,t,e,n){return arguments.length===1?Kd(r):new ki(r,t,e,n==null?1:n)}function ki(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}mo(ki,Op,ja(oA,{brighter(r){return r=r==null?JA:Math.pow(JA,r),new ki(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?AA:Math.pow(AA,r),new ki(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new ki(yo(this.r),yo(this.g),yo(this.b),Bc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ku,formatHex:Ku,formatHex8:Ip,formatRgb:zd,toString:zd}));function Ku(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}`}function Ip(){return`#${wo(this.r)}${wo(this.g)}${wo(this.b)}${wo((isNaN(this.opacity)?1:this.opacity)*255)}`}function zd(){const r=Bc(this.opacity);return`${r===1?"rgb(":"rgba("}${yo(this.r)}, ${yo(this.g)}, ${yo(this.b)}${r===1?")":`, ${r})`}`}function Bc(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function yo(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function wo(r){return r=yo(r),(r<16?"0":"")+r.toString(16)}function bc(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Sa(r,t,e,n)}function Vd(r){if(r instanceof Sa)return new Sa(r.h,r.s,r.l,r.opacity);if(r instanceof oA||(r=wc(r)),!r)return new Sa;if(r instanceof Sa)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,A=(a+i)/2;return o?(t===a?s=(e-n)/o+(e0&&A<1?0:s,new Sa(s,o,A,r.opacity)}function zu(r,t,e,n){return arguments.length===1?Vd(r):new Sa(r,t,e,n==null?1:n)}function Sa(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}mo(Sa,zu,ja(oA,{brighter(r){return r=r==null?JA:Math.pow(JA,r),new Sa(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?AA:Math.pow(AA,r),new Sa(this.h,this.s,this.l*r,this.opacity)},rgb(){var r=this.h%360+(this.h<0)*360,t=isNaN(r)||isNaN(this.s)?0:this.s,e=this.l,n=e+(e<.5?e:1-e)*t,i=2*e-n;return new ki(cA(r>=240?r-240:r+120,i,n),cA(r,i,n),cA(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Sa(Se(this.h),fs(this.s),fs(this.l),Bc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const r=Bc(this.opacity);return`${r===1?"hsl(":"hsla("}${Se(this.h)}, ${fs(this.s)*100}%, ${fs(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Se(r){return r=(r||0)%360,r<0?r+360:r}function fs(r){return Math.max(0,Math.min(1,r||0))}function cA(r,t,e){return(r<60?t+(e-t)*r/60:r<180?e:r<240?t+(e-t)*(240-r)/60:t)*255}function Ln(r,t){if(typeof r!="function"||t!=null&&typeof t!="function")throw new TypeError("Expected a function");var e=function(){for(var i=arguments.length,a=new Array(i),s=0;s=gs.kUnitType&&this.getType()<=gs.kClampType}}],[{key:"isAngle",value:function(e){return e===ge.kDegrees||e===ge.kRadians||e===ge.kGradians||e===ge.kTurns}},{key:"isLength",value:function(e){return e>=ge.kEms&&e1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},Zu=function(t){return Qp(kp(t))},_n=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ge.kNumber;(0,L.Z)(this,t),n=(0,P.Z)(this,t);var a;return typeof i=="string"?a=Cc(i):a=i,n.unit=a,n.value=e,n}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"clone",value:function(){return new t(this.value,this.unit)}},{key:"equals",value:function(n){var i=n;return this.value===i.value&&this.unit===i.unit}},{key:"getType",value:function(){return gs.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=Zu(this.unit);if(i!==Zu(n)||i===ge.kUnknown)return null;var a=Vu(this.unit)/Vu(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case ge.kUnknown:break;case ge.kInteger:s=Number(this.value).toFixed(0);break;case ge.kNumber:case ge.kPercentage:case ge.kEms:case ge.kRems:case ge.kPixels:case ge.kDegrees:case ge.kRadians:case ge.kGradians:case ge.kMilliseconds:case ge.kSeconds:case ge.kTurns:{var o=-999999,A=999999,l=this.value,c=Wu(this.unit);if(lA){var u=Wu(this.unit);!Number.isFinite(l)||Number.isNaN(l)?s=Wd(l,u):s=l+(u||"")}else s="".concat(l).concat(c)}}return a+=s,a}}])}($A),Ma=new _n(0,"px");new _n(1,"px");var Eo=new _n(0,"deg"),ju=function(r){function t(e,n,i){var a,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:1,o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return(0,L.Z)(this,t),a=(0,P.Z)(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"clone",value:function(){return new t(this.r,this.g,this.b,this.alpha)}},{key:"buildCSSText",value:function(n,i,a){return"".concat(a,"rgba(").concat(this.r,",").concat(this.g,",").concat(this.b,",").concat(this.alpha,")")}}])}(Up),el=new Qi("unset"),la=new Qi("initial"),Zd=new Qi("inherit"),uA={"":el,unset:el,initial:la,inherit:Zd},Pp=function(t){return uA[t]||(uA[t]=new Qi(t)),uA[t]},jd=new ju(0,0,0,0,!0),Sc=new ju(0,0,0,0),hA=Ln(function(r,t,e,n){return new ju(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),Yn=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ge.kNumber;return new _n(t,e)};new _n(50,"%");function Dp(r){var t=r.type,e=r.value;return t==="hex"?"#".concat(e):t==="literal"?e:t==="rgb"?"rgb(".concat(e.join(","),")"):"rgba(".concat(e.join(","),")")}var dA=function(){var r={linearGradient:/^(linear\-gradient)/i,repeatingLinearGradient:/^(repeating\-linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,repeatingRadialGradient:/^(repeating\-radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/^\#([0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^rgb/i,rgbaColor:/^rgba/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/},t="";function e(Pt){throw new Error("".concat(t,": ").concat(Pt))}function n(){var Pt=i();return t.length>0&&e("Invalid input not EOF"),Pt}function i(){return C(a)}function a(){return s("linear-gradient",r.linearGradient,A)||s("repeating-linear-gradient",r.repeatingLinearGradient,A)||s("radial-gradient",r.radialGradient,u)||s("repeating-radial-gradient",r.repeatingRadialGradient,u)||s("conic-gradient",r.conicGradient,u)}function s(Pt,xt,Ft){return o(xt,function(_t){var Xt=Ft();return Xt&&(bt(r.comma)||e("Missing comma before color stops")),{type:Pt,orientation:Xt,colorStops:C(F)}})}function o(Pt,xt){var Ft=bt(Pt);if(Ft){bt(r.startCall)||e("Missing (");var _t=xt(Ft);return bt(r.endCall)||e("Missing )"),_t}}function A(){return l()||c()}function l(){return wt("directional",r.sideOrCorner,1)}function c(){return wt("angular",r.angleValue,1)}function u(){var Pt,xt=h(),Ft;return xt&&(Pt=[],Pt.push(xt),Ft=t,bt(r.comma)&&(xt=h(),xt?Pt.push(xt):t=Ft)),Pt}function h(){var Pt=d()||f();if(Pt)Pt.at=v();else{var xt=g();if(xt){Pt=xt;var Ft=v();Ft&&(Pt.at=Ft)}else{var _t=m();_t&&(Pt={type:"default-radial",at:_t})}}return Pt}function d(){var Pt=wt("shape",/^(circle)/i,0);return Pt&&(Pt.style=pt()||g()),Pt}function f(){var Pt=wt("shape",/^(ellipse)/i,0);return Pt&&(Pt.style=at()||g()),Pt}function g(){return wt("extent-keyword",r.extentKeywords,1)}function v(){if(wt("position",/^at/,0)){var Pt=m();return Pt||e("Missing positioning value"),Pt}}function m(){var Pt=w();if(Pt.x||Pt.y)return{type:"position",value:Pt}}function w(){return{x:at(),y:at()}}function C(Pt){var xt=Pt(),Ft=[];if(xt)for(Ft.push(xt);bt(r.comma);)xt=Pt(),xt?Ft.push(xt):e("One extra comma");return Ft}function F(){var Pt=Q();return Pt||e("Expected color definition"),Pt.length=at(),Pt}function Q(){return K()||J()||G()||D()}function D(){return wt("literal",r.literalColor,0)}function K(){return wt("hex",r.hexColor,1)}function G(){return o(r.rgbColor,function(){return{type:"rgb",value:C($)}})}function J(){return o(r.rgbaColor,function(){return{type:"rgba",value:C($)}})}function $(){return bt(r.number)[1]}function at(){return wt("%",r.percentageValue,1)||At()||pt()}function At(){return wt("position-keyword",r.positionKeywords,1)}function pt(){return wt("px",r.pixelValue,1)||wt("em",r.emValue,1)}function wt(Pt,xt,Ft){var _t=bt(xt);if(_t)return{type:Pt,value:_t[Ft]}}function bt(Pt){var xt=/^[\n\r\t\s]+/.exec(t);xt&&Rt(xt[0].length);var Ft=Pt.exec(t);return Ft&&Rt(Ft[0].length),Ft}function Rt(Pt){t=t.substring(Pt)}return function(Pt){return t=Pt,n()}}();function Rp(r,t,e,n){var i=Un(n.value),a=0,s=0,o=a+t/2,A=s+e/2,l=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*l/2,u=r[1]+A-Math.sin(i)*l/2,h=r[0]+o+Math.cos(i)*l/2,d=r[1]+A+Math.sin(i)*l/2;return{x1:c,y1:u,x2:h,y2:d}}function _p(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===ge.kPercentage&&(s=n.value/100*t),i.unit===ge.kPercentage&&(o=i.value/100*e);var A=Math.max(Li([0,0],[s,o]),Li([0,e],[s,o]),Li([t,e],[s,o]),Li([t,0],[s,o]));return a&&(a instanceof _n?A=a.value:a instanceof Qi&&(a.value==="closest-side"?A=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?A=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(A=Math.min(Li([0,0],[s,o]),Li([0,e],[s,o]),Li([t,e],[s,o]),Li([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:A}}var Yd=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,Hp=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,Xd=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Jd=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function Gp(r){var t,e=r.length;if(r[e-1].length=(t=r[e-1].length)!==null&&t!==void 0?t:{type:"%",value:"100"},e>1){var n;r[0].length=(n=r[0].length)!==null&&n!==void 0?n:{type:"%",value:"0"}}for(var i=0,a=Number(r[0].length.value),s=1;s-1||r.indexOf("radial")>-1){var t=dA(r);return t.map(function(o){var A=o.type,l=o.orientation,c=o.colorStops;Gp(c);var u=c.map(function(C){return{offset:Yn(Number(C.length.value),"%"),color:Dp(C)}});if(A==="linear-gradient")return new tl(vs.LinearGradient,{angle:l?zp(l):Eo,steps:u});if(A==="radial-gradient"&&(l||(l=[{type:"shape",value:"circle"}]),l[0].type==="shape"&&l[0].value==="circle")){var h=Vp(l[0].at),d=h.cx,f=h.cy,g;if(l[0].style){var v=l[0].style,m=v.type,w=v.value;m==="extent-keyword"?g=Pp(w):g=Yn(w,m)}return new tl(vs.RadialGradient,{cx:d,cy:f,size:g,steps:u})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=Yd.exec(r);if(n){var i,a=((i=n[2].match(Jd))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new tl(vs.LinearGradient,{angle:Yn(parseFloat(n[1]),"deg"),steps:a.map(function(o){var A=(0,U.Z)(o,2),l=A[0],c=A[1];return{offset:Yn(Number(l)*100,"%"),color:c}})})]}}else if(e==="r"){var s=Zp(r);if(s)if(gn(s))r=s;else return[new tl(vs.RadialGradient,s)]}else if(e==="p")return jp(r)}});function Zp(r){var t=Hp.exec(r);if(t){var e,n=((e=t[4].match(Jd))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:Yn(50,"%"),cy:Yn(50,"%"),steps:n.map(function(i){var a=(0,U.Z)(i,2),s=a[0],o=a[1];return{offset:Yn(Number(s)*100,"%"),color:o}})}}return null}function jp(r){var t=Xd.exec(r);if(t){var e=t[1],n=t[2];switch(e){case"a":e="repeat";break;case"x":e="repeat-x";break;case"y":e="repeat-y";break;case"n":e="no-repeat";break;default:e="no-repeat"}return{image:n,repetition:e}}return null}function rE(r){return!!r.type&&!!r.value}function Bo(r){return r&&!!r.image}function Mc(r){return r&&!Pe(r.r)&&!Pe(r.g)&&!Pe(r.b)}var nl=Ln(function(r){if(Bo(r))return(0,H.Z)({repetition:"repeat"},r);if(Pe(r)&&(r=""),r==="transparent")return Sc;if(r==="currentColor")r="black";else if(r==="none")return jd;var t=Wp(r);if(t)return t;var e=wc(r),n=[0,0,0,0];return e!==null&&(n[0]=e.r||0,n[1]=e.g||0,n[2]=e.b||0,n[3]=e.opacity),hA.apply(void 0,n)});function Yp(r,t){if(!(!Mc(r)||!Mc(t)))return[[Number(r.r),Number(r.g),Number(r.b),Number(r.alpha)],[Number(t.r),Number(t.g),Number(t.b),Number(t.alpha)],function(e){var n=e.slice();if(n[3])for(var i=0;i<3;i++)n[i]=Math.round(hr(n[i],0,255));return n[3]=hr(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function rl(r,t){if(Pe(t))return Yn(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return Yn(Number(t),"px");if("deg".search(r)>=0)return Yn(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return Yn(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var E=function(t){return rl(new RegExp("px","g"),t)},p=Ln(E),b=function(t){return rl(new RegExp("%","g"),t)};Ln(b);var B=function(t){return ye(t)||isFinite(Number(t))?Yn(Number(t)||0,"px"):rl(new RegExp("px|%|em|rem","g"),t)},_=Ln(B),j=function(t){return rl(new RegExp("deg|rad|grad|turn","g"),t)},tt=Ln(j);function dt(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=t.value||0,A=Zu(r.unit),l=r.convertTo(A),c=t.convertTo(A);return l&&c?(s=l.value,o=c.value,a=Wu(r.unit)):(_n.isLength(r.unit)||_n.isLength(t.unit))&&(s=Ot(r,i,e),o=Ot(t,i,e),a="px"),[s,o,function(u){return n&&(u=Math.max(u,0)),u+a}]}function lt(r){var t=0;return r.unit===ge.kDegrees?t=r.value:r.unit===ge.kRadians?t=Bi(Number(r.value)):r.unit===ge.kTurns?t=Qd(Number(r.value)):r.value&&(t=r.value),t}function Tt(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):gn(r)?e=r.split(" ").map(function(n){return Number(n)}):ye(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat((0,N.Z)(e),(0,N.Z)(e)):e}function Ot(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===ge.kPixels)return Number(r.value);if(r.unit===ge.kPercentage&&e){var i=e.nodeName===Vt.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var Dt=function(t){return rl(/deg|rad|grad|turn|px|%/g,t)},Jt=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Oe(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var t=/\s*([\w-]+)\(([^)]*)\)/g,e=[],n,i=0;n=t.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,Jt.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return Dt(a)||nl(a)})}),t.lastIndex===r.length)return e}return[]}function fe(r){return r.toString()}var Be=function(t){return typeof t=="number"?Yn(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Yn(Number(t)):Yn(0)},an=Ln(Be);Ln(function(r){return gn(r)?r.split(" ").map(an):r.map(an)});function Ue(r,t){return[r,t,fe]}function Ne(r,t){return function(e,n){return[e,n,function(i){return fe(hr(i,r,t))}]}}function Mn(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function An(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=Hv(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function Xe(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=Qu(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function Fe(r){for(var t=0;t0&&e.push(n),{polygons:t,polylines:e}}function Ze(r,t){return r[0]===t[0]&&r[1]===t[1]}function Fr(r,t){for(var e=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-l:l,c=c>Math.PI/2?Math.PI-c:c;var u={xExtra:Math.cos(A/2-l)*(t/2*(1/Math.sin(A/2)))-t/2||0,yExtra:Math.cos(c-A/2)*(t/2*(1/Math.sin(A/2)))-t/2||0};return u}function Ui(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var Kn=function(t,e){var n=t.x*e.x+t.y*e.y,i=Math.sqrt((Math.pow(t.x,2)+Math.pow(t.y,2))*(Math.pow(e.x,2)+Math.pow(e.y,2))),a=t.x*e.y-t.y*e.x<0?-1:1,s=a*Math.acos(n/i);return s},zr=function(t,e,n,i,a,s,o,A){e=Math.abs(e),n=Math.abs(n),i=ud(i,360);var l=Un(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,u=(t.y-o.y)/2,h={x:Math.cos(l)*c+Math.sin(l)*u,y:-Math.sin(l)*c+Math.cos(l)*u},d=Math.pow(h.x,2)/Math.pow(e,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var f=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2),g=Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2),v=f/g;v=v<0?0:v;var m=(a!==s?1:-1)*Math.sqrt(v),w={x:m*(e*h.y/n),y:m*(-(n*h.x)/e)},C={x:Math.cos(l)*w.x-Math.sin(l)*w.y+(t.x+o.x)/2,y:Math.sin(l)*w.x+Math.cos(l)*w.y+(t.y+o.y)/2},F={x:(h.x-w.x)/e,y:(h.y-w.y)/n},Q=Kn({x:1,y:0},F),D={x:(-h.x-w.x)/e,y:(-h.y-w.y)/n},K=Kn(F,D);!s&&K>0?K-=2*Math.PI:s&&K<0&&(K+=2*Math.PI),K%=2*Math.PI;var G=Q+K*A,J=e*Math.cos(G),$=n*Math.sin(G),at={x:Math.cos(l)*J-Math.sin(l)*$+C.x,y:Math.sin(l)*J+Math.cos(l)*$+C.y,ellipticalArcStartAngle:Q,ellipticalArcEndAngle:Q+K,ellipticalArcAngle:G,ellipticalArcCenter:C,resultantRx:e,resultantRy:n};return at};function Ws(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,A=n.xRotation,l=n.arcFlag,c=n.sweepFlag,u=zr({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),h=zr({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),d=h.x-u.x,f=h.y-u.y,g=Math.sqrt(d*d+f*f);return{x:-d/g,y:-f/g}}function si(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function ps(r,t){return si(r)*si(t)?(r[0]*t[0]+r[1]*t[1])/(si(r)*si(t)):1}function Ta(r,t){return(r[0]*t[1]1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var f=e*e*(h*h)+n*n*(u*u),g=f?Math.sqrt((e*e*(n*n)-f)/f):1;a===s&&(g*=-1),isNaN(g)&&(g=0);var v=n?g*e*h/n:0,m=e?g*-n*u/e:0,w=(o+l)/2+Math.cos(i)*v-Math.sin(i)*m,C=(A+c)/2+Math.sin(i)*v+Math.cos(i)*m,F=[(u-v)/e,(h-m)/n],Q=[(-1*u-v)/e,(-1*h-m)/n],D=Ta([1,0],F),K=Ta(F,Q);return ps(F,Q)<=-1&&(K=Math.PI),ps(F,Q)>=1&&(K=0),s===0&&K>0&&(K-=2*Math.PI),s===1&&K<0&&(K+=2*Math.PI),{cx:w,cy:C,rx:Ze(r,[l,c])?0:e,ry:Ze(r,[l,c])?0:n,startAngle:D,endAngle:D+K,xRotation:i,arcFlag:a,sweepFlag:s}}function bo(r,t,e){return r.reduce(function(n,i){var a="";if(i[0]==="M"||i[0]==="L"){var s=vec3.fromValues(i[1],i[2],0);e&&vec3.transformMat4(s,s,e),a="".concat(i[0]).concat(s[0],",").concat(s[1])}else if(i[0]==="Z")a=i[0];else if(i[0]==="C"){var o=vec3.fromValues(i[1],i[2],0),A=vec3.fromValues(i[3],i[4],0),l=vec3.fromValues(i[5],i[6],0);e&&(vec3.transformMat4(o,o,e),vec3.transformMat4(A,A,e),vec3.transformMat4(l,l,e)),a="".concat(i[0]).concat(o[0],",").concat(o[1],",").concat(A[0],",").concat(A[1],",").concat(l[0],",").concat(l[1])}else if(i[0]==="A"){var c=vec3.fromValues(i[6],i[7],0);e&&vec3.transformMat4(c,c,e),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],",").concat(i[5],",").concat(c[0],",").concat(c[1])}else if(i[0]==="Q"){var u=vec3.fromValues(i[1],i[2],0),h=vec3.fromValues(i[3],i[4],0);e&&(vec3.transformMat4(u,u,e),vec3.transformMat4(h,h,e)),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],"}")}return n+=a},"")}function xo(r,t,e,n){return[["M",r,t],["L",e,n]]}function Ya(r,t,e,n){var i=(-1+Math.sqrt(2))/3*4,a=r*i,s=t*i,o=e-r,A=e+r,l=n-t,c=n+t;return[["M",o,n],["C",o,n-s,e-a,l,e,l],["C",e+a,l,A,n-s,A,n],["C",A,n+s,e+a,c,e,c],["C",e-a,c,o,n+s,o,n],["Z"]]}function Co(r,t){var e=r.map(function(n,i){return[i===0?"M":"L",n[0],n[1]]});return t&&e.push(["Z"]),e}function ms(r,t,e,n,i){if(i){var a=_slicedToArray(i,4),s=a[0],o=a[1],A=a[2],l=a[3],c=r>0?1:-1,u=t>0?1:-1,h=c+u!==0?1:0;return[["M",c*s+e,n],["L",r-c*o+e,n],o?["A",o,o,0,0,h,r+e,u*o+n]:null,["L",r+e,t-u*A+n],A?["A",A,A,0,0,h,r+e-c*A,t+n]:null,["L",e+c*l,t+n],l?["A",l,l,0,0,h,e,t+n-u*l]:null,["L",e,u*s+n],s?["A",s,s,0,0,h,c*s+e,n]:null,["Z"]].filter(function(d){return d})}return[["M",e,n],["L",e+r,n],["L",e+r,n+t],["L",e,n+t],["Z"]]}function il(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:r.getLocalTransform(),e=[];switch(r.nodeName){case Vt.LINE:var n=r.parsedStyle,i=n.x1,a=i===void 0?0:i,s=n.y1,o=s===void 0?0:s,A=n.x2,l=A===void 0?0:A,c=n.y2,u=c===void 0?0:c;e=xo(a,o,l,u);break;case Vt.CIRCLE:{var h=r.parsedStyle,d=h.r,f=d===void 0?0:d,g=h.cx,v=g===void 0?0:g,m=h.cy,w=m===void 0?0:m;e=Ya(f,f,v,w);break}case Vt.ELLIPSE:{var C=r.parsedStyle,F=C.rx,Q=F===void 0?0:F,D=C.ry,K=D===void 0?0:D,G=C.cx,J=G===void 0?0:G,$=C.cy,at=$===void 0?0:$;e=Ya(Q,K,J,at);break}case Vt.POLYLINE:case Vt.POLYGON:var At=r.parsedStyle.points;e=Co(At.points,r.nodeName===Vt.POLYGON);break;case Vt.RECT:var pt=r.parsedStyle,wt=pt.width,bt=wt===void 0?0:wt,Rt=pt.height,Pt=Rt===void 0?0:Rt,xt=pt.x,Ft=xt===void 0?0:xt,_t=pt.y,Xt=_t===void 0?0:_t,ie=pt.radius,le=ie&&ie.some(function(xe){return xe!==0});e=ms(bt,Pt,Ft,Xt,le&&ie.map(function(xe){return clamp(xe,0,Math.min(Math.abs(bt)/2,Math.abs(Pt)/2))}));break;case Vt.PATH:var ve=r.parsedStyle.d.absolutePath;e=_toConsumableArray(ve);break}if(e.length)return bo(e,r,t)}function Tc(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=r.map(function(s,o){var A=s[0],l=r[o+1],c=o===0&&(t!==0||e!==0),u=(o===r.length-1||l&&(l[0]==="M"||l[0]==="Z"))&&n!==0&&i!==0,h=c?[t,e]:[0,0],d=_slicedToArray(h,2),f=d[0],g=d[1],v=u?[n,i]:[0,0],m=_slicedToArray(v,2),w=m[0],C=m[1];switch(A){case"M":return"M ".concat(s[1]+f,",").concat(s[2]+g);case"L":return"L ".concat(s[1]+w,",").concat(s[2]+C);case"Q":return"Q ".concat(s[1]," ").concat(s[2],",").concat(s[3]+w," ").concat(s[4]+C);case"C":return"C ".concat(s[1]," ").concat(s[2],",").concat(s[3]," ").concat(s[4],",").concat(s[5]+w," ").concat(s[6]+C);case"A":return"A ".concat(s[1]," ").concat(s[2]," ").concat(s[3]," ").concat(s[4]," ").concat(s[5]," ").concat(s[6]," ").concat(s[7]).concat(u?" L ".concat(s[6]+n,",").concat(s[7]+i):"");case"Z":return"Z";default:return null}}).filter(function(s){return s!==null}).join(" ");return~a.indexOf("NaN")?"":a}var iE=function(t){if(t===""||Array.isArray(t)&&t.length===0)return{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:{x:0,y:0,width:0,height:0}};var e;try{e=ql(t)}catch(d){e=ql(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}Fe(e);var n=bn(e),i=xn(e),a=i.polygons,s=i.polylines,o=Ws(e),A=Fr(o,0),l=A.x,c=A.y,u=A.width,h=A.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(l)?l:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(u)?u:0,height:Number.isFinite(h)?h:0}}},AM=Ln(iE);function aE(r){return gn(r)?AM(r):iE(r)}function lM(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=Cu(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=Cu(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=fd(n,i));var s=gd(a[0])!==gd(a[1])?Yv(a[0]):Xv(a[0]);return[s,vd(a[1],s),function(o){return o}]}function cM(r,t){var e;return gn(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=(0,U.Z)(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function uM(r,t){return[r.points,t.points,function(e){return e}]}var xr=null,Fc=/\s*(\w+)\(([^)]*)\)/g;function ca(r){return function(t){var e=0;return r.map(function(n){return n===xr?t[e++]:n})}}function al(r){return r}var Yu={matrix:["NNNNNN",[xr,xr,0,0,xr,xr,0,0,0,0,1,0,xr,xr,0,1],al],matrix3d:["NNNNNNNNNNNNNNNN",al],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",ca([xr,xr,new _n(1)]),al],scaleX:["N",ca([xr,new _n(1),new _n(1)]),ca([xr,new _n(1)])],scaleY:["N",ca([new _n(1),xr,new _n(1)]),ca([new _n(1),xr])],scaleZ:["N",ca([new _n(1),new _n(1),xr])],scale3d:["NNN",al],skew:["Aa",null,al],skewX:["A",null,ca([xr,Eo])],skewY:["A",null,ca([Eo,xr])],translate:["Tt",ca([xr,xr,Ma]),al],translateX:["T",ca([xr,Ma,Ma]),ca([xr,Ma])],translateY:["T",ca([Ma,xr,Ma]),ca([Ma,xr])],translateZ:["L",ca([Ma,Ma,xr])],translate3d:["TTL",al]};function sE(r){for(var t=[],e=r.length,n=0;n2&&arguments[2]!==void 0?arguments[2]:{skipUpdateAttribute:!1,skipParse:!1,forceUpdateGeometry:!1,usedAttributes:[],memoize:!0};Object.assign(e.attributes,n);var a=e.parsedStyle.clipPath,s=e.parsedStyle.offsetPath;CM(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var A in n)if(bM.has(A)){o=!0;break}}var l=uE(e);l.has("fill")&&n.fill&&(e.parsedStyle.fill=nl(n.fill)),l.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=nl(n.stroke)),l.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=nl(n.shadowColor)),l.has("filter")&&n.filter&&(e.parsedStyle.filter=Oe(n.filter)),l.has("radius")&&!Pe(n.radius)&&(e.parsedStyle.radius=Tt(n.radius,4)),l.has("lineDash")&&!Pe(n.lineDash)&&(e.parsedStyle.lineDash=Tt(n.lineDash,"even")),l.has("points")&&n.points&&(e.parsedStyle.points=cM(n.points)),l.has("d")&&n.d===""&&(e.parsedStyle.d=(0,H.Z)({},hs)),l.has("d")&&n.d&&(e.parsedStyle.d=aE(n.d)),l.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[oe.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),l.has("clipPath")&&!Ye(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[oe.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),l.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[oe.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),l.has("transform")&&n.transform&&(e.parsedStyle.transform=oE(n.transform)),l.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=BM(n.transformOrigin)),l.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),l.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),l.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),l.has("zIndex")&&!Pe(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[oe.Z_INDEX].postProcessor(e),l.has("offsetDistance")&&!Pe(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[oe.OFFSET_DISTANCE].postProcessor(e),l.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[oe.TRANSFORM].postProcessor(e),l.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[oe.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.dirty(!0,!0),i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new jn),a.renderBounds||(a.renderBounds=new jn);var s=e.parsedStyle,o=i.update(s,e),A=o.cx,l=A===void 0?0:A,c=o.cy,u=c===void 0?0:c,h=o.cz,d=h===void 0?0:h,f=o.hwidth,g=f===void 0?0:f,v=o.hheight,m=v===void 0?0:v,w=o.hdepth,C=w===void 0?0:w,F=[Math.abs(g),Math.abs(m),C],Q=s.stroke,D=s.lineWidth,K=D===void 0?1:D,G=s.increasedLineWidthForHitTesting,J=G===void 0?0:G,$=s.shadowType,at=$===void 0?"outer":$,At=s.shadowColor,pt=s.filter,wt=pt===void 0?[]:pt,bt=s.transformOrigin,Rt=[l,u,d];a.contentBounds.update(Rt,F);var Pt=n===Vt.POLYLINE||n===Vt.POLYGON||n===Vt.PATH?Math.SQRT2:.5,xt=Q&&!Q.isNone;if(xt){var Ft=((K||0)+(J||0))*Pt;F[0]+=Ft,F[1]+=Ft}if(a.renderBounds.update(Rt,F),At&&at&&at!=="inner"){var _t=a.renderBounds,Xt=_t.min,ie=_t.max,le=s.shadowBlur,ve=s.shadowOffsetX,xe=s.shadowOffsetY,Qe=le||0,Re=ve||0,nn=xe||0,mn=Xt[0]-Qe+Re,sn=ie[0]+Qe+Re,er=Xt[1]-Qe+nn,kn=ie[1]+Qe+nn;Xt[0]=Math.min(Xt[0],mn),ie[0]=Math.max(ie[0],sn),Xt[1]=Math.min(Xt[1],er),ie[1]=Math.max(ie[1],kn),a.renderBounds.setMinMax(Xt,ie)}wt.forEach(function(Bn){var Ls=Bn.name,ui=Bn.params;if(Ls==="blur"){var Ki=ui[0].value;a.renderBounds.update(a.renderBounds.center,ue(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[Ki,Ki,0]))}else if(Ls==="drop-shadow"){var cn=ui[0].value,Tn=ui[1].value,hn=ui[2].value,Sn=a.renderBounds,Pn=Sn.min,ke=Sn.max,Fn=Pn[0]-hn+cn,En=ke[0]+hn+cn,cr=Pn[1]-hn+Tn,$e=ke[1]+hn+Tn;Pn[0]=Math.min(Pn[0],Fn),ke[0]=Math.max(ke[0],En),Pn[1]=Math.min(Pn[1],cr),ke[1]=Math.max(ke[1],$e),a.renderBounds.setMinMax(Pn,ke)}}),e.geometry.dirty=!1;var Cn=g<0,gr=m<0,va=(Cn?-1:1)*(bt?Ot(bt[0],0,e,!0):0),Hn=(gr?-1:1)*(bt?Ot(bt[1],1,e,!0):0);(va||Hn)&&e.setOrigin(va,Hn)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===Vt.CIRCLE&&(e.style.rawR||(e.style.rawR=e.style.r),e.style.r=(e.style.rawR||1)/n)):(e.style.rawLineWidth&&(e.style.lineWidth=e.style.rawLineWidth,delete e.style.rawLineWidth),e.nodeName===Vt.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function CM(r,t){var e=uE(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function uE(r){return r.constructor.PARSED_STYLE_LIST}var SM=function(){function r(){(0,L.Z)(this,r),this.mixer=Ue}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i,a){return lt(i)}}])}(),MM=function(){function r(){(0,L.Z)(this,r)}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof Qi&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtyToRoot(o)}),i}}])}(),TM=function(){function r(){(0,L.Z)(this,r),this.parser=nl,this.mixer=Yp}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Qi?i.value==="none"?jd:Sc:i}}])}(),FM=function(){function r(){(0,L.Z)(this,r)}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof Qi?[]:i}}])}();function hE(r){var t=r.parsedStyle,e=t.fontSize;return Pe(e)?null:e}var tm=function(){function r(){(0,L.Z)(this,r),this.mixer=Ue}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){if(ye(i))return i;if(_n.isRelativeUnit(i.unit)){if(i.unit===ge.kPercentage)return 0;if(i.unit===ge.kEms){if(a.parentNode){var o=hE(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===ge.kRems){var A;if(a!=null&&(A=a.ownerDocument)!==null&&A!==void 0&&A.documentElement){var l=hE(a.ownerDocument.documentElement);if(l)return l*=i.value,l}return 0}}else return i.value}}])}(),OM=function(){function r(){(0,L.Z)(this,r),this.mixer=Mn}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),IM=function(){function r(){(0,L.Z)(this,r),this.mixer=Mn}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),LM=function(){function r(){(0,L.Z)(this,r)}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof Qi&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),NM=function(){function r(){(0,L.Z)(this,r),this.mixer=Ue}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),kM=function(){function r(){(0,L.Z)(this,r),this.mixer=Ne(0,1)}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}},{key:"postProcessor",value:function(e){var n=e.parsedStyle,i=n.offsetPath,a=n.offsetDistance;if(i){var s=i.nodeName;if(s===Vt.LINE||s===Vt.PATH||s===Vt.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),QM=function(){function r(){(0,L.Z)(this,r),this.mixer=Ne(0,1)}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),UM=function(){function r(){(0,L.Z)(this,r),this.parser=aE,this.mixer=lM}return(0,I.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof Qi&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new cs(0,0,0,0)}:i}}])}(),PM=(0,I.Z)(function r(){(0,L.Z)(this,r),this.mixer=uM}),DM=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a>>1;dE(r[i],t)<0?e=i+1:n=i}return e}function dE(r,t){var e=Number(r.parsedStyle.zIndex||0),n=Number(t.parsedStyle.zIndex||0);if(e===n){var i=r.parentNode;if(i){var a=i.childNodes||[];return a.indexOf(r)-a.indexOf(t)}}return e-n}function fE(r){var t=r;do{var e,n=(e=t.parsedStyle)===null||e===void 0?void 0:e.clipPath;if(n)return t;t=t.parentElement}while(t!==null);return null}var gE="px";function zM(r,t,e){nm&&r.style&&(r.style.width=t+gE,r.style.height=e+gE)}function vE(r,t){if(nm)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function VM(r){var t=vE(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function WM(r){var t=vE(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var ZM=1,jM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},rm=typeof performance=="object"&&performance.now?performance:Date;function qd(r){return r.nodeName===Vt.FRAGMENT?!0:r.getRootNode().nodeName===Vt.FRAGMENT}function sl(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"auto",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,n=!1,i=!1,a=!!t&&!t.isNone,s=!!e&&!e.isNone;return r==="visiblepainted"||r==="painted"||r==="auto"?(n=a,i=s):r==="visiblefill"||r==="fill"?n=!0:r==="visiblestroke"||r==="stroke"?i=!0:(r==="visible"||r==="all")&&(n=!0,i=!0),[n,i]}var YM=1,XM=function(){return YM++},js=typeof self=="object"&&self.self===self?self:typeof M.g=="object"&&M.g.global===M.g?M.g:{},JM=Date.now(),qM=function(){return js.performance&&typeof js.performance.now=="function"?js.performance.now():Date.now()-JM},Xu={},pE=Date.now(),$M=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-pE,i=n>16?0:16-n,a=XM();return Xu[a]=t,Object.keys(Xu).length>1||setTimeout(function(){pE=e;var s=Xu;Xu={},Object.keys(s).forEach(function(o){return s[o](qM())})},i),a},tT=function(t){delete Xu[t]},eT=["","webkit","moz","ms","o"],mE=function(t){return typeof t!="string"?$M:t===""?js.requestAnimationFrame:js["".concat(t,"RequestAnimationFrame")]},nT=function(t){return typeof t!="string"?tT:t===""?js.cancelAnimationFrame:js["".concat(t,"CancelAnimationFrame")]||js["".concat(t,"CancelRequestAnimationFrame")]},rT=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},yE=rT(eT,function(r){return!!mE(r)}),im=mE(yE),wE=nT(yE);js.requestAnimationFrame=im,js.cancelAnimationFrame=wE;var iT=function(){function r(){(0,L.Z)(this,r),this.callbacks=[]}return(0,I.Z)(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i=0;c--){var u=l[c].trim();!oT.test(u)&&sT.indexOf(u)<0&&(u='"'.concat(u,'"')),l[c]=u}return"".concat(a," ").concat(s," ").concat(o," ").concat(A," ").concat(l.join(","))},function(r){var t=EE(r),e=t.fontSize,n=t.fontFamily,i=t.fontStyle,a=t.fontVariant,s=t.fontWeight;return"".concat(i,"_").concat(a,"_").concat(s,"_").concat(e,"_").concat(n)}),AT=1e-6,Ju=function(t){return Math.max(t,AT)};function sm(r,t,e){return Ie(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var Pr=te(),lT=te(),cT={scale:function(t){Dn(Pr,[t[0].value,t[1].value,1].map(function(e){return Ju(e)}))},scaleX:function(t){Dn(Pr,[t[0].value,1,1].map(function(e){return Ju(e)}))},scaleY:function(t){Dn(Pr,[1,t[0].value,1].map(function(e){return Ju(e)}))},scaleZ:function(t){Dn(Pr,[1,1,t[0].value].map(function(e){return Ju(e)}))},scale3d:function(t){Dn(Pr,[t[0].value,t[1].value,t[2].value].map(function(e){return Ju(e)}))},translate:function(t){Tr(Pr,[t[0].value,t[1].value,0])},translateX:function(t){Tr(Pr,[t[0].value,0,0])},translateY:function(t){Tr(Pr,[0,t[0].value,0])},translateZ:function(t){Tr(Pr,[0,0,t[0].value])},translate3d:function(t){Tr(Pr,[t[0].value,t[1].value,t[2].value])},rotate:function(t){wr(Pr,Un(lt(t[0])))},rotateX:function(t){Ji(Pr,Un(lt(t[0])))},rotateY:function(t){fn(Pr,Un(lt(t[0])))},rotateZ:function(t){wr(Pr,Un(lt(t[0])))},rotate3d:function(t){Xi(Pr,Un(lt(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){sm(Pr,Un(t[0].value),Un(t[1].value))},skewX:function(t){sm(Pr,Un(t[0].value),0)},skewY:function(t){sm(Pr,0,Un(t[0].value))},matrix:function(t){Wn(Pr,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){Wn.apply(O,[Pr].concat((0,N.Z)(t.map(function(e){return e.value}))))}},uT=Gt(1,1,1),hT=Ct(),bE={translate:function(t,e){ae.sceneGraphService.setLocalScale(t,uT,!1),ae.sceneGraphService.setLocalEulerAngles(t,hT,void 0,void 0,!1),ae.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),ae.sceneGraphService.dirtyLocalTransform(t,t.transformable)}};function xE(r,t){if(r.length){if(r.length===1&&bE[r[0].t]){bE[r[0].t](t,r[0].d);return}for(var e=Ie(lT),n=0;n1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0;if(i)return this.dispatchEventToSelf(e),!0;var a;if(this.document)a=this;else if(this.defaultView)a=this.defaultView;else{var s;a=(s=this.ownerDocument)===null||s===void 0?void 0:s.defaultView}if(a){if(e.manager=a.getEventService(),!e.manager)return!1;e.defaultPrevented=!1,e.path?e.path.length=0:e.page=[],n||(e.target=this),e.manager.dispatchEvent(e,e.type,n)}else this.dispatchEventToSelf(e);return!e.defaultPrevented}}])}(),vr=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(On)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(On)}},{key:"lookupPrefix",value:function(n){throw new Error(On)}},{key:"normalize",value:function(){throw new Error(On)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(A=i.parentNode)!==null&&A!==void 0?A:a.parentNode;){var A;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var l=s.length>o.length?s:o,c=l===s?o:s;if(l[l.length-c.length]===c[0])return l===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var u=l.length-c.length,h=c.length-1;h>=0;h--){var d=c[h],f=l[u+h];if(f!==d){var g=d.parentNode.childNodes;return g.indexOf(d)0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(SE);vr.DOCUMENT_POSITION_DISCONNECTED=1,vr.DOCUMENT_POSITION_PRECEDING=2,vr.DOCUMENT_POSITION_FOLLOWING=4,vr.DOCUMENT_POSITION_CONTAINS=8,vr.DOCUMENT_POSITION_CONTAINED_BY=16,vr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var CT=2048,ST=function(){function r(t,e){var n=this;(0,L.Z)(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=te(),this.tmpVec3=Ct(),this.onPointerDown=function(i){var a=n.createPointerEvent(i);if(n.dispatchEvent(a,"pointerdown"),a.pointerType==="touch")n.dispatchEvent(a,"touchstart");else if(a.pointerType==="mouse"||a.pointerType==="pen"){var s=a.button===2;n.dispatchEvent(a,s?"rightdown":"mousedown")}var o=n.trackingData(i.pointerId);o.pressTargetsByButton[i.button]=a.composedPath(),n.freeEvent(a)},this.onPointerUp=function(i){var a=rm.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var A=n.trackingData(i.pointerId),l=n.findMountedTarget(A.pressTargetsByButton[i.button]),c=l;if(l&&!s.composedPath().includes(l)){for(var u=l;u&&!s.composedPath().includes(u);){if(s.currentTarget=u,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var h=s.button===2;n.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}vr.isNode(u)&&(u=u.parentNode)}delete A.pressTargetsByButton[i.button],c=u}if(c){var d,f=n.clonePointerEvent(s,"click");f.target=c,f.path=[],A.clicksByButton[i.button]||(A.clicksByButton[i.button]={clickCount:0,target:f.target,timeStamp:a});var g=n.context.renderingContext.root.ownerDocument.defaultView,v=A.clicksByButton[i.button];v.target===f.target&&a-v.timeStamp=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;os||i>o?null:!A&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n=0;i--){var a=e[i];if(a===this.rootTarget||vr.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=GM(n)&&n.getAttribute("cursor");if(i)return i;n=vr.isNode(n)&&n.parentNode}}}])}(),Am=function(){function r(){(0,L.Z)(this,r)}return(0,I.Z)(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||ae.offscreenCanvas)this.canvas=e||ae.offscreenCanvas,this.context=this.canvas.getContext("2d",(0,H.Z)({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",(0,H.Z)({willReadFrequently:!0},n)),(!this.context||!this.context.measureText)&&(this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d"))}catch(i){this.canvas=document.createElement("canvas"),this.context=this.canvas.getContext("2d",(0,H.Z)({willReadFrequently:!0},n))}return this.canvas.width=10,this.canvas.height=10,this.canvas}},{key:"getOrCreateContext",value:function(e,n){return this.context?this.context:(this.getOrCreateCanvas(e,n),this.context)}}],[{key:"createCanvas",value:function(){try{return new window.OffscreenCanvas(0,0)}catch(e){}try{return document.createElement("canvas")}catch(e){}return null}}])}(),Oc=function(r){return r[r.CAMERA_CHANGED=0]="CAMERA_CHANGED",r[r.DISPLAY_OBJECT_CHANGED=1]="DISPLAY_OBJECT_CHANGED",r[r.NONE=2]="NONE",r}({}),MT=function(){function r(t,e){(0,L.Z)(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new ta,initAsync:new iT,dirtycheck:new am,cull:new am,beginFrame:new ta,beforeRender:new ta,render:new ta,afterRender:new ta,endFrame:new ta,destroy:new ta,pick:new aT,pickSync:new am,pointerDown:new ta,pointerUp:new ta,pointerMove:new ta,pointerOut:new ta,pointerOver:new ta,pointerWheel:new ta,pointerCancel:new ta,click:new ta},this.globalRuntime=t,this.context=e}return(0,I.Z)(r,[{key:"init",value:function(e){var n=this,i=(0,H.Z)((0,H.Z)({},this.globalRuntime),this.context);this.context.renderingPlugins.forEach(function(a){a.apply(i,n.globalRuntime)}),this.hooks.init.call(),this.hooks.initAsync.getCallbacksNum()===0?(this.inited=!0,e()):this.hooks.initAsync.promise().then(function(){n.inited=!0,e()}).catch(function(a){})}},{key:"getStats",value:function(){return this.stats}},{key:"disableDirtyRectangleRendering",value:function(){var e=this.context.config.renderer,n=e.getConfig(),i=n.enableDirtyRectangleRendering;return!i||this.context.renderingContext.renderReasons.has(Oc.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this,s=e.getConfig(),o=this.context.renderingContext;if(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.globalRuntime.sceneGraphService.syncHierarchy(o.root),this.globalRuntime.sceneGraphService.notifyMutationObservers(e),o.renderReasons.size&&this.inited){o.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var A=o.renderReasons.size===1&&o.renderReasons.has(Oc.CAMERA_CHANGED),l=!s.disableRenderHooks||!A;l&&this.renderDisplayObject(o.root,s,o),this.hooks.beginFrame.call(n),l&&o.renderListCurrentFrame.forEach(function(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),this.hooks.endFrame.call(n),o.renderListCurrentFrame=[],o.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,A=s.enableCulling;function l(g){var v=g.renderable,m=g.sortable,w=o?v.dirty||i.dirtyRectangleRenderingDisabled?g:null:g,C=null;w&&(C=A?a.hooks.cull.call(w,a.context.camera):w,C&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(C))),g.dirty(!1),m.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,m.dirty&&(a.sort(g,m),m.dirty=!1,m.dirtyChildren=[],m.dirtyReason=void 0)}for(var c=[e];c.length>0;){var u,h=c.pop();l(h);for(var d=((u=h.sortable)===null||u===void 0||(u=u.sorted)===null||u===void 0?void 0:u.length)>0?h.sortable.sorted:h.childNodes,f=d.length-1;f>=0;f--)c.push(d[f])}}},{key:"sort",value:function(e,n){var i,a;(n==null||(i=n.sorted)===null||i===void 0?void 0:i.length)>0&&n.dirtyReason!==mc.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(s){var o=n.sorted.indexOf(s);o>-1&&n.sorted.splice(o,1);var A=e.childNodes.indexOf(s);if(A>-1)if(n.sorted.length===0)n.sorted.push(s);else{var l=KM(n.sorted,s);n.sorted.splice(l,0,s)}}):n.sorted=e.childNodes.slice().sort(dE),((a=n.sorted)===null||a===void 0?void 0:a.length)>0&&e.childNodes.filter(function(s){return s.parsedStyle.zIndex}).length===0&&(n.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call()}},{key:"dirty",value:function(){this.context.renderingContext.renderReasons.add(Oc.DISPLAY_OBJECT_CHANGED)}}])}(),TT=/\[\s*(.*)=(.*)\s*\]/,FT=function(){function r(){(0,L.Z)(this,r)}return(0,I.Z)(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(A){return((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(A){return A.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):null}return n.find(function(A){return n!==A&&A.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(A){return n!==A&&((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(A){return n!==A&&A.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):[]}return n.findAll(function(A){return n!==A&&A.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(TT),i="",a="";return n&&n.length>2&&(i=n[1].replace(/"/g,""),a=n[2].replace(/"/g,"")),{name:i,value:a}}},{key:"attributeToString",value:function(e,n){if(!e.getAttribute)return"";var i=e.getAttribute(n);return Pe(i)?"":i.toString?i.toString():""}}])}(),yn=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),Ys=function(r){function t(e,n,i,a,s,o,A,l){var c;return(0,L.Z)(this,t),c=(0,P.Z)(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=A,c.newParsedValue=l,c.type=e,c}return(0,k.Z)(t,r),(0,I.Z)(t)}($d);Ys.ADDITION=2,Ys.MODIFICATION=1,Ys.REMOVAL=3;var OT=new Ys(yn.REPARENT,null,"","","",0,"",""),IT=vu(),ef=Ct(),LT=Gt(1,1,1),NT=te(),kT=vu(),ol=Ct(),QT=te(),Al=Er(),UT=Ct(),PT=Er(),DT=Ct(),qu=Ct(),ll=Ct(),nf=te(),ME=Er(),TE=Er(),rf=Er(),RT=function(){function r(t){(0,L.Z)(this,r),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return(0,I.Z)(r,[{key:"matches",value:function(e,n){return this.runtime.sceneGraphSelector.is(e,n)}},{key:"querySelector",value:function(e,n){return this.runtime.sceneGraphSelector.selectOne(e,n)}},{key:"querySelectorAll",value:function(e,n){return this.runtime.sceneGraphSelector.selectAll(e,n)}},{key:"attach",value:function(e,n,i){var a,s=!1;e.parentNode&&(s=e.parentNode!==n,this.detach(e));var o=e.nodeName===Vt.FRAGMENT,A=qd(n);e.parentNode=n;var l=o?e.childNodes:[e];ye(i)?l.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):l.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,u=c.sortable;if((u!=null&&(a=u.sorted)!==null&&a!==void 0&&a.length||u.dirty||e.parsedStyle.zIndex)&&(u.dirtyChildren.indexOf(e)===-1&&u.dirtyChildren.push(e),u.dirty=!0,u.dirtyReason=mc.ADDED),!A){if(o)this.dirtyFragment(e);else{var h=e.transformable;h&&this.dirtyWorldTransform(e,h)}if(s){var d,f=((d=n.ownerDocument)===null||d===void 0||(d=d.defaultView)===null||d===void 0||(d=d.getConfig())===null||d===void 0||(d=d.future)===null||d===void 0?void 0:d.experimentalCancelEventPropagation)===!0;e.dispatchEvent(OT,f,f)}}}},{key:"detach",value:function(e){var n,i;if(e.parentNode){var a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=mc.REMOVED);var A=e.parentNode.childNodes.indexOf(e);A>-1&&e.parentNode.childNodes.splice(A,1),a&&this.dirtyWorldTransform(e,a),e.parentNode=null}}},{key:"getLocalPosition",value:function(e){return e.transformable.localPosition}},{key:"getLocalRotation",value:function(e){return e.transformable.localRotation}},{key:"getLocalScale",value:function(e){return e.transformable.localScale}},{key:"getLocalSkew",value:function(e){return e.transformable.localSkew}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return zs(n),n.localTransform}},{key:"setLocalPosition",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;qu[0]=n[0],qu[1]=n[1],qu[2]=(i=n[2])!==null&&i!==void 0?i:0,!Zi(s.localPosition,qu)&&(re(s.localPosition,qu),a&&this.dirtyLocalTransform(e,s))}},{key:"translateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Gt(n,i,a));var s=e.transformable;Zi(n,ef)||(Gr(n,n,s.localRotation),ue(s.localPosition,s.localPosition,n),this.dirtyLocalTransform(e,s))}},{key:"setLocalRotation",value:function(e,n,i,a,s){var o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:!0;typeof n=="number"&&(n=WA(Al,n,i,a,s));var A=e.transformable;VA(A.localRotation,n),o&&this.dirtyLocalTransform(e,A)}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Gt(n,i,a));var s=e.transformable;Gn(TE,n[0],n[1],n[2]),gu(s.localRotation,s.localRotation,TE),this.dirtyLocalTransform(e,s)}},{key:"setLocalScale",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;de(ol,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Zi(ol,s.localScale)&&(re(s.localScale,ol),a&&this.dirtyLocalTransform(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;Ve(a.localScale,a.localScale,de(ol,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:1)),this.dirtyLocalTransform(e,a)}},{key:"setLocalSkew",value:function(e,n,i){var a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;typeof n=="number"&&(n=gv(kT,n,i));var s=e.transformable;fv(s.localSkew,n),a&&this.dirtyLocalTransform(e,s)}},{key:"setLocalEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;typeof n=="number"&&(n=Gt(n,i,a));var o=e.transformable;Gn(o.localRotation,n[0],n[1],n[2]),s&&this.dirtyLocalTransform(e,o)}},{key:"setLocalTransform",value:function(e,n){var i=Rn(UT,n),a=Wo(PT,n),s=ks(DT,n);this.setLocalScale(e,s,!1),this.setLocalPosition(e,i,!1),this.setLocalRotation(e,a,void 0,void 0,void 0,!1),this.dirtyLocalTransform(e,e.transformable)}},{key:"resetLocalTransform",value:function(e){this.setLocalScale(e,LT,!1),this.setLocalPosition(e,ef,!1),this.setLocalEulerAngles(e,ef,void 0,void 0,!1),this.setLocalSkew(e,IT,void 0,!1),this.dirtyLocalTransform(e,e.transformable)}},{key:"getPosition",value:function(e){var n=e.transformable;return Rn(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Wo(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return ks(n.scaling,this.getWorldTransform(e,n))}},{key:"getOrigin",value:function(e){return e.getGeometryBounds(),e.transformable.origin}},{key:"getWorldTransform",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:e.transformable;return!n.localDirtyFlag&&!n.dirtyFlag||(e.parentNode&&e.parentNode.transformable&&this.getWorldTransform(e.parentNode),this.internalUpdateTransform(e)),n.worldTransform}},{key:"setPosition",value:function(e,n){var i,a=e.transformable;if(ll[0]=n[0],ll[1]=n[1],ll[2]=(i=n[2])!==null&&i!==void 0?i:0,!Zi(this.getPosition(e),ll)){if(re(a.position,ll),e.parentNode===null||!e.parentNode.transformable)re(a.localPosition,ll);else{var s=e.parentNode.transformable;He(nf,s.worldTransform),on(nf,nf),me(a.localPosition,ll,nf)}this.dirtyLocalTransform(e,a)}}},{key:"translate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=de(ol,n,i,a)),!Zi(n,ef)&&(ue(ol,this.getPosition(e),n),this.setPosition(e,ol))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=td(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var A=this.getRotation(e.parentNode);VA(Al,A),KA(Al,Al),Qs(o.localRotation,Al,n),Zo(o.localRotation,o.localRotation),this.dirtyLocalTransform(e,o)}}},{key:"rotate",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Gt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=Al;Gn(o,n[0],n[1],n[2]);var A=this.getRotation(e),l=this.getRotation(e.parentNode);VA(rf,l),KA(rf,rf),Qs(o,rf,o),Qs(s.localRotation,o,A),Zo(s.localRotation,s.localRotation),this.dirtyLocalTransform(e,s)}}},{key:"setOrigin",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=[n,i,a]);var s=e.transformable;if(!(n[0]===s.origin[0]&&n[1]===s.origin[1]&&n[2]===s.origin[2])){var o=s.origin;o[0]=n[0],o[1]=n[1],o[2]=n[2]||0,this.dirtyLocalTransform(e,s)}}},{key:"setEulerAngles",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Gt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{Gn(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);VA(ME,KA(Al,o)),gu(s.localRotation,s.localRotation,ME),this.dirtyLocalTransform(e,s)}}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&ae.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new jn}},{key:"getTransformedGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=arguments.length>2?arguments[2]:void 0,a=this.getGeometryBounds(e,n);if(!jn.isEmpty(a)){var s=i||new jn;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,A=this.getTransformedGeometryBounds(e,i,o),l=e.childNodes;if(l.forEach(function(h){var d=n.getBounds(h,i);d&&(A?A.add(d):(A=o||new jn,A.update(d.center,d.halfExtents)))}),A||(A=new jn),i){var c=fE(e);if(c){var u=c.parsedStyle.clipPath.getBounds(i);A?u&&(A=u.intersection(A)):A.update(u.center,u.halfExtents)}}return i?(s.renderBounds=A,s.renderBoundsDirty=!1):(s.bounds=A,s.boundsDirty=!1),A}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=NT;e.parentNode.transformable&&(n=on(QT,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!jn.isEmpty(i)){var a=new jn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);jn.isEmpty(a)||(i=new jn,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),A=(0,U.Z)(o,2),l=A[0],c=A[1],u=i.getMax(),h=(0,U.Z)(u,2),d=h[0],f=h[1];return new cs(l+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),d-l,f-c)}return new cs((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(e){var n,i=(n=e.parentNode)===null||n===void 0?void 0:n.transformable;zs(e.transformable),sA(e.transformable,i)}},{key:"internalUpdateElement",value:function(e,n){var i,a,s,o,A=((i=e.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0,l=n[n.length-1],c=(l==null?void 0:l.transformDirty)||((a=e.transformable)===null||a===void 0?void 0:a.localDirtyFlag);if(e.transformable){var u;(u=e.transformable).dirtyFlag||(u.dirtyFlag=c)}if(this.internalUpdateTransform(e),c){var h;(h=e.dirty)===null||h===void 0||h.call(e,!0,!0)}var d=((s=e.renderable)===null||s===void 0?void 0:s.boundsDirty)||((o=e.renderable)===null||o===void 0?void 0:o.renderBoundsDirty);if((c||d)&&(l==null?void 0:l.shapeUpdated)===!1&&A)for(var f=n.length-1;f>=0;){var g,v,m=n[f];if(m.shapeUpdated)break;(g=(v=m.node).dirty)===null||g===void 0||g.call(v,!0,!0),m.shapeUpdated=!0,f-=1}return c}},{key:"syncHierarchy",value:function(e){for(var n,i,a=[e],s=e.parentNode?[{node:e.parentNode,transformDirty:((n=e.parentNode.transformable)===null||n===void 0?void 0:n.localDirtyFlag)||((i=e.parentNode.transformable)===null||i===void 0?void 0:i.dirtyFlag),shapeUpdated:!1}]:[];a.length>0;){for(var o=a.pop(),A=s[s.length-1];s.length>0&&o.parentNode!==A.node;)A=s.pop();var l=this.internalUpdateElement(o,s);if(o.childNodes.length>0){for(var c=o.childNodes.length-1;c>=0;c--)a.push(o.childNodes[c]);s.push({node:o,transformDirty:l,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(e,n){qd(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtyWorldTransform(e,n))}},{key:"dirtyWorldTransform",value:function(e,n){this.dirtyWorldInternal(e,n),this.dirtyToRoot(e,!0)}},{key:"dirtyWorldInternal",value:function(e,n){var i,a=this,s=((i=e.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0;n.dirtyFlag||(n.dirtyFlag=!0,e.dirty(!0,!0),s||e.childNodes.forEach(function(o){var A=o.transformable;a.dirtyWorldInternal(o,A)}))}},{key:"dirtyToRoot",value:function(e){for(var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=((n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalAttributeUpdateOptimization)===!0;a;){var o,A;if((o=(A=a).dirty)===null||o===void 0||o.call(A,!0,!0),s)break;a=a.parentNode}i&&e.forEach(function(u){var h;(h=u.dirty)===null||h===void 0||h.call(u,!0,!0)}),this.informDependentDisplayObjects(e);var l=e.mutations||[],c=l.find(function(u){return u.type==="attributes"&&u._boundsChangeData});c?c._boundsChangeData={affectChildren:c._boundsChangeData.affectChildren||i}:(c={type:"attributes",target:e,_boundsChangeData:{affectChildren:i}},l.push(c)),e.mutations=l}},{key:"dirtyFragment",value:function(e){var n,i,a=e.transformable;a&&(a.dirtyFlag=!0,a.localDirtyFlag=!0),(n=(i=e).dirty)===null||n===void 0||n.call(i,!0,!0);for(var s=e.childNodes.length,o=0;o0){var i=new Vr(yn.BOUNDS_CHANGED,{detail:Array.from(n)});e.dispatchEvent(i,!0,!0)}}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var A=this.displayObjectDependencyMap.get(i);A||(this.displayObjectDependencyMap.set(i,{}),A=this.displayObjectDependencyMap.get(i)),A[e]||(A[e]=[]),A[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n,i=this,a=this.displayObjectDependencyMap.get(e);if(a){var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation;Object.keys(a).forEach(function(o){a[o].forEach(function(A){i.dirtyToRoot(A,!0),A.dispatchEvent(new Ys(yn.ATTR_MODIFIED,A,i,i,o,Ys.MODIFICATION,i,i),s,s),A.isCustomElement&&A.isConnected&&A.attributeChangedCallback&&A.attributeChangedCallback(o,i,i)})})}}}])}(),FE=function(){function r(t){if((0,L.Z)(this,r),t<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=t,this.cache=new Map}return(0,I.Z)(r,[{key:"get",value:function(e){if(this.cache.has(e)){var n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}}},{key:"put",value:function(e,n){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,n),this.cache.size>this.capacity){var i=this.cache.keys().next().value;this.cache.delete(i)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])}(),cl={MetricsString:"|\xC9q\xC5",BaselineSymbol:"M",BaselineMultiplier:1.4,HeightMultiplier:2,Newlines:[10,13],BreakingSpaces:[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288]},OE=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,_T=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,HT=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,GT=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,KT=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,zT=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,VT=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,WT=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,ZT=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,jT=new RegExp("".concat(_T.source,"|").concat(GT.source,"|").concat(zT.source,"|").concat(WT.source)),YT=new RegExp("".concat(HT.source,"|").concat(KT.source,"|").concat(VT.source,"|").concat(ZT.source)),XT=function(){function r(t){var e=this;(0,L.Z)(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(YT.exec(i)||jT.exec(n)))},this.trimByKinsokuShorui=function(n){var i=(0,N.Z)(n),a=i[i.length-2];if(!a)return n;var s=a[a.length-1];return i[i.length-2]=a.slice(0,-1),i[i.length-1]=s+i[i.length-1],i},this.runtime=t,this.charWidthCache=new FE(100)}return(0,I.Z)(r,[{key:"measureFont",value:function(e,n){if(this.fontMetricsCache[e])return this.fontMetricsCache[e];var i={ascent:0,descent:0,fontSize:0},a=this.runtime.offscreenCanvasCreator.getOrCreateCanvas(n),s=this.runtime.offscreenCanvasCreator.getOrCreateContext(n,{willReadFrequently:!0});s.font=e;var o=cl.MetricsString+cl.BaselineSymbol,A=Math.ceil(s.measureText(o).width),l=Math.ceil(s.measureText(cl.BaselineSymbol).width),c=cl.HeightMultiplier*l;l=l*cl.BaselineMultiplier|0,a.width=A,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,A,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,l);var u=s.getImageData(0,0,A||1,c||1).data,h=u.length,d=A*4,f=0,g=0,v=!1;for(f=0;fl;--f){for(var w=0;wXt&&Ft>=_t;)Ft-=1,xt=xt.slice(0,-1);return{lineTxt:xt,txtLastCharIndex:Ft}}function at(xt,Ft){if(!(J<=0||J>v)){if(!w[xt]){w[xt]=m;return}var _t=$(w[xt],Ft,Q+1,v-J);w[xt]=_t.lineTxt+m}}for(var At=0;At=d){Atv){at(C,At-1),n.isOverflowing=!0;break}if(F>0&&F+Rt>v){var Pt=$(w[C],At-1,Q+1,v);if(Pt.txtLastCharIndex!==At-1){if(w[C]=Pt.lineTxt,Pt.txtLastCharIndex===s.length-1)break;At=Pt.txtLastCharIndex+1,pt=s[At],wt=s[At-1],bt=s[At+1],Rt=G(pt)}if(C+1>=d){at(C,At-1),n.isOverflowing=!0;break}if(Q=At-1,C+=1,F=0,w[C]="",this.isBreakingSpace(pt))continue;this.canBreakInLastChar(pt)||(w=this.trimToBreakable(w),F=this.sumTextWidthByCache(w[C]||"",G)),this.shouldBreakByKinsokuShorui(pt,bt)&&(w=this.trimByKinsokuShorui(w),F+=G(wt||""))}F+=Rt,w[C]+=pt}return w.join(` `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:cl.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:cl.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=(0,N.Z)(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),A=a+1,l=a+(o?0:1);return n[n.length-1]+=i.slice(A,i.length),n[n.length-2]=i.slice(0,l),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&OE.test(e))}},{key:"sumTextWidthByCache",value:function(e,n){return e.split("").reduce(function(i,a){return i+n(a)},0)}},{key:"findBreakableIndex",value:function(e){for(var n=e.length-1;n>=0;n--)if(!OE.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i.get(e);if(typeof s!="number"){var o=e.length*n,A=a.measureText(e);s=A.width+o,i.put(e,s)}return s}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),ae={},JT=function(r){var t=new ET,e=new wT;return r={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,Vt.FRAGMENT,null),Vt.CIRCLE,new vT),Vt.ELLIPSE,new pT),Vt.RECT,t),Vt.IMAGE,t),Vt.GROUP,new bT),Vt.LINE,new mT),Vt.TEXT,new BT(ae)),Vt.POLYLINE,e),Vt.POLYGON,e),(0,we.Z)((0,we.Z)((0,we.Z)(r,Vt.PATH,new yT),Vt.HTML,new xT),Vt.MESH,null)}(),qT=function(r){var t=new TM,e=new tm;return r={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,oe.PERCENTAGE,null),oe.NUMBER,new NM),oe.ANGLE,new SM),oe.DEFINED_PATH,new MM),oe.PAINT,t),oe.COLOR,t),oe.FILTER,new FM),oe.LENGTH,e),oe.LENGTH_PERCENTAGE,e),oe.LENGTH_PERCENTAGE_12,new OM),(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,oe.LENGTH_PERCENTAGE_14,new IM),oe.COORDINATE,new tm),oe.OFFSET_DISTANCE,new kM),oe.OPACITY_VALUE,new QM),oe.PATH,new UM),oe.LIST_OF_POINTS,new PM),oe.SHADOW_BLUR,new DM),oe.TEXT,new RM),oe.TEXT_TRANSFORM,new _M),oe.TRANSFORM,new dT),(0,we.Z)((0,we.Z)((0,we.Z)(r,oe.TRANSFORM_ORIGIN,new fT),oe.Z_INDEX,new gT),oe.MARKER,new LM)}(),$T=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof M.g!="undefined"?M.g:{}};ae.CameraContribution=Gu,ae.AnimationTimeline=null,ae.EasingFunction=null,ae.offscreenCanvasCreator=new Am,ae.sceneGraphSelector=new FT,ae.sceneGraphService=new RT(ae),ae.textService=new XT(ae),ae.geometryUpdaterFactory=JT,ae.CSSPropertySyntaxFactory=qT,ae.styleValueRegistry=new xM(ae),ae.layoutRegistry=null,ae.globalThis=$T(),ae.enableStyleSyntax=!0,ae.enableSizeAttenuation=!1;var IE=0;function T5(){IE=0}var lm=new Ys(yn.INSERTED,null,"","","",0,"",""),cm=new Ys(yn.REMOVED,null,"","","",0,"",""),LE=new Vr(yn.DESTROY),tF=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;this.renderable.dirty=n,i!==void 0&&(this.renderable.boundsDirty=i,this.renderable.renderBoundsDirty=i,this.geometry.dirty=i)}},{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(On)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(Ld);return ae.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!qd(this)&&n.nodeName===Vt.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(lm.relatedNode=this,n.dispatchEvent(lm)),n}},{key:"insertBefore",value:function(n,i){if(!i)this.appendChild(n);else{n.parentElement&&n.parentElement.removeChild(n);var a=this.childNodes.indexOf(i);a===-1?this.appendChild(n):this.appendChild(n,a)}return n}},{key:"replaceChild",value:function(n,i){var a=this.childNodes.indexOf(i);return this.removeChild(i),this.appendChild(n,a),i}},{key:"removeChild",value:function(n){var i,a,s=((i=this.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig().future)===null||i===void 0?void 0:i.experimentalCancelEventPropagation)===!0;return cm.relatedNode=this,n.dispatchEvent(cm,s,s),(a=n.ownerDocument)!==null&&a!==void 0&&a.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),ae.sceneGraphService.detach(n),n}},{key:"removeChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];this.removeChild(i)}}},{key:"destroyChildren",value:function(){for(var n=this.childNodes.length-1;n>=0;n--){var i=this.childNodes[n];i.childNodes.length>0&&i.destroyChildren(),i.destroy()}}},{key:"matches",value:function(n){return ae.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return ae.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return ae.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return ae.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return ae.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return ae.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return ae.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(ae.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o0&&arguments[0]!==void 0?arguments[0]:!1;return ae.sceneGraphService.getGeometryBounds(this,n)}},{key:"getTransformedGeometryBounds",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return ae.sceneGraphService.getTransformedGeometryBounds(this,n)}},{key:"getBounds",value:function(){return ae.sceneGraphService.getBounds(this)}},{key:"getRenderBounds",value:function(){return ae.sceneGraphService.getBounds(this,!0)}},{key:"getLocalBounds",value:function(){return ae.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return ae.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(On)}},{key:"getAttributeNode",value:function(n){throw new Error(On)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(On)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(On)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(On)}},{key:"removeAttributeNode",value:function(n){throw new Error(On)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(On)}},{key:"setAttributeNode",value:function(n){throw new Error(On)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(On)}},{key:"toggleAttribute",value:function(n,i){throw new Error(On)}}])}(vr);function Nn(r){return!!(r!=null&&r.nodeName)}var eF=ae.globalThis.Proxy?ae.globalThis.Proxy:function(){},Xs=new Ys(yn.ATTR_MODIFIED,null,null,null,null,Ys.MODIFICATION,null,null),$u=Ct(),nF=Er(),ir=function(r){function t(e){var n;return(0,L.Z)(this,t),n=(0,P.Z)(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||Vt.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),ae.enableStyleSyntax&&(n.style=new eF({setProperty:function(a,s){n.setAttribute(a,s)},getPropertyValue:function(a){return n.getAttribute(a)},removeProperty:function(a){n.removeAttribute(a)},item:function(){return""}},{get:function(a,s){return a[s]!==void 0?a[s]:n.getAttribute(s)},set:function(a,s,o){return n.setAttribute(s,o),!0}})),n}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"destroy",value:function(){_s(t,"destroy",this,3)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=(0,H.Z)({},this.attributes);for(var s in a){var o=a[s];Nn(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var A=new this.constructor((0,H.Z)((0,H.Z)({},this.config),{},{style:a}));return A.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(l){if(!l.style.isMarker){var c=l.cloneNode(n);A.appendChild(c)}}),A}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};ae.styleValueRegistry.processProperties(this,n,i),this.dirty()}},{key:"setAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!0;Ye(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),_s(t,"setAttribute",this,3)([n,i]))}},{key:"setAttributes",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.skipDispatchAttrModifiedEvent,s=a===void 0?!1:a,o,A;if(s||(o=(0,H.Z)({},this.attributes),A=(0,H.Z)({},this.parsedStyle)),ae.styleValueRegistry.processProperties(this,n,i),this.dirty(),!s)for(var l in n)this.dispatchAttrModifiedEvent(l,o[l],n[l],A[l])}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.attributes[n],o=this.parsedStyle[n];ae.styleValueRegistry.processProperties(this,(0,we.Z)({},n,i),a),this.dirty(),this.dispatchAttrModifiedEvent(n,s,i,o)}},{key:"dispatchAttrModifiedEvent",value:function(n,i,a,s){var o=this.parsedStyle[n];if(this.isConnected)if(Xs.relatedNode=this,Xs.prevValue=i,Xs.newValue=a,Xs.attrName=n,Xs.prevParsedValue=s,Xs.newParsedValue=o,this.isMutationObserved)this.dispatchEvent(Xs);else{var A,l=((A=this.ownerDocument.defaultView.getConfig().future)===null||A===void 0?void 0:A.experimentalCancelEventPropagation)===!0;Xs.target=this,this.ownerDocument.defaultView.dispatchEvent(Xs,!0,l)}if(this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,u;(c=(u=this).attributeChangedCallback)===null||c===void 0||c.call(u,n,i,a,s,o)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=(0,U.Z)(i,2),s=a[0],o=a[1],A=n.getMax(),l=(0,U.Z)(A,2),c=l[0],u=l[1];return new cs(s,o,c-s,u-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ae.sceneGraphService.setOrigin(this,vi(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return ae.sceneGraphService.getOrigin(this)}},{key:"setPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ae.sceneGraphService.setPosition(this,vi(n,i,a,!1)),this}},{key:"setLocalPosition",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ae.sceneGraphService.setLocalPosition(this,vi(n,i,a,!1)),this}},{key:"translate",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ae.sceneGraphService.translate(this,vi(n,i,a,!1)),this}},{key:"translateLocal",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return ae.sceneGraphService.translateLocal(this,vi(n,i,a,!1)),this}},{key:"getPosition",value:function(){return ae.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return ae.sceneGraphService.getLocalPosition(this)}},{key:"scale",value:function(n,i,a){return this.scaleLocal(n,i,a)}},{key:"scaleLocal",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=vi(n,i,a,!1)),ae.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=vi(n,i,a,!1)),ae.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return ae.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return ae.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=_u($u,ae.sceneGraphService.getWorldTransform(this)),i=(0,U.Z)(n,3),a=i[2];return Bi(a)}},{key:"getLocalEulerAngles",value:function(){var n=_u($u,ae.sceneGraphService.getLocalRotation(this)),i=(0,U.Z)(n,3),a=i[2];return Bi(a)}},{key:"setEulerAngles",value:function(n){return ae.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return ae.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return Pe(i)&&Pe(a)?ae.sceneGraphService.rotateLocal(this,0,0,n):ae.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return Pe(i)&&Pe(a)?ae.sceneGraphService.rotate(this,0,0,n):ae.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return ae.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return ae.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return ae.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return ae.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return ae.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return ae.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return ae.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return ae.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return ae.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){ae.sceneGraphService.resetLocalTransform(this)}},{key:"getAnimations",value:function(){return this.activeAnimations}},{key:"animate",value:function(n,i){var a,s=(a=this.ownerDocument)===null||a===void 0?void 0:a.timeline;return s?s.play(this,n,i):null}},{key:"isVisible",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.visibility)!=="hidden"}},{key:"interactive",get:function(){return this.isInteractive()},set:function(n){this.style.pointerEvents=n?"auto":"none"}},{key:"isInteractive",value:function(){var n;return((n=this.parsedStyle)===null||n===void 0?void 0:n.pointerEvents)!=="none"}},{key:"isCulled",value:function(){return!!(this.cullable&&this.cullable.enable&&!this.cullable.visible)}},{key:"toFront",value:function(){return this.parentNode&&(this.style.zIndex=Math.max.apply(Math,(0,N.Z)(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))+1),this}},{key:"toBack",value:function(){return this.parentNode&&(this.style.zIndex=Math.min.apply(Math,(0,N.Z)(this.parentNode.children.map(function(n){return Number(n.style.zIndex)})))-1),this}},{key:"getConfig",value:function(){return this.config}},{key:"attr",value:function(){for(var n=this,i=arguments.length,a=new Array(i),s=0;s1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"move",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return this.setPosition(n,i,a),this}},{key:"setZIndex",value:function(n){return this.style.zIndex=n,this}}])}(tF);ir.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var Js=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.CIRCLE},e)])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);Js.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var rF=["style"],th=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Za.Z)(n,rF);return(0,L.Z)(this,t),e=(0,P.Z)(this,t,[(0,H.Z)({style:i},a)]),e.isCustomElement=!0,e}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);th.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var eh=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.ELLIPSE},e)])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);eh.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var iF=function(r){function t(){return(0,L.Z)(this,t),(0,P.Z)(this,t,[{type:Vt.FRAGMENT}])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);iF.PARSED_STYLE_LIST=new Set(["class","className"]);var oi=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.GROUP},e)])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);oi.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var aF=["style"],ul=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Za.Z)(n,aF);return(0,L.Z)(this,t),e=(0,P.Z)(this,t,[(0,H.Z)({type:Vt.HTML,style:i},a)]),e.cullable.enable=!1,e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=on(te(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!jn.isEmpty(i)){var a=new jn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(ir);ul.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var nh=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.IMAGE},e)])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);nh.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var sF=["style"],hl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Za.Z)(n,sF);(0,L.Z)(this,t),e=(0,P.Z)(this,t,[(0,H.Z)({type:Vt.LINE,style:(0,H.Z)({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd;return o&&Nn(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),A&&Nn(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="x1"||n==="y1"||n==="x2"||n==="y2"||n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Nn(s)&&(this.markerStartAngle=0,s.remove()),o&&Nn(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&Nn(s)&&(this.markerEndAngle=0,s.remove()),o&&Nn(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=i.x1,c=i.x2,u=i.y1,h=i.y2,d=n?a:s;if(!(!d||!Nn(d))){var f=0,g,v,m,w,C,F;n?(m=l,w=u,g=c-l,v=h-u,C=o||0,F=this.markerStartAngle):(m=c,w=h,g=l-c,v=u-h,C=A||0,F=this.markerEndAngle),f=Math.atan2(v,g),d.setLocalEulerAngles(f*180/Math.PI+F),d.setLocalPosition(m+Math.cos(f)*C,w+Math.sin(f)*C)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,A=a.x2,l=a.y2,c=ba(s,o,A,l,n),u=c.x,h=c.y,d=me(Ct(),Gt(u,h,0),i?this.getWorldTransform():this.getLocalTransform());return new ii(d[0],d[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return Bd(i,a,s,o)}}])}(ir);hl.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var oF=["style"],Pi=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Za.Z)(n,oF);(0,L.Z)(this,t),e=(0,P.Z)(this,t,[(0,H.Z)({type:Vt.PATH,style:i,initialParsedStyle:{miterLimit:4,d:(0,H.Z)({},hs)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd,l=s.markerMid;return o&&Nn(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Nn(l)&&e.placeMarkerMid(l),A&&Nn(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="d"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Nn(s)&&(this.markerStartAngle=0,s.remove()),o&&Nn(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Nn(s)&&(this.markerEndAngle=0,s.remove()),o&&Nn(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=n?a:s;if(!(!l||!Nn(l))){var c=0,u,h,d,f,g,v;if(n){var m=this.getStartTangent(),w=(0,U.Z)(m,2),C=w[0],F=w[1];d=F[0],f=F[1],u=C[0]-F[0],h=C[1]-F[1],g=o||0,v=this.markerStartAngle}else{var Q=this.getEndTangent(),D=(0,U.Z)(Q,2),K=D[0],G=D[1];d=G[0],f=G[1],u=K[0]-G[0],h=K[1]-G[1],g=A||0,v=this.markerEndAngle}c=Math.atan2(h,u),l.setLocalEulerAngles(c*180/Math.PI+v),l.setLocalPosition(d+Math.cos(c)*g,f+Math.sin(c)*g)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&Nn(n))for(var a=1;a1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=np(a,n),o=s.x,A=s.y,l=me(Ct(),Gt(o,A,0),i?this.getWorldTransform():this.getLocalTransform());return new ii(l[0],l[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*An(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,A=n[i-1].endTangent;a=[],A?(a.push([o[0]-A[0],o[1]-A[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(ir);Pi.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var AF=["style"],dl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Za.Z)(n,AF);(0,L.Z)(this,t),e=(0,P.Z)(this,t,[(0,H.Z)({type:Vt.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd,l=s.markerMid;return o&&Nn(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Nn(l)&&e.placeMarkerMid(l),A&&Nn(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"attributeChangedCallback",value:function(n,i,a,s,o){n==="points"?(this.transformMarker(!0),this.transformMarker(!1),this.placeMarkerMid(this.parsedStyle.markerMid)):n==="markerStartOffset"||n==="markerEndOffset"?(this.transformMarker(!0),this.transformMarker(!1)):n==="markerStart"?(s&&Nn(s)&&(this.markerStartAngle=0,s.remove()),o&&Nn(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Nn(s)&&(this.markerEndAngle=0,s.remove()),o&&Nn(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=i.points,c=l||{},u=c.points,h=n?a:s;if(!(!h||!Nn(h)||!u)){var d=0,f,g,v,m,w,C;if(v=u[0][0],m=u[0][1],n)f=u[1][0]-u[0][0],g=u[1][1]-u[0][1],w=o||0,C=this.markerStartAngle;else{var F=u.length;this.parsedStyle.isClosed?(f=u[F-1][0]-u[0][0],g=u[F-1][1]-u[0][1]):(v=u[F-1][0],m=u[F-1][1],f=u[F-2][0]-u[F-1][0],g=u[F-2][1]-u[F-1][1]),w=A||0,C=this.markerEndAngle}d=Math.atan2(g,f),h.setLocalEulerAngles(d*180/Math.PI+C),h.setLocalPosition(v+Math.cos(d)*w,m+Math.sin(d)*w)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(u){u.remove()}),this.markerMidList=[],n&&Nn(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var A=s[o][0],l=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(A,l)}}}])}(ir);dl.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var lF=["style"],af=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,Za.Z)(e,lF);return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"getTotalLength",value:function(){return Xe(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,A,l,c=this.getTotalLength();a.forEach(function(m,w){a[w+1]&&(A=[0,0],A[0]=o/c,l=Bd(m[0],m[1],a[w+1][0],a[w+1][1]),o+=l,A[1]=o/c,s.push(A))}),this.parsedStyle.points.segments=s}var u=0,h=0;this.parsedStyle.points.segments.forEach(function(m,w){n>=m[0]&&n<=m[1]&&(u=(n-m[0])/(m[1]-m[0]),h=w)});var d=ba(a[h][0],a[h][1],a[h+1][0],a[h+1][1],u),f=d.x,g=d.y,v=me(Ct(),Gt(f,g,0),i?this.getWorldTransform():this.getLocalTransform());return new ii(v[0],v[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(dl);af.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(dl.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var xi=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.RECT},e)])}return(0,k.Z)(t,r),(0,I.Z)(t)}(ir);xi.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var cF=["style"],fl=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,Za.Z)(e,cF);return(0,L.Z)(this,t),(0,P.Z)(this,t,[(0,H.Z)({type:Vt.TEXT,style:(0,H.Z)({fill:"black"},n)},i)])}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(ir);fl.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(ir.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textDecorationThickness","textPathSide","textPathStartOffset","metrics","dx","dy"]));var uF=function(){function r(){(0,L.Z)(this,r),this.registry={},this.define(Vt.CIRCLE,Js),this.define(Vt.ELLIPSE,eh),this.define(Vt.RECT,xi),this.define(Vt.IMAGE,nh),this.define(Vt.LINE,hl),this.define(Vt.GROUP,oi),this.define(Vt.PATH,Pi),this.define(Vt.POLYGON,dl),this.define(Vt.POLYLINE,af),this.define(Vt.TEXT,fl),this.define(Vt.HTML,ul)}return(0,I.Z)(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),hF={number:function(t){return new _n(t)},percent:function(t){return new _n(t,"%")},px:function(t){return new _n(t,"px")},em:function(t){return new _n(t,"em")},rem:function(t){return new _n(t,"rem")},deg:function(t){return new _n(t,"deg")},grad:function(t){return new _n(t,"grad")},rad:function(t){return new _n(t,"rad")},turn:function(t){return new _n(t,"turn")},s:function(t){return new _n(t,"s")},ms:function(t){return new _n(t,"ms")},registerProperty:function(t){var e=t.name,n=t.inherits,i=t.interpolable,a=t.initialValue,s=t.syntax;ae.styleValueRegistry.registerMetadata({n:e,inh:n,int:i,d:a,syntax:s})},registerLayout:function(t,e){ae.layoutRegistry.registerLayout(t,e)}},NE=function(r){function t(){var e;(0,L.Z)(this,t),e=(0,P.Z)(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new ae.AnimationTimeline(e)}catch(i){}var n={};return $p.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Wt(o)?o(Vt.GROUP):o)}),e.documentElement=new oi({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"createElement",value:function(n,i){if(n==="svg")return this.documentElement;var a=this.defaultView.customElements.get(n);a||(console.warn("Unsupported tagName: ",n),a=n==="tspan"?fl:oi);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(On)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(n){}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=[],A=function(c){if(!(!c.isInteractive()||c.isCulled())){var u=c.parsedStyle.pointerEvents,h=u===void 0?"auto":u,d=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(h);if(!d||c.isVisible()){var f=c.getTransformedGeometryBounds(!0);f&&!jn.isEmpty(f)&&f.max[0]>=n&&f.min[0]<=a&&f.max[1]>=i&&f.min[1]<=s&&o.push(c)}c.childNodes&&c.childNodes.forEach(function(g){g instanceof ir&&A(g)})}};return A(this.documentElement),o.sort(function(l,c){return c.sortable.renderOrder-l.sortable.renderOrder}),o}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,A=this.defaultView.getConfig(),l=A.width,c=A.height;if(s<0||o<0||s>l||o>c)return null;var u=this.defaultView.viewport2Client({x:s,y:o}),h=u.x,d=u.y,f=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:h,clientY:d},picked:[]}),g=f.picked;return g&&g[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=(0,Wa.Z)((0,ri.Z)().mark(function i(a,s){var o,A,l,c,u,h,d,f,g,v,m;return(0,ri.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),A=o.x,l=o.y,c=this.defaultView.getConfig(),u=c.width,h=c.height,!(A<0||l<0||A>u||l>h)){w.next=1;break}return w.abrupt("return",null);case 1:return d=this.defaultView.viewport2Client({x:A,y:l}),f=d.x,g=d.y,w.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:A,viewportY:l,clientX:f,clientY:g},picked:[]});case 2:return v=w.sent,m=v.picked,w.abrupt("return",m&&m[0]||this.documentElement);case 3:case"end":return w.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,A=this.defaultView.getConfig(),l=A.width,c=A.height;if(s<0||o<0||s>l||o>c)return[];var u=this.defaultView.viewport2Client({x:s,y:o}),h=u.x,d=u.y,f=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:h,clientY:d},picked:[]}),g=f.picked;return g[g.length-1]!==this.documentElement&&g.push(this.documentElement),g}},{key:"elementsFromPoint",value:function(){var e=(0,Wa.Z)((0,ri.Z)().mark(function i(a,s){var o,A,l,c,u,h,d,f,g,v,m;return(0,ri.Z)().wrap(function(w){for(;;)switch(w.prev=w.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),A=o.x,l=o.y,c=this.defaultView.getConfig(),u=c.width,h=c.height,!(A<0||l<0||A>u||l>h)){w.next=1;break}return w.abrupt("return",[]);case 1:return d=this.defaultView.viewport2Client({x:A,y:l}),f=d.x,g=d.y,w.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:A,viewportY:l,clientX:f,clientY:g},picked:[]});case 2:return v=w.sent,m=v.picked,m[m.length-1]!==this.documentElement&&m.push(this.documentElement),w.abrupt("return",m);case 3:case"end":return w.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(eA)}},{key:"insertBefore",value:function(n,i){throw new Error(eA)}},{key:"removeChild",value:function(n,i){throw new Error(eA)}},{key:"replaceChild",value:function(n,i,a){throw new Error(eA)}},{key:"append",value:function(){throw new Error(eA)}},{key:"prepend",value:function(){throw new Error(eA)}},{key:"getElementById",value:function(n){return this.documentElement.getElementById(n)}},{key:"getElementsByName",value:function(n){return this.documentElement.getElementsByName(n)}},{key:"getElementsByTagName",value:function(n){return this.documentElement.getElementsByTagName(n)}},{key:"getElementsByClassName",value:function(n){return this.documentElement.getElementsByClassName(n)}},{key:"querySelector",value:function(n){return this.documentElement.querySelector(n)}},{key:"querySelectorAll",value:function(n){return this.documentElement.querySelectorAll(n)}},{key:"find",value:function(n){return this.documentElement.find(n)}},{key:"findAll",value:function(n){return this.documentElement.findAll(n)}}])}(vr),kE=function(){function r(t){(0,L.Z)(this,r),this.strategies=t}return(0,I.Z)(r,[{key:"apply",value:function(e){var n=e.config,i=e.camera,a=e.renderingService,s=e.renderingContext,o=this.strategies;a.hooks.cull.tap(r.tag,function(A){if(A){var l,c=A.cullable;if(o.length===0?c.visible=s.unculledEntities.indexOf(A.entity)>-1:c.visible=o.every(function(h){return h.isVisible(i,A)}),!A.isCulled()&&A.isVisible())return A;var u=((l=n.future)===null||l===void 0?void 0:l.experimentalCancelEventPropagation)===!0;return A.dispatchEvent(new Vr(yn.CULLED),u,u),null}return A}),a.hooks.afterRender.tap(r.tag,function(A){A.cullable.visibilityPlaneMask=-1})}}])}();kE.tag="Culling";var QE=function(){function r(){var t=this;(0,L.Z)(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new tf(null),this.rootWheelEvent=new om(null),this.onPointerMove=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView;if(!(i.supportsTouchEvents&&e.pointerType==="touch")){var a=t.normalizeToPointerEvent(e,i),s=(0,Gs.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var A=o.value,l=t.bootstrapEvent(t.rootPointerEvent,A,i,e);t.context.eventService.mapEvent(l)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=(0,Gs.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var A=o.value,l=t.bootstrapEvent(t.rootPointerEvent,A,i,e);t.context.eventService.mapEvent(l)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return(0,I.Z)(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),A=o.picked;return A[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var A=s.cancelable||!("cancelable"in s);A&&s.preventDefault()}var l=(0,Gs.Z)(o),c;try{for(l.s();!(c=l.n()).done;){var u=c.value,h=n.bootstrapEvent(n.rootPointerEvent,u,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),A=n.context.eventService.isNativeEventFromCanvas(o,s),l=A?"":"outside",c=n.normalizeToPointerEvent(s,a),u=(0,Gs.Z)(c),h;try{for(u.s();!(h=u.n()).done;){var d=h.value,f=n.bootstrapEvent(n.rootPointerEvent,d,a,s);f.type+=l,n.context.eventService.mapEvent(f)}}catch(g){u.e(g)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),A=(0,Gs.Z)(o),l;try{for(A.s();!(l=A.n()).done;){var c=l.value,u=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(u)}}catch(h){A.e(h)}finally{A.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,A=s.y;e.viewport.x=o,e.viewport.y=A;var l=this.context.eventService.viewport2Canvas(e.viewport),c=l.x,u=l.y;return e.canvas.x=c,e.canvas.y=u,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=jM[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),A=o.x,l=o.y;return n.canvas.x=A,n.canvas.y=l,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=rm.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a-1,A=0,l=a.length;A=1?Math.ceil($):1,a&&(G=o||VM(a)||a.width/$,J=A||WM(a)||a.height/$),n.customElements=new uF,n.devicePixelRatio=$,n.requestAnimationFrame=v!=null?v:im.bind(ae.globalThis),n.cancelAnimationFrame=m!=null?m:wE.bind(ae.globalThis),n.createImage=w!=null?w:function(){return new window.Image},n.supportsTouchEvents=C!=null?C:"ontouchstart"in ae.globalThis,n.supportsPointerEvents=F!=null?F:!!ae.globalThis.PointerEvent,n.isTouchEvent=Q!=null?Q:function(at){return n.supportsTouchEvents&&at instanceof ae.globalThis.TouchEvent},n.isMouseEvent=D!=null?D:function(at){return!ae.globalThis.MouseEvent||at instanceof ae.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(at instanceof ae.globalThis.PointerEvent))},f&&(ae.offscreenCanvas=f),n.document=new NE,n.document.defaultView=n,u||HM(i,n,d),n.initRenderingContext((0,H.Z)((0,H.Z)({},e),{},{width:G,height:J,background:l!=null?l:"transparent",cursor:c!=null?c:"default",cleanUpOnDestroy:d,devicePixelRatio:$,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,createImage:n.createImage,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:K!=null?K:200})),n.initDefaultCamera(G,J,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"initRenderingContext",value:function(n){this.context.config=n,this.context.renderingContext={root:this.document.documentElement,unculledEntities:[],renderListCurrentFrame:[],renderReasons:new Set,force:!1,dirty:!1}}},{key:"initDefaultCamera",value:function(n,i,a){var s=this,o=new ae.CameraContribution;o.clipSpaceNearZ=a,o.setType(In.EXPLORING,pc.DEFAULT).setPosition(n/2,i/2,PE).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,gF,vF),o.canvas=this,o.eventEmitter.on(Rd.UPDATED,function(){s.context.renderingContext.renderReasons.add(Oc.CAMERA_CHANGED),ae.enableSizeAttenuation&&s.getConfig().renderer.getConfig().enableSizeAttenuation&&s.updateSizeAttenuation()}),this.context.camera=o}},{key:"updateSizeAttenuation",value:function(){var n=this.getCamera().getZoom();this.document.documentElement.forEach(function(i){ae.styleValueRegistry.updateSizeAttenuation(i,n)})}},{key:"getConfig",value:function(){return this.context.config}},{key:"getRoot",value:function(){return this.document.documentElement}},{key:"getCamera",value:function(){return this.context.camera}},{key:"getContextService",value:function(){return this.context.contextService}},{key:"getEventService",value:function(){return this.context.eventService}},{key:"getRenderingService",value:function(){return this.context.renderingService}},{key:"getRenderingContext",value:function(){return this.context.renderingContext}},{key:"getStats",value:function(){return this.getRenderingService().getStats()}},{key:"ready",get:function(){var n=this;return this.readyPromise||(this.readyPromise=new Promise(function(i){n.resolveReadyPromise=function(){i(n)}}),this.inited&&this.resolveReadyPromise()),this.readyPromise}},{key:"destroy",value:function(){var n,i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,a=arguments.length>1?arguments[1]:void 0;Ln.clearCache();var s=((n=this.getConfig().future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation)===!0;a||this.dispatchEvent(new Vr(Fa.BEFORE_DESTROY),s,s),this.frameId&&this.cancelAnimationFrame(this.frameId);var o=this.getRoot();i&&(this.unmountChildren(o),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),a||this.dispatchEvent(new Vr(Fa.AFTER_DESTROY),s,s);var A=function(c){c.currentTarget=null,c.manager=null,c.target=null,c.relatedNode=null};A(sf),A(of),A(um),A(DE),A(hm),A(Xs),A(lm),A(cm),A(LE),ae.textService.clearCache()}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a,s=this.context.config;s.width=n,s.height=i,this.getContextService().resize(n,i);var o=this.context.camera,A=o.getProjectionMode();o.setPosition(n/2,i/2,PE).setFocalPoint(n/2,i/2,0),A===$i.ORTHOGRAPHIC?o.setOrthographic(n/-2,n/2,i/2,i/-2,o.getNear(),o.getFar()):o.setAspect(n/i);var l=((a=s.future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;this.dispatchEvent(new Vr(Fa.RESIZE,{width:n,height:i}),l,l)}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i,a=this;n&&(um.detail=n,hm.detail=n);var s=((i=this.getConfig().future)===null||i===void 0?void 0:i.experimentalCancelEventPropagation)===!0;this.dispatchEvent(um,s,s);var o=this.getRenderingService();o.render(this,n,function(){a.dispatchEvent(DE,s,s)}),this.dispatchEvent(hm,s,s)}},{key:"run",value:function(){var n=this,i=function(s,o){n.render(o),n.frameId=n.requestAnimationFrame(i)};i()}},{key:"initRenderer",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!n)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new QE,new UE,new kE([new fF])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService((0,H.Z)((0,H.Z)({},ae),this.context)),this.context.renderingService=new MT(ae,this.context),this.context.eventService=new ST(ae,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){var o;i.inited=!0;var A=((o=i.getConfig().future)===null||o===void 0?void 0:o.experimentalCancelEventPropagation)===!0;a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new Vr(Fa.READY),A,A)}):i.dispatchEvent(new Vr(Fa.READY),A,A):i.dispatchEvent(new Vr(Fa.RENDERER_CHANGED),A,A),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(l){var c,u;(c=(u=l).dirty)===null||c===void 0||c.call(u,!0,!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(ae)})}},{key:"setRenderer",value:function(n){var i=this.getConfig();if(i.renderer!==n){var a=i.renderer;i.renderer=n,this.destroy(!1,!0),(0,N.Z)((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(ae)}),this.initRenderer(n)}}},{key:"setCursor",value:function(n){var i=this.getConfig();i.cursor=n,this.getContextService().applyCursorStyle(n)}},{key:"unmountChildren",value:function(n){var i=this;if(n.childNodes.forEach(function(o){i.unmountChildren(o)}),this.inited){if(n.isMutationObserved)n.dispatchEvent(of);else{var a,s=((a=this.getConfig().future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;of.target=n,this.dispatchEvent(of,!0,s)}n!==this.document.documentElement&&(n.ownerDocument=null),n.isConnected=!1}n.isCustomElement&&n.disconnectedCallback&&n.disconnectedCallback()}},{key:"mountChildren",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:qd(n);if(this.inited){if(!n.isConnected&&(n.ownerDocument=this.document,n.isConnected=!0,!a))if(n.isMutationObserved)n.dispatchEvent(sf);else{var s,o=((s=this.getConfig().future)===null||s===void 0?void 0:s.experimentalCancelEventPropagation)===!0;sf.target=n,this.dispatchEvent(sf,!0,o)}}else console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName);n.childNodes.forEach(function(A){i.mountChildren(A,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(SE),O5=0,RE=new WeakMap,_E=null,I5=null,L5=null,Af,So;function N5(r,t){return Af=new _E(r,t)}function k5(r){return So||(So=_E.copy(Af),So.oldValue=r,So)}function Q5(){Af=So=void 0}function pF(r){return r===So||r===Af}function U5(r,t){return r===t?r:So&&pF(r)?So:null}function mF(r){r.nodes.forEach(function(t){var e=RE.get(t);e&&e.forEach(function(n){n.observer===r&&n.removeTransientObservers()})})}function P5(r,t){for(var e=r;e;e=e.parentNode){var n=RE.get(e);if(n)for(var i=0;i0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;pm.length<=0&&mm.length<=0||(mm.forEach(function(n){return n()}),mm=pm.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,A=e.naturalWidth||e.width,l=e.naturalHeight||e.height,c=n-s,u=i-s,h=Math.ceil(A/c),d=Math.ceil(l/u),f={tileSize:[n,i],gridSize:[d,h],tiles:Array(d).fill(null).map(function(){return Array(h).fill(null)})},g=function(w){for(var C=function(D){pm.push(function(){var K=D*c,G=w*u,J=[Math.min(n,A-K),Math.min(i,l-G)],$=J[0],at=J[1],At=o.createCanvas();At.width=n,At.height=i;var pt=At.getContext("2d");pt.drawImage(e,K,G,$,at,0,0,$,at),f.tiles[w][D]={x:K,y:G,tileX:D,tileY:w,data:At},a()})},F=0;F1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var A=s.root.ownerDocument.defaultView,l=A.context.eventService.nativeHTMLMap,c=function(m,w){w.style.transform=i.joinTransformMatrix(m.getWorldTransform(),m.getOrigin())},u=function(m){var w=m.target;if(w.nodeName===Vt.HTML){i.$camera||(i.$camera=i.createCamera(a));var C=i.getOrCreateEl(w);i.$camera.appendChild(C),Object.keys(w.attributes).forEach(function(F){i.updateAttribute(F,w)}),c(w,C),l.set(C,w)}},h=function(m){var w=m.target;if(w.nodeName===Vt.HTML&&i.$camera){var C=i.getOrCreateEl(w);C&&(C.remove(),l.delete(C))}},d=function(m){var w=m.target;if(w.nodeName===Vt.HTML){var C=m.attrName;i.updateAttribute(C,w)}},f=function(m){for(var w=m.detail,C=0;C0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e;if((e=this.effect.target)!==null&&e!==void 0&&e.destroyed)return this.readyPromise=void 0,this.finishedPromise=void 0,!1;var n=this.oldPlayState,i=this.pending?"pending":this.playState;return this.readyPromise&&i!==n&&(i==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):n==="pending"?this.resolveReadyPromise():i==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&i!==n&&(i==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):i==="finished"?this.resolveFinishedPromise():n==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=i,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=null,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new Em(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(On)}},{key:"addEventListener",value:function(e,n,i){throw new Error(On)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(On)}},{key:"dispatchEvent",value:function(e){throw new Error(On)}},{key:"commitStyles",value:function(){throw new Error(On)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Em(null,this,this.currentTime,e);setTimeout(function(){n.onfinish&&n.onfinish(i)})}this._finishedFlag=!0}}else{if(this.onframe&&this.playState==="running"){var a=new Em(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),OF=4,IF=.001,LF=1e-7,NF=10,rh=11,cf=1/(rh-1),kF=typeof Float32Array=="function",VE=function(t,e){return 1-3*e+3*t},WE=function(t,e){return 3*e-6*t},ZE=function(t){return 3*t},uf=function(t,e,n){return((VE(e,n)*t+WE(e,n))*t+ZE(e))*t},jE=function(t,e,n){return 3*VE(e,n)*t*t+2*WE(e,n)*t+ZE(e)},QF=function(t,e,n,i,a){var s,o,A=0;do o=e+(n-e)/2,s=uf(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>LF&&++A=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return function(A){return A};for(var a=kF?new Float32Array(rh):new Array(rh),s=0;s=IF?UF(l,f,t,n):g===0?f:QF(l,c,c+cf,t,n)};return function(A){return A===0||A===1?A:uf(o(A),e,i)}},PF=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},hf=function(t){return Math.pow(t,2)},df=function(t){return Math.pow(t,3)},ff=function(t){return Math.pow(t,4)},gf=function(t){return Math.pow(t,5)},vf=function(t){return Math.pow(t,6)},pf=function(t){return 1-Math.cos(t*Math.PI/2)},mf=function(t){return 1-Math.sqrt(1-t*t)},yf=function(t){return t*t*(3*t-2)},wf=function(t){for(var e,n=4;t<((e=Math.pow(2,--n))-1)/11;);return 1/Math.pow(4,3-n)-7.5625*Math.pow((e*3-2)/22-t,2)},Ef=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,U.Z)(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,A=hr(Number(a),1,10),l=hr(Number(o),.1,2);return t===0||t===1?t:-A*Math.pow(2,10*(t-1))*Math.sin((t-1-l/(Math.PI*2)*Math.asin(1/A))*(Math.PI*2)/l)},ih=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=(0,U.Z)(e,4),a=i[0],s=a===void 0?1:a,o=i[1],A=o===void 0?100:o,l=i[2],c=l===void 0?10:l,u=i[3],h=u===void 0?0:u;s=hr(s,.1,1e3),A=hr(A,.1,1e3),c=hr(c,.1,1e3),h=hr(h,.1,1e3);var d=Math.sqrt(A/s),f=c/(2*Math.sqrt(A*s)),g=f<1?d*Math.sqrt(1-f*f):0,v=1,m=f<1?(f*d+-h)/g:-h+d,w=n?n*t/1e3:t;return f<1?w=Math.exp(-w*f*d)*(v*Math.cos(g*w)+m*Math.sin(g*w)):w=(v+m*w)*Math.exp(-w*d),t===0||t===1?t:1-w},bm=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=(0,U.Z)(n,2),a=i[0],s=a===void 0?10:a,o=i[1],A=o==="start"?Math.ceil:Math.floor;return A(hr(t,0,1)*s)/s},YE=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,U.Z)(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return Bm(i,a,s,o)(t)},Bf=Bm(.42,0,1,1),Xa=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return 1-t(1-e,n,i)}},Ja=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?t(e*2,n,i)/2:1-t(e*-2+2,n,i)/2}},qa=function(t){return function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;return e<.5?(1-t(1-e*2,n,i))/2:(t(e*2-1,n,i)+1)/2}},XE={steps:bm,"step-start":function(t){return bm(t,[1,"start"])},"step-end":function(t){return bm(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":YE,ease:function(t){return YE(t,[.25,.1,.25,1])},in:Bf,out:Xa(Bf),"in-out":Ja(Bf),"out-in":qa(Bf),"in-quad":hf,"out-quad":Xa(hf),"in-out-quad":Ja(hf),"out-in-quad":qa(hf),"in-cubic":df,"out-cubic":Xa(df),"in-out-cubic":Ja(df),"out-in-cubic":qa(df),"in-quart":ff,"out-quart":Xa(ff),"in-out-quart":Ja(ff),"out-in-quart":qa(ff),"in-quint":gf,"out-quint":Xa(gf),"in-out-quint":Ja(gf),"out-in-quint":qa(gf),"in-expo":vf,"out-expo":Xa(vf),"in-out-expo":Ja(vf),"out-in-expo":qa(vf),"in-sine":pf,"out-sine":Xa(pf),"in-out-sine":Ja(pf),"out-in-sine":qa(pf),"in-circ":mf,"out-circ":Xa(mf),"in-out-circ":Ja(mf),"out-in-circ":qa(mf),"in-back":yf,"out-back":Xa(yf),"in-out-back":Ja(yf),"out-in-back":qa(yf),"in-bounce":wf,"out-bounce":Xa(wf),"in-out-bounce":Ja(wf),"out-in-bounce":qa(wf),"in-elastic":Ef,"out-elastic":Xa(Ef),"in-out-elastic":Ja(Ef),"out-in-elastic":qa(Ef),spring:ih,"spring-in":ih,"spring-out":Xa(ih),"spring-in-out":Ja(ih),"spring-out-in":qa(ih)},DF=function(t){return PF(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},RF=function(t){return XE[DF(t)]||XE.linear},_F=function(t){return t},HF=1,GF=.5,JE=0;function qE(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var bf="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",KF=new RegExp("cubic-bezier\\(".concat(bf,",").concat(bf,",").concat(bf,",").concat(bf,"\\)")),zF=/steps\(\s*(\d+)\s*\)/,VF=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function xm(r){var t=KF.exec(r);if(t)return Bm.apply(void 0,(0,N.Z)(t.slice(1).map(Number)));var e=zF.exec(r);if(e)return qE(Number(e[1]),JE);var n=VF.exec(r);return n?qE(Number(n[1]),{start:HF,middle:GF,end:JE}[n[2]]):RF(r)}function WF(r){return Math.abs(ZF(r)/(r.playbackRate||1))}function ZF(r){var t;return r.duration===0||r.iterations===0?0:(r.duration==="auto"?0:Number(r.duration))*((t=r.iterations)!==null&&t!==void 0?t:1)}var $E=0,Cm=1,xf=2,tB=3;function jF(r,t,e){if(t===null)return $E;var n=e.endTime;return t=Math.min(e.delay+r+e.endDelay,n)?xf:tB}function YF(r,t,e,n,i){switch(n){case Cm:return t==="backwards"||t==="both"?0:null;case tB:return e-i;case xf:return t==="forwards"||t==="both"?r:null;case $E:return null}}function XF(r,t,e,n,i){var a=i;return r===0?t!==Cm&&(a+=e):a+=n/r,a}function JF(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===xf&&n!==0&&(i!==0||a===0)&&(s=1),s}function qF(r,t,e,n){return r===xf&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function $F(r,t,e){var n=r;if(r!=="normal"&&r!=="reverse"){var i=t;r==="alternate-reverse"&&(i+=1),n="normal",i!==1/0&&i%2!==0&&(n="reverse")}return n==="normal"?e:1-e}function tO(r,t,e){var n=jF(r,t,e),i=YF(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=XF(a,n,e.iterations,i,e.iterationStart),o=JF(s,e.iterationStart,n,e.iterations,i,a),A=qF(n,e.iterations,o,s),l=$F(e.direction,A,o);return e.currentIteration=A,e.progress=l,e.easingFunction(l)}function eO(r,t,e){var n=nO(r,t),i=rO(n,e);return function(a,s){if(s!==null)i.filter(function(A){return s>=A.applyFrom&&s1)throw new Error("Keyframe offsets must be between 0 and 1.");l.computedOffset=u}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(u)===-1)throw new Error("".concat(u," compositing is not supported"));l[c]=u}return l.offset===void 0&&(l.offset=null),l.easing===void 0&&(l.easing=(t==null?void 0:t.easing)||"linear"),l.composite===void 0&&(l.composite="auto"),l}),n=!0,i=-1/0,a=0;a=0&&Number(A.offset)<=1});function o(){var A,l=e,c=l.length;if(e[c-1].computedOffset=Number((A=e[c-1].offset)!==null&&A!==void 0?A:1),c>1){var u;e[0].computedOffset=Number((u=e[0].offset)!==null&&u!==void 0?u:0)}for(var h=0,d=Number(e[0].computedOffset),f=1;f90)return this;this.computeMatrix()}return this._getAxes(),this.type===In.ORBITING||this.type===In.EXPLORING?this._getPosition():this.type===In.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=vi(n,i,0),s=Nt(this.position);return ue(s,s,Ht(Ct(),this.right,a[0])),ue(s,s,Ht(Ct(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=Nt(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===In.ORBITING||this.type===In.EXPLORING?this._getDistance():this.type===In.TRACKING&&ue(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=A.position,c=l===void 0?this.position:l,u=A.focalPoint,h=u===void 0?this.focalPoint:u,d=A.roll,f=A.zoom,g=new ae.CameraContribution;g.setType(this.type,void 0),g.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),g.setFocalPoint(h[0],(s=h[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=h[2])!==null&&o!==void 0?o:this.focalPoint[2]),g.setRoll(d!=null?d:this.roll),g.setZoom(f!=null?f:this.zoom);var v={name:n,matrix:Ee(g.getWorldTransform()),right:Nt(g.right),up:Nt(g.up),forward:Nt(g.forward),position:Nt(g.getPosition()),focalPoint:Nt(g.getFocalPoint()),distanceVector:Nt(g.getDistanceVector()),distance:g.getDistance(),dollyingStep:g.getDollyingStep(),azimuth:g.getAzimuth(),elevation:g.getElevation(),roll:g.getRoll(),relAzimuth:g.relAzimuth,relElevation:g.relElevation,relRoll:g.relRoll,zoom:g.getZoom()};return this.landmarks.push(v),v}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=gn(n)?this.landmarks.find(function(at){return at.name===n}):n;if(s){var o=ye(a)?{duration:a}:a,A=o.easing,l=A===void 0?"linear":A,c=o.duration,u=c===void 0?100:c,h=o.easingFunction,d=h===void 0?void 0:h,f=o.onfinish,g=f===void 0?void 0:f,v=o.onframe,m=v===void 0?void 0:v,w=.01;this.cancelLandmarkAnimation();var C=s.position,F=s.focalPoint,Q=s.zoom,D=s.roll,K=d||ae.EasingFunction(l),G,J=function(){i.setFocalPoint(F),i.setPosition(C),i.setRoll(D),i.setZoom(Q),i.computeMatrix(),i.triggerUpdate(),g==null||g()};if(u===0)return J();var $=function(At){G===void 0&&(G=At);var pt=At-G;if(pt>=u){J();return}var wt=K(pt/u),bt=Ct(),Rt=Ct(),Pt=1,xt=0;rn(bt,i.focalPoint,F,wt),rn(Rt,i.position,C,wt),xt=i.roll*(1-wt)+D*wt,Pt=i.zoom*(1-wt)+Q*wt,i.setFocalPoint(bt),i.setPosition(Rt),i.setRoll(xt),i.setZoom(Pt);var Ft=ma(bt,F)+ma(Rt,C);if(Ft<=w&&Q===void 0&&D===void 0)return J();i.computeMatrix(),i.triggerUpdate(),ptwt*wt+bt*bt&&(G=$,J=at),{cx:G,cy:J,x0:-c,y0:-u,x1:G*(i/Q-1),y1:J*(i/Q-1)}}function Mo(r,t){return t=t<0&&r>=0?t+EO:t,t-r<=Sm?0:1}var CO=function(r){function t(e){var n;return(0,L.Z)(this,t),n=(0,P.Z)(this,t,[e]),n.updatePath(),n}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"setAttribute",value:function(n,i,a){_s(t,"setAttribute",this,3)([n,i,a]),["startAngle","endAngle","sr","sr0","radius"].indexOf(n)>-1&&this.updatePath()}},{key:"updatePath",value:function(){var n=this.parsedStyle,i=n.x,a=n.y,s=n.startAngle,o=n.endAngle,A=n.sr,l=n.sr0,c=n.radius,u=this.createPath(i,a,s?Un(s):0,o?Un(o):Math.PI*2,A||0,l||0,c||[0,0,0,0]);_s(t,"setAttribute",this,3)(["d",u])}},{key:"createPath",value:function(n,i,a,s,o,A,l){if(!(o<=0)){var c=ys(n,i,o,a),u=ys(n,i,o,s),h=ys(n,i,A,a),d=ys(n,i,A,s);if(Xo(s-a,Math.PI*2)){var f=ys(n,i,o,a+Math.PI),g=ys(n,i,A,a+Math.PI),v=[["M",c.x,c.y],["A",o,o,0,1,1,f.x,f.y],["A",o,o,0,1,1,u.x,u.y],["M",h.x,h.y]];return A&&(v.push(["A",A,A,0,1,0,g.x,g.y]),v.push(["A",A,A,0,1,0,d.x,d.y])),v.push(["M",c.x,c.y]),v.push(["Z"]),v}var m=s-a,w=o*Cf(a),C=o*ah(a),F=A*Cf(s),Q=A*ah(s),D=o*Cf(s),K=o*ah(s),G=A*Cf(a),J=A*ah(a),$=(0,U.Z)(l,4),at=$[0],At=$[1],pt=$[2],wt=$[3],bt=(o-A)/2,Rt=qs(bt,at),Pt=qs(bt,At),xt=qs(bt,pt),Ft=qs(bt,wt),_t=Mm(Rt,Pt),Xt=Mm(xt,Ft),ie=_t,le=Xt;if((_t>Ic||Xt>Ic)&&mIc){var gr=qs(at,ie),va=qs(At,ie),Hn=Sf(G,J,w,C,o,gr,kn),Bn=Sf(D,K,F,Q,o,va,kn);if(Cn.push(["M",n+Hn.cx+Hn.x0,i+Hn.cy+Hn.y0]),ie<_t&&gr===va){var Ls=Di(Hn.y0,Hn.x0),ui=Di(Bn.y0,Bn.x0);Cn.push(["A",ie,ie,0,Mo(Ls,ui),1,n+Bn.cx+Bn.x0,i+Bn.cy+Bn.y0])}else{if(gr>0){var Ki=Di(Hn.y0,Hn.x0),cn=Di(Hn.y1,Hn.x1),Tn=ys(n,i,o,cn);Cn.push(["A",gr,gr,0,Mo(Ki,cn),1,Tn.x,Tn.y])}var hn=Di(Hn.cy+Hn.y1,Hn.cx+Hn.x1),Sn=Di(Bn.cy+Bn.y1,Bn.cx+Bn.x1),Pn=ys(n,i,o,Sn);if(Cn.push(["A",o,o,0,Mo(hn,Sn),1,Pn.x,Pn.y]),va>0){var ke=Di(Bn.y1,Bn.x1),Fn=Di(Bn.y0,Bn.x0);Cn.push(["A",va,va,0,Mo(ke,Fn),1,n+Bn.cx+Bn.x0,i+Bn.cy+Bn.y0])}}}else Cn.push(["M",c.x,c.y]),Cn.push(["A",o,o,0,er,1,u.x,u.y]);if(AIc){var En=qs(wt,le),cr=qs(pt,le),$e=Sf(F,Q,0,0,A-o,cr,kn),qe=Sf(0,0,G,J,A-o,En,kn);if(Cn.push(["L",n+$e.cx+$e.x0,i+$e.cy+$e.y0]),le0){var Ro=Di($e.y0,$e.x0),_o=Di($e.y1,$e.x1),Ei=ys(n,i,A-o,_o);Cn.push(["A",cr,cr,0,Mo(Ro,_o),1,Ei.x,Ei.y])}var pa=Di($e.cy+$e.y1,$e.cx+$e.x1),Da=Di(qe.cy+qe.y1,qe.cx+qe.x1),Ra=ys(n,i,A,Da);if(Cn.push(["A",A,A,0,Mo(Da,pa),0,Ra.x,Ra.y]),Cn.push(["L",Ra.x,Ra.y]),En>0){var Oi=Di(qe.y1,qe.x1),_a=Di(qe.y0,qe.x0);Cn.push(["A",En,En,0,Mo(Oi,_a),1,n+qe.cx+qe.x0,i+qe.cy+qe.y0])}}}else Cn.push(["L",d.x,d.y]),Cn.push(["A",A,A,0,er,0,h.x,h.y]);return Cn.push(["Z"]),Cn}}}])}(Pi);CO.PARSED_STYLE_LIST=new Set([].concat((0,N.Z)(Pi.PARSED_STYLE_LIST),["x","y","sr","sr0","radius","startAngle","endAngle"]));var lB=function(r){return Pe(r)?"":r.toString()},SO=function(r){var t=lB(r);return t.charAt(0).toUpperCase()+t.substring(1)},Mf=SO,MO=function(r){return typeof r=="object"&&r!==null},Tm=MO,TO=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},oh=TO,Fm=function(r,t){if(r===t)return!0;if(!r||!t||gn(r)||gn(t))return!1;if(oh(r)||oh(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n{!ha.mute&&console.debug(Oo(r))},info:r=>{!ha.mute&&console.info(Oo(r))},warn:r=>{!ha.mute&&console.warn(Oo(r))},error:r=>{!ha.mute&&console.error(Oo(r))}};function cB(r){const{theme:t}=r;if(!t)return{};const e=Fo(Ah.THEME,t);return e||(ha.warn(`The theme of ${t} is not registered.`),{})}function Im(r,t){if(Array.isArray(r)&&r.length===0)return null;const e=Array.isArray(r)?r[0]:r,n=Array.isArray(r)?r.slice(1):t||[];return new Proxy(e,{get(i,a){return typeof i[a]=="function"&&!["onframe","onfinish"].includes(a)?(...s)=>{i[a](...s),n.forEach(o=>{var A;return(A=o[a])===null||A===void 0?void 0:A.call(o,...s)})}:a==="finished"?Promise.all([e.finished,...n.map(s=>s.finished)]):Reflect.get(i,a)},set(i,a,s){return["onframe","onfinish"].includes(a)||n.forEach(o=>{o[a]=s}),Reflect.set(i,a,s)}})}function Lm(r){const t=r.reduce((n,i)=>(Object.entries(i).forEach(([a,s])=>{n[a]===void 0?n[a]=[s]:n[a].push(s)}),n),{});Object.entries(t).forEach(([n,i])=>{(i.length!==r.length||i.some(a=>Pe(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Dr(a,i[0])))&&delete t[n]});const e=Object.entries(t).reduce((n,[i,a])=>(a.forEach((s,o)=>{n[o]?n[o][i]=s:n[o]={[i]:s}}),n),[]);return r.length!==0&&e.length===0&&e.push({_:0},{_:0}),e}function lh(r){switch(r){case"opacity":return 1;case"x":case"y":case"z":case"zIndex":return 0;case"visibility":return"visible";case"collapsed":return!1;case"states":return[];default:return}}function uB(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},FO);return Br(e)&&Object.assign(n,e),Br(t)&&Object.assign(n,t),n}function NO(r){if(typeof r=="string"){const t=Fo(Ah.ANIMATION,r);return t||(ha.warn(`The animation of ${r} is not registered.`),[])}return r}function kO(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const A=o==null?void 0:o[e];if(A===!1)return[];const l=(a=cB(r)[t])===null||a===void 0?void 0:a.animation,c=(h=[])=>NO(h).map(d=>Object.assign(Object.assign(Object.assign(Object.assign({},OO),Br(s)&&s),d),Br(n)&&n));if(A)return c(A);if(!l)return[];const u=l[e];return u===!1?[]:c(u)}function hB(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o{if(!e.length)return null;const[n,i]=t,a=l=>{var c;if(l){const u=r.getShape(l);if(!u)return null;const h=`get${Mf(l)}Style`,d=((c=r==null?void 0:r[h])===null||c===void 0?void 0:c.bind(r))||(v=>v),f=(d==null?void 0:d(n))||{},g=(d==null?void 0:d(i))||{};return{shape:u,fromStyle:f,toStyle:g}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(l=>{var{fields:c,shape:u,states:h}=l,d=QO(l,["fields","shape","states"]);const f=a(u);if(!f)return null;const{shape:g,fromStyle:v,toStyle:m}=f,w=[{},{}];if(c.forEach(F=>{var Q,D;Object.assign(w[0],{[F]:(Q=v[F])!==null&&Q!==void 0?Q:lh(F)}),Object.assign(w[1],{[F]:(D=m[F])!==null&&D!==void 0?D:lh(F)})}),w.some(F=>Object.keys(F).some(Q=>["x","y","z"].includes(Q)))){const{x:F=0,y:Q=0,z:D,transform:K=""}=g.attributes||{};w.forEach(G=>{var J,$,at;G.transform=hB((J=G.x)!==null&&J!==void 0?J:F,($=G.y)!==null&&$!==void 0?$:Q,(at=G.z)!==null&&at!==void 0?at:D,K)})}const C=g.animate(Lm(w),d);return u===void 0&&(s=C),C}).filter(Boolean),A=s||(o==null?void 0:o[0]);return A?Im(A,o.filter(l=>l!==l)):null},PO=[{fields:["opacity"]}],DO=[{fields:["x","y"]}],dB=[{fields:["x","y"]}],RO=dB,fB=[{fields:["sourceNode","targetNode"]}],_O=fB,gB=[{fields:["childrenNode","x","y"]}],HO=gB,j5=[{fields:["childrenNode","x","y"]}];var GO=Object.prototype.hasOwnProperty;function KO(r,t){if(!t||!Ni(r))return{};for(var e={},n=Wt(t)?t:function(o){return o[t]},i,a=0;at?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(A,u)),s};return l.cancel=function(){clearTimeout(n),o=0,n=i=a=null},l},Nm=function(r){if(typeof r!="object"||r===null)return r;var t;if(Ni(r)){t=[];for(var e=0,n=r.length;etypeof t=="number"):!1}function $s(r,t,e){return r>=t&&r<=e}function La(r=0){if(Array.isArray(r)){const[t=0,e=t,n=t,i=e]=r;return[t,e,n,i]}return[r,r,r,r]}function WO(r=0){const t=La(r);return t[0]+t[2]}function X5(r=0){const t=La(r);return t[1]+t[3]}function to(r){return r.max[0]-r.min[0]}function eo(r){return r.max[1]-r.min[1]}function gA(r){return[to(r),eo(r)]}function vA(r,t){const e=kc(r)?km(r):r.getShape("key").getBounds();return t?pA(e,t):e}function km(r){const[t,e,n=0]=r,i=new jn;return i.setMinMax([t,e,n],[t,e,n]),i}function pA(r,t){const[e,n,i,a]=La(t),[s,o,A]=r.min,[l,c,u]=r.max,h=new jn;return h.setMinMax([s-a,o-e,A],[l+n,c+i,u]),h}function ch(r){if(r.length===0)return new jn;if(r.length===1)return r[0];const t=new jn;t.setMinMax(r[0].min,r[0].max);for(let e=1;e=s&&i<=A&&n>=o&&a<=l}function ws(r,t){return $s(r[0],t.min[0],t.max[0])&&$s(r[1],t.min[1],t.max[1])}function pB(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||$s(r[0],n,a)),A=(r[0]===n||r[0]===a)&&(e||$s(r[1],i,s));return o||A}function jO(r,t){return!ws(r,t)}function Of(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function uh(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,A=e-i,l=s-e,c=n-a,u=o-n,h=Math.min(A,l,c,u);return h===A?"left":h===l?"right":h===c?"top":h===u?"bottom":"left"}function vl(r,t){const e=Nc(r);if(ws(r,t))switch(uh(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,A]=t.max;e[0]=$s(n,a,o)?n:n0&&d(Q[0])}},m=0;m0;)h.push(A.pop());s.push(h)}}return s},EB=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,s=[],o={},A={},l={},c=[],u=0,h=function v(m){A[m.id]=u,l[m.id]=u,u+=1,s.push(m),o[m.id]=!0;for(var w=ts(m.id,a,"target").filter(function(K){return n.map(function(G){return G.id}).indexOf(K)>-1}),C=function(G){var J=w[G];if(!A[J]&&A[J]!==0){var $=n.filter(function(at){return at.id===J});$.length>0&&v($[0]),l[m.id]=Math.min(l[m.id],l[J])}else o[J]&&(l[m.id]=Math.min(l[m.id],A[J]))},F=0;F0;){var D=s.pop();if(o[D.id]=!1,Q.push(D),D===m)break}Q.length>0&&c.push(Q)}},d=0,f=n;d0;)for(var v=d.pop(),m=v.id,w=ts(m,t.edges),C=function(D){var K,G=w[D],J=t.nodes.find(function(bt){return bt.id===G});if(G===m)s.push((K={},K[G]=v,K));else if(!(G in g))f[G]=v,d.push(J),g[G]=new Set([v]);else if(!g[m].has(J)){for(var $=!0,at=[J,v],At=f[m];g[G].size&&!g[G].has(At)&&(at.push(At),At!==f[At.id]);)At=f[At.id];if(at.push(At),e&&n?($=!1,at.findIndex(function(bt){return e.indexOf(bt.id)>-1})>-1&&($=!0)):e&&!n&&at.findIndex(function(bt){return e.indexOf(bt.id)>-1})>-1&&($=!1),$){for(var pt={},wt=1;wt0;){var wt=pt.pop();a.has(wt)&&(a.delete(wt),s[wt.id].forEach(function(bt){pt.push(bt)}),s[wt.id].clear())}},u=function at(At,pt,wt){var bt=!1;if(e&&n===!1&&e.indexOf(At.id)>-1)return bt;i.push(At),a.add(At);for(var Rt=wt[At.id],Pt=0;Pt-1});le-1)?o.push((pt={},pt[ie.id]=ie,pt)):Xt[ie.id].push(l[xe])}}return{component:_t,adjList:Xt,minIdx:bt}},C=0;C=C}),Q=EB({nodes:F,edges:t.edges}).filter(function(at){return at.length>1});if(Q.length===0)break;var D=w(Q),K=D.minIdx,G=D.adjList,J=D.component;if(J.length>1){J.forEach(function(at){s[at.id]=new Set});var $=A[K];if(e&&n&&e.indexOf($.id)===-1)return o;u($,$,G),C=K+1}else break}return o},hI=function(t,e,n,i){return i===void 0&&(i=!0),e?SB(t,n,i):CB(t,n,i)},MB=uI,dI={}.toString,fI=function(r,t){return dI.call(r)==="[object "+t+"]"},Nf=fI,Um=function(r){return Nf(r,"Function")},Pm=function(r){return Array.isArray?Array.isArray(r):Nf(r,"Array")},gI=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function vI(r,t){if(r){var e;if(Pm(r))for(var n=0,i=r.length;n-1;)mI.call(r,a,1);return r},g8=null,wI=Array.prototype.splice,v8=function(t,e){if(!isArrayLike(t))return[];for(var n=t?e.length:0,i=n-1;n--;){var a=void 0,s=e[n];(n===i||s!==a)&&(a=s,wI.call(t,s,1))}return t},p8=null,m8=function(r,t,e){if(!isArray(r)&&!isPlainObject(r))return r;var n=e;return each(r,function(i,a){n=t(n,i,a)}),n},y8=null,w8=function(r,t){var e=[];if(!isArrayLike(r))return e;for(var n=-1,i=[],a=r.length;++na[o])return 1;if(i[o]0},j8=null,Y8=function(r,t){if(isArray(r)){for(var e,n=-1/0,i=0;in&&(e=a,n=s)}return e}},X8=function(r,t){if(isArray(r)){for(var e,n=1/0,i=0;io&&c>o);)if(A.push(l),o-=c,s=s.substr(i),!s)return A.join("");for(;l=s.substr(0,1),c=measureTextWidth(l,e),!(c+a>o);)if(A.push(l),o-=c,s=s.substr(1),!s)return A.join("");return""+A.join("")+n},k9=function(){function r(){this.map={}}return r.prototype.has=function(t){return this.map[t]!==void 0},r.prototype.get=function(t,e){var n=this.map[t];return n===void 0?e:n},r.prototype.set=function(t,e){this.map[t]=e},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(t){delete this.map[t]},r.prototype.size=function(){return Object.keys(this.map).length},r}(),Q9=null,PI=function(t,e,n){for(var i=1/0,a,s=0;su[Q.id]+At?(u[at]=u[Q.id]+At,h[at]=[Q.id]):u[at]===u[Q.id]+At&&h[at].push(Q.id)})},g=0;g0&&c.length>0;){var d=c[c.length-1];if(d.length){var f=d.shift();f&&(A.push(f),l[f]=!0,h=i?ts(f,o,"target"):ts(f,o),c.push(h.filter(function(m){return!l[m]})))}else{var g=A.pop();l[g]=!1,c.pop();continue}if(A[A.length-1]===n){var v=A.map(function(w){return w});u.push(v);var g=A.pop();l[g]=!1,c.pop()}}return u},_I=function(t,e){for(var n=If(t,e),i=[],a=n.length,s=0;si[s][A]+i[A][o]&&(i[s][o]=i[s][A]+i[A][o]);return i},Km=_I,HI=function(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=t.nodes,s=a===void 0?[]:a,o=t.edges,A=o===void 0?[]:o,l={},c={};s.forEach(function(F,Q){var D=wB();F.clusterId=D,l[D]={id:D,nodes:[F]},c[F.id]={node:F,idx:Q}});var u=If(t,e),h=[],d={};u.forEach(function(F,Q){var D=0,K=s[Q].id;d[K]={},F.forEach(function(G,J){if(G){D+=G;var $=s[J].id;d[K][$]=G}}),h.push(D)});for(var f=0,g=function(){var Q=!1;if(s.forEach(function(D){var K={};Object.keys(d[D.id]).forEach(function(bt){var Rt=d[D.id][bt],Pt=c[bt].node,xt=Pt.clusterId;K[xt]||(K[xt]=0),K[xt]+=Rt});var G=-1/0,J=[];if(Object.keys(K).forEach(function(bt){G=0&&J.splice($,1),J&&J.length){Q=!0;var at=l[D.clusterId],At=at.nodes.indexOf(D);at.nodes.splice(At,1);var pt=Math.floor(Math.random()*J.length),wt=l[J[pt]];wt.nodes.push(D),D.clusterId=wt.id}}}),!Q)return"break";f++};f0&&G>J&&G-JJ&&(at=u.map(function(Ft){return{node:Ft,clusterId:Ft.clusterId}}),At=dh(w),J=G),pt||$>100)break;$++,Object.keys(w).forEach(function(Ft){var _t=0;d.forEach(function(Xt){var ie=Xt.source,le=Xt.target,ve=C[ie].node.clusterId,xe=C[le].node.clusterId;(ve===Ft&&xe!==Ft||xe===Ft&&ve!==Ft)&&(_t=_t+(Xt[n]||1))}),w[Ft].sumTot=_t}),u.forEach(function(Ft,_t){var Xt=w[Ft.clusterId],ie=0,le,ve=Q[_t]/(2*K),xe=0,Qe=Xt.nodes;Qe.forEach(function(Hn){var Bn=C[Hn.id].idx;xe+=F[_t][Bn]||0});var Re=xe-Xt.sumTot*ve,nn=Qe.filter(function(Hn){return Hn.id!==Ft.id}),mn=[];nn.forEach(function(Hn,Bn){mn[Bn]=f[Hn.originIndex]});var sn=Vm(nn,f)*l,er=D[Ft.id];if(Object.keys(er).forEach(function(Hn){var Bn=C[Hn].node,Ls=Bn.clusterId;if(Ls!==Ft.clusterId){var ui=w[Ls],Ki=ui.nodes;if(!(!Ki||!Ki.length)){var cn=0;Ki.forEach(function(Fn){var En=C[Fn.id].idx;cn+=F[_t][En]||0});var Tn=cn-ui.sumTot*ve,hn=Ki.concat([Ft]),Sn=[];hn.forEach(function(Fn,En){Sn[En]=f[Fn.originIndex]});var Pn=Vm(hn,f)*l,ke=Tn-Re;a&&(ke=Tn+Pn-(Re+sn)),ke>ie&&(ie=ke,le=ui)}}}),ie>0){le.nodes.push(Ft);var kn=Ft.clusterId;Ft.clusterId=le.id;var Cn=Xt.nodes.indexOf(Ft);Xt.nodes.splice(Cn,1);var gr=0,va=0;d.forEach(function(Hn){var Bn=Hn.source,Ls=Hn.target,ui=C[Bn].node.clusterId,Ki=C[Ls].node.clusterId;(ui===le.id&&Ki!==le.id||Ki===le.id&&ui!==le.id)&&(gr=gr+(Hn[n]||1)),(ui===kn&&Ki!==kn||Ki===kn&&ui!==kn)&&(va=va+(Hn[n]||1))}),le.sumTot=gr,Xt.sumTot=va}})}var wt={},bt=0;Object.keys(At).forEach(function(Ft){var _t=At[Ft];if(!_t.nodes||!_t.nodes.length){delete At[Ft];return}var Xt=String(bt+1);Xt!==Ft&&(_t.id=Xt,_t.nodes=_t.nodes.map(function(ie){return{id:ie.id,clusterId:Xt}}),At[Xt]=_t,wt[Ft]=Xt,delete At[Ft],bt++)}),at.forEach(function(Ft){var _t=Ft.node,Xt=Ft.clusterId;_t&&(_t.clusterId=Xt,_t.clusterId&&wt[_t.clusterId]&&(_t.clusterId=wt[_t.clusterId]))});var Rt=[],Pt={};d.forEach(function(Ft){var _t=Ft.source,Xt=Ft.target,ie=Ft[n]||1,le=C[_t].node.clusterId,ve=C[Xt].node.clusterId;if(!(!le||!ve)){var xe="".concat(le,"---").concat(ve);if(Pt[xe])Pt[xe].weight+=ie,Pt[xe].count++;else{var Qe={source:le,target:ve,weight:ie,count:1};Pt[xe]=Qe,Rt.push(Qe)}}});var xt=[];return Object.keys(At).forEach(function(Ft){xt.push(At[Ft])}),{clusters:xt,clusterEdges:Rt}},DB=jI,YI=function(t,e,n,i,a,s,o,A){return e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=void 0),s===void 0&&(s=[]),o===void 0&&(o=["id"]),A===void 0&&(A=1),DB(t,e,n,i,!0,a,s,o,A)},XI=YI,JI=function(t,e){var n;e===void 0&&(e=1);for(var i=dh(t),a=i.nodes,s=a===void 0?[]:a,o=i.edges,A=o===void 0?[]:o,l=function(){var h=Qm({nodes:s,edges:A}),d=Object.keys(h);d.sort(function(v,m){var w,C;return((w=h[v])===null||w===void 0?void 0:w.degree)-((C=h[m])===null||C===void 0?void 0:C.degree)});var f=d[0];if(!s.length||((n=h[f])===null||n===void 0?void 0:n.degree)>=e)return"break";var g=s.findIndex(function(v){return v.id===f});s.splice(g,1),A=A.filter(function(v){return!(v.source===f||v.target===f)})};;){var c=l();if(c==="break")break}return{nodes:s,edges:A}},qI=JI,RB=function(t,e,n){var i=[];switch(t){case Es.EuclideanDistance:i=e[n];break;default:i=[];break}return i},$I=function(t,e,n,i,a,s){e===void 0&&(e=3),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=["id"]),s===void 0&&(s=Es.EuclideanDistance);var o=t.nodes,A=o===void 0?[]:o,l=t.edges,c=l===void 0?[]:l,u={clusters:[{id:"0",nodes:A}],clusterEdges:[]};if(s===Es.EuclideanDistance&&!A.every(function(Xt){return Xt.hasOwnProperty(n)}))return u;var h=[],d=[];if(s===Es.EuclideanDistance&&(h=Pf(A,n),d=Df(h,i,a)),!d.length)return u;for(var f=Rm(d.map(function(Xt){return Xt.join("")})),g=Math.min(e,A.length,f.length),v=0;vQ&&!m.find(function(nn){return QI(nn,RB(s,d,A[le].originIndex))})&&(Q=Re,D=le)}},G=0;G=0;wt--)C[Number(A[v].clusterId)][wt].id===A[v].id&&C[Number(A[v].clusterId)].splice(wt,1);A[v].clusterId=String($),C[$].push(A[v])}}for(var bt=!1,v=0;v=1e3)break}var Ft=[],_t={};return c.forEach(function(Xt){var ie,le,ve=Xt.source,xe=Xt.target,Qe=(ie=A.find(function(sn){return sn.id===ve}))===null||ie===void 0?void 0:ie.clusterId,Re=(le=A.find(function(sn){return sn.id===xe}))===null||le===void 0?void 0:le.clusterId,nn="".concat(Qe,"---").concat(Re);if(_t[nn])_t[nn].count++;else{var mn={source:Qe,target:Re,count:1};_t[nn]=mn,Ft.push(mn)}}),{clusters:C,clusterEdges:Ft}},tL=$I,eL=function(t,e){var n=new es(e),i=n.norm2(),a=new es(t),s=a.norm2(),o=n.dot(a),A=i*s,l=A?o/A:0;return l},_B=eL,nL=function(t,e,n,i,a){t===void 0&&(t=[]),n===void 0&&(n=void 0),i===void 0&&(i=[]),a===void 0&&(a=[]);var s=dh(t.filter(function(h){return h.id!==e.id})),o=t.findIndex(function(h){return h.id===e.id}),A=Pf(t,n),l=Df(A,i,a),c=l[o],u=[];return s.forEach(function(h,d){if(h.id!==e.id){var f=l[d],g=_B(f,c);u.push(g),h.cosineSimilarity=g}}),s.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:u,similarNodes:s}},rL=nL,iL=function(){function r(t){this.count=t.length,this.parent={};for(var e=0,n=t;e0&&(this.list[0]=e,this.moveDown(0)),t},r.prototype.insert=function(t){if(t!==null){this.list.push(t);var e=this.list.length-1;return this.moveUp(e),!0}return!1},r.prototype.moveUp=function(t){for(var e=this.getParent(t);t&&t>0&&this.compareFn(this.list[e],this.list[t])>0;){var n=this.list[e];this.list[e]=this.list[t],this.list[t]=n,t=e,e=this.getParent(t)}},r.prototype.moveDown=function(t){var e,n=t,i=this.getLeft(t),a=this.getRight(t),s=this.list.length;i!==null&&i0?n=i:a!==null&&a0&&(n=a),t!==n&&(e=[this.list[n],this.list[t]],this.list[t]=e[0],this.list[n]=e[1],this.moveDown(n))},r}(),AL=oL,lL=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,s=t.edges,o=s===void 0?[]:s;if(a.length===0)return n;var A=a[0],l=new Set;l.add(A);var c=function(v,m){return e?v.weight-m.weight:0},u=new AL(c);for(Lf(A.id,o).forEach(function(g){u.insert(g)});!u.isEmpty();){var h=u.delMin(),d=h.source,f=h.target;l.has(d)&&l.has(f)||(n.push(h),l.has(d)||(l.add(d),Lf(d,o).forEach(function(g){u.insert(g)})),l.has(f)||(l.add(f),Lf(f,o).forEach(function(g){u.insert(g)})))}return n},HB=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,s=t.edges,o=s===void 0?[]:s;if(a.length===0)return n;var A=o.map(function(d){return d});e&&A.sort(function(d,f){return d.weight-f.weight});for(var l=new aL(a.map(function(d){return d.id}));A.length>0;){var c=A.shift(),u=c.source,h=c.target;l.connected(u,h)||(n.push(c),l.union(u,h))}return n},cL=function(t,e,n){var i={prim:lL,kruskal:HB};return n?i[n](t,e):HB(t,e)},uL=cL,hL=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,A=o===void 0?[]:o,l=t.edges,c=l===void 0?[]:l,u=A.length,h,d={},f={},g=0;g0&&i>e;){a=0;for(var g=0;g0&&(h+=f[Q]/D)}d[m]=n*h,a+=d[m]}}a=(1-a)/u,i=0;for(var g=0;g=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,s=i.toNode;ad||i.hasNode(s[h.to])||(e.labelC;Q--){var D=F(Q);if(D==="break")break}if(m){var K=t.findMinLabel(v);s.dfsEdgeList.push(new pl(g,w,no,K.edgeLabel,no));var G=s.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[G]!==s.dfsEdgeList[G]?!1:u(v[K.edgeLabel].projected)}var J={};m=!1;var $=0;h.forEach(function(Rt){var Pt=new _f(Rt),xt=t.findForwardPureEdges(i,Pt.edges[d[0]],f,Pt);xt.length>0&&(m=!0,$=g,xt.forEach(function(Ft){var _t="".concat(Ft.label,"-").concat(a[Ft.to].label);J[_t]||(J[_t]={projected:[],edgeLabel:Ft.label,nodeLabel2:a[Ft.to].label}),J[_t].projected.push({graphId:i.id,edge:Ft,preNode:Rt})}))});for(var at=d.length,At=function(Pt){if(m)return"break";var xt=d[Pt];h.forEach(function(Ft){var _t=new _f(Ft),Xt=t.findForwardRmpathEdges(i,_t.edges[xt],f,_t);Xt.length>0&&(m=!0,$=s.dfsEdgeList[xt].fromNode,Xt.forEach(function(ie){var le="".concat(ie.label,"-").concat(a[ie.to].label);J[le]||(J[le]={projected:[],edgeLabel:ie.label,nodeLabel2:a[ie.to].label}),J[le].projected.push({graphId:i.id,edge:ie,preNode:Ft})}))})},Q=0;Q=0;f--){var g=e.findBackwardEdge(u,d.edges[a[f]],d.edges[a[0]],d);if(g){var v="".concat(e.dfsCode.dfsEdgeList[a[f]].fromNode,"-").concat(g.label);l[v]||(l[v]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[f]].fromNode,edgeLabel:g.label}),l[v].projected.push({graphId:c.graphId,edge:g,preNode:c})}}if(!(i>=e.maxNodeNum)){var m=e.findForwardPureEdges(u,d.edges[a[0]],o,d);m.forEach(function(C){var F="".concat(s,"-").concat(C.label,"-").concat(h[C.to].label);A[F]||(A[F]={projected:[],fromNodeId:s,edgeLabel:C.label,nodeLabel2:h[C.to].label}),A[F].projected.push({graphId:c.graphId,edge:C,preNode:c})});for(var w=function(F){var Q=e.findForwardRmpathEdges(u,d.edges[a[F]],o,d);Q.forEach(function(D){var K="".concat(e.dfsCode.dfsEdgeList[a[F]].fromNode,"-").concat(D.label,"-").concat(h[D.to].label);A[K]||(A[K]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[F]].fromNode,edgeLabel:D.label,nodeLabel2:h[D.to].label}),A[K].projected.push({graphId:c.graphId,edge:D,preNode:c})})},f=0;fC){var F=C;C=w,w=F}var Q=m.label,D="".concat(l,"-").concat(w,"-").concat(Q,"-").concat(C),K="".concat(w,"-").concat(Q,"-").concat(C);if(!s[K]){var G=s[K]||0;G++,s[K]=G}A[D]={graphId:l,nodeLabel1:w,edgeLabel:Q,nodeLabel2:C}})})}),Object.keys(a).forEach(function(l){var c=a[l];if(!(c2*e)););if(v<2*e&&(o["".concat(c,"-").concat(g)]={start:c,end:g,distance:a[c][g]},u++,A++,A>=n))return o;if(h++,h>2*e)break}if(uh&&(A=h);var d=n[u.id].inDegree;l>d&&(l=d);var f=n[u.id].outDegree;c>f&&(c=f)}),t[e]={degree:A,inDegree:l,outDegree:c}),{minPatternNodeLabelDegree:A,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:c}},bL=function(t,e,n,i,a,s,o){var A;if(n===void 0&&(n=!1),s===void 0&&(s="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var l=t.nodes.length;if(l){var c=Km(t,n),u=Km(e,n),h=$B(t.nodes,c,n),d=$B(e.nodes,u,n),f=JB(t.nodes,s),g=f.nodeMap,v=f.nodeLabelMap,m=JB(e.nodes,s),w=m.nodeMap,C=m.nodeLabelMap;qB(t.edges,o,g);var F=qB(e.edges,o,w).edgeLabelMap,Q=[];u==null||u.forEach(function(cn){Q=Q.concat(cn)}),a||(a=Math.max.apply(Math,(0,z.ev)((0,z.ev)([],Q,!1),[2],!1))),i||(i=a);var D=YB(t,c,s,i),K=YB(e,u,s,i),G=Math.min(100,l*(l-1)/2),J=wL(i,l,G,D,c),$=Hf(J,D,t),at=10,At=1,pt=1,wt=4,bt={graphs:$,nodeLabelProp:s,edgeLabelProp:o,minSupport:At,minNodeNum:pt,maxNodeNum:wt,directed:n},Rt=yL(bt).slice(0,at),Pt=Rt.length,xt=[];Rt.forEach(function(cn,Tn){xt[Tn]={},Object.keys($).forEach(function(hn){var Sn=$[hn],Pn=Gf(Sn,cn,s,o);xt[Tn][hn]=Pn})});var Ft=EL(xt,Pt,Rt),_t=Ft.structure,Xt=Ft.structureCountMap,ie=e.nodes[0],le=[],ve=(A=e.nodes[0])===null||A===void 0?void 0:A[s],xe=-1/0;e.nodes.forEach(function(cn){var Tn=cn[s],hn=v[Tn];(hn==null?void 0:hn.length)>xe&&(xe=hn.length,le=hn,ve=Tn,ie=cn)});var Qe={},Re={},nn={},mn={},sn={},er={};Object.keys(C).forEach(function(cn,Tn){sn[cn]=[],n&&(er[cn]=[]);var hn=-1/0,Sn=C[cn],Pn={};Sn.forEach(function($e){var qe=d["".concat(ie.id,"-").concat($e.id)];if(qe&&sn[cn].push(qe),hnsn[cn][Ei]){_o=!0;break}if(_o)return le.splice(qe,1),"continue";var pa={};zi.neighbors.forEach(function(Oi){var _a=h["".concat(pr.id,"-").concat(Oi.id)];pa["".concat(pr.id,"-").concat(Oi.id)]={start:g[pr.id].idx,end:g[Oi.id].idx,distance:_a}}),$=Hf(pa,D,t,$);var Da=[];Object.keys(pa).forEach(function(Oi){if(Xt[Oi]){Da.push(Xt[Oi]);return}var _a=$[Oi];Xt[Oi]=Gf(_a,_t,s,o),Da.push(Xt[Oi])}),Da=Da.sort(function(Oi,_a){return _a-Oi});for(var Ra=!1,Ei=0;Ei=0;cr--)En(cr)});var kn=[];le==null||le.forEach(function(cn){for(var Tn=g[cn.id].idx,hn=XB(t.nodes,c[Tn],Tn,s,a),Sn=hn.neighbors,Pn=Sn.length,ke=!1,Fn=Pn-1;Fn>=0;Fn--){if(Sn.length+1zi){Sn.splice(Fn,1);continue}if(n){var mr="".concat(En.id,"-").concat(cn.id),Ro=h[mr];pr=er[cr].length-1;var _o=er[cr][pr];if(Ro>_o){Sn.splice(Fn,1);continue}}var Ei=Xt[$e]?Xt[$e]:BL(t,cn,En,g,qe,D,_t,s,o,Xt,$),pa="".concat(ie.id,"-").concat(cr),Da=mn[pa][mn[pa].length-1];if(Ei=0;qe--){var _o=Ro(qe);if(_o==="break")break}if(mr)return kn.splice(Tn,1),"continue";hn.edges=Fn;var Ei=Uf(hn,hn.nodes[0].id,!1).length;if(Object.keys(Ei).reverse().forEach(function(ur){if(!(ur===hn.nodes[0].id||mr)){if(Ei[ur]===1/0){var Ha=ke[ur].node[s];if(Pn[Ha]--,Pn[Ha]gr[oo][gr[oo].length-1]){var Ha=ke[ur].node[s];if(Pn[Ha]--,Pn[Ha]=0;_a--){var Ho=hn.nodes[_a],tM=ke[Ho.id].degree,g5=ke[Ho.id].inDegree,v5=ke[Ho.id].outDegree,p5=Ho[s],W1=tb(Qe,p5,w,C),eM=W1.minPatternNodeLabelDegree,m5=W1.minPatternNodeLabelInDegree,y5=W1.minPatternNodeLabelOutDegree,w5=n?tM=0;W0--){var Go=Fn[W0];if(!ke[Go.source]||!ke[Go.target]){Fn.splice(W0,1);var Z0=Go[o];if(En[Z0]--,ke[Go.source]&&(ke[Go.source].degree--,ke[Go.source].outDegree--),ke[Go.target]&&(ke[Go.target].degree--,ke[Go.target].inDegree--),F[Z0]&&En[Z0]=0;Bn--){var Ls=Hn(Bn);if(Ls==="break")break}for(var ui=kn.length,Ki=function(Tn){var hn=kn[Tn],Sn={};hn.edges.forEach(function(Fn){var En="".concat(Fn.source,"-").concat(Fn.target,"-").concat(Fn.label);Sn[En]?Sn[En]++:Sn[En]=1});for(var Pn=function(En){var cr=kn[En],$e={};cr.edges.forEach(function(pr){var zi="".concat(pr.source,"-").concat(pr.target,"-").concat(pr.label);$e[zi]?$e[zi]++:$e[zi]=1});var qe=!0;Object.keys($e).length!==Object.keys(Sn).length?qe=!1:Object.keys(Sn).forEach(function(pr){$e[pr]!==Sn[pr]&&(qe=!1)}),qe&&kn.splice(En,1)},ke=ui-1;ke>Tn;ke--)Pn(ke);ui=kn.length},Bn=0;Bn<=ui-1;Bn++)Ki(Bn);return kn}}},xL=bL,CL=function(){function r(t){t===void 0&&(t=10),this.linkedList=new yB,this.maxStep=t}return Object.defineProperty(r.prototype,"length",{get:function(){return this.linkedList.toArray().length},enumerable:!1,configurable:!0}),r.prototype.isEmpty=function(){return!this.linkedList.head},r.prototype.isMaxStack=function(){return this.toArray().length>=this.maxStep},r.prototype.peek=function(){return this.isEmpty()?null:this.linkedList.head.value},r.prototype.push=function(t){this.linkedList.prepend(t),this.length>this.maxStep&&this.linkedList.deleteTail()},r.prototype.pop=function(){var t=this.linkedList.deleteHead();return t?t.value:null},r.prototype.toArray=function(){return this.linkedList.toArray().map(function(t){return t.value})},r.prototype.clear=function(){for(;!this.isEmpty();)this.pop()},r}(),SL=CL,ML=MB,R9={getAdjMatrix:If,breadthFirstSearch:sI,connectedComponent:BB,getDegree:Qm,getInDegree:AI,getOutDegree:lI,detectCycle:MB,detectDirectedCycle:ML,detectAllCycles:hI,detectAllDirectedCycle:SB,detectAllUndirectedCycle:CB,depthFirstSearch:xB,dijkstra:Uf,findAllPath:RI,findShortestPath:Gm,floydWarshall:Km,labelPropagation:GI,louvain:DB,iLouvain:XI,kCore:qI,kMeans:tL,cosineSimilarity:_B,nodesCosineSimilarity:rL,minimumSpanningTree:uL,pageRank:GB,getNeighbors:ts,Stack:SL,GADDI:xL};function Qt(r){if(r.id!==void 0)return r.id;if(r.source!==void 0&&r.target!==void 0)return`${r.source}-${r.target}`;throw new Error(Oo("The datum does not have available id."))}function Kf(r){return r.combo}function eb(r,t){const e={nodes:(r.nodes||[]).map(Qt),edges:(r.edges||[]).map(Qt),combos:(r.combos||[]).map(Qt)};return t?Object.values(e).flat():e}const nb=(r,t,e)=>{var n;switch(e.type){case"degree":{const i=new Map;return(n=r.nodes)===null||n===void 0||n.forEach(a=>{const s=t(Qt(a),e.direction).length;i.set(Qt(a),s)}),i}case"betweenness":return TL(r,e.directed,e.weightPropertyName);case"closeness":return FL(r,e.directed,e.weightPropertyName);case"eigenvector":return IL(r,e.directed);case"pagerank":return OL(r,e.epsilon,e.linkProb);default:return rb(r)}},rb=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(Qt(n),0)}),e},TL=(r,t,e)=>{const n=rb(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=Gm(r,Qt(a),Qt(s),t,e),A=o.length;o.flat().forEach(l=>{l!==Qt(a)&&l!==Qt(s)&&n.set(l,n.get(l)+1/A)})}})}),n},FL=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,A)=>{if(a!==A){const{length:l}=Gm(r,Qt(a),Qt(A),t,e);o+=l}return o},0);n.set(Qt(a),1/s)}),n},OL=(r,t,e)=>{var n;const i=new Map,a=GB(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(Qt(s),a[Qt(s)])}),i},IL=(r,t)=>{const{nodes:e=[]}=r,n=LL(r,t),i=NL(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(Qt(s),i[o])}),a},LL=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(l=>Qt(l)===a),A=e.findIndex(l=>Qt(l)===s);t?i[o][A]=1:(i[o][A]=1,i[A][o]=1)}),i},NL=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;sn;s++){const o=Array(t).fill(0);for(let l=0;ll+c*c,0));for(let l=0;ll+(c-i[u])*c,0)),i=o}return i};function mA(r,t,e,n=Dr){const i=new Map(r.map(h=>[e(h),h])),a=new Map(t.map(h=>[e(h),h])),s=new Set(i.keys()),o=new Set(a.keys()),A=[],l=[],c=[],u=[];return o.forEach(h=>{s.has(h)?n(i.get(h),a.get(h))?u.push(a.get(h)):l.push(a.get(h)):A.push(a.get(h))}),s.forEach(h=>{o.has(h)||c.push(i.get(h))}),{enter:A,exit:c,keep:u,update:l}}function ml(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function kL(r,t,e){const n={},i=a=>(a in n||(n[a]=0),`${t}-${a}-${n[a]++}`);return e.map(a=>typeof a=="string"?{type:a,key:i(a)}:typeof a=="function"?a.call(r):a.key?a:Object.assign(Object.assign({},a),{key:i(a.type)}))}class Wm{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=kL(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=mA(this.extensions,e,o=>o.key);this.createExtensions(n),this.updateExtensions([...i,...s]),this.destroyExtensions(a),this.extensions=e}createExtension(t){const{category:e}=this,{key:n,type:i}=t,a=Fo(e,i);if(!a)return ha.warn(`The extension ${i} of ${e} is not registered.`);const s=new a(this.context,t);s.initialized=!0,this.extensionMap[n]=s}createExtensions(t){t.forEach(e=>this.createExtension(e))}updateExtension(t){const{key:e}=t,n=this.extensionMap[e];n&&n.update(t)}updateExtensions(t){t.forEach(e=>this.updateExtension(e))}destroyExtension(t){const e=this.extensionMap[t];e&&(e.initialized&&!e.destroyed&&e.destroy(),delete this.extensionMap[t])}destroyExtensions(t){t.forEach(({key:e})=>this.destroyExtension(e))}destroy(){this.destroyExtensions(this.extensions),this.context={},this.extensions=[],this.extensionMap={}}}class Zm{constructor(t,e){this.events=[],this.initialized=!1,this.destroyed=!1,this.context=t,this.options=e}update(t){this.options=Object.assign(this.options,t)}destroy(){this.context={},this.options={},this.destroyed=!0}}class Na extends Zm{}class zf extends Na{constructor(t,e){super(t,Object.assign({},zf.defaultOptions,e)),this.isOverlapping=(n,i)=>i.some(a=>n.intersects(a)),this.occupiedBounds=[],this.detectLabelCollision=n=>{const i=this.context.viewport,a={show:[],hide:[]};return this.occupiedBounds=[],n.forEach(s=>{const o=s.getShape("label").getRenderBounds();i.isInViewport(o,!0)&&!this.isOverlapping(o,this.occupiedBounds)?(a.show.push(s),this.occupiedBounds.push(pA(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=mA(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(l=>(this.nodeCentralities.has(l.id)||(this.nodeCentralities=nb(s,o,i)),{node:l,centrality:this.nodeCentralities.get(l.id)})).sort((l,c)=>c.centrality-l.centrality).map(l=>l.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:A}=this.context;if(Wt(i))return n.sort((g,v)=>i(A.getElementDataById(g.id),A.getElementDataById(v.id)));const{node:l=[],edge:c=[],combo:u=[]}=Ff(n,g=>g.type),h=Wt(s)?u.sort((g,v)=>s(...A.getComboData([g.id,v.id]))):u,d=Wt(a)?l.sort((g,v)=>a(...A.getNodeData([g.id,v.id]))):this.sortNodesByCentrality(l,a),f=Wt(o)?c.sort((g,v)=>o(...A.getEdgeData([g.id,v.id]))):c;return[...h,...d,...f]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:A}=this.detectLabelCollision(s);for(let l=o.length-1;l>=0;l--)this.showLabel(o[l]);A.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&ml(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&ml(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=vB(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(Ae.BEFORE_RENDER,this.onBeforeRender),t.on(Ae.AFTER_RENDER,this.onAfterRender),t.on(Ae.AFTER_DRAW,this.toggle),t.on(Ae.AFTER_LAYOUT,this.toggle),t.on(Ae.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.BEFORE_RENDER,this.onBeforeRender),t.off(Ae.AFTER_RENDER,this.onAfterRender),t.off(Ae.AFTER_DRAW,this.toggle),t.off(Ae.AFTER_LAYOUT,this.toggle),t.off(Ae.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}zf.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};var QL=function(r){if(!Tm(r)||!pd(r,"Object"))return!1;if(Object.getPrototypeOf(r)===null)return!0;for(var t=r;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(r)===t},Qc=QL,UL=5;function PL(r,t){if(Object.hasOwn)return Object.hasOwn(r,t);if(r==null)throw new TypeError("Cannot convert undefined or null to object");return Object.prototype.hasOwnProperty.call(Object(r),t)}function ib(r,t,e,n){e=e||0,n=n||UL;for(var i in t)if(PL(t,i)){var a=t[i];a!==null&&Qc(a)?(Qc(r[i])||(r[i]={}),ee+t[n])}function tr(r,t){return r.map((e,n)=>e-t[n])}function Bs(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function bs(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function RL(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function _L(r,t){const e=fh(r),n=fh(t);return[e[1]*n[2]-e[2]*n[1],e[2]*n[0]-e[0]*n[2],e[0]*n[1]-e[1]*n[0]]}function yA(r,t){return r.map(e=>e*t)}function lr(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function Vf(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function Io(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function jm(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Bs(r,t).reduce((a,s)=>a+s,0)/(lr(r,ab)*lr(t,ab)));return e&&n<0&&(i=2*Math.PI-i),i}function _9(r,t){return r.every((e,n)=>e===t[n])}function Wf(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function Ym(r,t){return r.map(e=>e%t)}function yl(r){return[r[0],r[1]]}function fh(r){return VO(r)?[r[0],r[1],0]:r}function sb(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function ob(r,t){const[e,n]=r;if(t%360===0)return[e,n];const i=t*Math.PI/180,a=Math.cos(i),s=Math.sin(i);return[e*a-n*s,e*s+n*a]}function Ab(r,t){const[e,n]=r,[i,a]=t,s=tr(e,n),o=tr(i,a);return _L(s,o).every(A=>A===0)}function Xm(r,t,e=!1){if(Ab(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),A=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!$s(o,0,1)||!$s(A,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function lb(r){if(Array.isArray(r))return $s(r[0],0,1)&&$s(r[1],0,1)?r:[.5,.5];const t=r.split("-"),e=t.includes("left")?0:t.includes("right")?1:.5,n=t.includes("top")?0:t.includes("bottom")?1:.5;return[e,n]}function Ai(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function HL(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function cb(r,t){const[e,n]=t,{min:i,max:a}=r;return[i[0]+e*(a[0]-i[0]),i[1]+n*(a[1]-i[1])]}function Lo(r,t="center"){const e=lb(t);return cb(r,e)}function H9(r,t){const e=parseAnchor(t);return cb(r,e)}const G9=r=>{const[t,e]=r;return{left:Math.min(t[0],e[0]),right:Math.max(t[0],e[0]),top:Math.min(t[1],e[1]),bottom:Math.max(t[1],e[1])}};function Si(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function xs(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function K9(r){return r.sort((t,e)=>t[0]-e[0]||t[1]-e[1])}function z9(r){const t=new Set;return r.filter(e=>{const n=e.join(",");return t.has(n)?!1:(t.add(n),!0)})}function gh(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function wA(r,t,e,n=!1){if(Dr(r,t))return r;const i=n?tr(r,t):tr(t,r),a=Io(i),s=[a[0]*e,a[1]*e];return tn(yl(r),s)}function ub(r,t){return r[1]===t[1]}function GL(r,t){return r[0]===t[0]}function KL(r,t){return ub(r,t)||GL(r,t)}function hb(r,t,e){return Ab([r,t],[t,e])}function db(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function fb(r,t,e,n=!0,i=!1){for(let a=0;aa!=d>a&&i<(h-c)*(a-u)/(d-u)+c&&(s=!s)}return s}function VL(r,t,e=!1){const n=Lo(t,"center"),i=[Lo(t,"left-top"),Lo(t,"right-top"),Lo(t,"right-bottom"),Lo(t,"left-bottom")];return fb(r,n,i,!1,e).point}function Zf(r,t,e=!1){const n=t.center,i=e?db(r,n):r,a=tr(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=to(t)/2,A=eo(t)/2,l=n[0]+o*Math.cos(s),c=n[1]+A*Math.sin(s);return[l,c]}function WL(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=lr(i,a);s{const a=jL(r,i);a1?c=1:c<0&&(c=0);const u=e+c*A,h=n+c*l;return[u,h]}function YL(r){const t=r.reduce((e,n)=>tn(e,n),[0,0]);return bs(t,r.length)}function Jm(r,t=!0){const e=YL(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),A=Math.atan2(s-e[1],a-e[0]);return t?A-o:o-A})}function vb(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class Rr{constructor(t,e,n){if(this.phase=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,Rr.instance)return Rr.callbacks[this.phase].push(n),Rr.instance;this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents(),Rr.instance=this,Rr.callbacks[this.phase].push(n)}bindEvents(){const{emitter:t}=this;t.on(Yt.POINTER_DOWN,this.onPointerDown),t.on(Yt.POINTER_MOVE,this.onPointerMove),t.on(Yt.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client||{};if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){Rr.isPinching=!0;const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y;this.initialDistance=Math.sqrt(i*i+a*a),Rr.callbacks.pinchstart.forEach(s=>s(t,{scale:0}))}}onPointerMove(t){if(this.pointerByTouch.length!==2||this.initialDistance===null)return;const{x:e,y:n}=t.client||{};if(e===void 0||n===void 0)return;this.updatePointerPosition(t.pointerId,e,n);const i=this.pointerByTouch[0].x-this.pointerByTouch[1].x,a=this.pointerByTouch[0].y-this.pointerByTouch[1].y,o=Math.sqrt(i*i+a*a)/this.initialDistance;Rr.callbacks.pinchmove.forEach(A=>A(t,{scale:(o-1)*5}))}onPointerUp(t){var e;Rr.callbacks.pinchend.forEach(n=>n(t,{scale:0})),Rr.isPinching=!1,this.initialDistance=null,this.pointerByTouch=[],(e=Rr.instance)===null||e===void 0||e.tryDestroy()}destroy(){this.emitter.off(Yt.POINTER_DOWN,this.onPointerDown),this.emitter.off(Yt.POINTER_MOVE,this.onPointerMove),this.emitter.off(Yt.POINTER_UP,this.onPointerUp),Rr.instance=null}off(t,e){const n=Rr.callbacks[t].indexOf(e);n>-1&&Rr.callbacks[t].splice(n,1),this.tryDestroy()}tryDestroy(){Object.values(Rr.callbacks).every(t=>t.length===0)&&this.destroy()}}Rr.isPinching=!1,Rr.instance=null,Rr.callbacks={pinchstart:[],pinchmove:[],pinchend:[]};const pb=r=>r.map(t=>gn(t)?t.toLocaleLowerCase():t);class EA{constructor(t){this.map=new Map,this.boundHandlePinch=()=>{},this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(Yt.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(Yt.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(Yt.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(Yt.PINCH)&&!this.pinchHandler&&(this.boundHandlePinch=this.handlePinch.bind(this),this.pinchHandler=new Rr(this.emitter,"pinchmove",this.boundHandlePinch)),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Dr(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=pb(Array.from(this.recordKey)).sort(),n=pb(t).sort();return Dr(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(Yt.KEY_DOWN,this.onKeyDown),e.on(Yt.KEY_UP,this.onKeyUp),e.on(Yt.WHEEL,this.onWheel),e.on(Yt.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Dr(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(Yt.KEY_DOWN,this.onKeyDown),this.emitter.off(Yt.KEY_UP,this.onKeyUp),this.emitter.off(Yt.WHEEL,this.onWheel),this.emitter.off(Yt.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.off("pinchmove",this.boundHandlePinch),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"focus",this.onFocus)}}class vh extends Na{constructor(t,e){super(t,Ci({},vh.defaultOptions,e)),this.shortcut=new EA(t.graph),this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.clearStates=this.clearStates.bind(this),this.bindEvents()}onPointerDown(t){if(!this.validate(t)||!this.isKeydown()||this.startPoint)return;const{canvas:e,graph:n}=this.context,i=Object.assign({},this.options.style);this.options.style.lineWidth&&(i.lineWidth=+this.options.style.lineWidth/n.getZoom()),this.rectShape=new xi({id:"g6-brush-select",style:i}),e.appendChild(this.rectShape),this.startPoint=[t.canvas.x,t.canvas.y]}onPointerMove(t){var e;if(!this.startPoint)return;const{immediately:n,mode:i}=this.options;this.endPoint=jf(t,this.context.graph),(e=this.rectShape)===null||e===void 0||e.attr({x:Math.min(this.endPoint[0],this.startPoint[0]),y:Math.min(this.endPoint[1],this.startPoint[1]),width:Math.abs(this.endPoint[0]-this.startPoint[0]),height:Math.abs(this.endPoint[1]-this.startPoint[1])}),n&&i==="default"&&this.updateElementsStates(vb(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=jf(t,this.context.graph),this.updateElementsStates(vb(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>{var o;const A=(o=s.states||[])===null||o===void 0?void 0:o.filter(l=>l!==this.options.state);return a[Qt(s)]=A,a},{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n),A={};switch(a){case"union":o.forEach(l=>{A[l]=[...e.getElementState(l),i]});break;case"diff":o.forEach(l=>{const c=e.getElementState(l);A[l]=c.includes(i)?c.filter(u=>u!==i):[...c,i]});break;case"intersect":o.forEach(l=>{const c=e.getElementState(l);A[l]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(l=>{A[l]=[i]});break}Wt(s)&&s(A),e.setElementState(A,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const A=Qt(o);t.getElementVisibility(A)!=="hidden"&&zL(t.getElementPosition(A),e)&&i.push(A)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:A,target:l}=o;i.includes(A)&&i.includes(l)&&i.push(Qt(o))})}return i}clearBrush(){var t;(t=this.rectShape)===null||t===void 0||t.remove(),this.rectShape=void 0,this.startPoint=void 0,this.endPoint=void 0}isKeydown(){const{trigger:t}=this.options,e=Array.isArray(t)?t:[t];return this.shortcut.match(e.filter(n=>n!=="drag"))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(Yt.POINTER_DOWN,this.onPointerDown),t.on(Yt.POINTER_MOVE,this.onPointerMove),t.on(Yt.POINTER_UP,this.onPointerUp),t.on(To.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(Yt.POINTER_DOWN,this.onPointerDown),t.off(Yt.POINTER_MOVE,this.onPointerMove),t.off(Yt.POINTER_UP,this.onPointerUp),t.off(To.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=Ci(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}vh.defaultOptions={animation:!1,enable:!0,enableElements:["node","combo","edge"],immediately:!1,mode:"default",state:"selected",trigger:["shift"],style:{width:0,height:0,lineWidth:1,fill:"#1677FF",stroke:"#1677FF",fillOpacity:.1,zIndex:2,pointerEvents:"none"}};const jf=(r,t)=>{if((r.targetType==="node"||r.targetType==="combo")&&!(r.nativeEvent.target instanceof HTMLCanvasElement)){const[e,n]=t.getCanvasByClient([r.client.x,r.client.y]);return[e,n]}return[r.canvas.x,r.canvas.y]},No=.8,wl=["node","edge","combo"];function El(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)El(s,t,e,n,i+1);n==="BT"&&t(r,i)}function XL(r,t,e){const n=[[r,0]];for(;n.length;){const[i,a]=n.shift();t(i,a);const s=e(i);if(s)for(const o of s)n.push([o,a+1])}}function mb(r,t,e,n,i="both"){if(t==="combo"||t==="node")return qm(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=qm(r,a.source,n-1,i),o=qm(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function qm(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return XL(t,(o,A)=>{A>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(l=>{const c=Qt(l);!a.has(c)&&Ar.getRelatedEdgesData(o,n).map(A=>A.source===o?A.target:A.source).filter(A=>i.has(A)?!1:(i.add(A),!0))),Array.from(s)}function $m(r){return r.states||[]}var Yf=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Xf extends Na{constructor(t,e){super(t,Object.assign({},Xf.defaultOptions,e)),this.onClickSelect=n=>Yf(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.updateState(n),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.onClickCanvas=n=>Yf(this,void 0,void 0,function*(){var i,a;this.validate(n)&&(yield this.clearState(),(a=(i=this.options).onClick)===null||a===void 0||a.call(i,n))}),this.shortcut=new EA(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),wl.forEach(e=>{t.on(`${e}:${Yt.CLICK}`,this.onClickSelect)}),t.on(To.CLICK,this.onClickCanvas)}get isMultipleSelect(){const{multiple:t,trigger:e}=this.options;return t&&this.shortcut.match(e)}getNeighborIds(t){const{target:e,targetType:n}=t,{graph:i}=this.context,{degree:a}=this.options;return mb(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return Yf(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,A=o.getElementData(s.id),l=$m(A).includes(e)?"unselect":"select",c={},u=this.isMultipleSelect,h=[s.id],d=this.getNeighborIds(t);if(u)if(Object.assign(c,this.getDataStates()),l==="select"){const f=(g,v)=>{g.forEach(m=>{const w=new Set(o.getElementState(m));w.add(v),w.delete(n),c[m]=Array.from(w)})};f(h,e),f(d,i),n&&Object.keys(c).forEach(g=>{const v=c[g];!v.includes(e)&&!v.includes(i)&&!v.includes(n)&&c[g].push(n)})}else{const f=c[s.id];c[s.id]=f.filter(g=>g!==e&&g!==i),f.includes(n)||c[s.id].push(n),d.forEach(g=>{c[g]=c[g].filter(v=>v!==i),c[g].includes(e)||c[g].push(n)})}else if(l==="select"){Object.assign(c,this.getClearStates(!!n));const f=(g,v)=>{g.forEach(m=>{c[m]||(c[m]=o.getElementState(m)),c[m].push(v)})};f(h,e),f(d,i),n&&Object.keys(c).forEach(g=>{!h.includes(g)&&!d.includes(g)&&c[g].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[Qt(s)]=$m(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:A,combos:l}=e.getData(),c={};return[...o,...A,...l].forEach(u=>{const h=$m(u),d=h.filter(f=>!s.has(f));(t||d.length!==h.length)&&(c[Qt(u)]=d)}),c}clearState(){return Yf(this,void 0,void 0,function*(){const{graph:t}=this.context;yield t.setElementState(this.getClearStates(),this.options.animation)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;wl.forEach(e=>{t.off(`${e}:${Yt.CLICK}`,this.onClickSelect)}),t.off(To.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}Xf.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function da(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}var Mi=function(r,t,e){for(var n=0,i=gn(t)?t.split("."):t;r&&n="A"&&e<="Z"}function yb(r,t){return`${t}${Mf(r)}`}function wb(r,t,e=!0){if(!t||!mh(r,t))return r;const n=r.slice(t.length);return e?qL(n):n}function Or(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||mh(i,t)&&Object.assign(n,{[wb(i,t)]:a}),n),{});if("opacity"in r){const n=yb("opacity",t),i=r.opacity;if(n in r){const a=r[n];Object.assign(e,{opacity:i*a})}else Object.assign(e,{opacity:i})}return e}function ty(r,t){const e=t.length;return Object.keys(r).reduce((n,i)=>{if(i.startsWith(t)){const a=i.slice(e);n[a]=r[i]}return n},{})}function Eb(r,t){const e=typeof t=="string"?[t]:t,n={};return Object.keys(r).forEach(i=>{e.find(a=>i.startsWith(a))||(n[i]=r[i])}),n}function V9(r,t,e){return Object.entries(r).reduce((n,[i,a])=>(mh(i,t)?n[yb(wb(i,t,!1),e)]=a:n[i]=a,n),{})}function ka(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var $L=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);itypeof a=="function"?[i,a.call(n,e)]:[i,a]))}function pi(r,t){const e=(r==null?void 0:r.style)||{},n=(t==null?void 0:t.style)||{};for(const i in e)i in n||(n[i]=e[i]);return Object.assign({},r,t,{style:n})}function tN(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:A,visibility:l}=r;return $L(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function eN(r,t){const e=ka(r);let n={};return t.text&&!t.fontSize&&(n={fontSize:Math.min(...e)*.5}),t.src&&(!t.width||!t.height)&&(n={width:e[0]*.5,height:e[1]*.5}),n}function bb(r){if(r)return typeof r=="string"||typeof r=="function"||Array.isArray(r)?{type:"group",field:t=>t.id,color:r,invert:!1}:r}function nN(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=A=>{const l=typeof n=="string"?Fo("palette",n):n;if(typeof l=="function"){const c={};return A.forEach(([u,h])=>{c[u]=l(a?1-h:h)}),c}else if(Array.isArray(l)){const c=a?[...l].reverse():l,u={};return A.forEach(([h,d])=>{u[h]=c[d%l.length]}),u}return{}},o=(A,l)=>{var c;return typeof A=="string"?(c=l.data)===null||c===void 0?void 0:c[A]:A==null?void 0:A(l)};if(e==="group"){const A=Ff(r,h=>{if(!i)return"default";const d=o(i,h);return d?String(d):"default"}),l=Object.keys(A),c=s(l.map((h,d)=>[h,d])),u={};return Object.entries(A).forEach(([h,d])=>{d.forEach(f=>{u[Qt(f)]=c[h]})}),u}else if(e==="value"){const[A,l]=r.reduce(([u,h],d)=>{const f=o(i,d);if(typeof f!="number")throw new Error(Oo(`Palette field ${i} is not a number`));return[Math.min(u,f),Math.max(h,f)]},[1/0,-1/0]),c=l-A;return s(r.map(u=>[u.id,(o(i,u)-A)/c]))}}function xb(r){const t=typeof r=="string"?Fo("palette",r):r;if(typeof t!="function")return t}function Cb(r,t){let e=2*r;return typeof t=="string"?e=r*Number(t.replace("%",""))/100:typeof t=="number"&&(e=t),isNaN(e)&&(e=2*r),e}function Sb(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return Cb(a,t)}function rN(r,t,e=1){const n=lr(r[0],r[1])*e;return Cb(n,t)}var iN={}.toString,aN=function(r){return iN.call(r).replace(/^\[object /,"").replace(/]$/,"")},sN=aN,oN=Object.prototype,AN=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||oN;return r===e},lN=AN,cN=Object.prototype.hasOwnProperty;function uN(r){if(Pe(r))return!0;if(oh(r))return!r.length;var t=sN(r);if(t==="Map"||t==="Set")return!r.size;if(lN(r))return!Object.keys(r).length;for(var e in r)if(cN.call(r,e))return!1;return!0}var ro=uN;class yh extends th{constructor(t){Mb(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,A,l,c,u,h,d;const f=this.shapeMap[t];if(n===!1){f&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,f),i.removeChild(f),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,f));return}const g=typeof e=="string"?Fo(Ah.SHAPE,e):e;if(!g)throw new Error(Oo(`Shape ${e} not found`));if(!f||f.destroyed||!(f instanceof g)){f&&((A=a==null?void 0:a.beforeDestroy)===null||A===void 0||A.call(a,f),f==null||f.destroy(),(l=a==null?void 0:a.afterDestroy)===null||l===void 0||l.call(a,f)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const v=new g({className:t,style:n});return i.appendChild(v),this.shapeMap[t]=v,(u=a==null?void 0:a.afterCreate)===null||u===void 0||u.call(a,v),v}return(h=a==null?void 0:a.beforeUpdate)===null||h===void 0||h.call(a,f),py(f,n),(d=a==null?void 0:a.afterUpdate)===null||d===void 0||d.call(a,f),f}update(t={}){const e=Object.assign({},this.attributes,t);Mb(e),nQ(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return tN(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(A=>{const{x:l=a,y:c=s,z:u=o}=A;Object.assign(A,{transform:u?[["translate3d",l,c,u]]:[["translate",l,c]]})})}const i=super.animate(t,e);if(i&&(ey(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,A])=>{const l=`get${Mf(o)}Style`,c=this[l];if(Wt(c)){const u=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d))),h=A.animate(Lm(u),e);h&&(ey(A,h),n.push(h))}});const s=(o,A)=>{if(!ro(o)){const l=`get${Mf(A)}Style`,c=this[l];if(Wt(c)){const u=t.map(h=>c.call(this,Object.assign(Object.assign({},this.attributes),h)));Object.entries(u[0]).map(([h])=>{const d=u.map(g=>g[h]),f=o[h];if(f){const g=f.animate(Lm(d),e);g&&(ey(f,g),n.push(g))}})}}};this.compositeShapes.forEach(([o,A])=>{const l=ty(this.shapeMap,A);s(l,o)})}}return Im(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;ml(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function ey(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function Mb(r){if(!r)return{};if("x"in r||"y"in r||"z"in r){const{x:t=0,y:e=0,z:n,transform:i}=r,a=hB(t,e,n,i);a&&(r.transform=a)}return r}var hN=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{e.push([i===0?"M":"L",...n])}),t&&e.push(["Z"]),e}const Tb={M:["x","y"],m:["dx","dy"],H:["x"],h:["dx"],V:["y"],v:["dy"],L:["x","y"],l:["dx","dy"],Z:[],z:[],C:["x1","y1","x2","y2","x","y"],c:["dx1","dy1","dx2","dy2","dx","dy"],S:["x2","y2","x","y"],s:["dx2","dy2","dx","dy"],Q:["x1","y1","x","y"],q:["dx1","dy1","dx","dy"],T:["x","y"],t:["dx","dy"],A:["rx","ry","rotation","large-arc","sweep","x","y"],a:["rx","ry","rotation","large-arc","sweep","dx","dy"]};function fN(r){const t=r.replace(/[\n\r]/g,"").replace(/-/g," -").replace(/(\d*\.)(\d+)(?=\.)/g,"$1$2 ").trim().split(/\s*,|\s+/),e=[];let n="",i={};for(;t.length>0;){let a=t.shift();a in Tb?n=a:t.unshift(a),i={type:n},Tb[n].forEach(A=>{a=t.shift(),i[A]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function gN(r){const t=[];return(typeof r=="string"?fN(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s{const v=f,m=c[(g+1)%c.length];return Dr(v,m)?null:[v,m]}).filter(Boolean),h=ZL([o,A],u),d=gb([o,A],h);if(d&&h&&(l.transform=[["translate",d[0]+e,d[1]+n]],s)){const f=Math.atan((h[0][1]-h[1][1])/(h[0][0]-h[1][0]));l.transform.push(["rotate",f/Math.PI*180]),l.textAlign="center",(t==="right"||t==="left")&&(f>0?l.textBaseline=t==="right"?"bottom":"top":l.textBaseline=t==="right"?"top":"bottom")}return l}var pN=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{n!=null&&n.children.length&&n.children.forEach(i=>{t.push(i),e(i)})};return e(r),t}function yN(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}class ny extends nh{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Pc=this,this.isMutationObserved=!0,this.addEventListener(yn.MOUNTED,this.onMounted),this.addEventListener(yn.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const A=new xi({style:o});this.style.clipPath=A}}else e&&(this.style.clipPath=null)}}const ry=new WeakMap;let Pc=null;const iy=r=>{if(Pc&&yN(Pc).includes(r)){const t=ry.get(r);t?t.includes(Pc)||t.push(Pc):ry.set(r,[Pc])}},ay=r=>{const t=ry.get(r);t&&t.forEach(e=>e.handleRadius())};class Ob extends yh{constructor(t){super(t)}isImage(){const{src:t}=this.attributes;return!!t}getIconStyle(t=this.attributes){const{width:e=0,height:n=0}=t,i=this.getGraphicStyle(t);return this.isImage()?Object.assign({x:-e/2,y:-n/2},i):Object.assign({textBaseline:"middle",textAlign:"center"},i)}render(t=this.attributes,e=this){this.upsert("icon",this.isImage()?ny:fl,this.getIconStyle(t),e)}}class Ib extends yh{get context(){return this.config.context}get parsedAttributes(){return this.attributes}onframe(){}animate(t,e){const n=super.animate(t,e);return n&&(n.onframe=()=>this.onframe(),n.finished.then(()=>this.onframe())),n}}var Jf=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{i[u]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,A=Jf(t,["badges","badgePalette","opacity"]),l=xb(s),c=Or(this.getGraphicStyle(A),"badge");return a.forEach((u,h)=>{i[h]=Object.assign(Object.assign({backgroundFill:l?l[h%(l==null?void 0:l.length)]:void 0,opacity:o},c),this.getBadgeStyle(u))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=Jf(t,["placement","offsetX","offsetY"]),o=hx(e.getLocalBounds(),n,i,a,!0);return Object.assign(Object.assign({},o),s)}getPortsStyle(t){var e;const n=this.getPorts(),i={};if(Object.keys(n).forEach(o=>{i[o]=!1}),t.port===!1||!(!((e=t.ports)===null||e===void 0)&&e.length))return i;const a=Or(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,A)=>{const l=o.key||A,c=Object.assign(Object.assign({},a),o);if(lx(c))i[l]=!1;else{const[u,h]=this.getPortXY(t,o);i[l]=Object.assign({transform:[["translate",u,h]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return fy(wN(this.context,i),n)}getPorts(){return ty(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return VL(t,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t),i=this.getShape("key");this.upsert("halo",i.constructor,n,e)}drawIconShape(t,e){const n=this.getIconStyle(t);this.upsert("icon",Ob,n,e),iy(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,Uc,a,e)})}drawPortShapes(t,e){const n=this.getPortsStyle(t);Object.keys(n).forEach(i=>{const a=n[i],s=`port-${i}`;this.upsert(s,Js,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",io,n,e)}_drawKeyShape(t,e){return this.drawKeyShape(t,e)}render(t=this.parsedAttributes,e=this){this._drawKeyShape(t,e),this.getShape("key")&&(this.drawHaloShape(t,e),this.drawIconShape(t,e),this.drawBadgeShapes(t,e),this.drawLabelShape(t,e),this.drawPortShapes(t,e))}update(t){super.update(t),t&&("x"in t||"y"in t||"z"in t)&&ay(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Cs.defaultStyleProps={x:0,y:0,size:32,droppable:!0,draggable:!0,port:!0,ports:[],portZIndex:2,portLinkToCenter:!1,badge:!0,badges:[],badgeZIndex:3,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloStrokeOpacity:.25,haloPointerEvents:"none",haloZIndex:-1,icon:!0,iconZIndex:1,label:!0,labelIsBillboard:!0,labelMaxWidth:"200%",labelPlacement:"bottom",labelWordWrap:!1,labelZIndex:0};function wN(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();ml(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}class Bl extends Cs{constructor(t){super(pi({style:Bl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Js,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{r:Math.min(...this.getSize(t))/2})}getIconStyle(t){const e=super.getIconStyle(t),{r:n}=this.getShape("key").attributes,i=n*2*No;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return Zf(t,n,e)}}Bl.defaultStyleProps={size:32};class qf extends Cs{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",dl,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t);return Object.assign(Object.assign({},e),{points:this.getPoints(t)})}getIntersectPoint(t,e=!1){var n,i;const{points:a}=this.getShape("key").attributes,s=[+(((n=this.attributes)===null||n===void 0?void 0:n.x)||0),+(((i=this.attributes)===null||i===void 0?void 0:i.y)||0)];return fb(t,s,a,!0,e).point}}class EN extends qf{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return eQ(e,n)}}var BN=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);iye(u)?{value:u}:u),a=Or(this.getGraphicStyle(t),"donut"),s=xb(t.donutPalette);if(!s)return;const o=i.reduce((u,h)=>{var d;return u+((d=h.value)!==null&&d!==void 0?d:0)},0),A=this.parseOuterR(),l=this.parseInnerR();let c=0;i.forEach((u,h)=>{const{value:d=0,color:f=s[h%s.length]}=u,g=BN(u,["value","color"]),v=(o===0?1/i.length:d/o)*360;this.upsert(`round${h}`,Pi,Object.assign(Object.assign(Object.assign({},a),{d:CN(A,l,c,c+v),fill:f}),g),e),c+=v})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}$f.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const tg=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],bN=(r,t,e,n)=>n<=0||e<=n?[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"]]:[["M",r-e,t],["A",e,e,0,1,1,r+e,t],["A",e,e,0,1,1,r-e,t],["Z"],["M",r+n,t],["A",n,n,0,1,0,r-n,t],["A",n,n,0,1,0,r+n,t],["Z"]],xN=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],A=[tg(r,t,n,s),tg(r,t,e,s),tg(r,t,e,o),tg(r,t,n,o)],l=o-s>Math.PI?1:0;return[["M",A[0][0],A[0][1]],["L",A[1][0],A[1][1]],["A",e,e,0,l,1,A[2][0],A[2][1]],["L",A[3][0],A[3][1]],["A",n,n,0,l,0,A[0][0],A[0][1]],["Z"]]},CN=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?bN(i,a,r,t):xN(i,a,r,t,e,n)};class eg extends Cs{constructor(t){super(pi({style:eg.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",eh,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getSize(t);return Object.assign(Object.assign({},e),{rx:n/2,ry:i/2})}getIconStyle(t){const e=super.getIconStyle(t),{rx:n,ry:i}=this.getShape("key").attributes,a=Math.min(+n,+i)*2*No;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return Zf(t,n,e)}}eg.defaultStyleProps={size:[45,35]};class SN extends qf{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return rQ(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*No;return e?Object.assign({width:n,height:n},e):!1}}function ao(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var MN=0;function TN(r){return"__private_"+MN+++"_"+r}var _r=TN("renderState"),Lb=function(){function r(t){(0,L.Z)(this,r),this.renderQueue=[],Object.defineProperty(this,_r,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=te(),this.dprMatrix=te(),this.tmpMat4=te(),this.vec3a=Ct(),this.vec3b=Ct(),this.vec3c=Ct(),this.vec3d=Ct(),this.canvasRendererPluginOptions=t}return(0,I.Z)(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,A=a.renderingService,l=a.renderingContext,c=a.pathGeneratorFactory,u=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.pathGeneratorFactory=c;var h=e.contextService,d=l.root.ownerDocument.defaultView;A.hooks.init.tap(r.tag,function(){var v=h.getDPR(),m=s.width,w=s.height,C=h.getContext();i.clearRect(C,0,0,m*v,w*v,s.background)}),A.hooks.destroy.tap(r.tag,function(){i.renderQueue=[],ao(i,_r)[_r]={restoreStack:[],prevObject:null,currentContext:null}});var f=function(){var m,w=h.getContext(),C=h.getDPR(),F=s.width,Q=s.height,D=i.canvasRendererPluginOptions,K=D.dirtyObjectNumThreshold,G=D.dirtyObjectRatioThreshold,J=A.getStats(),$=J.total,at=J.rendered,At=at/$;i.clearFullScreen=i.clearFullScreenLastFrame||!((m=d.context.renderingPlugins[1])!==null&&m!==void 0&&m.isFirstTimeRenderingFinished)||A.disableDirtyRectangleRendering()||at>K&&At>G,w&&(typeof w.resetTransform=="function"?w.resetTransform():w.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(w,0,0,F*C,Q*C,s.background))},g=function(m,w){for(var C=[m];C.length>0;){var F,Q=C.pop();Q.isVisible()&&!Q.isCulled()&&(u?i.renderDisplayObjectOptimized(Q,w,i.context,ao(i,_r)[_r],n):i.renderDisplayObject(Q,w,i.context,ao(i,_r)[_r],n));for(var D=((F=Q.sortable)===null||F===void 0||(F=F.sorted)===null||F===void 0?void 0:F.length)>0?Q.sortable.sorted:Q.childNodes,K=D.length-1;K>=0;K--)C.push(D[K])}};A.hooks.endFrame.tap(r.tag,function(){if(f(),l.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}u=s.renderer.getConfig().enableRenderingOptimization,ao(i,_r)[_r]={restoreStack:[],prevObject:null,currentContext:ao(i,_r)[_r].currentContext},ao(i,_r)[_r].currentContext.clear(),i.clearFullScreenLastFrame=!1;var v=h.getContext(),m=h.getDPR();if(Dn(i.dprMatrix,[m,m,1]),he(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)u?(v.save(),g(l.root,v),v.restore()):g(l.root,v);else{var w=i.safeMergeAABB(i.mergeDirtyAABBs(i.renderQueue));if(jn.isEmpty(w)){i.renderQueue=[];return}var C=i.convertAABB2Rect(w),F=C.x,Q=C.y,D=C.width,K=C.height,G=me(i.vec3a,[F,Q,0],i.vpMatrix),J=me(i.vec3b,[F+D,Q,0],i.vpMatrix),$=me(i.vec3c,[F,Q+K,0],i.vpMatrix),at=me(i.vec3d,[F+D,Q+K,0],i.vpMatrix),At=Math.min(G[0],J[0],at[0],$[0]),pt=Math.min(G[1],J[1],at[1],$[1]),wt=Math.max(G[0],J[0],at[0],$[0]),bt=Math.max(G[1],J[1],at[1],$[1]),Rt=Math.floor(At),Pt=Math.floor(pt),xt=Math.ceil(wt-At),Ft=Math.ceil(bt-pt);v.save(),i.clearRect(v,Rt,Pt,xt,Ft,s.background),v.beginPath(),v.rect(Rt,Pt,xt,Ft),v.clip(),v.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var _t=s.renderer.getConfig(),Xt=_t.enableDirtyRectangleRenderingDebug;Xt&&d.dispatchEvent(new Vr(Fa.DIRTY_RECTANGLE,{dirtyRect:{x:Rt,y:Pt,width:xt,height:Ft}}));var ie=w.getMin(),le=(0,U.Z)(ie,2),ve=le[0],xe=le[1],Qe=w.getMax(),Re=(0,U.Z)(Qe,2),nn=Re[0],mn=Re[1],sn=l.root.ownerDocument.elementsFromBBox(ve,xe,nn,mn);sn.sort(function(er,kn){return er.sortable.renderOrder-kn.sortable.renderOrder}).forEach(function(er){er&&er.isVisible()&&!er.isCulled()&&i.renderDisplayObject(er,v,i.context,ao(i,_r)[_r],n)}),v.restore(),i.renderQueue.forEach(function(er){i.saveDirtyAABB(er)}),i.renderQueue=[]}ao(i,_r)[_r].restoreStack.forEach(function(){v.restore()}),ao(i,_r)[_r].restoreStack=[]}),A.hooks.render.tap(r.tag,function(v){i.clearFullScreen||i.renderQueue.push(v)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,A=!1,l=!1,c=this.context.styleRendererFactory[o],u=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){A=!a.prevObject||!Kr(h.getWorldTransform(),a.prevObject.getWorldTransform()),A&&(this.applyWorldTransform(n,h),a.prevObject=null);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),l=!0,n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}if(c){A=!a.prevObject||!Kr(e.getWorldTransform(),a.prevObject.getWorldTransform()),A&&this.applyWorldTransform(n,e);var f=!a.prevObject;if(!f){var g=a.prevObject.nodeName;o===Vt.TEXT?f=g!==Vt.TEXT:o===Vt.IMAGE?f=g!==Vt.IMAGE:f=g===Vt.TEXT||g===Vt.IMAGE}c.applyStyleToContext(n,e,f,a),a.prevObject=e}u&&(n.beginPath(),u(n,e.parsedStyle),o!==Vt.LINE&&o!==Vt.PATH&&o!==Vt.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,ao(this,_r)[_r],this,s),l&&n.restore(),e.dirty(!1)}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,A=a.restoreStack[a.restoreStack.length-1];A&&!(e.compareDocumentPosition(A)&vr.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var l=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(n,u);var h=this.pathGeneratorFactory[u.nodeName];h&&(n.save(),a.restoreStack.push(e),n.beginPath(),h(n,u.parsedStyle),n.closePath(),n.clip())}l&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==Vt.LINE&&o!==Vt.PATH&&o!==Vt.POLYLINE&&n.closePath()),l&&(l.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.dirty(!1)}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,A=i.lineDash,l=i.lineDashOffset;A&&e.setLineDash(A),Pe(l)||(e.lineDashOffset=l),Pe(o)||(e.globalAlpha*=o),!Pe(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!Pe(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),A=Math.ceil(i[1]),l=o-a,c=A-s;return{x:a,y:s,width:l,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new jn;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new jn);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(He(this.tmpMat4,n.getLocalTransform()),he(this.tmpMat4,i,this.tmpMat4),he(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(He(this.tmpMat4,n.getWorldTransform()),he(this.tmpMat4,this.vpMatrix,this.tmpMat4)),e.setTransform(this.tmpMat4[0],this.tmpMat4[1],this.tmpMat4[4],this.tmpMat4[5],this.tmpMat4[12],this.tmpMat4[13])}},{key:"safeMergeAABB",value:function(){for(var e=new jn,n=arguments.length,i=new Array(n),a=0;a0;if(u){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var h=!Pe(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:Wr.strokeStyle;Cr(e,"strokeStyle",h,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&Cr(e,"lineWidth",Pe(o.lineWidth)?Wr.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&Cr(e,"lineDash",o.lineDash||Wr.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&Cr(e,"lineDashOffset",Pe(o.lineDashOffset)?Wr.lineDashOffset:o.lineDashOffset,a.currentContext);for(var d=0;d4&&arguments[4]!==void 0?arguments[4]:!1;if(n){Cr(e,"shadowColor",Wr.shadowColor,a.currentContext);for(var o=0;o-1&&Cr(e,"filter",l.replace(/drop-shadow\([^)]*\)/,"").trim()||Wr.filter,a.currentContext)}else Cr(e,"filter",Wr.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,A=n.parsedStyle,l=A.fill,c=A.fillRule,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=Cr(e,"fillStyle",rg(d,n,e,o.imagePool),i.currentContext);u=u!=null?u:f,c?e.fill(c):e.fill()});else{if(Bo(l)){var h=ng(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);h&&(e.fillStyle=h,u=!0)}c?e.fill(c):e.fill()}u!==null&&Cr(e,"fillStyle",u,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,A=n.parsedStyle.stroke,l=null;if(Array.isArray(A)&&A.length>0)A.forEach(function(h){var d=Cr(e,"strokeStyle",rg(h,n,e,o.imagePool),i.currentContext);l=l!=null?l:d,e.stroke()});else{if(Bo(A)){var c=ng(A,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var u=Cr(e,"strokeStyle",c,i.currentContext);l=l!=null?l:u}}e.stroke()}l!==null&&Cr(e,"strokeStyle",l,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,A=n.nodeName,l=n.parsedStyle,c=l.opacity,u=c===void 0?Wr.globalAlpha:c,h=l.fillOpacity,d=h===void 0?Wr.fillOpacity:h,f=l.strokeOpacity,g=f===void 0?Wr.strokeOpacity:f,v=l.lineWidth,m=v===void 0?Wr.lineWidth:v,w=l.fill&&!l.fill.isNone,C=l.stroke&&!l.stroke.isNone&&m>0;if(!(!w&&!C)){var F=!Pe(l.shadowColor)&&l.shadowBlur>0,Q=l.shadowType==="inner",D=((o=l.fill)===null||o===void 0?void 0:o.alpha)===0,K=!!(l.filter&&l.filter.length),G=F&&C&&(A===Vt.PATH||A===Vt.LINE||A===Vt.POLYLINE||D||Q),J=null;if(w){G||this.applyShadowAndFilterStyleToContext(e,n,F,i);var $=u*d;J=Cr(e,"globalAlpha",$,i.currentContext),this.fillToContext(e,n,i,a,s),G||this.clearShadowAndFilterStyleForContext(e,F,K,i)}if(C){var at=!1,At=u*g,pt=Cr(e,"globalAlpha",At,i.currentContext);if(J=w?J:pt,G&&(this.applyShadowAndFilterStyleToContext(e,n,F,i),at=!0,Q)){var wt=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=wt,this.clearShadowAndFilterStyleForContext(e,F,K,i,!0)}this.strokeToContext(e,n,i,a,s),at&&this.clearShadowAndFilterStyleForContext(e,F,K,i)}J!==null&&Cr(e,"globalAlpha",J,i.currentContext)}}}])}(),Ss=function(r){function t(){return(0,L.Z)(this,t),(0,P.Z)(this,t,arguments)}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"render",value:function(n,i,a,s,o,A){var l=i.fill,c=i.fillRule,u=i.opacity,h=u===void 0?1:u,d=i.fillOpacity,f=d===void 0?1:d,g=i.stroke,v=i.strokeOpacity,m=v===void 0?1:v,w=i.lineWidth,C=w===void 0?1:w,F=i.lineCap,Q=i.lineJoin,D=i.shadowType,K=i.shadowColor,G=i.shadowBlur,J=i.filter,$=i.miterLimit,at=l&&!l.isNone,At=g&&!g.isNone&&C>0,pt=(l==null?void 0:l.alpha)===0,wt=!!(J&&J.length),bt=!Pe(K)&&G>0,Rt=a.nodeName,Pt=D==="inner",xt=At&&bt&&(Rt===Vt.PATH||Rt===Vt.LINE||Rt===Vt.POLYLINE||pt||Pt);at&&(n.globalAlpha=h*f,xt||ag(a,n,bt),Qb(n,a,l,c,s,o,A,this.imagePool),xt||this.clearShadowAndFilter(n,wt,bt)),At&&(n.globalAlpha=h*m,n.lineWidth=C,Pe($)||(n.miterLimit=$),Pe(F)||(n.lineCap=F),Pe(Q)||(n.lineJoin=Q),xt&&(Pt&&(n.globalCompositeOperation="source-atop"),ag(a,n,!0),Pt&&(sy(n,a,g,s,o,A,this.imagePool),n.globalCompositeOperation=Wr.globalCompositeOperation,this.clearShadowAndFilter(n,wt,!0))),sy(n,a,g,s,o,A,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!Pe(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(FN);function ag(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,A=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=A||0)}function Qb(r,t,e,n,i,a,s,o){var A=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(l){r.fillStyle=rg(l,t,r,o),A||(n?r.fill(n):r.fill())}):(Bo(e)&&(r.fillStyle=ng(e,t,r,i,a,s,o)),A||(n?r.fill(n):r.fill()))}function sy(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(A){r.strokeStyle=rg(A,t,r,s),o||r.stroke()}):(Bo(e)&&(r.strokeStyle=ng(e,t,r,n,i,a,s)),o||r.stroke())}function ON(r,t){var e=(0,U.Z)(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=(0,U.Z)(t,4),A=o[0],l=o[1],c=o[2],u=o[3],h=Math.max(n,A),d=Math.max(i,l),f=Math.min(n+a,A+c),g=Math.min(i+s,l+u);return f<=h||g<=d?null:[h,d,f-h,g-d]}function IN(r,t){var e=me(Ct(),[r[0],r[1],0],t),n=me(Ct(),[r[0]+r[2],r[1],0],t),i=me(Ct(),[r[0],r[1]+r[3],0],t),a=me(Ct(),[r[0]+r[2],r[1]+r[3],0],t);return[Math.min(e[0],n[0],i[0],a[0]),Math.min(e[1],n[1],i[1],a[1]),Math.max(e[0],n[0],i[0],a[0])-Math.min(e[0],n[0],i[0],a[0]),Math.max(e[1],n[1],i[1],a[1])-Math.min(e[1],n[1],i[1],a[1])]}var Ub=function(r){function t(){return(0,L.Z)(this,t),(0,P.Z)(this,t,arguments)}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,A=s.imageCache;if(!A.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(l){console.error(l)});return}n.drawImage(A.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,A=s.imageCache,l=s.imageRect,c=s.drawRect,u=A.size,h=n.getTransform(),d=h.a,f=h.b,g=h.c,v=h.d,m=h.e,w=h.f;if(n.resetTransform(),!(A!=null&&A.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirty())},a).catch(function(bt){console.error(bt)});return}for(var C=[u[0]/l[2],u[1]/l[3]],F=[A.tileSize[0]/C[0],A.tileSize[1]/C[1]],Q=[Math.floor((c[0]-l[0])/F[0]),Math.ceil((c[0]+c[2]-l[0])/F[0])],D=Q[0],K=Q[1],G=[Math.floor((c[1]-l[1])/F[1]),Math.ceil((c[1]+c[3]-l[1])/F[1])],J=G[0],$=G[1],at=J;at<=$;at++)for(var At=D;At<=K;At++){var pt=A.tiles[at][At];if(pt){var wt=[Math.floor(l[0]+pt.tileX*F[0]),Math.floor(l[1]+pt.tileY*F[1]),Math.ceil(F[0]),Math.ceil(F[1])];n.drawImage(pt.data,wt[0],wt[1],wt[2],wt[3])}}n.setTransform(d,f,g,v,m,w)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,A=i.y,l=A===void 0?0:A,c=i.width,u=i.height,h=i.src,d=i.shadowColor,f=i.shadowBlur,g=this.imagePool.getImageSync(h,a),v=g==null?void 0:g.img,m=c,w=u;if(v){m||(m=v.width),w||(w=v.height);var C=!Pe(d)&&f>0;ag(a,n,C);try{var F=a.ownerDocument.defaultView.getContextService().getDomElement(),Q=F.width,D=F.height,K=n.getTransform(),G=K.a,J=K.b,$=K.c,at=K.d,At=K.e,pt=K.f,wt=je(G,$,0,0,J,at,0,0,0,0,1,0,At,pt,0,1),bt=IN([o,l,m,w],wt),Rt=ON([0,0,Q,D],bt);if(!Rt)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:v,drawRect:[o,l,m,w]});return}var Pt=bt[2]/g.size[0];if(Pt<(g.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:h,imageCache:g,drawRect:[o,l,m,w]});return}if(!ImagePool.isSupportTile){t.renderFull(n,i,a,{image:v,drawRect:[o,l,m,w]});return}this.renderTile(n,i,a,{src:h,imageCache:g,imageRect:bt,drawRect:Rt})}catch(xt){}}}},{key:"drawToContext",value:function(n,i,a,s,o){this.render(n,i.parsedStyle,i)}}],[{key:"renderFull",value:function(n,i,a,s){n.drawImage(s.image,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}}])}(Ss),Pb=function(r){function t(){return(0,L.Z)(this,t),(0,P.Z)(this,t,arguments)}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"render",value:function(n,i,a,s,o,A){a.getBounds();var l=i.lineWidth,c=l===void 0?1:l,u=i.textAlign,h=u===void 0?"start":u,d=i.textBaseline,f=d===void 0?"alphabetic":d,g=i.lineJoin,v=g===void 0?"miter":g,m=i.miterLimit,w=m===void 0?10:m,C=i.letterSpacing,F=C===void 0?0:C,Q=i.stroke,D=i.fill,K=i.fillRule,G=i.fillOpacity,J=G===void 0?1:G,$=i.strokeOpacity,at=$===void 0?1:$,At=i.opacity,pt=At===void 0?1:At,wt=i.metrics,bt=i.x,Rt=bt===void 0?0:bt,Pt=i.y,xt=Pt===void 0?0:Pt,Ft=i.dx,_t=i.dy,Xt=i.shadowColor,ie=i.shadowBlur,le=i.textDecorationLine,ve=wt.font,xe=wt.lines,Qe=wt.height,Re=wt.lineHeight,nn=wt.lineMetrics;n.font=ve,n.lineWidth=c,n.textAlign=h==="middle"?"center":h;var mn=f;mn==="alphabetic"&&(mn="bottom"),n.lineJoin=v,Pe(w)||(n.miterLimit=w);var sn=xt;f==="middle"?sn+=-Qe/2-Re/2:f==="bottom"||f==="alphabetic"||f==="ideographic"?sn+=-Qe:(f==="top"||f==="hanging")&&(sn+=-Re);var er=Rt+(Ft||0);sn+=_t||0,xe.length===1&&(mn==="bottom"?(mn="middle",sn-=.5*Qe):mn==="top"&&(mn="middle",sn+=.5*Qe)),n.textBaseline=mn;var kn=!Pe(Xt)&&ie>0;ag(a,n,kn);for(var Cn=0;Cn0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),e=(0,P.Z)(this,t),e.name="canvas-renderer",e.options=n,e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"init",value:function(){var n,i=(0,H.Z)({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new Ss(a),o=(n={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(n,Vt.CIRCLE,s),Vt.ELLIPSE,s),Vt.RECT,s),Vt.IMAGE,new Ub(a)),Vt.TEXT,new Pb(a)),Vt.LINE,s),Vt.POLYLINE,s),Vt.POLYGON,s),Vt.PATH,s),Vt.GROUP,void 0),(0,we.Z)((0,we.Z)((0,we.Z)(n,Vt.HTML,void 0),Vt.MESH,void 0),Vt.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new Lb(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(ls),W9=Object.freeze({__proto__:null,CircleRenderer:Ss,DefaultRenderer:Ss,EllipseRenderer:Ss,ImageRenderer:Ub,LineRenderer:Ss,PathRenderer:Ss,Plugin:Db,PolygonRenderer:Ss,PolylineRenderer:Ss,RectRenderer:Ss,TextRenderer:Pb}),LN=Ct(),NN=Ct(),kN=Ct(),QN=te(),Rb=function(){function r(){var t=this;(0,L.Z)(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=on(QN,i),A=me(NN,de(kN,n[0],n[1],0),o);if(s(e,new ii(A[0],A[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return(0,I.Z)(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var A=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var l=(0,Wa.Z)((0,ri.Z)().mark(function c(u){return(0,ri.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",a.pick(A,u));case 1:case"end":return h.stop()}},c)}));return function(c){return l.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(l){return a.pick(A,l)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,A=de(LN,s,o,0),l=e.elementsFromBBox(A[0],A[1],A[0],A[1]),c=[],u=(0,Gs.Z)(l),h;try{for(u.s();!(h=u.n()).done;){var d=h.value,f=d.getWorldTransform(),g=this.isHit(d,A,f,!1);if(g){var v=fE(d);if(v){var m=v.parsedStyle.clipPath,w=this.isHit(m,A,m.getWorldTransform(),!0);if(w){if(i)return n.picked=[d],n;c.push(d)}}else{if(i)return n.picked=[d],n;c.push(d)}}}}catch(C){u.e(C)}finally{u.f()}return n.picked=c,n}}])}();Rb.tag="CanvasPicker";function UN(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,A=n.r,l=n.fill,c=n.stroke,u=n.lineWidth,h=u===void 0?1:u,d=n.increasedLineWidthForHitTesting,f=d===void 0?0:d,g=n.pointerEvents,v=g===void 0?"auto":g,m=(h+f)/2,w=gi(a,o,t.x,t.y),C=sl(v,l,c),F=(0,U.Z)(C,2),Q=F[0],D=F[1];return Q&&D||e?w<=A+m:Q?w<=A:D?w>=A-m&&w<=A+m:!1}function sg(r,t,e,n){return r/(e*e)+t/(n*n)}function PN(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,A=n.rx,l=n.ry,c=n.fill,u=n.stroke,h=n.lineWidth,d=h===void 0?1:h,f=n.increasedLineWidthForHitTesting,g=f===void 0?0:f,v=n.pointerEvents,m=v===void 0?"auto":v,w=t.x,C=t.y,F=sl(m,c,u),Q=(0,U.Z)(F,2),D=Q[0],K=Q[1],G=(d+g)/2,J=(w-a)*(w-a),$=(C-o)*(C-o);return D&&K||e?sg(J,$,A+G,l+G)<=1:D?sg(J,$,A,l)<=1:K?sg(J,$,A-G,l-G)>=1&&sg(J,$,A+G,l+G)<=1:!1}function bl(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function DN(r,t,e,n,i,a,s){var o=i/2;return bl(r-o,t-o,e,i,a,s)||bl(r+e-o,t-o,i,n,a,s)||bl(r+o,t+n-o,e,i,a,s)||bl(r-o,t+o,i,n,a,s)}function og(r,t,e,n,i,a,s,o){var A=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),l={x:r+e*Math.cos(A),y:t+e*Math.sin(A)};return gi(l.x,l.y,s,o)<=a/2}function BA(r,t,e,n,i,a,s){var o=Math.min(r,e),A=Math.max(r,e),l=Math.min(t,n),c=Math.max(t,n),u=i/2;return a>=o-u&&a<=A+u&&s>=l-u&&s<=c+u?XA(r,t,e,n,a,s)<=i/2:!1}function _b(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s0!=oy(o[1]-e)>0&&oy(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function Gb(r,t,e){for(var n=!1,i=0;i=i.min[0]&&t.y>=i.min[1]&&t.x<=i.max[0]&&t.y<=i.max[1]}var Kb=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;ao?s:o,l=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(l,c),r.arc(n,a,A,0,Math.PI*2)}}function qN(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,A=t.markerStartOffset,l=t.markerEndOffset,c=0,u=0,h=0,d=0,f=0,g,v;s&&Nn(s)&&A&&(g=i-e,v=a-n,f=Math.atan2(v,g),c=Math.cos(f)*(A||0),u=Math.sin(f)*(A||0)),o&&Nn(o)&&l&&(g=e-i,v=n-a,f=Math.atan2(v,g),h=Math.cos(f)*(l||0),d=Math.sin(f)*(l||0)),r.moveTo(e+c,n+u),r.lineTo(i+h,a+d)}function $N(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,A=s.segments,l=0,c=0,u=0,h=0,d=0,f,g;if(e&&Nn(e)&&i){var v=e.parentNode.getStartTangent(),m=(0,U.Z)(v,2),w=m[0],C=m[1];f=w[0]-C[0],g=w[1]-C[1],d=Math.atan2(g,f),l=Math.cos(d)*(i||0),c=Math.sin(d)*(i||0)}if(n&&Nn(n)&&a){var F=n.parentNode.getEndTangent(),Q=(0,U.Z)(F,2),D=Q[0],K=Q[1];f=D[0]-K[0],g=D[1]-K[1],d=Math.atan2(g,f),u=Math.cos(d)*(a||0),h=Math.sin(d)*(a||0)}for(var G=0;GQe?xe:Qe,kn=xe>Qe?1:xe/Qe,Cn=xe>Qe?Qe/xe:1;r.translate(le,ve),r.rotate(mn),r.scale(kn,Cn),r.arc(0,0,er,Re,nn,!!(1-sn)),r.scale(1/kn,1/Cn),r.rotate(-mn),r.translate(-le,-ve)}pt&&r.lineTo(J[6]+u,J[7]+h);break}case"Z":r.closePath();break}}}function tk(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,A=s[0][0],l=s[0][1],c=s[o-1][0],u=s[o-1][1],h=0,d=0,f=0,g=0,v=0,m,w;e&&Nn(e)&&i&&(m=s[1][0]-s[0][0],w=s[1][1]-s[0][1],v=Math.atan2(w,m),h=Math.cos(v)*(i||0),d=Math.sin(v)*(i||0)),n&&Nn(n)&&a&&(m=s[o-1][0]-s[0][0],w=s[o-1][1]-s[0][1],v=Math.atan2(w,m),f=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),r.moveTo(A+(h||f),l+(d||g));for(var C=1;C0?1:-1,d=A>0?1:-1,f=h+d===0,g=s.map(function(Q){return hr(Q,0,Math.min(Math.abs(l)/2,Math.abs(c)/2))}),v=(0,U.Z)(g,4),m=v[0],w=v[1],C=v[2],F=v[3];r.moveTo(h*m+n,a),r.lineTo(l-h*w+n,a),w!==0&&r.arc(l-h*w+n,d*w+a,w,-d*Math.PI/2,h>0?0:Math.PI,f),r.lineTo(l+n,c-d*C+a),C!==0&&r.arc(l-h*C+n,c-d*C+a,C,h>0?0:Math.PI,d>0?Math.PI/2:1.5*Math.PI,f),r.lineTo(h*F+n,c+a),F!==0&&r.arc(h*F+n,c-d*F+a,F,d>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,f),r.lineTo(n,d*m+a),m!==0&&r.arc(h*m+n,d*m+a,m,h>0?Math.PI:0,d>0?Math.PI*1.5:Math.PI/2,f)}}var zb=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,A.abrupt("return",this.context.canvas.toDataURL(a,s));case 1:case"end":return A.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),ik=function(r){function t(){var e;(0,L.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a{const n=this.context.canvas,i=n.context.renderingContext.root.ownerDocument.defaultView;this.normalizeToPointerEvent(e,i).forEach(s=>{const o=this.bootstrapEvent(this.rootPointerEvent,s,i,e);ph(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[Yt.CLICK,Yt.POINTER_DOWN,Yt.POINTER_MOVE,Yt.POINTER_UP,Yt.POINTER_OVER,Yt.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=xl(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=ok(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,A=this.upsert("key-container",xi,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",ul,n,A)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Eh))return;const n=this.getDomElement();this.events.forEach(i=>{n.addEventListener(i,this.forwardEvents)})}attributeChangedCallback(t,e,n){t==="zIndex"&&e!==n&&(this.getDomElement().style.zIndex=n)}destroy(){const t=this.getDomElement();this.events.forEach(e=>{t.removeEventListener(e,this.forwardEvents)}),super.destroy()}normalizeToPointerEvent(t,e){const n=[];if(e.isTouchEvent(t))for(let i=0;ithis.context.element.getElement(s)).filter(Boolean);if(i.length===0){const s=new jn,{x:o=0,y:A=0,size:l}=t,[c,u]=ka(l);return s.setMinMax([o-c/2,A-u/2,0],[o+c/2,A+u/2,0]),s}const a=ch(i.map(s=>s.getBounds()));return n?pA(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",Ob,n,e),iy(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Or(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=Zb(e,["type"]),a=this.getShape("key"),[s,o]=Lo(a.getLocalBounds(),"center"),A=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const l=this.getCollapsedMarkerText(n,t);Object.assign(A,{text:l})}return A}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(Qt(a))==="node").length.toString():Wt(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(A=>!s.isCombo(Qt(A)));if(o.length>0&&o.some(HL)){const A=o.reduce((l,c)=>tn(l,Ai(c)),[0,0,0]);return bs(A,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),ay(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:A}=i,l=Zb(i,["x","y","z","transform"]);return l}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}Dc.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class ck extends Dc{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Js,this.getKeyStyle(t),e)}getKeyStyle(t){const{collapsed:e}=t,n=super.getKeyStyle(t),[i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},n),e&&Or(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=ka(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=gA(e),a=Math.sqrt(Math.pow(n,2)+Math.pow(i,2))/2;return[a*2,a*2,0]}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return Zf(t,n,e)}}class uk extends Dc{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",xi,this.getKeyStyle(t),e)}getKeyStyle(t){const e=super.getKeyStyle(t),[n,i]=this.getKeySize(t);return Object.assign(Object.assign(Object.assign({},e),t.collapsed&&Or(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}var hk=function(r,t){if(!oh(r))return r;for(var e=[],n=0;n-1:!1},gk=fk,vk=function(r,t){return t===void 0&&(t=[]),dk(r,function(e){return!gk(t,e)})},pk=vk;const mk={padding:10};function jb(r,t,e,n,i,a){const{padding:s}=Object.assign(mk,a),o=vA(e,s),A=vA(n,s),l=[r,...i,t];let c=null;const u=[];for(let h=0,d=l.length;ha?"N":"S":n===a?e>i?"W":"E":null}function Ay(r,t){return t==="N"||t==="S"?eo(r):to(r)}function Xb(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=ea(r,n),s=ea(r,i),o=e?yk[e]:null,A=a===e||a!==o&&s!==e?n:i;return{points:[A],direction:ea(A,t)}}function ug(r,t,e){if(Of(r,e)){const n=Bh(r,t,e);return{points:[n],direction:ea(n,t)}}else{const n=vl(r,e),a=["left","right"].includes(uh(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:ea(a,t)}}}function Jb(r,t,e,n){const i=Of(t,e)?t:vl(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(A=>jO(A,e)&&!pB(A,e,!0)),o=s.filter(A=>ea(A,r)!==n);if(o.length>0){const A=o.find(l=>ea(r,l)===n)||o[0];return{points:[A],direction:ea(A,t)}}else{const A=pk(a,s)[0],l=wA(t,A,Ay(e,n)/2);return{points:[Bh(l,r,e),l],direction:ea(l,t)}}}function wk(r,t,e,n){let i=ug(r,t,e);const a=fh(i.points[0]);if(ws(a,n)){i=ug(t,r,n);const s=fh(i.points[0]);if(ws(s,e)){const o=wA(r,a,Ay(e,ea(r,a))/2),A=wA(t,s,Ay(n,ea(t,s))/2),l=[(o[0]+A[0])/2,(o[1]+A[1])/2],c=ug(r,l,e),u=Jb(l,t,n,c.direction);i.points=[c.points[0],u.points[0]],i.direction=u.direction}}return i}function ly(r,t,e,n,i){const s=ch([e,n]),o=lr(t,s.center)>lr(r,s.center),[A,l]=o?[t,r]:[r,t],c=eo(s)+to(s);let u;if(i){const f=[A[0]+c*Math.cos(Yb[i]),A[1]+c*Math.sin(Yb[i])];u=wA(vl(f,s),f,.01)}else u=wA(vl(A,s),A,-.01);let h=Bh(u,l,s),d=[gh(u,2),gh(h,2)];if(Dr(gh(u),gh(h))){const f=jm(tr(u,A),[1,0,0])+Math.PI/2;h=[l[0]+c*Math.cos(f),l[1]+c*Math.sin(f),0],h=gh(wA(vl(h,s),l,-.01),2);const g=Bh(u,h,s);d=[u,g,h]}return{points:o?d.reverse():d,direction:ea(o?u:h,t)}}function Bh(r,t,e){let n=[r[0],t[1]];return ws(n,e)&&(n=[t[0],r[1]]),n}function qb(r,t,e,n,i){let A=typeof t=="number"?t:.5;t==="start"&&(A=0),t==="end"&&(A=.99);const l=Si(r.getPoint(A)),c=Si(r.getPoint(A+.01));let u=t==="start"?"left":t==="end"?"right":"center";if(ub(l,c)||!e){const[m,w]=$b(r,A,n,i);return{transform:[["translate",m,w]],textAlign:u}}let h=Math.atan2(c[1]-l[1],c[0]-l[0]);c[0]{const c=s[l-1]||i,u=s[l+1]||a;if(!hb(c,A,u)&&t){const[h,d]=Ck(c,A,u,t);o.push(["L",h[0],h[1]],["Q",A[0],A[1],d[0],d[1]],["L",d[0],d[1]])}else o.push(["L",A[0],A[1]])}),o.push(["L",a[0],a[1]]),e&&o.push(["Z"]),o}function Ck(r,t,e,n){const i=Vf(r,t),a=Vf(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],A=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,A]}const Sk=r=>{const t=Math.PI/2,e=eo(r)/2,n=to(r)/2,i=Math.atan2(e,n)/2,a=Math.atan2(n,e)/2;return{top:[-t-a,-t+a],"top-right":[-t+a,-i],"right-top":[-t+a,-i],right:[-i,i],"bottom-right":[i,t-a],"right-bottom":[i,t-a],bottom:[t-a,t+a],"bottom-left":[t+a,Math.PI-i],"left-bottom":[t+a,Math.PI-i],left:[Math.PI-i,Math.PI+i],"top-left":[Math.PI+i,-t-a],"left-top":[Math.PI+i,-t-a]}};function ex(r,t,e,n,i){const a=vA(r),s=r.getCenter();let o=n&&xA(n),A=i&&xA(i);if(!o||!A){const l=Sk(a),c=l[t][0],u=l[t][1],[h,d]=gA(a),f=Math.max(h,d),g=tn(s,[f*Math.cos(c),f*Math.sin(c),0]),v=tn(s,[f*Math.cos(u),f*Math.sin(u),0]);o=vy(r,g),A=vy(r,v),e||([o,A]=[A,o])}return[o,A]}function Mk(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[A,l]=ex(r,t,e,s,o);const c=Tk(r,A,l,n);return s&&(A=xh(s,c[0])),o&&(l=xh(o,c.at(-1))),tx(A,l,c)}function Tk(r,t,e,n){const i=r.getCenter();if(Dr(t,e)){const a=tr(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[tn(t,s),tn(e,Bs(s,[1,-1,1]))]}return[wA(i,t,lr(i,t)+n),wA(i,e,lr(i,e)+n)]}function Fk(r,t,e,n,i,a,s){const o=gy(r),A=o[a||s],l=o[s||a];let[c,u]=ex(r,e,n,A,l);const h=Ok(r,c,u,i);return A&&(c=xh(A,h[0])),l&&(u=xh(l,h.at(-1))),uy([c,...h,u],t)}function Ok(r,t,e,n){const i=[],a=vA(r);if(Dr(t,e))switch(uh(t,a)){case"left":i.push([t[0]-n,t[1]]),i.push([t[0]-n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"right":i.push([t[0]+n,t[1]]),i.push([t[0]+n,t[1]+n]),i.push([t[0],t[1]+n]);break;case"top":i.push([t[0],t[1]-n]),i.push([t[0]+n,t[1]-n]),i.push([t[0]+n,t[1]]);break;case"bottom":i.push([t[0],t[1]+n]),i.push([t[0]+n,t[1]+n]),i.push([t[0]+n,t[1]]);break}else{const s=uh(t,a),o=uh(e,a);if(s===o){const A=s;let l,c;switch(A){case"left":l=Math.min(t[0],e[0])-n,i.push([l,t[1]]),i.push([l,e[1]]);break;case"right":l=Math.max(t[0],e[0])+n,i.push([l,t[1]]),i.push([l,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const A=(h,d)=>({left:[d[0]-n,d[1]],right:[d[0]+n,d[1]],top:[d[0],d[1]-n],bottom:[d[0],d[1]+n]})[h],l=A(s,t),c=A(o,e),u=Bh(l,c,a);i.push(l,u,c)}}return i}function hy(r,t){const e=new Set,n=new Set,i=new Set;return r.forEach(a=>{t(a).forEach(o=>{e.add(o),r.includes(o.source)&&r.includes(o.target)?n.add(o):i.add(o)})}),{edges:Array.from(e),internal:Array.from(n),external:Array.from(i)}}function nx(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(Qt(n));if(i)n=i;else break}if(e.some(i=>{var a;return(a=i.style)===null||a===void 0?void 0:a.collapsed})){const i=e.reverse().findIndex(da);return e[i]||e.at(-1)}return r}function Ik(r,t){return t||(r<4?10:r===4?12:r*2.5)}const Lk=(r,t)=>{const e=Math.max(r,t)/2;return[["M",-r/2,0],["A",e,e,0,1,0,2*e-r/2,0],["A",e,e,0,1,0,-r/2,0],["Z"]]},rx=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],Nk=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],kk=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],Qk=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],Uk=(r,t)=>{const e=r/2,n=r/7,i=r-n;return[["M",-e,0],["L",0,-t/2],["L",0,t/2],["Z"],["M",i-e,-t/2],["L",i+n-e,-t/2],["L",i+n-e,t/2],["L",i-e,t/2],["Z"]]},Pk=(r,t)=>[["M",r/2,-t/2],["L",-r/2,0],["L",r/2,0],["L",-r/2,0],["L",r/2,t/2]];var hg=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{l in i&&(A[l]=i[l])}),A}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=vA(i),s=Math.max(to(a),eo(a)),{placement:o,clockwise:A,dist:l=s}=Or(this.getGraphicStyle(t),"loop");return Mk(i,o,A,l,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[A,l]=Yk(s,o,i,a);if(!e){const d=A?xA(A):s.getCenter(),f=l?xA(l):o.getCenter();return[d,f]}const c=typeof n=="function"?n():n,u=ux(A||s,c[0]||l||o),h=ux(l||o,c[c.length-1]||A||s);return[u,h]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=Or(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Or(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,A=hg(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),l=qb(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),u=rN([c.min,c.max],o);return Object.assign({wordWrapWidth:u},l,A)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=Or(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=hg(e,["offsetX","offsetY","placement"]);return Object.assign(s,Ek(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const A=this.getArrowStyle(t,i),[l,c,u]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],h=o.parsedStyle[l];if(h)h.attr(A);else{const d=A.src?nh:Pi,f=new d({style:A});o.style[l]=f}o.style[c]=t[u]||A.width/2+ +A.lineWidth}else{const A=i?"markerStart":"markerEnd";(n=o.style[A])===null||n===void 0||n.destroy(),o.style[A]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=Or(this.getGraphicStyle(t),i),{size:s,type:o}=a,A=hg(a,["size","type"]),[l,c]=ka(Ik(n.lineWidth,s)),h=(Wt(o)?o:W[o]||rx)(l,c);return Object.assign(xl(n,["stroke","strokeOpacity","fillOpacity"]),{width:l,height:c},Object.assign({},h&&{d:h,fill:o==="simple"?"":n.stroke}),A)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",io,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",Pi,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",Uc,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",Pi,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}bA.defaultStyleProps={badge:!0,badgeOffsetX:0,badgeOffsetY:0,badgePlacement:"suffix",isBillboard:!0,label:!0,labelAutoRotate:!0,labelIsBillboard:!0,labelMaxWidth:"80%",labelOffsetX:4,labelOffsetY:0,labelPlacement:"center",labelTextBaseline:"middle",labelWordWrap:!1,halo:!1,haloDroppable:!1,haloLineDash:0,haloLineWidth:12,haloPointerEvents:"none",haloStrokeOpacity:.25,haloZIndex:-1,loop:!0,startArrow:!1,startArrowLineDash:0,startArrowLineJoin:"round",startArrowLineWidth:1,startArrowTransformOrigin:"center",startArrowType:"vee",endArrow:!1,endArrowLineDash:0,endArrowLineJoin:"round",endArrowLineWidth:1,endArrowTransformOrigin:"center",endArrowType:"vee",loopPlacement:"top",loopClockwise:!0};class Cl extends bA{constructor(t){super(pi({style:Cl.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,bk(a),Bk(s),i);return tx(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[cy(t,e,n[0],i[0]),cy(t,e,n[1],i[1])]}}Cl.defaultStyleProps={curvePosition:.5,curveOffset:20};class dg extends Cl{constructor(t){super(pi({style:dg.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[0]-t[0];return[[t[0]+a*n[0]+i[0],t[1]],[e[0]-a*n[1]+i[1],e[1]]]}}dg.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class fg extends Cl{constructor(t){super(pi({style:fg.defaultStyleProps},t))}get ref(){return this.context.model.getRootsData()[0]}getEndpoints(t){if(this.sourceNode.id===this.ref.id)return super.getEndpoints(t);const e=Ai(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=Ai(this.ref),n=lr(t,e),i=sb(tr(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),A=o-a;return[[t[0]+(A*n[0]+i[0])*Math.cos(s),t[1]+(A*n[0]+i[0])*Math.sin(s)],[e[0]-(A*n[1]-i[0])*Math.cos(s),e[1]-(A*n[1]-i[0])*Math.sin(s)]]}}fg.defaultStyleProps={curvePosition:.5,curveOffset:20};class gg extends Cl{constructor(t){super(pi({style:gg.defaultStyleProps},t))}getControlPoints(t,e,n,i){const a=e[1]-t[1];return[[t[0],t[1]+a*n[0]+i[0]],[e[0],e[1]-a*n[1]+i[1]]]}}gg.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class vg extends bA{constructor(t){super(pi({style:vg.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}}vg.defaultStyleProps={};const Dk={enableObstacleAvoidance:!1,offset:10,maxAllowedDirectionChange:Math.PI/2,maximumLoops:3e3,gridSize:5,startDirections:["top","right","bottom","left"],endDirections:["top","right","bottom","left"],directionMap:{right:{stepX:1,stepY:0},left:{stepX:-1,stepY:0},bottom:{stepX:0,stepY:1},top:{stepX:0,stepY:-1}},penalties:{0:0,90:0},distFunc:Vf},ko=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function Sl(r,t){const e=n=>Math.round(n/t);return ye(r)?e(r):r.map(e)}function Rk(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function ix(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function ax(r,t,e,n){const i=ix(r,t),a=e[ko(r)],o=ix(a||n,r);return Rk(o,i)}const _k=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=pA(a.getRenderBounds(),e);for(let o=Sl(s.min[0],n);o<=Sl(s.max[0],n);o+=1)for(let A=Sl(s.min[1],n);A<=Sl(s.max[1],n);A+=1)i[`${o}|||${A}`]=!0}),i};function sx(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function Hk(r,t,e){let n=r[0],i=e(r[0],t);for(let a=0;a{if(!t)return[r];const{directionMap:i,offset:a}=n,s=pA(t.getRenderBounds(),a),o=Object.keys(i).reduce((A,l)=>{if(e.includes(l)){const c=i[l],[u,h]=gA(s),d=[r[0]+c.stepX*u,r[1]+c.stepY*h],f=JO(s);for(let g=0;gSl(A,n.gridSize))},Gk=(r,t,e,n,i,a,s)=>{const o=[];let A=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(A);let l=r,c=t[ko(l)];for(;c;){const d=c,f=l;ax(d,f,t,e)&&(A=[d[0]===f[0]?A[0]:d[0]*s,d[1]===f[1]?A[1]:d[1]*s],o.unshift(A)),c=t[ko(d)],l=d}const u=i.map(d=>[d[0]*s,d[1]*s]),h=Hk(u,A,Vf);return o.unshift(h),o};function Kk(r,t,e,n){const i=yl(r.getCenter()),a=yl(t.getCenter()),s=Object.assign(Dk,n),{gridSize:o}=s,A=s.enableObstacleAvoidance?e:[r,t],l=_k(A,s),c=Sl(i,o),u=Sl(a,o),h=ox(i,r,s.startDirections,s),d=ox(a,t,s.endDirections,s);h.forEach(G=>delete l[ko(G)]),d.forEach(G=>delete l[ko(G)]);const f={},g={},v={},m={},w={},C=new zk;for(let G=0;Gko(G));let Q=s.maximumLoops,D,K=1/0;for(const[G,J]of Object.entries(f))w[G]<=K&&(K=w[G],D=J);for(;Object.keys(f).length>0&&Q>0;){const G=C.minId(!1);if(G)D=f[G];else break;const J=ko(D);if(F.includes(J))return Gk(D,v,c,a,h,u,o);delete f[J],C.remove(J),g[J]=!0;for(const $ of Object.values(s.directionMap)){const at=tn(D,[$.stepX,$.stepY]),At=ko(at);if(g[At])continue;const pt=ax(D,at,v,c);if(pt>s.maxAllowedDirectionChange||l[At])continue;f[At]||(f[At]=at);const wt=s.penalties[pt],bt=s.distFunc(D,at)+(isNaN(wt)?o:wt),Rt=m[J]+bt,Pt=m[At];Pt&&Rt>=Pt||(v[At]=D,m[At]=Rt,w[At]=Rt+sx(at,d,s.distFunc),C.add({id:At,value:w[At]}))}Q-=1}return[]}class zk{constructor(){this.arr=[],this.map={},this.arr=[],this.map={}}_innerAdd(t,e){let n=0,i=e-1;for(;i-n>1;){const a=Math.floor((n+i)/2);if(this.arr[a].value>t.value)i=a;else if(this.arr[a].value=0;e--)this.map[this.arr[e].id]?t=this.arr[e].id:this.arr.splice(e,1);return t}_findFirstId(){for(;this.arr.length;){const t=this.arr.shift();if(this.map[t.id])return t.id}}minId(t){return t?this._clearAndGetMinId():this._findFirstId()}}class pg extends bA{constructor(t){super(pi({style:pg.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:i}=this,[a,s]=this.getEndpoints(t,!1);let o=[];if(!e)o=t.controlPoints;else if(e.type==="shortest-path"){const A=this.context.element.getNodes();o=Kk(n,i,A,e),o.length||(o=jb(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=jb(a,s,n,i,t.controlPoints,e));return o}getPoints(t){const e=this.getControlPoints(t),[n,i]=this.getEndpoints(t,!0,e);return[n,...e,i]}getKeyPath(t){const e=this.getPoints(t);return uy(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=vA(a),o=Math.max(to(s),eo(s))/4,{placement:A,clockwise:l,dist:c=o}=Or(this.getGraphicStyle(t),"loop");return Fk(a,i,A,l,c,e,n)}}pg.defaultStyleProps={radius:0,controlPoints:[],router:!1};class mg extends bA{constructor(t){super(pi({style:mg.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||cy(i,a,e,n);return xk(i,a,s)}}mg.defaultStyleProps={curvePosition:.5,curveOffset:30};var Vk=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{var a;const{key:s,placement:o}=n;lx(n)&&(t[a=s||i]||(t[a]=Lo(r.getShape("key").getBounds(),o)))}),t}function lx(r){const{r:t}=r;return!t||Number(t)===0}function xA(r){return kc(r)?r:r.getPosition()}function Yk(r,t,e,n){const i=cx(r,t,e,n),a=cx(t,r,n,e);return[i,a]}function cx(r,t,e,n){const i=gy(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(l=>xA(l)),o=Xk(t,n),[A]=WL(s,o);return a.find(l=>xA(l)===A)}function Xk(r,t){const e=gy(r);if(t)return[xA(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>xA(i)):[r.getCenter()]}function ux(r,t){return dy(r)||bh(r)?vy(r,t):xh(r,t)}function xh(r,t){if(!r||!t)return[0,0,0];if(kc(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=kc(t)?t:bh(t)?t.getCenter():t.getPosition();return Zf(e,r.getBounds())}function vy(r,t){if(!r||!t)return[0,0,0];const e=kc(t)?t:bh(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function hx(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Lo(r,t),[A,l]=i?["bottom","top"]:["top","bottom"],c=a.includes("top")?l:a.includes("bottom")?A:"middle",u=a.includes("left")?"right":a.includes("right")?"left":"center";return{transform:[["translate",s+e,o+n]],textBaseline:c,textAlign:u}}function Jk(r,t){return[[0,-r],[t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)],[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[0,t],[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],[-t*Math.cos(Math.PI/10),t*Math.sin(Math.PI/10)],[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],[-t*Math.cos(3*Math.PI/10),-t*Math.sin(3*Math.PI/10)]]}function qk(r,t){const e={};return e.top=[0,-r],e.left=[-r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e["left-bottom"]=[-r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.bottom=[0,t],e["right-bottom"]=[r*Math.cos(3*Math.PI/10),r*Math.sin(3*Math.PI/10)],e.right=e.default=[r*Math.cos(Math.PI/10),-r*Math.sin(Math.PI/10)],e}function $k(r,t,e){const n=t/2,i=r/2,a={up:[[-i,n],[i,n],[0,-n]],left:[[-i,0],[i,n],[i,-n]],right:[[-i,n],[-i,-n],[i,0]],down:[[-i,-n],[i,-n],[0,n]]};return a[e]||a.up}function tQ(r,t,e){const n=t/2,i=r/2,a={};return e==="down"?(a.bottom=a.default=[0,n],a.right=[i,-n],a.left=[-i,-n]):e==="left"?(a.top=[i,-n],a.bottom=[i,n],a.left=a.default=[-i,0]):e==="right"?(a.top=[-i,-n],a.bottom=[-i,n],a.right=a.default=[i,0]):(a.left=[-i,n],a.top=a.default=[0,-n],a.right=[i,n]),a}function Y9(r,t){return[[r/2,-t/2],[r/2,t/2],[-r/2,t/2],[-r/2,-t/2]]}function eQ(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function dx(r){return Mi(r,["style","visibility"])!=="hidden"}function nQ(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:A}=t,l=Vk(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,l),n&&r.setAttribute("transform",n),ye(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),A&&r.setAttribute("component",A)}function py(r,t){"update"in r?r.update(t):r.attr(t)}function rQ(r){return[[0,r],[r*Math.sqrt(3)/2,r/2],[r*Math.sqrt(3)/2,-r/2],[0,-r],[-r*Math.sqrt(3)/2,-r/2],[-r*Math.sqrt(3)/2,r/2]]}function iQ(r){ph(r,"__to_be_destroyed__",!0)}function Ch(r){return Mi(r,"__to_be_destroyed__",!1)}var aQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class yg extends Na{constructor(t,e){super(t,Object.assign({},yg.defaultOptions,e)),this.onCollapseExpand=n=>aQ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!Wk(i))return;const a=i.id,{model:s,graph:o}=this.context,A=s.getElementDataById(a);if(!A)return!1;const{onCollapse:l,onExpand:c,animation:u,align:h}=this.options;da(A)?(yield o.expandElement(a,{animation:u,align:h}),c==null||c(a)):(yield o.collapseElement(a,{animation:u,align:h}),l==null||l(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}yg.defaultOptions={enable:!0,animation:!0,trigger:Yt.DBLCLICK,align:!0};var wg={},sQ=function(r){return r=r||"g",wg[r]?wg[r]+=1:wg[r]=1,r+wg[r]},Sh=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);if.length!==g.length?!1:f.every((v,m)=>v===g[m]),d=(f,g)=>{const v=Object.keys(f),m=Object.keys(g);return v.length!==m.length?!1:v.every(w=>f[w]===g[w])};return!(!d(s,u)||!h(a,c)||!h(e,o)||!d(n,A)||!d(i,l))}const fx="__internal_override__";function gx(r){return r[fx]!==!1}var Eg=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};const oQ="g6-create-edge-assist-edge-id",Bg="g6-create-edge-assist-node-id";class bg extends Na{constructor(t,e){super(t,Object.assign({},bg.defaultOptions,e)),this.drop=n=>Eg(this,void 0,void 0,function*(){const{targetType:i}=n;["combo","node"].includes(i)&&this.source?yield this.handleCreateEdge(n):yield this.cancelEdge()}),this.handleCreateEdge=n=>Eg(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:A,batch:l,element:c}=this.context,{style:u}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}l.startBatch(),A.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const h=o.getElementData(this.source);o.addNodeData([{id:Bg,type:"circle",[fx]:!1,style:{size:1,visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=h.style)===null||i===void 0?void 0:i.x,y:(a=h.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:oQ,source:this.source,target:Bg,style:Object.assign({pointerEvents:"none"},u)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>Eg(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(Bg,[n.client.x,n.client.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:A,onCreate:l}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const u=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],h=`${this.source}-${u}-${sQ()}`,d=l({id:h,source:this.source,target:u,style:o});d&&(s.addEdgeData([d]),A(d))},this.cancelEdge=()=>Eg(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([Bg]),this.source=void 0,yield(n=a.draw({animation:!1}))===null||n===void 0?void 0:n.finished,s.endBatch()}),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;this.unbindEvents(),e==="click"?(t.on($a.CLICK,this.handleCreateEdge),t.on(gl.CLICK,this.handleCreateEdge),t.on(To.CLICK,this.cancelEdge),t.on(Tf.CLICK,this.cancelEdge)):(t.on($a.DRAG_START,this.handleCreateEdge),t.on(gl.DRAG_START,this.handleCreateEdge),t.on(Yt.POINTER_UP,this.drop)),t.on(Yt.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off($a.CLICK,this.handleCreateEdge),t.off(gl.CLICK,this.handleCreateEdge),t.off(To.CLICK,this.cancelEdge),t.off(Tf.CLICK,this.cancelEdge),t.off($a.DRAG_START,this.handleCreateEdge),t.off(gl.DRAG_START,this.handleCreateEdge),t.off(Yt.POINTER_UP,this.drop),t.off(Yt.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}bg.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};function AQ(r,t,e){var n;return function(){var i=this,a=arguments,s=function(){n=null,e||r.apply(i,a)},o=e&&!n;clearTimeout(n),n=setTimeout(s,t),o&&r.apply(i,a)}}var Mh=AQ,vx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class xg extends Na{constructor(t,e){super(t,Object.assign({},xg.defaultOptions,e)),this.isDragging=!1,this.onDragStart=n=>{this.validate(n)&&(this.isDragging=!0,this.context.canvas.setCursor("grabbing"))},this.onDrag=n=>{var i,a,s,o;if(!this.isDragging||Rr.isPinching)return;const A=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,l=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;A|l&&this.translate([A,l],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Mh(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new EA(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(Br(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(Yt.DRAG_START,this.onDragStart),e.on(Yt.DRAG,this.onDrag),e.on(Yt.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return vx(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Bs(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return vx(this,void 0,void 0,function*(){t=this.clampByDirection(t),t=this.clampByRange(t),t=this.clampByRotation(t),yield this.context.graph.translateBy(t,e)})}clampByRotation([t,e]){const n=this.context.graph.getRotation();return ob([t,e],n)}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,A,l,c]=La(this.options.range),u=[s*o,a*A,s*l,a*c],h=pA(km(n.getCanvasCenter()),u),d=tr(n.getViewportCenter(),[t,e,0]);if(!ws(d,h)){const{min:[f,g],max:[v,m]}=h;(d[0]0||d[0]>v&&t<0)&&(t=0),(d[1]0||d[1]>m&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(Yt.DRAG_START,this.onDragStart),t.off(Yt.DRAG,this.onDrag),t.off(Yt.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}xg.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var px=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Th extends Na{constructor(t,e){super(t,Object.assign({},Th.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>px(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(A=>{const l=a.getParentData(A,nr);l&&Qt(l)===o&&a.refreshComboData(o),a.setParent(A,o,nr)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===Yt.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.shortcut=new EA(t.graph),this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${Yt.DRAG_START}`,this.onDragStart),t.on(`${i}:${Yt.DRAG}`,this.onDrag),t.on(`${i}:${Yt.DRAG_END}`,this.onDragEnd),t.on(`${i}:${Yt.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${Yt.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(gl.DROP,this.onDrop),t.on(To.DROP,this.onDrop))}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}getDelta(t){const e=this.context.graph.getZoom();return bs([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(!this.enable)return;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[A,l]=tr([+s,+o],this.shadowOrigin);this.moveElement(this.target,[A,l])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}isKeydown(){const{trigger:t}=this.options;return t!=null&&t.length?this.shortcut.match(t):!0}validate(t){if(this.destroyed||Ch(t.target)||this.context.graph.isCollapsingExpanding||!this.isKeydown())return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}clampByRotation([t,e]){const n=this.context.graph.getRotation();return ob([t,e],n)}moveElement(t,e){return px(this,void 0,void 0,function*(){const{graph:n,model:i}=this.context,{dropEffect:a}=this.options;a==="move"&&t.forEach(s=>i.refreshComboData(s)),n.translateElementBy(Object.fromEntries(t.map(s=>[s,this.clampByRotation(e)])),!1)})}moveShadow(t){if(!this.shadow)return;const{x:e=0,y:n=0}=this.shadow.attributes,[i,a]=t;this.shadow.attr({x:+e+i,y:+n+a})}createShadow(t){const e=Or(this.options,"shadow"),n=ch(t.map(l=>this.context.element.getElement(l).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=gA(n),A={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),A),{visibility:"visible"})):(this.shadow=new xi({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),A),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(Qt):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(Qt)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${Yt.DRAG_START}`,this.onDragStart),t.off(`${i}:${Yt.DRAG}`,this.onDrag),t.off(`${i}:${Yt.DRAG_END}`,this.onDragEnd),t.off(`${i}:${Yt.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${Yt.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${Yt.DROP}`,this.onDrop),t.off(`canvas:${Yt.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}Th.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),trigger:[],dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var lQ="*",cQ=function(){function r(){this._events={}}return r.prototype.on=function(t,e,n){return this._events[t]||(this._events[t]=[]),this._events[t].push({callback:e,once:!!n}),this},r.prototype.once=function(t,e){return this.on(t,e,!0)},r.prototype.emit=function(t){for(var e=this,n=[],i=1;i{t.has(s.id)||(t.add(s.id),r.push(s))})}return!1}function Sg(r,t,e,n){if(e(r))return!0;t.add(r.id);for(const a of n(r.id))if(!t.has(a.id)&&Sg(a,t,e,n))return!0;return!1}const mx=()=>!0;class uQ{constructor(t){yr(this,"graph");yr(this,"nodeFilter");yr(this,"edgeFilter");yr(this,"cacheEnabled");yr(this,"inEdgesMap",new Map);yr(this,"outEdgesMap",new Map);yr(this,"bothEdgesMap",new Map);yr(this,"allNodesMap",new Map);yr(this,"allEdgesMap",new Map);yr(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});yr(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});yr(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(A=>e.add(A.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});yr(this,"handleGraphChanged",t=>{const e=new Set;t.changes.forEach(n=>{switch(n.type){case"NodeAdded":e.add(n.value.id);break;case"NodeDataUpdated":e.add(n.id);break;case"EdgeAdded":e.add(n.value.source),e.add(n.value.target);break;case"EdgeUpdated":(n.propertyName==="source"||n.propertyName==="target")&&(e.add(n.oldValue),e.add(n.newValue));break;case"EdgeDataUpdated":if(t.graph.hasEdge(n.id)){const i=t.graph.getEdge(n.id);e.add(i.source),e.add(i.target)}break;case"EdgeRemoved":e.add(n.value.source),e.add(n.value.target);break;case"NodeRemoved":e.add(n.value.id);break;default:break}}),this.updateCache(e)});this.graph=t.graph;const e=t.nodeFilter||mx,n=t.edgeFilter||mx;this.nodeFilter=e,this.edgeFilter=i=>{const{source:a,target:s}=this.graph.getEdgeDetail(i.id);return!e(a)||!e(s)?!1:n(i,a,s)},t.cache==="auto"?(this.cacheEnabled=!0,this.startAutoCache()):t.cache==="manual"?this.cacheEnabled=!0:this.cacheEnabled=!1}startAutoCache(){this.refreshCache(),this.graph.on("changed",this.handleGraphChanged)}stopAutoCache(){this.graph.off("changed",this.handleGraphChanged)}checkNodeExistence(t){this.getNode(t)}hasNode(t){if(!this.graph.hasNode(t))return!1;const e=this.graph.getNode(t);return this.nodeFilter(e)}areNeighbors(t,e){return this.checkNodeExistence(t),this.getNeighbors(e).some(n=>n.id===t)}getNode(t){const e=this.graph.getNode(t);if(!this.nodeFilter(e))throw new Error("Node not found for id: "+t);return e}getRelatedEdges(t,e){return this.checkNodeExistence(t),this.cacheEnabled?e==="in"?this.inEdgesMap.get(t):e==="out"?this.outEdgesMap.get(t):this.bothEdgesMap.get(t):this.graph.getRelatedEdges(t,e).filter(this.edgeFilter)}getDegree(t,e){return this.getRelatedEdges(t,e).length}getSuccessors(t){const n=this.getRelatedEdges(t,"out").map(i=>this.getNode(i.target));return Array.from(new Set(n))}getPredecessors(t){const n=this.getRelatedEdges(t,"in").map(i=>this.getNode(i.source));return Array.from(new Set(n))}getNeighbors(t){const e=this.getPredecessors(t),n=this.getSuccessors(t);return Array.from(new Set([...e,...n]))}hasEdge(t){if(!this.graph.hasEdge(t))return!1;const e=this.graph.getEdge(t);return this.edgeFilter(e)}getEdge(t){const e=this.graph.getEdge(t);if(!this.edgeFilter(e))throw new Error("Edge not found for id: "+t);return e}getEdgeDetail(t){const e=this.getEdge(t);return{edge:e,source:this.getNode(e.source),target:this.getNode(e.target)}}hasTreeStructure(t){return this.graph.hasTreeStructure(t)}getRoots(t){return this.graph.getRoots(t).filter(this.nodeFilter)}getChildren(t,e){return this.checkNodeExistence(t),this.graph.getChildren(t,e).filter(this.nodeFilter)}getParent(t,e){this.checkNodeExistence(t);const n=this.graph.getParent(t,e);return!n||!this.nodeFilter(n)?null:n}getAllNodes(){return this.cacheEnabled?Array.from(this.allNodesMap.values()):this.graph.getAllNodes().filter(this.nodeFilter)}getAllEdges(){return this.cacheEnabled?Array.from(this.allEdgesMap.values()):this.graph.getAllEdges().filter(this.edgeFilter)}bfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];yy([this.getNode(t)],new Set,e,i)}dfs(t,e,n="out"){const i={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[n];Sg(this.getNode(t),new Set,e,i)}}class Hr extends Cg{constructor(e){super();yr(this,"nodeMap",new Map);yr(this,"edgeMap",new Map);yr(this,"inEdgesMap",new Map);yr(this,"outEdgesMap",new Map);yr(this,"bothEdgesMap",new Map);yr(this,"treeIndices",new Map);yr(this,"changes",[]);yr(this,"batchCount",0);yr(this,"onChanged",()=>{});yr(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,A;(o=a.childrenMap.get(e))==null||o.forEach(l=>{a.parentMap.delete(l.id)});const s=a.parentMap.get(e);s&&((A=a.childrenMap.get(s.id))==null||A.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(A=>{this.setParent(A.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,u;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const A=this.getNode(n);a.parentMap.set(e,A),o&&((u=a.childrenMap.get(o.id))==null||u.delete(s));let l=a.childrenMap.get(A.id);l||(l=new Set,a.childrenMap.set(A.id,l)),l.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:A.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Sg(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return yy([this.getNode(e)],new Set,n,a)}getAllNodes(){return Array.from(this.nodeMap.values())}getAllEdges(){return Array.from(this.edgeMap.values())}bfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return yy([this.getNode(e)],new Set,n,a)}dfs(e,n,i="out"){const a={in:this.getPredecessors.bind(this),out:this.getSuccessors.bind(this),both:this.getNeighbors.bind(this)}[i];return Sg(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>Y1(ru({},a),{data:ru({},a.data)})),n=this.getAllEdges().map(a=>Y1(ru({},a),{data:ru({},a.data)})),i=new Hr({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const A=new Map;a.forEach((c,u)=>{A.set(u,i.getNode(c.id))});const l=new Map;s.forEach((c,u)=>{l.set(u,new Set(Array.from(c).map(h=>i.getNode(h.id))))}),i.treeIndices.set(o,{parentMap:A,childrenMap:l})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new uQ(ru({graph:this},e))}}class Mg{constructor(t,e){this.context=t,this.options=e||{}}}var hQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},dQ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:A=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:A}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:A=[],controlPoints:l=A.slice(1,A.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},l!=null&&l.length?{controlPoints:l.map(Si)}:{})})}),n}function vQ(r,t){class e extends Mg{constructor(i,a){if(super(i,a),this.instance=new r({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const s=this.instance;this.stop=s.stop.bind(s),this.tick=o=>{const A=s.tick(o);return Tg(A)}}}execute(i,a){return hQ(this,void 0,void 0,function*(){return Tg(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(Ci({},this.options,a))))})}transformOptions(i){if(!("onTick"in i))return i;const a=i.onTick;return i.onTick=s=>a(Tg(s)),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,A=a.map(d=>{const f=Qt(d),{data:g,style:v,combo:m}=d,w=dQ(d,["data","style","combo"]),C={id:f,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:g}),m?{parentId:m}:{}),{style:v}),w)};return v!=null&&v.x&&Object.assign(C.data,{x:v.x}),v!=null&&v.y&&Object.assign(C.data,{y:v.y}),v!=null&&v.z&&Object.assign(C.data,{z:v.z}),C}),l=new Map(A.map(d=>[d.id,d])),c=s.filter(d=>{const{source:f,target:g}=d;return l.has(f)&&l.has(g)}).map(d=>{const{source:f,target:g,data:v,style:m}=d;return{id:Qt(d),source:f,target:g,data:Object.assign({},v),style:Object.assign({},m)}}),u=o.map(d=>({id:Qt(d),data:Object.assign({_isCombo:!0},d.data),style:Object.assign({},d.style)})),h=new Hr({nodes:[...A,...u],edges:c});return t.model.model.hasTreeStructure(nr)&&(h.attachTreeStructure(nr),A.forEach(d=>{const f=t.model.model.getParent(d.id,nr);f&&h.hasNode(f.id)&&h.setParent(d.id,f.id,nr)})),h}}return e}function wy(r,t,...e){if(t in r)return r[t](...e);if("instance"in r){const n=r.instance;if(t in n)return n[t](...e)}return null}function yx(r,t){if(t in r)return r[t];if("instance"in r){const e=r.instance;if(t in e)return e[t]}return null}var pQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class mQ extends Th{get forceLayoutInstance(){return this.context.layout.getLayoutInstance().find(t=>["d3-force","d3-force-3d"].includes(t==null?void 0:t.id))}validate(t){return this.context.layout?this.forceLayoutInstance?super.validate(t):(ha.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return pQ(this,void 0,void 0,function*(){const n=this.forceLayoutInstance;this.context.graph.getNodeData(t).forEach((i,a)=>{const{x:s=0,y:o=0}=i.style||{};n&&wy(n,"setFixedPosition",t[a],[...tn([+s,+o],this.clampByRotation(e))])})})}onDragStart(t){if(this.enable=this.validate(t),!this.enable)return;this.target=this.getSelectedNodeIDs([t.target.id]),this.hideEdge(),this.context.graph.frontElement(this.target);const e=this.forceLayoutInstance;e&&yx(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&wy(e,"setFixedPosition",Qt(n),[+i,+a])})}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.moveElement(this.target,e)}onDragEnd(){const t=this.forceLayoutInstance;t&&yx(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&wy(t,"setFixedPosition",Qt(e),[null,null,null])})}}var wx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Fg extends Na{constructor(t,e){super(t,Object.assign({},Fg.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>wx(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:A}=this.options,l=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),u=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(A),h=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,d=[...l,...u];d.length>0&&d.forEach(f=>this.fixNodeLike(f,h)),this.updateRelatedEdges(),c.length>0&&c.forEach(f=>this.fixEdge(f,h))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],A=((s=o.find(l=>l.shape===i))===null||s===void 0?void 0:s.style)||{};return a in A||(A[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(l=>l.shape!==i),{shape:i,style:A}])),A[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=mN(n);(Array.isArray(a)?a:[a]).forEach(A=>{const{shape:l,fields:c}=A,u=typeof l=="function"?l(s):n.getShape(l);if(u){if(!c){this.scaleEntireElement(n.id,u,i);return}c.forEach(h=>{const d=this.getOriginalFieldValue(n.id,u,h);ye(d)&&(u.style[h]=d/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=Qt(n),{element:s,model:o}=this.context,A=s.getElement(a);if(!A||this.skipIfExceedViewport(A))return;o.getRelatedEdgesData(a).forEach(u=>this.relatedEdgeToUpdate.add(Qt(u)));const c=this.options[A.type];if(!c){this.scaleEntireElement(a,A,i);return}this.scaleSpecificShapes(A,i,c)},this.fixEdge=(n,i)=>{const a=Qt(n),s=this.context.element.getElement(a);if(!s||this.skipIfExceedViewport(s))return;const o=this.options.edge;if(!o){s.style.transformOrigin="center",this.scaleEntireElement(a,s,i);return}this.scaleSpecificShapes(s,i,o)},this.updateRelatedEdges=()=>{const{element:n}=this.context;this.relatedEdgeToUpdate.size>0&&this.relatedEdgeToUpdate.forEach(i=>{const a=n.getElement(i);a==null||a.update({})}),this.relatedEdgeToUpdate.clear()},this.resetTransform=n=>wx(this,void 0,void 0,function*(){var i;!((i=n.data)===null||i===void 0)&&i.firstRender||(this.options.reset?this.restoreCachedStyles():this.fixElementSize({data:{scale:this.zoom}}))}),this.bindEvents()}restoreCachedStyles(){if(this.cachedStyles.size>0){this.cachedStyles.forEach(i=>{i.forEach(({shape:a,style:s})=>{if(ro(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,A])=>a.style[o]=A)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(Qt(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_DRAW,this.resetTransform),t.on(Ae.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.resetTransform),t.off(Ae.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Fg.defaultOptions={enable:r=>r.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};var yQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Og extends Na{constructor(t,e){super(t,Object.assign({},Og.defaultOptions,e)),this.focus=n=>yQ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.shortcut=new EA(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),wl.forEach(e=>{t.on(`${e}:${Yt.CLICK}`,this.focus)})}validate(t){if(this.destroyed||!this.isKeydown())return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}isKeydown(){const{trigger:t}=this.options;return t!=null&&t.length?this.shortcut.match(t):!0}unbindEvents(){const{graph:t}=this.context;wl.forEach(e=>{t.off(`${e}:${Yt.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),this.shortcut.destroy(),super.destroy()}}Og.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0,trigger:[]};class Ig extends Na{constructor(t,e){super(t,Object.assign({},Ig.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===Yt.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:A}=this.options,l=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(l,s,i)),A){const u=eb(a.getData(),!0).filter(h=>!l.includes(h));Object.assign(c,this.getElementsState(u,A,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(A=>{const l=s.getElementState(A);a?o[A]=l.includes(i)?l:[...l,i]:o[A]=l.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),wl.forEach(n=>{t.on(`${n}:${Yt.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${Yt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${Yt.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${Yt.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?mb(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Ch(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;wl.forEach(n=>{t.off(`${n}:${Yt.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${Yt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${Yt.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${Yt.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}Ig.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class wQ extends vh{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e,graph:n}=this.context;this.pathShape=new Pi({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[jf(t,n)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(jf(t,this.context.graph)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",dN(this.points)),n&&i==="default"&&this.points.length>2&&super.updateElementsStates(this.points)}onPointerUp(){if(this.points){if(this.points.length<2){this.clearLasso();return}super.updateElementsStates(this.points),this.clearLasso()}}clearLasso(){var t;(t=this.pathShape)===null||t===void 0||t.remove(),this.pathShape=void 0,this.points=void 0}}class Lg extends Na{constructor(t,e){super(t,Object.assign({},Lg.defaultOptions,e)),this.hiddenShapes=[],this.isVisible=!0,this.setElementsVisibility=(n,i,a)=>{n.filter(Boolean).forEach(s=>{i==="hidden"&&!s.isVisible()?this.hiddenShapes.push(s):i==="visible"&&this.hiddenShapes.includes(s)?this.hiddenShapes.splice(this.hiddenShapes.indexOf(s),1):ml(s,i,a)})},this.filterShapes=(n,i)=>{if(Wt(i))return s=>!i(n,s);const a=i==null?void 0:i[n];return s=>s.className?!(a!=null&&a.includes(s.className)):!0},this.hideShapes=n=>{if(!this.validate(n)||!this.isVisible)return;const{element:i}=this.context,{shapes:a={}}=this.options;this.setElementsVisibility(i.getNodes(),"hidden",this.filterShapes("node",a)),this.setElementsVisibility(i.getEdges(),"hidden",this.filterShapes("edge",a)),this.setElementsVisibility(i.getCombos(),"hidden",this.filterShapes("combo",a)),this.isVisible=!1},this.showShapes=Mh(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(Ae.BEFORE_TRANSFORM,this.hideShapes),t.on(Ae.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.BEFORE_TRANSFORM,this.hideShapes),t.off(Ae.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Lg.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var Ex=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Ng extends Na{constructor(t,e){super(t,Object.assign({},Ng.defaultOptions,e)),this.onWheel=n=>Ex(this,void 0,void 0,function*(){this.options.preventDefault&&n.preventDefault();const i=n.deltaX,a=n.deltaY;yield this.scroll([-i,-a],n)}),this.shortcut=new EA(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),Br(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,A=>this.scroll([0,-10],A)),this.shortcut.bind(a,A=>this.scroll([0,10],A)),this.shortcut.bind(s,A=>this.scroll([-10,0],A)),this.shortcut.bind(o,A=>this.scroll([10,0],A))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(Yt.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Bs(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,A,l,c]=La(this.options.range),u=[s*o,a*A,s*l,a*c],h=pA(km(n.getCanvasCenter()),u),d=tr(n.getViewportCenter(),[t,e,0]);if(!ws(d,h)){const{min:[f,g],max:[v,m]}=h;(d[0]0||d[0]>v&&t<0)&&(t=0),(d[1]0||d[1]>m&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return Ex(this,void 0,void 0,function*(){if(!this.validate(e))return;const{onFinish:n}=this.options,i=this.context.graph,a=this.formatDisplacement(t);yield i.translateBy(a,!1),n==null||n()})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.onWheel),super.destroy()}}Ng.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var Bx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class kg extends Na{constructor(t,e){super(t,Object.assign({},kg.defaultOptions,e)),this.zoom=(n,i,a)=>Bx(this,void 0,void 0,function*(){if(!this.validate(i))return;const{graph:s}=this.context;let o=this.options.origin;!o&&"viewport"in i&&(o=Si(i.viewport));const{sensitivity:A,onFinish:l}=this.options,c=1+hr(n,-50,50)*A/100,u=s.getZoom();yield s.zoomTo(u*c,a,o),l==null||l()}),this.onReset=()=>Bx(this,void 0,void 0,function*(){yield this.context.graph.zoomTo(1,this.options.animation)}),this.preventDefault=n=>{this.options.preventDefault&&n.preventDefault()},this.shortcut=new EA(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(Yt.PINCH))this.shortcut.bind([Yt.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(Yt.WHEEL,this.preventDefault),this.shortcut.bind([...t,Yt.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a!=null?a:i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Wt(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.preventDefault),super.destroy()}}kg.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function bx(r,t,e,n="height"){const i=r[n],a=t[n];return e==="center"?(i+a)/2:r.height}const Ml=Object.assign,EQ={getId:r=>r.id||r.name,getPreH:r=>r.preH||0,getPreV:r=>r.preV||0,getHGap:r=>r.hgap||18,getVGap:r=>r.vgap||18,getChildren:r=>r.children,getHeight:r=>r.height||36,getWidth(r){const t=r.label||" ";return r.width||18*t.split("").length}};class Qg{constructor(t,e){if(this.x=0,this.y=0,this.depth=0,this.children=[],this.hgap=0,this.vgap=0,t instanceof Qg||"x"in t&&"y"in t&&"children"in t){const a=t;return this.data=a.data,this.id=a.id,this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.depth=a.depth,this.children=a.children,this.parent=a.parent,this.hgap=a.hgap,this.vgap=a.vgap,this.preH=a.preH,void(this.preV=a.preV)}this.data=t;const n=e.getHGap(t),i=e.getVGap(t);this.preH=e.getPreH(t),this.preV=e.getPreV(t),this.width=e.getWidth(t),this.height=e.getHeight(t),this.width+=this.preH,this.height+=this.preV,this.id=e.getId(t),this.addGap(n,i)}isRoot(){return this.depth===0}isLeaf(){return this.children.length===0}addGap(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e}eachNode(t){let e,n=[this];for(;e=n.shift();)t(e),n=e.children.concat(n)}DFTraverse(t){this.eachNode(t)}BFTraverse(t){let e,n=[this];for(;e=n.shift();)t(e),n=n.concat(e.children)}getBoundingBox(){const t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(e=>{t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t}translate(t=0,e=0){this.eachNode(n=>{n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})}right2left(){const t=this.getBoundingBox();this.eachNode(e=>{e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)}bottom2top(){const t=this.getBoundingBox();this.eachNode(e=>{e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}}function Ey(r,t={},e){t=Ml({},EQ,t);const n=new Qg(r,t),i=[n];let a;if(!e&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){const s=t.getChildren(a.data),o=s?s.length:0;if(a.children=new Array(o),s&&o)for(let A=0;A{const a=j0.fromNode(i,e);a&&n.push(a)}),e?new j0(t.height,t.width,t.x,n):new j0(t.width,t.height,t.y,n)}};function xx(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(n=>{xx(n,t,e)})}function Cx(r,t){let e=t?r.y:r.x;return r.children.forEach(n=>{e=Math.min(Cx(n,t),e)}),e}function bQ(r,t){xx(r,-Cx(r,t),t)}function Sx(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach((n,i)=>{Sx(n,t.children[i],e)})}function Mx(r,t,e=0){t?(r.x=e,e+=r.width):(r.y=e,e+=r.height),r.children.forEach(n=>{Mx(n,t,e)})}function xQ(r,t={}){const e=t.isHorizontal;function n(u){u.cs===0?(u.el=u,u.er=u,u.msel=u.mser=0):(u.el=u.c[0].el,u.msel=u.c[0].msel,u.er=u.c[u.cs-1].er,u.mser=u.c[u.cs-1].mser)}function i(u,h,d){let f=u.c[h-1],g=f.mod,v=u.c[h],m=v.mod;for(;f!==null&&v!==null;){d&&A(f)>d.low&&(d=d.nxt);const w=g+f.prelim+f.w-(m+v.prelim);w>0&&(m+=w,d&&a(u,h,d.index,w));const C=A(f),F=A(v);C<=F&&(f=o(f),f!==null&&(g+=f.mod)),C>=F&&(v=s(v),v!==null&&(m+=v.mod))}!f&&v?function(w,C,F,Q){const D=w.c[0].el;D.tl=F;const K=Q-F.mod-w.c[0].msel;D.mod+=K,D.prelim-=K,w.c[0].el=w.c[C].el,w.c[0].msel=w.c[C].msel}(u,h,v,m):f&&!v&&function(w,C,F,Q){const D=w.c[C].er;D.tr=F;const K=Q-F.mod-w.c[C].mser;D.mod+=K,D.prelim-=K,w.c[C].er=w.c[C-1].er,w.c[C].mser=w.c[C-1].mser}(u,h,f,g)}function a(u,h,d,f){u.c[h].mod+=f,u.c[h].msel+=f,u.c[h].mser+=f,function(g,v,m,w){if(m!==v-1){const C=v-m;g.c[m+1].shift+=w/C,g.c[v].shift-=w/C,g.c[v].change-=w-w/C}}(u,h,d,f)}function s(u){return u.cs===0?u.tl:u.c[0]}function o(u){return u.cs===0?u.tr:u.c[u.cs-1]}function A(u){return u.y+u.h}function l(u,h,d){for(;d!==null&&u>=d.low;)d=d.nxt;return{low:u,index:h,nxt:d}}Mx(r,e);const c=BQ.fromNode(r,e);return c&&(function u(h){if(h.cs===0)return void n(h);u(h.c[0]);let d=l(A(h.c[0].el),0,null);for(let f=1;f{o.isRoot()||(o.side="left")}),n.eachNode(o=>{o.isRoot()||(o.side="right")}),{left:e,right:n}}const SA=["LR","RL","TB","BT","H","V"],CQ=["LR","RL","H"],SQ=SA[0];function By(r,t,e){const n=t.direction||SQ;if(t.isHorizontal=(a=>CQ.indexOf(a)>-1)(n),n&&SA.indexOf(n)===-1)throw new TypeError(`Invalid direction: ${n}`);if(n===SA[0])e(r,t);else if(n===SA[1])e(r,t),r.right2left();else if(n===SA[2])e(r,t);else if(n===SA[3])e(r,t),r.bottom2top();else if(n===SA[4]||n===SA[5]){const{left:a,right:s}=Tx(r,t);e(a,t),e(s,t),t.isHorizontal?a.right2left():a.bottom2top(),s.translate(a.x-s.x,a.y-s.y),r.x=a.x,r.y=s.y;const o=r.getBoundingBox();t.isHorizontal?o.top<0&&r.translate(0,-o.top):o.left<0&&r.translate(-o.left,0)}let i=t.fixedRoot;return i===void 0&&(i=!0),i&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),function(a,s){if(s.radial){const[o,A]=s.isHorizontal?["x","y"]:["y","x"],l={x:1/0,y:1/0},c={x:-1/0,y:-1/0};let u=0;a.DFTraverse(f=>{u++;const{x:g,y:v}=f;l.x=Math.min(l.x,g),l.y=Math.min(l.y,v),c.x=Math.max(c.x,g),c.y=Math.max(c.y,v)});const h=c[A]-l[A];if(h===0)return;const d=2*Math.PI/u;a.DFTraverse(f=>{const g=f[A],v=l[A],m=f[o],w=a[o],C=(g-v)/h*(2*Math.PI-d)+d,F=m-w;f.x=Math.cos(C)*F,f.y=Math.sin(C)*F})}}(r,t),r}class MQ extends Ug{execute(){return By(this.rootNode,this.options,xQ)}}const TQ={};function Fx(r,t){const e=Ml({},TQ,t);return new MQ(r,e).execute()}class FQ{constructor(t=0,e=[]){this.x=0,this.y=0,this.leftChild=null,this.rightChild=null,this.isLeaf=!1,this.height=t,this.children=e}}const OQ={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Ox(r,t,e){e?(t.x=r.x,t.y=r.y):(t.x=r.y,t.y=r.x),r.children.forEach((n,i)=>{Ox(n,t.children[i],e)})}function IQ(r,t={}){const e=Ml({},OQ,t);let n=0,i=null;const a=function s(o){o.width=0,o.depth&&o.depth>n&&(n=o.depth);const A=o.children,l=A.length,c=new FQ(0,[]);return A.forEach((u,h)=>{const d=s(u);c.children.push(d),h===0&&(c.leftChild=d),h===l-1&&(c.rightChild=d)}),c.originNode=o,c.isLeaf=o.isLeaf(),c}(r);return function s(o){if(o.isLeaf||o.children.length===0)o.drawingDepth=n;else{const A=o.children.map(c=>s(c)),l=Math.min(...A);o.drawingDepth=l-1}return o.drawingDepth}(a),function s(o){o.x=o.drawingDepth*e.rankSep,o.isLeaf?(o.y=0,i&&(o.y=i.y+i.height+e.nodeSep,o.originNode.parent!==i.originNode.parent&&(o.y+=e.subTreeSep)),i=o):(o.children.forEach(A=>{s(A)}),o.y=(o.leftChild.y+o.rightChild.y)/2)}(a),Ox(a,r,e.isHorizontal),r}class LQ extends Ug{execute(){return this.rootNode.width=0,By(this.rootNode,this.options,IQ)}}const NQ={};function Ix(r,t){const e=Ml({},NQ,t);return new LQ(r,e).execute()}function Pg(r,t,e,n){let i=null;r.eachNode(a=>{(function(s,o,A,l,c){const u=(typeof A=="function"?A(s):A)*s.depth;if(!l)try{if(s.parent&&s.id===s.parent.children[0].id)return s.x+=u,void(s.y=o?o.y:0)}catch(h){}if(s.x+=u,o){if(s.y=o.y+bx(o,s,c),o.parent&&s.parent&&s.parent.id!==o.parent.id){const h=o.parent,d=h.y+bx(h,s,c);s.y=d>s.y?d:s.y}}else s.y=0})(a,i,t,e,n),i=a})}const Fh=["LR","RL","H"],kQ=Fh[0];class QQ extends Ug{execute(){const t=this.options,e=this.rootNode;t.isHorizontal=!0;const{indent:n=20,dropCap:i=!0,direction:a=kQ,align:s}=t;if(a&&Fh.indexOf(a)===-1)throw new TypeError(`Invalid direction: ${a}`);if(a===Fh[0])Pg(e,n,i,s);else if(a===Fh[1])Pg(e,n,i,s),e.right2left();else if(a===Fh[2]){const{left:o,right:A}=Tx(e,t);Pg(o,n,i,s),o.right2left(),Pg(A,n,i,s);const l=o.getBoundingBox();A.translate(l.width,0),e.x=A.x-e.width/2}return e}}const UQ={};function Lx(r,t){const e=Ml({},UQ,t);return new QQ(r,e).execute()}function Nx(r,t){let e=0;return r.children.length?r.children.forEach(n=>{e+=Nx(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function kx(r){const t=r.children,e=t.length;if(e){t.forEach(o=>{kx(o)});const n=t[0],i=t[e-1],a=i.y-n.y+i.height;let s=0;if(t.forEach(o=>{s+=o.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(t.length!==1||r.height>s){const o=r.y+(r.height-a)/2-n.y;t.forEach(A=>{A.translate(0,o)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}const PQ={getSubTreeSep:()=>0};function DQ(r,t={}){return t=Ml({},PQ,t),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(e=>{e.x=e.parent.x+e.parent.width}),r.parent=void 0,Nx(r,t),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(e=>{const n=e.children,i=n.length;if(i){const a=n[0];if(a.startY=e.startY+e._subTreeSep,i===1)a.y=e.y+e.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(let s=1;s{if(r!=="next"&&r!=="prev")return t},Ux=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};class GQ{constructor(){const t={};t.prev=t,t.next=t.prev,this.shortcut=t}dequeue(){const t=this.shortcut,e=t.prev;if(e&&e!==t)return Ux(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&Ux(t),t.next=e.next,e.next.prev=t,e.next=t,t.prev=e}toString(){const t=[],e=this.shortcut;let n=e.prev;for(;n!==e;)t.push(JSON.stringify(n,HQ)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}}class KQ extends GQ{}const zQ=()=>1,VQ=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=ZQ(r,t||zQ);return(e=WQ(n.graph,n.buckets,n.zeroIdx).map(a=>r.getRelatedEdges(a.v,"out").filter(({target:s})=>s===a.w)))===null||e===void 0?void 0:e.flat()},WQ=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)by(r,t,e,s);for(;s=i.dequeue();)by(r,t,e,s);if(r.getAllNodes().length){for(let o=t.length-2;o>0;--o)if(s=t[o].dequeue(),s){n=n.concat(by(r,t,e,s,!0));break}}}return n},by=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(A=>{const l=A.data.weight,c=r.getNode(A.source);i&&o.push({v:A.source,w:A.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=l,xy(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(A=>{const l=A.data.weight,c=A.target,u=r.getNode(c);u.data.in===void 0&&(u.data.in=0),u.data.in-=l,xy(t,e,Object.assign({v:u.id},u.data))}),r.removeNode(n.v)),i?o:void 0},ZQ=(r,t)=>{const e=new Hr;let n=0,i=0;r.getAllNodes().forEach(A=>{e.addNode({id:A.id,data:{v:A.id,in:0,out:0}})}),r.getAllEdges().forEach(A=>{const l=e.getRelatedEdges(A.source,"out").find(u=>u.target===A.target),c=(t==null?void 0:t(A))||1;l?e.updateEdgeData(l==null?void 0:l.id,Object.assign(Object.assign({},l.data),{weight:l.data.weight+c})):e.addEdge({id:A.id,source:A.source,target:A.target,data:{weight:c}}),i=Math.max(i,e.getNode(A.source).data.out+=c),n=Math.max(n,e.getNode(A.target).data.in+=c)});const a=[],s=i+n+3;for(let A=0;A{xy(a,o,Object.assign({v:A.id},e.getNode(A.id).data))}),{buckets:a,zeroIdx:o,graph:e}},xy=(r,t,e)=>{e.out?e.in?r[e.out-e.in+t].enqueue(e):r[r.length-1].enqueue(e):r[0].enqueue(e)},jQ=(r,t)=>{const n=t==="greedy"?VQ(r,(i=>a=>a.data.weight||1)(r)):YQ(r);n==null||n.forEach(i=>{const a=i.data;r.removeEdge(i.id),a.forwardName=i.data.name,a.reversed=!0,r.addEdge({id:i.id,source:i.target,target:i.source,data:Object.assign({},a)})})},YQ=r=>{const t=[],e={},n={},i=a=>{n[a]||(n[a]=!0,e[a]=!0,r.getRelatedEdges(a,"out").forEach(s=>{e[s.target]?t.push(s):i(s.target)}),delete e[a])};return r.getAllNodes().forEach(a=>i(a.id)),t},XQ=r=>{r.getAllEdges().forEach(t=>{const e=t.data;if(e.reversed){r.removeEdge(t.id);const n=e.forwardName;delete e.reversed,delete e.forwardName,r.addEdge({id:t.id,source:t.target,target:t.source,data:Object.assign(Object.assign({},e),{forwardName:n})})}})},JQ=(r,t)=>Number(r)-Number(t),_c=(r,t,e,n)=>{let i;do i=`${n}${Math.random()}`;while(r.hasNode(i));return e.dummy=t,r.addNode({id:i,data:e}),i},qQ=r=>{const t=new Hr;return r.getAllNodes().forEach(e=>{t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{const n=t.getRelatedEdges(e.source,"out").find(i=>i.target===e.target);n?t.updateEdgeData(n==null?void 0:n.id,Object.assign(Object.assign({},n.data),{weight:n.data.weight+e.data.weight||0,minlen:Math.max(n.data.minlen,e.data.minlen||1)})):t.addEdge({id:e.id,source:e.source,target:e.target,data:{weight:e.data.weight||0,minlen:e.data.minlen||1}})}),t},Px=r=>{const t=new Hr;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},Dx=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),eG=r=>{const t={};return r.getAllNodes().forEach(e=>{const n={};r.getRelatedEdges(e.id,"out").forEach(i=>{n[i.target]=(n[i.target]||0)+(i.data.weight||0)}),t[e.id]=n}),t},nG=r=>{const t=r.getAllNodes(),e=t.map(n=>{const i={};return r.getRelatedEdges(n.id,"in").forEach(a=>{i[a.source]=(i[a.source]||0)+a.data.weight}),i});return Dx(t.map(n=>n.id),e)},Rx=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let A,l;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),A=o*i/a,l=o):(i<0&&(s=-s),A=s,l=s*a/i),{x:e+A,y:n+l}},Oh=r=>{const t=[],e=Hx(r)+1;for(let n=0;n{const i=n.data.rank;i!==void 0&&t[i]&&t[i].push(n.id)});for(let n=0;nJQ(r.getNode(i).data.order,r.getNode(a).data.order));return t},$Q=r=>{const t=r.getAllNodes().filter(n=>n.data.rank!==void 0).map(n=>n.data.rank),e=Math.min(...t);r.getAllNodes().forEach(n=>{n.data.hasOwnProperty("rank")&&e!==1/0&&(n.data.rank-=e)})},tU=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const A=(o.data.rank||0)-i;a[A]||(a[A]=[]),a[A].push(o.id)});let s=0;for(let o=0;o{const c=r.getNode(l);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},_x=(r,t,e,n)=>{const i={width:0,height:0};return ye(e)&&ye(n)&&(i.rank=e,i.order=n),_c(r,"border",i,t)},Hx=r=>{let t;return r.getAllNodes().forEach(e=>{const n=e.data.rank;n!==void 0&&(t===void 0||n>t)&&(t=n)}),t||(t=0),t},eU=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},Cy=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),Gx=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>Gx(r,s,e,n,i,a)),e&&a.push(t.id))},Kx=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=A=>n?r.getSuccessors(A):r.getNeighbors(A),s=[],o=[];return i.forEach(A=>{if(r.hasNode(A.id))Gx(r,A,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${A}`)}),s},nU=r=>{const t=e=>{const n=r.getChildren(e),i=r.getNode(e);if(n!=null&&n.length&&n.forEach(a=>t(a.id)),i.data.hasOwnProperty("minRank")){i.data.borderLeft=[],i.data.borderRight=[];for(let a=i.data.minRank,s=i.data.maxRank+1;at(e.id))},zx=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],A=_c(r,"border",s,e);i.data[t][a]=A,r.setParent(A,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:A,data:{weight:1}})},rU=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&Vx(r)},iU=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&aU(r),(e==="lr"||e==="rl")&&(sU(r),Vx(r))},Vx=r=>{r.getAllNodes().forEach(t=>{Wx(t)}),r.getAllEdges().forEach(t=>{Wx(t)})},Wx=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},aU=r=>{r.getAllNodes().forEach(t=>{Sy(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Sy(n)),t.data.hasOwnProperty("y")&&Sy(t.data)})},Sy=r=>{r!=null&&r.y&&(r.y=-r.y)},sU=r=>{r.getAllNodes().forEach(t=>{My(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>My(n)),t.data.hasOwnProperty("x")&&My(t.data)})},My=r=>{const t=r.x;r.x=r.y,r.y=t},oU=r=>{const t=_c(r,"root",{},"_root"),e=AU(r);let n=Math.max(...Object.values(e));Math.abs(n)===1/0&&(n=1);const i=n-1,a=2*i+1;r.getAllEdges().forEach(o=>{o.data.minlen*=a});const s=lU(r)+1;return r.getRoots().forEach(o=>{Zx(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},Zx=(r,t,e,n,i,a,s)=>{const o=r.getChildren(s);if(!(o!=null&&o.length)){s!==t&&r.addEdge({id:`e${Math.random()}`,source:t,target:s,data:{weight:0,minlen:e}});return}const A=_x(r,"_bt"),l=_x(r,"_bb"),c=r.getNode(s);r.setParent(A,s),c.data.borderTop=A,r.setParent(l,s),c.data.borderBottom=l,o==null||o.forEach(u=>{Zx(r,t,e,n,i,a,u.id);const h=u.data.borderTop?u.data.borderTop:u.id,d=u.data.borderBottom?u.data.borderBottom:u.id,f=u.data.borderTop?n:2*n,g=h!==d?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:A,target:h,data:{minlen:g,weight:f,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:d,target:l,data:{minlen:g,weight:f,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:A,data:{weight:0,minlen:i+a[s]}})},AU=r=>{const t={},e=(n,i)=>{const a=r.getChildren(n);a==null||a.forEach(s=>e(s.id,i+1)),t[n]=i};return r.getRoots().forEach(n=>e(n.id,1)),t},lU=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},cU=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},uU="edge",jx="edge-label",hU=(r,t)=>{r.getAllEdges().forEach(e=>dU(r,e,t))},dU=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let A,l,c;for(c=0,++i;i{t.forEach(e=>{let n=r.getNode(e);const{data:i}=n,a=i.originalEdge;let s;a&&r.addEdge(a);let o=e;for(;n.data.dummy;)s=r.getSuccessors(o)[0],r.removeNode(o),a.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===jx&&(a.data.x=n.data.x,a.data.y=n.data.y,a.data.width=n.data.width,a.data.height=n.data.height),o=s.id,n=r.getNode(o)})},gU=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,A;for(;s;){if(o=r.getParent(s.id),o?(A=n[o.id],n[o.id]=s.id):(A=i,i=s.id),A&&A!==s.id){t.hasNode(A)||t.addNode({id:A,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${A}-${s.id}`)||t.addEdge({id:`e${A}-${s.id}`,source:A,target:s.id,data:{}});return}s=o}})},vU=(r,t,e)=>{const n=pU(r),i=new Hr({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const A=o.source===a.id?o.target:o.source;i.hasNode(A)||i.addNode(Object.assign({},r.getNode(A)));const l=i.getRelatedEdges(A,"out").find(({target:u})=>u===a.id),c=l!==void 0?l.data.weight:0;l?i.updateEdgeData(l.id,Object.assign(Object.assign({},l.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:A,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},pU=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},mU=(r,t,e)=>{const n=Dx(e,e.map((c,u)=>u)),a=t.map(c=>{const u=r.getRelatedEdges(c,"out").map(h=>({pos:n[h.target]||0,weight:h.data.weight}));return u==null?void 0:u.sort((h,d)=>h.pos-d.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s{if(c){let u=c.pos+s;A[u]+=c.weight;let h=0;for(;u>0;)u%2&&(h+=A[u+1]),u=u-1>>1,A[u]+=c.weight;l+=c.weight*h}}),l},Yx=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=mU(r,t[n-1],t[n]);return e},Xx=r=>{const t={},e=r.getAllNodes(),n=e.map(l=>{var c;return(c=l.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let l=0;lr.getNode(l.id).data.rank-r.getNode(c.id).data.rank),A=s.filter(l=>r.getNode(l.id).data.fixorder!==void 0).sort((l,c)=>r.getNode(l.id).data.fixorder-r.getNode(c.id).data.fixorder);return A==null||A.forEach(l=>{isNaN(r.getNode(l.id).data.rank)||a[r.getNode(l.id).data.rank].push(l.id),t[l.id]=!0}),s==null||s.forEach(l=>r.dfsTree(l.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},yU=(r,t)=>t.map(e=>{const n=r.getRelatedEdges(e,"in");if(!(n!=null&&n.length))return{v:e};const i={sum:0,weight:0};return n==null||n.forEach(a=>{const s=r.getNode(a.source);i.sum+=a.data.weight*s.data.order,i.weight+=a.data.weight}),{v:e,barycenter:i.sum/i.weight,weight:i.weight}}),wU=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,A)=>{a[o.v]={i:A,indegree:0,in:[],out:[],vs:[o.v]};const l=a[o.v];o.barycenter!==void 0&&(l.barycenter=o.barycenter,l.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const A=a[o.source],l=a[o.target];A!==void 0&&l!==void 0&&(l.indegree++,A.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return EU(s)},EU=r=>{var t,e;const n=[],i=A=>l=>{l.merged||(l.barycenter===void 0||A.barycenter===void 0||l.barycenter>=A.barycenter)&&BU(A,l)},a=A=>l=>{l.in.push(A),--l.indegree===0&&r.push(l)};for(;r!=null&&r.length;){const A=r.pop();n.push(A),(t=A.in.reverse())===null||t===void 0||t.forEach(l=>i(A)(l)),(e=A.out)===null||e===void 0||e.forEach(l=>a(A)(l))}const s=n.filter(A=>!A.merged),o=["vs","i","barycenter","weight"];return s.map(A=>{const l={};return o==null||o.forEach(c=>{A[c]!==void 0&&(l[c]=A[c])}),l})},BU=(r,t)=>{var e;let n=0,i=0;r.weight&&(n+=r.barycenter*r.weight,i+=r.weight),t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),r.vs=(e=t.vs)===null||e===void 0?void 0:e.concat(r.vs),r.barycenter=n/i,r.weight=i,r.i=Math.min(t.i,r.i),t.merged=!0};var bU=wU;const xU=(r,t,e,n)=>{const i=eU(r,h=>{const d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((h,d)=>-h.i- -d.i),o=[];let A=0,l=0,c=0;a==null||a.sort(CU(!!t,!!e)),c=Jx(o,s,c),a==null||a.forEach(h=>{var d;c+=(d=h.vs)===null||d===void 0?void 0:d.length,o.push(h.vs),A+=h.barycenter*h.weight,l+=h.weight,c=Jx(o,s,c)});const u={vs:o.flat()};return l&&(u.barycenter=A/l,u.weight=l),u},Jx=(r,t,e)=>{let n=e,i;for(;t.length&&(i=t[t.length-1]).i<=n;)t.pop(),r==null||r.push(i.vs),n++;return n},CU=(r,t)=>(e,n)=>{if(e.fixorder!==void 0&&n.fixorder!==void 0)return e.fixorder-n.fixorder;if(e.barycentern.barycenter)return 1;if(t&&e.order!==void 0&&n.order!==void 0){if(e.ordern.order)return 1}return r?n.i-e.i:e.i-n.i},qx=(r,t,e,n,i,a)=>{var s,o,A,l;let c=r.getChildren(t).map(w=>w.id);const u=r.getNode(t),h=u?u.data.borderLeft:void 0,d=u?u.data.borderRight:void 0,f={};h&&(c=c==null?void 0:c.filter(w=>w!==h&&w!==d));const g=yU(r,c||[]);g==null||g.forEach(w=>{var C;if(!((C=r.getChildren(w.v))===null||C===void 0)&&C.length){const F=qx(r,w.v,e,n,a);f[w.v]=F,F.hasOwnProperty("barycenter")&&MU(w,F)}});const v=bU(g,e);SU(v,f),(s=v.filter(w=>w.vs.length>0))===null||s===void 0||s.forEach(w=>{const C=r.getNode(w.vs[0]);C&&(w.fixorder=C.data.fixorder,w.order=C.data.order)});const m=xU(v,n,i,a);if(h&&(m.vs=[h,m.vs,d].flat(),!((o=r.getPredecessors(h))===null||o===void 0)&&o.length)){const w=r.getNode(((A=r.getPredecessors(h))===null||A===void 0?void 0:A[0].id)||""),C=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||"");m.hasOwnProperty("barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+w.data.order+C.data.order)/(m.weight+2),m.weight+=2}return m},SU=(r,t)=>{r==null||r.forEach(e=>{var n;const i=(n=e.vs)===null||n===void 0?void 0:n.map(a=>t[a]?t[a].vs:a);e.vs=i.flat()})},MU=(r,t)=>{r.barycenter!==void 0?(r.barycenter=(r.barycenter*r.weight+t.barycenter*t.weight)/(r.weight+t.weight),r.weight+=t.weight):(r.barycenter=t.barycenter,r.weight=t.weight)},TU=(r,t)=>{const e=Hx(r),n=[],i=[];for(let c=1;c-1;c--)i.push(c);const a=$x(r,n,"in"),s=$x(r,i,"out");let o=Xx(r);Ty(r,o);let A=Number.POSITIVE_INFINITY,l;for(let c=0,u=0;u<4;++c,++u){tC(c%2?a:s,c%4>=2,!1,t),o=Oh(r);const h=Yx(r,o);h=2,!0,t),o=Oh(r);const h=Yx(r,o);ht.map(n=>vU(r,n,e)),tC=(r,t,e,n)=>{const i=new Hr;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,A=qx(a,o,i,t,e,n);for(let l=0;l<((s=A.vs)===null||s===void 0?void 0:s.length);l++){const c=a.getNode(A.vs[l]);c&&(c.data.order=l)}gU(a,i,A.vs)})},Ty=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},FU=(r,t)=>{const n=r.getAllNodes().filter(s=>{var o;return!(!((o=r.getChildren(s.id))===null||o===void 0)&&o.length)}).map(s=>s.data.rank),i=Math.max(...n),a=[];for(let s=0;s{const o=r.getNode(s);!o||o.data.dummy||isNaN(o.data.rank)||(o.data.fixorder=a[o.data.rank].length,a[o.data.rank].push(s))})},OU=r=>{const t={};let e=0;const n=i=>{const a=e;r.getChildren(i).forEach(s=>n(s.id)),t[i]={low:a,lim:e++}};return r.getRoots().forEach(i=>n(i.id)),t},IU=(r,t,e,n)=>{var i,a;const s=[],o=[],A=Math.min(t[e].low,t[n].low),l=Math.max(t[e].lim,t[n].lim);let c,u;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>A||l>t[c].lim));for(u=c,c=n;c&&c!==u;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:u,path:s.concat(o.reverse())}},LU=(r,t)=>{const e=OU(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const A=o.data.originalEdge;if(!A)return;const l=IU(r,e,A.source,A.target),c=l.path,u=l.lca;let h=0,d=c[h],f=!0;for(;s!==A.target;){if(o=r.getNode(s),f){for(;d!==u&&((i=r.getNode(d))===null||i===void 0?void 0:i.data.maxRank){const e={},n=(i,a)=>{let s=0,o=0;const A=i.length,l=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,u)=>{var h;const d=NU(r,c),f=d?r.getNode(d.id).data.order:A;(d||c===l)&&((h=a.slice(o,u+1))===null||h===void 0||h.forEach(g=>{var v;(v=r.getPredecessors(g))===null||v===void 0||v.forEach(m=>{var w;const C=r.getNode(m.id),F=C.data.order;(F{const e={};function n(o,A,l,c,u){var h,d;let f;for(let g=A;g{const m=r.getNode(v.id);m.data.dummy&&(m.data.orderu)&&rC(e,v.id,f)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,A){const l=i(o);A.get(l)||(n(...o),A.set(l,!0))}const s=(o,A)=>{let l=-1,c,u=0;const h=new Map;return A==null||A.forEach((d,f)=>{var g;if(((g=r.getNode(d))===null||g===void 0?void 0:g.data.dummy)==="border"){const v=r.getPredecessors(d)||[];v.length&&(c=r.getNode(v[0].id).data.order,a([A,u,f,l,c],h),u=f,l=c)}a([A,u,A.length,c,o.length],h)}),A};return t!=null&&t.length&&t.reduce(s),e},NU=(r,t)=>{var e,n;if(!((e=r.getNode(t))===null||e===void 0)&&e.data.dummy)return(n=r.getPredecessors(t))===null||n===void 0?void 0:n.find(i=>r.getNode(i.id).data.dummy)},rC=(r,t,e)=>{let n=t,i=e;if(n>i){const s=n;n=i,i=s}let a=r[n];a||(r[n]=a={}),a[i]=!0},kU=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},iC=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((A,l)=>{i[A]=A,a[A]=A,s[A]=l})}),t==null||t.forEach(o=>{let A=-1;o==null||o.forEach(l=>{let c=n(l).map(u=>u.id);if(c.length){c=c.sort((h,d)=>s[h]-s[d]);const u=(c.length-1)/2;for(let h=Math.floor(u),d=Math.ceil(u);h<=d;++h){const f=c[h];a[l]===l&&A{var o;const A={},l=QU(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",u=(f,g)=>{let v=l.getAllNodes(),m=v.pop();const w={};for(;m;)w[m.id]?f(m.id):(w[m.id]=!0,v.push(m),v=v.concat(g(m.id))),m=v.pop()},h=f=>{A[f]=(l.getRelatedEdges(f,"in")||[]).reduce((g,v)=>Math.max(g,(A[v.source]||0)+v.data.weight),0)},d=f=>{const g=(l.getRelatedEdges(f,"out")||[]).reduce((m,w)=>Math.min(m,(A[w.target]||0)-w.data.weight),Number.POSITIVE_INFINITY),v=r.getNode(f);g!==Number.POSITIVE_INFINITY&&v.data.borderType!==c&&(A[f]=Math.max(A[f],g))};return u(h,l.getPredecessors.bind(l)),u(d,l.getSuccessors.bind(l)),(o=Object.values(n))===null||o===void 0||o.forEach(f=>{A[f]=A[e[f]]}),A},QU=(r,t,e,n,i,a)=>{const s=new Hr,o=UU(n,i,a);return t==null||t.forEach(A=>{let l;A==null||A.forEach(c=>{const u=e[c];if(s.hasNode(u)||s.addNode({id:u,data:{}}),l){const h=e[l],d=s.getRelatedEdges(h,"out").find(f=>f.target===u);d?s.updateEdgeData(d.id,Object.assign(Object.assign({},d.data),{weight:Math.max(o(r,c,l),d.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:h,target:u,data:{weight:Math.max(o(r,c,l),0)}})}l=c})}),s},sC=(r,t)=>Cy(Object.values(t),e=>{var n;let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return(n=Object.keys(e))===null||n===void 0||n.forEach(s=>{const o=e[s],A=PU(r,s)/2;i=Math.max(o+A,i),a=Math.min(o-A,a)}),i-a});function oC(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,A=r[o];let l;if(A===t)return;const c=Object.values(A);l=s==="l"?n-Math.min(...c):i-Math.max(...c),l&&(r[o]={},Object.keys(A).forEach(u=>{r[o][u]=A[u]+l}))})})}const AC=(r,t)=>{const e={};return Object.keys(r.ul).forEach(n=>{if(t)e[n]=r[t.toLowerCase()][n];else{const i=Object.values(r).map(a=>a[n]);e[n]=(i[0]+i[1])/2}}),e},rG=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=buildLayerMatrix(r),s=Object.assign(eC(r,a),nC(r,a)),o={};let A;["u","d"].forEach(c=>{A=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(u=>{u==="r"&&(A=A.map(g=>Object.values(g).reverse()));const h=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),d=iC(r,A,s,h),f=aC(r,A,d.root,d.align,n,i,u==="r");u==="r"&&Object.keys(f).forEach(g=>{f[g]=-f[g]}),o[c+u]=f})});const l=sC(r,o);return oC(o,l),AC(o,e)},UU=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let A=0,l=0;if(A+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":l=-s.data.width/2;break;case"r":l=s.data.width/2;break}if(l&&(A+=e?l:-l),l=0,A+=(s.data.dummy?t:r)/2,A+=(o.data.dummy?t:r)/2,A+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":l=o.data.width/2;break;case"r":l=-o.data.width/2;break}return l&&(A+=e?l:-l),l=0,A},PU=(r,t)=>r.getNode(t).data.width||0,DU=(r,t)=>{const{ranksep:e=0}=t||{},n=Oh(r);let i=0;n==null||n.forEach(a=>{const s=a.map(A=>r.getNode(A).data.height),o=Math.max(...s,0);a==null||a.forEach(A=>{r.getNode(A).data.y=i+o/2}),i+=o+e})},RU=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=Oh(r),s=Object.assign(eC(r,a),nC(r,a)),o={};let A=[];["u","d"].forEach(c=>{A=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(u=>{u==="r"&&(A=A.map(g=>Object.values(g).reverse()));const h=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),d=iC(r,A,s,h),f=aC(r,A,d.root,d.align,n,i,u==="r");u==="r"&&Object.keys(f).forEach(g=>f[g]=-f[g]),o[c+u]=f})});const l=sC(r,o);return l&&oC(o,l),AC(o,e)},_U=(r,t)=>{var e;const n=Px(r);DU(n,t);const i=RU(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},lC=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const A=e(o.target),l=o.data.minlen,c=A-l;c&&(s===void 0||cr.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},HU=r=>{const t={};let e;const n=s=>{var o;const A=r.getNode(s);if(!A)return 0;if(t[s])return A.data.rank;t[s]=!0;let l;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const u=n(c.target),h=c.data.minlen,d=u-h;d&&(l===void 0||dr.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var A;const l=r.getNode(s),c=isNaN(l.data.layer)?o:l.data.layer;(l.data.rank===void 0||l.data.rank{a(u.target,c+u.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},MA=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,GU=r=>{const t=new Hr({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;KU(t,r){const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!MA(t,i)&&(r.addNode({id:s,data:{}}),r.addEdge({id:i.id,source:n,target:s,data:{}}),e(s))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},zU=r=>{const t=new Hr({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;VU(t,r){const e=n=>{var i;(i=t.getRelatedEdges(n,"both"))===null||i===void 0||i.forEach(a=>{const s=a.source,o=n===s?a.target:s;!r.hasNode(o)&&(t.getNode(o).data.layer!==void 0||!MA(t,a))&&(r.addNode({id:o,data:{}}),r.addEdge({id:a.id,source:n,target:o,data:{}}),e(o))})};return r.getAllNodes().forEach(n=>e(n.id)),r.getAllNodes().length},cC=(r,t)=>Cy(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?MA(t,e):1/0),uC=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},WU=r=>{const t=qQ(r);lC(t);const e=GU(t);dC(e),hC(e,t);let n,i;for(;n=YU(e);)i=XU(e,t,n),JU(e,t,n,i)},hC=(r,t)=>{let e=Kx(r,r.getAllNodes(),"post",!1);e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{ZU(r,t,n)})},ZU=(r,t,e)=>{const i=r.getNode(e).data.parent,a=r.getRelatedEdges(e,"both").find(s=>s.target===i||s.source===i);a.data.cutvalue=jU(r,t,e)},jU=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(A=>A.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(A=>A.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(A=>{const l=A.source===e,c=l?A.target:A.source;if(c!==i){const u=l===a,h=A.data.weight;if(o+=u?h:-h,$U(r,e,c)){const d=r.getRelatedEdges(e,"both").find(f=>f.source===c||f.target===c).data.cutvalue;o+=u?-d:d}}}),o},dC=(r,t=r.getAllNodes()[0].id)=>{fC(r,{},1,t)},fC=(r,t,e,n,i)=>{var a;const s=e;let o=e;const A=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(l=>{t[l.id]||(o=fC(r,t,o,l.id,n))}),A.data.low=s,A.data.lim=o++,i?A.data.parent=i:delete A.data.parent,o},YU=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),XU=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,A=!1;a.data.lim>s.data.lim&&(o=s,A=!0);const l=t.getAllEdges().filter(c=>A===gC(r.getNode(c.source),o)&&A!==gC(r.getNode(c.target),o));return Cy(l,c=>MA(t,c))},JU=(r,t,e,n)=>{const i=r.getRelatedEdges(e.source,"both").find(a=>a.source===e.target||a.target===e.target);i&&r.removeEdge(i.id),r.addEdge({id:`e${Math.random()}`,source:n.source,target:n.target,data:{}}),dC(r),hC(r,t),qU(r,t)},qU=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=Kx(r,e,"pre",!1);n=n.slice(1),n.forEach(i=>{const a=r.getNode(i).data.parent;let s=t.getRelatedEdges(i,"out").find(A=>A.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(A=>A.target===i),o=!0),t.getNode(i).data.rank=(t.hasNode(a)&&t.getNode(a).data.rank||0)+(o?s==null?void 0:s.data.minlen:-(s==null?void 0:s.data.minlen))})},$U=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),gC=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,t3=(r,t)=>{switch(t){case"network-simplex":n3(r);break;case"tight-tree":vC(r);break;case"longest-path":e3(r);break;default:vC(r)}},e3=lC,vC=r=>{HU(r),zU(r)},n3=r=>{WU(r)},r3=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&a3(r,i);const o=u3(r);e&&(t.ranksep=h3(o,{rankdir:a,ranksep:s}));let A;try{A=i3(o,t)}catch(l){if(l.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure: `,l);return}throw l}return s3(r,o),A},i3=(r,t)=>{const{acyclicer:e,ranker:n,rankdir:i="tb",nodeOrder:a,keepNodeOrder:s,align:o,nodesep:A=50,edgesep:l=20,ranksep:c=50}=t;E3(r),jQ(r,e);const{nestingRoot:u,nodeRankFactor:h}=oU(r);t3(Px(r),n),d3(r),tU(r,h),cU(r,u),$Q(r),f3(r),g3(r);const d=[];hU(r,d),LU(r,d),nU(r),s&&FU(r,a),TU(r,s),B3(r),rU(r,i),_U(r,{align:o,nodesep:A,edgesep:l,ranksep:c}),b3(r),w3(r),fU(r,d),m3(r),iU(r,i);const{width:f,height:g}=v3(r);return p3(r),y3(r),XQ(r),{width:f,height:g}},a3=(r,t)=>{r.getAllNodes().forEach(e=>{const n=r.getNode(e.id);if(t.hasNode(e.id)){const i=t.getNode(e.id);n.data.fixorder=i.data._order,delete i.data._order}else delete n.data.fixorder})},s3=(r,t)=>{r.getAllNodes().forEach(e=>{var n;const i=r.getNode(e.id);if(i){const a=t.getNode(e.id);i.data.x=a.data.x,i.data.y=a.data.y,i.data._order=a.data.order,i.data._rank=a.data.rank,!((n=t.getChildren(e.id))===null||n===void 0)&&n.length&&(i.data.width=a.data.width,i.data.height=a.data.height)}}),r.getAllEdges().forEach(e=>{const n=r.getEdge(e.id),i=t.getEdge(e.id);n.data.points=i?i.data.points:[],i&&i.data.hasOwnProperty("x")&&(n.data.x=i.data.x,n.data.y=i.data.y)})},o3=["width","height","layer","fixorder"],A3={width:0,height:0},l3=["minlen","weight","width","height","labeloffset"],c3={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Fy=["labelpos"],u3=r=>{const t=new Hr({tree:[]});return r.getAllNodes().forEach(e=>{const n=mC(r.getNode(e.id).data),i=Object.assign(Object.assign({},A3),n),a=pC(i,o3);t.hasNode(e.id)||t.addNode({id:e.id,data:Object.assign({},a)});const s=r.hasTreeStructure("combo")?r.getParent(e.id,"combo"):r.getParent(e.id);Pe(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=mC(r.getEdge(e.id).data),i={};Fy==null||Fy.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},c3,pC(n,l3),i)})}),t},h3=(r,t)=>{const{ranksep:e=0,rankdir:n}=t;return r.getAllNodes().forEach(i=>{isNaN(i.data.layer)||i.data.layer||(i.data.layer=0)}),r.getAllEdges().forEach(i=>{var a;i.data.minlen*=2,((a=i.data.labelpos)===null||a===void 0?void 0:a.toLowerCase())!=="c"&&(n==="TB"||n==="BT"?i.data.width+=i.data.labeloffset:i.data.height+=i.data.labeloffset)}),e/2},d3=r=>{r.getAllEdges().forEach(t=>{if(t.data.width&&t.data.height){const e=r.getNode(t.source),n=r.getNode(t.target),i={e:t,rank:(n.data.rank-e.data.rank)/2+e.data.rank};_c(r,"edge-proxy",i,"_ep")}})},f3=r=>{let t=0;return r.getAllNodes().forEach(e=>{var n,i;e.data.borderTop&&(e.data.minRank=(n=r.getNode(e.data.borderTop))===null||n===void 0?void 0:n.data.rank,e.data.maxRank=(i=r.getNode(e.data.borderBottom))===null||i===void 0?void 0:i.data.rank,t=Math.max(t,e.data.maxRank||-1/0))}),t},g3=r=>{r.getAllNodes().forEach(t=>{t.data.dummy==="edge-proxy"&&(r.getEdge(t.data.e.id).data.labelRank=t.data.rank,r.removeNode(t.id))})},v3=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}=t||{},A=l=>{if(!l.data)return;const c=l.data.x,u=l.data.y,h=l.data.width,d=l.data.height;!isNaN(c)&&!isNaN(h)&&(e===void 0&&(e=c-h/2),e=Math.min(e,c-h/2),n=Math.max(n,c+h/2)),!isNaN(u)&&!isNaN(d)&&(i===void 0&&(i=u-d/2),i=Math.min(i,u-d/2),a=Math.max(a,u+d/2))};return r.getAllNodes().forEach(l=>{A(l)}),r.getAllEdges().forEach(l=>{l!=null&&l.data.hasOwnProperty("x")&&A(l)}),e-=s,i-=o,r.getAllNodes().forEach(l=>{l.data.x-=e,l.data.y-=i}),r.getAllEdges().forEach(l=>{var c;(c=l.data.points)===null||c===void 0||c.forEach(u=>{u.x-=e,u.y-=i}),l.data.hasOwnProperty("x")&&(l.data.x-=e),l.data.hasOwnProperty("y")&&(l.data.y-=i)}),{width:n-e+s,height:a-i+o}},p3=r=>{r.getAllEdges().forEach(t=>{const e=r.getNode(t.source),n=r.getNode(t.target);let i,a;t.data.points?(i=t.data.points[0],a=t.data.points[t.data.points.length-1]):(t.data.points=[],i={x:n.data.x,y:n.data.y},a={x:e.data.x,y:e.data.y}),t.data.points.unshift(Rx(e.data,i)),t.data.points.push(Rx(n.data,a))})},m3=r=>{r.getAllEdges().forEach(t=>{if(t.data.hasOwnProperty("x"))switch((t.data.labelpos==="l"||t.data.labelpos==="r")&&(t.data.width-=t.data.labeloffset),t.data.labelpos){case"l":t.data.x-=t.data.width/2+t.data.labeloffset;break;case"r":t.data.x+=t.data.width/2+t.data.labeloffset;break}})},y3=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},w3=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),A=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),l=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((l==null?void 0:l.data.x)-(A==null?void 0:A.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((A==null?void 0:A.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},E3=r=>{r.getAllEdges().forEach(t=>{if(t.source===t.target){const e=r.getNode(t.source);e.data.selfEdges||(e.data.selfEdges=[]),e.data.selfEdges.push(t),r.removeEdge(t.id)}})},B3=r=>{const t=Oh(r);t==null||t.forEach(e=>{let n=0;e==null||e.forEach((i,a)=>{var s;const o=r.getNode(i);o.data.order=a+n,(s=o.data.selfEdges)===null||s===void 0||s.forEach(A=>{_c(r,"selfedge",{width:A.data.width,height:A.data.height,rank:o.data.rank,order:a+ ++n,e:A},"_se")}),delete o.data.selfEdges})})},b3=r=>{r.getAllNodes().forEach(t=>{const e=r.getNode(t.id);if(e.data.dummy==="selfedge"){const n=r.getNode(e.data.e.source),i=n.data.x+n.data.width/2,a=n.data.y,s=e.data.x-i,o=n.data.height/2;r.hasEdge(e.data.e.id)?r.updateEdgeData(e.data.e.id,e.data.e.data):r.addEdge({id:e.data.e.id,source:e.data.e.source,target:e.data.e.target,data:e.data.e.data}),r.removeNode(t.id),e.data.e.data.points=[{x:i+2*s/3,y:a-o},{x:i+5*s/6,y:a-o},{y:a,x:i+s},{x:i+5*s/6,y:a+o},{x:i+2*s/3,y:a+o}],e.data.e.data.x=e.data.x,e.data.e.data.y=e.data.y}})},pC=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},mC=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t};function Ih(r){if(!r)return[0,0,0];if(ye(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Tl(r,t){let e;return Wt(t)?e=t:ye(t)?e=()=>t:e=()=>r,e}function Oy(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:Br(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Wt(t)?t:ye(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:Br(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const Iy=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Wt(r)?n=r:n=s=>r:n=s=>{var o,A,l;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(A=s.data)===null||A===void 0?void 0:A.bboxSize;if(!((l=s.data)===null||l===void 0)&&l.size){const c=s.data.size;return Array.isArray(c)?c:Br(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),A=i(s);return Math.max(...Ih(o))+A}},Ly=r=>{if(r===null)return r;if(r instanceof Date)return new Date(r.getTime());if(r instanceof Array){const t=[];return r.forEach(e=>{t.push(e)}),t.map(e=>Ly(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=Ly(r[e])}),t}return r},Qa=(r,t)=>{const e=Ly(r);return e.data=e.data||{},t&&(ye(e.data.x)||(e.data.x=Math.random()*t[0]),ye(e.data.y)||(e.data.y=Math.random()*t[1])),e},x3={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class C3{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},x3),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:A,nodesep:l,ranksepFunc:c,nodesepFunc:u,edgeLabelSpace:h,ranker:d,nodeOrder:f,begin:g,controlPoints:v,radial:m,sortByCombo:w,preset:C}=i,F=new Hr({tree:[]}),Q=Tl(A||50,c),D=Tl(l||50,u);let K=D,G=Q;(o==="LR"||o==="RL")&&(K=Q,G=D);const J=Oy(10,a,!1),$=e.getAllNodes(),at=e.getAllEdges();$.forEach(xt=>{const Ft=Ih(J(xt)),_t=G(xt),Xt=K(xt),ie=Ft[0]+2*Xt,le=Ft[1]+2*_t,ve=xt.data.layer;ye(ve)?F.addNode({id:xt.id,data:{width:ie,height:le,layer:ve}}):F.addNode({id:xt.id,data:{width:ie,height:le}})}),w&&(F.attachTreeStructure("combo"),$.forEach(xt=>{const{parentId:Ft}=xt.data;Ft!==void 0&&F.hasNode(Ft)&&F.setParent(xt.id,Ft,"combo")})),at.forEach(xt=>{F.addEdge({id:xt.id,source:xt.source,target:xt.target,data:{weight:xt.data.weight||1}})});let At;C!=null&&C.length&&(At=new Hr({nodes:C})),r3(F,{prevGraph:At,edgeLabelSpace:h,keepNodeOrder:!!f,nodeOrder:f||[],acyclicer:"greedy",ranker:d,rankdir:o,nodesep:l,align:s});const pt=[0,0];if(g){let xt=1/0,Ft=1/0;F.getAllNodes().forEach(_t=>{xt>_t.data.x&&(xt=_t.data.x),Ft>_t.data.y&&(Ft=_t.data.y)}),F.getAllEdges().forEach(_t=>{var Xt;(Xt=_t.data.points)===null||Xt===void 0||Xt.forEach(ie=>{xt>ie.x&&(xt=ie.x),Ft>ie.y&&(Ft=ie.y)})}),pt[0]=g[0]-xt,pt[1]=g[1]-Ft}const wt=o==="LR"||o==="RL";if(!m){const xt=new Set,_t=o==="BT"||o==="RL"?(ve,xe)=>xe-ve:(ve,xe)=>ve-xe;F.getAllNodes().forEach(ve=>{ve.data.x=ve.data.x+pt[0],ve.data.y=ve.data.y+pt[1],xt.add(wt?ve.data.x:ve.data.y)});const Xt=Array.from(xt).sort(_t),ie=wt?(ve,xe)=>ve.x!==xe.x:(ve,xe)=>ve.y!==xe.y,le=wt?(ve,xe,Qe)=>{const Re=Math.max(xe.y,Qe.y),nn=Math.min(xe.y,Qe.y);return ve.filter(mn=>mn.y<=Re&&mn.y>=nn)}:(ve,xe,Qe)=>{const Re=Math.max(xe.x,Qe.x),nn=Math.min(xe.x,Qe.x);return ve.filter(mn=>mn.x<=Re&&mn.x>=nn)};F.getAllEdges().forEach((ve,xe)=>{var Qe;h&&v&&ve.data.type!=="loop"&&(ve.data.controlPoints=S3((Qe=ve.data.points)===null||Qe===void 0?void 0:Qe.map(({x:Re,y:nn})=>({x:Re+pt[0],y:nn+pt[1]})),F.getNode(ve.source),F.getNode(ve.target),Xt,wt,ie,le))})}let bt=[];bt=F.getAllNodes().map(xt=>Qa(xt));const Rt=F.getAllEdges();return t&&(bt.forEach(xt=>{e.mergeNodeData(xt.id,{x:xt.data.x,y:xt.data.y})}),Rt.forEach(xt=>{e.mergeEdgeData(xt.id,{controlPoints:xt.data.controlPoints})})),{nodes:bt,edges:Rt}})}}const S3=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:A,y:l}=t.data,{x:c,y:u}=e.data;if(i&&(A=t.data.y,l=t.data.x,c=e.data.y,u=e.data.x),u!==l&&A!==c){const h=n.indexOf(l),d=n[h+1];if(d){const v=o[0],m=i?{x:(l+d)/2,y:(v==null?void 0:v.y)||c}:{x:(v==null?void 0:v.x)||c,y:(l+d)/2};(!v||a(v,m))&&o.unshift(m)}const f=n.indexOf(u),g=Math.abs(f-h);if(g===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(l+u)/2,y:A}:{x:A,y:(l+u)/2});else if(g>1){const v=n[f-1];if(v){const m=o[o.length-1],w=i?{x:(u+v)/2,y:(m==null?void 0:m.y)||c}:{x:(m==null?void 0:m.x)||A,y:(u+v)/2};(!m||a(m,w))&&o.push(w)}}}}return o},Fl=(r,t,e)=>{const n=r.getAllNodes(),i=r.getAllEdges();if(!(n!=null&&n.length))return{nodes:[],edges:i};if(n.length===1)return t&&r.mergeNodeData(n[0].id,{x:e[0],y:e[1]}),{nodes:[Object.assign(Object.assign({},n[0]),{data:Object.assign(Object.assign({},n[0].data),{x:e[0],y:e[1]})})],edges:i}},M3={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class T3{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},M3),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:A,startAngle:l=0,endAngle:c=2*Math.PI,angleRatio:u,ordering:h,clockwise:d,nodeSpacing:f,nodeSize:g}=i,v=e.getAllNodes(),m=e.getAllEdges(),[w,C,F]=O3(a,s,o),Q=v==null?void 0:v.length;if(!Q||Q===1)return Fl(e,t,F);const D=(c-l)/Q;let{radius:K,startRadius:G,endRadius:J}=i;if(f){const wt=Tl(10,f),bt=Oy(10,g);let Rt=-1/0;v.forEach(xt=>{const Ft=bt(xt);Rt{Ft===0?Pt+=Rt||10:Pt+=(wt(xt)||0)+(Rt||10)}),K=Pt/(2*Math.PI)}else!K&&!G&&!J?K=Math.min(C,w)/2:!G&&J?G=J:G&&!J&&(J=G);const $=D*u;let at=[];h==="topology"?at=yC(e,v):h==="topology-directed"?at=yC(e,v,!0):h==="degree"?at=F3(e,v):at=v.map(wt=>Qa(wt));const At=Math.ceil(Q/A);for(let wt=0;wt{e.mergeNodeData(wt.id,{x:wt.data.x,y:wt.data.y})}),{nodes:at,edges:m}})}}const yC=(r,t,e=!1)=>{const n=[Qa(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,A)=>{if(A!==0)if((A===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[A+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(Qa(o)),i[o.id]=!0,s++;else{const l=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let h=0;h{e.push(Qa(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const O3=(r,t,e)=>{let n=r,i=t,a=e;return!n&&typeof window!="undefined"&&(n=window.innerWidth),!i&&typeof window!="undefined"&&(i=window.innerHeight),a||(a=[n/2,i/2]),[n,i,a]},Qo=Array.isArray,I3={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Ny{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},I3),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:A,maxLevelDiff:l,sweep:c,clockwise:u,equidistant:h,preventOverlap:d,startAngle:f=3/2*Math.PI,nodeSize:g,nodeSpacing:v}=i,m=e.getAllNodes(),w=e.getAllEdges(),C=!s&&typeof window!="undefined"?window.innerWidth:s,F=!o&&typeof window!="undefined"?window.innerHeight:o,Q=a||[C/2,F/2];if(!(m!=null&&m.length)||m.length===1)return Fl(e,t,Q);const D=[];let K,G=0;Qo(g)?K=Math.max(g[0],g[1]):Wt(g)?(K=-1/0,m.forEach(xt=>{const Ft=Math.max(...Ih(g(xt)));Ft>K&&(K=Ft)})):K=g,Qo(v)?G=Math.max(v[0],v[1]):ye(v)&&(G=v),m.forEach(xt=>{const Ft=Qa(xt);D.push(Ft);let _t=K;const{data:Xt}=Ft;Qo(Xt.size)?_t=Math.max(Xt.size[0],Xt.size[1]):ye(Xt.size)?_t=Xt.size:Br(Xt.size)&&(_t=Math.max(Xt.size.width,Xt.size.height)),K=Math.max(K,_t),Wt(v)&&(G=Math.max(v(xt),G))});const J={};D.forEach((xt,Ft)=>{J[xt.id]=Ft});let $=A;(!gn($)||D[0].data[$]===void 0)&&($="degree"),$==="degree"?D.sort((xt,Ft)=>e.getDegree(Ft.id,"both")-e.getDegree(xt.id,"both")):D.sort((xt,Ft)=>Ft.data[$]-xt.data[$]);const at=D[0],At=(l||($==="degree"?e.getDegree(at.id,"both"):at.data[$]))/4,pt=[{nodes:[]}];let wt=pt[0];D.forEach(xt=>{if(wt.nodes.length>0){const Ft=Math.abs($==="degree"?e.getDegree(wt.nodes[0].id,"both")-e.getDegree(xt.id,"both"):wt.nodes[0].data[$]-xt.data[$]);At&&Ft>=At&&(wt={nodes:[]},pt.push(wt))}wt.nodes.push(xt)});let bt=K+G;if(!d){const xt=pt.length>0&&pt[0].nodes.length>1,_t=(Math.min(C,F)/2-bt)/(pt.length+(xt?1:0));bt=Math.min(bt,_t)}let Rt=0;if(pt.forEach(xt=>{const Ft=c===void 0?2*Math.PI-2*Math.PI/xt.nodes.length:c;if(xt.dTheta=Ft/Math.max(1,xt.nodes.length-1),xt.nodes.length>1&&d){const _t=Math.cos(xt.dTheta)-Math.cos(0),Xt=Math.sin(xt.dTheta)-Math.sin(0),ie=Math.sqrt(bt*bt/(_t*_t+Xt*Xt));Rt=Math.max(ie,Rt)}xt.r=Rt,Rt+=bt}),h){let xt=0,Ft=0;for(let _t=0;_t{Xt===0&&(Ft=_t.r||0),_t.r=Ft,Ft+=xt})}return pt.forEach(xt=>{const Ft=xt.dTheta||0,_t=xt.r||0;xt.nodes.forEach((Xt,ie)=>{const le=f+(u?1:-1)*Ft*ie;Xt.data.x=Q[0]+_t*Math.cos(le),Xt.data.y=Q[1]+_t*Math.sin(le)})}),t&&D.forEach(xt=>e.mergeNodeData(xt.id,{x:xt.data.x,y:xt.data.y})),{nodes:D,edges:w}})}}var ky=M(14301),L3=M(7695);const N3=.81,Qy=.1;function k3(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((c,u)=>{const{nodeStrength:h,x:d,y:f,z:g,size:v}=c.data;return{x:d,y:f,z:g,size:v,index:u,id:c.id,vx:0,vy:0,vz:0,weight:a*h}}),A=(i===2?(0,ky.Z)(o,c=>c.x,c=>c.y):(0,L3.Z)(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(Q3),l=new Map;return o.forEach(c=>{l.set(c.id,c),P3(c,A,i)}),o.map((c,u)=>{const{id:h,data:d}=s[u],{mass:f=1}=d;n[h]={x:c.vx/f,y:c.vy/f,z:c.vz/f}}),n}function Q3(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const A=[e,n,i][s-1],l=a.x-r.x||Qy,c=a.y-r.y||Qy,u=a.z-r.z||Qy,h=[l,c,u],d=A-t;let f=0;for(let m=0;mU3(n,i,a,s,o,r,e))}const D3={dimensions:2,maxIteration:500,gravity:10,factor:1,edgeStrength:50,nodeStrength:1e3,coulombDisScale:.005,damping:.9,maxSpeed:200,minMovement:.4,interval:.02,linkDistance:200,clusterNodeStrength:20,preventOverlap:!0,distanceThresholdMode:"mean"};class wC{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},D3),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericForceLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;(this.judgingDistance>this.lastOptions.minMovement||n<1)&&nthis.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericForceLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:A,width:l,height:c,nodeSize:u,getMass:h,nodeStrength:d,edgeStrength:f,linkDistance:g}=o,v=a.map((G,J)=>Object.assign(Object.assign({},G),{data:Object.assign(Object.assign({},G.data),{x:ye(G.data.x)?G.data.x:Math.random()*l,y:ye(G.data.y)?G.data.y:Math.random()*c,z:ye(G.data.z)?G.data.z:Math.random()*Math.sqrt(l*c),size:u(G)||30,mass:h(G),nodeStrength:d(G)})})),m=s.map(G=>Object.assign(Object.assign({},G),{data:Object.assign(Object.assign({},G.data),{edgeStrength:f(G),linkDistance:g(G,e.getNode(G.source),e.getNode(G.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const w={};a.forEach((G,J)=>{w[G.id]={x:0,y:0,z:0}});const C=new Hr({nodes:v,edges:m});this.formatCentripetal(o,C);const{maxIteration:F,minMovement:Q,onTick:D}=o;if(this.lastLayoutNodes=v,this.lastLayoutEdges=m,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=C,this.lastOptions=o,this.lastVelMap=w,typeof window=="undefined")return;let K=0;return new Promise(G=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&G({nodes:Uy(e,v),edges:s}),this.runOneStep(C,e,K,w,o),this.updatePosition(e,C,w,o),t&&v.forEach(J=>e.mergeNodeData(J.id,{x:J.data.x,y:J.data.y,z:A===3?J.data.z:void 0})),D==null||D({nodes:Uy(e,v),edges:s}),K++,(K>=F||this.judgingDistance{let l=1;ye(A==null?void 0:A.data.mass)&&(l=A==null?void 0:A.data.mass);const c=e.getDegree(A.id,"both");return!c||c<5?l:c*5*l}),n.nodeSize=Iy(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Tl(1,t.linkDistance):A=>1+n.nodeSize(e.getNode(A.source))+n.nodeSize(e.getNode(A.target));return n.linkDistance=o,n.nodeStrength=Tl(1,t.nodeStrength),n.edgeStrength=Tl(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:A,nodeClusterBy:l}=t,c=e.getAllNodes(),u=i||{leaf:2,single:2,others:1,center:m=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=m=>s);let h,d;if(o&&l&&(h=EC(e,l),d=Array.from(new Set(c==null?void 0:c.map(m=>m.data[l])))||[],t.centripetalOptions=Object.assign(u,{single:100,leaf:m=>{const{siblingLeaves:w,sameTypeLeaves:C}=h[m.id]||{};return(C==null?void 0:C.length)===(w==null?void 0:w.length)||(d==null?void 0:d.length)===1?1:t.clusterNodeStrength(m)},others:1,center:m=>{const w=e.getDegree(m.id,"both");if(!w)return{x:100,y:100,z:0};let C;if(w===1){const{sameTypeLeaves:F=[]}=h[m.id]||{};F.length===1?C=void 0:F.length>1&&(C=BC(F))}else C=void 0;return{x:C==null?void 0:C.x,y:C==null?void 0:C.y,z:C==null?void 0:C.z}}})),A&&l){h||(h=EC(e,l)),d||(d=Array.from(new Set(c.map(w=>w.data[l])))),d=d.filter(w=>w!==void 0);const m={};d.forEach(w=>{const C=c.filter(F=>F.data[l]===w).map(F=>e.getNode(F.id));m[w]=BC(C)}),t.centripetalOptions=Object.assign(u,{single:w=>t.clusterNodeStrength(w),leaf:w=>t.clusterNodeStrength(w),others:w=>t.clusterNodeStrength(w),center:w=>{const C=m[w.data[l]];return{x:C==null?void 0:C.x,y:C==null?void 0:C.y,z:C==null?void 0:C.z}}})}const{leaf:f,single:g,others:v}=t.centripetalOptions||{};f&&typeof f!="function"&&(t.centripetalOptions.leaf=()=>f),g&&typeof g!="function"&&(t.centripetalOptions.single=()=>g),v&&typeof v!="function"&&(t.centripetalOptions.others=()=>v)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),A=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:l}=a;if(this.calRepulsive(t,s,a),A&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),l){const c=this.calTotalEnergy(s,o);l({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,A=this.options.dimensions===3?t[i.id].z:0,l=s*s+o*o+A*A,{mass:c=1}=i.data;n+=c*l*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;k3(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:A,target:l}=s,c=t.getNode(A),u=t.getNode(l);if(!c||!u)return;let h=u.data.x-c.data.x,d=u.data.y-c.data.y,f=i===3?u.data.z-c.data.z:0;!h&&!d&&(h=Math.random()*.01,d=Math.random()*.01,i===3&&!f&&(f=Math.random()*.01));const g=Math.sqrt(h*h+d*d+f*f);if(g{const{id:g,data:v}=f,{mass:m,x:w,y:C,z:F}=v,Q=e.getNode(g);let D=0,K=0,G=0,J=h;const $=t.getDegree(g,"in"),at=t.getDegree(g,"out"),At=t.getDegree(g,"both"),pt=a==null?void 0:a(Q,At);if(pt){const[wt,bt,Rt]=pt;D=w-wt,K=C-bt,J=Rt}else D=w-u[0],K=C-u[1],G=F-u[2];if(J&&(n[g].x-=J*D/m,n[g].y-=J*K/m,n[g].z-=J*G/m),d){const{leaf:wt,single:bt,others:Rt,center:Pt}=d,{x:xt,y:Ft,z:_t,centerStrength:Xt}=(Pt==null?void 0:Pt(Q,o,A,l,c))||{x:0,y:0,z:0,centerStrength:0};if(!ye(xt)||!ye(Ft))return;const ie=(w-xt)/m,le=(C-Ft)/m,ve=(F-_t)/m;if(Xt&&(n[g].x-=Xt*ie,n[g].y-=Xt*le,n[g].z-=Xt*ve),At===0){const Qe=bt(Q);if(!Qe)return;n[g].x-=Qe*ie,n[g].y-=Qe*le,n[g].z-=Qe*ve;return}if($===0||at===0){const Qe=wt(Q,o,A);if(!Qe)return;n[g].x-=Qe*ie,n[g].y-=Qe*le,n[g].z-=Qe*ve;return}const xe=Rt(Q);if(!xe)return;n[g].x-=xe*ie,n[g].y-=xe*le,n[g].z-=xe*ve}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:A}=i,l=t.getAllNodes();l!=null&&l.length&&l.forEach(c=>{const{id:u}=c;let h=(n[u].x+e[u].x*o)*a||.01,d=(n[u].y+e[u].y*o)*a||.01,f=A===3?(n[u].z+e[u].z*o)*a||.01:0;const g=Math.sqrt(h*h+d*d+f*f);if(g>s){const v=s/g;h=v*h,d=v*d,f=v*f}n[u]={x:h,y:d,z:f}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,A=e.getAllNodes();if(!(A!=null&&A.length)){this.judgingDistance=0;return}let l=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),A.forEach(c=>{const{id:u}=c,h=t.getNode(u);if(ye(h.data.fx)&&ye(h.data.fy)){e.mergeNodeData(u,{x:h.data.fx,y:h.data.fy,z:o===3?h.data.fz:void 0});return}const d=n[u].x*s,f=n[u].y*s,g=o===3?n[u].z*s:0;e.mergeNodeData(u,{x:c.data.x+d,y:c.data.y+f,z:c.data.z+g});const v=Math.sqrt(d*d+f*f+g*g);switch(a){case"max":this.judgingDistancev&&(this.judgingDistance=v);break;default:l=l+v;break}}),(!a||a==="mean")&&(this.judgingDistance=l/A.length)}}const EC=(r,t)=>{const e=r.getAllNodes();if(!(e!=null&&e.length))return{};const n={};return e.forEach((i,a)=>{r.getDegree(i.id,"both")===1&&(n[i.id]=R3(r,"leaf",i,t))}),n},R3=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(l=>r.getDegree(l.id,"in")===0||r.getDegree(l.id,"out")===0);const A=_3(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:A}},_3=(r,t,e,n,i)=>{const a=n.data[e]||"";let s=(i==null?void 0:i.filter(o=>o.data[e]===a))||[];return t==="leaf"&&(s=s.filter(o=>r.getDegree(o.id,"in")===0||r.getDegree(o.id,"out")===0)),s},BC=r=>{const t={x:0,y:0};r.forEach(n=>{const{x:i,y:a}=n.data;t.x+=i||0,t.y+=a||0});const e=r.length||1;return{x:t.x/e,y:t.y/e}},Uy=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var wn=M(30035);const iG=wn.XA,aG=wn.a_,sG=wn.yQ,oG=wn.Hs,AG=wn.Ec,lG=wn.dx,cG=wn.LU,uG=wn.Rm,TA=wn.y3,hG=wn.qK,dG=wn.pb,fG=wn.j,gG=wn.sO,vG=wn.BZ,pG=wn.EK,mG=wn.Db,yG=wn.Fx,wG=wn.tU,EG=wn.Ym,BG=wn.rs,bG=wn.QR,xG=wn.TB,CG=wn.oH,bC=wn.Sc,SG=wn.BN,MG=wn.it,TG=wn.$r,FG=wn.QM,OG=wn.AV;var IG=(wn.y3,wn.y3);const LG=wn.GH,NG=wn.SO,kG=wn.uZ,QG=wn.yU,UG=wn.F1,PG=wn.re,xC=r=>{const t=[],e=r.length;for(let n=0;nt[i][n]+t[n][a]&&(t[i][a]=t[i][n]+t[n][a]);return t},CC=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const A=[];i.push(A)}),n==null||n.forEach(s=>{const{source:o,target:A}=s,l=a[o],c=a[A];l===void 0||c===void 0||(i[l][c]=1,t||(i[c][l]=1))}),i},H3=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},G3=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Qo(s)?s.length===1&&(s=[s[0],s[0]]):ye(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],A=a.data.x-o[0],l=a.data.x+o[0],c=a.data.y-o[1],u=a.data.y+o[1];t>A&&(t=A),e>c&&(e=c),nMath.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),Py=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let A=0;A{const m=Qa(o[v]);m.data.x=g[0]+a[0],m.data.y=g[1]+a[1],d.push(m)}),t&&d.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:A}})}}const z3=r=>{let t=-999999;r.forEach(e=>{e.forEach(n=>{n!==1/0&&t{e.forEach((i,a)=>{i===1/0&&(r[n][a]=t)})})},V3=r=>{const e=TA.mul(TA.pow(r,2),-.5),n=e.mean("row"),i=e.mean("column"),a=e.mean();e.add(a).subRowVector(n).subColumnVector(i);const s=new bC(e),o=TA.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(A=>TA.mul([A],[o]).toJSON()[0].splice(0,2))};function Dy(r){return!!r.tick&&!!r.stop}const W3={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},Z3={center:[0,0],comboPadding:10,treeKey:"combo"};class j3{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},Z3),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,A=e.getAllNodes().filter(G=>!G.data._isCombo),l=e.getAllNodes().filter(G=>G.data._isCombo),c=e.getAllEdges(),u=A==null?void 0:A.length;if(!u||u===1)return Fl(e,t,a);const h=[],d=new Map;A.forEach(G=>{d.set(G.id,G)});const f=new Map;l.forEach(G=>{f.set(G.id,G)});const g=new Map,v=this.getInnerGraphs(e,s,d,f,c,i,g);yield Promise.all(v);const m=new Map,w=[],C=new Map;let F=!0;e.getRoots(s).forEach(G=>{const J=g.get(G.id),$=f.get(G.id)||d.get(G.id),at={id:G.id,data:Object.assign(Object.assign({},G.data),{x:J.data.x||$.data.x,y:J.data.y||$.data.y,fx:J.data.fx||$.data.fx,fy:J.data.fy||$.data.fy,mass:J.data.mass||$.data.mass,size:J.data.size})};w.push(at),m.set(G.id,!0),!isNaN(at.data.x)&&at.data.x!==0&&!isNaN(at.data.y)&&at.data.y!==0?F=!1:(at.data.x=Math.random()*100,at.data.y=Math.random()*100),Py(e,[G],At=>{At.id!==G.id&&C.set(At.id,G.id)},"TB",s)});const Q=[];c.forEach(G=>{const J=C.get(G.source)||G.source,$=C.get(G.target)||G.target;J!==$&&m.has(J)&&m.has($)&&Q.push({id:G.id,source:J,target:$,data:{}})});let D;if(w!=null&&w.length){if(w.length===1)w[0].data.x=a[0],w[0].data.y=a[1];else{const G=new Hr({nodes:w,edges:Q}),J=o||new wC;F&&W3[J.id]&&(yield(w.length<100?new MC:new Ny).assign(G));const $=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},J.id==="force"?{gravity:1,factor:4,linkDistance:(at,At,pt)=>{const wt=Math.max(...At.data.size)||32,bt=Math.max(...pt.data.size)||32;return wt/2+bt/2+200}}:{});D=yield TC(J,G,$)}g.forEach(G=>{var J;const $=D.nodes.find(pt=>pt.id===G.id);if($){const{x:pt,y:wt}=$.data;G.data.visited=!0,G.data.x=pt,G.data.y=wt,h.push({id:G.id,data:{x:pt,y:wt}})}const{x:at,y:At}=G.data;(J=G.data.nodes)===null||J===void 0||J.forEach(pt=>{h.push({id:pt.id,data:{x:pt.data.x+at,y:pt.data.y+At}})})}),g.forEach(({data:G})=>{const{x:J,y:$,visited:at,nodes:At}=G;At==null||At.forEach(pt=>{if(!at){const wt=h.find(bt=>bt.id===pt.id);wt.data.x+=J||0,wt.data.y+=$||0}})})}return t&&h.forEach(G=>{e.mergeNodeData(G.id,{x:G.data.x,y:G.data.y})}),{nodes:h,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(ye(i)?o=()=>i:Wt(i)?o=i:o=()=>0,e.spacing=o,!n)s=l=>{const c=o(l);return l.size?Qo(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+c)/2:Br(l.size)?((l.size.width>l.size.height?l.size.width:l.size.height)+c)/2:(l.size+c)/2:32+c/2};else if(Wt(n))s=l=>{const c=n(l),u=o(l);return Qo(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+u)/2:((c||32)+u)/2};else if(Qo(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=u=>c+o(u)/2}else{const l=n/2;s=c=>l+o(c)/2}e.nodeSize=s;let A;return ye(a)?A=()=>a:Qo(a)?A=()=>Math.max.apply(null,a):Wt(a)?A=a:A=()=>0,e.comboPadding=A,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:A,comboPadding:l,spacing:c,innerLayout:u}=s,h=u||new Ny({}),d={center:[0,0],preventOverlap:!0,nodeSpacing:c},f=[],g=v=>{let m=(l==null?void 0:l(v))||10;return Qo(m)&&(m=Math.max(...m)),{size:m?[m*2,m*2]:[30,30],padding:m}};return t.getRoots(e).forEach(v=>{o.set(v.id,{id:v.id,data:{nodes:[],size:g(v).size}});let m=Promise.resolve();Py(t,[v],w=>{var C;if(!w.data._isCombo)return;const{size:F,padding:Q}=g(w);if(!(!((C=t.getChildren(w.id,e))===null||C===void 0)&&C.length))o.set(w.id,{id:w.id,data:Object.assign(Object.assign({},w.data),{size:F})});else{const D=o.get(w.id);o.set(w.id,{id:w.id,data:Object.assign({nodes:[]},D==null?void 0:D.data)});const K=new Map,G=t.getChildren(w.id,e).map(at=>{if(at.data._isCombo)return o.has(at.id)||o.set(at.id,{id:at.id,data:Object.assign({},at.data)}),K.set(at.id,!0),o.get(at.id);const At=n.get(at.id)||i.get(at.id);return K.set(at.id,!0),{id:at.id,data:Object.assign(Object.assign({},At.data),at.data)}}),J={nodes:G,edges:a.filter(at=>K.has(at.source)&&K.has(at.target))};let $=1/0;G.forEach(at=>{var At;let{size:pt}=at.data;pt||(pt=((At=o.get(at.id))===null||At===void 0?void 0:At.data.size)||(A==null?void 0:A(at))||[30,30]),ye(pt)&&(pt=[pt,pt]);const[wt,bt]=pt;$>wt&&($=wt),$>bt&&($=bt),at.data.size=pt}),m=m.then(()=>(0,z.mG)(this,void 0,void 0,function*(){const at=new Hr(J);yield TC(h,at,d,!0);const{minX:At,minY:pt,maxX:wt,maxY:bt}=G3(G),Rt={x:(wt+At)/2,y:(bt+pt)/2};J.nodes.forEach(xt=>{xt.data.x-=Rt.x,xt.data.y-=Rt.y});const Pt=[Math.max(wt-At,$)+Q*2,Math.max(bt-pt,$)+Q*2];o.get(w.id).data.size=Pt,o.get(w.id).data.nodes=G}))}return!0},"BT",e),f.push(m)}),f}}function TC(r,t,e,n){var i;return(0,z.mG)(this,void 0,void 0,function*(){return Dy(r)?(r.execute(t,e),r.stop(),r.tick((i=e.iterations)!==null&&i!==void 0?i:300)):n?yield r.assign(t,e):yield r.execute(t,e)})}function li(r){return function(){return r}}function FA(r){return(r()-.5)*1e-6}function Y3(r){return r.index}function FC(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function X3(r){var t=Y3,e=u,n,i=li(30),a,s,o,A,l,c=1;r==null&&(r=[]);function u(v){return 1/Math.min(o[v.source.index],o[v.target.index])}function h(v){for(var m=0,w=r.length;m[t(Q,D,s),Q])),F;for(v=0,o=new Array(m);v(r=($3*r+tP)%OC)/OC}function nP(r){return r.x}function rP(r){return r.y}var iP=10,aP=Math.PI*(3-Math.sqrt(5));function sP(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,A=(0,q3.HT)(u),l=(0,J3.Z)("tick","end"),c=eP();r==null&&(r=[]);function u(){h(),l.call("tick",t),e1?(v==null?o.delete(g):o.set(g,f(v)),t):o.get(g)},find:function(g,v,m){var w=0,C=r.length,F,Q,D,K,G;for(m==null?m=1/0:m*=m,w=0;w1?(l.on(g,v),t):l.on(g)}}}function oP(){var r,t,e,n,i=li(-30),a,s=1,o=1/0,A=.81;function l(d){var f,g=r.length,v=(0,ky.Z)(r,nP,rP).visitAfter(u);for(n=d,f=0;f=o)return;(d.data!==t||d.next)&&(m===0&&(m=FA(e),F+=m*m),w===0&&(w=FA(e),F+=w*w),Fh.index){var at=d-G.x-G.vx,At=f-G.y-G.vy,pt=at*at+At*At;pt<$*$&&(at===0&&(at=FA(n),pt+=at*at),At===0&&(At=FA(n),pt+=At*At),pt=($-(pt=Math.sqrt(pt)))/pt*i,h.vx+=(at*=pt)*($=(J*=J)/(v+J)),h.vy+=(At*=pt)*$,G.vx-=at*($=1-$),G.vy-=At*$)}return}return F>d+$||Df+$||Kl.r&&(l.r=l[c].r)}function A(){if(t){var l,c=t.length,u;for(e=new Array(c),l=0;le.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Ci(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericLayout(!0,t,e)})}stop(){this.simulation.stop()}tick(t){return this.simulation.tick(t),this.getResult()}restart(){this.simulation.restart()}setFixedPosition(t,e){const n=this.context.nodes.find(i=>i.id===t);n&&e.forEach((i,a)=>{if(typeof i=="number"||i===null){const s=["fx","fy","fz"][a];n[s]=i}})}getOptions(t){var e,n;const i=Ci({},this.options,t);return i.collide&&((e=i.collide)===null||e===void 0?void 0:e.radius)===void 0&&(i.collide=i.collide||{},i.collide.radius=(n=i.nodeSize)!==null&&n!==void 0?n:10),i.iterations===void 0&&(i.link&&i.link.iterations===void 0&&(i.iterations=i.link.iterations),i.collide&&i.collide.iterations===void 0&&(i.iterations=i.collide.iterations)),this.context.options=i,i}genericLayout(t,e,n){var i;return(0,z.mG)(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:u})=>Object.assign(Object.assign({id:c},u),xl(u.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const A=new Promise(c=>{this.resolver=c}),l=this.setSimulation(a);return l.nodes(s),(i=l.force("link"))===null||i===void 0||i.links(o),A})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),xl(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:A,target:l,data:c})=>({id:o,source:typeof A=="object"?A.id:A,target:typeof l=="object"?l.id:l,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return sP()}setSimulation(t){const e=this.simulation||this.options.forceSimulation||this.initSimulation();return this.simulation||(this.simulation=e.on("tick",()=>{var n;return(n=t.onTick)===null||n===void 0?void 0:n.call(t,this.getResult())}).on("end",()=>{var n;return(n=this.resolver)===null||n===void 0?void 0:n.call(this,this.getResult())})),IC(e,this.config.simulationAttrs.map(n=>[n,t[n]])),Object.entries(this.forceMap).forEach(([n,i])=>{const a=n;if(t[n]){let s=e.force(a);s||(s=i(),e.force(a,s)),IC(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const IC=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var LC=M(92546),vP=M.n(LC);class Dg{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,Dg.defaultOptions,t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,Object.assign(Object.assign({},this.options),e))})}genericDagreLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new LC.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:l})=>ye(l))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(l=>{const{id:c}=l,u=Object.assign({},l.data);if(i!==void 0){const[h,d]=Ih(Wt(i)?i(l):i);Object.assign(u,{width:h,height:d})}a.setNode(c.toString(),u)}),e.getAllEdges().forEach(({id:l,source:c,target:u})=>{a.setEdge(c.toString(),u.toString(),{id:l})}),vP().layout(a);const A={nodes:[],edges:[]};return a.nodes().forEach(l=>{const c=a.node(l);A.nodes.push({id:l,data:c}),t&&e.mergeNodeData(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),{id:u}=c,h=(0,z._T)(c,["id"]),{v:d,w:f}=l;A.edges.push({id:u,source:d,target:f,data:h}),t&&e.mergeEdgeData(u,h)}),A})}}Dg.defaultOptions={};class Ry{constructor(t){this.id=t.id||0,this.rx=t.rx,this.ry=t.ry,this.fx=0,this.fy=0,this.mass=t.mass,this.degree=t.degree,this.g=t.g||0}distanceTo(t){const e=this.rx-t.rx,n=this.ry-t.ry;return Math.hypot(e,n)}setPos(t,e){this.rx=t,this.ry=e}resetForce(){this.fx=0,this.fy=0}addForce(t){const e=t.rx-this.rx,n=t.ry-this.ry;let i=Math.hypot(e,n);i=i<1e-4?1e-4:i;const a=this.g*(this.degree+1)*(t.degree+1)/i;this.fx+=a*e/i,this.fy+=a*n/i}in(t){return t.contains(this.rx,this.ry)}add(t){const e=this.mass+t.mass,n=(this.rx*this.mass+t.rx*t.mass)/e,i=(this.ry*this.mass+t.ry*t.mass)/e,a=this.degree+t.degree,s={rx:n,ry:i,mass:e,degree:a};return new Ry(s)}}class Hc{constructor(t){this.xmid=t.xmid,this.ymid=t.ymid,this.length=t.length,this.massCenter=t.massCenter||[0,0],this.mass=t.mass||1}getLength(){return this.length}contains(t,e){const n=this.length/2;return t<=this.xmid+n&&t>=this.xmid-n&&e<=this.ymid+n&&e>=this.ymid-n}NW(){const t=this.xmid-this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Hc(i)}NE(){const t=this.xmid+this.length/4,e=this.ymid+this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Hc(i)}SW(){const t=this.xmid-this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Hc(i)}SE(){const t=this.xmid+this.length/4,e=this.ymid-this.length/4,n=this.length/2,i={xmid:t,ymid:e,length:n};return new Hc(i)}}class Gc{constructor(t){this.body=null,this.quad=null,this.NW=null,this.NE=null,this.SW=null,this.SE=null,this.theta=.5,t!=null&&(this.quad=t)}insert(t){if(this.body==null){this.body=t;return}this._isExternal()?(this.quad&&(this.NW=new Gc(this.quad.NW()),this.NE=new Gc(this.quad.NE()),this.SW=new Gc(this.quad.SW()),this.SE=new Gc(this.quad.SE())),this._putBody(this.body),this._putBody(t),this.body=this.body.add(t)):(this.body=this.body.add(t),this._putBody(t))}_putBody(t){this.quad&&(t.in(this.quad.NW())&&this.NW?this.NW.insert(t):t.in(this.quad.NE())&&this.NE?this.NE.insert(t):t.in(this.quad.SW())&&this.SW?this.SW.insert(t):t.in(this.quad.SE())&&this.SE&&this.SE.insert(t))}_isExternal(){return this.NW==null&&this.NE==null&&this.SW==null&&this.SE==null}updateForce(t){if(!(this.body==null||t===this.body))if(this._isExternal())t.addForce(this.body);else{const e=this.quad?this.quad.getLength():0,n=this.body.distanceTo(t);e/nQa(m,[o,A])),f=i.filter(m=>{const{source:w,target:C}=m;return w!==C}),g=new Hr({nodes:d,edges:f}),v=this.getSizes(g,u);if(this.run(g,e,c,v,t,s),l){for(let w=0;w250&&(n.barnesHut=!0),A===void 0&&e>100&&(n.prune=!0),l===0&&!A?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):l===0&&A&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),u||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:A,onTick:l}=s,c=t.getAllNodes();let u=0,h=n;const d={},f={},g={};for(let v=0;v0;)u=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:u,forces:d,preForces:f,bodies:g,sizes:i},s),h--,l==null||l({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:A,bodies:l,sizes:c}=e;let{forces:u}=e;const{preventOverlap:h,barnesHut:d}=n,f=t.getAllNodes();for(let g=0;ga||!h)?u=this.getOptRepGraForces(t,u,l,n):u=this.getRepGraForces(t,i,a,u,s,c,n),this.updatePos(t,u,A,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:A,mode:l,prune:c}=s,u=t.getAllEdges();for(let h=0;h0&&(Q=F,D=F),a[d][0]+=Q*C[0],a[f][0]-=D*C[0],a[d][1]+=Q*C[1],a[f][1]-=D*C[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,A=t.getAllNodes(),l=A.length;let c=9e10,u=-9e10,h=9e10,d=-9e10;for(let w=0;w=u&&(u=F.x),F.x<=c&&(c=F.x),F.y>=d&&(d=F.y),F.y<=h&&(h=F.y))}const f=Math.max(u-c,d-h),g={xmid:(u+c)/2,ymid:(d+h)/2,length:f,massCenter:s,mass:l},v=new Hc(g),m=new Gc(v);for(let w=0;w0&&($=l*(m+1)*(K+1)/J),i[v.id][0]-=$*G[0],i[D.id][0]+=$*G[0],i[v.id][1]-=$*G[1],i[D.id][1]+=$*G[1]}const w=[v.data.x-u[0],v.data.y-u[1]],C=Math.hypot(w[0],w[1]);w[0]=w[0]/C,w[1]=w[1]/C;const F=c*(m+1);i[v.id][0]-=F*w[0],i[v.id][1]-=F*w[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:A,ksmax:l}=a,c=t.getAllNodes(),u=c.length,h=[],d=[];let f=0,g=0,v=i;for(let w=0;w1.5*m?1.5*m:v);for(let w=0;wG?G:D;const J=D*e[C][0],$=D*e[C][1];t.mergeNodeData(C,{x:F.x+J,y:F.y+$})}return v}}const yP={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},wP=800;class EP{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},yP),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericFruchtermanLayout(!0,t,e)})}stop(){this.timeInterval&&typeof window!="undefined"&&window.clearInterval(this.timeInterval),this.running=!1}tick(t=this.options.maxIteration||1){if(this.lastResult)return this.lastResult;for(let n=0;nthis.lastGraph.mergeNodeData(n.id,{x:n.data.x,y:n.data.y,z:this.options.dimensions===3?n.data.z:void 0})),e}genericFruchtermanLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:A,clustering:l,nodeClusterBy:c,maxIteration:u,onTick:h}=i,d=e.getAllNodes(),f=e.getAllEdges();if(!(d!=null&&d.length)){const C={nodes:[],edges:f};return this.lastResult=C,C}if(d.length===1){t&&e.mergeNodeData(d[0].id,{x:A[0],y:A[1],z:a===3?A[2]:void 0});const C={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:A[0],y:A[1],z:a===3?A[2]:void 0})})],edges:f};return this.lastResult=C,C}const g=d.map(C=>Qa(C,[s,o])),v=new Hr({nodes:g,edges:f}),m={};if(l&&g.forEach(C=>{const F=C.data[c];m[F]||(m[F]={name:F,cx:0,cy:0,count:0})}),this.lastLayoutNodes=g,this.lastLayoutEdges=f,this.lastAssign=t,this.lastGraph=v,this.lastOptions=i,this.lastClusterMap=m,typeof window=="undefined")return;let w=0;return new Promise(C=>{this.timeInterval=window.setInterval(()=>{if(!this.running){C({nodes:g,edges:f});return}this.runOneStep(v,m,i),t&&g.forEach(({id:F,data:Q})=>e.mergeNodeData(F,{x:Q.x,y:Q.y,z:a===3?Q.z:void 0})),h==null||h({nodes:g,edges:f}),w++,w>=u&&(window.clearInterval(this.timeInterval),C({nodes:g,edges:f}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window!="undefined"?window.innerWidth:s,e.height=!o&&typeof window!="undefined"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:A,speed:l,clustering:c,nodeClusterBy:u,clusterGravity:h}=n,d=a*s,f=Math.sqrt(d)/10,g=t.getAllNodes(),v=d/(g.length+1),m=Math.sqrt(v),w={};if(this.applyCalculate(t,w,m,v),c){for(const F in e)e[F].cx=0,e[F].cy=0,e[F].count=0;g.forEach(F=>{const{data:Q}=F,D=e[Q[u]];ye(Q.x)&&(D.cx+=Q.x),ye(Q.y)&&(D.cy+=Q.y),D.count++});for(const F in e)e[F].cx/=e[F].count,e[F].cy/=e[F].count;const C=h||o;g.forEach((F,Q)=>{const{id:D,data:K}=F;if(!ye(K.x)||!ye(K.y))return;const G=e[K[u]],J=Math.sqrt((K.x-G.cx)*(K.x-G.cx)+(K.y-G.cy)*(K.y-G.cy)),$=m*C;w[D].x-=$*(K.x-G.cx)/J,w[D].y-=$*(K.y-G.cy)/J})}g.forEach((C,F)=>{const{id:Q,data:D}=C;if(!ye(D.x)||!ye(D.y))return;const K=.01*m*o;w[Q].x-=K*(D.x-A[0]),w[Q].y-=K*(D.y-A[1]),i===3&&(w[Q].z-=K*(D.z-A[2]))}),g.forEach((C,F)=>{const{id:Q,data:D}=C;if(ye(D.fx)&&ye(D.fy)){D.x=D.fx,D.y=D.fy,i===3&&(D.z=D.fz);return}if(!ye(D.x)||!ye(D.y))return;const K=Math.sqrt(w[Q].x*w[Q].x+w[Q].y*w[Q].y+(i===3?w[Q].z*w[Q].z:0));if(K>0){const G=Math.min(f*(l/wP),K);t.mergeNodeData(Q,{x:D.x+w[Q].x/K*G,y:D.y+w[Q].y/K*G,z:i===3?D.z+w[Q].z/K*G:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:A,id:l},c)=>{if(o<=c||!ye(a.x)||!ye(A.x)||!ye(a.y)||!ye(A.y))return;let u=a.x-A.x,h=a.y-A.y,d=this.options.dimensions===3?a.z-A.z:0,f=u*u+h*h+d*d;f===0&&(f=1,u=.01,h=.01,d=.01);const g=n/f,v=u*g,m=h*g,w=d*g;e[s].x+=v,e[s].y+=m,e[l].x-=v,e[l].y-=m,this.options.dimensions===3&&(e[s].z+=w,e[l].z-=w)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:A}=t.getNode(s),{data:l}=t.getNode(o);if(!ye(l.x)||!ye(A.x)||!ye(l.y)||!ye(A.y))return;const c=l.x-A.x,u=l.y-A.y,h=this.options.dimensions===3?l.z-A.z:0,d=Math.sqrt(c*c+u*u+h*h)/n,f=c*d,g=u*d,v=h*d;e[s].x+=f,e[s].y+=g,e[o].x-=f,e[o].y-=g,this.options.dimensions===3&&(e[s].z+=v,e[o].z-=v)})}}const BP={begin:[0,0],preventOverlap:!0,preventOverlapPadding:10,condense:!1,rows:void 0,cols:void 0,position:void 0,sortBy:"degree",nodeSize:30,width:300,height:300};class bP{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},BP),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:A,rows:l,cols:c,nodeSpacing:u,nodeSize:h,width:d,height:f,position:g}=i;let{sortBy:v}=i;const m=e.getAllNodes(),w=e.getAllEdges(),C=m==null?void 0:m.length;if(!C||C===1)return Fl(e,t,a);const F=m.map(bt=>Qa(bt));v!=="id"&&(!gn(v)||F[0].data[v]===void 0)&&(v="degree"),v==="degree"?F.sort((bt,Rt)=>e.getDegree(Rt.id,"both")-e.getDegree(bt.id,"both")):v==="id"?F.sort((bt,Rt)=>ye(Rt.id)&&ye(bt.id)?Rt.id-bt.id:`${bt.id}`.localeCompare(`${Rt.id}`)):F.sort((bt,Rt)=>Rt.data[v]-bt.data[v]);const Q=!d&&typeof window!="undefined"?window.innerWidth:d,D=!f&&typeof window!="undefined"?window.innerHeight:f,K=C,G={rows:l,cols:c};if(l!=null&&c!=null)G.rows=l,G.cols=c;else if(l!=null&&c==null)G.rows=l,G.cols=Math.ceil(K/G.rows);else if(l==null&&c!=null)G.cols=c,G.rows=Math.ceil(K/G.cols);else{const bt=Math.sqrt(K*D/Q);G.rows=Math.round(bt),G.cols=Math.round(Q/D*bt)}if(G.rows=Math.max(G.rows,1),G.cols=Math.max(G.cols,1),G.cols*G.rows>K){const bt=Rg(G),Rt=_g(G);(bt-1)*Rt>=K?Rg(G,bt-1):(Rt-1)*bt>=K&&_g(G,Rt-1)}else for(;G.cols*G.rows=K?_g(G,Rt+1):Rg(G,bt+1)}let J=s?0:Q/G.cols,$=s?0:D/G.rows;if(A||u){const bt=Tl(10,u),Rt=Oy(30,h,!1);F.forEach(Pt=>{(!Pt.data.x||!Pt.data.y)&&(Pt.data.x=0,Pt.data.y=0);const xt=e.getNode(Pt.id),[Ft,_t]=Ih(Rt(xt)||30),Xt=bt!==void 0?bt(Pt):o,ie=Ft+Xt,le=_t+Xt;J=Math.max(J,ie),$=Math.max($,le)})}const at={},At={row:0,col:0},pt={};for(let bt=0;bt{e.mergeNodeData(bt.id,{x:bt.data.x,y:bt.data.y})}),wt})}}const Rg=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.min(n,i):Math.min(n,i)===r.rows?r.rows=t:r.cols=t,e},_g=(r,t)=>{let e;const n=r.rows||5,i=r.cols||5;return t==null?e=Math.max(n,i):Math.max(n,i)===r.rows?r.rows=t:r.cols=t,e},_y=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,NC=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,kC=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},xP=(r,t,e,n,i,a,s,o)=>{let A,l;const c=i[r.id];if(c)A=c.col*e+e/2+t[0],l=c.row*n+n/2+t[1];else{for(;_y(o,s);)kC(a,s);A=s.col*e+e/2+t[0],l=s.row*n+n/2+t[1],NC(o,s),kC(a,s)}r.data.x=A,r.data.y=l},CP=(r,t,e)=>{try{const n=TA.mul(TA.pow(t,2),-.5),i=n.mean("row"),a=n.mean("column"),s=n.mean();n.add(s).subRowVector(i).subColumnVector(a);const o=new bC(n),A=TA.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(l=>TA.mul([l],[A]).toJSON()[0].splice(0,r))}catch(n){const i=[];for(let a=0;a{const e=Object.assign(Object.assign({},MP),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:A,focusIdx:l,radii:c=[],nodeSizeFunc:u}=e,h=r.getAllNodes(),d=[],f=a/10;for(let g=0;g{d[m]={x:0,y:0}}),FP(h,n,d,s,c,u),OP(n,d,o,A,l,f,a,c);return n},FP=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((A,l)=>{if(o===l||i[o]!==i[l])return;let c=s.x-A.x,u=s.y-A.y,h=Math.sqrt(c*c+u*u);if(h===0){h=1;const d=o>l?1:-1;c=.01*d,u=.01*d}if(h{const A=a||s/10;return n&&t.forEach((l,c)=>{const u=r[c].x-r[i].x,h=r[c].y-r[i].y,d=Math.sqrt(u*u+h*h);let f=h/d,g=-u/d;const v=Math.sqrt(l.x*l.x+l.y*l.y);let m=Math.acos((f*l.x+g*l.y)/v);m>Math.PI/2&&(m-=Math.PI/2,f*=-1,g*=-1);const w=Math.cos(m)*v;l.x=f*w,l.y=g*w}),r.forEach((l,c)=>{if(c===i)return;const u=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(u>0&&c!==i){const h=Math.min(A*(e/SP),u);if(l.x+=t[c].x/u*h,l.y+=t[c].y/u*h,n){let d=l.x-r[i].x,f=l.y-r[i].y;const g=Math.sqrt(d*d+f*f);d=d/g*o[c],f=f/g*o[c],l.x=r[i].x+d,l.y=r[i].y+f}}}),r},IP={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class LP{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},IP),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:A,unitRadius:l,nodeSize:c,nodeSpacing:u,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:g,linkDistance:v=50,sortStrength:m=10,maxIteration:w=1e3}=i,C=e.getAllNodes(),F=e.getAllEdges(),Q=!a&&typeof window!="undefined"?window.innerWidth:a,D=!s&&typeof window!="undefined"?window.innerHeight:s,K=o||[Q/2,D/2];if(!(C!=null&&C.length)||C.length===1)return Fl(e,t,K);let G=C[0];if(gn(A)){for(let Re=0;ReK[0]?K[0]:Q-K[0],bt=D-K[1]>K[1]?K[1]:D-K[1];wt===0&&(wt=Q/2),bt===0&&(bt=D/2);const Rt=Math.min(wt,bt),Pt=Math.max(...pt),xt=[],Ft=l||Rt/Pt;pt.forEach((Re,nn)=>{xt[nn]=Re*Ft});const _t=NP(C,at,v,xt,Ft,g,m),Xt=kP(_t),ie=CP(v,_t,v);let le=ie.map(([Re,nn])=>({x:(isNaN(Re)?Math.random()*v:Re)-ie[J][0],y:(isNaN(nn)?Math.random()*v:nn)-ie[J][1]}));this.run(w,le,Xt,_t,xt,J);let ve;if(d){ve=Iy(c,u);const Re={nodes:C,nodeSizeFunc:ve,positions:le,radii:xt,height:D,width:Q,strictRadial:!!h,focusIdx:J,iterations:f||200,k:le.length/4.5};le=TP(e,Re)}const xe=[];return le.forEach((Re,nn)=>{const mn=Qa(C[nn]);mn.data.x=Re.x+K[0],mn.data.y=Re.y+K[1],xe.push(mn)}),t&&xe.forEach(Re=>e.mergeNodeData(Re.id,{x:Re.data.x,y:Re.data.y})),{nodes:xe,edges:F}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const A=o/t;this.oneIteration(A,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((A,l)=>{const c=SC(A,{x:0,y:0}),u=c===0?0:1/c;if(l===s)return;let h=0,d=0,f=0;e.forEach((v,m)=>{if(l===m)return;const w=SC(A,v),C=w===0?0:1/w,F=i[m][l];f+=a[l][m],h+=a[l][m]*(v.x+F*(A.x-v.x)*C),d+=a[l][m]*(v.y+F*(A.y-v.y)*C)});const g=n[l]===0?0:1/n[l];f*=o,f+=t*g*g,h*=o,h+=t*g*A.x*u,A.x=h/f,d*=o,d+=t*g*A.y*u,A.y=d/f})}}const NP=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const A={};t.forEach((l,c)=>{const u=[];l.forEach((h,d)=>{var f,g;if(c===d)u.push(0);else if(n[c]===n[d])if(a==="data")u.push(h*(Math.abs(c-d)*s)/(n[c]/i));else if(a){let v,m;if(A[r[c].id])v=A[r[c].id];else{const w=(a==="id"?r[c].id:(f=r[c].data)===null||f===void 0?void 0:f[a])||0;gn(w)?v=w.charCodeAt(0):v=w,A[r[c].id]=v}if(A[r[d].id])m=A[r[d].id];else{const w=(a==="id"?r[d].id:(g=r[d].data)===null||g===void 0?void 0:g[a])||0;gn(w)?m=w.charCodeAt(0):m=w,A[r[d].id]=m}u.push(h*(Math.abs(v-m)*s)/(n[c]/i))}else u.push(h*e/(n[c]/i));else{const v=(e+i)/2;u.push(h*v)}}),o.push(u)})}return o},kP=r=>{const t=r.length,e=r[0].length,n=[];for(let i=0;i{let e=-1;return r.forEach((n,i)=>{n.id===t&&(e=i)}),Math.max(e,0)},UP=(r,t,e)=>{const n=r.length;for(let i=0;i{let e=0;for(let n=0;ne?r[t][n]:e);return e},DP={center:[0,0],width:300,height:300};class RP{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},DP),t)}execute(t,e){return(0,z.mG)(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return(0,z.mG)(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return(0,z.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,A=e.getAllNodes(),l=.9,c=!s&&typeof window!="undefined"?window.innerWidth:s,u=!o&&typeof window!="undefined"?window.innerHeight:o,h=a||[c/2,u/2],d=[];return A&&A.forEach(g=>{d.push({id:g.id,data:{x:(Math.random()-.5)*l*c+h[0],y:(Math.random()-.5)*l*u+h[1]}})}),t&&d.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:e.getAllEdges()}})}}function _P(r){var t,e,n,i=r||1;function a(o,A){++t>i&&(n=e,s(1),++t),e[o]=A}function s(o){t=0,e=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return e[o]!==void 0||n[o]!==void 0},get:function(o){var A=e[o];if(A!==void 0)return A;if((A=n[o])!==void 0)return a(o,A),A},set:function(o,A){e[o]!==void 0?e[o]=A:a(o,A)}}}var Hy=new Map;function Gy(r,t,e){e===void 0&&(e=128);var n=function(){for(var i=[],a=0;a2))return t[0]}formatSize(t){const e=typeof t=="function"?t:()=>t;return n=>ka(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:A}=this.context,l=this.formatSize(s);let c=l(t)[0]+i(t);const u=(C,F=0)=>{var Q;return F+=n*((C.children||[]).length+1),(Q=C.children)===null||Q===void 0||Q.forEach(D=>{var K;(K=A.getNodeLikeDatum(D).children)===null||K===void 0||K.forEach(J=>{const $=A.getNodeLikeDatum(J);F=u($,F)})}),F},h=C=>{if(C.depth===1)return c;const F=A.getParentData(C.id,"tree");if(Kc(C)){const Q=A.getParentData(F.id,"tree"),D=g(C)-g(Q);return h(F)+D*n/a}else{const Q=(F.children||[]).indexOf(C.id),D=A.getNodeData((F.children||[]).slice(Q));return d(F)-D.reduce((K,G)=>K+u(G),0)-l(F)[0]/2}},d=Gy(C=>{if(Ky(C))return l(C)[0]/2;const F=A.getParentData(C.id,"tree");if(Kc(C))return h(C)+u(C)+l(C)[0]/2;{const Q=g(C)-g(F),D=n/a;return h(C)+Q*D}},C=>C.id),f=C=>g(A.getParentData(C,"tree")),g=Gy(C=>{if(Ky(C))return o/2;if(Kc(C)){const F=A.getParentData(C.id,"tree"),Q=F.children.indexOf(C.id);if(Q===0)return f(F.id)+a;const D=A.getNodeLikeDatum(F.children[Q-1]);if(ro(D.children))return g(D)+a;const K=A.getDescendantsData(D.id);return Math.max(...K.map(G=>Kc(G)?f(G.id):g(G)))+a}else{if(ro(C.children))return f(C.id)+a;const F=A.getNodeLikeDatum(C.children.slice(-1)[0]);if(ro(F.children))return g(F)+a;const Q=A.getDescendantsData(C.id).slice(-1)[0];return(Kc(Q)?f(Q.id):g(Q))+a}},C=>C.id);let v=0;const m={nodes:[],edges:[]},w=C=>{var F;(F=C.children)===null||F===void 0||F.forEach(J=>w(A.getNodeLikeDatum(J)));const Q=g(C),D=d(C);if(m.nodes.push({id:C.id,x:D,y:Q}),Ky(C))return;const K=A.getRelatedEdgesData(C.id,"in")[0],G=[h(C),Kc(C)?Q:f(C.id)];m.edges.push({id:Qt(K),controlPoints:[G],relatedNodeId:C.id}),v=Math.max(v,D+i(C)),C.depth===1&&(c=v)};return w(t),m}placeAlterative(t,e){const n=(e.children||[]).filter((o,A)=>A%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const A=i.getAncestorsData(o,"tree");if(ro(A))return!1;const l=A.length===1?o:A[A.length-2].id;return n.includes(l)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(A=>[A[0],2*a-A[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return HP(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},Hg.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(h=>o(h)[0])));let A=this.doLayout(s,n);this.placeAlterative(A,s),i==="RL"&&(A=this.rightToLeft(A,n));const{model:l}=this.context,c=[],u=[];return A.nodes.forEach(h=>{const{id:d,x:f,y:g}=h,v=l.getNodeLikeDatum(d);c.push(QC(v,{x:f,y:g}))}),A.edges.forEach(h=>{const{id:d,controlPoints:f}=h,g=l.getEdgeDatum(d);u.push(QC(g,{controlPoints:f}))}),{nodes:c,edges:u}})}}Hg.defaultOptions={direction:"RL",getRibSep:()=>60};const QC=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),Ky=r=>r.depth===0,Kc=r=>(r.depth||(r.depth=0))%2===0;var GP=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Gg extends Mg{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=ka(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,A=h=>{o.has(h)||(o.add(h),s[h].forEach(A))};if(A(e[0].id),o.size!==e.length)return!1;const l=e.filter(h=>i[h.id]===0),c=e.filter(h=>a[h.id]===0);return!(l.length!==1||c.length!==1||e.filter(h=>i[h.id]===1&&a[h.id]===1).length!==e.length-2)}execute(t,e){return GP(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:A,rowGap:l,clockwise:c,width:u,height:h}=Object.assign({},Gg.defaultOptions,this.options,e),[d,f,g,v]=La(a),m=this.formatSize(t.nodes||[],i),w=Math.ceil((t.nodes||[]).length/o);let C=A||(u-v-f-o*m[0])/(o-1),F=l||(h-d-g-w*m[1])/(w-1);return(F===1/0||F<0)&&(F=0),(C===1/0||C<0)&&(C=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):KP(t))||[]).map((K,G)=>{const J=Math.floor(G/o),$=G%o,at=c?J%2===0?$:o-1-$:J%2===0?o-1-$:$,At=v+at*(m[0]+C)+m[0]/2,pt=d+J*(m[1]+F)+m[1]/2;return{id:K.id,style:{x:At,y:pt}}})}})}}Gg.defaultOptions={padding:0,cols:5,clockwise:!0};function KP(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),A=t.find(l=>l.id===o);s.push(A),i[o].forEach(l=>{n[l]--,n[l]===0&&a.push(l)})}return s}const zP=["rgb(158, 1, 66)","rgb(213, 62, 79)","rgb(244, 109, 67)","rgb(253, 174, 97)","rgb(254, 224, 139)","rgb(255, 255, 191)","rgb(230, 245, 152)","rgb(171, 221, 164)","rgb(102, 194, 165)","rgb(50, 136, 189)","rgb(94, 79, 162)"],VP=["rgb(78, 121, 167)","rgb(242, 142, 44)","rgb(225, 87, 89)","rgb(118, 183, 178)","rgb(89, 161, 79)","rgb(237, 201, 73)","rgb(175, 122, 161)","rgb(255, 157, 167)","rgb(156, 117, 95)","rgb(186, 176, 171)"],WP=["rgb(255, 245, 235)","rgb(254, 230, 206)","rgb(253, 208, 162)","rgb(253, 174, 107)","rgb(253, 141, 60)","rgb(241, 105, 19)","rgb(217, 72, 1)","rgb(166, 54, 3)","rgb(127, 39, 4)"],ZP=["rgb(247, 252, 245)","rgb(229, 245, 224)","rgb(199, 233, 192)","rgb(161, 217, 155)","rgb(116, 196, 118)","rgb(65, 171, 93)","rgb(35, 139, 69)","rgb(0, 109, 44)","rgb(0, 68, 27)"],jP=["rgb(247, 251, 255)","rgb(222, 235, 247)","rgb(198, 219, 239)","rgb(158, 202, 225)","rgb(107, 174, 214)","rgb(66, 146, 198)","rgb(33, 113, 181)","rgb(8, 81, 156)","rgb(8, 48, 107)"];var YP=function(r,t,e){if(!Ni(r)&&!Qc(r))return r;var n=e;return Vb(r,function(i,a){n=t(n,i,a)}),n},XP=YP,zy=function(r,t){return XP(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})};class mi extends Zm{}function zc(r,t=!0,e){const n=document.createElement("div");return n.setAttribute("class",`g6-${r}`),Object.assign(n.style,{position:"absolute",display:"block"}),t&&Object.assign(n.style,{position:"unset",gridArea:"1 / 1 / 2 / 2",inset:"0px",height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none"}),e&&Object.assign(n.style,e),n}function Vy(r,t="div",e={},n="",i=document.body){const a=document.getElementById(r);a&&a.remove();const s=document.createElement(t);return s.innerHTML=n,s.id=r,Object.assign(s.style,e),i.appendChild(s),s}var JP=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Kg extends mi{constructor(t,e){super(t,Object.assign({},Kg.defaultOptions,e)),this.$element=zc("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return JP(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,zy(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}Kg.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function Wy(r,t,e,n,i,a){const s=r,o=t,A=e-s,l=n-o;let c=i-s,u=a-o,h=c*A+u*l,d=0;h<=0?d=0:(c=A-c,u=l-u,h=c*A+u*l,h<=0?d=0:d=h*h/(A*A+l*l));const f=c*c+u*u-d;return f<0?0:f}function OA(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function UC(r,t,e,n,i){return OA(r,t,e,n)e;if(r===0)return Math.round;const t=Math.pow(10,r);return e=>Math.round(e*t)/t}function PC(r){const t=Math.min(r.x1,r.x2),e=Math.max(r.x1,r.x2),n=Math.min(r.y1,r.y2),i=Math.max(r.y1,r.y2);return{x:t,y:n,x2:e,y2:i,width:e-t,height:i-n}}class yi{constructor(t,e,n,i){this.x1=t,this.y1=e,this.x2=n,this.y2=i}equals(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}draw(t){t.moveTo(this.x1,this.y1),t.lineTo(this.x2,this.y2)}toString(){return`Line(from=(${this.x1},${this.y1}),to=(${this.x2},${this.y2}))`}static from(t){return new yi(t.x1,t.y1,t.x2,t.y2)}cuts(t,e){if(this.y1===this.y2||ethis.y1&&e>=this.y2||t>this.x1&&t>=this.x2)return!1;if(tthis.x2+n)return!1}else if(tthis.x1+n)return!1;if(this.y1this.y2+n)return!1}else if(ethis.y1+n)return!1;return!0}}var Ir;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Ir||(Ir={}));class Zy{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function zg(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;return 0<=a&&a<=1&&0<=s&&s<=1?new Zy(Ir.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Zy(Ir.NONE)}return new Zy(e===0||n===0?Ir.COINCIDENT:Ir.PARALLEL)}function DC(r,t){const e=(t.x2-t.x1)*(r.y1-t.y1)-(t.y2-t.y1)*(r.x1-t.x1),n=(r.x2-r.x1)*(r.y1-t.y1)-(r.y2-r.y1)*(r.x1-t.x1),i=(t.y2-t.y1)*(r.x2-r.x1)-(t.x2-t.x1)*(r.y2-r.y1);if(i){const a=e/i,s=n/i;if(0<=a&&a<=1&&0<=s&&s<=1)return a}return Number.POSITIVE_INFINITY}function $P(r,t){function e(i,a,s,o){let A=DC(t,new yi(i,a,s,o));return A=Math.abs(A-.5),A>=0&&A<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var Lr;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(Lr||(Lr={}));function Vg(r,t,e){const n=new Set;return r.width<=0?(n.add(Lr.LEFT),n.add(Lr.RIGHT)):tr.x+r.width&&n.add(Lr.RIGHT),r.height<=0?(n.add(Lr.TOP),n.add(Lr.BOTTOM)):er.y+r.height&&n.add(Lr.BOTTOM),n}function RC(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(Vg(r,i,a));if(s.length===0)return!0;let o=Vg(r,e,n);for(;o.size!==0;){for(const A of s)if(o.has(A))return!1;if(o.has(Lr.RIGHT)||o.has(Lr.LEFT)){let A=r.x;o.has(Lr.RIGHT)&&(A+=r.width),n=n+(A-e)*(a-n)/(i-e),e=A}else{let A=r.y;o.has(Lr.BOTTOM)&&(A+=r.height),e=e+(A-n)*(i-e)/(a-n),n=A}o=Vg(r,e,n)}return!0}function tD(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,A){let l=DC(t,new yi(a,s,o,A));l=Math.abs(l-.5),l>=0&&l<=1&&(n++,l1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function eD(r,t){let e=0;const n=zg(r,new yi(t.x,t.y,t.x2,t.y));e+=n.state===Ir.POINT?1:0;const i=zg(r,new yi(t.x,t.y,t.x,t.y2));e+=i.state===Ir.POINT?1:0;const a=zg(r,new yi(t.x,t.y2,t.x2,t.y2));e+=a.state===Ir.POINT?1:0;const s=zg(r,new yi(t.x2,t.y,t.x2,t.y2));return e+=s.state===Ir.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Ri{constructor(t,e,n,i){this.x=t,this.y=e,this.width=n,this.height=i}get x2(){return this.x+this.width}get y2(){return this.y+this.height}get cx(){return this.x+this.width/2}get cy(){return this.y+this.height/2}get radius(){return Math.max(this.width,this.height)/2}static from(t){return new Ri(t.x,t.y,t.width,t.height)}equals(t){return this.x===t.x&&this.y===t.y&&this.width===t.width&&this.height===t.height}clone(){return new Ri(this.x,this.y,this.width,this.height)}add(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x+t.width),a=Math.max(this.y2,t.y+t.height);this.x=e,this.y=n,this.width=i-e,this.height=a-n}addPoint(t){const e=Math.min(this.x,t.x),n=Math.min(this.y,t.y),i=Math.max(this.x2,t.x),a=Math.max(this.y2,t.y);this.x=e,this.y=n,this.width=i-e,this.height=a-n}toString(){return`Rectangle[x=${this.x}, y=${this.y}, w=${this.width}, h=${this.height}]`}draw(t){t.rect(this.x,this.y,this.width,this.height)}containsPt(t,e){return t>=this.x&&t<=this.x2&&e>=this.y&&e<=this.y2}get area(){return this.width*this.height}intersects(t){return this.area<=0||t.width<=0||t.height<=0?!1:t.x+t.width>this.x&&t.y+t.height>this.y&&t.x=this.width?this.width-1:t}boundY(t){return t=this.height?this.height-1:t}scaleX(t){return this.boundX(Math.floor((t-this.pixelX)/this.pixelGroup))}scaleY(t){return this.boundY(Math.floor((t-this.pixelY)/this.pixelGroup))}scale(t){const e=this.scaleX(t.x),n=this.scaleY(t.y),i=this.boundX(Math.ceil((t.x+t.width-this.pixelX)/this.pixelGroup)),a=this.boundY(Math.ceil((t.y+t.height-this.pixelY)/this.pixelGroup)),s=i-e,o=a-n;return new Ri(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),A=s-i,l=o-a;return new Ri(i,a,A,l)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),A=Math.min(t.j+t.height,this.height);if(!(A<=0||o<=0||a>=n||A>=this.height))for(let l=s;lMath.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;se?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function _C(r,t){const e=n=>({x:n.x-t,y:n.y-t,width:n.width+2*t,height:n.height+2*t});return Array.isArray(r)?r.map(e):e(r)}function HC(r,t,e){return GC(Object.assign(PC(r),{distSquare:(n,i)=>Wy(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function GC(r,t,e){const n=_C(r,e),i=t.scale(n),a=t.createSub(i,n);return rD(a,t,e,(s,o)=>r.distSquare(s,o)),a}function rD(r,t,e,n){const i=e*e;for(let a=0;a{const o=i.slice(0,s);return sD(t,a,o,e,n)}).flat()}function sD(r,t,e,n,i){const a=fr(t.cx,t.cy),s=lD(a,e,r);if(s==null)return[];const o=new yi(a.x,a.y,s.cx,s.cy),A=oD(o,r,n,i);return AD(A,r)}function oD(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o0;){const A=a.pop(),l=KC(t,A),c=l?eD(A,l):null;if(!l||!c||c.count!==2){s||i.push(A);continue}let u=n,h=jg(l,u,c,!0),d=IA(h,a)||IA(h,i),f=Zg(h,t);for(;!d&&f&&u>=1;)u/=1.5,h=jg(l,u,c,!0),d=IA(h,a)||IA(h,i),f=Zg(h,t);if(h&&!d&&!f&&(a.push(new yi(A.x1,A.y1,h.x,h.y)),a.push(new yi(h.x,h.y,A.x2,A.y2)),s=!0),s)continue;u=n,h=jg(l,u,c,!1);let g=IA(h,a)||IA(h,i);for(f=Zg(h,t);!g&&f&&u>=1;)u/=1.5,h=jg(l,u,c,!1),g=IA(h,a)||IA(h,i),f=Zg(h,t);h&&!g&&(a.push(new yi(A.x1,A.y1,h.x,h.y)),a.push(new yi(h.x,h.y,A.x2,A.y2)),s=!0),s||i.push(A)}for(;a.length>0;)i.push(a.pop());return i}function AD(r,t){const e=[];for(;r.length>0;){const n=r.pop();if(r.length===0){e.push(n);break}const i=r.pop(),a=new yi(n.x1,n.y1,i.x2,i.y2);KC(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function lD(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=OA(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new yi(r.x,r.y,a.cx,a.cy),A=uD(e,o);return s*(A+1)*(A+1){t+=n.cx,e+=n.cy}),t/=r.length,e/=r.length,r.map(n=>{const i=t-n.cx,a=e-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function Zg(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function IA(r,t){return t.some(e=>!!(UC(e.x1,e.y1,r.x,r.y,.001)||UC(e.x2,e.y2,r.x,r.y,.001)))}function KC(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!RC(i,t))continue;const a=tD(i,t);a>=0&&aRC(n,t)&&$P(n,t)?e+1:e,0)}function jg(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Ir.POINT){if(i.state===Ir.POINT)return fr(r.x-t,r.y-t);if(s.state===Ir.POINT)return fr(r.x-t,r.y2+t);const h=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)o.y?fr(r.x-t,r.y-t):fr(r.x2+t,r.y-t):a.ys.x?fr(r.x-t,r.y-t):fr(r.x-t,r.y2+t):i.xo.y?fr(r.x2+t,r.y2+t):fr(r.x-t,r.y2+t):a.ys.x?fr(r.x2+t,r.y2+t):fr(r.x2+t,r.y-t):i.xn)return!1}return!0}function dD(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n{if(s.length<3)return s;const o=[],A=s.closed,l=s.length+3-1+(A?0:2);o.push(a(s,2-(A?0:2),0));for(let c=2-(A?0:2);c{let e=r,n=t.length;if(e>1)for(n=Math.floor(t.length/e);n<3&&e>1;)e-=1,n=Math.floor(t.length/e);const i=[];for(let a=0,s=0;s=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(e.length===0)return"";const n=typeof t=="function"?t:qP(t);let i="M";for(const a of e)i+=`${n(a.x)},${n(a.y)} L`;return i=i.slice(0,-1),this.closed&&(i+=" Z"),i}draw(t){const e=this.points;if(e.length!==0){t.beginPath(),t.moveTo(e[0].x,e[0].y);for(const n of e)t.lineTo(n.x,n.y);this.closed&&t.closePath()}}sample(t){return vD(t)(this)}simplify(t){return dD(t)(this)}bSplines(t){return gD(t)(this)}apply(t){return t(this)}containsElements(t){const e=nD(this.points);return e?t.every(n=>e.containsPt(n.cx,n.cy)&&this.withinArea(n.cx,n.cy)):!1}withinArea(t,e){if(this.length===0)return!1;let n=0;const i=this.points[0],a=new yi(i.x,i.y,i.x,i.y);for(let s=1;st?c+u:c}function a(A,l){let c=Lh;return c=i(A,l,c,1),c=i(A+1,l,c,2),c=i(A,l+1,c,4),c=i(A+1,l+1,c,8),Number.isNaN(c)?-1:c}let s=Yg;function o(A,l){let c=A,u=l,h=r.invertScaleX(c),d=r.invertScaleY(u);for(let f=0;fzC(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Ms.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>zC(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Ms.NON_MEMBERS),!0)}removeEdge(t){const e=this.edges.findIndex(n=>n.obj.equals(t));return e<0?!1:(this.edges.splice(e,1),this.dirty.add(Ms.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Ms.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:Nh(e)?Wg.from(e):Ri.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Ms.EDGES);for(const e of t)this.edges.push({raw:e,obj:yi.from(e),area:null})}}update(){const t=this.dirty.has(Ms.MEMBERS),e=this.dirty.has(Ms.NON_MEMBERS);let n=this.dirty.has(Ms.EDGES);this.dirty.clear();const i=this.members.map(l=>l.obj);if(this.o.virtualEdges&&(t||e)){const l=this.nonMembers.map(h=>h.obj),c=aD(i,l,this.o.maxRoutingIterations,this.o.morphBuffer),u=new Map(this.virtualEdges.map(h=>[h.obj.toString(),h.area]));this.virtualEdges=c.map(h=>{var d;return{raw:h,obj:h,area:(d=u.get(h.toString()))!==null&&d!==void 0?d:null}}),n=!0}let a=!1;if(t||n){const l=this.virtualEdges.concat(this.edges).map(d=>d.obj),c=wD(i,l),u=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,h=Ri.from(_C(c,u));h.equals(this.activeRegion)||(a=!0,this.activeRegion=h)}if(a){const l=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Ol.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(u=>u.area=null),this.nonMembers.forEach(u=>u.area=null),this.edges.forEach(u=>u.area=null),this.virtualEdges.forEach(u=>u.area=null)):(l!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Ol.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=l=>{if(l.area){const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Ri?"R":"C"}`;s.set(c,l.area)}},A=l=>{if(l.area)return;const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Ri?"R":"C"}`;if(s.has(c)){const h=s.get(c);l.area=this.potentialArea.copy(h,{x:l.obj.x-this.o.nodeR1,y:l.obj.y-this.o.nodeR1});return}const u=l.obj instanceof Ri?iD(l.obj,this.potentialArea,this.o.nodeR1):GC(l.obj,this.potentialArea,this.o.nodeR1);l.area=u,s.set(c,u)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(A),this.nonMembers.forEach(l=>{this.activeRegion.intersects(l.obj)?A(l):l.area=null}),this.edges.forEach(l=>{l.area||(l.area=HC(l.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(l=>{l.area||(l.area=HC(l.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new Il([]);this.dirty.size>0&&this.update();const{o:t,potentialArea:e}=this,n=this.members.map(o=>o.area),i=this.virtualEdges.concat(this.edges).map(o=>o.area),a=this.nonMembers.filter(o=>o.area!=null).map(o=>o.area),s=this.members.map(o=>o.obj);return yD(e,n,i,a,o=>o.containsElements(s),t)}}function yD(r,t,e,n,i,a={}){const s=Object.assign({},Jg,a);let o=s.threshold,A=s.memberInfluenceFactor,l=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const u=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),h=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let d=0;d0)c*=.8;else break}return new Il([])}function wD(r,t){if(r.length===0)return new Ri(0,0,0,0);const e=Ri.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(PC(n));return e}function HG(r,t=[],e=[],n={}){if(r.length===0)return new Il([]);const i=new Yy(n);return i.pushMember(...r),i.pushNonMember(...t),i.pushEdge(...e),i.compute()}var ED=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const{style:n,bubbleSetOptions:i}=this.parseOptions();Dr(this.bubbleSetOptions,i)||this.init(),this.bubbleSetOptions=Object.assign({},i);const a=Object.assign(Object.assign({},n),{d:this.getPath()});this.shape?this.shape.update(a):(this.shape=new wh({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=Qt(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,A=[...this.avoidMembers.keys()];if(a.length===0&&o.length===0)return this.members.clear(),this.avoidMembers.clear(),this.path=[],this.path;if(!n&&this.path&&Dr(a,s)&&Dr(o,A))return this.path;const{enter:l=[],exit:c=[]}=mA(s,a,v=>v),{enter:u=[],exit:h=[]}=mA(A,o,v=>v);if(n){const v=a.includes(n),m=o.includes(n);v&&(c.push(n),l.push(n)),m&&(h.push(n),u.push(n))}const d=(v,m,w)=>{v.forEach(C=>{const F=w?this.members:this.avoidMembers,Q=w?"pushMember":"pushNonMember",D=w?"removeMember":"removeNonMember";if(m){let K;i.getElementType(C)==="edge"?([K]=bD(i,C),this.bubbleSets.pushEdge(K)):([K]=BD(i,C),this.bubbleSets[Q](K)),F.set(C,K)}else{const K=F.get(C);K&&(i.getElementType(C)==="edge"?this.bubbleSets.removeEdge(K):this.bubbleSets[D](K),F.delete(C))}})};d(c,!1,!0),d(l,!0,!0),d(h,!1,!1),d(u,!0,!1);const g=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=Fb(g.points.map(Si)),this.path},this.bindEvents(),this.bubbleSets=new Yy(this.options)}bindEvents(){this.context.graph.on(Ae.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(Ae.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new Yy(this.options),this.members.clear(),this.avoidMembers.clear(),this.path=null}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=ED(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((A,l)=>(l in Jg?A.bubbleSetOptions[l]=s[l]:A.style[l]=s[l],A),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Wt(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(Ae.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(Ae.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape&&(this.shape.destroy(),this.shape=void 0),super.destroy()}}qg.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},Jg);const BD=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Ri(i.min[0],i.min[1],to(i),eo(i))}),bD=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getEdgeData(n),a=r.getElementPosition(i.source),s=r.getElementPosition(i.target);return yi.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});class GG extends null{constructor(t,e){super(t,e),this.setOptions=n=>{const i={cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"},a=(s,o)=>{switch(s){case"projectionMode":return o==="perspective"?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[o];case"aspect":return typeof o=="number"?o:this.getCanvasAspect();default:return o}};Object.entries(i).forEach(([s,o])=>{const A=n[s];if(A!==void 0){const l=a(s,A);this.context.canvas.getCamera()[o](l)}})},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(GraphEvent.BEFORE_DRAW,()=>this.setOptions(this.options))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}}function xD(r){return`
    ${r.map(t=>`
  • ${t.name}
  • `).join("")}
`}const CD=` .g6-contextmenu { font-size: 12px; background-color: rgba(255, 255, 255, 0.96); border-radius: 4px; overflow: hidden; box-shadow: rgba(0, 0, 0, 0.12) 0px 6px 12px 0px; transition: visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1) 0s, left 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s, top 0.4s cubic-bezier(0.23, 1, 0.32, 1) 0s; } .g6-contextmenu-ul { max-width: 256px; min-width: 96px; list-style: none; padding: 0; margin: 0; } .g6-contextmenu-li { padding: 8px 12px; cursor: pointer; user-select: none; } .g6-contextmenu-li:hover { background-color: #f5f5f5; cursor: pointer; } `;var VC=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class $g extends mi{constructor(t,e){super(t,Object.assign({},$g.defaultOptions,e)),this.targetElement=null,this.onTriggerEvent=n=>{var i;(i=n.preventDefault)===null||i===void 0||i.call(n),this.show(n)},this.onMenuItemClick=n=>{const{onClick:i,trigger:a}=this.options;if(n.target instanceof HTMLElement&&n.target.className.includes("g6-contextmenu-li")){const s=n.target.getAttribute("value");i==null||i(s,n.target,this.targetElement),this.hide()}a!=="click"&&this.hide()},this.initElement(),this.update(e)}initElement(){this.$element=zc("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),Vy("g6-contextmenu-css","style",{},CD,document.head)}show(t){return VC(this,void 0,void 0,function*(){const{enable:e,offset:n}=this.options;if(typeof e=="function"&&!e(t)||!e){this.hide();return}const i=yield this.getDOMContent(t);i instanceof HTMLElement?(this.$element.innerHTML="",this.$element.appendChild(i)):this.$element.innerHTML=i;const a=this.context.graph.getCanvas().getContainer().getBoundingClientRect();this.$element.style.left=`${t.client.x-a.left+n[0]}px`,this.$element.style.top=`${t.client.y-a.top+n[1]}px`,this.$element.style.display="block",this.targetElement=t.target})}hide(){this.$element.style.display="none",this.targetElement=null}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy(),this.$element.remove()}getDOMContent(t){return VC(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?xD(yield n(t)):yield e(t)})}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`canvas:${e}`,this.onTriggerEvent),t.on(`node:${e}`,this.onTriggerEvent),t.on(`edge:${e}`,this.onTriggerEvent),t.on(`combo:${e}`,this.onTriggerEvent),document.addEventListener("click",this.onMenuItemClick)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`canvas:${e}`,this.onTriggerEvent),t.off(`node:${e}`,this.onTriggerEvent),t.off(`edge:${e}`,this.onTriggerEvent),t.off(`combo:${e}`,this.onTriggerEvent),document.removeEventListener("click",this.onMenuItemClick)}}$g.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'
Loading...
',getContent:()=>"It is a empty context menu.",enable:()=>!0};class t0 extends mi{constructor(t,e){super(t,Object.assign({},t0.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:A}=this.options;let{lambda:l,divisions:c,iterations:u}=this.options;for(let h=0;h{var v;if(g.source===g.target)return;const m=Qt(g);f[m]=this.getEdgeForces(g,c,l);for(let w=0;w{const d=Qt(h),f=i.getElement(d);f==null||f.update({d:uy(this.edgePoints[d])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[Qt(e),yl(Ai(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=Qt(n);(i=this.edgePoints)[a]||(i[a]=[]);const s=this.nodeMap[n.source],o=this.nodeMap[n.target];if(t===1)this.edgePoints[a].push(s),this.edgePoints[a].push(bs(tn(s,o),2)),this.edgePoints[a].push(o);else{const l=(this.edgePoints[a].length===0?lr(s,o):OD(this.edgePoints[a]))/(t+1);let c=l;const u=[s];for(let h=1;hc;){const v=c/g,m=tn(d,Bs(tr(f,d),v));u.push(m),g-=c,c=l}c-=g}u.push(o),this.edgePoints[a]=u}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=tr(n,e),s=lr(e,n);return{source:e,target:n,vx:i,vy:a,length:s}}measureEdgeCompatibility(t,e){const n=this.getVectorPosition(t),i=this.getVectorPosition(e),a=SD(n,i),s=MD(n,i),o=TD(n,i),A=FD(n,i);return a*s*o*A}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var A,l;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[A=Qt(i)]||(t[A]=[]),t[Qt(i)].push(s),t[l=Qt(s)]||(t[l]=[]),t[Qt(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Bs(tr(tn(n,a),Bs(i,2)),e)}getElectrostaticForce(t,e){ro(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[Qt(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[Qt(a)][t],o=this.edgePoints[Qt(e)][t],A=tr(s,o),l=lr(s,o);i=tn(i,Bs(A,1/l))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(lr(i,a)*(e+1)),o=[[0,0]],A=Qt(t);for(let l=1;lMath.abs(RL([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),MD=(r,t)=>{const e=(r.length+t.length)/2;return 2/(e/Math.min(r.length,t.length)+Math.max(r.length,t.length)/e)},TD=(r,t)=>{const e=(r.length+t.length)/2,n=bs(tn(r.source,r.target),2),i=bs(tn(t.source,t.target),2);return e/(e+lr(n,i))},WC=(r,t)=>{if(t.source[0]===t.target[0])return[t.source[0],r[1]];if(t.source[1]===t.target[1])return[r[0],t.source[1]];const e=(t.source[1]-t.target[1])/(t.source[0]-t.target[0]),n=(e*e*t.source[0]+e*(r[1]-t.source[1])+r[0])/(e*e+1),i=e*(n-t.source[0])+t.source[1];return[n,i]},ZC=(r,t)=>{const e=WC(t.source,r),n=WC(t.target,r),i=bs(tn(e,n),2),a=bs(tn(r.source,r.target),2);return lr(e,n)===0?0:Math.max(0,1-2*lr(a,i)/lr(e,n))},FD=(r,t)=>Math.min(ZC(r,t),ZC(t,r)),OD=r=>{let t=0;for(let e=1;e{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Si(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},ID,this.options.style);this.isLensOn||(this.lens=new Bl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,xs(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:A}=a;return{nodes:s.filter(l=>n(Qt(l),"node")),edges:o.filter(l=>n(Qt(l),"edge")),combos:A.filter(l=>n(Qt(l),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(l=>lr(Ai(l),n)Qt(l)),A=a.filter(l=>{const{source:c,target:u}=l,h=o.includes(c),d=o.includes(u);switch(this.options.nodeType){case"both":return h&&d;case"either":return h!==d;case"source":return h&&!d;case"target":return!h&&d;default:return!1}});return{nodes:s,edges:A}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),A=new Set,l=c=>{const u=Qt(c);A.add(u);const h=n.getElement(u);if(!h)return;const d=this.shapes.get(u)||h.cloneNode();d.setPosition(h.getPosition()),d.id=h.id,this.shapes.has(u)?Object.entries(h.attributes).forEach(([v,m])=>{d.style[v]!==m&&(d.style[v]=m)}):(this.canvas.appendChild(d),this.shapes.set(u,d));const f=i.getElementType(u),g=this.getElementStyle(f,c);d.update(g)};s.forEach(l),o.forEach(l),this.shapes.forEach((c,u)=>{A.has(u)||(c.destroy(),this.shapes.delete(u))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:A}=n,{graph:l,canvas:c}=this.context,u=l.getCanvasByClient([a,s]),h=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||lr(u,h)>this.r)return;const{maxR:d,minR:f}=this.options,g=o+A>0?1/(1-jC):1-jC,v=Math.min(...c.getSize())/2;this.r=Math.max(f||0,Math.min(d||v,this.r*g)),this.renderLens(h),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=Si(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||lr(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Si(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(Yt.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(Yt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(Yt.DRAG_START,this.onDragStart),a.addEventListener(Yt.DRAG,this.onDrag),a.addEventListener(Yt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(Yt.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(Yt.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(Yt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(Yt.DRAG_START,this.onDragStart),a.removeEventListener(Yt.DRAG,this.onDrag),a.removeEventListener(Yt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.scaleRByWheel))}update(t){var e;this.unbindEvents(),super.update(t),this.r=(e=t.r)!==null&&e!==void 0?e:this.r,this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}e0.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const LD={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},YC=.05,XC=.1;class n0 extends mi{constructor(t,e){super(t,Object.assign({},n0.defaultOptions,e)),this.r=this.options.r,this.d=this.options.d,this.onCreateFisheye=n=>{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Si(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},LD,this.options.style);this.isLensOn||(this.lens=new Bl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,xs(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(l=>{const c=Ai(l),u=lr(c,i);if(u>this.r)return;const h=a*u/(this.d*u+this.r),[d,f]=c,[g,v]=i,m=(d-g)/u,w=(f-v)/u,C=[g+h*m,v+h*w],F=Qt(l),Q=this.getNodeStyle(l),D=xl(n.getElementRenderStyle(F),Object.keys(Q));s.set(F,Object.assign(Object.assign({},xs(C)),Q)),o.set(F,Object.assign(Object.assign({},xs(c)),D))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:A,keep:l}=mA(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),h=>h),c=new Set,u=(h,d)=>{const f=s.getElement(h);f==null||f.update(d),a.getRelatedEdgesData(h).forEach(g=>{c.add(Qt(g))})};[...o,...l].forEach(h=>{u(h,n.get(h))}),A.forEach(h=>{u(h,this.prevOriginStyleMap.get(h)),this.prevOriginStyleMap.delete(h)}),c.forEach(h=>{const d=s.getElement(h);d==null||d.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((h,d)=>{this.prevOriginStyleMap.has(d)||this.prevOriginStyleMap.set(d,h)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(lr(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-YC):1-YC,o=Math.min(...this.context.canvas.getSize())/2;this.r=Math.max(a||0,Math.min(i||o,this.r*s))},this.scaleD=n=>{const{maxD:i,minD:a}=this.options,s=n?this.d+XC:this.d-XC;this.d=Math.max(a,Math.min(i,s))},this.scaleRByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleR(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByWheel=n=>{if(!this.isWheelValid(n))return;const{deltaX:i,deltaY:a}=n;this.scaleD(i+a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.isDragValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const i=Si(n.canvas),a=this.lens.getCenter();return!(lr(i,a)>this.r)},this.isLensDragging=!1,this.onDragStart=n=>{this.isDragValid(n)&&(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Si(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(Yt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(Yt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(Yt.DRAG_START,this.onDragStart),s.addEventListener(Yt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(Yt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(Yt.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(Yt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(Yt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(Yt.DRAG_START,this.onDragStart),s.removeEventListener(Yt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(Yt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,o)}}update(t){var e,n;this.unbindEvents(),super.update(t),this.r=(e=t.r)!==null&&e!==void 0?e:this.r,this.d=(n=t.d)!==null&&n!==void 0?n:this.d,this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}n0.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class r0 extends mi{constructor(t,e){super(t,Object.assign({},r0.defaultOptions,e)),this.$el=this.context.canvas.getContainer(),this.graphSize=[0,0],this.onFullscreenChange=()=>{var n,i,a,s;const o=!!document.fullscreenElement;this.options.autoFit&&this.setGraphSize(o),o?(i=(n=this.options).onEnter)===null||i===void 0||i.call(n):(s=(a=this.options).onExit)===null||s===void 0||s.call(a)},this.shortcut=new EA(t.graph),this.bindEvents(),this.style=document.createElement("style"),document.head.appendChild(this.style),this.style.innerHTML=` :not(:root):fullscreen::backdrop { background: transparent; } `}bindEvents(){this.unbindEvents(),this.shortcut.unbindAll();const{request:t=[],exit:e=[]}=this.options.trigger;this.shortcut.bind(t,this.request),this.shortcut.bind(e,this.exit),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(i=>{document.addEventListener(i,this.onFullscreenChange,!1)})}unbindEvents(){this.shortcut.unbindAll(),["webkitfullscreenchange","mozfullscreenchange","fullscreenchange","MSFullscreenChange"].forEach(e=>{document.removeEventListener(e,this.onFullscreenChange,!1)})}setGraphSize(t=!0){var e,n;let i,a;t?(i=((e=globalThis.screen)===null||e===void 0?void 0:e.width)||0,a=((n=globalThis.screen)===null||n===void 0?void 0:n.height)||0,this.graphSize=this.context.graph.getSize()):[i,a]=this.graphSize,this.context.graph.setSize(i,a),this.context.graph.render()}request(){document.fullscreenElement||!ND()||this.$el.requestFullscreen().catch(t=>{ha.warn(`Error attempting to enable full-screen: ${t.message} (${t.name})`)})}exit(){document.fullscreenElement&&document.exitFullscreen()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.exit(),this.style.remove(),super.destroy()}}r0.defaultOptions={trigger:{},autoFit:!0};function ND(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class i0 extends mi{constructor(t,e){super(t,Object.assign({},i0.defaultOptions,e)),this.$element=zc("grid-line",!0),this.offset=[0,0],this.currentScale=1,this.followZoom=i=>{const{data:{scale:a,origin:s}}=i;if(!a||s===void 0&&this.context.viewport===void 0)return;const o=this.currentScale;this.currentScale=a;const A=a/o,l=Bs(s||this.context.graph.getCanvasCenter(),1-A),c=this.baseSize*a,u=Bs(this.offset,A),h=Ym(u,c),d=tn(h,l);this.$element.style.backgroundSize=`${c}px ${c}px`,this.$element.style.backgroundPosition=`${d[0]}px ${d[1]}px`,this.offset=Ym(d,c)},this.followTranslate=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.onTransform=i=>{const a=this.parseFollow(this.options.follow);a.zoom&&this.followZoom(i),a.translate&&this.followTranslate(i)},this.context.canvas.getContainer().prepend(this.$element),this.baseSize=this.options.size,this.updateStyle(),this.bindEvents()}update(t){super.update(t),t.size!==void 0&&(this.baseSize=t.size),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{stroke:t,lineWidth:e,border:n,borderLineWidth:i,borderStroke:a,borderStyle:s}=this.options,o=this.baseSize*this.currentScale;Object.assign(this.$element.style,{border:n?`${i}px ${s} ${a}`:"none",backgroundImage:`linear-gradient(${t} ${e}px, transparent ${e}px), linear-gradient(90deg, ${t} ${e}px, transparent ${e}px)`,backgroundSize:`${o}px ${o}px`,backgroundRepeat:"repeat"})}updateOffset(t){const e=this.baseSize*this.currentScale;this.offset=Ym(tn(this.offset,t),e),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}parseFollow(t){var e,n;return Jo(t)?{translate:t,zoom:t}:{translate:(e=t==null?void 0:t.translate)!==null&&e!==void 0?e:!1,zoom:(n=t==null?void 0:t.zoom)!==null&&n!==void 0?n:!1}}destroy(){this.context.graph.off(Ae.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}i0.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function Xy(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=Qt(i);if(n==="NodeAdded"||n==="EdgeAdded"||n==="ComboAdded")t.Added.set(a,e);else if(n==="NodeUpdated"||n==="EdgeUpdated"||n==="ComboUpdated")if(t.Added.has(a))t.Added.set(a,{type:n.replace("Updated","Added"),value:i});else if(t.Updated.has(a)){const{original:s}=t.Updated.get(a);t.Updated.set(a,{type:n,value:i,original:s})}else t.Removed.has(a)||t.Updated.set(a,e);else(n==="NodeRemoved"||n==="EdgeRemoved"||n==="ComboRemoved")&&(t.Added.has(a)?t.Added.delete(a):(t.Updated.has(a)&&t.Updated.delete(a),t.Removed.set(a,e)))}),[...Array.from(t.Added.values()),...Array.from(t.Updated.values()),...Array.from(t.Removed.values())]}function JC(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:A=[],ComboRemoved:l=[]}=Ff(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:A},remove:{nodes:n,edges:s,combos:l}}}function qC(r,t){for(const e in r)Br(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),qC(r[e],t[e])):t[e]===void 0&&(t[e]=lh(e))}function kD(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=JC(Xy(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);let h=Object.assign({},A.original);if(e){const d=e.graph.getElementType(Qt(A.original)),f=d==="edge"?"stroke":"fill",g=e.element.getElementComputedStyle(d,A.original);h=Object.assign(Object.assign({},A.original),{style:Object.assign({[f]:g[f]},A.original.style)})}qC(u,h),(l=n.current.update)[o]||(l[o]=[]),n.current.update[o].push(u),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(h)}),i[o]&&i[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);(l=n.current.add)[o]||(l[o]=[]),n.current.add[o].push(u),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(u)}),s[o]&&s[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);(l=n.current.remove)[o]||(l[o]=[]),n.current.remove[o].push(u),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(u)})}),n}class a0 extends mi{constructor(t,e){super(t,Object.assign({},a0.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,A;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const l=a?i.original:i.current;this.context.graph.addData(l.add),this.context.graph.updateData(l.update),this.context.graph.removeData(eb(l.remove,!1)),(A=this.context.element)===null||A===void 0||A.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===Ae.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(kD(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(fA.ADD,this.undoStack[this.undoStack.length-1])}},this.initBatchCommand=i=>{const{initiate:a}=i.data;this.batchAnimation=!1,a?this.batchChanges=[]:this.undoStack.pop()||(this.batchChanges=null)},this.emitter=new Cg;const{graph:n}=this.context;n.on(Ae.AFTER_DRAW,this.addCommand),n.on(Ae.BATCH_START,this.initBatchCommand),n.on(Ae.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(fA.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(fA.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(fA.CANCEL,t)),this}undoStackPush(t){var e,n,i,a;const{stackSize:s}=this.options;s!==0&&this.undoStack.length>=s&&this.undoStack.shift(),((n=(e=this.options).beforeAddCommand)===null||n===void 0?void 0:n.call(e,t,!0))!==!1&&(this.undoStack.push(t),(a=(i=this.options).afterAddCommand)===null||a===void 0||a.call(i,t,!0))}clear(){this.undoStack=[],this.redoStack=[],this.batchChanges=null,this.batchAnimation=!1,this.notify(fA.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(fA.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.addCommand),t.off(Ae.BATCH_START,this.initBatchCommand),t.off(Ae.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}a0.defaultOptions={stackSize:0};const Jy={toXy(r,t){if(!t)return[...r];const e=t[0].slice(1),n=t[1].slice(1);return r.map(i=>[i[e],i[n]])},fromXy(r,t){if(!t)return[...r];const e=t[0].slice(1),n=t[1].slice(1);return r.map(([i,a])=>({[e]:i,[n]:a}))}};class QD{constructor(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(const n of t){const i=this.coordToCellNum(n[0]),a=this.coordToCellNum(n[1]);this._cells[i]||(this._cells[i]=[]),this._cells[i][a]||(this._cells[i][a]=[]),this._cells[i][a].push(n)}}cellPoints(t,e){var n;return((n=this._cells[t])===null||n===void 0?void 0:n[e])||[]}rangePoints(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),i=this.coordToCellNum(t[2]),a=this.coordToCellNum(t[3]),s=[];for(let o=e;o<=i;o++)for(let A=n;A<=a;A++){const l=this.cellPoints(o,A);for(const c of l)s.push(c)}return s}removePoint(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),i=this._cells[e][n],a=i.findIndex(([s,o])=>s===t[0]&&o===t[1]);return a>-1&&i.splice(a,1),i}trunc(t){return Math.trunc(t)}coordToCellNum(t){return this.trunc(t*this._reverseCellSize)}extendBbox(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}}function UD(r,t){return new QD(r,t)}const $C=+(Math.pow(2,27)+1);function s0(r,t,e){const n=r*t,i=$C*r,a=i-r,s=i-a,o=r-s,A=$C*t,l=A-t,c=A-l,u=t-c,f=n-s*c-o*c-s*u,g=o*u-f;return e?(e[0]=g,e[1]=n,e):[g,n]}function PD(r,t,e){const n=r+t,i=n-r,a=n-i,s=t-i,o=r-a;return e?(e[0]=o+s,e[1]=n,e):[o+s,n]}function DD(r,t){const e=r.length;if(e===1){const o=s0(r[0],t);return o[0]?o:[o[1]]}const n=new Array(2*e),i=[.1,.1],a=[.1,.1];let s=0;s0(r[0],t,i),i[0]&&(n[s++]=i[0]);for(let o=1;o=n?(f=c,o+=1,o=n?(f=c,o+=1,o0){if(a<=0)return s;o=i+a}else if(i<0){if(a>=0)return s;o=-(i+a)}else return s;const A=KD*o;return s>=A||s<=-A?s:jD(t,e,n)},function(t,e,n,i){const a=t[0]-i[0],s=e[0]-i[0],o=n[0]-i[0],A=t[1]-i[1],l=e[1]-i[1],c=n[1]-i[1],u=t[2]-i[2],h=e[2]-i[2],d=n[2]-i[2],f=s*c,g=o*l,v=o*A,m=a*c,w=a*l,C=s*A,F=u*(f-g)+h*(v-m)+d*(w-C),Q=(Math.abs(f)+Math.abs(g))*Math.abs(u)+(Math.abs(v)+Math.abs(m))*Math.abs(h)+(Math.abs(w)+Math.abs(C))*Math.abs(d),D=zD*Q;return F>D||-F>D?F:YD(t,e,n,i)}];function XD(r){let t=Ll[r.length];return t||(t=Ll[r.length]=A0(r.length)),t.apply(void 0,...r)}function JD(r,t,e,n,i,a,s){return function(...A){switch(A.length){case 0:case 1:return 0;case 2:return n(A[0],A[1]);case 3:return i(A[0],A[1],A[2]);case 4:return a(A[0],A[1],A[2],A[3]);case 5:return s(A[0],A[1],A[2],A[3],A[4])}return r(A)}}function qD(){for(;Ll.length<=t2;)Ll.push(A0(Ll.length));const r=JD(void 0,XD,...Ll);for(let t=0;t<=t2;++t)r[t]=Ll[t];return r}var kh=qD();const e2=kh[3];function $D(r){const t=r.length;if(t<3){const o=new Array(t);for(let A=0;A{const l=r[o][0]-r[A][0];return l||r[o][1]-r[A][1]});const n=[e[0],e[1]],i=[e[0],e[1]];for(let o=2;o1&&e2(r[n[c-2]],r[n[c-1]],l)<=0;)c-=1,n.pop();for(n.push(A),c=i.length;c>1&&e2(r[i[c-2]],r[i[c-1]],l)>=0;)c-=1,i.pop();i.push(A)}const a=new Array(i.length+n.length-2);let s=0;for(let o=0,A=n.length;o0;--o)a[s++]=i[o];return a}function tR(r,t,e,n){for(let i=0;i<2;++i){const a=r[i],s=t[i],[o,A]=[Math.min(a,s),Math.max(a,s)],l=e[i],c=n[i],[u,h]=[Math.min(l,c),Math.max(l,c)];if(h0&&a>0||i<0&&a<0)return!1;const s=kh(e,r,t),o=kh(n,r,t);return s>0&&o>0||s<0&&o<0?!1:i===0&&a===0&&s===0&&o===0?tR(r,t,e,n):!0}function nR(r){const t=[r[0]];let e=r[0];for(let n=1;n=0;a--)r[a][0]n&&(n=r[a][0]),r[a][1]>i&&(i=r[a][1]);return[n-t,i-e]}function aR(r){return[Math.min(r[0][0],r[1][0]),Math.min(r[0][1],r[1][1]),Math.max(r[0][0],r[1][0]),Math.max(r[0][1],r[1][1])]}function sR(r,t,e){let n=null,i=a2,a=a2,s,o;for(let A=0;Ai&&o>a&&!r2([r[0],t[A]],e)&&!r2([r[1],t[A]],e)&&(i=s,a=o,n=t[A]);return n}function i2(r,t,e,n,i){let a=!1;for(let s=0;su||e[1]>h));u>=e[0]&&h>=e[1]&&i.add(A),d!==null&&(r.splice(s+1,0,d),n.removePoint(d),a=!0)}return a?i2(r,t,e,n,i):r}function oR(r,t,e){const n=t||20,i=nR(rR(Jy.toXy(r,e)));if(i.length<4){const u=i.concat([i[0]]);return e?Jy.fromXy(u,e):u}const a=iR(i),s=[a[0]*s2,a[1]*s2],o=$D(i).reverse().map(u=>i[u]);o.push(o[0]);const A=i.filter(function(u){return o.indexOf(u)<0}),l=Math.ceil(1/(i.length/(a[0]*a[1]))),c=i2(o,Math.pow(n,2),s,UD(A,l),new Set);return e?Jy.fromXy(c,e):c}const a2=Math.cos(90/(180/Math.PI)),s2=.6;function AR(r,t,e){if(r.length===1)return lR(r[0],t,e);if(r.length===2)return o2(r,t,e);if(r.length===3){const[n,i,a]=Jm(r);if(hb(n,i,a))return o2([n,a],t,e)}switch(e){case"smooth":return uR(r,t);case"sharp":return hR(r,t);case"rounded":default:return cR(r,t)}}const lR=(r,t,e)=>{if(e==="sharp")return[["M",r[0]-t,r[1]-t],["L",r[0]+t,r[1]-t],["L",r[0]+t,r[1]+t],["L",r[0]-t,r[1]+t],["Z"]];const n=[t,t,0,0,0];return[["M",r[0],r[1]-t],["A",...n,r[0],r[1]+t],["A",...n,r[0],r[1]-t]]},o2=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?tn(r[0],yA(Io(tr(r[0],r[1])),t)):r[0],a=e==="sharp"?tn(r[1],yA(Io(tr(r[1],r[0])),t)):r[1],s=yA(Io(Wf(tr(i,a),!1)),t),o=yA(s,-1),A=tn(i,s),l=tn(a,s),c=tn(a,o),u=tn(i,o);return e==="sharp"?[["M",A[0],A[1]],["L",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["Z"]]:[["M",A[0],A[1]],["L",l[0],l[1]],["A",...n,c[0],c[1]],["L",u[0],u[1]],["A",...n,A[0],A[1]]]},cR=(r,t)=>{const e=Jm(r).map((o,A)=>{const l=(A-2+r.length)%r.length,c=(A-1+r.length)%r.length,u=(A+1)%r.length,h=r[l],d=r[c],f=r[u],g=tr(h,d),v=tr(d,o),m=tr(o,f),w=(K,G)=>jm(K,G,!0)yA(Io(Wf(K,!1)),t),D=Q(v);return[{p:yl(C?tn(d,Q(g)):tn(d,D)),concave:C&&d},{p:yl(F?tn(o,Q(m)):tn(o,D)),concave:F&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,A)=>!e[(A-1+e.length)%e.length][0].concave&&!e[(A-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,A)=>{const l=[],c=a[e.length-1];return A===0&&l.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):l.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):l.push(["L",...o[1].p]),s.length===3&&(l.pop(),l.push(["C",...s.flat()]),s=[]),l})},uR=(r,t)=>{const e=Jm(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:Io(tr(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=Io(tn(s,yA(n.v,jm(s,n.v,!0)n.p))},hR=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],A=fh(yA(Io(Wf(tr(o,a),!1)),t));return[tn(o,A),tn(a,A)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],A=[n[(s+1)%n.length],n[(s+2)%n.length]];return Xm(o,A,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var dR=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{if(!this.shape)this.shape=new wh({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Dr(this.optionsCache,this.options);this.shape.update(this.getHullStyle(n))}this.optionsCache=Object.assign({},this.options)},this.updateHullPath=n=>{this.shape&&this.options.members.includes(Qt(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(l=>i.getNodeData(l)),o=oR(s.map(Ai),this.options.concavity).slice(1).reverse(),A=o.flatMap(l=>s.filter(c=>Dr(Ai(c),l)).map(Qt));return Dr(A,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=A,this.path=AR(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(Ae.AFTER_RENDER,this.drawHull),this.context.graph.on(Ae.AFTER_ELEMENT_UPDATE,this.updateHullPath)}unbindEvents(){this.context.graph.off(Ae.AFTER_RENDER,this.drawHull),this.context.graph.off(Ae.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=dR(e,["members","padding","corner"]);return Object.assign(Object.assign({},s),{d:this.getHullPath(t)})}getPadding(){const{graph:t}=this.context;return this.hullMemberIds.reduce((n,i)=>{const{halfExtents:a}=t.getElementRenderBounds(i),s=Math.max(a[0],a[1]);return Math.max(n,s)},0)+this.options.padding}addMember(t){const e=Array.isArray(t)?t:[t];this.options.members=[...new Set([...this.options.members,...e])],this.shape.update({d:this.getHullPath()})}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),e.some(n=>this.hullMemberIds.includes(n))&&this.shape.update({d:this.getHullPath()})}updateMember(t){this.options.members=Wt(t)?t(this.options.members):t,this.shape.update(this.getHullStyle(!0))}getMember(){return this.options.members}destroy(){this.unbindEvents(),this.shape.destroy(),this.hullMemberIds=[],super.destroy()}}l0.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function A2(r,t){t(r),r.children&&r.children.forEach(function(e){e&&A2(e,t)})}function Qh(r){c0(r,!0)}function Ts(r){c0(r,!1)}function c0(r,t){var e=t?"visible":"hidden";A2(r,function(n){n.attr("visibility",e)})}var fR=5,l2=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=fR),Object.entries(t).forEach(function(i){var a=(0,z.CR)(i,2),s=a[0],o=a[1],A=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?Qc(o)?(Qc(r[s])||(A[s]={}),e="A"&&e<="Z"};function en(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=(0,z.CR)(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(u0(s,"show")&&u0(u2(s,"show"),t)!==e)s===yR(t,"show")?n[s]=o:n[s.replace(new RegExp($y(t)),"")]=o;else if(!u0(s,"show")&&u0(s,t)!==e){var A=u2(s,t);A==="filter"&&typeof o=="function"||(n[A]=o)}}}),n}function Vc(r,t){return Object.entries(r).reduce(function(e,n){var i=(0,z.CR)(n,2),a=i[0],s=i[1];return a.startsWith("show")?e["show".concat(t).concat(a.slice(4))]=s:e["".concat(t).concat($y(a))]=s,e},{})}function Uo(r,t){t===void 0&&(t=["x","y","class","className"]);var e=["transform","transformOrigin","anchor","visibility","pointerEvents","zIndex","cursor","clipPath","clipPathTargets","offsetPath","offsetPathTargets","offsetDistance","draggable","droppable"],n={},i={};return Object.entries(r).forEach(function(a){var s=(0,z.CR)(a,2),o=s[0],A=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=A:n[o]=A)}),[n,i]}var ER=function(r){if(!Ni(r))return[];for(var t=[],e=0;e=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function KG(r){var t=r.getRenderBounds(),e=__read(t.min,2),n=e[0],i=e[1],a=__read(t.max,2),s=a[0],o=a[1],A=s-n,l=o-i;return new _i(n,i,A,l)}var Fs=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=(0,z.CR)(i,2),s=a[0],o=a[1],A=e(o);return[s,{name:A,class:".".concat(A),id:"#".concat(A),toString:function(){return A}}]}));return Object.assign(n,{prefix:e}),n};function h0(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function Ti(r){if(ye(r))return[r,r,r,r];if(Ni(r)){var t=r.length;if(t===1)return[r[0],r[0],r[0],r[0]];if(t===2)return[r[0],r[1],r[0],r[1]];if(t===3)return[r[0],r[1],r[2],r[1]];if(t===4)return r}return[0,0,0,0]}function fa(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function Hi(r,t,e){return e?"".concat(r," ").concat(e,"legend-").concat(t):r}function zG(r,t,e){var n=r.classNamePrefix,i=n===void 0?"":n;return Hi(t.name,e,i)}var na={title:"title",item:"item",marker:"marker",label:"label",value:"value",focusIcon:"focus-icon",background:"background",ribbon:"ribbon",track:"track",selection:"selection",handle:"handle",handleMarker:"handle-marker",handleLabel:"handle-label",indicator:"indicator",prevBtn:"prev-btn",nextBtn:"next-btn",pageInfo:"page-info"},e1=Fs({text:"text"},"title");function MR(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),A=t.getBBox(),l=h0(n),c=(0,z.CR)(Ti(s?i:0),4),u=c[0],h=c[1],d=c[2],f=c[3],g=(0,z.CR)(Ti(a),4),v=g[0],m=g[1],w=g[2],C=g[3],F=(0,z.CR)([f+h,u+d],2),Q=F[0],D=F[1],K=(0,z.CR)([C+m,v+w],2),G=K[0],J=K[1];if(l[0]==="l")return new _i(o.x,o.y,A.width+o.width+Q+G,Math.max(A.height+J,o.height));if(l[0]==="t")return new _i(o.x,o.y,Math.max(A.width+G,o.width),A.height+o.height+D+J);var $=(0,z.CR)([t.attributes.width||A.width,t.attributes.height||A.height],2),at=$[0],At=$[1];return new _i(A.x,A.y,at+o.width+Q+G,At+o.height+D+J)}function TR(r,t){var e=Object.entries(t).reduce(function(n,i){var a=(0,z.CR)(i,2),s=a[0],o=a[1],A=r.node().attr(s);return A||(n[s]=o),n},{});r.styles(e)}function FR(r){var t,e,n,i,a=r,s=a.width,o=a.height,A=a.position,l=(0,z.CR)([+s/2,+o/2],2),c=l[0],u=l[1],h=(0,z.CR)([+c,+u,"center","middle"],4),d=h[0],f=h[1],g=h[2],v=h[3],m=h0(A);return m.includes("l")&&(t=(0,z.CR)([0,"start"],2),d=t[0],g=t[1]),m.includes("r")&&(e=(0,z.CR)([+s,"end"],2),d=e[0],g=e[1]),m.includes("t")&&(n=(0,z.CR)([0,"top"],2),f=n[0],v=n[1]),m.includes("b")&&(i=(0,z.CR)([+o,"bottom"],2),f=i[0],v=i[1]),{x:d,y:f,textAlign:g,textBaseline:v}}var OR=function(r){(0,z.ZT)(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,A=n.inset,l=e.querySelector(e1.text.class);if(!l)return new _i(0,0,+i,+a);var c=l.getBBox(),u=c.width,h=c.height,d=(0,z.CR)(Ti(o),4),f=d[0],g=d[1],v=d[2],m=d[3],w=(0,z.CR)([0,0,+i,+a],4),C=w[0],F=w[1],Q=w[2],D=w[3],K=h0(s);if(K.includes("i"))return new _i(C,F,Q,D);K.forEach(function(Rt,Pt){var xt,Ft,_t,Xt;Rt==="t"&&(xt=(0,z.CR)(Pt===0?[h+v,+a-h-v]:[0,+a],2),F=xt[0],D=xt[1]),Rt==="r"&&(Ft=(0,z.CR)([+i-u-m],1),Q=Ft[0]),Rt==="b"&&(_t=(0,z.CR)([+a-h-f],1),D=_t[0]),Rt==="l"&&(Xt=(0,z.CR)(Pt===0?[u+g,+i-u-g]:[0,+i],2),C=Xt[0],Q=Xt[1])});var G=(0,z.CR)(Ti(A),4),J=G[0],$=G[1],at=G[2],At=G[3],pt=(0,z.CR)([At+$,J+at],2),wt=pt[0],bt=pt[1];return new _i(C+At,F+J,Q-wt,D-bt)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new _i(0,0,0,0)},t.prototype.render=function(e,n){var i=this,a=e.width,s=e.height,o=e.position,A=e.spacing,l=e.classNamePrefix,c=(0,z._T)(e,["width","height","position","spacing","classNamePrefix"]),u=(0,z.CR)(Uo(c),1),h=u[0],d=FR(e),f=d.x,g=d.y,v=d.textAlign,m=d.textBaseline;fa(!!c.text,Le(n),function(w){var C=Hi(e1.text.name,na.title,l);i.title=w.maybeAppendByClassName(e1.text,"text").attr("className",C).styles(h).call(TR,{x:f,y:g,textAlign:v,textBaseline:m}).node()})},t}(Sr),n1=function(){};function ga(r,t){return Wt(r)?r.apply(void 0,(0,z.ev)([],(0,z.CR)(t),!1)):r}function IR(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function LR(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function h2(r){if(!r)return{enter:!1,update:!1,exit:!1};var t=["enter","update","exit"],e=Object.fromEntries(Object.entries(r).filter(function(n){var i=(0,z.CR)(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return LR(r)?r[n]===!1?[n,!1]:[n,(0,z.pi)((0,z.pi)({},r[n]),e)]:[n,e]}))}function Wc(r,t){r?r.finished.then(t):t()}function NR(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function d2(r,t){"update"in r?r.update(t):r.attr(t)}function f2(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return d2(r,{style:n}),null}return r.animate(t,e)}function kR(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function QR(r,t,e,n){if(n===void 0&&(n="destroy"),kR(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Ts(r),t.isVisible()&&Qh(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,A=o===void 0?0:o,l=Math.ceil(+s/2),c=+s/4,u=(0,z.CR)(r.getGeometryBounds().center,2),h=u[0],d=u[1],f=(0,z.CR)(t.getGeometryBounds().center,2),g=f[0],v=f[1],m=(0,z.CR)([(h+g)/2-h,(d+v)/2-d],2),w=m[0],C=m[1],F=r.style.opacity,Q=F===void 0?1:F,D=t.style.opacity,K=D===void 0?1:D,G=r.style.transform||"",J=t.style.transform||"",$=r.animate([{opacity:Q,transform:"translate(0, 0) ".concat(G)},{opacity:0,transform:"translate(".concat(w,", ").concat(C,") ").concat(G)}],(0,z.pi)((0,z.pi)({fill:"both"},e),{duration:A+l+c})),at=t.animate([{opacity:0,transform:"translate(".concat(-w,", ").concat(-C,") ").concat(J),offset:.01},{opacity:K,transform:"translate(0, 0) ".concat(J)}],(0,z.pi)((0,z.pi)({fill:"both"},e),{duration:l+c,delay:A+l-c}));return Wc(at,i),[$,at]}function Os(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=(0,z.CR)(a,2),o=s[0],A=s[1];if(!Pe(A)){var l=r.style[o]||r.parsedStyle[o]||0;l!==A&&(n[o]=l,i[o]=A)}}),e?f2(r,[n,i],(0,z.pi)({fill:"both"},e)):(d2(r,i),null)}function UR(r){var t;return((t=r[0])===null||t===void 0?void 0:t.map(function(e,n){return r.map(function(i){return i[n]})}))||[]}function r1(r,t,e){e===void 0&&(e=!1);var n=r.getBBox(),i=n.width,a=n.height,s=t/Math.max(i,a);return e&&(r.style.transform="scale(".concat(s,")")),s}var g2=function(r,t,e){return[["M",r-e,t],["A",e,e,0,1,0,r+e,t],["A",e,e,0,1,0,r-e,t],["Z"]]},PR=g2,DR=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t-e],["L",r+e,t+e],["L",r-e,t+e],["Z"]]},RR=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},_R=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["Z"]]},HR=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t-n],["L",r+e,t-n],["L",r,t+n],["Z"]]},GR=function(r,t,e){var n=e/2*Math.sqrt(3);return[["M",r,t-e],["L",r+n,t-e/2],["L",r+n,t+e/2],["L",r,t+e],["L",r-n,t+e/2],["L",r-n,t-e/2],["Z"]]},KR=function(r,t,e){var n=e-1.5;return[["M",r-e,t-n],["L",r+e,t+n],["L",r+e,t-n],["L",r-e,t+n],["Z"]]},v2=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},zR=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t+e],["M",r+e,t-e],["L",r-e,t+e]]},VR=function(r,t,e){return[["M",r-e/2,t-e],["L",r+e/2,t-e],["M",r,t-e],["L",r,t+e],["M",r-e/2,t+e],["L",r+e/2,t+e]]},WR=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},ZR=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},p2=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},jR=p2,YR=function(r,t,e){return[["M",r-e,t],["A",e/2,e/2,0,1,1,r,t],["A",e/2,e/2,0,1,0,r+e,t]]},XR=function(r,t,e){return[["M",r-e-1,t-2.5],["L",r,t-2.5],["L",r,t+2.5],["L",r+e+1,t+2.5]]},JR=function(r,t,e){return[["M",r-e-1,t+2.5],["L",r,t+2.5],["L",r,t-2.5],["L",r+e+1,t-2.5]]},qR=function(r,t,e){return[["M",r-(e+1),t+2.5],["L",r-e/2,t+2.5],["L",r-e/2,t-2.5],["L",r+e/2,t-2.5],["L",r+e/2,t+2.5],["L",r+e+1,t+2.5]]};function $R(r,t){return[["M",r-5,t+2.5],["L",r-5,t],["L",r,t],["L",r,t-3],["L",r,t+3],["L",r+6.5,t+3]]}var t_=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]},e_=function(r,t,e){var n=e,i=e*.2,a=e*.7;return[["M",r-n,t],["A",n,n,0,1,0,r+n,t],["A",n,n,0,1,0,r-n,t],["Z"],["M",r-a,t],["L",r-i,t],["M",r+i,t],["L",r+a,t],["M",r,t-a],["L",r,t-i],["M",r,t+i],["L",r,t+a]]},ra=Fs({prevBtnGroup:"prev-btn-group",prevBtn:"prev-btn",nextBtnGroup:"next-btn-group",nextBtn:"next-btn",pageInfoGroup:"page-info-group",pageInfo:"page-info",playWindow:"play-window",contentGroup:"content-group",controller:"controller",clipPath:"clip-path"},"navigator"),n_=function(r){(0,z.ZT)(t,r);function t(e){var n=r.call(this,e,{x:0,y:0,animate:{easing:"linear",duration:200,fill:"both"},buttonCursor:"pointer",buttonFill:"black",buttonD:t_(0,0,6),buttonSize:12,controllerPadding:5,controllerSpacing:5,formatter:function(i,a){return"".concat(i,"/").concat(a)},defaultPage:0,loop:!1,orientation:"horizontal",pageNumFill:"black",pageNumFontSize:12,pageNumTextAlign:"start",pageNumTextBaseline:"middle"})||this;return n.playState="idle",n.contentGroup=n.appendChild(new oi({class:ra.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new oi({class:ra.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return hr(e,0,Math.max(this.pageViews.length-1,0))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.playWindow.children},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"controllerShape",{get:function(){return this.totalPages>1?{width:55,height:0}:{width:0,height:0}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageShape",{get:function(){var e=this.pageViews,n=(0,z.CR)(UR(e.map(function(u){var h=u.getBBox(),d=h.width,f=h.height;return[d,f]})).map(function(u){return Math.max.apply(Math,(0,z.ev)([],(0,z.CR)(u),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,A=o===void 0?i:o,l=s.pageHeight,c=l===void 0?a:l;return{pageWidth:A,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,A=s.pageHeight;return new _i(n,i,o+a.width,A)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,A=a.playWindow,l=a.pageViews;if(o!=="idle"||e<0||l.length<=0||e>=l.length)return null;l[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=(0,z.CR)(this.getFollowingPageDiff(e),2),u=c[0],h=c[1];this.playState="running";var d=f2(A,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-h,")")}],i);return Wc(d,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),d},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:hr(i-1,0,n);return this.goTo(a)},t.prototype.next=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i>=n-1)return null;var a=e?(i+1)%n:hr(i+1,0,n);return this.goTo(a)},t.prototype.renderClipPath=function(e){var n=this.pageShape,i=n.pageWidth,a=n.pageHeight;if(!i||!a){this.contentGroup.style.clipPath=void 0;return}this.clipPath=e.maybeAppendByClassName(ra.clipPath,"rect").styles({width:i,height:a}),this.contentGroup.attr("clipPath",this.clipPath.node())},t.prototype.setVisiblePages=function(e){this.playWindow.children.forEach(function(n,i){e.includes(i)?Qh(n):Ts(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,A=s.controllerPadding,l=a.getBBox(),c=l.width,u=l.height,h=(0,z.CR)(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],f=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(f);var g=n.getBBox(),v=g.width,m=g.height,w=i.getBBox(),C=w.width,F=w.height,Q=Math.max(v,c,C),D=o==="horizontal"?{offset:[[0,0],[v/2+A,0],[v+c+A*2,0]],textAlign:"start"}:{offset:[[Q/2,-m-A],[Q/2,0],[Q/2,F+A]],textAlign:"center"},K=(0,z.CR)(D.offset,3),G=(0,z.CR)(K[0],2),J=G[0],$=G[1],at=(0,z.CR)(K[1],2),At=at[0],pt=at[1],wt=(0,z.CR)(K[2],2),bt=wt[0],Rt=wt[1],Pt=D.textAlign,xt=a.querySelector("text");xt&&(xt.style.textAlign=Pt),n.setLocalPosition(J,$),a.setLocalPosition(At,pt),i.setLocalPosition(bt,Rt)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(ra.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,A=e=2,h=e.maybeAppendByClassName(ra.controller,"g");if(c0(h.node(),u),!!u){var d=en(this.attributes,"button"),f=en(this.attributes,"pageNum"),g=(0,z.CR)(Uo(d),2),v=g[0],m=g[1],w=v.size,C=(0,z._T)(v,["size"]),F=!h.select(ra.prevBtnGroup.class).node(),Q=h.maybeAppendByClassName(ra.prevBtnGroup,"g").styles(m);this.prevBtnGroup=Q.node();var D=Q.maybeAppendByClassName(ra.prevBtn,"path");if(o){var K=Hi(ra.prevBtn.name,na.prevBtn,o);D.node().setAttribute("class",K)}var G=h.maybeAppendByClassName(ra.nextBtnGroup,"g").styles(m);this.nextBtnGroup=G.node();var J=G.maybeAppendByClassName(ra.nextBtn,"path");if(o){var $=Hi(ra.nextBtn.name,na.nextBtn,o);J.node().setAttribute("class",$)}[D,J].forEach(function(wt){wt.styles((0,z.pi)((0,z.pi)({},C),{transformOrigin:"center"})),r1(wt.node(),w,!0)});var at=h.maybeAppendByClassName(ra.pageInfoGroup,"g");this.pageInfoGroup=at.node();var At=at.maybeAppendByClassName(ra.pageInfo,"text");if(At.styles(f),o){var pt=Hi(ra.pageInfo.name,na.pageInfo,o);At.node().setAttribute("class",pt)}this.updatePageInfo(),h.node().setLocalPosition(l+a,c/2),F&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var A=Le(n);this.renderClipPath(A),this.renderController(A),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Mh(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(yn.INSERTED,n),this.playWindow.addEventListener(yn.REMOVED,n)},t}(Sr);function r_(r){var t="default";if(Br(r)&&r instanceof Image)t="image";else if(Wt(r))t="symbol";else if(gn(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function i_(r){var t=r_(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var zn=function(r){(0,z.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,A=this.getSubShapeStyle(e),l=A.symbol,c=A.size,u=c===void 0?16:c,h=(0,z._T)(A,["symbol","size"]),d=i_(l);fa(!!d,Le(n),function(f){f.maybeAppendByClassName("marker",d).attr("className","marker ".concat(d,"-marker")).call(function(g){if(d==="image"){var v=u*2;g.styles({img:l,width:v,height:v,x:a-u,y:o-u})}else{var v=u/2,m=Wt(l)?l:t.getSymbol(l);g.styles((0,z.pi)({d:m==null?void 0:m(a,o,v)},h))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(Sr);zn.registerSymbol("cross",zR),zn.registerSymbol("hyphen",ZR),zn.registerSymbol("line",v2),zn.registerSymbol("plus",WR),zn.registerSymbol("tick",VR),zn.registerSymbol("circle",g2),zn.registerSymbol("point",PR),zn.registerSymbol("bowtie",KR),zn.registerSymbol("hexagon",GR),zn.registerSymbol("square",DR),zn.registerSymbol("diamond",RR),zn.registerSymbol("triangle",_R),zn.registerSymbol("triangle-down",HR),zn.registerSymbol("line",v2),zn.registerSymbol("dot",p2),zn.registerSymbol("dash",jR),zn.registerSymbol("smooth",YR),zn.registerSymbol("hv",XR),zn.registerSymbol("vh",JR),zn.registerSymbol("hvh",qR),zn.registerSymbol("vhv",$R),zn.registerSymbol("focus",e_);function VG(r,t,e){var n=Math.round((r-e)/t);return e+n*t}function a_(r,t,e){var n=1.4,i=n*e;return[["M",r-e,t-i],["L",r+e,t-i],["L",r+e,t+i],["L",r-e,t+i],["Z"]]}var m2=1.4,y2=.4;function s_(r,t,e){var n=e,i=n*m2,a=n/2,s=n/6,o=r+i*y2;return[["M",r,t],["L",o,t+a],["L",r+i,t+a],["L",r+i,t-a],["L",o,t-a],["Z"],["M",o,t+s],["L",r+i-2,t+s],["M",o,t-s],["L",r+i-2,t-s]]}function o_(r,t,e){var n=e,i=n*m2,a=n/2,s=n/6,o=t+i*y2;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}zn.registerSymbol("hiddenHandle",a_),zn.registerSymbol("verticalHandle",s_),zn.registerSymbol("horizontalHandle",o_);var WG=function(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e};function ZG(r,t,e,n){var i;n===void 0&&(n=4);var a=__read(r,2),s=a[0],o=a[1],A=__read(t,2),l=A[0],c=A[1],u=__read(e,2),h=u[0],d=u[1],f=__read([l,c],2),g=f[0],v=f[1],m=v-g;return g>v&&(i=__read([v,g],2),g=i[0],v=i[1]),m>o-s?[s,o]:go?d===o&&h===g?[g,o]:[o-m,o]:[g,v]}function i1(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}function jG(r){var t=r&&r.getRenderBounds();if(!t)return{width:0,height:0};var e=t.getMax(),n=t.getMin();return{width:e[0]-n[0],height:e[1]-n[1]}}function w2(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=(0,z.CR)([e,n],2),a=(0,z.CR)(i[0],2),s=a[0],o=a[1],A=(0,z.CR)(i[1],2),l=A[0],c=A[1];return{x:s,y:o,width:l-s,height:c-o,left:s,bottom:c,top:o,right:l}}function YG(r,t){var e=select(r).append("text").node();return e.attr(__assign(__assign({},t),{visibility:"hidden"})),e}function A_(r,t){var e=(0,z.CR)(r,2),n=e[0],i=e[1],a=(0,z.CR)(t,2),s=a[0],o=a[1];return n!==s&&i===o}function XG(r,t){var e=__read(r,2),n=e[0],i=e[1],a=__read(t,2),s=a[0],o=a[1];return n===s&&i!==o}function l_(r,t){var e,n,i=t.attributes;try{for(var a=(0,z.XA)(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=(0,z.CR)(s.value,2),A=o[0],l=o[1];A!=="id"&&A!=="className"&&r.attr(A,l)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function Po(r){return typeof r=="function"?r():gn(r)||ye(r)?new t1({style:{text:String(r)}}):r}function c_(r,t){return typeof r=="function"?r():gn(r)||ye(r)?new ul({style:(0,z.pi)((0,z.pi)({pointerEvents:"auto"},t),{innerHTML:r})}):r}var d0,a1;function JG(r){a1=r}var u_=Gy(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return a1?a1(r,e):(d0||(d0=ae.offscreenCanvasCreator.getOrCreateContext(void 0)),d0.font=[a,s,i,"".concat(e,"px"),n].join(" "),d0.measureText(r).width)},function(r,t){return[r,Object.values(t||E2(r)).join()].join("")},4096),E2=function(r){var t=r.style.fontFamily||"sans-serif",e=r.style.fontWeight||"normal",n=r.style.fontStyle||"normal",i=r.style.fontVariant,a=r.style.fontSize;return a=typeof a=="object"?a.value:a,{fontSize:a,fontFamily:t,fontWeight:e,fontStyle:n,fontVariant:i}};function B2(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function b2(r,t){var e=B2(r);e&&e.attr(t)}function s1(r,t,e){e===void 0&&(e="..."),b2(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function o1(r,t){for(var e in t)t.hasOwnProperty(e)&&e!=="constructor"&&t[e]!==void 0&&(r[e]=t[e])}function h_(r,t,e,n){return t&&o1(r,t),e&&o1(r,e),n&&o1(r,n),r}function d_(r){return r instanceof Element||r instanceof Document}var vn,f_="component-poptip",ln={CONTAINER:"component-poptip",ARROW:"component-poptip-arrow",TEXT:"component-poptip-text"},x2=(vn={},vn[".".concat(ln.CONTAINER)]={visibility:"visible",position:"absolute","background-color":"rgba(0, 0, 0)","box-shadow":"0px 0px 10px #aeaeae","border-radius":"3px",color:"#fff",opacity:.8,"font-size":"12px",padding:"4px 6px",display:"flex","justify-content":"center","align-items":"center","z-index":8,transition:"visibility 50ms"},vn[".".concat(ln.TEXT)]={"text-align":"center"},vn[".".concat(ln.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='left']")]={transform:"translate(-100%, -50%)"},vn[".".concat(ln.CONTAINER,"[data-position='right']")]={transform:"translate(0, -50%)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='top-left']")]={transform:"translate(0,-100%)"},vn[".".concat(ln.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},vn[".".concat(ln.CONTAINER,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='right-top']")]={transform:"translate(0, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},vn[".".concat(ln.ARROW)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},vn[".".concat(ln.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},vn["[data-position='top'] .".concat(ln.ARROW)]={bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},vn["[data-position='left'] .".concat(ln.ARROW)]={right:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='right']")]={transform:"translate(5px, -50%)"},vn["[data-position='right'] .".concat(ln.ARROW)]={left:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},vn["[data-position='bottom'] .".concat(ln.ARROW)]={top:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},vn["[data-position='top-left'] .".concat(ln.ARROW)]={left:"10px",bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},vn["[data-position='top-right'] .".concat(ln.ARROW)]={right:"10px",bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},vn["[data-position='left-top'] .".concat(ln.ARROW)]={right:"-2px",top:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},vn["[data-position='left-bottom'] .".concat(ln.ARROW)]={right:"-2px",bottom:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='right-top']")]={transform:"translate(5px, 0)"},vn["[data-position='right-top'] .".concat(ln.ARROW)]={left:"-2px",top:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},vn["[data-position='right-bottom'] .".concat(ln.ARROW)]={left:"-2px",bottom:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},vn["[data-position='bottom-left'] .".concat(ln.ARROW)]={top:"-2px",left:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},vn["[data-position='bottom-right'] .".concat(ln.ARROW)]={top:"-2px",right:"8px"},vn),g_=void 0;function v_(r,t,e,n,i,a){if(i===void 0&&(i=!1),a===void 0&&(a=!1),a)return[r,t];var s=e.getBoundingClientRect(),o=s.x,A=s.y,l=s.width,c=s.height;switch(n){case"top":return i?[o+l/2,A]:[r,A];case"left":return i?[o,A+c/2]:[o,t];case"bottom":return i?[o+l/2,A+c]:[r,A+c];case"right":return i?[o+l,A+c/2]:[o+l,t];case"top-right":case"right-top":return[o+l,A];case"left-bottom":case"bottom-left":return[o,A+c];case"right-bottom":case"bottom-right":return[o+l,A+c];case"top-left":case"left-top":default:return[o,A]}}var p_=function(r){var t;return function(){for(var e=[],n=0;n');e.innerHTML=o,gn(a)?e.innerHTML+=a:a&&d_(a)&&e.appendChild(a),s&&(e.getElementsByClassName(ln.TEXT)[0].textContent=s),this.applyStyles(),this.container.style.visibility=this.visibility},t.prototype.applyStyles=function(){var e=Zr({},x2,this.style.domStyles),n=Object.entries(e).reduce(function(a,s){var o=(0,z.CR)(s,2),A=o[0],l=o[1],c=Object.entries(l).reduce(function(u,h){var d=(0,z.CR)(h,2),f=d[0],g=d[1];return"".concat(u).concat(f,": ").concat(g,";")},"");return"".concat(a).concat(A,"{").concat(c,"}")},"");if(this.domStyles!==n){this.domStyles=n;var i=this.container.querySelector("style");i&&this.container.removeChild(i),i=document.createElement("style"),i.innerHTML=n,this.container.appendChild(i)}},t.prototype.setOffsetPosition=function(e,n,i){i===void 0&&(i=this.style.offset);var a=(0,z.CR)(i,2),s=a[0],o=s===void 0?0:s,A=a[1],l=A===void 0?0:A;this.container.style.left="".concat(e+o,"px"),this.container.style.top="".concat(n+l,"px")},t.tag="poptip",t.defaultOptions={style:{x:0,y:0,width:0,height:0,target:null,visibility:"hidden",text:"",position:"top",follow:!1,offset:[0,0],domStyles:x2,template:'
')}},t}(Sr),jr=Fs({layout:"flex",markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label",valueGroup:"value-group",focusGroup:"focus-group",focus:"focus",value:"value",backgroundGroup:"background-group",background:"background"},"legend-category-item"),E_={offset:[0,20],domStyles:{".component-poptip":{opacity:"1",padding:"8px 12px",background:"#fff",boxShadow:"0 2px 8px rgba(0, 0, 0, 0.15)"},".component-poptip-arrow":{display:"none"},".component-poptip-text":{color:"#000",lineHeight:"20px"}}};function B_(r){var t=r.querySelector(jr.marker.class);return t?t.style:{}}var b_=function(r){(0,z.ZT)(t,r);function t(e,n){var i=r.call(this,e,{span:[1,1],marker:function(){return new Js({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this;return i.keyFields={},i.keyFields=n||{},i}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes,a=i.markerSize,s=i.focus,o=i.focusMarkerSize,A=e.node().getBBox(),l=A.width,c=A.height,u=n.node().getBBox(),h=u.width,d=u.height,f=s?o!=null?o:12:0;return{markerWidth:a,labelWidth:l,valueWidth:h,focusWidth:f,height:Math.max(a,c,d)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=(0,z.CR)(Ti(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),t.prototype.setAttribute=function(e,n){r.prototype.setAttribute.call(this,e,n)},Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,A=s.focusWidth,l=s.height,c=this.actualSpace,u=c.labelWidth,h=c.valueWidth,d=(0,z.CR)(this.spacing,3),f=d[0],g=d[1],v=d[2];if(a){var m=a-i-f-g-A-v,w=(0,z.CR)(this.span,2),C=w[0],F=w[1];e=(0,z.CR)([C*m,F*m],2),u=e[0],h=e[1]}var Q=o+u+h+f+g+A+v;return{width:Q,height:l,markerWidth:o,labelWidth:u,valueWidth:h,focusWidth:A}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes,n=e.spacing,i=e.focus;if(!n)return[0,0,0];var a=(0,z.CR)(Ti(n),3),s=a[0],o=a[1],A=a[2];return[s,this.showValue?o:0,i?A:0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.focusWidth,o=e.width,A=e.height,l=(0,z.CR)(this.spacing,3),c=l[0],u=l[1],h=l[2];return{height:A,width:o,markerWidth:n,labelWidth:i,valueWidth:a,focusWidth:s,position:[n/2,n+c,n+i+c+u,n+i+a+c+u+h+s/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=B_(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,A=o===void 0?e.lineWidth:o,l=n.markerStroke,c=l===void 0?e.stroke:l,u=+(s||A||(c?1:0))*Math.sqrt(2),h=this.markerGroup.node().getBBox(),d=h.width,f=h.height;return(1-u/Math.max(d,f))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.marker,s=i.classNamePrefix,o=en(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(jr.markerGroup,"g").style("zIndex",0),fa(!!a,this.markerGroup,function(){var A,l=n.markerGroup.node(),c=(A=l.childNodes)===null||A===void 0?void 0:A[0],u=Hi(jr.marker.name,na.marker,s),h=typeof a=="string"?new zn({style:{symbol:a},className:u}):a();if(c)if(h.nodeName===c.nodeName)c instanceof zn?c.update((0,z.pi)((0,z.pi)({},o),{symbol:a})):(l_(c,h),Le(c).styles(o));else{if(c.remove(),!(h instanceof zn)){var f=Hi(jr.marker.name,na.marker,s);h.className=f}Le(h).styles(o),l.appendChild(h)}else{if(!(h instanceof zn)){var d=Hi(jr.marker.name,na.marker,s);h.className=d,Le(h).styles(o)}l.appendChild(h)}n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var g=r1(n.markerGroup.node(),n.scaleSize,!0);n.markerGroup.node().style._transform="scale(".concat(g,")")})},t.prototype.renderLabel=function(e){var n=en(this.attributes,"label"),i=n.text,a=(0,z._T)(n,["text"]),s=this.attributes.classNamePrefix;this.labelGroup=e.maybeAppendByClassName(jr.labelGroup,"g").style("zIndex",0);var o=Hi(jr.label.name,na.label,s),A=this.labelGroup.maybeAppendByClassName(jr.label,function(){return Po(i)});A.node().setAttribute("class",o),A.styles(a)},t.prototype.renderValue=function(e){var n=this,i=en(this.attributes,"value"),a=i.text,s=(0,z._T)(i,["text"]),o=this.attributes.classNamePrefix;this.valueGroup=e.maybeAppendByClassName(jr.valueGroup,"g").style("zIndex",0),fa(this.showValue,this.valueGroup,function(){var A=Hi(jr.value.name,na.value,o),l=n.valueGroup.maybeAppendByClassName(jr.value,function(){return Po(a)});l.node().setAttribute("class",A),l.styles(s)})},t.prototype.createPoptip=function(){var e=this.attributes.poptip,n=e||{},i=n.render,a=(0,z._T)(n,["render"]),s=new w_({style:Zr(E_,a)});return this.poptipGroup=s,s},t.prototype.bindPoptip=function(e){var n=this,i=this.attributes.poptip;if(i){var a=this.poptipGroup||this.createPoptip();a.bind(e,function(){var s=n.attributes,o=s.labelText,A=s.valueText,l=s.markerFill,c=typeof o=="string"?o:o==null?void 0:o.attr("text"),u=typeof A=="string"?A:A==null?void 0:A.attr("text");if(typeof i.render=="function")return{html:i.render((0,z.pi)((0,z.pi)({},n.keyFields),{label:c,value:u,color:l}))};var h="";return(typeof c=="string"||typeof c=="number")&&(h+='
'.concat(c,"
")),(typeof u=="string"||typeof u=="number")&&(h+='
'.concat(u,"
")),{html:h}})}},t.prototype.renderFocus=function(e){var n=this,i=this.attributes,a=i.focus,s=i.focusMarkerSize,o=i.classNamePrefix,A={x:0,y:0,size:s,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};Ye(a)||(this.focusGroup=e.maybeAppendByClassName(jr.focusGroup,"g").style("zIndex",0),fa(a,this.focusGroup,function(){var l=Hi(jr.focus.name,na.focusIcon,o),c=new zn({style:(0,z.pi)((0,z.pi)({},A),{symbol:"focus"}),className:l}),u=new Js({style:{r:A.size/2,fill:"transparent"}}),h=n.focusGroup.node();h.appendChild(u),h.appendChild(c),c.update({opacity:0}),e.node().addEventListener("pointerenter",function(){c.update({opacity:1})}),e.node().addEventListener("pointerleave",function(){c.update({opacity:0})})}))},t.prototype.renderPoptip=function(e){var n=this,i=this.attributes.poptip;if(i){var a=e.maybeAppendByClassName(jr.value,"g").node(),s=e.maybeAppendByClassName(jr.label,"g").node();[a,s].forEach(function(o){o&&n.bindPoptip(o)})}},t.prototype.renderBackground=function(e){var n=this.shape,i=n.width,a=n.height,s=en(this.attributes,"background");this.background=e.maybeAppendByClassName(jr.backgroundGroup,"g").style("zIndex",-1);var o=this.background.maybeAppendByClassName(jr.background,"rect");o.styles((0,z.pi)({width:i,height:a},s));var A=this.attributes.classNamePrefix,l=A===void 0?"":A;if(l){var c=Hi(jr.background.name,na.background,l);o.node().setAttribute("class",c)}},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=(0,z.CR)(e.position,4),o=s[0],A=s[1],l=s[2],c=s[3],u=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(u,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(A,", ").concat(u,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(c,", ").concat(u,")")}),s1(this.labelGroup.select(jr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(l,", ").concat(u,")")}),s1(this.valueGroup.select(jr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=Le(n),a=e.x,s=a===void 0?0:a,o=e.y,A=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(A,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.renderPoptip(i),this.renderFocus(i),this.adjustLayout()},t}(Sr),Nl=Fs({page:"item-page",navigator:"navigator",item:"item"},"items"),C2=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},x_=function(r){(0,z.ZT)(t,r);function t(e){var n=r.call(this,e,{data:[],gridRow:1/0,gridCol:void 0,padding:0,width:1e3,height:100,rowPadding:0,colPadding:0,layout:"flex",orientation:"horizontal",click:n1,mouseenter:n1,mouseleave:n1})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=e.poptip,s=e.focus,o=e.focusMarkerSize,A=e.classNamePrefix,l=en(this.attributes,"item"),c=n.map(function(u,h){var d=u.id,f=d===void 0?h:d,g=u.label,v=u.value;return{id:"".concat(f),index:h,style:(0,z.pi)({layout:i,labelText:g,valueText:v,poptip:a,focus:s,focusMarkerSize:o,classNamePrefix:A},Object.fromEntries(Object.entries(l).map(function(m){var w=(0,z.CR)(m,2),C=w[0],F=w[1];return[C,ga(F,[u,h,n])]})))}});return c},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,A=(0,z.CR)(this.navigatorShape,1),l=A[0],c=(0,z.CR)(this.grid,2),u=c[0],h=c[1],d=h*u,f=0;return this.pageViews.children.map(function(g,v){var m,w,C=Math.floor(v/d),F=v%d,Q=e.ifHorizontal(h,u),D=[Math.floor(F/Q),F%Q];i==="vertical"&&D.reverse();var K=(0,z.CR)(D,2),G=K[0],J=K[1],$=(a-l-(h-1)*o)/h,at=g.getBBox().height,At=(0,z.CR)([0,0],2),pt=At[0],wt=At[1];return i==="horizontal"?(m=(0,z.CR)([f,G*(at+s)],2),pt=m[0],wt=m[1],f=J===h-1?0:f+$+o):(w=(0,z.CR)([J*($+o),f],2),pt=w[0],wt=w[1],f=G===u-1?0:f+at+s),{page:C,index:v,row:G,col:J,pageIndex:F,width:$,height:at,x:pt,y:wt}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=(0,z.CR)(this.navigatorShape,1),A=o[0],l=(0,z.CR)(this.grid,2),c=l[0],u=l[1],h=(0,z.CR)([n-A,i],2),d=h[0],f=h[1],g=(0,z.CR)([0,0,0,0,0,0,0,0],8),v=g[0],m=g[1],w=g[2],C=g[3],F=g[4],Q=g[5],D=g[6],K=g[7];return this.pageViews.children.map(function(G,J){var $,at,At,pt,wt=G.getBBox(),bt=wt.width,Rt=wt.height,Pt=D===0?0:s,xt=D+Pt+bt;if(xt<=d&&C2(F,function(_t){return _t0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return i1(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(Nl.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(Nl.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave,o=n.classNamePrefix;this.flattenPage(e);var A=this.dispatchCustomEvent.bind(this),l=Hi(Nl.item.name,na.item,o);Le(e).selectAll(Nl.item.class).data(this.renderData,function(c){return c.id}).join(function(c){return c.append(function(u){var h=u.style,d=(0,z._T)(u,["style"]);return new b_({style:h},d)}).attr("className",l).on("click",function(){i==null||i(this),A("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),A("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),A("itemMouseleave",{item:this})})},function(c){return c.each(function(u){var h=u.style;this.update(h)})},function(c){return c.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=(0,z.CR)(this.navigatorShape,2),A=o[0],l=o[1];this.navigator.update(i==="grid"?{pageWidth:a-A,pageHeight:s-l}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(IR(this.itemsLayout,"page")).map(function(a){var s=(0,z.CR)(a,2),o=s[0],A=s[1];return{page:o,layouts:A}}),i=(0,z.ev)([],(0,z.CR)(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new oi({className:Nl.page.name}));s.forEach(function(A){var l=A.x,c=A.y,u=A.index,h=A.width,d=A.height,f=i[u];o.appendChild(f),ph(f,"__layout__",A),f.update({x:l,y:c,width:h,height:d})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes,i=n.orientation,a=n.classNamePrefix,s=en(this.attributes,"nav"),o=Zr({orientation:i,classNamePrefix:a},s),A=this;return e.selectAll(Nl.navigator.class).data(["nav"]).join(function(l){return l.append(function(){return new n_({style:o})}).attr("className",Nl.navigator.name).each(function(){A.navigator=this})},function(l){return l.each(function(){this.update(o)})},function(l){return l.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(Le(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new Vr(e,{detail:n});this.dispatchEvent(i)},t}(Sr),kl=Fs({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),S2={showLabel:!0,formatter:function(r){return r.toString()},markerSize:25,markerStroke:"#c5c5c5",markerFill:"#fff",markerLineWidth:1,labelFontSize:12,labelFill:"#c5c5c5",labelText:"",orientation:"vertical",spacing:0},qG=function(r){(0,z.ZT)(t,r);function t(e){return r.call(this,e,S2)||this}return t.prototype.render=function(e,n){var i=Le(n).maybeAppendByClassName(kl.markerGroup,"g");this.renderMarker(i);var a=Le(n).maybeAppendByClassName(kl.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.classNamePrefix,o=i.markerSymbol,A=o===void 0?i1(a,"horizontalHandle","verticalHandle"):o;fa(!!A,e,function(l){var c=en(n.attributes,"marker"),u=(0,z.pi)({symbol:A},c),h=Hi(kl.marker.name,na.handleMarker,s);if(n.marker=l.maybeAppendByClassName(kl.marker,function(){return new zn({style:u,className:h})}).update(u),s){var d=n.marker.node().querySelector(".marker");if(d){var f=d.getAttribute("class")||"",g=f.split(" ")[0],v=Hi(g,na.handleMarker,s);d.setAttribute("class",v)}}})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,A=o===void 0?0:o,l=i.formatter,c=i.classNamePrefix;fa(a,e,function(u){var h,d=en(n.attributes,"label"),f=d.text,g=(0,z._T)(d,["text"]),v=((h=u.select(kl.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},m=v.width,w=m===void 0?0:m,C=v.height,F=C===void 0?0:C,Q=(0,z.CR)(i1(s,[0,F+A,"center","top"],[w+A,0,"start","middle"]),4),D=Q[0],K=Q[1],G=Q[2],J=Q[3],$=Hi(kl.label.name,na.handleLabel,c);u.maybeAppendByClassName(kl.label,"text").attr("className",$).styles((0,z.pi)((0,z.pi)({},g),{x:D,y:K,text:l(f).toString(),textAlign:G,textBaseline:J}))})},t}(Sr),M2={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},C_=Zr({},M2,{}),$G=Zr({},M2,Vc(S2,"handle"),{color:["#d0e3fa","#acc7f6","#8daaf2","#6d8eea","#4d73cd","#325bb1","#5a3e75","#8c3c79","#e23455","#e7655b"],indicatorBackgroundFill:"#262626",indicatorLabelFill:"white",indicatorLabelFontSize:12,indicatorVisibility:"hidden",labelAlign:"value",labelDirection:"positive",labelSpacing:5,showHandle:!0,showIndicator:!0,showLabel:!0,slidable:!0,titleText:"",type:"continuous"}),tK=.01,eK=.5,Ql=Fs({title:"title",html:"html",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),S_=function(r){(0,z.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.update=function(e){this.attr(e)},t}(ul),M_=function(r){(0,z.ZT)(t,r);function t(e){return r.call(this,e,C_)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,A=a.classNamePrefix,l=en(this.attributes,"title"),c=(0,z.CR)(Uo(l),2),u=c[0],h=c[1];this.titleGroup=e.maybeAppendByClassName(Ql.titleGroup,"g").styles(h);var d=(0,z.pi)((0,z.pi)({width:n,height:i},u),{text:s?o:"",classNamePrefix:A});this.title=this.titleGroup.maybeAppendByClassName(Ql.title,function(){return new OR({style:d})}).update(d)},t.prototype.renderCustom=function(e){var n=this.attributes.data,i={innerHTML:this.attributes.render(n),pointerEvents:"auto"};e.maybeAppendByClassName(Ql.html,function(){return new S_({className:Ql.html.name,style:i})}).update(i)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,A=en(this.attributes,"title",!0),l=(0,z.CR)(Uo(A),2),c=l[0],u=l[1],h=(0,z.pi)((0,z.pi)({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Ql.itemsGroup,"g").styles((0,z.pi)((0,z.pi)({},u),{transform:"translate(".concat(i,", ").concat(a,")")}));var d=this;this.itemsGroup.selectAll(Ql.items.class).data(["items"]).join(function(f){return f.append(function(){return new x_({style:h})}).attr("className",Ql.items.name).each(function(){d.items=Le(this)})},function(f){return f.update(h)},function(f){return f.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new _i(0,0,i,a)},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e,n,i=(e=this.title)===null||e===void 0?void 0:e.node(),a=(n=this.items)===null||n===void 0?void 0:n.node();return!i||!a?r.prototype.getBBox.call(this):MR(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,A=o===void 0?0:o,l=i.y,c=l===void 0?0:l,u=i.classNamePrefix,h=i.render,d=Le(n),f=n.className||"legend-category";u?n.attr("className","".concat(f," ").concat(u,"legend")):n.className||n.attr("className","legend-category"),n.style.transform="translate(".concat(A,", ").concat(c,")"),h?this.renderCustom(d):(this.renderTitle(d,a,s),this.renderItems(d,this.availableSpace),this.adjustLayout())},t}(Sr);function f0(r){const{width:t,height:e,renderer:n}=r,i=T_(r),a=new dm({width:t,height:e,container:i,renderer:n||new Eh});return[i,a]}function T_(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=zc(n,!1),{width:s,height:o,containerStyle:A}=r,[l,c]=F_(r);return Object.assign(a.style,Object.assign({position:"absolute",left:l+"px",top:c+"px",width:s+"px",height:o+"px"},A)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function F_(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,A]=lb(n);return[o*(a-t),A*(s-e)]}var O_=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const{graph:n}=this.context;n.on(Ae.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=Mi(n,[s,"id"]),A=Mi(n,[s,"style","labelText"]),[l]=o.split("__"),c=this.fieldMap[l].get(A)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(u=>[u,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=Mi(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?(this.selectedItems=this.selectedItems.filter(a=>a!==i),this.changeState(n,[])):(this.selectedItems.push(i),this.changeState(n,"selected"))},this.mouseleave=n=>{this.options.trigger!=="click"&&(this.selectedItems=[],this.changeState(n,[]))},this.mouseenter=n=>{if(this.options.trigger==="click")return;const i=Mi(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:A,combos:l}=a.getData(),c={},u=v=>Wt(n)?n(v):n,h={node:"circle",edge:"line",combo:"rect"},d={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},f=(v,m)=>s==null?void 0:s.getElementComputedStyle(v,m),g=(v,m)=>{v.forEach(w=>{const{id:C}=w,F=Mi(w,["data",u(w)]),Q=(s==null?void 0:s.getElementType(m,w))||"circle",D=f(m,w),K=(m==="edge"?D==null?void 0:D.stroke:D==null?void 0:D.fill)||"#1783ff";C&&F&&F.replace(/\s+/g,"")&&(this.setFieldMap(F,C,m),c[F]||(c[F]={id:`${m}__${C}`,label:F,marker:d[Q]||h[m],elementType:m,lineWidth:1,stroke:K,fill:K}))})};switch(i){case"node":g(o,"node");break;case"edge":g(A,"edge");break;case"combo":g(l,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:A,trigger:l,position:c,container:u,containerStyle:h,className:d}=n,f=O_(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),g=this.getMarkerData(s,"node"),v=this.getMarkerData(o,"edge"),m=this.getMarkerData(A,"combo"),w=[...g,...m,...v],C=Object.assign({width:i,height:a,data:w,itemMarkerLineWidth:({lineWidth:D})=>D,itemMarker:({marker:D})=>D,itemMarkerStroke:({stroke:D})=>D,itemMarkerFill:({fill:D})=>D,gridCol:g.length},f,this.getEvents()),F=new M_({className:"legend",style:C});this.category=F,this.upsertCanvas().appendChild(F),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:A,className:l}=this.options,[c,u]=f0({width:i,height:a,graphCanvas:t,container:o,containerStyle:A,placement:s,className:"legend"});return this.container=c,l&&c.classList.add(l),this.canvas=u,this.canvas}destroy(){this.clear(),this.context.graph.off(Ae.AFTER_DRAW,this.createElement),super.destroy()}}g0.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class v0 extends mi{constructor(t,e){super(t,Object.assign({},v0.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:A,top:l,width:c,height:u}=this.mask.style,[,,h,d]=this.maskBBox;let f=parseInt(A)+s,g=parseInt(l)+o,v=parseInt(c),m=parseInt(u);f<0&&(f=0),g<0&&(g=0),f+v>i&&(f=NA(i-v,0)),g+m>a&&(g=NA(a-m,0)),v0?(f=NA(f-s,0),v=LA(v+s,i)):s<0&&(v=LA(v-s,i))),m0?(g=NA(g-o,0),m=LA(m+o,a)):o<0&&(m=LA(m-o,a))),Object.assign(this.mask.style,{left:f+"px",top:g+"px",width:v+"px",height:m+"px"});const w=parseInt(A)-f,C=parseInt(l)-g;if(w===0&&C===0)return;const F=this.context.canvas.getCamera().getZoom(),Q=this.canvas.getCamera().getZoom(),D=F/Q;this.context.graph.translateBy([w*D,C*D],!1)},this.onMaskDragEnd=n=>{this.mask&&(this.isMaskDragging=!1,this.mask.releasePointerCapture(n.pointerId),this.mask.removeEventListener("pointermove",this.onMaskDrag),this.mask.removeEventListener("pointerup",this.onMaskDragEnd),this.mask.removeEventListener("pointercancel",this.onMaskDragEnd))},this.onTransform=vB(()=>{this.isMaskDragging||(this.updateMask(),this.setCamera())},32,{leading:!0}),this.setOnRender(),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),"delay"in t&&this.setOnRender(),this.bindEvents()}setOnRender(){this.onRender=Mh(()=>{this.renderMinimap(),this.renderMask()},this.options.delay)}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_DRAW,this.onDraw),t.on(Ae.AFTER_RENDER,this.onRender),t.on(Ae.AFTER_ANIMATE,this.onRender),t.on(Ae.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.onDraw),t.off(Ae.AFTER_RENDER,this.onRender),t.off(Ae.AFTER_ANIMATE,this.onRender),t.off(Ae.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e,element:n}=this.context,i=e.getData(),a={nodes:i.nodes.filter(l=>n==null?void 0:n.getElement(Qt(l))),edges:i.edges.filter(l=>{const c=n==null?void 0:n.getElement(Qt(l));return c&&dx(c)}),combos:i.combos.filter(l=>n==null?void 0:n.getElement(Qt(l)))};if(!t)return a;const{nodes:s,edges:o,combos:A}=a;return{nodes:s.filter(l=>t(Qt(l),"node")),edges:o.filter(l=>t(Qt(l),"edge")),combos:A.filter(l=>t(Qt(l),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context,A=(l,c)=>{const u=Qt(l),h=o==null?void 0:o.getElement(u);if(!h)return;const d=h.getShape("key");let f;if(typeof s=="string"){const g=s;f=h.getShape(g).cloneNode()}else{const g=s(u,c,h);g===h?f=g.cloneNode(!0):f=g}f.setPosition(d.getPosition()),h.style.zIndex&&(f.style.zIndex=h.style.zIndex),f.id=h.id,t.appendChild(f)};t.removeChildren(),i.forEach(l=>A(l,"edge")),a.forEach(l=>A(l,"combo")),n.forEach(l=>A(l,"node"))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[A,l]=f0({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&A.classList.add(i),this.container=A,this.canvas=l}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,A,l,c]=La(s),{min:u,max:h,center:d}=e.getBounds("elements"),f=h[0]-u[0],g=h[1]-u[1],v=i-c-A,m=a-o-l,w=v/f,C=m/g,F=Math.min(w,C),Q=this.createLandmark(d,d,F);n.gotoLandmark(Q,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(xs(n)),s=this.canvas.canvas2Viewport(xs(i)),o=s.x-a.x,A=s.y-a.y;return[a.x,a.y,o,A]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=LA(a+n,t),n=0),i<0&&(s=LA(s+i,e),i=0),n+a>t&&(a=NA(t-n,0)),i+s>e&&(s=NA(e-i,0)),[LA(n,t),LA(i,e),NA(a,0),NA(s,0)]}renderMask(){const{maskStyle:t}=this.options;this.mask||(this.mask=document.createElement("div"),this.mask.addEventListener("pointerdown",this.onMaskDragStart),this.mask.draggable=!0,this.mask.addEventListener("dragstart",e=>e.preventDefault&&e.preventDefault())),this.container.appendChild(this.mask),Object.assign(this.mask.style,Object.assign(Object.assign({},t),{cursor:"move",position:"absolute",pointerEvents:"auto"})),this.updateMask()}updateMask(){if(!this.mask)return;const[t,e,n,i]=this.calculateMaskBBox();Object.assign(this.mask.style,{top:e+"px",left:t+"px",width:n+"px",height:i+"px"})}destroy(){var t,e,n;this.unbindEvents(),(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.mask)===null||e===void 0||e.remove(),(n=this.container)===null||n===void 0||n.remove(),super.destroy()}}v0.defaultOptions={size:[240,160],shape:"key",padding:10,position:"right-bottom",maskStyle:{border:"1px solid #ddd",background:"rgba(0, 0, 0, 0.1)"},containerStyle:{border:"1px solid #ddd",background:"#fff"},delay:128};const LA=(r,t)=>Math.min(r,t),NA=(r,t)=>Math.max(r,t);var A1=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};const l1={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class p0 extends mi{constructor(t,e){super(t,Object.assign({},p0.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new hl({style:Object.assign(Object.assign({},l1),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new hl({style:Object.assign(Object.assign({},l1),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>A1(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:A}=this.options,{min:[l,c],max:[u,h],center:[d,f]}=i;let g=0,v=0;s!==null&&(Gi(u,s){const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,A],max:[l,c],center:[u,h]}=i;let d=null,f=null,g=null,v=null,m=null,w=null;return this.getNodes().some(C=>{if(Dr(n.id,C.id))return!1;const F=T2(C,s).getRenderBounds(),{min:[Q,D],max:[K,G],center:[J,$]}=F;return d===null&&(Gi(J,u){this.initSnapline()},this.onDrag=n=>A1(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=T2(i,this.options.shape).getRenderBounds(),s=this.calcSnaplineMetadata(i,a);this.hideSnapline(),(s.verticalX!==null||s.horizontalY!==null)&&this.updateSnapline(s),this.options.autoSnap&&(yield this.autoSnapToLine(i.id,a,s))}),this.onDragEnd=()=>{this.hideSnapline()},this.bindEvents()}getNodes(){var t;const{filter:e}=this.options,i=(((t=this.context.element)===null||t===void 0?void 0:t.getNodes())||[]).filter(a=>{var s;return dx(a)&&((s=this.context.viewport)===null||s===void 0?void 0:s.isInViewport(a.getRenderBounds()))});return e?i.filter(a=>e(a)):i}hideSnapline(){this.horizontalLine.style.visibility="hidden",this.verticalLine.style.visibility="hidden"}getLineWidth(t){const{lineWidth:e}=this.options[`${t}LineStyle`];return+(e||l1.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[A,l]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?A:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?l:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return bs([t.dx,t.dy],e)}bindEvents(){return A1(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on($a.DRAG_START,this.onDragStart),t.on($a.DRAG,this.onDrag),t.on($a.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off($a.DRAG_START,this.onDragStart),t.off($a.DRAG,this.onDrag),t.off($a.DRAG_END,this.onDragEnd)}destroyElements(){var t,e;(t=this.horizontalLine)===null||t===void 0||t.destroy(),(e=this.verticalLine)===null||e===void 0||e.destroy()}destroy(){this.destroyElements(),this.unbindEvents(),super.destroy()}}p0.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Gi=(r,t)=>Math.abs(r-t),T2=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var F2=null,I_=null;function m0(r){return r instanceof Date?r:new Date(r)}function L_(r){for(var t=__read(r,2),e=t[0],n=t[1],i=F2.indexOf(e),a=F2.indexOf(n),s="",o=i;o<=a;o+=1)if(s+=I_[o],o2&&(A=":"),s+=A}return s}function ia(r,t){var e={YYYY:r.getFullYear(),MM:r.getMonth()+1,DD:r.getDate(),HH:r.getHours(),mm:r.getMinutes(),ss:r.getSeconds()},n=t;return Object.keys(e).forEach(function(i){var a=e[i];n=n.replace(i,i==="YYYY"?"".concat(a):"".concat(a).padStart(2,"0"))}),n}function nK(r,t){return m0(r).getTime()-m0(t).getTime()}function rK(r,t){var e=__read([m0(r),m0(t)],2),n=e[0],i=e[1];return n.getFullYear()!==i.getFullYear()?"year":n.getMonth()!==i.getMonth()?"month":n.getDay()!==i.getDay()?"day":n.getHours()!==i.getHours()?"hour":n.getMinutes()!==i.getMinutes()?"minute":"second"}function iK(r,t){var e=new Date(r),n={year:function(i){i.setMonth(0),i.setHours(0,0,0,0)},month:function(i){i.setDate(1),i.setHours(0,0,0,0)},day:function(i){return i.setHours(0,0,0,0)},hour:function(i){return i.setMinutes(0,0,0)},minute:function(i){return i.setSeconds(0,0)},second:function(i){return i.setMilliseconds(0)}};return n[t](e),ia(e,L_(["year",t]))}function N_(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i180?1:0,G=r>t?0:1,J=!1;return J?"M".concat(e,",").concat(n,",L").concat(f,",").concat(g,",A").concat(o,",").concat(A,",0,").concat(K,",").concat(G,",").concat(m,",").concat(w,",L").concat(e,",").concat(n):"M".concat(f,",").concat(g,",A").concat(o,",").concat(A,",0,").concat(K,",").concat(G,",").concat(m,",").concat(w)}function Y_(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return(0,z.ev)((0,z.ev)([e,n],(0,z.CR)(i),!1),[a],!1)}function X_(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius,A=t.classNamePrefix;return r.selectAll(Je.line.class).data([{d:D2.apply(void 0,(0,z.ev)((0,z.ev)([i,a],(0,z.CR)(s),!1),[o],!1))}],function(l,c){return c}).join(function(l){var c=l.append("path").attr("className",Je.line.name).styles(t).styles({d:function(u){return u.d}});return Ua(c,Je.line,Vn.line,A),c},function(l){return l.transition(function(){var c=this,u=W_(this,Y_(this),(0,z.ev)((0,z.ev)([i,a],(0,z.CR)(s),!1),[o],!1),n.update);if(u){var h=function(){var d=Mi(c.attributes,"__keyframe_data__");c.style.d=D2.apply(void 0,(0,z.ev)([],(0,z.CR)(d),!1))};u.onframe=h,u.onfinish=h}return u}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function J_(r,t){var e=t.truncRange,n=t.truncShape,i=t.lineExtension}function q_(r,t,e){e===void 0&&(e=[0,0]);var n=(0,z.CR)([r,t,e],3),i=(0,z.CR)(n[0],2),a=i[0],s=i[1],o=(0,z.CR)(n[1],2),A=o[0],l=o[1],c=(0,z.CR)(n[2],2),u=c[0],h=c[1],d=(0,z.CR)([A-a,l-s],2),f=d[0],g=d[1],v=Math.sqrt(Math.pow(f,2)+Math.pow(g,2)),m=(0,z.CR)([-u/v,h/v],2),w=m[0],C=m[1];return[w*f,w*g,C*f,C*g]}function R2(r){var t=(0,z.CR)(r,2),e=(0,z.CR)(t[0],2),n=e[0],i=e[1],a=(0,z.CR)(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function $_(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,A=t.lineExtension,l=t.classNamePrefix,c=(0,z.CR)([a,s],2),u=(0,z.CR)(c[0],2),h=u[0],d=u[1],f=(0,z.CR)(c[1],2),g=f[0],v=f[1],m=(0,z.CR)(A?q_(a,s,A):new Array(4).fill(0),4),w=m[0],C=m[1],F=m[2],Q=m[3],D=function(Ft){return r.selectAll(Je.line.class).data(Ft,function(_t,Xt){return Xt}).join(function(_t){var Xt=_t.append("line").styles(e).transition(function(ie){return Os(this,R2(ie.line),!1)});return Xt.attr("className",function(ie){if(!l)return"".concat(Je.line.name," ").concat(ie.className);var le=Dh(Je.line.name,Vn.line,l);if(ie.className===Je.lineFirst.name){var ve=Dh(Je.lineFirst.name,Vn.lineFirst,l);return"".concat(le," ").concat(ve)}if(ie.className===Je.lineSecond.name){var ve=Dh(Je.lineSecond.name,Vn.lineSecond,l);return"".concat(le," ").concat(ve)}return le}),Xt},function(_t){return _t.styles(e).transition(function(Xt){var ie=Xt.line;return Os(this,R2(ie),n.update)})},function(_t){return _t.remove()}).transitions()};if(!i||!o)return D([{line:[[h+w,d+C],[g+F,v+Q]],className:Je.line.name}]);var K=(0,z.CR)(o,2),G=K[0],J=K[1],$=g-h,at=v-d,At=(0,z.CR)([h+$*G,d+at*G],2),pt=At[0],wt=At[1],bt=(0,z.CR)([h+$*J,d+at*J],2),Rt=bt[0],Pt=bt[1],xt=D([{line:[[h+w,d+C],[pt,wt]],className:Je.lineFirst.name},{line:[[Rt,Pt],[g+F,v+Q]],className:Je.lineSecond.name}]);return J_(r,t),xt}function t4(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,A=e.lineArrowSize,l;if(t==="arc"?l=r.select(Je.line.class):a?l=r.select(Je.lineSecond.class):l=r.select(Je.line.class),!i||!s||e.type==="arc"&&P2(e.startAngle,e.endAngle)){var c=l.node();c&&(c.style.markerEnd=void 0);return}var u=Po(s);u.attr(n),r1(u,A,!0),l.style("markerEnd",u).style("markerEndOffset",-o)}function e4(r,t,e){var n=t.type,i,a=en(t,"line");return n==="linear"?i=$_(r,t,f1(a,"arrow"),e):i=X_(r,t,f1(a,"arrow"),e),t4(r,n,t,a),i}function n4(r,t){return v1(r,t.gridDirection,t)}function _2(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function r4(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=(0,z.CR)(E0(a,t),2),o=s[0],A=s[1],l=(0,z.CR)(Do(n4(a,t),e),2),c=l[0],u=l[1];return{id:i,points:[[o,A],[o+c,A+u]]}})}function i4(r,t){var e=t.gridControlAngles,n=_2(t);if(!n)throw new Error("grid center is not provide");if(r.length<2)throw new Error("Invalid grid data");if(!e||e.length===0)throw new Error("Invalid gridControlAngles");var i=(0,z.CR)(n,2),a=i[0],s=i[1];return r.map(function(o,A){var l=o.value,c=(0,z.CR)(E0(l,t),2),u=c[0],h=c[1],d=(0,z.CR)([u-a,h-s],2),f=d[0],g=d[1],v=[];return e.forEach(function(m){var w=Zc(m),C=(0,z.CR)([Math.cos(w),Math.sin(w)],2),F=C[0],Q=C[1],D=f*F-g*Q+a,K=f*Q+g*F+s;v.push([D,K])}),{points:v,id:A}})}function a4(r,t,e,n){var i=e.classNamePrefix,a=en(e,"grid"),s=a.type,o=a.areaFill,A=_2(e),l=g1(t,e.gridFilter),c=s==="segment"?r4(l,e):i4(l,e),u=(0,z.pi)((0,z.pi)({},a),{center:A,areaFill:Wt(o)?l.map(function(h,d){return ga(o,[h,d,l])}):o,animate:n,data:c});return r.selectAll(Je.grid.class).data([1]).join(function(h){var d=h.append(function(){return new G_({style:u})}).attr("className",Je.grid.name);return Ua(d,Je.grid,Vn.grid,i),d},function(h){return h.transition(function(){return this.update(u)})},function(h){return h.remove()}).transitions()}function Fi(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=!1),n&&r===t||i&&r===e?!0:r>t&&r0,w=n-A,C=i-l,F=h*C-d*w;if(F<0===m)return!1;var Q=f*C-g*w;return!(Q<0===m||F>v===m||Q>v===m)}function K2(r,t){var e=[[r[0],r[1],r[2],r[3]],[r[2],r[3],r[4],r[5]],[r[4],r[5],r[6],r[7]],[r[6],r[7],r[0],r[1]]];return e.some(function(n){return G2(t,n)})}var cK={lineToLine:G2,intersectBoxLine:K2,getBounds:B0};function d4(r,t,e){var n,i,a=B0(r,e).flat(1),s=B0(t,e).flat(1),o=[[a[0],a[1],a[2],a[3]],[a[0],a[1],a[4],a[5]],[a[4],a[5],a[6],a[7]],[a[2],a[3],a[6],a[7]]];try{for(var A=(0,z.XA)(o),l=A.next();!l.done;l=A.next()){var c=l.value;if(K2(s,c))return!0}}catch(u){n={error:u}}finally{try{l&&!l.done&&(i=A.return)&&i.call(A)}finally{if(n)throw n.error}}return!1}function f4(r,t){var e=r.type,n=r.labelDirection,i=r.crossSize;if(!i)return!1;if(e==="arc"){var a=r.center,s=r.radius,o=(0,z.CR)(a,2),A=o[0],l=o[1],c=n==="negative"?0:i,u=-s-c,h=s+c,d=(0,z.CR)(Ti(t),4),f=d[0],g=d[1],v=d[2],m=d[3];return new m1(A+u-m,l+u-f,A+h+g,l+h+v)}var w=(0,z.CR)(r.startPos,2),C=w[0],F=w[1],Q=(0,z.CR)(r.endPos,2),D=Q[0],K=Q[1],G=(0,z.CR)(U2(r)?[-t,0,t,0]:[0,t,0,-t],4),J=G[0],$=G[1],at=G[2],At=G[3],pt=Yc(0,r),wt=Do(pt,i),bt=new m1(C,F,D,K);return bt.x1+=At,bt.y1+=J,bt.x2+=$+wt[0],bt.y2+=at+wt[1],bt}function b0(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,A=f4(t,a),l=function(f){return A?h4(A,f):!0},c=function(f,g){return!f||!f.firstChild?!0:!d4(f.firstChild,g.firstChild,Ti(e))};try{for(var u=(0,z.XA)(r),h=u.next();!h.done;h=u.next()){var d=h.value;l(d)?!o||c(o,d)?o=d:(s.add(o),s.add(d)):s.add(d)}}catch(f){n={error:f}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return Array.from(s)}function y1(r,t){return t===void 0&&(t={}),Pe(r)?0:typeof r=="number"?r:Math.floor(u_(r,t))}function g4(r,t,e,n){if(!(r.length<=0)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,A=o===void 0?1/0:o,l=t.step,c=l===void 0?" ":l,u=t.margin,h=u===void 0?[0,0,0,0]:u,d=E2(n.getTextShape(r[0])),f=y1(c,d),g=s?y1(s,d):f,v=y1(A,d);(Pe(v)||v===1/0)&&(v=Math.max.apply(null,r.map(function(wt){return wt.getBBox().width})));for(var m=r.slice(),w=(0,z.CR)(h,4),C=w[0],F=C===void 0?0:C,Q=w[1],D=Q===void 0?0:Q,K=w[2],G=K===void 0?F:K,J=w[3],$=J===void 0?D:J,at=function(wt){if(m.forEach(function(bt){n.ellipsis(n.getTextShape(bt),wt,a)}),m=b0(r,e,h),m.length<1)return{value:void 0}},At=v;At>g+f;At-=f){var pt=at(At);if(typeof pt=="object")return pt.value}}}var v4=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},p4={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Ts(i),!1):!0})}},m4=function(r){return r.filter(v4)};function y4(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=p4.parity,A=function(C){return C.forEach(n.show),C},l=2,c=r.slice(),u=r.slice(),h=Math.min.apply(Math,(0,z.ev)([1],(0,z.CR)(r.map(function(C){return C.getBBox().width})),!1));if(e.type==="linear"&&(p1(e)||U2(e))){var d=w2(r[0]).left,f=w2(r[i-1]).right,g=Math.abs(f-d)||1;l=Math.max(Math.floor(i*h/g),l)}var v,m;for(a&&(v=c.splice(0,1)[0]),s&&(m=c.splice(-1,1)[0],c.reverse()),A(c);lo)){if(e.type==="linear"&&p1(e)){if(m(o),g())return}else for(var w=f;w<=o;w++)if(m(w),g())return;l&&m(d)}}var b4=new Map([["hide",y4],["rotate",w4],["ellipsis",g4],["wrap",B4]]);function x4(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!vR(r[0]):e==="rotate"?!r.some(function(n){var i;return!!(!((i=n.attr("transform"))===null||i===void 0)&&i.includes("rotate"))}):e==="ellipsis"||e==="wrap"?r.filter(function(n){return n.querySelector("text")}).length>=1:!0}function C4(r,t,e,n){var i=t.labelOverlap,a=i===void 0?[]:i;a.length&&a.forEach(function(s){var o=s.type,A=b4.get(o);x4(r,t,o)&&(A==null||A(r,s,t,n,e))})}function S4(){for(var r=[],t=0;th[0]&&G0&&Number.isFinite(r)?t:e},pK=function(r,t){return r*t},mK=function(r,t){return r/2+(t||0)/2},B1=function(r){return r};class tS{constructor(t){this.options=Ci({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=Ci({},this.options,t),this.rescale(t)}rescale(t){}}function b1(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function x0(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function z4(r,t,e,n,i){let a=e||0,s=n||r.length;const o=i||(A=>A);for(;at?s=A:a=A+1}return a}var V4=M(75196),W4=M.n(V4);function x1(r,t,e){let n=e;return n<0&&(n+=1),n>1&&(n-=1),n<1/6?r+(t-r)*6*n:n<1/2?t:n<2/3?r+(t-r)*(2/3-n)*6:r}function Z4(r){const t=r[0]/360,e=r[1]/100,n=r[2]/100,i=r[3];if(e===0)return[n*255,n*255,n*255,i];const a=n<.5?n*(1+e):n+e-n*e,s=2*n-a,o=x1(s,a,t+1/3),A=x1(s,a,t),l=x1(s,a,t-1/3);return[o*255,A*255,l*255,i]}function eS(r){const t=W4().get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?Z4(n):null}const C0=(r,t)=>e=>r*(1-e)+t*e,j4=(r,t)=>{const e=eS(r),n=eS(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const u=e[c],h=n[c];a[c]=u*(1-i)+h*i}const[s,o,A,l]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(A)}, ${l})`}},Y4=(r,t)=>typeof r=="number"&&typeof t=="number"?C0(r,t):typeof r=="string"&&typeof t=="string"?j4(r,t):()=>r,X4=(r,t)=>{const e=C0(r,t);return n=>Math.round(e(n))};function J4(r){return r===null}function nS(r){return!Ye(r)&&!J4(r)&&!Number.isNaN(r)}const C1=Math.sqrt(50),S1=Math.sqrt(10),M1=Math.sqrt(2);function S0(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/QA(10,i);return i>=0?(a>=C1?10:a>=S1?5:a>=M1?2:1)*QA(10,i):-QA(10,-i)/(a>=C1?10:a>=S1?5:a>=M1?2:1)}function yK(r,t,e){const n=Math.abs(t-r)/Math.max(0,e);let i=QA(10,Math.floor(Math.log(n)/Math.LN10));const a=n/i;return a>=C1?i*=10:a>=S1?i*=5:a>=M1&&(i*=2),t{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],A;return o0?(s=Math.floor(s/A)*A,o=Math.ceil(o/A)*A,A=S0(s,o,e)):A<0&&(s=Math.ceil(s*A)/A,o=Math.floor(o*A)/A,A=S0(s,o,e)),A>0?(n[i]=Math.floor(s/A)*A,n[a]=Math.ceil(o/A)*A):A<0&&(n[i]=Math.ceil(s*A)/A,n[a]=Math.floor(o*A)/A),n};function $4(r,t){const e=tt?r:t;return i=>Math.min(Math.max(e,i),n)}const tH=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,A;return n{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,A=s?[...t].reverse():t;for(let l=0;l{const c=z4(r,l,1,n)-1,u=i[c],h=a[c];return x0(h,u)(l)}},rS=(r,t,e,n)=>(Math.min(r.length,t.length)>2?eH:tH)(r,t,n?X4:e);class nH extends tS{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:C0,tickCount:5}}map(t){return nS(t)?this.output(t):this.options.unknown}invert(t){return nS(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...i]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...i)}getTicks(){const{tickMethod:t}=this.options,[e,n,i,...a]=this.getTickMethodOptions();return t(e,n,i,...a)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options,n=t[0],i=t[t.length-1];return[n,i,e]}chooseNice(){return q4}rescale(){this.nice();const[t,e]=this.chooseTransforms();this.composeOutput(t,this.chooseClamp(t)),this.composeInput(t,e,this.chooseClamp(e))}chooseClamp(t){const{clamp:e,range:n}=this.options,i=this.options.domain.map(t),a=Math.min(i.length,n.length);return e?$4(i[0],i[a-1]):B1}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=rS(n.map(t),i,s,a);this.output=x0(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=rS(a,i.map(t),C0);this.input=x0(e,n,s)}}const rH=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=S0(a,s,e);if(o===0||!Number.isFinite(o))return[];if(o>0){a=Math.ceil(a/o),s=Math.floor(s/o),i=new Array(n=Math.ceil(s-a+1));for(let A=0;A`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class F1 extends tS{getDefaultOptions(){return{domain:[],range:[],unknown:T1}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&sS(this.domainIndexMap,this.getDomain(),this.domainKey),oS({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&sS(this.rangeIndexMap,this.getRange(),this.rangeKey),oS({value:this.rangeKey(t),mapper:this.rangeIndexMap,from:this.getRange(),to:this.getDomain(),notFoundReturn:this.options.unknown})}rescale(t){const[e]=this.options.domain,[n]=this.options.range;if(this.domainKey=AS(e),this.rangeKey=AS(n),!this.rangeIndexMap){this.rangeIndexMap=new Map,this.domainIndexMap=new Map;return}(!t||t.range)&&this.rangeIndexMap.clear(),(!t||t.domain||t.compare)&&(this.domainIndexMap.clear(),this.sortedDomain=void 0)}clone(){return new F1(this.options)}getRange(){return this.options.range}getDomain(){if(this.sortedDomain)return this.sortedDomain;const{domain:t,compare:e}=this.options;return this.sortedDomain=e?[...t].sort(e):t,this.sortedDomain}}function oH(r){const t=Math.min(...r);return r.map(e=>e/t)}function AH(r,t){const e=r.length,n=t-e;return n>0?[...r,...new Array(n).fill(1)]:n<0?r.slice(0,t):r}function lH(r){return Math.round(r*1e12)/1e12}function cH(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,A=t.length,l=AH(a,A),[c,u]=e,h=u-c,d=2/A*n+1-1/A*i,f=h/d,g=f*i/A,v=f-A*g,m=oH(l),w=m.reduce((At,pt)=>At+pt),C=v/w,F=new aS(t.map((At,pt)=>{const wt=m[pt]*C;return[At,s?Math.floor(wt):wt]})),Q=new aS(t.map((At,pt)=>{const bt=m[pt]*C+g;return[At,s?Math.floor(bt):bt]})),D=Array.from(Q.values()).reduce((At,pt)=>At+pt),G=(h-(D-D/A*i))*o,J=c+G;let $=s?Math.round(J):J;const at=new Array(A);for(let At=0;Ath+C*c);return{valueStep:c,valueBandWidth:u,adjustedRange:m}}class O1 extends F1{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:T1,flex:[]}}constructor(t){super(t)}clone(){return new O1(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:A}=uH({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=A,this.valueBandWidth=o,this.adjustedRange=s}}var hH=function(r){(0,z.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,z._T)(e,["style"]);return n=r.call(this,Ci({},{type:"column"},(0,z.pi)({style:i},a)))||this,n.columnsGroup=new oi({name:"columns"}),n.appendChild(n.columnsGroup),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.columns,i=e.x,a=e.y;this.columnsGroup.style.transform="translate(".concat(i,", ").concat(a,")"),Le(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(Zr({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(ir),dH=function(r){(0,z.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,z._T)(e,["style"]);return n=r.call(this,Ci({},{type:"lines"},(0,z.pi)({style:i},a)))||this,n.linesGroup=n.appendChild(new oi),n.areasGroup=n.appendChild(new oi),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(Zr({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){Le(this.linesGroup).selectAll(".line").data(e).join(function(n){return n.append("path").attr("className","line").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.attr(i)})},function(n){return n.remove()})},t.prototype.renderAreas=function(e){Le(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(ir);function fH(r,t,e,n){var i,a=[],s=!!n,o,A,l=[1/0,1/0],c=[-1/0,-1/0],u,h,d;if(s){i=(0,z.CR)(n,2),l=i[0],c=i[1];for(var f=0,g=r.length;fs&&(e=(0,z.CR)([s,o],2),o=e[0],s=e[1]),r.map(function(A){var l=A.map(function(c,u){return[n.map(u),hr(i.map(c),o,s)]});return l})}function Gh(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return(0,z.ev)([a===e?"M":"L"],(0,z.CR)(i),!1)});return t?n.reverse():n}function M0(r,t){if(t===void 0&&(t=!1),r.length<=2)return Gh(r);for(var e=[],n=r.length,i=0;i=0;i-=1){var a=r[i],s=Gh(a),o=void 0;if(i===0)o=I1(s,t,e);else{var A=r[i-1],l=Gh(A,!0);l[0][0]="L",o=(0,z.ev)((0,z.ev)((0,z.ev)([],(0,z.CR)(s),!1),(0,z.CR)(l),!1),[["Z"]],!1)}n.push(o)}return n}function yH(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=M0(a),o=void 0;if(i===0)o=I1(s,t,e);else{var A=r[i-1],l=M0(A,!0),c=a[0];l[0][0]="L",o=(0,z.ev)((0,z.ev)((0,z.ev)([],(0,z.CR)(s),!1),(0,z.CR)(l),!1),[(0,z.ev)(["M"],(0,z.CR)(c),!1),["Z"]],!1)}n.push(o)}return n}var wH=function(r,t){if(Ni(r)){for(var e,n=1/0,i=0;in&&(e=a,n=s)}return e}};function lS(r){return r.length===0?[0,0]:[$l(wH(r,function(t){return $l(t)||0})),tc(EH(r,function(t){return tc(t)||0}))]}function cS(r){for(var t=Nc(r),e=t[0].length,n=(0,z.CR)([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s=0?(o[A]+=i[A],i[A]=o[A]):(o[A]+=a[A],a[A]=o[A]);return t}var BH=function(r){(0,z.ZT)(t,r);function t(e){return r.call(this,e,{type:"line",x:0,y:0,width:200,height:20,isStack:!1,color:["#83daad","#edbf45","#d2cef9","#e290b3","#6f63f4"],smooth:!0,lineLineWidth:1,areaOpacity:0,isGroup:!1,columnLineWidth:1,columnStroke:"#fff",scale:1,spacing:0})||this}return Object.defineProperty(t.prototype,"rawData",{get:function(){var e=this.attributes.data;if(!e||(e==null?void 0:e.length)===0)return[[]];var n=Nc(e);return ye(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?cS(this.rawData):this.rawData},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scales",{get:function(){return this.createScales(this.data)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"baseline",{get:function(){var e=this.scales.y,n=(0,z.CR)(e.getOptions().domain||[0,0],2),i=n[0],a=n[1];return a<0?e.map(a):e.map(i<0?0:i)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"containerShape",{get:function(){var e=this.attributes,n=e.width,i=e.height;return{width:n,height:i}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"linesStyle",{get:function(){var e=this,n=this.attributes,i=n.type,a=n.isStack,s=n.smooth;if(i!=="line")throw new Error("linesStyle can only be used in line type");var o=en(this.attributes,"area"),A=en(this.attributes,"line"),l=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var u=this.scales,h=u.x,d=u.y,f=vH(c,{type:"line",x:h,y:d}),g=[];if(o){var v=this.baseline;a?g=s?yH(f,l,v):mH(f,l,v):g=pH(f,s,l,v)}return{lines:f.map(function(m,w){return(0,z.pi)({stroke:e.getColor(w),d:s?M0(m):Gh(m)},A)}),areas:g.map(function(m,w){return(0,z.pi)({d:m,fill:e.getColor(w)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=en(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var A=this.containerShape.height,l=this.rawData;if(!l)return{columns:[]};a&&(l=cS(l));var c=this.createScales(l),u=c.x,h=c.y,d=(0,z.CR)(lS(l),2),f=d[0],g=d[1],v=new Hh({domain:[0,g-(f>0?0:f)],range:[0,A*o]}),m=u.getBandWidth(),w=this.rawData;return{columns:l.map(function(C,F){return C.map(function(Q,D){var K=m/l.length,G=function(){return{x:u.map(D)+K*F,y:Q>=0?h.map(Q):h.map(0),width:K,height:v.map(Math.abs(Q))}},J=function(){return{x:u.map(D),y:h.map(Q),width:m,height:v.map(w[F][D])}};return(0,z.pi)((0,z.pi)({fill:e.getColor(F)},n),a?J():G())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){SR(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),A=(0,z.pi)({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);Le(n).selectAll(".spark").data([i]).join(function(l){return l.append(function(c){return c==="line"?new dH({className:o,style:A}):new hH({className:o,style:A})}).attr("className","spark ".concat(o))},function(l){return l.update(A)},function(l){return l.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Ni(n)?n[e%n.length]:Wt(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,A=a.range,l=A===void 0?[]:A,c=a.spacing,u=this.containerShape,h=u.width,d=u.height,f=(0,z.CR)(lS(e),2),g=f[0],v=f[1],m=new Hh({domain:[(n=l[0])!==null&&n!==void 0?n:g,(i=l[1])!==null&&i!==void 0?i:v],range:[d,d*(1-o)]});return s==="line"?{type:s,x:new Hh({domain:[0,e[0].length-1],range:[0,h]}),y:m}:{type:s,x:new O1({domain:e[0].map(function(w,C){return C}),range:[0,h],paddingInner:c,paddingOuter:c/2,align:.5}),y:m}},t.tag="sparkline",t}(Sr),uS={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},hS={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},dS={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},so=Fs({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),ns=Fs({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),bH=function(r){(0,z.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,A=e.radius,l=A===void 0?o/4:A,c=e.orientation,u=e.classNamePrefix,h=(0,z._T)(e,["x","y","size","radius","orientation","classNamePrefix"]),d=o,f=d*2.4,g=u?"".concat(ns.iconRect.name," ").concat(u,"handle-icon-rect"):ns.iconRect.name,v=function(D){return u?"".concat(ns.iconLine,"-").concat(D," ").concat(u,"handle-icon-line"):"".concat(ns.iconLine,"-").concat(D)},m=Le(n).maybeAppendByClassName(ns.iconRect,"rect").attr("className",g).styles((0,z.pi)((0,z.pi)({},h),{width:d,height:f,radius:l,x:i-d/2,y:a-f/2,transformOrigin:"center"})),w=i+1/3*d-d/2,C=i+2/3*d-d/2,F=a+1/4*f-f/2,Q=a+3/4*f-f/2;m.maybeAppendByClassName("".concat(ns.iconLine,"-1"),"line").attr("className",v(1)).styles((0,z.pi)({x1:w,x2:w,y1:F,y2:Q},h)),m.maybeAppendByClassName("".concat(ns.iconLine,"-2"),"line").attr("className",v(2)).styles((0,z.pi)({x1:C,x2:C,y1:F,y2:Q},h)),c==="vertical"&&(m.node().style.transform="rotate(90)")},t}(Sr),xH=function(r){(0,z.ZT)(t,r);function t(e){return r.call(this,e,dS)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,A=en(this.attributes,"label"),l=A.x,c=l===void 0?0:l,u=A.y,h=u===void 0?0:u,d=A.transform,f=A.transformOrigin,g=(0,z._T)(A,["x","y","transform","transformOrigin"]),v=(0,z.CR)(Uo(g,[]),2),m=v[0],w=v[1],C=Le(e).maybeAppendByClassName(ns.labelGroup,"g").styles(w),F=(0,z.pi)((0,z.pi)({},hS),m),Q=F.text,D=(0,z._T)(F,["text"]);fa(!!o,C,function(K){n.label=K.maybeAppendByClassName(ns.label,"text").styles((0,z.pi)((0,z.pi)({},D),{x:a+c,y:s+h,transform:d,transformOrigin:f,text:"".concat(Q)})),n.label.on("mousedown",function(G){G.stopPropagation()}),n.label.on("touchstart",function(G){G.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,A=n.classNamePrefix,l=(0,z.pi)((0,z.pi)({x:i,y:a,orientation:s,classNamePrefix:A},uS),en(this.attributes,"icon")),c=this.attributes.iconShape,u=c===void 0?function(){return new bH({style:l})}:c,h=Le(e).maybeAppendByClassName(ns.iconGroup,"g");h.selectAll(ns.icon.class).data([u]).join(function(d){return d.append(typeof u=="string"?u:function(){return u(o)}).attr("className",ns.icon.name)},function(d){return d.update(l)},function(d){return d.remove()})},t.prototype.render=function(e,n){this.renderIcon(n),this.renderLabel(n)},t}(Sr),CH=function(r){(0,z.ZT)(t,r);function t(e){var n=r.call(this,e,(0,z.pi)((0,z.pi)((0,z.pi)({x:0,y:0,animate:{duration:100,fill:"both"},brushable:!0,formatter:function(i){return i.toString()},handleSpacing:2,orientation:"horizontal",padding:0,autoFitLabel:!0,scrollable:!0,selectionFill:"#5B8FF9",selectionFillOpacity:.45,selectionZIndex:2,showHandle:!0,showLabel:!0,slidable:!0,trackFill:"#416180",trackLength:200,trackOpacity:.05,trackSize:20,trackZIndex:-1,values:[0,1],type:"range",selectionType:"select",handleIconOffset:0},Vc(dS,"handle")),Vc(uS,"handleIcon")),Vc(hS,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal($2(a));var s=n.availableSpace,o=s.x,A=s.y,l=n.getBBox(),c=l.x,u=l.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,A])-n.getOrientVal([+c,+u])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,A=a.type;i.stopPropagation();var l=n.getOrientVal($2(i)),c=l-n.prevPos;if(c){var u=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(u);break;case"end":s&&n.setValuesOffset(0,u);break;case"selection":s&&n.setValuesOffset(u,u);break;case"track":if(!o)return;n.selectionWidth+=u,A==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break;default:break}n.prevPos=l}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,A=o==="range"?i:i[1],l=o==="range"?n.getValues():n.getValues()[1],c=new Vr("valuechange",{detail:{oldValue:A,value:l}});n.dispatchEvent(c),s==null||s(l)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=en(this.attributes,"sparkline");return(0,z.pi)((0,z.pi)({zIndex:0},this.availableSpace),n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"shape",{get:function(){var e=this.attributes,n=e.trackLength,i=e.trackSize,a=(0,z.CR)(this.getOrientVal([[n,i],[i,n]]),2),s=a[0],o=a[1];return{width:s,height:o}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.padding,s=(0,z.CR)(Ti(a),4),o=s[0],A=s[1],l=s[2],c=s[3],u=this.shape,h=u.width,d=u.height;return{x:c,y:o,width:h-(c+A),height:d-(o+l)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(so.selection.class).each(function(i,a){Os(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Os(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Os(this.endHandle,this.getHandleStyle("end"),e))},t.prototype.innerSetValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1);var i=this.values,a=this.clampValues(e);this.attributes.values=a,this.setValues(a),n&&this.onValueChange(i)},t.prototype.renderTrack=function(e){var n=this.attributes,i=n.x,a=n.y,s=en(this.attributes,"track");this.trackShape=Le(e).maybeAppendByClassName(so.track,"rect").styles((0,z.pi)((0,z.pi)({x:i,y:a},this.shape),s))},t.prototype.renderBrushArea=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.brushable;this.brushArea=Le(e).maybeAppendByClassName(so.brushArea,"rect").styles((0,z.pi)({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,A=Le(e).maybeAppendByClassName(so.sparklineGroup,"g");fa(o==="horizontal",A,function(l){var c=(0,z.pi)((0,z.pi)({},n.sparklineStyle),{x:a,y:s});l.maybeAppendByClassName(so.sparkline,function(){return new BH({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],A=a?o:[],l=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(so.handle.class).data(A.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(u){var h=u.type;return new xH({style:e.getHandleStyle(h)})}).each(function(u){var h=u.type;this.attr("class","".concat(so.handle.name," ").concat(h,"-handle"));var d="".concat(h,"Handle");l[d]=this,this.addEventListener("pointerdown",l.onDragStart(h))})},function(c){return c.each(function(u){var h=u.type;this.update(l.getHandleStyle(h))})},function(c){return c.each(function(u){var h=u.type,d="".concat(h,"Handle");l[d]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=Le(e).maybeAppendByClassName(so.foreground,"g");var A=en(this.attributes,"selection"),l=function(u){return u.style("visibility",function(h){return h.show?"visible":"hidden"}).style("cursor",function(h){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles((0,z.pi)((0,z.pi)({},A),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(so.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(u,h){return{style:(0,z.pi)({},u),index:h,show:o==="select"?h===1:h!==1}}),function(u){return u.index}).join(function(u){return u.append("rect").attr("className",so.selection.name).call(l).each(function(h,d){var f=this;d===1?(c.selectionShape=Le(this),this.on("pointerdown",function(g){f.attr("cursor","grabbing"),c.onDragStart("selection")(g)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){f.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){f.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){f.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(u){return u.call(l)},function(u){return u.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=(0,z.CR)(this.range,2),s=a[0],o=a[1],A=(0,z.CR)(this.getValues().map(function(v){return E1(v,n)}),2),l=A[0],c=A[1],u=Array.isArray(e)?e:[l,e!=null?e:c],h=(0,z.CR)((u||[l,c]).map(function(v){return E1(v,n)}),2),d=h[0],f=h[1];if(this.attributes.type==="value")return[0,hr(f,s,o)];d>f&&(i=(0,z.CR)([f,d],2),d=i[0],f=i[1]);var g=f-d;return g>o-s?[s,o]:do?c===o&&l===d?[d,o]:[o-g,o]:[d,f]},t.prototype.calcSelectionArea=function(e){var n=(0,z.CR)(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,A=s.y,l=s.width,c=s.height;return this.getOrientVal([[{y:A,height:c,x:o,width:i*l},{y:A,height:c,x:i*l+o,width:(a-i)*l},{y:A,height:c,x:a*l,width:(1-a)*l}],[{x:o,width:l,y:A,height:i*c},{x:o,width:l,y:i*c+A,height:(a-i)*c},{x:o,width:l,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,A=i.height,l=(0,z.CR)(this.clampValues(),2),c=l[0],u=l[1],h=e==="start"?-n:n,d=(e==="start"?c:u)*this.getOrientVal([o,A])+h;return{x:a+this.getOrientVal([d,o/2]),y:s+this.getOrientVal([A/2,d])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,A=i.autoFitLabel,l=en(this.attributes,"handle"),c=en(l,"label"),u=l.spacing,h=this.getHandleSize(),d=this.clampValues(),f=e==="start"?d[0]:d[1],g=o(f),v=new t1({style:(0,z.pi)((0,z.pi)((0,z.pi)({},c),this.inferTextStyle(e)),{text:g})}),m=v.getBBox(),w=m.width,C=m.height;if(v.destroy(),!A){if(a==="value")return{text:g,x:0,y:-C-u};var F=u+h+(s==="horizontal"?w/2:0);return n={text:g},n[s==="horizontal"?"x":"y"]=e==="start"?-F:F,n}var Q=0,D=0,K=this.availableSpace,G=K.width,J=K.height,$=this.calcSelectionArea()[1],at=$.x,At=$.y,pt=$.width,wt=$.height,bt=u+h;if(s==="horizontal"){var Rt=bt+w/2;if(e==="start"){var Pt=at-bt-w;Q=Pt>0?-Rt:Rt}else{var xt=G-at-pt-bt>w;Q=xt?Rt:-Rt}}else{var Ft=bt,_t=C+bt;e==="start"?D=At-h>C?-_t:Ft:D=J-(At+wt)-h>C?_t:-Ft}return{x:Q,y:D,text:g}},t.prototype.getHandleLabelStyle=function(e){var n=en(this.attributes,"handleLabel");return(0,z.pi)((0,z.pi)((0,z.pi)({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=en(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return(0,z.pi)({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,A=n.orientation,l=this.calcHandlePosition(e),c=l.x,u=l.y,h=this.calcHandleText(e),d=s;return!s&&o&&(this.target?d=!0:d=!1),(0,z.pi)((0,z.pi)((0,z.pi)({},Vc(this.getHandleIconStyle(),"icon")),Vc((0,z.pi)((0,z.pi)({},this.getHandleLabelStyle(e)),h),"label")),{transform:"translate(".concat(c+i,", ").concat(u+a,")"),orientation:A,showLabel:d,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=(0,z.CR)(e,2),i=n[0],a=n[1],s=this.attributes.orientation;return s==="horizontal"?i:a},t.prototype.setValuesOffset=function(e,n){n===void 0&&(n=0);var i=this.attributes.type,a=(0,z.CR)(this.getValues(),2),s=a[0],o=a[1],A=i==="range"?e:0,l=[s+A,o+n].sort();this.innerSetValues(l,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new Vr(i,{detail:s}))})},t.prototype.bindEvents=function(){this.addEventListener("wheel",this.onScroll);var e=this.brushArea;this.dispatchCustomEvent(e,"click","trackClick"),this.dispatchCustomEvent(e,"pointerenter","trackMouseenter"),this.dispatchCustomEvent(e,"pointerleave","trackMouseleave"),e.on("pointerdown",this.onDragStart("track"))},t.prototype.onScroll=function(e){var n=this.attributes.scrollable;if(n){var i=e.deltaX,a=e.deltaY,s=a||i,o=this.getRatio(s);this.setValuesOffset(o,o)}},t.tag="slider",t}(Sr),SH={backgroundFill:"#262626",backgroundLineCap:"round",backgroundLineWidth:1,backgroundStroke:"#333",backgroundZIndex:-1,formatter:function(r){return r.toString()},labelFill:"#fff",labelFontSize:12,labelTextBaseline:"middle",padding:[2,4],position:"right",radius:0,zIndex:999},L1=Fs({background:"background",labelGroup:"label-group",label:"label"},"indicator"),MH=function(r){(0,z.ZT)(t,r);function t(e){var n=r.call(this,e,SH)||this;return n.point=[0,0],n.group=n.appendChild(new oi({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=(0,z.CR)(Ti(i),4),s=a[0],o=a[1],A=a[2],l=a[3],c=this.label.node().getLocalBounds(),u=c.min,h=c.max,d=new _i(u[0]-l,u[1]-s,h[0]+o-u[0]+l,h[1]+A-u[1]+s),f=this.getPath(n,d),g=en(this.attributes,"background");this.background=Le(this.group).maybeAppendByClassName(L1.background,"path").styles((0,z.pi)((0,z.pi)({},g),{d:f})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=en(this.attributes,"label"),s=(0,z.CR)(Uo(a),2),o=s[0],A=s[1],l=o.text,c=(0,z._T)(o,["text"]);if(this.label=Le(this.group).maybeAppendByClassName(L1.labelGroup,"g").styles(A),!!i){var u=this.label.maybeAppendByClassName(L1.label,function(){return Po(n(i))}).style("text",n(i).toString());u.selectAll("text").styles(c)}},t.prototype.adjustLayout=function(){var e=(0,z.CR)(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,A=n.height,l=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+A-i],["A",i,i,0,0,1,a+o-i,s+A],["L",a+i,s+A],["A",i,i,0,0,1,a,s+A-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},u=c[e],h=this.createCorner([l[u].slice(-2),l[u+1].slice(-2)]);return l.splice.apply(l,(0,z.ev)([u+1,1],(0,z.CR)(h),!1)),l[0][0]="M",l},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=A_.apply(void 0,(0,z.ev)([],(0,z.CR)(e),!1)),s=(0,z.CR)(e,2),o=(0,z.CR)(s[0],2),A=o[0],l=o[1],c=(0,z.CR)(s[1],2),u=c[0],h=c[1],d=(0,z.CR)(a?[u-A,[A,u]]:[h-l,[l,h]],2),f=d[0],g=(0,z.CR)(d[1],2),v=g[0],m=g[1],w=f/2,C=f/Math.abs(f),F=n*C,Q=F/2,D=F*Math.sqrt(3)/2*i,K=(0,z.CR)([v,v+w-Q,v+w,v+w+Q,m],5),G=K[0],J=K[1],$=K[2],at=K[3],At=K[4];return a?(this.point=[$,l-D],[["L",G,l],["L",J,l],["L",$,l-D],["L",at,l],["L",At,l]]):(this.point=[A+D,$],[["L",A,G],["L",A,J],["L",A+D,$],["L",A,at],["L",A,At]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Ts(this):Qh(this)},t.prototype.bindEvents=function(){this.label.on(yn.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(Sr),TH=function(r){(0,z.ZT)(t,r);function t(e){var n=r.call(this,Zr({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new xi({})),n.label=n.background.appendChild(new oi({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Ti(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=en(this.attributes,"label");Le(this.label).maybeAppend(".label",function(){return Po(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=(0,z.CR)(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],A=e.width,l=e.height,c=A+o+a,u=l+i+s,h=en(this.attributes,"background"),d=this.style,f=d.width,g=f===void 0?0:f,v=d.height,m=v===void 0?0:v,w=d.selected;this.background.attr((0,z.pi)((0,z.pi)({},h),{width:Math.max(c,g),height:Math.max(u,m),fill:w?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((u-l)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(Sr),FH=function(r){(0,z.ZT)(t,r);function t(e){var n,i,a=r.call(this,Zr({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new xi({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new xi({className:"dropdown"}));var s=a.style.defaultValue;return s&&(!((i=a.style.options)===null||i===void 0)&&i.some(function(o){return o.value===s}))&&(a.currentValue=s),a}return t.prototype.setValue=function(e){this.currentValue=e,this.render()},t.prototype.getValue=function(){return this.currentValue},Object.defineProperty(t.prototype,"dropdownPadding",{get:function(){return Ti(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,A=i.height,l=i.bordered,c=i.showDropdownIcon,u=en(this.attributes,"select"),h=en(this.attributes,"placeholder");this.select.attr((0,z.pi)((0,z.pi)({x:a,y:s,width:o,height:A},u),{fill:"#fff",strokeWidth:l?1:0}));var d=this.dropdownPadding,f=10;c&&Le(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-f-d[1]-d[3],", ").concat(s+A/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var g=(n=this.style.options)===null||n===void 0?void 0:n.find(function(C){return C.value===e.currentValue}),v=(0,z.pi)({x:a+d[3]},h);Le(this.select).selectAll(".placeholder").data(g?[]:[1]).join(function(C){return C.append("text").attr("className","placeholder").styles(v).style("y",function(){var F=this.getBBox();return s+(A-F.height)/2})},function(C){return C.styles(v)},function(C){return C.remove()});var m=en(this.attributes,"optionLabel"),w=(0,z.pi)({x:a+d[3]},m);Le(this.select).selectAll(".value").data(g?[g]:[]).join(function(C){return C.append(function(F){return Po(F.label)}).attr("className","value").styles(w).style("y",function(){var F=this.getBBox();return s+(A-F.height)/2})},function(C){return C.styles(w)},function(C){return C.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,A=a.width,l=a.height,c=a.options,u=a.onSelect,h=a.open,d=en(this.attributes,"dropdown"),f=en(this.attributes,"option"),g=this.dropdownPadding;Le(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(w){return w.value}).join(function(w){return w.append(function(C){return new TH({className:"dropdown-item",style:(0,z.pi)((0,z.pi)((0,z.pi)({},C),f),{width:A-g[1]-g[3],selected:C.value===e.currentValue,onClick:function(F,Q,D){e.setValue(F),u==null||u(F,Q,D),e.dispatchEvent(new Vr("change",{detail:{value:F,option:Q,item:D}})),Ts(e.dropdown)}})})}).each(function(C,F){var Q,D=(Q=this.parentNode)===null||Q===void 0?void 0:Q.children,K=D.reduce(function(G,J,$){return $a.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,A=e.controllerHeight,l=hr(+s-A,0,+s),c=new _i(n,i+ +s-A,+a,A),u,h=0;o==="chart"?(h=35,u=new _i(n,i+l-h,+a,h)):u=new _i;var d=o==="time"?10:l,f=new _i(n,i+(o==="time"?l:l-d),+a,d-h);return{axisBBox:u,controllerBBox:c,timelineBBox:f}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=(0,z.CR)(Array.isArray(e)?e:[0,e],2),o=s[0],A=s[1],l=a.length,c=a[Math.floor(o*l)],u=a[Math.ceil(A*l)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=u==null?void 0:u.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=(0,z.CR)(Array.isArray(e)?e:[void 0,e],2),A=o[0],l=o[1],c=s.find(function(h){var d=h.time;return d===A}),u=s.find(function(h){var d=h.time;return d===l});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=u==null?void 0:u.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,A=(0,z.CR)(e,2),l=A[0],c=A[1];this.states.values=[(i=(n=o[l])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=(0,z.CR)(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],A=this.data,l=A.length,c=i==="value",u=function(){var d=A.findIndex(function(f){var g=f.time;return g===s});return c?0:d>-1?d/l:0},h=function(){if(o===1/0)return 1;var d=A.findIndex(function(f){var g=f.time;return g===o});return d>-1?d/l:c?.5:1};return[u(),h()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=(0,z.CR)(Array.isArray(n)?n:[this.data[0].time,n],2),s=a[0],o=a[1];return i==="value"?o:[s,o]},enumerable:!1,configurable:!0}),t.prototype.getDatumByRatio=function(e){var n=this.data,i=n.length,a=Math.floor(e*(i-1));return n[a]},Object.defineProperty(t.prototype,"chartHandleIconShape",{get:function(){var e=this.states.selectionType,n=this.space.timelineBBox.height;return e==="range"?function(i){return new KH({style:{type:i,height:n,iconSize:n/6}})}:function(){return new hl({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,A=this.states,l=A.selectionType,c=A.chartType,u=this.data,h=this.attributes,d=h.type,f=h.labelFormatter,g=en(this.attributes,"chart"),v=g.type,m=(0,z._T)(g,["type"]),w=l==="range";if(d==="time")return(0,z.pi)({handleIconShape:function(){return new GH({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:w?-15:0,autoFitLabel:w,handleSpacing:w?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:l,values:this.sliderValues,formatter:function(Q){if(f)return f(Q);var D=n.getDatumByRatio(Q).time;return typeof D=="number"?gS(D):ia(D,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m);var C=l==="range"?5:0,F=u.map(function(Q){var D=Q.value;return D});return(0,z.pi)({handleIconOffset:C,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:F,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:l,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},m)},t.prototype.renderChart=function(e){e===void 0&&(e=this.space.timelineBBox),this.timeline.update(this.getChartStyle(e))},t.prototype.updateSelection=function(){this.timeline.setValues(this.sliderValues,!0),this.handleSliderChange(this.sliderValues)},t.prototype.getAxisStyle=function(e){var n=this.data,i=this.attributes,a=i.interval,s=i.labelFormatter,o=en(this.attributes,"axis"),A=e.x,l=e.y,c=e.width,u=(0,z.ev)((0,z.ev)([],(0,z.CR)(n),!1),[{time:0}],!1).map(function(d,f,g){var v=d.time;return{label:"".concat(v),value:f/(g.length-1),time:v}}),h=(0,z.pi)({startPos:[A,l],endPos:[A+c,l],data:u,labelFilter:function(d,f){return fa?A==="value"?[0,0]:l==="acc"?[K(Q),K(Q)]:[0,K(D-Q)]:Q<0?l==="acc"?[0,K(D)]:[K(Q+a-D),a]:[K(Q),K(D)]},w=m(v);return this.setByIndex(w),this.updateSelection(),w},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,A=this.states.speed,l=A===void 0?1:A;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/l),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(Sr);function ZH(r){return r instanceof Date}var jH=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},YH=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{var f;const g=Object.assign(Object.assign({x:h[0]/2-A/2,y:d,onChange:v=>{const m=(Ni(v)?v:[v,v]).map(w=>ZH(w)?w.getTime():w);this.options.mode==="modify"?this.filterElements(m):this.hiddenElements(m),n==null||n(m)}},u),{data:a.map(v=>ye(v)?{time:v,value:0}:v),width:A,height:l,type:i});this.timebar?this.timebar.update(g):(this.timebar=new WH({style:g}),(f=this.canvas)===null||f===void 0||f.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[A,l]=f0({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=A,t&&A.classList.add(t),this.canvas=l,this.canvas}filterElements(t){return jH(this,void 0,void 0,function*(){var e;if(!this.originalData)return;const{elementTypes:n,getTime:i}=this.options,{graph:a,element:s}=this.context,o=vS(this.originalData);n.forEach(l=>{const c=`${l}s`;o[c]=(this.originalData[c]||[]).filter(u=>{const h=i(u);return!!pS(h,t)})});const A=[...o.nodes,...o.combos].map(l=>Qt(l));o.edges=o.edges.filter(l=>{const c=l.source,u=l.target;return A.includes(c)&&A.includes(u)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var A;const l=`${o}s`;(((A=this.originalData)===null||A===void 0?void 0:A[l])||[]).forEach(u=>{const h=Qt(u),d=i(u);pS(d,t)?s.push(h):a.push(h)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}T0.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>JH(r,XH,void 0),loop:!1};const vS=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},pS=(r,t)=>{if(ye(t))return r===t;const[e,n]=t;return r>=e&&r<=n},JH=(r,t,e)=>{var n;for(let i=0;i{const i=this.updateCanvas();this.renderTitle(i)},this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_RENDER,this.onRender),t.on(Ae.AFTER_ANIMATE,this.onRender)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_RENDER,this.onRender),t.off(Ae.AFTER_ANIMATE,this.onRender)}destroy(){var t,e;this.unbindEvents(),(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),super.destroy()}updateCanvas(){const{size:t,className:e,align:n}=this.options,[i]=this.context.canvas.getSize(),[a=0,,s=0]=this.padding,o=t+a+s;if(this.canvas){const{width:A,height:l}=this.canvas.getConfig();(i!==A||o!==l)&&this.canvas.resize(i,o)}else{const A={left:"left-top",center:"top",right:"right-top"},[l,c]=f0({width:i,height:o,placement:A[n]||A.left,className:"title-canvas",graphCanvas:this.context.canvas});e&&l.classList.add(e),this.container=l,this.canvas=c}return this.canvas}renderTitle(t){const e=new r6({options:this.options,ctx:this.context});t.removeChildren(),e.getTitle().forEach(n=>{n&&t.appendChild(n)})}}class r6{get padding(){return La(this.options.padding)}constructor(t){const{options:e,ctx:n}=t;this.options=e,this.context=n}getTitle(){const t=this.options,e=D1,n=t[e],i=yS,a=t[i],{spacing:s=44,padding:o,align:A}=t,l=qH(t,[typeof e=="symbol"?e:e+"",typeof i=="symbol"?i:i+"","spacing","padding","align"]),c=n,u=a,h=Or(l,D1),d=Or(l,yS),[f]=this.context.graph.getSize(),[g=0,v=0,,m=0]=this.padding,w=f,C=w-m-v;let F=null,Q=m,D="left";switch(A){case"left":Q=m,D="left";break;case"center":Q=w/2,D="center";break;case"right":Q=w-v,D="right";break;default:Q=m,D="left"}const K=new io({className:D1,style:Object.assign(Object.assign(Object.assign(Object.assign({},$H),{wordWrapWidth:C-5,x:Q,y:g,textAlign:D}),h),{text:c})}),G=K.getBBox();return u&&(F=new io({className:"subTitle",style:Object.assign(Object.assign(Object.assign(Object.assign({},t6),{wordWrapWidth:C-5,x:Q,y:G.height+s+g,textAlign:D}),d),{text:u})})),[K,F]}}function i6(r){const t={top:"unset",right:"unset",bottom:"unset",left:"unset"};return r.split("-").forEach(n=>{t[n]="8px"}),t.flexDirection=r.startsWith("top")||r.startsWith("bottom")?"row":"column",t}const a6=` .g6-toolbar { position: absolute; z-index: 100; display: flex; flex-direction: row; align-items: center; justify-content: center; border-radius: 4px; box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.1); opacity: 0.65; } .g6-toolbar .g6-toolbar-item { display: inline-block; width: 16px; height: 16px; padding: 4px; cursor: pointer; box-sizing: content-box; } .g6-toolbar .g6-toolbar-item:hover { background-color: #f0f0f0; } .g6-toolbar .g6-toolbar-item svg { display: inline-block; width: 100%; height: 100%; pointer-events: none; } `,s6=` `;var wS=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class F0 extends mi{constructor(t,e){super(t,Object.assign({},F0.defaultOptions,e)),this.$element=zc("toolbar",!1),this.onToolbarItemClick=i=>{const{onClick:a}=this.options;if(i.target instanceof Element&&i.target.className.includes("g6-toolbar-item")){const s=i.target.getAttribute("value");a==null||a(s,i.target)}};const n=this.context.canvas.getContainer();this.$element.style.display="flex",n.appendChild(this.$element),Vy("g6-toolbar-css","style",{},a6,document.head),Vy("g6-toolbar-svgicon","div",{display:"none"},s6),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return wS(this,void 0,void 0,function*(){e.update.call(this,t);const{className:n,position:i,style:a}=this.options;this.$element.className=`g6-toolbar ${n||""}`,Object.assign(this.$element.style,a,i6(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return wS(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>{var n;return`
`}).join("")})}}F0.defaultOptions={position:"top-left"};function R1(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function o6(r,t){return!r||!t?r:r.replace(/\\?\{([^{}]+)\}/g,function(e,n){return e.charAt(0)==="\\"?e.slice(1):t[n]===void 0?"":t[n]})}var A6=o6,ES=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,(0,z.ev)([],(0,z.CR)(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function _1(r){return r===void 0&&(r=""),{CONTAINER:"".concat(r,"tooltip"),TITLE:"".concat(r,"tooltip-title"),LIST:"".concat(r,"tooltip-list"),LIST_ITEM:"".concat(r,"tooltip-list-item"),NAME:"".concat(r,"tooltip-list-item-name"),MARKER:"".concat(r,"tooltip-list-item-marker"),NAME_LABEL:"".concat(r,"tooltip-list-item-name-label"),VALUE:"".concat(r,"tooltip-list-item-value"),CROSSHAIR_X:"".concat(r,"tooltip-crosshair-x"),CROSSHAIR_Y:"".concat(r,"tooltip-crosshair-y")}}var BS={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function l6(r){var t;r===void 0&&(r="");var e=_1(r);return t={},t[".".concat(e.CONTAINER)]={position:"absolute",visibility:"visible","z-index":8,transition:"visibility 0.2s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1), top 0.4s cubic-bezier(0.23, 1, 0.32, 1)","background-color":"rgba(255, 255, 255, 0.96)","box-shadow":"0 6px 12px 0 rgba(0, 0, 0, 0.12)","border-radius":"4px",color:"rgba(0, 0, 0, 0.65)","font-size":"12px","line-height":"20px",padding:"12px","min-width":"120px","max-width":"360px","font-family":"Roboto-Regular"},t[".".concat(e.TITLE)]={color:"rgba(0, 0, 0, 0.45)"},t[".".concat(e.LIST)]={margin:"0px","list-style-type":"none",padding:"0px"},t[".".concat(e.LIST_ITEM)]={"list-style-type":"none",display:"flex","line-height":"2em","align-items":"center","justify-content":"space-between","white-space":"nowrap"},t[".".concat(e.MARKER)]={width:"8px",height:"8px","border-radius":"50%",display:"inline-block","margin-right":"4px"},t[".".concat(e.NAME)]={display:"flex","align-items":"center","max-width":"216px"},t[".".concat(e.NAME_LABEL)]=(0,z.pi)({flex:1},BS),t[".".concat(e.VALUE)]=(0,z.pi)({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},BS),t[".".concat(e.CROSSHAIR_X)]={position:"absolute",width:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t[".".concat(e.CROSSHAIR_Y)]={position:"absolute",height:"1px","background-color":"rgba(0, 0, 0, 0.25)"},t}var c6=function(r){(0,z.ZT)(t,r);function t(e){var n=this,i,a,s=(a=(i=e.style)===null||i===void 0?void 0:i.template)===null||a===void 0?void 0:a.prefixCls,o=_1(s);return n=r.call(this,e,{data:[],x:0,y:0,visibility:"visible",title:"",position:"bottom-right",offset:[5,5],enterable:!1,container:{x:0,y:0},bounding:null,template:{prefixCls:"",container:'
'),title:'
'),item:'
  • {name} {value}
  • `)},style:l6(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,A=o===void 0?"":o,l=a.color,c=l===void 0?"black":l,u=a.index,h=(0,z._T)(a,["name","color","index"]),d=(0,z.pi)({name:A,color:c,index:u!=null?u:s},h);return R1(A6(i.item,d))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e!=null?e:i.attributes.x,i.attributes.y=n!=null?n:i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=R1(e.container),this.id&&this.element.setAttribute("id",this.id)},t.prototype.renderCustomContent=function(){if(!(this.prevCustomContentKey!==void 0&&this.prevCustomContentKey===this.attributes.contentKey)){this.prevCustomContentKey=this.attributes.contentKey;var e=this.attributes.content;e&&(typeof e=="string"?this.element.innerHTML=e:ES(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,A=i.style,l=i.content,c=_1(a.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",l)this.renderCustomContent();else{s?(u.innerHTML=a.title,u.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=u.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var h=this.HTMLTooltipItemsElements,d=document.createElement("ul");d.className=c.LIST,ES(d,h);var f=this.element.querySelector(".".concat(c.LIST));f?f.replaceWith(d):u.appendChild(d)}wR(u,A)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),A={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},l=this.elementSize,c=l.width,u=l.height,h=[-c/2,-u/2];return o.forEach(function(d){var f=(0,z.CR)(h,2),g=f[0],v=f[1],m=(0,z.CR)(A[d],2),w=m[0],C=m[1];h=[g+(c/2+a[0])*w,v+(u/2+a[1])*C]}),h},t.prototype.setOffsetPosition=function(e){var n=(0,z.CR)(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,A=o===void 0?0:o,l=s.y,c=l===void 0?0:l,u=s.container,h=u.x,d=u.y;this.element.style.left="".concat(+A+h+i,"px"),this.element.style.top="".concat(+c+d+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestampw+F,top:vC+Q},K=[];c.split("-").forEach(function(J){D[J]?K.push(m[J]):K.push(J)});var G=K.join("-");return this.getRelativeOffsetFromCursor(G)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,A=i.height;return new _i(a,s,o,A).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(Sr),bS=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class O0 extends mi{constructor(t,e){super(t,Object.assign({},O0.defaultOptions,e)),this.currentTarget=null,this.tooltipElement=null,this.container=null,this.isEnable=(n,i)=>{const{enable:a}=this.options;return typeof a=="function"?a(n,i):a},this.onClick=n=>{const{target:{id:i}}=n;this.currentTarget===i?this.hide(n):this.show(n)},this.onPointerMove=n=>{const{target:i}=n;!this.currentTarget||i.id===this.currentTarget||this.show(n)},this.onPointerLeave=n=>{this.hide(n)},this.onCanvasMove=n=>{this.hide(n)},this.onPointerOver=n=>{this.show(n)},this.showById=n=>bS(this,void 0,void 0,function*(){const i={target:{id:n}};yield this.show(i)}),this.getElementData=(n,i)=>{const{model:a}=this.context;switch(i){case"node":return a.getNodeData([n]);case"edge":return a.getEdgeData([n]);case"combo":return a.getComboData([n]);default:return[]}},this.show=n=>bS(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Ch(n.target))return;const A=this.context.graph.getElementType(o),{getContent:l,title:c}=this.options,u=this.getElementData(o,A);if(!this.tooltipElement)return;if(!this.isEnable(n,u)){this.hide(n);return}let h={};if(l){if(h.content=yield l(n,u),!h.content)return}else{const g=this.context.graph.getElementRenderStyle(o),v=A==="node"?g.fill:g.stroke;h={title:c||A,data:u.map(m=>({name:"ID",value:m.id||`${m.source} -> ${m.target}`,color:v}))}}this.currentTarget=o;let d,f;if(s)d=s.x,f=s.y;else{const g=Mi(u,"0.style",{x:0,y:0});d=g.x,f=g.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:d,y:f,style:{".tooltip":{visibility:"visible"}}}),h))}),this.hide=n=>{var i,a,s,o,A;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:l,y:c}}=n;(A=(o=this.options).onOpenChange)===null||A===void 0||A.call(o,!1),this.tooltipElement.hide(l,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new c6({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerover":this.onPointerOver,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerover":this.onPointerOver,"edge:pointermove":this.onPointerMove,"combo:pointerover":this.onPointerOver,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:A,container:l={x:-a,y:-i},title:c,offset:u}=this.options,[h,d]=e,[f,g]=t.getSize();return{x:h,y:d,container:l,title:c,bounding:{x:0,y:0,width:f,height:g},position:o,enterable:A,offset:u,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}O0.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var xS=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};let Xc;function CS(r,t){return Xc||(Xc=document.createElement("canvas")),Xc.width=r,Xc.height=t,Xc.getContext("2d").clearRect(0,0,r,t),Xc}function u6(r,t,e,n){return xS(this,void 0,void 0,function*(){const i=CS(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:A,textFontSize:l,textFontFamily:c,textFontVariant:u,textFontWeight:h,textAlign:d,textBaseline:f}=n;return a.textAlign=d,a.textBaseline=f,a.translate(r/2,t/2),a.font=`${l}px ${c} ${u} ${h}`,s&&a.rotate(s),o&&(a.globalAlpha=o),A&&(a.fillStyle=A,a.fillText(`${e}`,0,0)),i.toDataURL()})}function h6(r,t,e,n){return xS(this,void 0,void 0,function*(){const i=CS(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const A=new Image;return A.crossOrigin="anonymous",A.src=e,new Promise(l=>{A.onload=function(){const c=r>A.width?(r-A.width)/2:0,u=t>A.height?(t-A.height)/2:0;a.drawImage(A,0,0,A.width,A.height,c,u,r-c*2,t-u*2),l(i.toDataURL())}})})}var d6=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},f6=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);isuper.update}});return d6(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,A=f6(n,["width","height","text","imageURL"]);Object.keys(A).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const l=o?yield h6(i,a,o,A):yield u6(i,a,s,A);this.$element.style.backgroundImage=`url(${l})`})}destroy(){super.destroy(),this.$element.remove()}}I0.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const g6=["#7E92B5","#F4664A","#FFBE3A"],v6={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},p6={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function SS(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:A=.06,nodeIconOpacityInactive:l=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:u=g6,nodePaletteOptions:h=v6,edgeColor:d,edgeColorDisabled:f,edgePaletteOptions:g=p6,comboColor:v,comboColorDisabled:m,comboStroke:w,comboStrokeDisabled:C,edgeColorInactive:F}=r;return{background:t,node:{palette:h,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:u,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:l,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:A,fill:i,fillOpacity:A,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:A}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:d,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,badgeBackgroundOpacity:1,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:d,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:F,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:f,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:v,halo:!1,haloLineWidth:12,haloStroke:w,haloStrokeOpacity:.25,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[2,4,2,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,lineDash:0,lineWidth:1,fillOpacity:.04,strokeOpacity:1,padding:10,stroke:w},state:{selected:{halo:!0,labelFontSize:14,labelFontWeight:700,lineWidth:4},active:{halo:!0},highlight:{labelFontWeight:700,lineWidth:4},inactive:{fillOpacity:.65,labelOpacity:.25,strokeOpacity:.65},disabled:{fill:m,fillOpacity:.25,labelOpacity:.25,stroke:C,strokeOpacity:.25}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"combo-expand",collapse:"combo-collapse",update:[{fields:["x","y"]},{fields:["fill","stroke","lineWidth"],shape:"key"}],translate:[{fields:["x","y"]}]}}}}const m6=SS({bgColor:"#000000",comboColor:"#fdfdfd",comboColorDisabled:"#d0e4ff",comboStroke:"#99add1",comboStrokeDisabled:"#969696",edgeColor:"#637088",edgeColorDisabled:"#637088",edgeColorInactive:"#D0E4FF",edgePaletteOptions:{type:"group",color:["#637088","#0F55A6","#008383","#9C5D38","#8B53A6","#4E40A6","#8F6608","#3E801D","#A65383","#175E75","#0F8248"]},nodeColor:"#1783ff",nodeColorDisabled:"#D0E4FF",nodeHaloStrokeOpacityActive:.25,nodeHaloStrokeOpacitySelected:.45,nodeIconOpacityInactive:.45,nodeOpacityDisabled:.25,nodeOpacityInactive:.45,nodeStroke:"#d0e4ff",textColor:"#ffffff"}),y6=SS({bgColor:"#ffffff",comboColor:"#99ADD1",comboColorDisabled:"#f0f0f0",comboStroke:"#99add1",comboStrokeDisabled:"#d9d9d9",edgeColor:"#99add1",edgeColorDisabled:"#d9d9d9",edgeColorInactive:"#1B324F",nodeColor:"#1783ff",nodeColorDisabled:"#1B324F",nodeHaloStrokeOpacityActive:.15,nodeHaloStrokeOpacitySelected:.25,nodeIconOpacityInactive:.85,nodeOpacityDisabled:.06,nodeOpacityInactive:.25,nodeStroke:"#000000",textColor:"#000000"});class kA extends Zm{beforeDraw(t,e){return t}afterLayout(t,e){}}class w6 extends kA{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,A)=>{const c=e.getAncestorsData(A,"combo").map(u=>Qt(u)).reverse();s.push([A,o,c.length])}),new Map(s.sort(([,,o],[,,A])=>A-o).map(([o,A])=>[o,A]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Pa(r,t,e,n,i){const a=Qt(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([A,l])=>{t===A?l[s].set(a,o):l[s].delete(a)})}function L0(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class E6 extends kA{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(nr))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,A]=s.pop();if(da(A)){const l=n.getDescendantsData(o),c=l.map(Qt),{internal:u,external:h}=hy(c,d=>n.getRelatedEdgesData(d));l.forEach(d=>{const f=Qt(d),g=s.findIndex(([m])=>m===f);g!==-1&&s.splice(g,1);const v=n.getElementType(f);Pa(t,"remove",v,d)}),u.forEach(d=>Pa(t,"remove","edge",d)),h.forEach(d=>{var f;const g=Qt(d);((f=this.context.element)===null||f===void 0?void 0:f.getElement(g))?a.edges.set(g,d):i.edges.set(g,d)})}else{const l=n.getChildrenData(o),c=l.map(Qt),{edges:u}=hy(c,h=>n.getRelatedEdgesData(h));[...l,...u].forEach(h=>{var d;const f=Qt(h),g=n.getElementType(f);((d=this.context.element)===null||d===void 0?void 0:d.getElement(f))?Pa(t,"update",g,h):Pa(t,"add",g,h),g==="combo"&&s.push([f,h])})}}return t}}const MS=(r,t,e,n)=>{const i=`${e}s`,a=Qt(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(Qt(n),n)};class B6 extends kA{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(MS(e,"add","node",t),da(t))return;const n=Qt(t);MS(e,"add","node",t),this.context.model.getRelatedEdgesData(n).forEach(s=>{Pa(e,"add","edge",s)}),this.context.model.getChildrenData(n).forEach(s=>{this.handleExpand(s,e)})}beforeDraw(t){const{graph:e,model:n}=this.context;if(!n.model.hasTreeStructure(Ia))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,A=new Map;i.forEach((c,u)=>{da(c)&&o.set(u,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const u=e.getNodeData(c.source);da(u)&&o.set(c.source,u)}),s.forEach((c,u)=>{const h=this.getElement(u);if(!h)return;const d=h.attributes.collapsed;da(c)?d||o.set(u,c):d&&A.set(u,c)});const l=new Set;return o.forEach((c,u)=>{n.getDescendantsData(u).forEach(d=>{const f=Qt(d);if(l.has(f))return;Pa(t,"remove","node",d),n.getRelatedEdgesData(f).forEach(v=>{Pa(t,"remove","edge",v)}),l.add(f)})}),A.forEach((c,u)=>{if(n.getAncestorsData(u,Ia).some(da)){Pa(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}const H1=new WeakMap;function bK(r,t,e){H1.has(r)||H1.set(r,{});const n=H1.get(r);if(!n[t])return n[t]=e,!0;const i=n[t];return TS(i,e)?!1:(n[t]=e,!0)}const TS=(r,t,e=2)=>{if(typeof r!="object"||typeof t!="object")return r===t;const n=Object.keys(r),i=Object.keys(t);if(n.length!==i.length)return!1;for(const a of n){const s=r[a],o=t[a];if(e>1&&typeof s=="object"&&typeof o=="object"){if(!TS(s,o,e-1))return!1}else if(s!==o)return!1}return!0};function b6(r,t,e){Om[r][t]&&ha.warn(`The extension ${t} of ${r} has been registered before, and will be overridden.`),Object.assign(Om[r],{[t]:e})}var FS=function(){function r(t){(0,L.Z)(this,r),this.dragndropPluginOptions=t}return(0,I.Z)(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,A=function(c){var u=c.target,h=u===s,d=h&&n.dragndropPluginOptions.isDocumentDraggable?s:u.closest&&u.closest("[draggable=true]");if(d){var f=!1,g=c.timeStamp,v=[c.clientX,c.clientY],m=null,w=[c.clientX,c.clientY],C=function(){var Q=(0,Wa.Z)((0,ri.Z)().mark(function D(K){var G,J,$,at,At,pt;return(0,ri.Z)().wrap(function(wt){for(;;)switch(wt.prev=wt.next){case 0:if(f){wt.next=2;break}if(G=K.timeStamp-g,J=Li([K.clientX,K.clientY],v),!(G<=n.dragndropPluginOptions.dragstartTimeThreshold||J<=n.dragndropPluginOptions.dragstartDistanceThreshold)){wt.next=1;break}return wt.abrupt("return");case 1:K.type="dragstart",d.dispatchEvent(K),f=!0;case 2:if(K.type="drag",K.dx=K.clientX-w[0],K.dy=K.clientY-w[1],d.dispatchEvent(K),w=[K.clientX,K.clientY],h){wt.next=4;break}return $=n.dragndropPluginOptions.overlap==="pointer"?[K.canvasX,K.canvasY]:u.getBounds().center,wt.next=3,s.elementsFromPoint($[0],$[1]);case 3:at=wt.sent,At=at[at.indexOf(u)+1],pt=(At==null?void 0:At.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),m!==pt&&(m&&(K.type="dragleave",K.target=m,m.dispatchEvent(K)),pt&&(K.type="dragenter",K.target=pt,pt.dispatchEvent(K)),m=pt,m&&(K.type="dragover",K.target=m,m.dispatchEvent(K)));case 4:case"end":return wt.stop()}},D)}));return function(K){return Q.apply(this,arguments)}}();o.addEventListener("pointermove",C);var F=function(D){if(f){D.detail={preventClick:!0};var K=D.clone();m&&(K.type="drop",K.target=m,m.dispatchEvent(K)),K.type="dragend",d.dispatchEvent(K),f=!1}o.removeEventListener("pointermove",C)};u.addEventListener("pointerup",F,{once:!0}),u.addEventListener("pointerupoutside",F,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",A)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",A)})}}])}();FS.tag="Dragndrop";var x6=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,L.Z)(this,t),e=(0,P.Z)(this,t),e.name="dragndrop",e.options=n,e}return(0,k.Z)(t,r),(0,I.Z)(t,[{key:"init",value:function(){this.addRenderingPlugin(new FS((0,H.Z)({overlap:"pointer",isDocumentDraggable:!1,isDocumentDroppable:!1,dragstartDistanceThreshold:0,dragstartTimeThreshold:0},this.options)))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins()}},{key:"setOptions",value:function(n){Object.assign(this.plugins[0].dragndropPluginOptions,n)}}])}(ls),OS=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},IS=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const h=new dm(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:l[u],background:s?u==="background"?i:void 0:i}));return[u,h]}));US(c),this.extends={config:this.config,renderer:n,renderers:l,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return ch(Object.values(this.getLayers()).map(e=>t?e.getRoot().childNodes.find(i=>i.classList.includes(t)):e.getRoot()).filter(e=>(e==null?void 0:e.childNodes.length)>0).map(e=>e.getBounds()))}getContainer(){const t=this.extends.config.container;return typeof t=="string"?document.getElementById(t):t}getSize(){return[this.extends.config.width||0,this.extends.config.height||0]}appendChild(t,e){var n;const i=((n=t.style)===null||n===void 0?void 0:n.$layer)||"main";return this.getLayer(i).appendChild(t,e)}setRenderer(t){if(t===this.extends.renderer)return;const e=QS(t,this.config.enableMultiLayer?NS:LS);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),US(this.getLayers())}getCanvasByViewport(t){return Si(this.getLayer().viewport2Canvas(xs(t)))}getViewportByCanvas(t){return Si(this.getLayer().canvas2Viewport(xs(t)))}getViewportByClient(t){return Si(this.getLayer().client2Viewport(xs(t)))}getClientByViewport(t){return Si(this.getLayer().viewport2Client(xs(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(xs(t));return Si(e.viewport2Canvas(n))}toDataURL(){return OS(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=IS(t,["mode"]);let[a,s,o,A]=[0,0,0,0];if(n==="viewport")[o,A]=this.getSize();else if(n==="overall"){const m=this.getBounds(),w=gA(m);[a,s]=m.min,[o,A]=w}const l=R1('
    '),c=new dm({width:o,height:A,renderer:new Eh,devicePixelRatio:e,container:l,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const u=this.getLayer("label").getRoot().cloneNode(!0),h=c.viewport2Canvas({x:0,y:0}),d=this.getCanvasByViewport([0,0]);u.translate([d[0]-h.x,d[1]-h.y]),u.scale(1/this.getCamera().getZoom()),c.appendChild(u),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const f=this.getCamera(),g=c.getCamera();if(n==="viewport")g.setZoom(f.getZoom()),g.setPosition(f.getPosition()),g.setFocalPoint(f.getFocalPoint());else if(n==="overall"){const[m,w,C]=g.getPosition(),[F,Q,D]=g.getFocalPoint();g.setPosition([m+a,w+s,C]),g.setFocalPoint([F+a,Q+s,D])}const v=c.getContextService();return new Promise(m=>{c.addEventListener(Fa.RERENDER,()=>OS(this,void 0,void 0,function*(){yield new Promise(C=>setTimeout(C,300));const w=yield v.toDataURL(i);m(w)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function QS(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new Eh;return n instanceof Eh&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new x6({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function US(r){Object.entries(r).forEach(([t,e])=>{const n=e.getContextService().getDomElement();n!=null&&n.style&&(n.style.gridArea="1 / 1 / 2 / 2",n.style.outline="none",n.tabIndex=1,t!=="main"&&(n.style.pointerEvents="none")),n!=null&&n.parentElement&&(n.parentElement.style.display="grid",n.parentElement.style.isolation="isolate")})}const Jc=r=>r?parseInt(r):0;function S6(r){const t=getComputedStyle(r),e=r.clientWidth||Jc(t.width),n=r.clientHeight||Jc(t.height),i=Jc(t.paddingLeft)+Jc(t.paddingRight),a=Jc(t.paddingTop)+Jc(t.paddingBottom);return[e-i,n-a]}function PS(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=S6(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(ye(t)?t:a,a),Math.max(ye(e)?e:s,s)]}class N0{constructor(t){this.type=t}}class Yr extends N0{constructor(t,e){super(t),this.data=e}}class rs extends N0{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class qc extends N0{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class k0 extends N0{constructor(t,e){super(t),this.data=e}}function ci(r,t){r.emit(t.type,t)}function M6(r){if(!r)return null;if(r instanceof NE)return{type:"canvas",element:r};let t=r;for(;t;){if(bh(t))return{type:"node",element:t};if(Ax(t))return{type:"edge",element:t};if(dy(t))return{type:"combo",element:t};t=t.parentElement}return null}function DS(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const $c="cachedStyle",Q0=r=>`__${r}__`;function T6(r,t){const e=Array.isArray(t)?t:[t];Mi(r,$c)||ph(r,$c,{}),e.forEach(n=>{ph(Mi(r,$c),Q0(n),r.attributes[n])})}function RS(r,t){return Mi(r,[$c,Q0(t)])}function F6(r,t){return Q0(t)in(Mi(r,$c)||{})}function xK(r,t,e){set(r,[$c,Q0(t)],e)}class O6{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([l,c])=>{var u,h,d;const{element:f,elementType:g,stage:v}=l,m=kO(this.context.options,g,v,t);(u=c==null?void 0:c.before)===null||u===void 0||u.call(c);const w=m.length?UO(f,this.inferStyle(l,n),m):null;return w?((h=c==null?void 0:c.beforeAnimate)===null||h===void 0||h.call(c,w),w.finished.then(()=>{var C,F;(C=c==null?void 0:c.afterAnimate)===null||C===void 0||C.call(c,w),(F=c==null?void 0:c.after)===null||F===void 0||F.call(c),this.animations.delete(w)})):(d=c==null?void 0:c.after)===null||d===void 0||d.call(c),w}).filter(Boolean);o.forEach(l=>this.animations.add(l));const A=Im(o);return A?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,A),A.finished.then(()=>{var l,c;(l=e==null?void 0:e.afterAnimate)===null||l===void 0||l.call(e,A),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),A}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:A,updatedStyle:l={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},A),l));const{modifiedStyle:c}=t,u={},h={};if(o==="enter")Object.assign(u,{opacity:0});else if(o==="exit")Object.assign(h,{opacity:0});else if(o==="show")Object.assign(u,{opacity:0}),Object.assign(h,{opacity:(n=RS(a,"opacity"))!==null&&n!==void 0?n:lh("opacity")});else if(o==="hide")Object.assign(u,{opacity:(i=RS(a,"opacity"))!==null&&i!==void 0?i:lh("opacity")}),Object.assign(h,{opacity:0});else if(o==="collapse"){const{collapse:d}=e||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(g.includes(a.id)){const[m,w,C]=v;Object.assign(h,{x:m,y:w,z:C})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[m,w]=v;Object.assign(h,{x:m,y:w,childrenNode:A.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:d}=e||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(a.id===f||g.includes(a.id)){const[m,w,C]=v;Object.assign(u,{x:m,y:w,z:C})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[m,w,C]=v;Object.assign(u,{x:m,y:w,z:C,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(u,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(u).length>0?Object.assign({},A,u):A,Object.keys(h).length>0?Object.assign({},c,h):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class I6{constructor(t){this.batchCount=0,this.context=t}emit(t){const{graph:e}=this.context;e.emit(t.type,t)}startBatch(t=!0){this.batchCount++,this.batchCount===1&&this.emit(new Yr(Ae.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new Yr(Ae.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class L6 extends Wm{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=M6(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:A}=i;if("destroyed"in A&&(Ch(A)||A.destroyed))return;const{type:l,detail:c,button:u}=e,h=Object.assign(Object.assign({},e),{target:A,targetType:o,originalTarget:n});l===Yt.POINTER_MOVE&&(this.currentTarget!==A&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${Yt.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:Yt.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),A&&(Object.assign(h,{type:Yt.POINTER_ENTER}),a.emit(`${o}:${Yt.POINTER_ENTER}`,h))),this.currentTarget=A,this.currentTargetType=o),l===Yt.CLICK&&u===2||(a.emit(`${o}:${l}`,h),a.emit(l,h)),l===Yt.CLICK&&c===2&&(Object.assign(h,{type:Yt.DBLCLICK}),a.emit(`${o}:${Yt.DBLCLICK}`,h),a.emit(Yt.DBLCLICK,h)),l===Yt.POINTER_DOWN&&u===2&&(Object.assign(h,{type:Yt.CONTEXT_MENU,preventDefault:()=>{var d;(d=s.getContainer())===null||d===void 0||d.addEventListener(Yt.CONTEXT_MENU,f=>f.preventDefault(),{once:!0})}}),a.emit(`${o}:${Yt.CONTEXT_MENU}`,h),a.emit(Yt.CONTEXT_MENU,h))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[Lc.KEY_DOWN,Lc.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[Yt.CLICK,Yt.DBLCLICK,Yt.POINTER_OVER,Yt.POINTER_LEAVE,Yt.POINTER_ENTER,Yt.POINTER_MOVE,Yt.POINTER_OUT,Yt.POINTER_DOWN,Yt.POINTER_UP,Yt.CONTEXT_MENU,Yt.DRAG_START,Yt.DRAG,Yt.DRAG_END,Yt.DRAG_ENTER,Yt.DRAG_OVER,Yt.DRAG_LEAVE,Yt.DROP,Yt.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[Lc.KEY_DOWN,Lc.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function N6(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=wi(n);return this.isCombo(Qt(i))||(t===void 0||t.includes(Qt(i)))&&e.push(i),e},[])}getEdgeDatum(t){return wi(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=wi(n);return(t===void 0||t.includes(Qt(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=wi(n);return this.isCombo(Qt(i))&&(t===void 0||t.includes(Qt(i)))&&e.push(i),e},[])}getRootsData(t=Ia){return this.model.getRoots(t).map(wi)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(wi)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return El(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(Qt(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){ha.warn("The hierarchy structure key is not specified");return}if(!n.hasNode(t)||!n.hasTreeStructure(e))return;const i=n.getParent(t,e);return i?wi(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?Ia:nr,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(wi)}getElementsDataByType(t){return t==="node"?this.getNodeData():t==="edge"?this.getEdgeData():t==="combo"?this.getComboData():[]}getElementDataById(t){return this.getElementType(t)==="edge"?this.getEdgeDatum(t):this.getNodeLikeDatum(t)}getNodeLikeDatum(t){const e=this.model.getNode(t);return wi(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=wi(n);return t?t.includes(Qt(i))&&e.push(i):e.push(i),e},[])}getElementDataByState(t,e){return this.getElementsDataByType(t).filter(i=>{var a;return(a=i.states)===null||a===void 0?void 0:a.includes(e)})}getElementState(t){var e;return((e=this.getElementDataById(t))===null||e===void 0?void 0:e.states)||[]}hasNode(t){return this.model.hasNode(t)&&!this.isCombo(t)}hasEdge(t){return this.model.hasEdge(t)}hasCombo(t){return this.model.hasNode(t)&&this.isCombo(t)}getRelatedEdgesData(t,e="both"){return this.model.getRelatedEdges(t,e).map(wi)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(wi)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),A=mA(a,e,u=>Qt(u),Rc),l=mA(s,n,u=>Qt(u),Rc),c=mA(o,i,u=>Qt(u),Rc);this.batch(()=>{const u={nodes:A.enter,edges:l.enter,combos:c.enter};this.addData(u),this.computeZIndex(u,"add",!0);const h={nodes:A.update,edges:l.update,combos:c.update};this.updateData(h),this.computeZIndex(h,"update",!0);const d={nodes:A.exit.map(Qt),edges:l.exit.map(Qt),combos:c.exit.map(Qt)};this.removeData(d)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:dr.NodeAdded}),G1(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:dr.EdgeAdded}),G1(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(nr)||e.attachTreeStructure(nr),e.addNodes(t.map(n=>(this.comboIds.add(Qt(n)),this.pushChange({value:n,type:dr.ComboAdded}),G1(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(Qt);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var A,l,c;const u=Qt(o);if(e==="add"&&ye((A=o.style)===null||A===void 0?void 0:A.zIndex)||e==="update"&&!("combo"in o))return;const h=this.getParentData(u,nr),d=h?((c=(l=h.style)===null||l===void 0?void 0:l.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:u,style:{zIndex:d}}])})}),i.forEach(o=>{var A,l,c;const u=Qt(o);if(e==="add"&&ye((A=o.style)===null||A===void 0?void 0:A.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let h=0;const d=this.getParentData(u,nr);if(d)h=(((l=d.style)===null||l===void 0?void 0:l.zIndex)||0)+1;else{const f=this.getParentData(u,Ia);f&&(h=((c=f==null?void 0:f.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:u,style:{zIndex:h}}])})}),a.forEach(o=>{var A,l,c,u,h;if(ye((A=o.style)===null||A===void 0?void 0:A.zIndex))return;let{id:d,source:f,target:g}=o;if(!d)d=Qt(o);else{const w=this.getEdgeDatum(d);f=w.source,g=w.target}if(!f||!g)return;const v=((c=(l=this.getNodeLikeDatum(f))===null||l===void 0?void 0:l.style)===null||c===void 0?void 0:c.zIndex)||0,m=((h=(u=this.getNodeLikeDatum(g))===null||u===void 0?void 0:u.style)===null||h===void 0?void 0:h.zIndex)||0;this.updateEdgeData([{id:Qt(o),style:{zIndex:Math.max(v,m)-1}}])})})}getFrontZIndex(t){var e;const n=this.getElementType(t),i=this.getElementDataById(t),a=this.getData();if(Object.assign(a,{[`${n}s`]:a[`${n}s`].filter(s=>Qt(s)!==t)}),n==="combo"&&!da(i)){const s=new Set(this.getAncestorsData(t,nr).map(Qt));a.nodes=a.nodes.filter(o=>!s.has(Qt(o))),a.combos=a.combos.filter(o=>!s.has(Qt(o))),a.edges=a.edges.filter(({source:o,target:A})=>!s.has(o)&&!s.has(A))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=Qt(n),a=Kf(n);a!==void 0&&(e.hasTreeStructure(nr)||e.attachTreeStructure(nr),a===null&&this.refreshComboData(i),this.setParent(i,Kf(n),nr));const s=n.children||[];if(s.length){e.hasTreeStructure(Ia)||e.attachTreeStructure(Ia);const o=s.filter(A=>e.hasNode(A));o.forEach(A=>this.setParent(A,i,Ia)),o.length!==s.length&&this.updateNodeData([{id:i,children:o}])}})}preventUpdateNodeLikeHierarchy(t){this.enableUpdateNodeLikeHierarchy=!1,t(),this.enableUpdateNodeLikeHierarchy=!0}updateData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.updateNodeData(e),this.updateComboData(i),this.updateEdgeData(n)}),this.computeZIndex(t,"update")}updateNodeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{const n=[];t.forEach(i=>{const a=Qt(i),s=wi(e.getNode(a));if(Rc(s,i))return;const o=CA(s,i);this.pushChange({value:o,original:s,type:dr.NodeUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({nodes:t},"update")}refreshData(){const{nodes:t,edges:e,combos:n}=this.getData();t.forEach(i=>{this.pushChange({value:i,original:i,type:dr.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:dr.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:dr.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=Qt(t);if(!e.hasNode(n))return;const i=wi(e.getNode(n)),a=CA(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=Qt(t);if(!e.hasEdge(n))return;const i=wi(e.getEdge(n)),a=CA(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=Qt(n),a=wi(e.getEdge(i));if(Rc(a,n))return;n.source&&a.source!==n.source&&e.updateEdgeSource(i,n.source),n.target&&a.target!==n.target&&e.updateEdgeTarget(i,n.target);const s=CA(a,n);this.pushChange({value:s,original:a,type:dr.EdgeUpdated}),e.mergeEdgeData(i,s)})}),this.computeZIndex({edges:t},"update")}updateComboData(t=[]){if(!t.length)return;const{model:e}=this;e.batch(()=>{const n=[];t.forEach(i=>{const a=Qt(i),s=wi(e.getNode(a));if(Rc(s,i))return;const o=CA(s,i);this.pushChange({value:o,original:s,type:dr.ComboUpdated}),e.mergeNodeData(a,o),n.push(o)}),this.updateNodeLikeHierarchy(n)}),this.computeZIndex({combos:t},"update")}setParent(t,e,n,i=!0){if(t===e)return;const a=this.getNodeLikeDatum(t),s=Kf(a);if(s!==e&&n===nr){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===nr&&N6([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,nr);e&&this.pushChange({value:e,original:e,type:dr.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:dr.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return Ai(e)}translateNodeLikeBy(t,e){this.isCombo(t)?this.translateComboBy(t,e):this.translateNodeBy(t,e)}translateNodeLikeTo(t,e){this.isCombo(t)?this.translateComboTo(t,e):this.translateNodeTo(t,e)}translateNodeBy(t,e){const n=this.getElementPosition(t),i=tn(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(A=>A===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;El(s,A=>{const l=Qt(A);if(o.has(l))return;o.add(l);const[c,u,h]=Ai(A),d=CA(A,{style:{x:c+n,y:u+i,z:h+a}});this.pushChange({value:d,original:A,type:this.isCombo(l)?dr.ComboUpdated:dr.NodeUpdated}),this.model.mergeNodeData(l,d)},A=>this.getChildrenData(Qt(A)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[A,l,c]=Ai(o),u=i-A,h=a-l,d=s-c;El(o,f=>{const g=Qt(f),[v,m,w]=Ai(f),C=CA(f,{style:{x:v+u,y:m+h,z:w+d}});this.pushChange({value:C,original:f,type:this.isCombo(g)?dr.ComboUpdated:dr.NodeUpdated}),this.model.mergeNodeData(g,C)},f=>this.getChildrenData(Qt(f)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(Qt)),this.pushChange({value:this.getNodeData([e])[0],type:dr.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:dr.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:dr.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(nr)){const e=Kf(this.getNodeLikeDatum(t));this.setParent(t,void 0,nr,!1),this.model.getChildren(t,nr).forEach(n=>{const i=wi(n),a=Qt(i);this.setParent(Qt(i),e,nr,!1);const s=CA(i,{id:Qt(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?dr.ComboUpdated:dr.NodeUpdated}),this.model.mergeNodeData(Qt(i),s)}),Pe(e)||this.refreshComboData(e)}}getElementType(t){if(this.model.hasNode(t))return this.isCombo(t)?"combo":"node";if(this.model.hasEdge(t))return"edge";throw new Error(Oo(`Unknown element type of id: ${t}`))}destroy(){const{model:t}=this,e=t.getAllNodes(),n=t.getAllEdges();t.removeEdges(n.map(i=>i.id)),t.removeNodes(e.map(i=>i.id)),this.context={}}}var tu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class P6{constructor(t){this.elementMap={},this.shapeTypeMap={},this.paletteStyle={},this.defaultStyle={},this.stateStyle={},this.visibilityCache=new WeakMap,this.context=t}init(){this.initContainer()}initContainer(){if(!this.container||this.container.destroyed){const{canvas:t}=this.context;this.container=t.appendChild(new oi({className:"elements"}))}}emit(t,e){e.silence||ci(this.context.graph,t)}forEachElementData(t){wl.forEach(e=>{const n=this.context.model.getElementsDataByType(e);t(e,n)})}getElementType(t,e){var n;const{options:i,graph:a}=this.context,s=gx(e)&&((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return cB(this.context.options)[t]||{}}getThemeStyle(t){return this.getTheme(t).style||{}}getThemeStateStyle(t,e){const{state:n={}}=this.getTheme(t);return Object.assign({},...e.map(i=>n[i]||{}))}computePaletteStyle(){const{options:t}=this.context;this.paletteStyle={},this.forEachElementData((e,n)=>{var i,a;const s=Object.assign({},bb((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),bb((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,nN(n,s))})}getPaletteStyle(t,e){const n=this.paletteStyle[e];return n?t==="edge"?{stroke:n}:{fill:n}:{}}computeElementDefaultStyle(t,e){var n;const{options:i}=this.context,a=((n=i[t])===null||n===void 0?void 0:n.style)||{};"transform"in a&&Array.isArray(a.transform)&&(a.transform=[...a.transform]),this.defaultStyle[Qt(e.datum)]=Bb(a,e)}computeElementsDefaultStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;sthis.getElementStateStyle(t,i,n)))}computeElementsStatesStyle(t){const{graph:e}=this.context;this.forEachElementData((n,i)=>{const a=i.length;for(let s=0;sthis.elementMap[t])}getEdges(){return this.context.model.getEdgeData().map(t=>this.elementMap[Qt(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=Qt(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),A=this.getThemeStateStyle(t,this.getElementState(n)),l=this.getStateStyle(n),c=gx(e)?Object.assign({},i,a,s,o,A,l):Object.assign({},s);if(t==="combo"){const u=this.context.model.getChildrenData(n),d=!!c.collapsed?[]:u.map(Qt).filter(f=>this.getElement(f));Object.assign(c,{childrenNode:d,childrenData:u})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return tu(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:A}=a;return this.destroyElements(A,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:A}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new Yr(Ae.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render"}),t),beforeAnimate:l=>this.emit(new rs(Ae.BEFORE_ANIMATE,ua.DRAW,l,s),t),afterAnimate:l=>this.emit(new rs(Ae.AFTER_ANIMATE,ua.DRAW,l,s),t),after:()=>this.emit(new Yr(Ae.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=Xy(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:A=[],EdgeUpdated:l=[],EdgeRemoved:c=[],ComboAdded:u=[],ComboUpdated:h=[],ComboRemoved:d=[]}=Ff(i,Q=>Q.type),f=(Q,D)=>{const K=[];return Q.forEach(G=>{const J=Qt(G.value);this.getElement(J)?K.push(G):D.push(G)}),K},g=f(s,a),v=f(l,A),m=f(h,u),w=Q=>new Map(Q.map(D=>{const K=D.value;return[Qt(K),K]})),C={add:{nodes:w(a),edges:w(A),combos:w(u)},update:{nodes:w(g),edges:w(v),combos:w(m)},remove:{nodes:w(o),edges:w(c),combos:w(d)}},F=this.transformData(C,t);return e.clearChanges(),{dataChanges:n,drawData:F}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=Qt(e);if(this.getElement(a))return;const o=this.getElementType(t,e),A=this.getElementComputedStyle(t,e),l=Fo(t,o);if(!l)return ha.warn(`The element ${o} of ${t} is not registered.`);this.emit(new qc(Ae.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new l({id:a,context:this.context,style:A}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:u="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:u,originalStyle:Object.assign({},c.attributes),updatedStyle:A},{after:()=>{var h;this.emit(new qc(Ae.AFTER_ELEMENT_CREATE,t,e),n),(h=c.onCreate)===null||h===void 0||h.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.createElement(o,l,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=Qt(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new qc(Ae.BEFORE_ELEMENT_UPDATE,t,e),n);const A=this.getElementType(t,e),l=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==A&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:l.visibility==="hidden"?"hide":"show";c==="hide"&&delete l.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:l},{before:()=>{const u=this.elementMap[a];s!=="collapse"&&py(u,l),s==="visibility"&&(F6(u,"opacity")||T6(u,"opacity"),this.visibilityCache.set(u,c==="show"?"visible":"hidden"),c==="show"&&ml(u,"visible"))},after:()=>{var u;const h=this.elementMap[a];s==="collapse"&&py(h,l),c==="hide"&&ml(h,this.visibilityCache.get(h)),this.emit(new qc(Ae.AFTER_ELEMENT_UPDATE,t,e),n),(u=h.onUpdate)===null||u===void 0||u.call(h)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.updateElement(o,l,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=Qt(n),a=this.getElement(i);a&&iQ(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=Qt(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new qc(Ae.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var A;this.clearElement(s),o.destroy(),(A=o.onDestroy)===null||A===void 0||A.call(o),this.emit(new qc(Ae.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,A])=>{A.forEach(l=>this.destroyElement(o,l,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>Qt(s)===e);if(a){const s=Ai(this.context.model.getNodeLikeDatum(e)),o=Ai(a),A=tr(s,o);(i=t.nodes)===null||i===void 0||i.forEach(l=>{var c,u,h;!((c=l.style)===null||c===void 0)&&c.x&&(l.style.x+=A[0]),!((u=l.style)===null||u===void 0)&&u.y&&(l.style.y+=A[1]),!((h=l.style)===null||h===void 0)&&h.z&&(l.style.z+=A[2]||0)})}}syncLayoutResult(t,e){return tu(this,void 0,void 0,function*(){const{layout:n,model:i}=this.context;if(!n)return;const a=this.context.options.layout,s=A=>Array.isArray(A)?A.map(l=>Object.assign(Object.assign({},l),{preLayout:!0})):Object.assign(Object.assign({},A),{preLayout:!0}),o=yield n.simulate(a?s(a):void 0);e&&this.alignLayoutResultToElement(o,t),i.updateData(o)})}collapseNode(t,e){return tu(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e;yield this.syncLayoutResult(t,a);const s=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!s)return;const{drawData:o}=s,{add:A,remove:l,update:c}=o;this.markDestroyElement(o);const u={animation:i,stage:"collapse",data:o};this.destroyElements(l,u),this.createElements(A,u),this.updateElements(c,u),yield(n=this.context.animation.animate(i,{beforeAnimate:h=>this.emit(new rs(Ae.BEFORE_ANIMATE,ua.COLLAPSE,h,o),u),afterAnimate:h=>this.emit(new rs(Ae.AFTER_ANIMATE,ua.COLLAPSE,h,o),u)},{collapse:{target:t,descendants:Array.from(l.nodes).map(([,h])=>Qt(h)),position:Ai(c.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return tu(this,void 0,void 0,function*(){var n;const{model:i}=this.context,{animation:a,align:s}=e,o=Ai(i.getNodeData([t])[0]);yield this.syncLayoutResult(t,s);const A=this.computeChangesAndDrawData({stage:"expand",animation:a});if(this.createElements(A.drawData.add,{animation:!1,stage:"expand",target:t}),this.context.animation.clear(),this.computeStyle("expand"),!A)return;const{drawData:l}=A,{update:c,add:u}=l,h={animation:a,stage:"expand",data:l};u.edges.forEach(d=>c.edges.set(Qt(d),d)),u.nodes.forEach(d=>c.nodes.set(Qt(d),d)),this.updateElements(c,h),yield(n=this.context.animation.animate(a,{beforeAnimate:d=>this.emit(new rs(Ae.BEFORE_ANIMATE,ua.EXPAND,d,l),h),afterAnimate:d=>this.emit(new rs(Ae.AFTER_ANIMATE,ua.EXPAND,d,l),h)},{expand:{target:t,descendants:Array.from(u.nodes).map(([,d])=>Qt(d)),position:o}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return tu(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,nr).some(g=>da(g)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),A=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!A)return;const{dataChanges:l,drawData:c}=A;this.markDestroyElement(c);const{update:u,remove:h}=c,d={animation:e,stage:"collapse",data:c};this.destroyElements(h,d),this.updateElements(u,d);const f=g=>Array.from(g).map(([,v])=>Qt(v));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Yr(Ae.BEFORE_DRAW,{dataChanges:l,animation:e}),d),beforeAnimate:g=>this.emit(new rs(Ae.BEFORE_ANIMATE,ua.COLLAPSE,g,c),d),afterAnimate:g=>this.emit(new rs(Ae.AFTER_ANIMATE,ua.COLLAPSE,g,c),d),after:()=>this.emit(new Yr(Ae.AFTER_DRAW,{dataChanges:l,animation:e}),d)},{collapse:{target:t,descendants:[...f(h.nodes),...f(h.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return tu(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=Ai(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:A}=s,{add:l,update:c}=A,u={animation:e,stage:"expand",data:A,target:t};this.createElements(l,u),this.updateElements(c,u);const h=d=>Array.from(d).map(([,f])=>Qt(f));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Yr(Ae.BEFORE_DRAW,{dataChanges:o,animation:e}),u),beforeAnimate:d=>this.emit(new rs(Ae.BEFORE_ANIMATE,ua.EXPAND,d,A),u),afterAnimate:d=>this.emit(new rs(Ae.AFTER_ANIMATE,ua.EXPAND,d,A),u),after:()=>this.emit(new Yr(Ae.AFTER_DRAW,{dataChanges:o,animation:e}),u)},{expand:{target:t,descendants:[...h(l.nodes),...h(l.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}const _S=Symbol("Comlink.proxy"),D6=Symbol("Comlink.endpoint"),HS=Symbol("Comlink.releaseProxy"),K1=Symbol("Comlink.finalizer"),U0=Symbol("Comlink.thrown"),GS=r=>typeof r=="object"&&r!==null||typeof r=="function",R6={canHandle:r=>GS(r)&&r[_S],serialize(r){const{port1:t,port2:e}=new MessageChannel;return zS(r,t),[e,[e]]},deserialize(r){return r.start(),WS(r)}},_6={canHandle:r=>GS(r)&&U0 in r,serialize({value:r}){let t;return r instanceof Error?t={isError:!0,value:{message:r.message,name:r.name,stack:r.stack}}:t={isError:!1,value:r},[t,[]]},deserialize(r){throw r.isError?Object.assign(new Error(r.value.message),r.value):r.value}},KS=new Map([["proxy",R6],["throw",_6]]);function H6(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function zS(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!H6(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),A=(i.data.argumentList||[]).map(Dl);let l;try{const c=o.slice(0,-1).reduce((h,d)=>h[d],r),u=o.reduce((h,d)=>h[d],r);switch(s){case"GET":l=u;break;case"SET":c[o.slice(-1)[0]]=Dl(i.data.value),l=!0;break;case"APPLY":l=u.apply(c,A);break;case"CONSTRUCT":{const h=new u(...A);l=Z6(h)}break;case"ENDPOINT":{const{port1:h,port2:d}=new MessageChannel;zS(r,d),l=W6(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(c){l={value:c,[U0]:0}}Promise.resolve(l).catch(c=>({value:c,[U0]:0})).then(c=>{const[u,h]=_0(c);t.postMessage(Object.assign(Object.assign({},u),{id:a}),h),s==="RELEASE"&&(t.removeEventListener("message",n),VS(t),K1 in r&&typeof r[K1]=="function"&&r[K1]())}).catch(c=>{const[u,h]=_0({value:new TypeError("Unserializable return value"),[U0]:0});t.postMessage(Object.assign(Object.assign({},u),{id:a}),h)})}),t.start&&t.start()}function G6(r){return r.constructor.name==="MessagePort"}function VS(r){G6(r)&&r.close()}function WS(r,t){const e=new Map;return r.addEventListener("message",function(i){const{data:a}=i;if(!a||!a.id)return;const s=e.get(a.id);if(s)try{s(a)}finally{e.delete(a.id)}}),z1(r,e,[],t)}function P0(r){if(r)throw new Error("Proxy has been released and is not useable")}function ZS(r){return eu(r,new Map,{type:"RELEASE"}).then(()=>{VS(r)})}const D0=new WeakMap,R0="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(D0.get(r)||0)-1;D0.set(r,t),t===0&&ZS(r)});function K6(r,t){const e=(D0.get(t)||0)+1;D0.set(t,e),R0&&R0.register(r,t,r)}function z6(r){R0&&R0.unregister(r)}function z1(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(P0(i),o===HS)return()=>{z6(a),ZS(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const A=eu(r,t,{type:"GET",path:e.map(l=>l.toString())}).then(Dl);return A.then.bind(A)}return z1(r,t,[...e,o])},set(s,o,A){P0(i);const[l,c]=_0(A);return eu(r,t,{type:"SET",path:[...e,o].map(u=>u.toString()),value:l},c).then(Dl)},apply(s,o,A){P0(i);const l=e[e.length-1];if(l===D6)return eu(r,t,{type:"ENDPOINT"}).then(Dl);if(l==="bind")return z1(r,t,e.slice(0,-1));const[c,u]=jS(A);return eu(r,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:c},u).then(Dl)},construct(s,o){P0(i);const[A,l]=jS(o);return eu(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:A},l).then(Dl)}});return K6(a,r),a}function V6(r){return Array.prototype.concat.apply([],r)}function jS(r){const t=r.map(_0);return[t.map(e=>e[0]),V6(t.map(e=>e[1]))]}const YS=new WeakMap;function W6(r,t){return YS.set(r,t),r}function Z6(r){return Object.assign(r,{[_S]:!0})}function CK(r,t=globalThis,e="*"){return{postMessage:(n,i)=>r.postMessage(n,e,i),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function _0(r){for(const[t,e]of KS)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},YS.get(r)||[]]}function Dl(r){switch(r.type){case"HANDLER":return KS.get(r.name).deserialize(r.value);case"RAW":return r.value}}function eu(r,t,e,n){return new Promise(i=>{const a=j6();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function j6(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class Y6 extends Cg{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=WS(new Worker(new URL(M.p+M.u(1262),M.b),{type:void 0})),this.running&&(this.running=!1,this.execute())}execute(){var t;return(0,z.mG)(this,void 0,void 0,function*(){if(this.running)return this;this.running=!0;const e=this.layout.options,{onTick:n}=e,i=(0,z._T)(e,["onTick"]),a={};Object.keys(i).forEach(l=>{Wt(i[l])||(a[l]=i[l])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[A]=yield this.proxy.calculateLayout(s,[o]);return A})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[HS]()}isRunning(){return this.running}}var nu=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},X6=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const u=Qt(c),h=A.nodes.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),(i=l==null?void 0:l.edges)===null||i===void 0||i.forEach(c=>{const u=Qt(c),h=A.edges.get(u);o.syncEdgeDatum(c),h&&Object.assign(h.style,c.style)}),(a=l==null?void 0:l.combos)===null||a===void 0||a.forEach(c=>{const u=Qt(c),h=A.combos.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),ci(s,new Yr(Ae.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return nu(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;ci(n,new Yr(Ae.BEFORE_LAYOUT,{type:"post"}));for(let i=0;ii.afterLayout(t,e))}simulate(){return nu(this,arguments,void 0,function*(t=this.options){if(!t)return{};const e=Array.isArray(t)?t:[t];let n={};for(let i=0;i{this.updateElementPosition(l,!1)}}):(o.execute(t),o.stop(),o.tick(s));const A=yield o.execute(t);if(i){const l=this.updateElementPosition(A,i);yield l==null?void 0:l.finished}return A})}treeLayout(t,e,n){return nu(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=Fo("layout",i);if(!s)return{};const{nodes:o=[],edges:A=[]}=t,l=new Hr({nodes:o.map(f=>({id:Qt(f),data:f.data||{}})),edges:A.map(f=>({id:Qt(f),source:f.source,target:f.target,data:f.data||{}}))});Q6(l);const c={nodes:[],edges:[]},u={nodes:[],edges:[]};l.getRoots(Ia).forEach(f=>{El(f,C=>{C.children=l.getSuccessors(C.id)},C=>l.getSuccessors(C.id),"TB");const g=s(f,e),{x:v,y:m,z:w=0}=g;El(g,C=>{const{id:F,x:Q,y:D,z:K=0}=C;c.nodes.push({id:F,style:{x:v,y:m,z:w}}),u.nodes.push({id:F,style:{x:Q,y:D,z:K}})},C=>C.children,"TB")});const d=this.inferTreeLayoutOffset(u);if(XS(u,d),a){XS(c,d),this.updateElementPosition(c,!1);const f=this.updateElementPosition(u,a);yield f==null?void 0:f.finished}return u})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(g=>{const{x:v=0,y:m=0}=g.style||{};n=Math.min(n,v),i=Math.max(i,v),a=Math.min(a,m),s=Math.max(s,m)});const{canvas:o}=this.context,A=o.getSize(),[l,c]=o.getCanvasByViewport([0,0]),[u,h]=o.getCanvasByViewport(A);if(n>=l&&i<=u&&a>=c&&s<=h)return[0,0];const d=(l+u)/2,f=(c+h)/2;return[d-(n+i)/2,f-(a+s)/2]}stopLayout(){this.instance&&Dy(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,comboFilter:n=()=>!0,preLayout:i=!1,isLayoutInvisibleNodes:a=!1}=t,{nodes:s,edges:o,combos:A}=this.context.model.getData(),{element:l,model:c}=this.context,u=m=>l.getElement(m),h=i?m=>{var w;return!a&&(((w=m.style)===null||w===void 0?void 0:w.visibility)==="hidden"||c.getAncestorsData(m.id,Ia).some(da)||c.getAncestorsData(m.id,nr).some(da))?!1:e(m)}:m=>{const w=Qt(m),C=u(w);return!C||Ch(C)?!1:e(m)},d=s.filter(h),f=A.filter(n),g=new Map(d.map(m=>[Qt(m),m]));f.forEach(m=>g.set(Qt(m),m));const v=o.filter(({source:m,target:w})=>g.has(m)&&g.has(w));return{nodes:d,edges:v,combos:f}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:A}=t,l=X6(t,["type","enableWorker","animation","iterations"]),[c,u]=i.getCanvasSize(),h=[c/2,u/2],d=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:w=>{const C=n==null?void 0:n.getElement(w.id);return C?C.attributes.size:n==null?void 0:n.getElementComputedStyle("node",w).size},f=Fo("layout",a);if(!f)return ha.warn(`The layout of ${a} is not registered.`);const g=Object.getPrototypeOf(f.prototype)===Mg.prototype?f:vQ(f,this.context),v=new g(this.context),m={nodeSize:d,width:c,height:u,center:h};switch(v.id){case"d3-force":case"d3-force-3d":Object.assign(m,{center:{x:c/2,y:u/2,z:0}});break;default:break}return Ci(v.options,m,l),v}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const XS=(r,t)=>{var e;const[n,i]=t;(e=r.nodes)===null||e===void 0||e.forEach(a=>{if(a.style){const{x:s=0,y:o=0}=a.style;a.style.x=s+n,a.style.y=o+i}else a.style={x:n,y:i}})};function q6(r){return[$6].reduce((e,n)=>n(e),r)}function $6(r){return!r.layout||Array.isArray(r.layout)||"preLayout"in r.layout||["antv-dagre","combo-combined","compact-box","circular","concentric","dagre","fishbone","grid","indented","mds","radial","random","snake","dendrogram","mindmap"].includes(r.layout.type)&&(r.layout.preLayout=!0),r}class t5 extends Wm{constructor(t){super(t),this.category="plugin",this.setPlugins(this.context.options.plugins||[])}setPlugins(t){this.setExtensions(t)}getPluginInstance(t){const e=this.extensionMap[t];if(e)return e;ha.warn(`Cannot find the plugin ${t}, will try to find it by type.`);const n=this.extensions.find(i=>i.type===t);if(n)return this.extensionMap[n.key]}}const H0=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class e5 extends Wm{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...H0.slice(0,H0.length-1),...t,H0[H0.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var zh=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class n5{get padding(){return La(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const A=s.apply(e,o);return a.forEach(l=>{l[n].apply(l,o)}),A}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=uB(this.context.options,t);return e?xl(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[A,l]=this.getCanvasCenter(),[c=0,u=0,h=0]=i,d=bs([-c,-u,-h],a);return n==="relative"?{position:tn(s,d),focalPoint:tn(o,d)}:{position:tn([A,l,s[2]],d),focalPoint:tn([A,l,o[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return hr(i==="relative"?n*a:a,...e)}transform(t,e){return zh(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const A=this.getAnimation(e);if(ci(n,new k0(Ae.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!A){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),ci(n,new k0(Ae.AFTER_TRANSFORM,t));return}const l={};if(i&&Object.assign(l,this.getTranslateOptions(t)),ye(a)&&Object.assign(l,this.getRotateOptions(t)),ye(s)&&Object.assign(l,{zoom:this.getZoomOptions(t)}),A)return ci(n,new rs(Ae.BEFORE_ANIMATE,ua.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(l),Object.assign(Object.assign({},A),{onfinish:()=>{ci(n,new rs(Ae.AFTER_ANIMATE,ua.TRANSFORM,null,t)),ci(n,new k0(Ae.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(l),{duration:0}),ci(n,new k0(Ae.AFTER_TRANSFORM,t))})}fitView(t,e){return zh(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:A="both"}=t||{},[l,c]=this.context.canvas.getSize(),u=l-s-i,h=c-n-a,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[g,v]=gA(f),m=A==="x"&&g>=u||A==="y"&&v>=h||A==="both"&&g>=u&&v>=h;if(o==="overflow"&&!m)return yield this.fitCenter({animation:e});const w=u/g,C=h/v,F=A==="x"?w:A==="y"?C:Math.min(w,C),Q=this.getAnimation(e);Number.isFinite(F)&&(yield this.transform({mode:"relative",scale:F,translate:tn(tr(this.getCanvasCenter(),this.getBBoxInViewport(d).center),bs(this.paddingOffset,F))},Q))})}fitCenter(t){return zh(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return zh(this,arguments,void 0,function*(e,n={}){const{element:i}=this.context;if(!i)return;const a=o=>n.shapes?o.getShape(n.shapes).getRenderBounds():o.getRenderBounds(),s=ch(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return zh(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=tr(i,n);yield this.transform({mode:"relative",translate:tn(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,A]=i.getViewportByCanvas(n),l=new jn;return l.setMinMax([a,s,0],[o,A,0]),l}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[A,l]=i.getCanvasByViewport(a);let c=new jn;return c.setMinMax([s,o,0],[A,l,0]),n&&(c=pA(c,n)),kc(t)?ws(t,c):e?ZO(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var ar=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class G0 extends Cg{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new U6},this.isCollapsingExpanding=!1,this.onResize=Mh(()=>{this.resize()},300),this._setOptions(Object.assign({},G0.defaultOptions,t),!0),this.context.graph=this,this.options.autoResize&&((e=globalThis.addEventListener)===null||e===void 0||e.call(globalThis,"resize",this.onResize))}getOptions(){return this.options}setOptions(t){this._setOptions(t,!1)}_setOptions(t,e){if(this.updateCanvas(t),Object.assign(this.options,q6(t)),e){const{data:h}=t;h&&this.addData(h);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:A,plugins:l,theme:c,transforms:u}=t;n&&this.setBehaviors(n),a&&this.setData(a),A&&this.setNode(A),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),l&&this.setPlugins(l),u&&this.setTransforms(u)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Wt(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Wt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Wt(t)?t(this.getBehaviors()):t,(e=this.context.behavior)===null||e===void 0||e.setBehaviors(this.options.behaviors)}updateBehavior(t){this.setBehaviors(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getBehaviors(){return this.options.behaviors||[]}setPlugins(t){var e;this.options.plugins=Wt(t)?t(this.getPlugins()):t,(e=this.context.plugin)===null||e===void 0||e.setPlugins(this.options.plugins)}updatePlugin(t){this.setPlugins(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n))}getPlugins(){return this.options.plugins||[]}getPluginInstance(t){return this.context.plugin.getPluginInstance(t)}setTransforms(t){var e;this.options.transforms=Wt(t)?t(this.getTransforms()):t,(e=this.context.transform)===null||e===void 0||e.setTransforms(this.options.transforms)}updateTransform(t){this.setTransforms(e=>e.map(n=>typeof n=="object"&&n.key===t.key?Object.assign(Object.assign({},n),t):n)),this.context.model.refreshData()}getTransforms(){return this.options.transforms||[]}getData(){return this.context.model.getData()}hasNode(t){return this.context.model.hasNode(t)}hasEdge(t){return this.context.model.hasEdge(t)}hasCombo(t){return this.context.model.hasCombo(t)}getElementData(t){return Array.isArray(t)?t.map(e=>this.context.model.getElementDataById(e)):this.context.model.getElementDataById(t)}getNodeData(t){return t===void 0?this.context.model.getNodeData():Array.isArray(t)?this.context.model.getNodeData(t):this.context.model.getNodeLikeDatum(t)}getEdgeData(t){return t===void 0?this.context.model.getEdgeData():Array.isArray(t)?this.context.model.getEdgeData(t):this.context.model.getEdgeDatum(t)}getComboData(t){return t===void 0?this.context.model.getComboData():Array.isArray(t)?this.context.model.getComboData(t):this.context.model.getNodeLikeDatum(t)}setData(t){this.context.model.setData(Wt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Wt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Wt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Wt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Wt(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Wt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Wt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Wt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Wt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Wt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Wt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Wt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Wt(t)?t(this.getComboData()):t)}getElementType(t){return this.context.model.getElementType(t)}getRelatedEdgesData(t,e="both"){return this.context.model.getRelatedEdgesData(t,e)}getNeighborNodesData(t){return this.context.model.getNeighborNodesData(t)}getAncestorsData(t,e){return this.context.model.getAncestorsData(t,e)}getParentData(t,e){return this.context.model.getParentData(t,e)}getChildrenData(t){return this.context.model.getChildrenData(t)}getDescendantsData(t){return this.context.model.getDescendantsData(t)}getElementDataByState(t,e){return this.context.model.getElementDataByState(t,e)}initCanvas(){return ar(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:A,devicePixelRatio:l=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof kS)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=gn(e)?document.getElementById(e):e,u=PS(c);this.emit(Ae.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const h=Object.assign(Object.assign({},A),{container:c,width:n||u[0],height:i||u[1],background:o,renderer:a,cursor:s,devicePixelRatio:l}),d=new kS(h);this.context.canvas=d,yield d.ready,this.emit(Ae.AFTER_CANVAS_INIT,{canvas:d})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,A=this.context.canvas;A&&(i&&(this.emit(Ae.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),A.setRenderer(i),this.emit(Ae.AFTER_RENDERER_CHANGE,{renderer:i})),a&&A.setCursor(a),(ye(o)||ye(s))&&this.setSize((e=o!=null?o:this.options.width)!==null&&e!==void 0?e:0,(n=s!=null?s:this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new I6(this.context)),this.context.plugin||(this.context.plugin=new t5(this.context)),this.context.viewport||(this.context.viewport=new n5(this.context)),this.context.transform||(this.context.transform=new e5(this.context)),this.context.element||(this.context.element=new P6(this.context)),this.context.animation||(this.context.animation=new O6(this.context)),this.context.layout||(this.context.layout=new J6(this.context)),this.context.behavior||(this.context.behavior=new L6(this.context))}prepare(){return ar(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed){console.error(Oo("The graph instance has been destroyed"));return}yield this.initCanvas(),this.initRuntime()})}render(){return ar(this,void 0,void 0,function*(){if(yield this.prepare(),ci(this,new Yr(Ae.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&gQ(this.options.layout)){const t=yield this.context.element.preLayoutDraw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.context.layout.postLayout()]),yield this.autoFit()}else{const t=this.context.element.draw({type:"render"});yield Promise.all([t==null?void 0:t.finished,this.autoFit()])}this.rendered=!0,ci(this,new Yr(Ae.AFTER_RENDER))})}draw(){return ar(this,void 0,void 0,function*(){var t;yield this.prepare(),yield(t=this.context.element.draw())===null||t===void 0?void 0:t.finished})}layout(t){return ar(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return ar(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;ci(this,new Yr(Ae.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:A}=this.context;A==null||A.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,ci(this,new Yr(Ae.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=PS((n=this.context.canvas)===null||n===void 0?void 0:n.getContainer()),a=[t||i[0],e||i[1]];if(!this.context.canvas)return;const s=this.context.canvas.getSize();Dr(a,s)||(ci(this,new Yr(Ae.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),ci(this,new Yr(Ae.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return ar(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.fitView(t,e)})}fitCenter(t){return ar(this,void 0,void 0,function*(){var e;yield(e=this.context.viewport)===null||e===void 0?void 0:e.fitCenter({animation:t})})}autoFit(){return ar(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(gn(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return ar(this,void 0,void 0,function*(){var n;yield(n=this.context.viewport)===null||n===void 0?void 0:n.focusElements(Array.isArray(t)?t:[t],{animation:e})})}zoomBy(t,e,n){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",scale:t,origin:n},e)})}getZoom(){return this.context.viewport.getZoom()}rotateBy(t,e,n){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",rotate:t,origin:n},e)})}getRotation(){return this.context.viewport.getRotation()}translateBy(t,e){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return ar(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return tr([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return ar(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=Br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeBy(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return ar(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=Br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeTo(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return zy(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return ar(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=Br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([d,f])=>{const g=this.getElementType(d);c[`${g}s`].push({id:d,style:{visibility:f}})});const{model:u,element:h}=this.context;u.preventUpdateNodeLikeHierarchy(()=>{u.updateData(c)}),yield(o=h.draw({animation:l,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return ar(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"visible"])),e)})}hideElement(t,e){return ar(this,void 0,void 0,function*(){const n=Array.isArray(t)?t:[t];yield this.setElementVisibility(Object.fromEntries(n.map(i=>[i,"hidden"])),e)})}getElementVisibility(t){var e,n;const i=this.context.element.getElement(t);return(n=(e=i==null?void 0:i.style)===null||e===void 0?void 0:e.visibility)!==null&&n!==void 0?n:"visible"}setElementZIndex(t,e){return ar(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=Br(t)?t:{[t]:e};Object.entries(a).forEach(([A,l])=>{const c=this.getElementType(A);i[`${c}s`].push({id:A,style:{zIndex:l}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return ar(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const A=n.getAncestorsData(a,nr).at(-1)||this.getComboData(a),l=[A,...n.getDescendantsData(Qt(A))],c=s-DS(A);l.forEach(h=>{i[Qt(h)]=this.getElementZIndex(Qt(h))+c});const{internal:u}=hy(l.map(Qt),h=>n.getRelatedEdgesData(h));u.forEach(h=>{const d=Qt(h);i[d]=this.getElementZIndex(d)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return DS(this.context.model.getElementDataById(t))}setElementState(t,e){return ar(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=Br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=h=>h?Array.isArray(h)?h:[h]:[],u={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([h,d])=>{const f=this.getElementType(h);u[`${f}s`].push({id:h,states:c(d)})}),this.updateData(u),yield(o=this.context.element.draw({animation:l,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return ar(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(da(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:e,style:{collapsed:!0}}]}:{combos:[{id:e,style:{collapsed:!0}}]}),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return ar(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!da(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(e);this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:e,style:{collapsed:!1}}]}:{combos:[{id:e,style:{collapsed:!1}}]}),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return ar(this,arguments,void 0,function*(t={}){return this.context.canvas.toDataURL(t)})}getCanvasByViewport(t){return this.context.canvas.getCanvasByViewport(t)}getViewportByCanvas(t){return this.context.canvas.getViewportByCanvas(t)}getClientByCanvas(t){return this.context.canvas.getClientByCanvas(t)}getCanvasByClient(t){return this.context.canvas.getCanvasByClient(t)}getViewportCenter(){return this.context.viewport.getViewportCenter()}getCanvasCenter(){return this.context.viewport.getCanvasCenter()}on(t,e,n){return super.on(t,e,n)}once(t,e){return super.once(t,e)}off(t,e){return super.off(t,e)}}G0.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var r5=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{if(o.depth=A,!o.children)return o;const{children:l}=o,c=r5(o,["children"]);return Object.assign(Object.assign({},c),{children:l.map(u=>u.id)})},getEdgeData:n=(o,A)=>({source:o.id,target:A.id}),getChildren:i=o=>o.children||[]}=t||{},a=[],s=[];return El(r,(o,A)=>{a.push(e(o,A));const l=i(o);for(const c of l)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class a5 extends kA{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{JS(i,a)}),t}}const JS=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=nx(i,u=>r.getParentData(u,nr)),o=nx(a,u=>r.getParentData(u,nr)),A=Qt(s),l=Qt(o),c={sourceNode:A,targetNode:l};return t.style?Object.assign(t.style,c):t.style=c,t},s5=(r,t,e)=>{const[n,i]=t,[a,s]=e;if(i===n)return a;const o=(r-n)/(i-n);return a+o*(s-a)},o5=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.log(r-n+1)/Math.log(i-n+1);return a+o*(s-a)},A5=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,A=Math.pow((r-i)/(a-i),n);return s+A*(o-s)},l5=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class K0 extends kA{constructor(t,e){super(t,Ci({},K0.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,A)=>{const l=[i,a],c=[s[0],o[0]],u=[s[1],o[1]],h=[s[2],o[2]],d=(f,g)=>{if(typeof A=="function")return A(f,l,g);switch(A){case"linear":return s5(f,l,g);case"log":return o5(f,l,g);case"pow":return A5(f,l,g,2);case"sqrt":return l5(f,l,g);default:return g[0]}};return[d(n,c),d(n,u),d(n,h)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=ka(this.options.maxSize),a=ka(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,A=s.size>0?Math.min(...s.values()):0;return n.forEach(l=>{var c;const u=this.assignSizeByCentrality(s.get(Qt(l))||0,A,o,a,i,this.options.scale),h=(c=this.context.element)===null||c===void 0?void 0:c.getElement(Qt(l)),d={size:u};this.assignLabelStyle(d,u,l,h),(!h||!L0(d,h.attributes))&&Pa(t,h?"update":"add","node",Ci(l,{style:d}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,xl(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+WO(t.labelPadding)})}return t}getLabelSizeByNodeSize(t,e,n){const i=Math.min(...t)/2,[a,s]=Array.isArray(this.options.mapLabelSize)?this.options.mapLabelSize:[n,e];return Math.min(s,Math.max(i,a))}getCentralities(t){const{model:e}=this.context,n=e.getData();if(typeof t=="function")return t(n);const i=e.getRelatedEdgesData.bind(e);return nb(n,i,t)}}K0.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class z0 extends kA{constructor(t,e){super(t,Object.assign({},z0.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=Ai(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(Qt(s)===Qt(this.ref))return;const A=sb(tr(Ai(s),e)),l=Math.abs(A)>Math.PI/2,c=!s.children||s.children.length===0,u=Qt(s),h=(o=this.context.element)===null||o===void 0?void 0:o.getElement(u);if(!h||!h.isVisible())return;const d=ka(n.getElementRenderStyle(u).size)[0]/2,f=(c?1:-1)*(d+this.options.offset),g=[["translate",f*Math.cos(A),f*Math.sin(A)],["rotate",l?Bi(A)+180:Bi(A)]];i.updateNodeData([{id:Qt(s),style:{labelTextAlign:l===c?"right":"left",labelTextBaseline:"middle",labelTransform:g}}])}),n.draw()}}z0.defaultOptions={offset:5};const c5="quadratic",qS=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class V0 extends kA{constructor(t,e){super(t,Object.assign({},V0.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:A}}=n,{model:l}=this.context,c=new Map,u=(f,g)=>{l.getRelatedEdgesData(g).forEach(m=>!c.has(Qt(m))&&c.set(Qt(m),m))};a.forEach(u),o.forEach(u);const h=f=>{const g=new Set(n.remove.edges.keys()),v=l.getEdgeData().filter(m=>!g.has(Qt(m))).map(m=>JS(l,m));u5(f,v,!0).forEach(m=>{const w=Qt(m);c.has(w)||c.set(w,m)})};if(A.size&&A.forEach(h),i.size&&i.forEach(h),s.size){const f=JC(Xy(l.getChanges())).update.edges;s.forEach(g=>{var v;h(g);const m=(v=f.find(w=>Qt(w.value)===Qt(g)))===null||v===void 0?void 0:v.original;m&&!V1(g,m)&&h(m)})}ro(this.options.edges)||c.forEach((f,g)=>!this.options.edges.includes(g)&&c.delete(g));const d=l.getEdgeData().map(Qt);return new Map([...c].sort((f,g)=>d.indexOf(f[0])-d.indexOf(g[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=$S(i);s.forEach(A=>{A.forEach((l,c,u)=>{var h;const d=u.length,f=l.style||{};if(l.source===l.target){const m=qS.length;f.loopPlacement=qS[c%m],f.loopDist=Math.floor(c/m)*a+50}else if(d===1)f.curveOffset=0;else{const m=(c%2===0?1:-1)*(o[`${l.source}|${l.target}|${c}`]?-1:1);f.curveOffset=d%2===1?m*Math.ceil(c/2)*a*2:m*(Math.floor(c/2)*a*2+a)}const g=Object.assign(l,{type:c5,style:f}),v=(h=this.context.element)===null||h===void 0?void 0:h.getElement(Qt(l));(!v||!L0(g.style,v.attributes))&&Pa(n,v?"update":"add","edge",g,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(Qt(n))||{};return Object.keys(a).forEach(s=>{Dr(i[s],a[s])&&(n[s]?i[s]=n[s]:delete i[s])}),Object.assign(n,{style:i})},this.applyMergingStyle=(n,i)=>{const{edgeMap:a,reverses:s}=$S(i);a.forEach(o=>{var A;if(o.length===1){const c=o[0],u=(A=this.context.element)===null||A===void 0?void 0:A.getElement(Qt(c)),h=this.resetEdgeStyle(c);(!u||!L0(h,u.attributes))&&Pa(n,u?"update":"add","edge",h);return}const l=o.map(({source:c,target:u,style:h={}},d)=>{const{startArrow:f,endArrow:g}=h,v={},[m,w]=s[`${c}|${u}|${d}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Jo(f)&&(v[m]=f),Jo(g)&&(v[w]=g),v}).reduce((c,u)=>Object.assign(Object.assign({},c),u),{});o.forEach((c,u,h)=>{var d;if(u!==0){Pa(n,"remove","edge",c);return}const f=Object.assign({},Wt(this.options.style)?this.options.style(h):this.options.style,{childrenData:h});this.cacheMergeStyle.set(Qt(c),f);const g=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),l),f)}),v=(d=this.context.element)===null||d===void 0?void 0:d.getElement(Qt(c));(!v||!L0(g.style,v.attributes))&&Pa(n,v?"update":"add","edge",g,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}V0.defaultOptions={mode:"bundle",distance:15};const $S=r=>{const t=new Map,e=new Set,n={},i=new Map;for(const[a,s]of r){if(e.has(a))continue;const{source:o,target:A}=s,l=`${o}-${A}`;t.has(l)||(t.set(l,[]),i.set(l,new Set));const c=t.get(l),u=i.get(l);c&&u&&!u.has(a)&&(c.push(s),u.add(a),e.add(a));for(const[h,d]of r)if(!(e.has(h)||h===a)&&V1(s,d)){const f=t.get(l),g=i.get(l);f&&g&&!g.has(h)&&(f.push(d),g.add(h),o===d.target&&A===d.source&&(n[`${d.source}|${d.target}|${f.length-1}`]=!0),e.add(h))}}return{edgeMap:t,reverses:n}},u5=(r,t,e)=>t.filter(n=>(e||Qt(n)!==Qt(r))&&V1(n,r)),V1=(r,t)=>{const{sourceNode:e,targetNode:n}=r.style||{},{sourceNode:i,targetNode:a}=t.style||{};return e===i&&n===a||e===a&&n===i};class h5 extends kA{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,A=(l,c)=>{i.getRelatedEdgesData(c).forEach(h=>!s.has(Qt(h))&&s.set(Qt(h),h))};return a.forEach(A),o.forEach(A),t}}const d5={animation:{"combo-collapse":gB,"combo-expand":HO,"node-collapse":dB,"node-expand":RO,"path-in":fB,"path-out":_O,fade:PO,translate:DO},behavior:{"brush-select":vh,"click-select":Xf,"collapse-expand":yg,"create-edge":bg,"drag-canvas":xg,"drag-element-force":mQ,"drag-element":Th,"fix-element-size":Fg,"focus-element":Og,"hover-activate":Ig,"lasso-select":wQ,"auto-adapt-label":zf,"optimize-viewport-transform":Lg,"scroll-canvas":Ng,"zoom-canvas":kg},combo:{circle:ck,rect:uk},edge:{cubic:Cl,line:vg,polyline:pg,quadratic:mg,"cubic-horizontal":dg,"cubic-radial":fg,"cubic-vertical":gg},layout:{"antv-dagre":C3,"combo-combined":j3,"compact-box":Fx,"d3-force":gP,"force-atlas2":mP,circular:T3,concentric:Ny,dagre:Dg,dendrogram:Ix,fishbone:Hg,force:wC,fruchterman:EP,grid:bP,indented:Lx,mds:MC,mindmap:Qx,radial:LP,random:RP,snake:Gg},node:{circle:Bl,diamond:EN,ellipse:eg,hexagon:SN,html:Ag,image:lg,rect:Ak,star:lk,donut:$f,triangle:cg},palette:{spectral:zP,tableau:VP,oranges:WP,greens:ZP,blues:jP},theme:{dark:m6,light:y6},plugin:{"bubble-sets":qg,"edge-bundling":t0,"edge-filter-lens":e0,"grid-line":i0,background:Kg,contextmenu:$g,fisheye:n0,fullscreen:r0,history:a0,hull:l0,legend:g0,minimap:v0,snapline:p0,timebar:T0,title:n6,toolbar:F0,tooltip:O0,watermark:I0},transform:{"arrange-draw-order":w6,"collapse-expand-combo":E6,"collapse-expand-node":B6,"get-edge-actual-ends":a5,"map-node-size":K0,"place-radial-labels":z0,"process-parallel-edges":V0,"update-related-edges":h5},shape:{circle:Js,ellipse:eh,group:oi,html:ul,image:ny,line:hl,path:Pi,polygon:dl,polyline:af,rect:xi,text:fl,label:io,badge:Uc}};function f5(){Object.entries(d5).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{b6(r,e,n)})})}f5();const SK={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"}},72484:function(X,et,M){"use strict";var O=M(59301),W=M(42441),H=M(48961),L=M.n(H),I=Object.defineProperty,N=Object.defineProperties,P=Object.getOwnPropertyDescriptors,k=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Z=Object.prototype.propertyIsEnumerable,V=(it,vt,gt)=>vt in it?I(it,vt,{enumerable:!0,configurable:!0,writable:!0,value:gt}):it[vt]=gt,Y=(it,vt)=>{for(var gt in vt||(vt={}))U.call(vt,gt)&&V(it,gt,vt[gt]);if(k)for(var gt of k(vt))Z.call(vt,gt)&&V(it,gt,vt[gt]);return it},nt=(it,vt)=>N(it,P(vt));function rt(it,vt,gt=1/3,yt){let mt=it*Math.PI*2,Mt=vt*Math.PI*2;return{u:{min:-Math.PI,max:Math.PI*3,step:Math.PI/32},v:{min:0,max:Math.PI*2,step:Math.PI/20},x:function(Ct,Nt){return CtMt?Math.cos(Mt)*(1+Math.cos(Nt)*gt):Math.cos(Ct)*(1+Math.cos(Nt)*gt)},y:function(Ct,Nt){return CtMt?Math.sin(Mt)*(1+Math.cos(Nt)*gt):Math.sin(Ct)*(1+Math.cos(Nt)*gt)},z:function(Ct,Nt){return Ct<-Math.PI*.5?Math.sin(Ct):Ct>Math.PI*2.5?Math.sin(Ct)*yt*.1:Math.sin(Nt)>0?1*yt*.1:-1}}}function ft({pieData:it=[],internalDiameterRatio:vt=1/3}){var gt,yt,mt,Mt;const Ct=[],Nt=it==null?void 0:it.reduce((ue,Me)=>(ue||0)+((Me==null?void 0:Me.value)||0),0);let qt=0,Gt=0;const re=[];for(let ue=0;ue<(it==null?void 0:it.length);ue++){Gt=qt+(Nt==0?1:((gt=it==null?void 0:it[ue])==null?void 0:gt.value)||0);const Me={itemStyle:((yt=it==null?void 0:it[ue])==null?void 0:yt.itemStyle)||{},name:((mt=it==null?void 0:it[ue])==null?void 0:mt.name)||`name${ue}`,type:"surface",parametric:!0,parametricEquation:rt(qt/(Nt||(it==null?void 0:it.length)),Gt/(Nt||(it==null?void 0:it.length)),vt,((Mt=it==null?void 0:it[ue])==null?void 0:Mt.value)||(Nt==0?25:0)),wireframe:{show:!1},pieData:it==null?void 0:it[ue]};re.push(Me.name),Ct.push(Me),qt=Gt}return Ct.push({name:"pie2d",type:"pie",showEmptyCircle:!0,label:{show:!0,formatter:ue=>`${ue.value} ${ue.name}`},startAngle:-35,radius:["49%","50%"],center:["50%","40%"],data:[...it||[]].reverse(),itemStyle:{opacity:0}}),{legend:{left:"50%",top:"center",textStyle:{fontSize:12},data:re},xAxis3D:{},yAxis3D:{},zAxis3D:{},grid3D:{viewControl:{alpha:45,rotateSensitivity:0,zoomSensitivity:0,panSensitivity:0,autoRotate:!1},left:"center",top:"-10%",show:!1,boxHeight:25},series:Ct}}const ct=({dataSource:it=[{name:"\u638C\u63E1\u738780%~100%",value:0,itemStyle:{color:"rgb(223,209,38)"}},{name:"\u638C\u63D0\u738760%~79%",value:0,itemStyle:{color:"rgb(6,234,230)"}},{name:"\u638C\u63A8\u738759%\u4EE5\u4E0B",value:0,itemStyle:{color:"rgb(6,110,247)"}}],className:vt="",style:gt={},legend:yt={},internalDiameterRatio:mt=1/3})=>{const[Mt,Ct]=(0,O.useState)([]),Nt=(0,O.useCallback)(re=>{const de=re.selected||{},ue=it.map(Me=>Me.name).filter(Me=>de[Me]===!1);Ct(ue)},[it]),qt=(0,O.useMemo)(()=>it.filter(re=>!Mt.includes(re.name)),[it,Mt]),Gt=(0,O.useMemo)(()=>{const re=ft({pieData:qt,internalDiameterRatio:mt}),de=it.map(Me=>Me.name),ue=it.reduce((Me,Ve)=>(Me[Ve.name]=!Mt.includes(Ve.name),Me),{});return re.legend=nt(Y(Y({},re.legend),yt),{data:de,selected:ue}),re},[qt,yt,mt,it,Mt]);return O.createElement(W.Z,{onEvents:{legendselectchanged:Nt},className:`w-full h-full ${vt}`,option:Gt,style:Y({height:"100%"},gt)})};et.Z=ct},30035:function(X,et,M){"use strict";var O,W=Object.defineProperty,H=q=>{throw TypeError(q)},L=Math.pow,I=(q,x,S)=>x in q?W(q,x,{enumerable:!0,configurable:!0,writable:!0,value:S}):q[x]=S,N=(q,x,S)=>I(q,typeof x!="symbol"?x+"":x,S),P=(q,x,S)=>x.has(q)||H("Cannot "+S),k=(q,x,S)=>(P(q,x,"read from private field"),S?S.call(q):x.get(q)),U=(q,x,S)=>x.has(q)?H("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(q):x.set(q,S),Z=(q,x,S,y)=>(P(q,x,"write to private field"),y?y.call(q,S):x.set(q,S),S),V=(q,x,S)=>(P(q,x,"access private method"),S),Y,nt,rt;O={value:!0};var ft=M(34634),ct=M(34402);const it=" ".repeat(2),vt=" ".repeat(4);function gt(){return yt(this)}function yt(q,x={}){const{maxRows:S=15,maxColumns:y=10,maxNumSize:T=8,padMinus:R="auto"}=x;return`${q.constructor.name} { ${it}[ ${vt}${mt(q,S,y,T,R)} ${it}] ${it}rows: ${q.rows} ${it}columns: ${q.columns} }`}function mt(q,x,S,y,T){const{rows:R,columns:st}=q,ot=Math.min(R,x),ut=Math.min(st,S),ht=[];if(T==="auto"){T=!1;t:for(let kt=0;kt=0&&S?` ${Ct(q,x-1)}`:Ct(q,x)).padEnd(x)}function Ct(q,x){let S=q.toString();if(S.length<=x)return S;let y=q.toFixed(x);if(y.length>x&&(y=q.toFixed(Math.max(0,x-(y.length-x)))),y.length<=x&&!y.startsWith("0.000")&&!y.startsWith("-0.000"))return y;let T=q.toExponential(x);return T.length>x&&(T=q.toExponential(Math.max(0,x-(T.length-x)))),T.slice(0)}function Nt(q,x){q.prototype.add=function(y){return typeof y=="number"?this.addS(y):this.addM(y)},q.prototype.addS=function(y){for(let T=0;T>y);return this},q.prototype.signPropagatingRightShiftM=function(y){if(y=x.checkMatrix(y),this.rows!==y.rows||this.columns!==y.columns)throw new RangeError("Matrices dimensions must be equal");for(let T=0;T>y.get(T,R));return this},q.signPropagatingRightShift=function(y,T){return new x(y).signPropagatingRightShift(T)},q.prototype.rightShift=function(y){return typeof y=="number"?this.rightShiftS(y):this.rightShiftM(y)},q.prototype.rightShiftS=function(y){for(let T=0;T>>y);return this},q.prototype.rightShiftM=function(y){if(y=x.checkMatrix(y),this.rows!==y.rows||this.columns!==y.columns)throw new RangeError("Matrices dimensions must be equal");for(let T=0;T>>y.get(T,R));return this},q.rightShift=function(y,T){return new x(y).rightShift(T)},q.prototype.zeroFillRightShift=q.prototype.rightShift,q.prototype.zeroFillRightShiftS=q.prototype.rightShiftS,q.prototype.zeroFillRightShiftM=q.prototype.rightShiftM,q.zeroFillRightShift=q.rightShift,q.prototype.not=function(){for(let y=0;yy)throw new RangeError("Row index out of range")}function Gt(q,x,S){let y=S?q.columns:q.columns-1;if(x<0||x>y)throw new RangeError("Column index out of range")}function re(q,x){if(x.to1DArray&&(x=x.to1DArray()),x.length!==q.columns)throw new RangeError("vector size must be the same as the number of columns");return x}function de(q,x){if(x.to1DArray&&(x=x.to1DArray()),x.length!==q.rows)throw new RangeError("vector size must be the same as the number of rows");return x}function ue(q,x){if(!ft.isAnyArray(x))throw new TypeError("row indices must be an array");for(let S=0;S=q.rows)throw new RangeError("row indices are out of range")}function Me(q,x){if(!ft.isAnyArray(x))throw new TypeError("column indices must be an array");for(let S=0;S=q.columns)throw new RangeError("column indices are out of range")}function Ve(q,x,S,y,T){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Xn("startRow",x),Xn("endRow",S),Xn("startColumn",y),Xn("endColumn",T),x>S||y>T||x<0||x>=q.rows||S<0||S>=q.rows||y<0||y>=q.columns||T<0||T>=q.columns)throw new RangeError("Submatrix indices are out of range")}function dn(q,x=0){let S=[];for(let y=0;y=R)throw new RangeError("min must be smaller than max");let ot=R-T,ut=new pe(x,S);for(let ht=0;hty?(R=!0,y=S):(T=!1,R=!0);x++}return T}isReducedEchelonForm(){let x=0,S=0,y=-1,T=!0,R=!1;for(;xy?(R=!0,y=S):(T=!1,R=!0);for(let st=S+1;stx.get(T,y)&&(T=R);if(x.get(T,y)===0)y++;else{x.swapRows(S,T);let R=x.get(S,y);for(let st=y;st=0;)if(x.maxRow(T)===0)T--;else{let R=0,st=!1;for(;RS[y]&&(S[y]=this.get(y,T));return S}case"column":{const S=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let y=0;yS[T]&&(S[T]=this.get(y,T));return S}case void 0:{let S=this.get(0,0);for(let y=0;yS&&(S=this.get(y,T));return S}default:throw new Error(`invalid option: ${x}`)}}maxIndex(){Xr(this);let x=this.get(0,0),S=[0,0];for(let y=0;yx&&(x=this.get(y,T),S[0]=y,S[1]=T);return S}min(x){if(this.isEmpty())return NaN;switch(x){case"row":{const S=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let y=0;yS&&(S=this.get(x,y));return S}maxRowIndex(x){qt(this,x),Xr(this);let S=this.get(x,0),y=[x,0];for(let T=1;TS&&(S=this.get(x,T),y[1]=T);return y}minRow(x){if(qt(this,x),this.isEmpty())return NaN;let S=this.get(x,0);for(let y=1;yS&&(S=this.get(y,x));return S}maxColumnIndex(x){Gt(this,x),Xr(this);let S=this.get(0,x),y=[0,x];for(let T=1;TS&&(S=this.get(T,x),y[0]=T);return y}minColumn(x){if(Gt(this,x),this.isEmpty())return NaN;let S=this.get(0,x);for(let y=1;y=1;T/=2)T&1&&(S=S.mmul(y)),y=y.mmul(y);return S}strassen2x2(x){x=pe.checkMatrix(x);let S=new pe(2,2);const y=this.get(0,0),T=x.get(0,0),R=this.get(0,1),st=x.get(0,1),ot=this.get(1,0),ut=x.get(1,0),ht=this.get(1,1),kt=x.get(1,1),Bt=(y+ht)*(T+kt),jt=(ot+ht)*T,ce=y*(st-kt),Kt=ht*(ut-T),$t=(y+R)*kt,Ce=(ot-y)*(T+st),St=(R-ht)*(ut+kt),te=Bt+Kt-$t+St,Ee=ce+$t,He=jt+Kt,je=Bt-jt+ce+Ce;return S.set(0,0,te),S.set(0,1,Ee),S.set(1,0,He),S.set(1,1,je),S}strassen3x3(x){x=pe.checkMatrix(x);let S=new pe(3,3);const y=this.get(0,0),T=this.get(0,1),R=this.get(0,2),st=this.get(1,0),ot=this.get(1,1),ut=this.get(1,2),ht=this.get(2,0),kt=this.get(2,1),Bt=this.get(2,2),jt=x.get(0,0),ce=x.get(0,1),Kt=x.get(0,2),$t=x.get(1,0),Ce=x.get(1,1),St=x.get(1,2),te=x.get(2,0),Ee=x.get(2,1),He=x.get(2,2),je=(y+T+R-st-ot-kt-Bt)*Ce,Wn=(y-st)*(-ce+Ce),Ie=ot*(-jt+ce+$t-Ce-St-te+He),De=(-y+st+ot)*(jt-ce+Ce),on=(st+ot)*(-jt+ce),Lt=y*jt,ee=(-y+ht+kt)*(jt-Kt+St),he=(-y+ht)*(Kt-St),se=(ht+kt)*(-jt+Kt),Jn=(y+T+R-ot-ut-ht-kt)*St,Qn=kt*(-jt+Kt+$t-Ce-St-te+Ee),Zn=(-R+kt+Bt)*(Ce+te-Ee),qn=(R-Bt)*(Ce-Ee),kr=R*te,Tr=(kt+Bt)*(-te+Ee),Dn=(-R+ot+ut)*(St+te-He),Xi=(R-ut)*(St-He),Ji=(ot+ut)*(-te+He),fn=T*$t,wr=ut*Ee,$r=st*Kt,ti=ht*ce,Rn=Bt*He,ks=Lt+kr+fn,Wo=je+De+on+Lt+Zn+kr+Tr,au=Lt+ee+se+Jn+kr+Dn+Ji,co=Wn+Ie+De+Lt+kr+Dn+Xi,uo=Wn+De+on+Lt+wr,_A=kr+Dn+Xi+Ji+$r,su=Lt+ee+he+Qn+Zn+qn+kr,Vl=Zn+qn+kr+Tr+ti,ou=Lt+ee+he+se+Rn;return S.set(0,0,ks),S.set(0,1,Wo),S.set(0,2,au),S.set(1,0,co),S.set(1,1,uo),S.set(1,2,_A),S.set(2,0,su),S.set(2,1,Vl),S.set(2,2,ou),S}mmulStrassen(x){x=pe.checkMatrix(x);let S=this.clone(),y=S.rows,T=S.columns,R=x.rows,st=x.columns;T!==R&&console.warn(`Multiplying ${y} x ${T} and ${R} x ${st} matrix: dimensions do not match.`);function ot(Bt,jt,ce){let Kt=Bt.rows,$t=Bt.columns;if(Kt===jt&&$t===ce)return Bt;{let Ce=me.zeros(jt,ce);return Ce=Ce.setSubMatrix(Bt,0,0),Ce}}let ut=Math.max(y,R),ht=Math.max(T,st);S=ot(S,ut,ht),x=ot(x,ut,ht);function kt(Bt,jt,ce,Kt){if(ce<=512||Kt<=512)return Bt.mmul(jt);ce%2===1&&Kt%2===1?(Bt=ot(Bt,ce+1,Kt+1),jt=ot(jt,ce+1,Kt+1)):ce%2===1?(Bt=ot(Bt,ce+1,Kt),jt=ot(jt,ce+1,Kt)):Kt%2===1&&(Bt=ot(Bt,ce,Kt+1),jt=ot(jt,ce,Kt+1));let $t=parseInt(Bt.rows/2,10),Ce=parseInt(Bt.columns/2,10),St=Bt.subMatrix(0,$t-1,0,Ce-1),te=jt.subMatrix(0,$t-1,0,Ce-1),Ee=Bt.subMatrix(0,$t-1,Ce,Bt.columns-1),He=jt.subMatrix(0,$t-1,Ce,jt.columns-1),je=Bt.subMatrix($t,Bt.rows-1,0,Ce-1),Wn=jt.subMatrix($t,jt.rows-1,0,Ce-1),Ie=Bt.subMatrix($t,Bt.rows-1,Ce,Bt.columns-1),De=jt.subMatrix($t,jt.rows-1,Ce,jt.columns-1),on=kt(me.add(St,Ie),me.add(te,De),$t,Ce),Lt=kt(me.add(je,Ie),te,$t,Ce),ee=kt(St,me.sub(He,De),$t,Ce),he=kt(Ie,me.sub(Wn,te),$t,Ce),se=kt(me.add(St,Ee),De,$t,Ce),Jn=kt(me.sub(je,St),me.add(te,He),$t,Ce),Qn=kt(me.sub(Ee,Ie),me.add(Wn,De),$t,Ce),Zn=me.add(on,he);Zn.sub(se),Zn.add(Qn);let qn=me.add(ee,se),kr=me.add(Lt,he),Tr=me.sub(on,Lt);Tr.add(ee),Tr.add(Jn);let Dn=me.zeros(2*Zn.rows,2*Zn.columns);return Dn=Dn.setSubMatrix(Zn,0,0),Dn=Dn.setSubMatrix(qn,Zn.rows,0),Dn=Dn.setSubMatrix(kr,0,Zn.columns),Dn=Dn.setSubMatrix(Tr,Zn.rows,Zn.columns),Dn.subMatrix(0,ce-1,0,Kt-1)}return kt(S,x,ut,ht)}scaleRows(x={}){if(typeof x!="object")throw new TypeError("options must be an object");const{min:S=0,max:y=1}=x;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(y))throw new TypeError("max must be a number");if(S>=y)throw new RangeError("min must be smaller than max");let T=new pe(this.rows,this.columns);for(let R=0;R0&&ct(st,{min:S,max:y,output:st}),T.setRow(R,st)}return T}scaleColumns(x={}){if(typeof x!="object")throw new TypeError("options must be an object");const{min:S=0,max:y=1}=x;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(y))throw new TypeError("max must be a number");if(S>=y)throw new RangeError("min must be smaller than max");let T=new pe(this.rows,this.columns);for(let R=0;Ry||S<0||S>=this.columns||y<0||y>=this.columns)throw new RangeError("Argument out of range");let T=new pe(x.length,y-S+1);for(let R=0;R=this.rows)throw new RangeError(`Row index out of range: ${x[R]}`);T.set(R,st-S,this.get(x[R],st))}return T}subMatrixColumn(x,S,y){if(S===void 0&&(S=0),y===void 0&&(y=this.rows-1),S>y||S<0||S>=this.rows||y<0||y>=this.rows)throw new RangeError("Argument out of range");let T=new pe(y-S+1,x.length);for(let R=0;R=this.columns)throw new RangeError(`Column index out of range: ${x[R]}`);T.set(st-S,R,this.get(st,x[R]))}return T}setSubMatrix(x,S,y){if(x=pe.checkMatrix(x),x.isEmpty())return this;let T=S+x.rows-1,R=y+x.columns-1;Ve(this,S,T,y,R);for(let st=0;sttypeof x=="number")}me.random=me.rand,me.randomInt=me.randInt,me.diagonal=me.diag,me.prototype.diagonal=me.prototype.diag,me.identity=me.eye,me.prototype.negate=me.prototype.neg,me.prototype.tensorProduct=me.prototype.kroneckerProduct;const Wi=class X1 extends me{constructor(x,S){if(super(),U(this,Y),N(this,"data"),X1.isMatrix(x))V(this,Y,nt).call(this,x.rows,x.columns),X1.copy(x,this);else if(Number.isInteger(x)&&x>=0)V(this,Y,nt).call(this,x,S);else if(ft.isAnyArray(x)){const y=x;if(x=y.length,S=x?y[0].length:0,typeof S!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let T=0;T=0)for(let S=0;S=0)Z(this,rt,new pe(x,x));else if(Z(this,rt,new pe(x)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return k(this,rt).size}get rows(){return k(this,rt).rows}get columns(){return k(this,rt).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(x){return pe.isMatrix(x)&&x.klassType==="SymmetricMatrix"}static zeros(x){return new this(x)}static ones(x){return new this(x).fill(1)}clone(){const x=new J1(this.diagonalSize);for(const[S,y,T]of this.upperRightEntries())x.set(S,y,T);return x}toMatrix(){return new pe(this)}get(x,S){return k(this,rt).get(x,S)}set(x,S,y){return k(this,rt).set(x,S,y),k(this,rt).set(S,x,y),this}removeCross(x){return k(this,rt).removeRow(x),k(this,rt).removeColumn(x),this}addCross(x,S){S===void 0&&(S=x,x=this.diagonalSize);const y=S.slice();return y.splice(x,1),k(this,rt).addRow(x,y),k(this,rt).addColumn(x,S),this}applyMask(x){if(x.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const S=[];for(const[y,T]of x.entries())T||S.push(y);S.reverse();for(const y of S)this.removeCross(y);return this}toCompact(){const{diagonalSize:x}=this,S=new Array(x*(x+1)/2);for(let y=0,T=0,R=0;R=x&&(y=++T);return S}static fromCompact(x){const S=x.length,y=(Math.sqrt(8*S+1)-1)/2;if(!Number.isInteger(y))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(x)}`);const T=new J1(y);for(let R=0,st=0,ot=0;ot=y&&(R=++st);return T}*upperRightEntries(){for(let x=0,S=0;x=this.diagonalSize&&(S=++x)}}*upperRightValues(){for(let x=0,S=0;x=this.diagonalSize&&(S=++x)}};rt=new WeakMap;let Nr=Ga;Nr.prototype.klassType="SymmetricMatrix";class Mr extends Nr{static isDistanceMatrix(x){return Nr.isSymmetricMatrix(x)&&x.klassSubType==="DistanceMatrix"}constructor(x){if(super(x),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(x,S,y){return x===S&&(y=0),super.set(x,S,y)}addCross(x,S){return S===void 0&&(S=x,x=this.diagonalSize),S=S.slice(),S[x]=0,super.addCross(x,S)}toSymmetricMatrix(){return new Nr(this)}clone(){const x=new Mr(this.diagonalSize);for(const[S,y,T]of this.upperRightEntries())S!==y&&x.set(S,y,T);return x}toCompact(){const{diagonalSize:x}=this,S=(x-1)*x/2,y=new Array(S);for(let T=1,R=0,st=0;st=x&&(T=++R+1);return y}static fromCompact(x){const S=x.length;if(S===0)return new this(0);const y=(Math.sqrt(8*S+1)+1)/2;if(!Number.isInteger(y))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(x)}`);const T=new this(y);for(let R=1,st=0,ot=0;ot=y&&(R=++st+1);return T}}Mr.prototype.klassSubType="DistanceMatrix";class di extends me{constructor(x,S,y){super(),this.matrix=x,this.rows=S,this.columns=y}}class as extends di{constructor(x,S){Gt(x,S),super(x,x.rows,1),this.column=S}set(x,S,y){return this.matrix.set(x,this.column,y),this}get(x){return this.matrix.get(x,this.column)}}class Zi extends di{constructor(x,S){Me(x,S),super(x,x.rows,S.length),this.columnIndices=S}set(x,S,y){return this.matrix.set(x,this.columnIndices[S],y),this}get(x,S){return this.matrix.get(x,this.columnIndices[S])}}class ss extends di{constructor(x){super(x,x.rows,x.columns)}set(x,S,y){return this.matrix.set(x,this.columns-S-1,y),this}get(x,S){return this.matrix.get(x,this.columns-S-1)}}class Ii extends di{constructor(x){super(x,x.rows,x.columns)}set(x,S,y){return this.matrix.set(this.rows-x-1,S,y),this}get(x,S){return this.matrix.get(this.rows-x-1,S)}}class Jr extends di{constructor(x,S){qt(x,S),super(x,1,x.columns),this.row=S}set(x,S,y){return this.matrix.set(this.row,S,y),this}get(x,S){return this.matrix.get(this.row,S)}}class ma extends di{constructor(x,S){ue(x,S),super(x,S.length,x.columns),this.rowIndices=S}set(x,S,y){return this.matrix.set(this.rowIndices[x],S,y),this}get(x,S){return this.matrix.get(this.rowIndices[x],S)}}class ya extends di{constructor(x,S,y){ue(x,S),Me(x,y),super(x,S.length,y.length),this.rowIndices=S,this.columnIndices=y}set(x,S,y){return this.matrix.set(this.rowIndices[x],this.columnIndices[S],y),this}get(x,S){return this.matrix.get(this.rowIndices[x],this.columnIndices[S])}}class aa extends di{constructor(x,S,y,T,R){Ve(x,S,y,T,R),super(x,y-S+1,R-T+1),this.startRow=S,this.startColumn=T}set(x,S,y){return this.matrix.set(this.startRow+x,this.startColumn+S,y),this}get(x,S){return this.matrix.get(this.startRow+x,this.startColumn+S)}}class wa extends di{constructor(x){super(x,x.columns,x.rows)}set(x,S,y){return this.matrix.set(S,x,y),this}get(x,S){return this.matrix.get(S,x)}}class qr extends me{constructor(x,S={}){const{rows:y=1}=S;if(x.length%y!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=y,this.columns=x.length/y,this.data=x}set(x,S,y){let T=this._calculateIndex(x,S);return this.data[T]=y,this}get(x,S){let y=this._calculateIndex(x,S);return this.data[y]}_calculateIndex(x,S){return x*this.columns+S}}class or extends me{constructor(x){super(),this.data=x,this.rows=x.length,this.columns=x[0].length}set(x,S,y){return this.data[x][S]=y,this}get(x,S){return this.data[x][S]}}function Ko(q,x){if(ft.isAnyArray(q))return q[0]&&ft.isAnyArray(q[0])?new or(q):new qr(q,x);throw new Error("the argument is not an array")}class ji{constructor(x){x=or.checkMatrix(x);let S=x.clone(),y=S.rows,T=S.columns,R=new Float64Array(y),st=1,ot,ut,ht,kt,Bt,jt,ce,Kt,$t;for(ot=0;otMath.abs(Kt[kt])&&(kt=ot);if(kt!==ut){for(ht=0;ht=0;ht--){for(ut=0;utst?T.set(R,st,x.get(R,st)):R===st?T.set(R,st,1):T.set(R,st,0);return T}get upperTriangularMatrix(){let x=this.LU,S=x.rows,y=x.columns,T=new pe(S,y);for(let R=0;RMath.abs(x)?(S=x/q,Math.abs(q)*Math.sqrt(1+S*S)):x!==0?(S=q/x,Math.abs(x)*Math.sqrt(1+S*S)):0}class lo{constructor(x){x=or.checkMatrix(x);let S=x.clone(),y=x.rows,T=x.columns,R=new Float64Array(T),st,ot,ut,ht;for(ut=0;ut=0;ht--){for(ut=0;ut=0;ot--){for(R=0;R=0;Lt--)if(Kt[Lt]!==0){for(let ee=Lt+1;ee=0;Lt--){if(Lt0;){let Lt,ee;for(Lt=Ie-2;Lt>=-1&&Lt!==-1;Lt--){const he=Number.MIN_VALUE+on*Math.abs(Kt[Lt]+Math.abs(Kt[Lt+1]));if(Math.abs(St[Lt])<=he||Number.isNaN(St[Lt])){St[Lt]=0;break}}if(Lt===Ie-2)ee=4;else{let he;for(he=Ie-1;he>=Lt&&he!==Lt;he--){let se=(he!==Ie?Math.abs(St[he]):0)+(he!==Lt+1?Math.abs(St[he-1]):0);if(Math.abs(Kt[he])<=on*se){Kt[he]=0;break}}he===Lt?ee=3:he===Ie-1?ee=1:(ee=2,Lt=he)}switch(Lt++,ee){case 1:{let he=St[Ie-2];St[Ie-2]=0;for(let se=Ie-2;se>=Lt;se--){let Jn=Yi(Kt[se],he),Qn=Kt[se]/Jn,Zn=he/Jn;if(Kt[se]=Jn,se!==Lt&&(he=-Zn*St[se-1],St[se-1]=Qn*St[se-1]),ht)for(let qn=0;qn=Kt[Lt+1]);){let he=Kt[Lt];if(Kt[Lt]=Kt[Lt+1],Kt[Lt+1]=he,ht&&LtS&&R.set(kt,Bt,x.get(kt,Bt)/this.s[Bt]);let st=this.U,ot=st.rows,ut=st.columns,ht=new pe(y,ot);for(let kt=0;ktx&&S++;return S}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return pe.diag(this.s)}}function zo(q,x=!1){return q=or.checkMatrix(q),x?new Ka(q).inverse():UA(q,pe.eye(q.rows))}function UA(q,x,S=!1){return q=or.checkMatrix(q),x=or.checkMatrix(x),S?new Ka(q).solve(x):q.isSquare()?new ji(q).solve(x):new lo(q).solve(x)}function Ns(q){if(q=pe.checkMatrix(q),q.isSquare()){if(q.columns===0)return 1;let x,S,y,T;if(q.columns===2)return x=q.get(0,0),S=q.get(0,1),y=q.get(1,0),T=q.get(1,1),x*T-S*y;if(q.columns===3){let R,st,ot;return R=new ya(q,[1,2],[1,2]),st=new ya(q,[1,2],[0,2]),ot=new ya(q,[1,2],[0,1]),x=q.get(0,0),S=q.get(0,1),y=q.get(0,2),x*Ns(R)-S*Ns(st)+y*Ns(ot)}else return new ji(q).determinant}else throw Error("determinant can only be calculated for a square matrix")}function PA(q,x){let S=[];for(let y=0;yT)return new Array(x.rows+1).fill(0);{let R=x.addRow(S,[0]);for(let st=0;stx?R[st]=1/R[st]:R[st]=0;return T.mmul(pe.diag(R).mmul(y.transpose()))}function Wh(q,x=q,S={}){q=new pe(q);let y=!1;if(typeof x=="object"&&!pe.isMatrix(x)&&!ft.isAnyArray(x)?(S=x,x=q,y=!0):x=new pe(x),q.rows!==x.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:T=!0}=S;T&&(q=q.center("column"),y||(x=x.center("column")));const R=q.transpose().mmul(x);for(let st=0;st0?T.set(R,R+1,S[R]):S[R]<0&&T.set(R,R-1,S[R])}return T}}function DA(q,x,S,y){let T,R,st,ot,ut,ht,kt,Bt;for(ut=0;ut0;ot--){for(Bt=0,st=0,ht=0;ht0&&(R=-R),x[ot]=Bt*R,st=st-T*R,S[ot-1]=T-R,ut=0;utht)do{for(T=S[ht],Bt=(S[ht+1]-T)/(2*x[ht]),jt=Yi(Bt,1),Bt<0&&(jt=-jt),S[ht]=x[ht]/(Bt+jt),S[ht+1]=x[ht]*(Bt+jt),ce=S[ht+1],R=T-S[ht],st=ht+2;st=ht;st--)for(Ce=$t,$t=Kt,Ee=te,T=Kt*x[st],R=Kt*Bt,jt=Yi(Bt,x[st]),x[st+1]=te*jt,te=x[st]/jt,Kt=Bt/jt,Bt=Kt*S[st]-te*T,S[st+1]=R+te*(Kt*T+te*S[st]),ut=0;utWn*je);S[ht]=S[ht]+He,x[ht]=0}for(st=0;st=Bt;ht--)S[ht]=x.get(ht,Bt-1)/jt,ut+=S[ht]*S[ht];for(ot=Math.sqrt(ut),S[Bt]>0&&(ot=-ot),ut=ut-S[Bt]*ot,S[Bt]=S[Bt]-ot,kt=Bt;kt=Bt;ht--)st+=S[ht]*x.get(ht,kt);for(st=st/ut,ht=Bt;ht<=R;ht++)x.set(ht,kt,x.get(ht,kt)-st*S[ht])}for(ht=0;ht<=R;ht++){for(st=0,kt=R;kt>=Bt;kt--)st+=S[kt]*x.get(ht,kt);for(st=st/ut,kt=Bt;kt<=R;kt++)x.set(ht,kt,x.get(ht,kt)-st*S[kt])}S[Bt]=jt*S[Bt],x.set(Bt,Bt-1,jt*ot)}}for(ht=0;ht=T+1;Bt--)if(x.get(Bt,Bt-1)!==0){for(ht=Bt+1;ht<=R;ht++)S[ht]=x.get(ht,Bt-1);for(kt=Bt;kt<=R;kt++){for(ot=0,ht=Bt;ht<=R;ht++)ot+=S[ht]*y.get(ht,kt);for(ot=ot/S[Bt]/x.get(Bt,Bt-1),ht=Bt;ht<=R;ht++)y.set(ht,kt,y.get(ht,kt)+ot*S[ht])}}}function RA(q,x,S,y,T){let R=q-1,st=0,ot=q-1,ut=Number.EPSILON,ht=0,kt=0,Bt=0,jt=0,ce=0,Kt=0,$t=0,Ce=0,St,te,Ee,He,je,Wn,Ie,De,on,Lt,ee,he,se,Jn,Qn;for(St=0;Stot)&&(S[St]=T.get(St,St),x[St]=0),te=Math.max(St-1,0);te=st;){for(He=R;He>st&&(Kt=Math.abs(T.get(He-1,He-1))+Math.abs(T.get(He,He)),Kt===0&&(Kt=kt),!(Math.abs(T.get(He,He-1))=0){for($t=Bt>=0?Bt+$t:Bt-$t,S[R-1]=De+$t,S[R]=S[R-1],$t!==0&&(S[R]=De-Ie/$t),x[R-1]=0,x[R]=0,De=T.get(R,R-1),Kt=Math.abs(De)+Math.abs($t),Bt=De/Kt,jt=$t/Kt,ce=Math.sqrt(Bt*Bt+jt*jt),Bt=Bt/ce,jt=jt/ce,te=R-1;te0)){for(Kt=Math.sqrt(Kt),on=He&&($t=T.get(je,je),ce=De-$t,Kt=on-$t,Bt=(ce*Kt-Ie)/T.get(je+1,je)+T.get(je,je+1),jt=T.get(je+1,je+1)-$t-ce-Kt,ce=T.get(je+2,je+1),Kt=Math.abs(Bt)+Math.abs(jt)+Math.abs(ce),Bt=Bt/Kt,jt=jt/Kt,ce=ce/Kt,!(je===He||Math.abs(T.get(je,je-1))*(Math.abs(jt)+Math.abs(ce))je+2&&T.set(St,St-3,0);for(Ee=je;Ee<=R-1&&(Jn=Ee!==R-1,Ee!==je&&(Bt=T.get(Ee,Ee-1),jt=T.get(Ee+1,Ee-1),ce=Jn?T.get(Ee+2,Ee-1):0,De=Math.abs(Bt)+Math.abs(jt)+Math.abs(ce),De!==0&&(Bt=Bt/De,jt=jt/De,ce=ce/De)),De!==0);Ee++)if(Kt=Math.sqrt(Bt*Bt+jt*jt+ce*ce),Bt<0&&(Kt=-Kt),Kt!==0){for(Ee!==je?T.set(Ee,Ee-1,-Kt*De):He!==je&&T.set(Ee,Ee-1,-T.get(Ee,Ee-1)),Bt=Bt+Kt,De=Bt/Kt,on=jt/Kt,$t=ce/Kt,jt=jt/Bt,ce=ce/Bt,te=Ee;te=0;R--)if(Bt=S[R],jt=x[R],jt===0)for(He=R,T.set(R,R,1),St=R-1;St>=0;St--){for(Ie=T.get(St,St)-Bt,ce=0,te=He;te<=R;te++)ce=ce+T.get(St,te)*T.get(te,R);if(x[St]<0)$t=Ie,Kt=ce;else if(He=St,x[St]===0?T.set(St,R,Ie!==0?-ce/Ie:-ce/(ut*kt)):(De=T.get(St,St+1),on=T.get(St+1,St),jt=(S[St]-Bt)*(S[St]-Bt)+x[St]*x[St],Wn=(De*Kt-$t*ce)/jt,T.set(St,R,Wn),T.set(St+1,R,Math.abs(De)>Math.abs($t)?(-ce-Ie*Wn)/De:(-Kt-on*Wn)/$t)),Wn=Math.abs(T.get(St,R)),ut*Wn*Wn>1)for(te=St;te<=R;te++)T.set(te,R,T.get(te,R)/Wn)}else if(jt<0)for(He=R-1,Math.abs(T.get(R,R-1))>Math.abs(T.get(R-1,R))?(T.set(R-1,R-1,jt/T.get(R,R-1)),T.set(R-1,R,-(T.get(R,R)-Bt)/T.get(R,R-1))):(Qn=Vo(0,-T.get(R-1,R),T.get(R-1,R-1)-Bt,jt),T.set(R-1,R-1,Qn[0]),T.set(R-1,R,Qn[1])),T.set(R,R-1,0),T.set(R,R,1),St=R-2;St>=0;St--){for(Lt=0,ee=0,te=He;te<=R;te++)Lt=Lt+T.get(St,te)*T.get(te,R-1),ee=ee+T.get(St,te)*T.get(te,R);if(Ie=T.get(St,St)-Bt,x[St]<0)$t=Ie,ce=Lt,Kt=ee;else if(He=St,x[St]===0?(Qn=Vo(-Lt,-ee,Ie,jt),T.set(St,R-1,Qn[0]),T.set(St,R,Qn[1])):(De=T.get(St,St+1),on=T.get(St+1,St),he=(S[St]-Bt)*(S[St]-Bt)+x[St]*x[St]-jt*jt,se=(S[St]-Bt)*2*jt,he===0&&se===0&&(he=ut*kt*(Math.abs(Ie)+Math.abs(jt)+Math.abs(De)+Math.abs(on)+Math.abs($t))),Qn=Vo(De*ce-$t*Lt+jt*ee,De*Kt-$t*ee-jt*Lt,he,se),T.set(St,R-1,Qn[0]),T.set(St,R,Qn[1]),Math.abs(De)>Math.abs($t)+Math.abs(jt)?(T.set(St+1,R-1,(-Lt-Ie*T.get(St,R-1)+jt*T.get(St,R))/De),T.set(St+1,R,(-ee-Ie*T.get(St,R)-jt*T.get(St,R-1))/De)):(Qn=Vo(-ce-on*T.get(St,R-1),-Kt-on*T.get(St,R),$t,jt),T.set(St+1,R-1,Qn[0]),T.set(St+1,R,Qn[1]))),Wn=Math.max(Math.abs(T.get(St,R-1)),Math.abs(T.get(St,R))),ut*Wn*Wn>1)for(te=St;te<=R;te++)T.set(te,R-1,T.get(te,R-1)/Wn),T.set(te,R,T.get(te,R)/Wn)}for(St=0;Stot)for(te=St;te=st;te--)for(St=st;St<=ot;St++){for($t=0,Ee=st;Ee<=Math.min(te,ot);Ee++)$t=$t+y.get(St,Ee)*T.get(Ee,te);y.set(St,te,$t)}}}function Vo(q,x,S,y){let T,R;return Math.abs(S)>Math.abs(y)?(T=y/S,R=S+T*y,[(q+T*x)/R,(x-T*q)/R]):(T=S/y,R=y+T*S,[(T*q+x)/R,(T*x-q)/R])}class Kl{constructor(x){if(x=or.checkMatrix(x),!x.isSymmetric())throw new Error("Matrix is not symmetric");let S=x,y=S.rows,T=new pe(y,y),R=!0,st,ot,ut;for(ot=0;ot0),T.set(ot,ot,Math.sqrt(Math.max(ht,0))),ut=ot+1;ut=0;ut--)for(ot=0;otst;ce++)Bt=x.transpose().mmul(ot).div(ot.transpose().mmul(ot).get(0,0)),Bt=Bt.div(Bt.norm()),ht=x.mmul(Bt).div(Bt.transpose().mmul(Bt).get(0,0)),ce>0&&(ut=ht.clone().sub(jt).pow(2).sum()),jt=ht.clone(),y?(kt=y.transpose().mmul(ht).div(ht.transpose().mmul(ht).get(0,0)),kt=kt.div(kt.norm()),ot=y.mmul(kt).div(kt.transpose().mmul(kt).get(0,0))):ot=ht;if(y){let ce=x.transpose().mmul(ht).div(ht.transpose().mmul(ht).get(0,0));ce=ce.div(ce.norm());let Kt=x.clone().sub(ht.clone().mmul(ce.transpose())),$t=ot.transpose().mmul(ht).div(ht.transpose().mmul(ht).get(0,0)),Ce=y.clone().sub(ht.clone().mulS($t.get(0,0)).mmul(kt.transpose()));this.t=ht,this.p=ce.transpose(),this.w=Bt.transpose(),this.q=kt,this.u=ot,this.s=ht.transpose().mmul(ht),this.xResidual=Kt,this.yResidual=Ce,this.betas=$t}else this.w=Bt.transpose(),this.s=ht.transpose().mmul(ht).sqrt(),T?this.t=ht.clone().div(this.s.get(0,0)):this.t=ht,this.xResidual=x.sub(ht.mmul(Bt.transpose()))}}et.XA=me,et.a_=Kl,et.yQ=Kl,et.Hs=Mr,et.Ec=pn,et.dx=pn,et.LU=ji,et.Rm=ji,et.y3=pe,et.qK=Zi,et.pb=as,et.j=ss,et.sO=Ii,et.BZ=ma,et.EK=Jr,et.Db=ya,et.Fx=aa,et.tU=wa,et.Ym=zl,et.rs=zl,et.QR=lo,et.TB=lo,et.oH=Ka,et.Sc=Ka,et.BN=Nr,et.it=qr,et.$r=or,et.QM=Hl,et.AV=Wh,O=pe,et.GH=Ns,et.SO=zo,et.uZ=iu,et.yU=Vh,et.F1=UA,et.re=Ko},45411:function(X){"use strict";X.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},75196:function(X,et,M){var O=M(45411),W=M(81683),H=Object.hasOwnProperty,L=Object.create(null);for(var I in O)H.call(O,I)&&(L[O[I]]=I);var N=X.exports={to:{},get:{}};N.get=function(U){var Z=U.substring(0,3).toLowerCase(),V,Y;switch(Z){case"hsl":V=N.get.hsl(U),Y="hsl";break;case"hwb":V=N.get.hwb(U),Y="hwb";break;default:V=N.get.rgb(U),Y="rgb";break}return V?{model:Y,value:V}:null},N.get.rgb=function(U){if(!U)return null;var Z=/^#([a-f0-9]{3,4})$/i,V=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,Y=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,nt=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,rt=/^(\w+)$/,ft=[0,0,0,1],ct,it,vt;if(ct=U.match(V)){for(vt=ct[2],ct=ct[1],it=0;it<3;it++){var gt=it*2;ft[it]=parseInt(ct.slice(gt,gt+2),16)}vt&&(ft[3]=parseInt(vt,16)/255)}else if(ct=U.match(Z)){for(ct=ct[1],vt=ct[3],it=0;it<3;it++)ft[it]=parseInt(ct[it]+ct[it],16);vt&&(ft[3]=parseInt(vt+vt,16)/255)}else if(ct=U.match(Y)){for(it=0;it<3;it++)ft[it]=parseInt(ct[it+1],0);ct[4]&&(ct[5]?ft[3]=parseFloat(ct[4])*.01:ft[3]=parseFloat(ct[4]))}else if(ct=U.match(nt)){for(it=0;it<3;it++)ft[it]=Math.round(parseFloat(ct[it+1])*2.55);ct[4]&&(ct[5]?ft[3]=parseFloat(ct[4])*.01:ft[3]=parseFloat(ct[4]))}else return(ct=U.match(rt))?ct[1]==="transparent"?[0,0,0,0]:H.call(O,ct[1])?(ft=O[ct[1]],ft[3]=1,ft):null:null;for(it=0;it<3;it++)ft[it]=P(ft[it],0,255);return ft[3]=P(ft[3],0,1),ft},N.get.hsl=function(U){if(!U)return null;var Z=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,V=U.match(Z);if(V){var Y=parseFloat(V[4]),nt=(parseFloat(V[1])%360+360)%360,rt=P(parseFloat(V[2]),0,100),ft=P(parseFloat(V[3]),0,100),ct=P(isNaN(Y)?1:Y,0,1);return[nt,rt,ft,ct]}return null},N.get.hwb=function(U){if(!U)return null;var Z=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,V=U.match(Z);if(V){var Y=parseFloat(V[4]),nt=(parseFloat(V[1])%360+360)%360,rt=P(parseFloat(V[2]),0,100),ft=P(parseFloat(V[3]),0,100),ct=P(isNaN(Y)?1:Y,0,1);return[nt,rt,ft,ct]}return null},N.to.hex=function(){var U=W(arguments);return"#"+k(U[0])+k(U[1])+k(U[2])+(U[3]<1?k(Math.round(U[3]*255)):"")},N.to.rgb=function(){var U=W(arguments);return U.length<4||U[3]===1?"rgb("+Math.round(U[0])+", "+Math.round(U[1])+", "+Math.round(U[2])+")":"rgba("+Math.round(U[0])+", "+Math.round(U[1])+", "+Math.round(U[2])+", "+U[3]+")"},N.to.rgb.percent=function(){var U=W(arguments),Z=Math.round(U[0]/255*100),V=Math.round(U[1]/255*100),Y=Math.round(U[2]/255*100);return U.length<4||U[3]===1?"rgb("+Z+"%, "+V+"%, "+Y+"%)":"rgba("+Z+"%, "+V+"%, "+Y+"%, "+U[3]+")"},N.to.hsl=function(){var U=W(arguments);return U.length<4||U[3]===1?"hsl("+U[0]+", "+U[1]+"%, "+U[2]+"%)":"hsla("+U[0]+", "+U[1]+"%, "+U[2]+"%, "+U[3]+")"},N.to.hwb=function(){var U=W(arguments),Z="";return U.length>=4&&U[3]!==1&&(Z=", "+U[3]),"hwb("+U[0]+", "+U[1]+"%, "+U[2]+"%"+Z+")"},N.to.keyword=function(U){return L[U.slice(0,3)]};function P(U,Z,V){return Math.min(Math.max(Z,U),V)}function k(U){var Z=Math.round(U).toString(16).toUpperCase();return Z.length<2?"0"+Z:Z}},92546:function(X,et,M){X.exports={graphlib:M(76626),layout:M(47194),debug:M(11303),util:{time:M(53063).time,notime:M(53063).notime},version:M(11897)}},81255:function(X,et,M){"use strict";var O=M(72361),W=M(39240);X.exports={run:H,undo:I};function H(N){var P=N.graph().acyclicer==="greedy"?W(N,k(N)):L(N);O.forEach(P,function(U){var Z=N.edge(U);N.removeEdge(U),Z.forwardName=U.name,Z.reversed=!0,N.setEdge(U.w,U.v,Z,O.uniqueId("rev"))});function k(U){return function(Z){return U.edge(Z).weight}}}function L(N){var P=[],k={},U={};function Z(V){O.has(U,V)||(U[V]=!0,k[V]=!0,O.forEach(N.outEdges(V),function(Y){O.has(k,Y.w)?P.push(Y):Z(Y.w)}),delete k[V])}return O.forEach(N.nodes(),Z),P}function I(N){O.forEach(N.edges(),function(P){var k=N.edge(P);if(k.reversed){N.removeEdge(P);var U=k.forwardName;delete k.reversed,delete k.forwardName,N.setEdge(P.w,P.v,k,U)}})}},60765:function(X,et,M){var O=M(72361),W=M(53063);X.exports=H;function H(I){function N(P){var k=I.children(P),U=I.node(P);if(k.length&&O.forEach(k,N),O.has(U,"minRank")){U.borderLeft=[],U.borderRight=[];for(var Z=U.minRank,V=U.maxRank+1;Z0;--it)if(ct=V[it].dequeue(),ct){nt=nt.concat(P(Z,V,Y,ct,!0));break}}}return nt}function P(Z,V,Y,nt,rt){var ft=rt?[]:void 0;return O.forEach(Z.inEdges(nt.v),function(ct){var it=Z.edge(ct),vt=Z.node(ct.v);rt&&ft.push({v:ct.v,w:ct.w}),vt.out-=it,U(V,Y,vt)}),O.forEach(Z.outEdges(nt.v),function(ct){var it=Z.edge(ct),vt=ct.w,gt=Z.node(vt);gt.in-=it,U(V,Y,gt)}),Z.removeNode(nt.v),ft}function k(Z,V){var Y=new W,nt=0,rt=0;O.forEach(Z.nodes(),function(it){Y.setNode(it,{v:it,in:0,out:0})}),O.forEach(Z.edges(),function(it){var vt=Y.edge(it.v,it.w)||0,gt=V(it),yt=vt+gt;Y.setEdge(it.v,it.w,yt),rt=Math.max(rt,Y.node(it.v).out+=gt),nt=Math.max(nt,Y.node(it.w).in+=gt)});var ft=O.range(rt+nt+3).map(function(){return new H}),ct=nt+1;return O.forEach(Y.nodes(),function(it){U(ft,ct,Y.node(it))}),{graph:Y,buckets:ft,zeroIdx:ct}}function U(Z,V,Y){Y.out?Y.in?Z[Y.out-Y.in+V].enqueue(Y):Z[Z.length-1].enqueue(Y):Z[0].enqueue(Y)}},47194:function(X,et,M){"use strict";var O=M(72361),W=M(81255),H=M(27163),L=M(64505),I=M(53063).normalizeRanks,N=M(71970),P=M(53063).removeEmptyRanks,k=M(31733),U=M(60765),Z=M(13257),V=M(62852),Y=M(93021),nt=M(53063),rt=M(76626).Graph;X.exports=ft;function ft(Et,It){var Ut=It&&It.debugTiming?nt.time:nt.notime;Ut("layout",function(){var ne=Ut(" buildLayoutGraph",function(){return Gt(Et)});Ut(" runLayout",function(){ct(ne,Ut)}),Ut(" updateInputGraph",function(){it(Et,ne)})})}function ct(Et,It){It(" makeSpaceForEdgeLabels",function(){re(Et)}),It(" removeSelfEdges",function(){is(Et)}),It(" acyclic",function(){W.run(Et)}),It(" nestingGraph.run",function(){k.run(Et)}),It(" rank",function(){L(nt.asNonCompoundGraph(Et))}),It(" injectEdgeLabelProxies",function(){de(Et)}),It(" removeEmptyRanks",function(){P(Et)}),It(" nestingGraph.cleanup",function(){k.cleanup(Et)}),It(" normalizeRanks",function(){I(Et)}),It(" assignRankMinMax",function(){ue(Et)}),It(" removeEdgeLabelProxies",function(){Me(Et)}),It(" normalize.run",function(){H.run(Et)}),It(" parentDummyChains",function(){N(Et)}),It(" addBorderSegments",function(){U(Et)}),It(" order",function(){V(Et)}),It(" insertSelfEdges",function(){Ao(Et)}),It(" adjustCoordinateSystem",function(){Z.adjust(Et)}),It(" position",function(){Y(Et)}),It(" positionSelfEdges",function(){Ht(Et)}),It(" removeBorderNodes",function(){Vi(Et)}),It(" normalize.undo",function(){H.undo(Et)}),It(" fixupEdgeLabelCoords",function(){Xn(Et)}),It(" undoCoordinateSystem",function(){Z.undo(Et)}),It(" translateGraph",function(){Ve(Et)}),It(" assignNodeIntersects",function(){dn(Et)}),It(" reversePoints",function(){Xr(Et)}),It(" acyclic.undo",function(){W.undo(Et)})}function it(Et,It){O.forEach(Et.nodes(),function(Ut){var ne=Et.node(Ut),be=It.node(Ut);ne&&(ne.x=be.x,ne.y=be.y,It.children(Ut).length&&(ne.width=be.width,ne.height=be.height))}),O.forEach(Et.edges(),function(Ut){var ne=Et.edge(Ut),be=It.edge(Ut);ne.points=be.points,O.has(be,"x")&&(ne.x=be.x,ne.y=be.y)}),Et.graph().width=It.graph().width,Et.graph().height=It.graph().height}var vt=["nodesep","edgesep","ranksep","marginx","marginy"],gt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},yt=["acyclicer","ranker","rankdir","align"],mt=["width","height"],Mt={width:0,height:0},Ct=["minlen","weight","width","height","labeloffset"],Nt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},qt=["labelpos"];function Gt(Et){var It=new rt({multigraph:!0,compound:!0}),Ut=Zt(Et.graph());return It.setGraph(O.merge({},gt,zt(Ut,vt),O.pick(Ut,yt))),O.forEach(Et.nodes(),function(ne){var be=Zt(Et.node(ne));It.setNode(ne,O.defaults(zt(be,mt),Mt)),It.setParent(ne,Et.parent(ne))}),O.forEach(Et.edges(),function(ne){var be=Zt(Et.edge(ne));It.setEdge(ne,O.merge({},Nt,zt(be,Ct),O.pick(be,qt)))}),It}function re(Et){var It=Et.graph();It.ranksep/=2,O.forEach(Et.edges(),function(Ut){var ne=Et.edge(Ut);ne.minlen*=2,ne.labelpos.toLowerCase()!=="c"&&(It.rankdir==="TB"||It.rankdir==="BT"?ne.width+=ne.labeloffset:ne.height+=ne.labeloffset)})}function de(Et){O.forEach(Et.edges(),function(It){var Ut=Et.edge(It);if(Ut.width&&Ut.height){var ne=Et.node(It.v),be=Et.node(It.w),_e={rank:(be.rank-ne.rank)/2+ne.rank,e:It};nt.addDummyNode(Et,"edge-proxy",_e,"_ep")}})}function ue(Et){var It=0;O.forEach(Et.nodes(),function(Ut){var ne=Et.node(Ut);ne.borderTop&&(ne.minRank=Et.node(ne.borderTop).rank,ne.maxRank=Et.node(ne.borderBottom).rank,It=O.max(It,ne.maxRank))}),Et.graph().maxRank=It}function Me(Et){O.forEach(Et.nodes(),function(It){var Ut=Et.node(It);Ut.dummy==="edge-proxy"&&(Et.edge(Ut.e).labelRank=Ut.rank,Et.removeNode(It))})}function Ve(Et){var It=Number.POSITIVE_INFINITY,Ut=0,ne=Number.POSITIVE_INFINITY,be=0,_e=Et.graph(),Te=_e.marginx||0,rn=_e.marginy||0;function rr(sr){var Ge=sr.x,Ke=sr.y,me=sr.width,We=sr.height;It=Math.min(It,Ge-me/2),Ut=Math.max(Ut,Ge+me/2),ne=Math.min(ne,Ke-We/2),be=Math.max(be,Ke+We/2)}O.forEach(Et.nodes(),function(sr){rr(Et.node(sr))}),O.forEach(Et.edges(),function(sr){var Ge=Et.edge(sr);O.has(Ge,"x")&&rr(Ge)}),It-=Te,ne-=rn,O.forEach(Et.nodes(),function(sr){var Ge=Et.node(sr);Ge.x-=It,Ge.y-=ne}),O.forEach(Et.edges(),function(sr){var Ge=Et.edge(sr);O.forEach(Ge.points,function(Ke){Ke.x-=It,Ke.y-=ne}),O.has(Ge,"x")&&(Ge.x-=It),O.has(Ge,"y")&&(Ge.y-=ne)}),_e.width=Ut-It+Te,_e.height=be-ne+rn}function dn(Et){O.forEach(Et.edges(),function(It){var Ut=Et.edge(It),ne=Et.node(It.v),be=Et.node(It.w),_e,Te;Ut.points?(_e=Ut.points[0],Te=Ut.points[Ut.points.length-1]):(Ut.points=[],_e=be,Te=ne),Ut.points.unshift(nt.intersectRect(ne,_e)),Ut.points.push(nt.intersectRect(be,Te))})}function Xn(Et){O.forEach(Et.edges(),function(It){var Ut=Et.edge(It);if(O.has(Ut,"x"))switch((Ut.labelpos==="l"||Ut.labelpos==="r")&&(Ut.width-=Ut.labeloffset),Ut.labelpos){case"l":Ut.x-=Ut.width/2+Ut.labeloffset;break;case"r":Ut.x+=Ut.width/2+Ut.labeloffset;break}})}function Xr(Et){O.forEach(Et.edges(),function(It){var Ut=Et.edge(It);Ut.reversed&&Ut.points.reverse()})}function Vi(Et){O.forEach(Et.nodes(),function(It){if(Et.children(It).length){var Ut=Et.node(It),ne=Et.node(Ut.borderTop),be=Et.node(Ut.borderBottom),_e=Et.node(O.last(Ut.borderLeft)),Te=Et.node(O.last(Ut.borderRight));Ut.width=Math.abs(Te.x-_e.x),Ut.height=Math.abs(be.y-ne.y),Ut.x=_e.x+Ut.width/2,Ut.y=ne.y+Ut.height/2}}),O.forEach(Et.nodes(),function(It){Et.node(It).dummy==="border"&&Et.removeNode(It)})}function is(Et){O.forEach(Et.edges(),function(It){if(It.v===It.w){var Ut=Et.node(It.v);Ut.selfEdges||(Ut.selfEdges=[]),Ut.selfEdges.push({e:It,label:Et.edge(It)}),Et.removeEdge(It)}})}function Ao(Et){var It=nt.buildLayerMatrix(Et);O.forEach(It,function(Ut){var ne=0;O.forEach(Ut,function(be,_e){var Te=Et.node(be);Te.order=_e+ne,O.forEach(Te.selfEdges,function(rn){nt.addDummyNode(Et,"selfedge",{width:rn.label.width,height:rn.label.height,rank:Te.rank,order:_e+ ++ne,e:rn.e,label:rn.label},"_se")}),delete Te.selfEdges})})}function Ht(Et){O.forEach(Et.nodes(),function(It){var Ut=Et.node(It);if(Ut.dummy==="selfedge"){var ne=Et.node(Ut.e.v),be=ne.x+ne.width/2,_e=ne.y,Te=Ut.x-be,rn=ne.height/2;Et.setEdge(Ut.e,Ut.label),Et.removeNode(It),Ut.label.points=[{x:be+2*Te/3,y:_e-rn},{x:be+5*Te/6,y:_e-rn},{x:be+Te,y:_e},{x:be+5*Te/6,y:_e+rn},{x:be+2*Te/3,y:_e+rn}],Ut.label.x=Ut.x,Ut.label.y=Ut.y}})}function zt(Et,It){return O.mapValues(O.pick(Et,It),Number)}function Zt(Et){var It={};return O.forEach(Et,function(Ut,ne){It[ne.toLowerCase()]=Ut}),It}},72361:function(X,et,M){var O;try{O={cloneDeep:M(20250),constant:M(13503),defaults:M(28548),each:M(76934),filter:M(64725),find:M(79785),flatten:M(40151),forEach:M(99204),forIn:M(23190),has:M(99946),isUndefined:M(16513),last:M(10611),map:M(9924),mapValues:M(70642),max:M(95987),merge:M(28440),min:M(73376),minBy:M(83296),now:M(5795),pick:M(89409),range:M(60859),reduce:M(16473),sortBy:M(351),uniqueId:M(95708),values:M(81229),zipObject:M(65441)}}catch(W){}O||(O=window._),X.exports=O},31733:function(X,et,M){var O=M(72361),W=M(53063);X.exports={run:H,cleanup:P};function H(k){var U=W.addDummyNode(k,"root",{},"_root"),Z=I(k),V=O.max(O.values(Z))-1,Y=2*V+1;k.graph().nestingRoot=U,O.forEach(k.edges(),function(rt){k.edge(rt).minlen*=Y});var nt=N(k)+1;O.forEach(k.children(),function(rt){L(k,U,Y,nt,V,Z,rt)}),k.graph().nodeRankFactor=Y}function L(k,U,Z,V,Y,nt,rt){var ft=k.children(rt);if(!ft.length){rt!==U&&k.setEdge(U,rt,{weight:0,minlen:Z});return}var ct=W.addBorderNode(k,"_bt"),it=W.addBorderNode(k,"_bb"),vt=k.node(rt);k.setParent(ct,rt),vt.borderTop=ct,k.setParent(it,rt),vt.borderBottom=it,O.forEach(ft,function(gt){L(k,U,Z,V,Y,nt,gt);var yt=k.node(gt),mt=yt.borderTop?yt.borderTop:gt,Mt=yt.borderBottom?yt.borderBottom:gt,Ct=yt.borderTop?V:2*V,Nt=mt!==Mt?1:Y-nt[rt]+1;k.setEdge(ct,mt,{weight:Ct,minlen:Nt,nestingEdge:!0}),k.setEdge(Mt,it,{weight:Ct,minlen:Nt,nestingEdge:!0})}),k.parent(rt)||k.setEdge(U,ct,{weight:0,minlen:Y+nt[rt]})}function I(k){var U={};function Z(V,Y){var nt=k.children(V);nt&&nt.length&&O.forEach(nt,function(rt){Z(rt,Y+1)}),U[V]=Y}return O.forEach(k.children(),function(V){Z(V,1)}),U}function N(k){return O.reduce(k.edges(),function(U,Z){return U+k.edge(Z).weight},0)}function P(k){var U=k.graph();k.removeNode(U.nestingRoot),delete U.nestingRoot,O.forEach(k.edges(),function(Z){var V=k.edge(Z);V.nestingEdge&&k.removeEdge(Z)})}},27163:function(X,et,M){"use strict";var O=M(72361),W=M(53063);X.exports={run:H,undo:I};function H(N){N.graph().dummyChains=[],O.forEach(N.edges(),function(P){L(N,P)})}function L(N,P){var k=P.v,U=N.node(k).rank,Z=P.w,V=N.node(Z).rank,Y=P.name,nt=N.edge(P),rt=nt.labelRank;if(V!==U+1){N.removeEdge(P);var ft,ct,it;for(it=0,++U;U0;)rt%2&&(ft+=V[rt+1]),rt=rt-1>>1,V[rt]+=nt.weight;Y+=nt.weight*ft})),Y}},62852:function(X,et,M){"use strict";var O=M(72361),W=M(18043),H=M(45456),L=M(86490),I=M(59105),N=M(52205),P=M(76626).Graph,k=M(53063);X.exports=U;function U(nt){var rt=k.maxRank(nt),ft=Z(nt,O.range(1,rt+1),"inEdges"),ct=Z(nt,O.range(rt-1,-1,-1),"outEdges"),it=W(nt);Y(nt,it);for(var vt=Number.POSITIVE_INFINITY,gt,yt=0,mt=0;mt<4;++yt,++mt){V(yt%2?ft:ct,yt%4>=2),it=k.buildLayerMatrix(nt);var Mt=H(nt,it);Mt=Z.barycenter)&&L(Z,V)}}function k(Z){return function(V){V.in.push(Z),--V.indegree===0&&I.push(V)}}for(;I.length;){var U=I.pop();N.push(U),O.forEach(U.in.reverse(),P(U)),O.forEach(U.out,k(U))}return O.map(O.filter(N,function(Z){return!Z.merged}),function(Z){return O.pick(Z,["vs","i","barycenter","weight"])})}function L(I,N){var P=0,k=0;I.weight&&(P+=I.barycenter*I.weight,k+=I.weight),N.weight&&(P+=N.barycenter*N.weight,k+=N.weight),I.vs=N.vs.concat(I.vs),I.barycenter=P/k,I.weight=k,I.i=Math.min(N.i,I.i),N.merged=!0}},86490:function(X,et,M){var O=M(72361),W=M(99506),H=M(45926),L=M(1349);X.exports=I;function I(k,U,Z,V){var Y=k.children(U),nt=k.node(U),rt=nt?nt.borderLeft:void 0,ft=nt?nt.borderRight:void 0,ct={};rt&&(Y=O.filter(Y,function(Mt){return Mt!==rt&&Mt!==ft}));var it=W(k,Y);O.forEach(it,function(Mt){if(k.children(Mt.v).length){var Ct=I(k,Mt.v,Z,V);ct[Mt.v]=Ct,O.has(Ct,"barycenter")&&P(Mt,Ct)}});var vt=H(it,Z);N(vt,ct);var gt=L(vt,V);if(rt&&(gt.vs=O.flatten([rt,gt.vs,ft],!0),k.predecessors(rt).length)){var yt=k.node(k.predecessors(rt)[0]),mt=k.node(k.predecessors(ft)[0]);O.has(gt,"barycenter")||(gt.barycenter=0,gt.weight=0),gt.barycenter=(gt.barycenter*gt.weight+yt.order+mt.order)/(gt.weight+2),gt.weight+=2}return gt}function N(k,U){O.forEach(k,function(Z){Z.vs=O.flatten(Z.vs.map(function(V){return U[V]?U[V].vs:V}),!0)})}function P(k,U){O.isUndefined(k.barycenter)?(k.barycenter=U.barycenter,k.weight=U.weight):(k.barycenter=(k.barycenter*k.weight+U.barycenter*U.weight)/(k.weight+U.weight),k.weight+=U.weight)}},1349:function(X,et,M){var O=M(72361),W=M(53063);X.exports=H;function H(N,P){var k=W.partition(N,function(ct){return O.has(ct,"barycenter")}),U=k.lhs,Z=O.sortBy(k.rhs,function(ct){return-ct.i}),V=[],Y=0,nt=0,rt=0;U.sort(I(!!P)),rt=L(V,Z,rt),O.forEach(U,function(ct){rt+=ct.vs.length,V.push(ct.vs),Y+=ct.barycenter*ct.weight,nt+=ct.weight,rt=L(V,Z,rt)});var ft={vs:O.flatten(V,!0)};return nt&&(ft.barycenter=Y/nt,ft.weight=nt),ft}function L(N,P,k){for(var U;P.length&&(U=O.last(P)).i<=k;)P.pop(),N.push(U.vs),k++;return k}function I(N){return function(P,k){return P.barycenterk.barycenter?1:N?k.i-P.i:P.i-k.i}}},71970:function(X,et,M){var O=M(72361);X.exports=W;function W(I){var N=L(I);O.forEach(I.graph().dummyChains,function(P){for(var k=I.node(P),U=k.edgeObj,Z=H(I,N,U.v,U.w),V=Z.path,Y=Z.lca,nt=0,rt=V[nt],ft=!0;P!==U.w;){if(k=I.node(P),ft){for(;(rt=V[nt])!==Y&&I.node(rt).maxRankV||Y>N[nt].lim));for(rt=nt,nt=k;(nt=I.parent(nt))!==rt;)Z.push(nt);return{path:U.concat(Z.reverse()),lca:rt}}function L(I){var N={},P=0;function k(U){var Z=P;O.forEach(I.children(U),k),N[U]={low:Z,lim:P++}}return O.forEach(I.children(),k),N}},92080:function(X,et,M){"use strict";var O=M(72361),W=M(76626).Graph,H=M(53063);X.exports={positionX:ft,findType1Conflicts:L,findType2Conflicts:I,addConflict:P,hasConflict:k,verticalAlignment:U,horizontalCompaction:Z,alignCoordinates:nt,findSmallestWidthAlignment:Y,balance:rt};function L(vt,gt){var yt={};function mt(Mt,Ct){var Nt=0,qt=0,Gt=Mt.length,re=O.last(Ct);return O.forEach(Ct,function(de,ue){var Me=N(vt,de),Ve=Me?vt.node(Me).order:Gt;(Me||de===re)&&(O.forEach(Ct.slice(qt,ue+1),function(dn){O.forEach(vt.predecessors(dn),function(Xn){var Xr=vt.node(Xn),Vi=Xr.order;(Vire)&&P(yt,Me,de)})})}function Mt(Ct,Nt){var qt=-1,Gt,re=0;return O.forEach(Nt,function(de,ue){if(vt.node(de).dummy==="border"){var Me=vt.predecessors(de);Me.length&&(Gt=vt.node(Me[0]).order,mt(Nt,re,ue,qt,Gt),re=ue,qt=Gt)}mt(Nt,re,Nt.length,Gt,Ct.length)}),Nt}return O.reduce(gt,Mt),yt}function N(vt,gt){if(vt.node(gt).dummy)return O.find(vt.predecessors(gt),function(yt){return vt.node(yt).dummy})}function P(vt,gt,yt){if(gt>yt){var mt=gt;gt=yt,yt=mt}var Mt=vt[gt];Mt||(vt[gt]=Mt={}),Mt[yt]=!0}function k(vt,gt,yt){if(gt>yt){var mt=gt;gt=yt,yt=mt}return O.has(vt[gt],yt)}function U(vt,gt,yt,mt){var Mt={},Ct={},Nt={};return O.forEach(gt,function(qt){O.forEach(qt,function(Gt,re){Mt[Gt]=Gt,Ct[Gt]=Gt,Nt[Gt]=re})}),O.forEach(gt,function(qt){var Gt=-1;O.forEach(qt,function(re){var de=mt(re);if(de.length){de=O.sortBy(de,function(Xn){return Nt[Xn]});for(var ue=(de.length-1)/2,Me=Math.floor(ue),Ve=Math.ceil(ue);Me<=Ve;++Me){var dn=de[Me];Ct[re]===re&&GtGt.lim&&(re=Gt,de=!0);var ue=O.filter(mt.edges(),function(Me){return de===gt(yt,yt.node(Me.v),re)&&de!==gt(yt,yt.node(Me.w),re)});return O.minBy(ue,function(Me){return H(mt,Me)})}function ct(yt,mt,Mt,Ct){var Nt=Mt.v,qt=Mt.w;yt.removeEdge(Nt,qt),yt.setEdge(Ct.v,Ct.w,{}),Y(yt),U(yt,mt),it(yt,mt)}function it(yt,mt){var Mt=O.find(yt.nodes(),function(Nt){return!mt.node(Nt).parent}),Ct=I(yt,Mt);Ct=Ct.slice(1),O.forEach(Ct,function(Nt){var qt=yt.node(Nt).parent,Gt=mt.edge(Nt,qt),re=!1;Gt||(Gt=mt.edge(qt,Nt),re=!0),mt.node(Nt).rank=mt.node(qt).rank+(re?Gt.minlen:-Gt.minlen)})}function vt(yt,mt,Mt){return yt.hasEdge(mt,Mt)}function gt(yt,mt,Mt){return Mt.low<=mt.lim&&mt.lim<=Mt.lim}},2416:function(X,et,M){"use strict";var O=M(72361);X.exports={longestPath:W,slack:H};function W(L){var I={};function N(P){var k=L.node(P);if(O.has(I,P))return k.rank;I[P]=!0;var U=O.min(O.map(L.outEdges(P),function(Z){return N(Z.w)-L.edge(Z).minlen}));return(U===Number.POSITIVE_INFINITY||U===void 0||U===null)&&(U=0),k.rank=U}O.forEach(L.sources(),N)}function H(L,I){return L.node(I.w).rank-L.node(I.v).rank-L.edge(I).minlen}},53063:function(X,et,M){"use strict";var O=M(72361),W=M(76626).Graph;X.exports={addDummyNode:H,simplify:L,asNonCompoundGraph:I,successorWeights:N,predecessorWeights:P,intersectRect:k,buildLayerMatrix:U,normalizeRanks:Z,removeEmptyRanks:V,addBorderNode:Y,maxRank:nt,partition:rt,time:ft,notime:ct};function H(it,vt,gt,yt){var mt;do mt=O.uniqueId(yt);while(it.hasNode(mt));return gt.dummy=vt,it.setNode(mt,gt),mt}function L(it){var vt=new W().setGraph(it.graph());return O.forEach(it.nodes(),function(gt){vt.setNode(gt,it.node(gt))}),O.forEach(it.edges(),function(gt){var yt=vt.edge(gt.v,gt.w)||{weight:0,minlen:1},mt=it.edge(gt);vt.setEdge(gt.v,gt.w,{weight:yt.weight+mt.weight,minlen:Math.max(yt.minlen,mt.minlen)})}),vt}function I(it){var vt=new W({multigraph:it.isMultigraph()}).setGraph(it.graph());return O.forEach(it.nodes(),function(gt){it.children(gt).length||vt.setNode(gt,it.node(gt))}),O.forEach(it.edges(),function(gt){vt.setEdge(gt,it.edge(gt))}),vt}function N(it){var vt=O.map(it.nodes(),function(gt){var yt={};return O.forEach(it.outEdges(gt),function(mt){yt[mt.w]=(yt[mt.w]||0)+it.edge(mt).weight}),yt});return O.zipObject(it.nodes(),vt)}function P(it){var vt=O.map(it.nodes(),function(gt){var yt={};return O.forEach(it.inEdges(gt),function(mt){yt[mt.v]=(yt[mt.v]||0)+it.edge(mt).weight}),yt});return O.zipObject(it.nodes(),vt)}function k(it,vt){var gt=it.x,yt=it.y,mt=vt.x-gt,Mt=vt.y-yt,Ct=it.width/2,Nt=it.height/2;if(!mt&&!Mt)throw new Error("Not possible to find intersection inside of the rectangle");var qt,Gt;return Math.abs(Mt)*Ct>Math.abs(mt)*Nt?(Mt<0&&(Nt=-Nt),qt=Nt*mt/Mt,Gt=Nt):(mt<0&&(Ct=-Ct),qt=Ct,Gt=Ct*Mt/mt),{x:gt+qt,y:yt+Gt}}function U(it){var vt=O.map(O.range(nt(it)+1),function(){return[]});return O.forEach(it.nodes(),function(gt){var yt=it.node(gt),mt=yt.rank;O.isUndefined(mt)||(vt[mt][yt.order]=gt)}),vt}function Z(it){var vt=O.min(O.map(it.nodes(),function(gt){return it.node(gt).rank}));O.forEach(it.nodes(),function(gt){var yt=it.node(gt);O.has(yt,"rank")&&(yt.rank-=vt)})}function V(it){var vt=O.min(O.map(it.nodes(),function(Mt){return it.node(Mt).rank})),gt=[];O.forEach(it.nodes(),function(Mt){var Ct=it.node(Mt).rank-vt;gt[Ct]||(gt[Ct]=[]),gt[Ct].push(Mt)});var yt=0,mt=it.graph().nodeRankFactor;O.forEach(gt,function(Mt,Ct){O.isUndefined(Mt)&&Ct%mt!==0?--yt:yt&&O.forEach(Mt,function(Nt){it.node(Nt).rank+=yt})})}function Y(it,vt,gt,yt){var mt={width:0,height:0};return arguments.length>=4&&(mt.rank=gt,mt.order=yt),H(it,"border",mt,vt)}function nt(it){return O.max(O.map(it.nodes(),function(vt){var gt=it.node(vt).rank;if(!O.isUndefined(gt))return gt}))}function rt(it,vt){var gt={lhs:[],rhs:[]};return O.forEach(it,function(yt){vt(yt)?gt.lhs.push(yt):gt.rhs.push(yt)}),gt}function ft(it,vt){var gt=O.now();try{return vt()}finally{console.log(it+" time: "+(O.now()-gt)+"ms")}}function ct(it,vt){return vt()}},11897:function(X){X.exports="0.8.5"},37271:function(X){"use strict";var et=Object.prototype.hasOwnProperty,M="~";function O(){}Object.create&&(O.prototype=Object.create(null),new O().__proto__||(M=!1));function W(N,P,k){this.fn=N,this.context=P,this.once=k||!1}function H(N,P,k,U,Z){if(typeof k!="function")throw new TypeError("The listener must be a function");var V=new W(k,U||N,Z),Y=M?M+P:P;return N._events[Y]?N._events[Y].fn?N._events[Y]=[N._events[Y],V]:N._events[Y].push(V):(N._events[Y]=V,N._eventsCount++),N}function L(N,P){--N._eventsCount===0?N._events=new O:delete N._events[P]}function I(){this._events=new O,this._eventsCount=0}I.prototype.eventNames=function(){var P=[],k,U;if(this._eventsCount===0)return P;for(U in k=this._events)et.call(k,U)&&P.push(M?U.slice(1):U);return Object.getOwnPropertySymbols?P.concat(Object.getOwnPropertySymbols(k)):P},I.prototype.listeners=function(P){var k=M?M+P:P,U=this._events[k];if(!U)return[];if(U.fn)return[U.fn];for(var Z=0,V=U.length,Y=new Array(V);Z0&&(Y=V.removeMin(),nt=Z[Y],nt.distance!==Number.POSITIVE_INFINITY);)U(Y).forEach(rt);return Z}},59324:function(X,et,M){var O=M(95329),W=M(94558);X.exports=H;function H(L){return O.filter(W(L),function(I){return I.length>1||I.length===1&&L.hasEdge(I[0],I[0])})}},22893:function(X,et,M){var O=M(95329);X.exports=H;var W=O.constant(1);function H(I,N,P){return L(I,N||W,P||function(k){return I.outEdges(k)})}function L(I,N,P){var k={},U=I.nodes();return U.forEach(function(Z){k[Z]={},k[Z][Z]={distance:0},U.forEach(function(V){Z!==V&&(k[Z][V]={distance:Number.POSITIVE_INFINITY})}),P(Z).forEach(function(V){var Y=V.v===Z?V.w:V.v,nt=N(V);k[Z][Y]={distance:nt,predecessor:Z}})}),U.forEach(function(Z){var V=k[Z];U.forEach(function(Y){var nt=k[Y];U.forEach(function(rt){var ft=nt[Z],ct=V[rt],it=nt[rt],vt=ft.distance+ct.distance;vt0;){if(Z=U.removeMin(),O.has(k,Z))P.setEdge(Z,k[Z]);else{if(Y)throw new Error("Input graph is not connected: "+I);Y=!0}I.nodeEdges(Z).forEach(V)}return P}},94558:function(X,et,M){var O=M(95329);X.exports=W;function W(H){var L=0,I=[],N={},P=[];function k(U){var Z=N[U]={onStack:!0,lowlink:L,index:L++};if(I.push(U),H.successors(U).forEach(function(nt){O.has(N,nt)?N[nt].onStack&&(Z.lowlink=Math.min(Z.lowlink,N[nt].index)):(k(nt),Z.lowlink=Math.min(Z.lowlink,N[nt].lowlink))}),Z.lowlink===Z.index){var V=[],Y;do Y=I.pop(),N[Y].onStack=!1,V.push(Y);while(U!==Y);P.push(V)}}return H.nodes().forEach(function(U){O.has(N,U)||k(U)}),P}},7793:function(X,et,M){var O=M(95329);X.exports=W,W.CycleException=H;function W(L){var I={},N={},P=[];function k(U){if(O.has(N,U))throw new H;O.has(I,U)||(N[U]=!0,I[U]=!0,O.each(L.predecessors(U),k),delete N[U],P.push(U))}if(O.each(L.sinks(),k),O.size(I)!==L.nodeCount())throw new H;return P}function H(){}H.prototype=new Error},36614:function(X,et,M){var O=M(95329);X.exports=W;function W(){this._arr=[],this._keyIndices={}}W.prototype.size=function(){return this._arr.length},W.prototype.keys=function(){return this._arr.map(function(H){return H.key})},W.prototype.has=function(H){return O.has(this._keyIndices,H)},W.prototype.priority=function(H){var L=this._keyIndices[H];if(L!==void 0)return this._arr[L].priority},W.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},W.prototype.add=function(H,L){var I=this._keyIndices;if(H=String(H),!O.has(I,H)){var N=this._arr,P=N.length;return I[H]=P,N.push({key:H,priority:L}),this._decrease(P),!0}return!1},W.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var H=this._arr.pop();return delete this._keyIndices[H.key],this._heapify(0),H.key},W.prototype.decrease=function(H,L){var I=this._keyIndices[H];if(L>this._arr[I].priority)throw new Error("New priority is greater than current priority. Key: "+H+" Old: "+this._arr[I].priority+" New: "+L);this._arr[I].priority=L,this._decrease(I)},W.prototype._heapify=function(H){var L=this._arr,I=2*H,N=I+1,P=H;I>1,!(L[N].priority1?rt.setNode(ft,Y):rt.setNode(ft)}),this},I.prototype.setNode=function(V,Y){return O.has(this._nodes,V)?(arguments.length>1&&(this._nodes[V]=Y),this):(this._nodes[V]=arguments.length>1?Y:this._defaultNodeLabelFn(V),this._isCompound&&(this._parent[V]=H,this._children[V]={},this._children[H][V]=!0),this._in[V]={},this._preds[V]={},this._out[V]={},this._sucs[V]={},++this._nodeCount,this)},I.prototype.node=function(V){return this._nodes[V]},I.prototype.hasNode=function(V){return O.has(this._nodes,V)},I.prototype.removeNode=function(V){var Y=this;if(O.has(this._nodes,V)){var nt=function(rt){Y.removeEdge(Y._edgeObjs[rt])};delete this._nodes[V],this._isCompound&&(this._removeFromParentsChildList(V),delete this._parent[V],O.each(this.children(V),function(rt){Y.setParent(rt)}),delete this._children[V]),O.each(O.keys(this._in[V]),nt),delete this._in[V],delete this._preds[V],O.each(O.keys(this._out[V]),nt),delete this._out[V],delete this._sucs[V],--this._nodeCount}return this},I.prototype.setParent=function(V,Y){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(O.isUndefined(Y))Y=H;else{Y+="";for(var nt=Y;!O.isUndefined(nt);nt=this.parent(nt))if(nt===V)throw new Error("Setting "+Y+" as parent of "+V+" would create a cycle");this.setNode(Y)}return this.setNode(V),this._removeFromParentsChildList(V),this._parent[V]=Y,this._children[Y][V]=!0,this},I.prototype._removeFromParentsChildList=function(V){delete this._children[this._parent[V]][V]},I.prototype.parent=function(V){if(this._isCompound){var Y=this._parent[V];if(Y!==H)return Y}},I.prototype.children=function(V){if(O.isUndefined(V)&&(V=H),this._isCompound){var Y=this._children[V];if(Y)return O.keys(Y)}else{if(V===H)return this.nodes();if(this.hasNode(V))return[]}},I.prototype.predecessors=function(V){var Y=this._preds[V];if(Y)return O.keys(Y)},I.prototype.successors=function(V){var Y=this._sucs[V];if(Y)return O.keys(Y)},I.prototype.neighbors=function(V){var Y=this.predecessors(V);if(Y)return O.union(Y,this.successors(V))},I.prototype.isLeaf=function(V){var Y;return this.isDirected()?Y=this.successors(V):Y=this.neighbors(V),Y.length===0},I.prototype.filterNodes=function(V){var Y=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});Y.setGraph(this.graph());var nt=this;O.each(this._nodes,function(ct,it){V(it)&&Y.setNode(it,ct)}),O.each(this._edgeObjs,function(ct){Y.hasNode(ct.v)&&Y.hasNode(ct.w)&&Y.setEdge(ct,nt.edge(ct))});var rt={};function ft(ct){var it=nt.parent(ct);return it===void 0||Y.hasNode(it)?(rt[ct]=it,it):it in rt?rt[it]:ft(it)}return this._isCompound&&O.each(Y.nodes(),function(ct){Y.setParent(ct,ft(ct))}),Y},I.prototype.setDefaultEdgeLabel=function(V){return O.isFunction(V)||(V=O.constant(V)),this._defaultEdgeLabelFn=V,this},I.prototype.edgeCount=function(){return this._edgeCount},I.prototype.edges=function(){return O.values(this._edgeObjs)},I.prototype.setPath=function(V,Y){var nt=this,rt=arguments;return O.reduce(V,function(ft,ct){return rt.length>1?nt.setEdge(ft,ct,Y):nt.setEdge(ft,ct),ct}),this},I.prototype.setEdge=function(){var V,Y,nt,rt,ft=!1,ct=arguments[0];typeof ct=="object"&&ct!==null&&"v"in ct?(V=ct.v,Y=ct.w,nt=ct.name,arguments.length===2&&(rt=arguments[1],ft=!0)):(V=ct,Y=arguments[1],nt=arguments[3],arguments.length>2&&(rt=arguments[2],ft=!0)),V=""+V,Y=""+Y,O.isUndefined(nt)||(nt=""+nt);var it=k(this._isDirected,V,Y,nt);if(O.has(this._edgeLabels,it))return ft&&(this._edgeLabels[it]=rt),this;if(!O.isUndefined(nt)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(V),this.setNode(Y),this._edgeLabels[it]=ft?rt:this._defaultEdgeLabelFn(V,Y,nt);var vt=U(this._isDirected,V,Y,nt);return V=vt.v,Y=vt.w,Object.freeze(vt),this._edgeObjs[it]=vt,N(this._preds[Y],V),N(this._sucs[V],Y),this._in[Y][it]=vt,this._out[V][it]=vt,this._edgeCount++,this},I.prototype.edge=function(V,Y,nt){var rt=arguments.length===1?Z(this._isDirected,arguments[0]):k(this._isDirected,V,Y,nt);return this._edgeLabels[rt]},I.prototype.hasEdge=function(V,Y,nt){var rt=arguments.length===1?Z(this._isDirected,arguments[0]):k(this._isDirected,V,Y,nt);return O.has(this._edgeLabels,rt)},I.prototype.removeEdge=function(V,Y,nt){var rt=arguments.length===1?Z(this._isDirected,arguments[0]):k(this._isDirected,V,Y,nt),ft=this._edgeObjs[rt];return ft&&(V=ft.v,Y=ft.w,delete this._edgeLabels[rt],delete this._edgeObjs[rt],P(this._preds[Y],V),P(this._sucs[V],Y),delete this._in[Y][rt],delete this._out[V][rt],this._edgeCount--),this},I.prototype.inEdges=function(V,Y){var nt=this._in[V];if(nt){var rt=O.values(nt);return Y?O.filter(rt,function(ft){return ft.v===Y}):rt}},I.prototype.outEdges=function(V,Y){var nt=this._out[V];if(nt){var rt=O.values(nt);return Y?O.filter(rt,function(ft){return ft.w===Y}):rt}},I.prototype.nodeEdges=function(V,Y){var nt=this.inEdges(V,Y);if(nt)return nt.concat(this.outEdges(V,Y))};function N(V,Y){V[Y]?V[Y]++:V[Y]=1}function P(V,Y){--V[Y]||delete V[Y]}function k(V,Y,nt,rt){var ft=""+Y,ct=""+nt;if(!V&&ft>ct){var it=ft;ft=ct,ct=it}return ft+L+ct+L+(O.isUndefined(rt)?W:rt)}function U(V,Y,nt,rt){var ft=""+Y,ct=""+nt;if(!V&&ft>ct){var it=ft;ft=ct,ct=it}var vt={v:ft,w:ct};return rt&&(vt.name=rt),vt}function Z(V,Y){return k(V,Y.v,Y.w,Y.name)}},89224:function(X,et,M){X.exports={Graph:M(6349),version:M(16544)}},17401:function(X,et,M){var O=M(95329),W=M(6349);X.exports={write:H,read:N};function H(P){var k={options:{directed:P.isDirected(),multigraph:P.isMultigraph(),compound:P.isCompound()},nodes:L(P),edges:I(P)};return O.isUndefined(P.graph())||(k.value=O.clone(P.graph())),k}function L(P){return O.map(P.nodes(),function(k){var U=P.node(k),Z=P.parent(k),V={v:k};return O.isUndefined(U)||(V.value=U),O.isUndefined(Z)||(V.parent=Z),V})}function I(P){return O.map(P.edges(),function(k){var U=P.edge(k),Z={v:k.v,w:k.w};return O.isUndefined(k.name)||(Z.name=k.name),O.isUndefined(U)||(Z.value=U),Z})}function N(P){var k=new W(P.options).setGraph(P.value);return O.each(P.nodes,function(U){k.setNode(U.v,U.value),U.parent&&k.setParent(U.v,U.parent)}),O.each(P.edges,function(U){k.setEdge({v:U.v,w:U.w,name:U.name},U.value)}),k}},95329:function(X,et,M){var O;try{O={clone:M(76833),constant:M(13503),each:M(76934),filter:M(64725),has:M(99946),isArray:M(80744),isEmpty:M(61627),isFunction:M(9363),isUndefined:M(16513),keys:M(55451),map:M(9924),reduce:M(16473),size:M(40617),transform:M(91116),union:M(44065),values:M(81229)}}catch(W){}O||(O=window._),X.exports=O},16544:function(X){X.exports="2.1.8"},64270:function(X){(function(et,M){X.exports=M()})(this,function(){"use strict";var et=function(E,p){return et=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,B){b.__proto__=B}||function(b,B){for(var _ in B)Object.prototype.hasOwnProperty.call(B,_)&&(b[_]=B[_])},et(E,p)};function M(E,p){if(typeof p!="function"&&p!==null)throw new TypeError("Class extends value "+String(p)+" is not a constructor or null");et(E,p);function b(){this.constructor=E}E.prototype=p===null?Object.create(p):(b.prototype=p.prototype,new b)}var O=function(){return O=Object.assign||function(p){for(var b,B=1,_=arguments.length;B<_;B++){b=arguments[B];for(var j in b)Object.prototype.hasOwnProperty.call(b,j)&&(p[j]=b[j])}return p},O.apply(this,arguments)};function W(E,p,b,B){function _(j){return j instanceof b?j:new b(function(tt){tt(j)})}return new(b||(b=Promise))(function(j,tt){function dt(Ot){try{Tt(B.next(Ot))}catch(Dt){tt(Dt)}}function lt(Ot){try{Tt(B.throw(Ot))}catch(Dt){tt(Dt)}}function Tt(Ot){Ot.done?j(Ot.value):_(Ot.value).then(dt,lt)}Tt((B=B.apply(E,p||[])).next())})}function H(E,p){var b={label:0,sent:function(){if(j[0]&1)throw j[1];return j[1]},trys:[],ops:[]},B,_,j,tt;return tt={next:dt(0),throw:dt(1),return:dt(2)},typeof Symbol=="function"&&(tt[Symbol.iterator]=function(){return this}),tt;function dt(Tt){return function(Ot){return lt([Tt,Ot])}}function lt(Tt){if(B)throw new TypeError("Generator is already executing.");for(;b;)try{if(B=1,_&&(j=Tt[0]&2?_.return:Tt[0]?_.throw||((j=_.return)&&j.call(_),0):_.next)&&!(j=j.call(_,Tt[1])).done)return j;switch(_=0,j&&(Tt=[Tt[0]&2,j.value]),Tt[0]){case 0:case 1:j=Tt;break;case 4:return b.label++,{value:Tt[1],done:!1};case 5:b.label++,_=Tt[1],Tt=[0];continue;case 7:Tt=b.ops.pop(),b.trys.pop();continue;default:if(j=b.trys,!(j=j.length>0&&j[j.length-1])&&(Tt[0]===6||Tt[0]===2)){b=0;continue}if(Tt[0]===3&&(!j||Tt[1]>j[0]&&Tt[1]=55296&&_<=56319&&b>10)+55296,tt%1024+56320)),(_+1===b||B.length>16384)&&(j+=String.fromCharCode.apply(String,B),B.length=0)}return j},Z="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",V=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),Y=0;Y>4,Ot[_++]=(tt&15)<<4|dt>>2,Ot[_++]=(dt&3)<<6|lt&63;return Tt},it=function(E){for(var p=E.length,b=[],B=0;B>gt,Nt=1<>gt,re=Ct+Gt,de=re,ue=32,Me=de+ue,Ve=65536>>yt,dn=1<=0){if(p<55296||p>56319&&p<=65535)return b=this.index[p>>gt],b=(b<>gt)],b=(b<>yt),b=this.index[b],b+=p>>gt&Xn,b=this.index[b],b=(b<It?(_.push(!0),dt-=It):_.push(!1),["normal","auto","loose"].indexOf(p)!==-1&&[8208,8211,12316,12448].indexOf(j)!==-1)return B.push(tt),b.push(pe);if(dt===_e||dt===Ke){if(tt===0)return B.push(tt),b.push(qr);var lt=b[tt-1];return zl.indexOf(lt)===-1?(B.push(B[tt-1]),b.push(lt)):(B.push(tt),b.push(qr))}if(B.push(tt),dt===or)return b.push(p==="strict"?as:zo);if(dt===iu||dt===wa)return b.push(qr);if(dt===Vh)return j>=131072&&j<=196605||j>=196608&&j<=262141?b.push(zo):b.push(qr);b.push(dt)}),[B,b,_]},y=function(E,p,b,B){var _=B[b];if(Array.isArray(E)?E.indexOf(_)!==-1:E===_)for(var j=b;j<=B.length;){j++;var tt=B[j];if(tt===p)return!0;if(tt!==Ge)break}if(_===Ge)for(var j=b;j>0;){j--;var dt=B[j];if(Array.isArray(E)?E.indexOf(dt)!==-1:E===dt)for(var lt=b;lt<=B.length;){lt++;var tt=B[lt];if(tt===p)return!0;if(tt!==Ge)break}if(dt!==Ge)break}return!1},T=function(E,p){for(var b=E;b>=0;){var B=p[b];if(B===Ge)b--;else return B}return 0},R=function(E,p,b,B,_){if(b[B]===0)return pn;var j=B-1;if(Array.isArray(_)&&_[j]===!0)return pn;var tt=j-1,dt=j+1,lt=p[j],Tt=tt>=0?p[tt]:0,Ot=p[dt];if(lt===ne&&Ot===be)return pn;if(RA.indexOf(lt)!==-1)return Hl;if(RA.indexOf(Ot)!==-1||Vo.indexOf(Ot)!==-1)return pn;if(T(j,p)===rr)return DA;if(Gl.get(E[j])===Ke||(lt===Ko||lt===ji)&&Gl.get(E[dt])===Ke||lt===rn||Ot===rn||lt===sr||[Ge,We,Wi].indexOf(lt)===-1&&Ot===sr||[Ga,Nr,Mr,Ii,aa].indexOf(Ot)!==-1||T(j,p)===Zi||y(ss,Zi,j,p)||y([Ga,Nr],as,j,p)||y(me,me,j,p))return pn;if(lt===Ge)return DA;if(lt===ss||Ot===ss)return pn;if(Ot===pe||lt===pe)return DA;if([We,Wi,as].indexOf(Ot)!==-1||lt===Gr||Tt===Ka&&x.indexOf(lt)!==-1||lt===aa&&Ot===Ka||Ot===di||Ea.indexOf(Ot)!==-1&<===Jr||Ea.indexOf(lt)!==-1&&Ot===Jr||lt===ya&&[zo,Ko,ji].indexOf(Ot)!==-1||[zo,Ko,ji].indexOf(lt)!==-1&&Ot===ma||Ea.indexOf(lt)!==-1&&Kl.indexOf(Ot)!==-1||Kl.indexOf(lt)!==-1&&Ea.indexOf(Ot)!==-1||[ya,ma].indexOf(lt)!==-1&&(Ot===Jr||[Zi,Wi].indexOf(Ot)!==-1&&p[dt+1]===Jr)||[Zi,Wi].indexOf(lt)!==-1&&Ot===Jr||lt===Jr&&[Jr,aa,Ii].indexOf(Ot)!==-1)return pn;if([Jr,aa,Ii,Ga,Nr].indexOf(Ot)!==-1)for(var Dt=j;Dt>=0;){var Jt=p[Dt];if(Jt===Jr)return pn;if([aa,Ii].indexOf(Jt)!==-1)Dt--;else break}if([ya,ma].indexOf(Ot)!==-1)for(var Dt=[Ga,Nr].indexOf(lt)!==-1?tt:j;Dt>=0;){var Jt=p[Dt];if(Jt===Jr)return pn;if([aa,Ii].indexOf(Jt)!==-1)Dt--;else break}if(UA===lt&&[UA,Ns,Yi,lo].indexOf(Ot)!==-1||[Ns,Yi].indexOf(lt)!==-1&&[Ns,PA].indexOf(Ot)!==-1||[PA,lo].indexOf(lt)!==-1&&Ot===PA||q.indexOf(lt)!==-1&&[di,ma].indexOf(Ot)!==-1||q.indexOf(Ot)!==-1&<===ya||Ea.indexOf(lt)!==-1&&Ea.indexOf(Ot)!==-1||lt===Ii&&Ea.indexOf(Ot)!==-1||Ea.concat(Jr).indexOf(lt)!==-1&&Ot===Zi&&Wh.indexOf(E[dt])===-1||Ea.concat(Jr).indexOf(Ot)!==-1&<===Nr)return pn;if(lt===_l&&Ot===_l){for(var Oe=b[j],fe=1;Oe>0&&(Oe--,p[Oe]===_l);)fe++;if(fe%2!==0)return pn}return lt===Ko&&Ot===ji?pn:DA},st=function(E,p){p||(p={lineBreak:"normal",wordBreak:"normal"});var b=S(E,p.lineBreak),B=b[0],_=b[1],j=b[2];(p.wordBreak==="break-all"||p.wordBreak==="break-word")&&(_=_.map(function(dt){return[Jr,qr,iu].indexOf(dt)!==-1?zo:dt}));var tt=p.wordBreak==="keep-all"?j.map(function(dt,lt){return dt&&E[lt]>=19968&&E[lt]<=40959}):void 0;return[B,_,tt]},ot=function(){function E(p,b,B,_){this.codePoints=p,this.required=b===Hl,this.start=B,this.end=_}return E.prototype.slice=function(){return U.apply(void 0,this.codePoints.slice(this.start,this.end))},E}(),ut=function(E,p){var b=k(E),B=st(b,p),_=B[0],j=B[1],tt=B[2],dt=b.length,lt=0,Tt=0;return{next:function(){if(Tt>=dt)return{done:!0,value:null};for(var Ot=pn;Tt=Au&&E<=57},tv=function(E){return E>=55296&&E<=57343},ho=function(E){return Kr(E)||E>=jh&&E<=uu||E>=lu&&E<=Zh},ev=function(E){return E>=lu&&E<=J0},Xh=function(E){return E>=jh&&E<=$0},nv=function(E){return ev(E)||Xh(E)},q1=function(E){return E>=wr},hu=function(E){return E===ce||E===Ce||E===St},Wl=function(E){return nv(E)||q1(E)||E===Lt},rv=function(E){return Wl(E)||Kr(E)||E===ee},$1=function(E){return E>=uo&&E<=_A||E===su||E>=Vl&&E<=ou||E===Y0},fo=function(E,p){return E!==$t?!1:p!==ce},du=function(E,p,b){return E===ee?Wl(p)||fo(p,b):Wl(E)?!0:!!(E===$t&&fo(E,p))},Jh=function(E,p,b){return E===Rn||E===ee?Kr(p)?!0:p===co&&Kr(b):Kr(E===co?p:E)},tw=function(E){var p=0,b=1;(E[p]===Rn||E[p]===ee)&&(E[p]===ee&&(b=-1),p++);for(var B=[];Kr(E[p]);)B.push(E[p++]);var _=B.length?parseInt(U.apply(void 0,B),10):0;E[p]===co&&p++;for(var j=[];Kr(E[p]);)j.push(E[p++]);var tt=j.length,dt=tt?parseInt(U.apply(void 0,j),10):0;(E[p]===Yh||E[p]===cu)&&p++;var lt=1;(E[p]===Rn||E[p]===ee)&&(E[p]===ee&&(lt=-1),p++);for(var Tt=[];Kr(E[p]);)Tt.push(E[p++]);var Ot=Tt.length?parseInt(U.apply(void 0,Tt),10):0;return b*(_+dt*Math.pow(10,-tt))*Math.pow(10,lt*Ot)},ew={type:2},nw={type:3},rw={type:4},iw={type:13},aw={type:8},sw={type:21},ow={type:9},Aw={type:10},lw={type:11},cw={type:12},uw={type:14},fu={type:23},hw={type:1},dw={type:25},fw={type:24},gw={type:26},vw={type:27},pw={type:28},mw={type:29},yw={type:31},qh={type:32},Er=function(){function E(){this._value=[]}return E.prototype.write=function(p){this._value=this._value.concat(k(p))},E.prototype.read=function(){for(var p=[],b=this.consumeToken();b!==qh;)p.push(b),b=this.consumeToken();return p},E.prototype.consumeToken=function(){var p=this.consumeCodePoint();switch(p){case te:return this.consumeStringToken(te);case He:var b=this.peekCodePoint(0),B=this.peekCodePoint(1),_=this.peekCodePoint(2);if(rv(b)||fo(B,_)){var j=du(b,B,_)?kt:ht,tt=this.consumeName();return{type:5,value:tt,flags:j}}break;case je:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),iw;break;case Ie:return this.consumeStringToken(Ie);case De:return ew;case on:return nw;case ti:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),uw;break;case Rn:if(Jh(p,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(p),this.consumeNumericToken();break;case ks:return rw;case ee:var dt=p,lt=this.peekCodePoint(0),Tt=this.peekCodePoint(1);if(Jh(dt,lt,Tt))return this.reconsumeCodePoint(p),this.consumeNumericToken();if(du(dt,lt,Tt))return this.reconsumeCodePoint(p),this.consumeIdentLikeToken();if(lt===ee&&Tt===Jn)return this.consumeCodePoint(),this.consumeCodePoint(),fw;break;case co:if(Jh(p,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(p),this.consumeNumericToken();break;case Kt:if(this.peekCodePoint(0)===ti)for(this.consumeCodePoint();;){var Ot=this.consumeCodePoint();if(Ot===ti&&(Ot=this.consumeCodePoint(),Ot===Kt))return this.consumeToken();if(Ot===za)return this.consumeToken()}break;case Wo:return gw;case au:return vw;case se:if(this.peekCodePoint(0)===he&&this.peekCodePoint(1)===ee&&this.peekCodePoint(2)===ee)return this.consumeCodePoint(),this.consumeCodePoint(),dw;break;case Qn:var Dt=this.peekCodePoint(0),Jt=this.peekCodePoint(1),Oe=this.peekCodePoint(2);if(du(Dt,Jt,Oe)){var tt=this.consumeName();return{type:7,value:tt}}break;case Zn:return pw;case $t:if(fo(p,this.peekCodePoint(0)))return this.reconsumeCodePoint(p),this.consumeIdentLikeToken();break;case qn:return mw;case kr:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),aw;break;case Tr:return lw;case Xi:return cw;case X0:case q0:var fe=this.peekCodePoint(0),Be=this.peekCodePoint(1);return fe===Rn&&(ho(Be)||Be===Dn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(p),this.consumeIdentLikeToken();case Ji:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),ow;if(this.peekCodePoint(0)===Ji)return this.consumeCodePoint(),sw;break;case fn:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),Aw;break;case za:return qh}return hu(p)?(this.consumeWhiteSpace(),yw):Kr(p)?(this.reconsumeCodePoint(p),this.consumeNumericToken()):Wl(p)?(this.reconsumeCodePoint(p),this.consumeIdentLikeToken()):{type:6,value:U(p)}},E.prototype.consumeCodePoint=function(){var p=this._value.shift();return typeof p=="undefined"?-1:p},E.prototype.reconsumeCodePoint=function(p){this._value.unshift(p)},E.prototype.peekCodePoint=function(p){return p>=this._value.length?-1:this._value[p]},E.prototype.consumeUnicodeRangeToken=function(){for(var p=[],b=this.consumeCodePoint();ho(b)&&p.length<6;)p.push(b),b=this.consumeCodePoint();for(var B=!1;b===Dn&&p.length<6;)p.push(b),b=this.consumeCodePoint(),B=!0;if(B){var _=parseInt(U.apply(void 0,p.map(function(lt){return lt===Dn?Au:lt})),16),j=parseInt(U.apply(void 0,p.map(function(lt){return lt===Dn?uu:lt})),16);return{type:30,start:_,end:j}}var tt=parseInt(U.apply(void 0,p),16);if(this.peekCodePoint(0)===ee&&ho(this.peekCodePoint(1))){this.consumeCodePoint(),b=this.consumeCodePoint();for(var dt=[];ho(b)&&dt.length<6;)dt.push(b),b=this.consumeCodePoint();var j=parseInt(U.apply(void 0,dt),16);return{type:30,start:tt,end:j}}else return{type:30,start:tt,end:tt}},E.prototype.consumeIdentLikeToken=function(){var p=this.consumeName();return p.toLowerCase()==="url"&&this.peekCodePoint(0)===De?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===De?(this.consumeCodePoint(),{type:19,value:p}):{type:20,value:p}},E.prototype.consumeUrlToken=function(){var p=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===za)return{type:22,value:""};var b=this.peekCodePoint(0);if(b===Ie||b===te){var B=this.consumeStringToken(this.consumeCodePoint());return B.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===za||this.peekCodePoint(0)===on)?(this.consumeCodePoint(),{type:22,value:B.value}):(this.consumeBadUrlRemnants(),fu)}for(;;){var _=this.consumeCodePoint();if(_===za||_===on)return{type:22,value:U.apply(void 0,p)};if(hu(_))return this.consumeWhiteSpace(),this.peekCodePoint(0)===za||this.peekCodePoint(0)===on?(this.consumeCodePoint(),{type:22,value:U.apply(void 0,p)}):(this.consumeBadUrlRemnants(),fu);if(_===te||_===Ie||_===De||$1(_))return this.consumeBadUrlRemnants(),fu;if(_===$t)if(fo(_,this.peekCodePoint(0)))p.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),fu;else p.push(_)}},E.prototype.consumeWhiteSpace=function(){for(;hu(this.peekCodePoint(0));)this.consumeCodePoint()},E.prototype.consumeBadUrlRemnants=function(){for(;;){var p=this.consumeCodePoint();if(p===on||p===za)return;fo(p,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},E.prototype.consumeStringSlice=function(p){for(var b=5e4,B="";p>0;){var _=Math.min(b,p);B+=U.apply(void 0,this._value.splice(0,_)),p-=_}return this._value.shift(),B},E.prototype.consumeStringToken=function(p){var b="",B=0;do{var _=this._value[B];if(_===za||_===void 0||_===p)return b+=this.consumeStringSlice(B),{type:0,value:b};if(_===ce)return this._value.splice(0,B),hw;if(_===$t){var j=this._value[B+1];j!==za&&j!==void 0&&(j===ce?(b+=this.consumeStringSlice(B),B=-1,this._value.shift()):fo(_,j)&&(b+=this.consumeStringSlice(B),b+=U(this.consumeEscapedCodePoint()),B=-1))}B++}while(!0)},E.prototype.consumeNumber=function(){var p=[],b=Bt,B=this.peekCodePoint(0);for((B===Rn||B===ee)&&p.push(this.consumeCodePoint());Kr(this.peekCodePoint(0));)p.push(this.consumeCodePoint());B=this.peekCodePoint(0);var _=this.peekCodePoint(1);if(B===co&&Kr(_))for(p.push(this.consumeCodePoint(),this.consumeCodePoint()),b=jt;Kr(this.peekCodePoint(0));)p.push(this.consumeCodePoint());B=this.peekCodePoint(0),_=this.peekCodePoint(1);var j=this.peekCodePoint(2);if((B===Yh||B===cu)&&((_===Rn||_===ee)&&Kr(j)||Kr(_)))for(p.push(this.consumeCodePoint(),this.consumeCodePoint()),b=jt;Kr(this.peekCodePoint(0));)p.push(this.consumeCodePoint());return[tw(p),b]},E.prototype.consumeNumericToken=function(){var p=this.consumeNumber(),b=p[0],B=p[1],_=this.peekCodePoint(0),j=this.peekCodePoint(1),tt=this.peekCodePoint(2);if(du(_,j,tt)){var dt=this.consumeName();return{type:15,number:b,flags:B,unit:dt}}return _===Wn?(this.consumeCodePoint(),{type:16,number:b,flags:B}):{type:17,number:b,flags:B}},E.prototype.consumeEscapedCodePoint=function(){var p=this.consumeCodePoint();if(ho(p)){for(var b=U(p);ho(this.peekCodePoint(0))&&b.length<6;)b+=U(this.consumeCodePoint());hu(this.peekCodePoint(0))&&this.consumeCodePoint();var B=parseInt(b,16);return B===0||tv(B)||B>1114111?$r:B}return p===za?$r:p},E.prototype.consumeName=function(){for(var p="";;){var b=this.consumeCodePoint();if(rv(b))p+=U(b);else if(fo(b,this.peekCodePoint(0)))p+=U(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(b),p}},E}(),iv=function(){function E(p){this._tokens=p}return E.create=function(p){var b=new Er;return b.write(p),new E(b.read())},E.parseValue=function(p){return E.create(p).parseComponentValue()},E.parseValues=function(p){return E.create(p).parseComponentValues()},E.prototype.parseComponentValue=function(){for(var p=this.consumeToken();p.type===31;)p=this.consumeToken();if(p.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(p);var b=this.consumeComponentValue();do p=this.consumeToken();while(p.type===31);if(p.type===32)return b;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},E.prototype.parseComponentValues=function(){for(var p=[];;){var b=this.consumeComponentValue();if(b.type===32)return p;p.push(b),p.push()}},E.prototype.consumeComponentValue=function(){var p=this.consumeToken();switch(p.type){case 11:case 28:case 2:return this.consumeSimpleBlock(p.type);case 19:return this.consumeFunction(p)}return p},E.prototype.consumeSimpleBlock=function(p){for(var b={type:p,values:[]},B=this.consumeToken();;){if(B.type===32||sv(B,p))return b;this.reconsumeToken(B),b.values.push(this.consumeComponentValue()),B=this.consumeToken()}},E.prototype.consumeFunction=function(p){for(var b={name:p.value,values:[],type:18};;){var B=this.consumeToken();if(B.type===32||B.type===3)return b;this.reconsumeToken(B),b.values.push(this.consumeComponentValue())}},E.prototype.consumeToken=function(){var p=this._tokens.shift();return typeof p=="undefined"?qh:p},E.prototype.reconsumeToken=function(p){this._tokens.unshift(p)},E}(),sa=function(E){return E.type===15},HA=function(E){return E.type===17},$n=function(E){return E.type===20},Qs=function(E){return E.type===0},$h=function(E,p){return $n(E)&&E.value===p},av=function(E){return E.type!==31},GA=function(E){return E.type!==31&&E.type!==4},os=function(E){var p=[],b=[];return E.forEach(function(B){if(B.type===4){if(b.length===0)throw new Error("Error parsing function args, zero tokens for arg");p.push(b),b=[];return}B.type!==31&&b.push(B)}),b.length&&p.push(b),p},sv=function(E,p){return p===11&&E.type===12||p===28&&E.type===29?!0:p===2&&E.type===3},Us=function(E){return E.type===17||E.type===15},Qr=function(E){return E.type===16||Us(E)},Zl=function(E){return E.length>1?[E[0],E[1]]:[E[0]]},fi={type:17,number:0,flags:Bt},KA={type:16,number:50,flags:Bt},go={type:16,number:100,flags:Bt},zA=function(E,p,b){var B=E[0],_=E[1];return[Gn(B,p),Gn(typeof _!="undefined"?_:B,b)]},Gn=function(E,p){if(E.type===16)return E.number/100*p;if(sa(E))switch(E.unit){case"rem":case"em":return 16*E.number;case"px":default:return E.number}return E.number},ov="deg",Av="grad",td="rad",VA="turn",WA={name:"angle",parse:function(E,p){if(p.type===15)switch(p.unit){case ov:return Math.PI*p.number/180;case Av:return Math.PI/200*p.number;case td:return p.number;case VA:return Math.PI*2*p.number}throw new Error("Unsupported angle type")}},lv=function(E){return E.type===15&&(E.unit===ov||E.unit===Av||E.unit===td||E.unit===VA)},gu=function(E){var p=E.filter($n).map(function(b){return b.value}).join(" ");switch(p){case"to bottom right":case"to right bottom":case"left top":case"top left":return[fi,fi];case"to top":case"bottom":return oa(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[fi,go];case"to right":case"left":return oa(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[go,go];case"to bottom":case"top":return oa(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[go,fi];case"to left":case"right":return oa(270)}return 0},oa=function(E){return Math.PI*E/180},Ps={name:"color",parse:function(E,p){if(p.type===18){var b=ww[p.name];if(typeof b=="undefined")throw new Error('Attempting to parse an unsupported color function "'+p.name+'"');return b(E,p.values)}if(p.type===5){if(p.value.length===3){var B=p.value.substring(0,1),_=p.value.substring(1,2),j=p.value.substring(2,3);return po(parseInt(B+B,16),parseInt(_+_,16),parseInt(j+j,16),1)}if(p.value.length===4){var B=p.value.substring(0,1),_=p.value.substring(1,2),j=p.value.substring(2,3),tt=p.value.substring(3,4);return po(parseInt(B+B,16),parseInt(_+_,16),parseInt(j+j,16),parseInt(tt+tt,16)/255)}if(p.value.length===6){var B=p.value.substring(0,2),_=p.value.substring(2,4),j=p.value.substring(4,6);return po(parseInt(B,16),parseInt(_,16),parseInt(j,16),1)}if(p.value.length===8){var B=p.value.substring(0,2),_=p.value.substring(2,4),j=p.value.substring(4,6),tt=p.value.substring(6,8);return po(parseInt(B,16),parseInt(_,16),parseInt(j,16),parseInt(tt,16)/255)}}if(p.type===20){var dt=Ds[p.value.toUpperCase()];if(typeof dt!="undefined")return dt}return Ds.TRANSPARENT}},vo=function(E){return(255&E)===0},ei=function(E){var p=255&E,b=255&E>>8,B=255&E>>16,_=255&E>>24;return p<255?"rgba("+_+","+B+","+b+","+p/255+")":"rgb("+_+","+B+","+b+")"},po=function(E,p,b,B){return(E<<24|p<<16|b<<8|Math.round(B*255)<<0)>>>0},cv=function(E,p){if(E.type===17)return E.number;if(E.type===16){var b=p===3?1:255;return p===3?E.number/100*b:Math.round(E.number/100*b)}return 0},uv=function(E,p){var b=p.filter(GA);if(b.length===3){var B=b.map(cv),_=B[0],j=B[1],tt=B[2];return po(_,j,tt,1)}if(b.length===4){var dt=b.map(cv),_=dt[0],j=dt[1],tt=dt[2],lt=dt[3];return po(_,j,tt,lt)}return 0};function Zo(E,p,b){return b<0&&(b+=1),b>=1&&(b-=1),b<1/6?(p-E)*b*6+E:b<1/2?p:b<2/3?(p-E)*6*(2/3-b)+E:E}var hv=function(E,p){var b=p.filter(GA),B=b[0],_=b[1],j=b[2],tt=b[3],dt=(B.type===17?oa(B.number):WA.parse(E,B))/(Math.PI*2),lt=Qr(_)?_.number/100:0,Tt=Qr(j)?j.number/100:0,Ot=typeof tt!="undefined"&&Qr(tt)?Gn(tt,1):1;if(lt===0)return po(Tt*255,Tt*255,Tt*255,1);var Dt=Tt<=.5?Tt*(lt+1):Tt+lt-Tt*lt,Jt=Tt*2-Dt,Oe=Zo(Jt,Dt,dt+1/3),fe=Zo(Jt,Dt,dt),Be=Zo(Jt,Dt,dt-1/3);return po(Oe*255,fe*255,Be*255,Ot)},ww={hsl:hv,hsla:hv,rgb:uv,rgba:uv},jl=function(E,p){return Ps.parse(E,iv.create(p).parseComponentValue())},Ds={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Ew={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(E,p){return p.map(function(b){if($n(b))switch(b.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},vu={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},pu=function(E,p){var b=Ps.parse(E,p[0]),B=p[1];return B&&Qr(B)?{color:b,stop:B}:{color:b,stop:null}},dv=function(E,p){var b=E[0],B=E[E.length-1];b.stop===null&&(b.stop=fi),B.stop===null&&(B.stop=go);for(var _=[],j=0,tt=0;ttj?_.push(lt):_.push(j),j=lt}else _.push(null)}for(var Tt=null,tt=0;tt<_.length;tt++){var Ot=_[tt];if(Ot===null)Tt===null&&(Tt=tt);else if(Tt!==null){for(var Dt=tt-Tt,Jt=_[Tt-1],Oe=(Ot-Jt)/(Dt+1),fe=1;fe<=Dt;fe++)_[Tt+fe-1]=Oe*fe;Tt=null}}return E.map(function(Be,an){var Ue=Be.color;return{color:Ue,stop:Math.max(Math.min(1,_[an]/p),0)}})},fv=function(E,p,b){var B=p/2,_=b/2,j=Gn(E[0],p)-B,tt=_-Gn(E[1],b);return(Math.atan2(tt,j)+Math.PI*2)%(Math.PI*2)},gv=function(E,p,b){var B=typeof E=="number"?E:fv(E,p,b),_=Math.abs(p*Math.sin(B))+Math.abs(b*Math.cos(B)),j=p/2,tt=b/2,dt=_/2,lt=Math.sin(B-Math.PI/2)*dt,Tt=Math.cos(B-Math.PI/2)*dt;return[_,j-Tt,j+Tt,tt-lt,tt+lt]},Va=function(E,p){return Math.sqrt(E*E+p*p)},vv=function(E,p,b,B,_){var j=[[0,0],[0,p],[E,0],[E,p]];return j.reduce(function(tt,dt){var lt=dt[0],Tt=dt[1],Ot=Va(b-lt,B-Tt);return(_?Ottt.optimumDistance)?{optimumCorner:dt,optimumDistance:Ot}:tt},{optimumDistance:_?1/0:-1/0,optimumCorner:null}).optimumCorner},Bw=function(E,p,b,B,_){var j=0,tt=0;switch(E.size){case 0:E.shape===0?j=tt=Math.min(Math.abs(p),Math.abs(p-B),Math.abs(b),Math.abs(b-_)):E.shape===1&&(j=Math.min(Math.abs(p),Math.abs(p-B)),tt=Math.min(Math.abs(b),Math.abs(b-_)));break;case 2:if(E.shape===0)j=tt=Math.min(Va(p,b),Va(p,b-_),Va(p-B,b),Va(p-B,b-_));else if(E.shape===1){var dt=Math.min(Math.abs(b),Math.abs(b-_))/Math.min(Math.abs(p),Math.abs(p-B)),lt=vv(B,_,p,b,!0),Tt=lt[0],Ot=lt[1];j=Va(Tt-p,(Ot-b)/dt),tt=dt*j}break;case 1:E.shape===0?j=tt=Math.max(Math.abs(p),Math.abs(p-B),Math.abs(b),Math.abs(b-_)):E.shape===1&&(j=Math.max(Math.abs(p),Math.abs(p-B)),tt=Math.max(Math.abs(b),Math.abs(b-_)));break;case 3:if(E.shape===0)j=tt=Math.max(Va(p,b),Va(p,b-_),Va(p-B,b),Va(p-B,b-_));else if(E.shape===1){var dt=Math.max(Math.abs(b),Math.abs(b-_))/Math.max(Math.abs(p),Math.abs(p-B)),Dt=vv(B,_,p,b,!1),Tt=Dt[0],Ot=Dt[1];j=Va(Tt-p,(Ot-b)/dt),tt=dt*j}break}return Array.isArray(E.size)&&(j=Gn(E.size[0],B),tt=E.size.length===2?Gn(E.size[1],_):j),[j,tt]},bw=function(E,p){var b=oa(180),B=[];return os(p).forEach(function(_,j){if(j===0){var tt=_[0];if(tt.type===20&&tt.value==="to"){b=gu(_);return}else if(lv(tt)){b=WA.parse(E,tt);return}}var dt=pu(E,_);B.push(dt)}),{angle:b,stops:B,type:1}},mu=function(E,p){var b=oa(180),B=[];return os(p).forEach(function(_,j){if(j===0){var tt=_[0];if(tt.type===20&&["top","left","right","bottom"].indexOf(tt.value)!==-1){b=gu(_);return}else if(lv(tt)){b=(WA.parse(E,tt)+oa(270))%oa(360);return}}var dt=pu(E,_);B.push(dt)}),{angle:b,stops:B,type:1}},xw=function(E,p){var b=oa(180),B=[],_=1,j=0,tt=3,dt=[];return os(p).forEach(function(lt,Tt){var Ot=lt[0];if(Tt===0){if($n(Ot)&&Ot.value==="linear"){_=1;return}else if($n(Ot)&&Ot.value==="radial"){_=2;return}}if(Ot.type===18){if(Ot.name==="from"){var Dt=Ps.parse(E,Ot.values[0]);B.push({stop:fi,color:Dt})}else if(Ot.name==="to"){var Dt=Ps.parse(E,Ot.values[0]);B.push({stop:go,color:Dt})}else if(Ot.name==="color-stop"){var Jt=Ot.values.filter(GA);if(Jt.length===2){var Dt=Ps.parse(E,Jt[1]),Oe=Jt[0];HA(Oe)&&B.push({stop:{type:16,number:Oe.number*100,flags:Oe.flags},color:Dt})}}}}),_===1?{angle:(b+oa(180))%oa(360),stops:B,type:_}:{size:tt,shape:j,stops:B,position:dt,type:_}},pv="closest-side",mv="farthest-side",yv="closest-corner",wv="farthest-corner",Ev="circle",Bv="ellipse",bv="cover",xv="contain",Cw=function(E,p){var b=0,B=3,_=[],j=[];return os(p).forEach(function(tt,dt){var lt=!0;if(dt===0){var Tt=!1;lt=tt.reduce(function(Dt,Jt){if(Tt)if($n(Jt))switch(Jt.value){case"center":return j.push(KA),Dt;case"top":case"left":return j.push(fi),Dt;case"right":case"bottom":return j.push(go),Dt}else(Qr(Jt)||Us(Jt))&&j.push(Jt);else if($n(Jt))switch(Jt.value){case Ev:return b=0,!1;case Bv:return b=1,!1;case"at":return Tt=!0,!1;case pv:return B=0,!1;case bv:case mv:return B=1,!1;case xv:case yv:return B=2,!1;case wv:return B=3,!1}else if(Us(Jt)||Qr(Jt))return Array.isArray(B)||(B=[]),B.push(Jt),!1;return Dt},lt)}if(lt){var Ot=pu(E,tt);_.push(Ot)}}),{size:B,shape:b,stops:_,position:j,type:2}},yu=function(E,p){var b=0,B=3,_=[],j=[];return os(p).forEach(function(tt,dt){var lt=!0;if(dt===0?lt=tt.reduce(function(Ot,Dt){if($n(Dt))switch(Dt.value){case"center":return j.push(KA),!1;case"top":case"left":return j.push(fi),!1;case"right":case"bottom":return j.push(go),!1}else if(Qr(Dt)||Us(Dt))return j.push(Dt),!1;return Ot},lt):dt===1&&(lt=tt.reduce(function(Ot,Dt){if($n(Dt))switch(Dt.value){case Ev:return b=0,!1;case Bv:return b=1,!1;case xv:case pv:return B=0,!1;case mv:return B=1,!1;case yv:return B=2,!1;case bv:case wv:return B=3,!1}else if(Us(Dt)||Qr(Dt))return Array.isArray(B)||(B=[]),B.push(Dt),!1;return Ot},lt)),lt){var Tt=pu(E,tt);_.push(Tt)}}),{size:B,shape:b,stops:_,position:j,type:2}},Sw=function(E){return E.type===1},Cv=function(E){return E.type===2},wu={name:"image",parse:function(E,p){if(p.type===22){var b={url:p.value,type:0};return E.cache.addImage(p.value),b}if(p.type===18){var B=Sv[p.name];if(typeof B=="undefined")throw new Error('Attempting to parse an unsupported image function "'+p.name+'"');return B(E,p.values)}throw new Error("Unsupported image type "+p.type)}};function Mw(E){return!(E.type===20&&E.value==="none")&&(E.type!==18||!!Sv[E.name])}var Sv={"linear-gradient":bw,"-moz-linear-gradient":mu,"-ms-linear-gradient":mu,"-o-linear-gradient":mu,"-webkit-linear-gradient":mu,"radial-gradient":Cw,"-moz-radial-gradient":yu,"-ms-radial-gradient":yu,"-o-radial-gradient":yu,"-webkit-radial-gradient":yu,"-webkit-gradient":xw},Tw={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(E,p){if(p.length===0)return[];var b=p[0];return b.type===20&&b.value==="none"?[]:p.filter(function(B){return GA(B)&&Mw(B)}).map(function(B){return wu.parse(E,B)})}},Fw={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(E,p){return p.map(function(b){if($n(b))switch(b.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Ow={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(E,p){return os(p).map(function(b){return b.filter(Qr)}).map(Zl)}},Iw={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(E,p){return os(p).map(function(b){return b.filter($n).map(function(B){return B.value}).join(" ")}).map(Lw)}},Lw=function(E){switch(E){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},ZA;(function(E){E.AUTO="auto",E.CONTAIN="contain",E.COVER="cover"})(ZA||(ZA={}));var Nw={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(E,p){return os(p).map(function(b){return b.filter(kw)})}},kw=function(E){return $n(E)||Qr(E)},Eu=function(E){return{name:"border-"+E+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},Qw=Eu("top"),Mv=Eu("right"),Uw=Eu("bottom"),Pw=Eu("left"),Bu=function(E){return{name:"border-radius-"+E,initialValue:"0 0",prefix:!1,type:1,parse:function(p,b){return Zl(b.filter(Qr))}}},Dw=Bu("top-left"),Rw=Bu("top-right"),_w=Bu("bottom-right"),Hw=Bu("bottom-left"),bu=function(E){return{name:"border-"+E+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(p,b){switch(b){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},Gw=bu("top"),ye=bu("right"),Li=bu("bottom"),Pe=bu("left"),gn=function(E){return{name:"border-"+E+"-width",initialValue:"0",type:0,prefix:!1,parse:function(p,b){return sa(b)?b.number:0}}},Tv=gn("top"),hr=gn("right"),z=gn("bottom"),jA=gn("left"),ed={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},nd={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(E,p){switch(p){case"rtl":return 1;case"ltr":default:return 0}}},rd={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(E,p){return p.filter($n).reduce(function(b,B){return b|id(B.value)},0)}},id=function(E){switch(E){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},ad={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(E,p){switch(p){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Fv={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(E,p){return p.type===20&&p.value==="normal"?0:p.type===17||p.type===15?p.number:0}},Yl;(function(E){E.NORMAL="normal",E.STRICT="strict"})(Yl||(Yl={}));var jo={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(E,p){switch(p){case"strict":return Yl.STRICT;case"normal":default:return Yl.NORMAL}}},Ov={name:"line-height",initialValue:"normal",prefix:!1,type:4},sd=function(E,p){return $n(E)&&E.value==="normal"?1.2*p:E.type===17?p*E.number:Qr(E)?Gn(E,p):p},Xl={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(E,p){return p.type===20&&p.value==="none"?null:wu.parse(E,p)}},Iv={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(E,p){switch(p){case"inside":return 0;case"outside":default:return 1}}},xu={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(E,p){switch(p){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},Jl=function(E){return{name:"margin-"+E,initialValue:"0",prefix:!1,type:4}},Lv=Jl("top"),Nv=Jl("right"),kv=Jl("bottom"),Qv=Jl("left"),ql={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(E,p){return p.filter($n).map(function(b){switch(b.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},Rs={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(E,p){switch(p){case"break-word":return"break-word";case"normal":default:return"normal"}}},Yo=function(E){return{name:"padding-"+E,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},od=Yo("top"),Uv=Yo("right"),Pv=Yo("bottom"),Dv=Yo("left"),Ad={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(E,p){switch(p){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},Rv={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(E,p){switch(p){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},_v={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(E,p){return p.length===1&&$h(p[0],"none")?[]:os(p).map(function(b){for(var B={color:Ds.TRANSPARENT,offsetX:fi,offsetY:fi,blur:fi},_=0,j=0;j1?1:0],this.overflowWrap=Wt(p,Rs,b.overflowWrap),this.paddingTop=Wt(p,od,b.paddingTop),this.paddingRight=Wt(p,Uv,b.paddingRight),this.paddingBottom=Wt(p,Pv,b.paddingBottom),this.paddingLeft=Wt(p,Dv,b.paddingLeft),this.paintOrder=Wt(p,Ye,b.paintOrder),this.position=Wt(p,Rv,b.position),this.textAlign=Wt(p,Ad,b.textAlign),this.textDecorationColor=Wt(p,hd,(B=b.textDecorationColor)!==null&&B!==void 0?B:b.color),this.textDecorationLine=Wt(p,Vv,(_=b.textDecorationLine)!==null&&_!==void 0?_:b.textDecoration),this.textShadow=Wt(p,_v,b.textShadow),this.textTransform=Wt(p,ld,b.textTransform),this.transform=Wt(p,Hv,b.transform),this.transformOrigin=Wt(p,Gv,b.transformOrigin),this.visibility=Wt(p,ud,b.visibility),this.webkitTextStrokeColor=Wt(p,$v,b.webkitTextStrokeColor),this.webkitTextStrokeWidth=Wt(p,tp,b.webkitTextStrokeWidth),this.wordBreak=Wt(p,Kv,b.wordBreak),this.zIndex=Wt(p,ec,b.zIndex)}return E.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},E.prototype.isTransparent=function(){return vo(this.backgroundColor)},E.prototype.isTransformed=function(){return this.transform!==null},E.prototype.isPositioned=function(){return this.position!==0},E.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},E.prototype.isFloating=function(){return this.float!==0},E.prototype.isInlineLevel=function(){return Ur(this.display,4)||Ur(this.display,33554432)||Ur(this.display,268435456)||Ur(this.display,536870912)||Ur(this.display,67108864)||Ur(this.display,134217728)},E}(),ep=function(){function E(p,b){this.content=Wt(p,jv,b.content),this.quotes=Wt(p,Jv,b.quotes)}return E}(),Jo=function(){function E(p,b){this.counterIncrement=Wt(p,gd,b.counterIncrement),this.counterReset=Wt(p,Yv,b.counterReset)}return E}(),Wt=function(E,p,b){var B=new Er,_=b!==null&&typeof b!="undefined"?b.toString():p.initialValue;B.write(_);var j=new iv(B.read());switch(p.type){case 2:var tt=j.parseComponentValue();return p.parse(E,$n(tt)?tt.value:p.initialValue);case 0:return p.parse(E,j.parseComponentValue());case 1:return p.parse(E,j.parseComponentValues());case 4:return j.parseComponentValue();case 3:switch(p.format){case"angle":return WA.parse(E,j.parseComponentValue());case"color":return Ps.parse(E,j.parseComponentValue());case"image":return wu.parse(E,j.parseComponentValue());case"length":var dt=j.parseComponentValue();return Us(dt)?dt:fi;case"length-percentage":var lt=j.parseComponentValue();return Qr(lt)?lt:fi;case"time":return nc.parse(E,j.parseComponentValue())}break}},Br="data-html2canvas-debug",np=function(E){var p=E.getAttribute(Br);switch(p){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},we=function(E,p){var b=np(E);return b===1||p===b},Ba=function(){function E(p,b){if(this.context=p,this.textNodes=[],this.elements=[],this.flags=0,we(b,3))debugger;this.styles=new pd(p,window.getComputedStyle(b,null)),Ru(b)&&(this.styles.animationDuration.some(function(B){return B>0})&&(b.style.animationDuration="0s"),this.styles.transform!==null&&(b.style.transform="none")),this.bounds=N(this.context,b),we(b,4)&&(this.flags|=16)}return E}(),rp="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",rc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",_s=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),ic=0;ic>4,Ot[_++]=(tt&15)<<4|dt>>2,Ot[_++]=(dt&3)<<6|lt&63;return Tt},ac=function(E){for(var p=E.length,b=[],B=0;B>Hs,ap=1<>Hs,op=yd+sp,wd=op,Ed=32,Ap=wd+Ed,Kw=65536>>Su,zw=1<=0){if(p<55296||p>56319&&p<=65535)return b=this.index[p>>Hs],b=(b<>Hs)],b=(b<>Su),b=this.index[b],b+=p>>Hs&lp,b=this.index[b],b=(b<=55296&&_<=56319&&b>10)+55296,tt%1024+56320)),(_+1===b||B.length>16384)&&(j+=String.fromCharCode.apply(String,B),B.length=0)}return j},Td=Vw(rp),Aa="\xD7",Qu="\xF7",Zw=function(E){return Td.get(E)},jw=function(E,p,b){var B=b-2,_=p[B],j=p[b-1],tt=p[b];if(j===As&&tt===sc)return Aa;if(j===As||j===sc||j===Ou||tt===As||tt===sc||tt===Ou)return Qu;if(j===xd&&[xd,Cd,Nu,hp].indexOf(tt)!==-1||(j===Nu||j===Cd)&&(tt===Cd||tt===Lu)||(j===hp||j===Lu)&&tt===Lu||tt===dp||tt===bd||tt===Iu||j===Ww)return Aa;if(j===dp&&tt===ku){for(;_===bd;)_=p[--B];if(_===ku)return Aa}if(j===oc&&tt===oc){for(var dt=0;_===oc;)dt++,_=p[--B];if(dt%2===0)return Aa}return Qu},Yw=function(E){var p=Sd(E),b=p.length,B=0,_=0,j=p.map(Zw);return{next:function(){if(B>=b)return{done:!0,value:null};for(var tt=Aa;Btt.x||Ot.y>tt.y;return tt=Ot,Tt===0?!0:Dt});return E.body.removeChild(p),dt},qw=function(){return typeof new Image().crossOrigin!="undefined"},$w=function(){return typeof new XMLHttpRequest().responseType=="string"},tE=function(E){var p=new Image,b=E.createElement("canvas"),B=b.getContext("2d");if(!B)return!1;p.src="data:image/svg+xml,";try{B.drawImage(p,0,0),b.toDataURL()}catch(_){return!1}return!0},qo=function(E){return E[0]===0&&E[1]===255&&E[2]===0&&E[3]===255},Fd=function(E){var p=E.createElement("canvas"),b=100;p.width=b,p.height=b;var B=p.getContext("2d");if(!B)return Promise.reject(!1);B.fillStyle="rgb(0, 255, 0)",B.fillRect(0,0,b,b);var _=new Image,j=p.toDataURL();_.src=j;var tt=Uu(b,b,0,0,_);return B.fillStyle="red",B.fillRect(0,0,b,b),lc(tt).then(function(dt){B.drawImage(dt,0,0);var lt=B.getImageData(0,0,b,b).data;B.fillStyle="red",B.fillRect(0,0,b,b);var Tt=E.createElement("div");return Tt.style.backgroundImage="url("+j+")",Tt.style.height=b+"px",qo(lt)?lc(Uu(b,b,0,0,Tt)):Promise.reject(!1)}).then(function(dt){return B.drawImage(dt,0,0),qo(B.getImageData(0,0,b,b).data)}).catch(function(){return!1})},Uu=function(E,p,b,B,_){var j="http://www.w3.org/2000/svg",tt=document.createElementNS(j,"svg"),dt=document.createElementNS(j,"foreignObject");return tt.setAttributeNS(null,"width",E.toString()),tt.setAttributeNS(null,"height",p.toString()),dt.setAttributeNS(null,"width","100%"),dt.setAttributeNS(null,"height","100%"),dt.setAttributeNS(null,"x",b.toString()),dt.setAttributeNS(null,"y",B.toString()),dt.setAttributeNS(null,"externalResourcesRequired","true"),tt.appendChild(dt),dt.appendChild(_),tt},lc=function(E){return new Promise(function(p,b){var B=new Image;B.onload=function(){return p(B)},B.onerror=b,B.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(E))})},ni={get SUPPORT_RANGE_BOUNDS(){var E=Xw(document);return Object.defineProperty(ni,"SUPPORT_RANGE_BOUNDS",{value:E}),E},get SUPPORT_WORD_BREAKING(){var E=ni.SUPPORT_RANGE_BOUNDS&&Jw(document);return Object.defineProperty(ni,"SUPPORT_WORD_BREAKING",{value:E}),E},get SUPPORT_SVG_DRAWING(){var E=tE(document);return Object.defineProperty(ni,"SUPPORT_SVG_DRAWING",{value:E}),E},get SUPPORT_FOREIGNOBJECT_DRAWING(){var E=typeof Array.from=="function"&&typeof window.fetch=="function"?Fd(document):Promise.resolve(!1);return Object.defineProperty(ni,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:E}),E},get SUPPORT_CORS_IMAGES(){var E=qw();return Object.defineProperty(ni,"SUPPORT_CORS_IMAGES",{value:E}),E},get SUPPORT_RESPONSE_TYPE(){var E=$w();return Object.defineProperty(ni,"SUPPORT_RESPONSE_TYPE",{value:E}),E},get SUPPORT_CORS_XHR(){var E="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ni,"SUPPORT_CORS_XHR",{value:E}),E},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var E=!!(typeof Intl!="undefined"&&Intl.Segmenter);return Object.defineProperty(ni,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:E}),E}},cc=function(){function E(p,b){this.text=p,this.bounds=b}return E}(),fp=function(E,p,b,B){var _=Za(p,b),j=[],tt=0;return _.forEach(function(dt){if(b.textDecorationLine.length||dt.trim().length>0)if(ni.SUPPORT_RANGE_BOUNDS){var lt=ri(B,tt,dt.length).getClientRects();if(lt.length>1){var Tt=Wa(dt),Ot=0;Tt.forEach(function(Jt){j.push(new cc(Jt,I.fromDOMRectList(E,ri(B,Ot+tt,Jt.length).getClientRects()))),Ot+=Jt.length})}else j.push(new cc(dt,I.fromDOMRectList(E,lt)))}else{var Dt=B.splitText(dt.length);j.push(new cc(dt,gp(E,B))),B=Dt}else ni.SUPPORT_RANGE_BOUNDS||(B=B.splitText(dt.length));tt+=dt.length}),j},gp=function(E,p){var b=p.ownerDocument;if(b){var B=b.createElement("html2canvaswrapper");B.appendChild(p.cloneNode(!0));var _=p.parentNode;if(_){_.replaceChild(B,p);var j=N(E,B);return B.firstChild&&_.replaceChild(B.firstChild,B),j}}return I.EMPTY},ri=function(E,p,b){var B=E.ownerDocument;if(!B)throw new Error("Node has no owner document");var _=B.createRange();return _.setStart(E,p),_.setEnd(E,p+b),_},Wa=function(E){if(ni.SUPPORT_NATIVE_TEXT_SEGMENTATION){var p=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(p.segment(E)).map(function(b){return b.segment})}return Ac(E)},Gs=function(E,p){if(ni.SUPPORT_NATIVE_TEXT_SEGMENTATION){var b=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(b.segment(E)).map(function(B){return B.segment})}return uc(E,p)},Za=function(E,p){return p.letterSpacing!==0?Wa(E):Gs(E,p)},Vt=[32,160,4961,65792,65793,4153,4241],uc=function(E,p){for(var b=ut(E,{lineBreak:p.lineBreak,wordBreak:p.overflowWrap==="break-word"?"break-word":p.wordBreak}),B=[],_,j=function(){if(_.value){var tt=_.value.slice(),dt=k(tt),lt="";dt.forEach(function(Tt){Vt.indexOf(Tt)===-1?lt+=U(Tt):(lt.length&&B.push(lt),B.push(U(Tt)),lt="")}),lt.length&&B.push(lt)}};!(_=b.next()).done;)j();return B},ls=function(){function E(p,b,B){this.text=vp(b.data,B.textTransform),this.textBounds=fp(p,this.text,B,b)}return E}(),vp=function(E,p){switch(p){case 1:return E.toLowerCase();case 3:return E.replace(Pu,$o);case 2:return E.toUpperCase();default:return E}},Pu=/(^|\s|:|-|\(|\))([a-z])/g,$o=function(E,p,b){return E.length>0?p+b.toUpperCase():E},Od=function(E){M(p,E);function p(b,B){var _=E.call(this,b,B)||this;return _.src=B.currentSrc||B.src,_.intrinsicWidth=B.naturalWidth,_.intrinsicHeight=B.naturalHeight,_.context.cache.addImage(_.src),_}return p}(Ba),Id=function(E){M(p,E);function p(b,B){var _=E.call(this,b,B)||this;return _.canvas=B,_.intrinsicWidth=B.width,_.intrinsicHeight=B.height,_}return p}(Ba),Du=function(E){M(p,E);function p(b,B){var _=E.call(this,b,B)||this,j=new XMLSerializer,tt=N(b,B);return B.setAttribute("width",tt.width+"px"),B.setAttribute("height",tt.height+"px"),_.svg="data:image/svg+xml,"+encodeURIComponent(j.serializeToString(B)),_.intrinsicWidth=B.width.baseVal.value,_.intrinsicHeight=B.height.baseVal.value,_.context.cache.addImage(_.svg),_}return p}(Ba),hc=function(E){M(p,E);function p(b,B){var _=E.call(this,b,B)||this;return _.value=B.value,_}return p}(Ba),jn=function(E){M(p,E);function p(b,B){var _=E.call(this,b,B)||this;return _.start=B.start,_.reversed=typeof B.reversed=="boolean"&&B.reversed===!0,_}return p}(Ba),pp=[{type:15,flags:0,unit:"px",number:3}],tA=[{type:16,flags:0,number:50}],mp=function(E){return E.width>E.height?new I(E.left+(E.width-E.height)/2,E.top,E.height,E.height):E.width0)b.textNodes.push(new ls(E,_,b.styles));else if(us(_))if(pc(_)&&_.assignedNodes)_.assignedNodes().forEach(function(dt){return fc(E,dt,b,B)});else{var tt=Bi(E,_);tt.styles.isVisible()&&(eE(_,tt,B)?tt.flags|=4:nE(tt.styles)&&(tt.flags|=2),Un.indexOf(_.tagName)!==-1&&(tt.flags|=8),b.elements.push(tt),_.slot,_.shadowRoot?fc(E,_.shadowRoot,tt,B):!rA(_)&&!xa(_)&&!In(_)&&fc(E,_,tt,B))}},Bi=function(E,p){return vc(p)?new Od(E,p):nA(p)?new Id(E,p):xa(p)?new Du(E,p):_u(p)?new hc(E,p):yp(p)?new jn(E,p):wp(p)?new Ks(E,p):In(p)?new dc(E,p):rA(p)?new vi(E,p):Pd(p)?new Nd(E,p):new Ba(E,p)},kd=function(E,p){var b=Bi(E,p);return b.flags|=4,fc(E,p,b,b),b},eE=function(E,p,b){return p.styles.isPositionedWithZIndex()||p.styles.opacity<1||p.styles.isTransformed()||qi(E)&&b.styles.isTransparent()},nE=function(E){return E.isPositioned()||E.isFloating()},Qd=function(E){return E.nodeType===Node.TEXT_NODE},us=function(E){return E.nodeType===Node.ELEMENT_NODE},Ru=function(E){return us(E)&&typeof E.style!="undefined"&&!gc(E)},gc=function(E){return typeof E.className=="object"},_u=function(E){return E.tagName==="LI"},yp=function(E){return E.tagName==="OL"},wp=function(E){return E.tagName==="INPUT"},Ud=function(E){return E.tagName==="HTML"},xa=function(E){return E.tagName==="svg"},qi=function(E){return E.tagName==="BODY"},nA=function(E){return E.tagName==="CANVAS"},ze=function(E){return E.tagName==="VIDEO"},vc=function(E){return E.tagName==="IMG"},Pd=function(E){return E.tagName==="IFRAME"},Dd=function(E){return E.tagName==="STYLE"},Ep=function(E){return E.tagName==="SCRIPT"},rA=function(E){return E.tagName==="TEXTAREA"},In=function(E){return E.tagName==="SELECT"},pc=function(E){return E.tagName==="SLOT"},$i=function(E){return E.tagName.indexOf("-")>0},Rd=function(){function E(){this.counters={}}return E.prototype.getCounterValue=function(p){var b=this.counters[p];return b&&b.length?b[b.length-1]:1},E.prototype.getCounterValues=function(p){var b=this.counters[p];return b||[]},E.prototype.pop=function(p){var b=this;p.forEach(function(B){return b.counters[B].pop()})},E.prototype.parse=function(p){var b=this,B=p.counterIncrement,_=p.counterReset,j=!0;B!==null&&B.forEach(function(dt){var lt=b.counters[dt.counter];lt&&dt.increment!==0&&(j=!1,lt.length||lt.push(1),lt[Math.max(0,lt.length-1)]+=dt.increment)});var tt=[];return j&&_.forEach(function(dt){var lt=b.counters[dt.counter];tt.push(dt.counter),lt||(lt=b.counters[dt.counter]=[]),lt.push(dt.reset)}),tt},E}(),Hu={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Gu={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},Bp={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},mc={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},iA=function(E,p,b,B,_,j){return Eb?ds(E,_,j.length>0):B.integers.reduce(function(tt,dt,lt){for(;E>=dt;)E-=dt,tt+=B.values[lt];return tt},"")+j},aA=function(E,p,b,B){var _="";do b||E--,_=B(E)+_,E/=p;while(E*p>=p);return _},br=function(E,p,b,B,_){var j=b-p+1;return(E<0?"-":"")+(aA(Math.abs(E),j,B,function(tt){return U(Math.floor(tt%j)+p)})+_)},zs=function(E,p,b){b===void 0&&(b=". ");var B=p.length;return aA(Math.abs(E),B,!1,function(_){return p[Math.floor(_%B)]})+b},sA=1,hs=2,oe=4,mo=8,ja=function(E,p,b,B,_,j){if(E<-9999||E>9999)return ds(E,4,_.length>0);var tt=Math.abs(E),dt=_;if(tt===0)return p[0]+dt;for(var lt=0;tt>0&<<=4;lt++){var Tt=tt%10;Tt===0&&Ur(j,sA)&&dt!==""?dt=p[Tt]+dt:Tt>1||Tt===1&<===0||Tt===1&<===1&&Ur(j,hs)||Tt===1&<===1&&Ur(j,oe)&&E>100||Tt===1&<>1&&Ur(j,mo)?dt=p[Tt]+(lt>0?b[lt-1]:"")+dt:Tt===1&<>0&&(dt=b[lt-1]+dt),tt=Math.floor(tt/10)}return(E<0?B:"")+dt},oA="\u5341\u767E\u5343\u842C",AA="\u62FE\u4F70\u4EDF\u842C",JA="\u30DE\u30A4\u30CA\u30B9",Vs="\uB9C8\uC774\uB108\uC2A4",ds=function(E,p,b){var B=b?". ":"",_=b?"\u3001":"",j=b?", ":"",tt=b?" ":"";switch(p){case 0:return"\u2022"+tt;case 1:return"\u25E6"+tt;case 2:return"\u25FE"+tt;case 5:var dt=br(E,48,57,!0,B);return dt.length<4?"0"+dt:dt;case 4:return zs(E,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",_);case 6:return iA(E,1,3999,Hu,3,B).toLowerCase();case 7:return iA(E,1,3999,Hu,3,B);case 8:return br(E,945,969,!1,B);case 9:return br(E,97,122,!1,B);case 10:return br(E,65,90,!1,B);case 11:return br(E,1632,1641,!0,B);case 12:case 49:return iA(E,1,9999,Gu,3,B);case 35:return iA(E,1,9999,Gu,3,B).toLowerCase();case 13:return br(E,2534,2543,!0,B);case 14:case 30:return br(E,6112,6121,!0,B);case 15:return zs(E,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",_);case 16:return zs(E,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",_);case 17:case 48:return ja(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",oA,"\u8CA0",_,hs|oe|mo);case 47:return ja(E,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",AA,"\u8CA0",_,sA|hs|oe|mo);case 42:return ja(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",oA,"\u8D1F",_,hs|oe|mo);case 41:return ja(E,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",AA,"\u8D1F",_,sA|hs|oe|mo);case 26:return ja(E,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",JA,_,0);case 25:return ja(E,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",JA,_,sA|hs|oe);case 31:return ja(E,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",Vs,j,sA|hs|oe);case 33:return ja(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",Vs,j,0);case 32:return ja(E,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",Vs,j,sA|hs|oe);case 18:return br(E,2406,2415,!0,B);case 20:return iA(E,1,19999,mc,3,B);case 21:return br(E,2790,2799,!0,B);case 22:return br(E,2662,2671,!0,B);case 22:return iA(E,1,10999,Bp,3,B);case 23:return zs(E,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return zs(E,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return br(E,3302,3311,!0,B);case 28:return zs(E,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",_);case 29:return zs(E,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",_);case 34:return br(E,3792,3801,!0,B);case 37:return br(E,6160,6169,!0,B);case 38:return br(E,4160,4169,!0,B);case 39:return br(E,2918,2927,!0,B);case 40:return br(E,1776,1785,!0,B);case 43:return br(E,3046,3055,!0,B);case 44:return br(E,3174,3183,!0,B);case 45:return br(E,3664,3673,!0,B);case 46:return br(E,3872,3881,!0,B);case 3:default:return br(E,48,57,!0,B)}},Ca="data-html2canvas-ignore",_d=function(){function E(p,b,B){if(this.context=p,this.options=B,this.scrolledElements=[],this.referenceElement=b,this.counters=new Rd,this.quoteDepth=0,!b.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(b.ownerDocument.documentElement,!1)}return E.prototype.toIFrame=function(p,b){var B=this,_=bp(p,b);if(!_.contentWindow)return Promise.reject("Unable to find iframe window");var j=p.defaultView.pageXOffset,tt=p.defaultView.pageYOffset,dt=_.contentWindow,lt=dt.document,Tt=Sp(_).then(function(){return W(B,void 0,void 0,function(){var Ot,Dt;return H(this,function(Jt){switch(Jt.label){case 0:return this.scrolledElements.forEach(Fp),dt&&(dt.scrollTo(b.left,b.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(dt.scrollY!==b.top||dt.scrollX!==b.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(dt.scrollX-b.left,dt.scrollY-b.top,0,0))),Ot=this.options.onclone,Dt=this.clonedReferenceElement,typeof Dt=="undefined"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:lt.fonts&<.fonts.ready?[4,lt.fonts.ready]:[3,2];case 1:Jt.sent(),Jt.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,Cp(lt)]:[3,4];case 3:Jt.sent(),Jt.label=4;case 4:return typeof Ot=="function"?[2,Promise.resolve().then(function(){return Ot(lt,Dt)}).then(function(){return _})]:[2,_]}})})});return lt.open(),lt.write(Hd(document.doctype)+""),Tp(this.referenceElement.ownerDocument,j,tt),lt.replaceChild(lt.adoptNode(this.documentElement),lt.documentElement),lt.close(),Tt},E.prototype.createElementClone=function(p){if(we(p,2))debugger;if(nA(p))return this.createCanvasClone(p);if(ze(p))return this.createVideoClone(p);if(Dd(p))return this.createStyleClone(p);var b=p.cloneNode(!1);return vc(b)&&(vc(p)&&p.currentSrc&&p.currentSrc!==p.src&&(b.src=p.currentSrc,b.srcset=""),b.loading==="lazy"&&(b.loading="eager")),$i(b)?this.createCustomElementClone(b):b},E.prototype.createCustomElementClone=function(p){var b=document.createElement("html2canvascustomelement");return yc(p.style,b),b},E.prototype.createStyleClone=function(p){try{var b=p.sheet;if(b&&b.cssRules){var B=[].slice.call(b.cssRules,0).reduce(function(j,tt){return tt&&typeof tt.cssText=="string"?j+tt.cssText:j},""),_=p.cloneNode(!1);return _.textContent=B,_}}catch(j){if(this.context.logger.error("Unable to access cssRules property",j),j.name!=="SecurityError")throw j}return p.cloneNode(!1)},E.prototype.createCanvasClone=function(p){var b;if(this.options.inlineImages&&p.ownerDocument){var B=p.ownerDocument.createElement("img");try{return B.src=p.toDataURL(),B}catch(Tt){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",p)}}var _=p.cloneNode(!1);try{_.width=p.width,_.height=p.height;var j=p.getContext("2d"),tt=_.getContext("2d");if(tt)if(!this.options.allowTaint&&j)tt.putImageData(j.getImageData(0,0,p.width,p.height),0,0);else{var dt=(b=p.getContext("webgl2"))!==null&&b!==void 0?b:p.getContext("webgl");if(dt){var lt=dt.getContextAttributes();(lt==null?void 0:lt.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",p)}tt.drawImage(p,0,0)}return _}catch(Tt){this.context.logger.info("Unable to clone canvas as it is tainted",p)}return _},E.prototype.createVideoClone=function(p){var b=p.ownerDocument.createElement("canvas");b.width=p.offsetWidth,b.height=p.offsetHeight;var B=b.getContext("2d");try{return B&&(B.drawImage(p,0,0,b.width,b.height),this.options.allowTaint||B.getImageData(0,0,b.width,b.height)),b}catch(j){this.context.logger.info("Unable to clone video as it is tainted",p)}var _=p.ownerDocument.createElement("canvas");return _.width=p.offsetWidth,_.height=p.offsetHeight,_},E.prototype.appendChildNode=function(p,b,B){(!us(b)||!Ep(b)&&!b.hasAttribute(Ca)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(b)))&&(!this.options.copyStyles||!us(b)||!Dd(b))&&p.appendChild(this.cloneNode(b,B))},E.prototype.cloneChildNodes=function(p,b,B){for(var _=this,j=p.shadowRoot?p.shadowRoot.firstChild:p.firstChild;j;j=j.nextSibling)if(us(j)&&pc(j)&&typeof j.assignedNodes=="function"){var tt=j.assignedNodes();tt.length&&tt.forEach(function(dt){return _.appendChildNode(b,dt,B)})}else this.appendChildNode(b,j,B)},E.prototype.cloneNode=function(p,b){if(Qd(p))return document.createTextNode(p.data);if(!p.ownerDocument)return p.cloneNode(!1);var B=p.ownerDocument.defaultView;if(B&&us(p)&&(Ru(p)||gc(p))){var _=this.createElementClone(p);_.style.transitionProperty="none";var j=B.getComputedStyle(p),tt=B.getComputedStyle(p,":before"),dt=B.getComputedStyle(p,":after");this.referenceElement===p&&Ru(_)&&(this.clonedReferenceElement=_),qi(_)&&Op(_);var lt=this.counters.parse(new Jo(this.context,j)),Tt=this.resolvePseudoContent(p,_,tt,qA.BEFORE);$i(p)&&(b=!0),ze(p)||this.cloneChildNodes(p,_,b),Tt&&_.insertBefore(Tt,_.firstChild);var Ot=this.resolvePseudoContent(p,_,dt,qA.AFTER);return Ot&&_.appendChild(Ot),this.counters.pop(lt),(j&&(this.options.copyStyles||gc(p))&&!Pd(p)||b)&&yc(j,_),(p.scrollTop!==0||p.scrollLeft!==0)&&this.scrolledElements.push([_,p.scrollLeft,p.scrollTop]),(rA(p)||In(p))&&(rA(_)||In(_))&&(_.value=p.value),_}return p.cloneNode(!1)},E.prototype.resolvePseudoContent=function(p,b,B,_){var j=this;if(B){var tt=B.content,dt=b.ownerDocument;if(!(!dt||!tt||tt==="none"||tt==="-moz-alt-content"||B.display==="none")){this.counters.parse(new Jo(this.context,B));var lt=new ep(this.context,B),Tt=dt.createElement("html2canvaspseudoelement");yc(B,Tt),lt.content.forEach(function(Dt){if(Dt.type===0)Tt.appendChild(dt.createTextNode(Dt.value));else if(Dt.type===22){var Jt=dt.createElement("img");Jt.src=Dt.value,Jt.style.opacity="1",Tt.appendChild(Jt)}else if(Dt.type===18){if(Dt.name==="attr"){var Oe=Dt.values.filter($n);Oe.length&&Tt.appendChild(dt.createTextNode(p.getAttribute(Oe[0].value)||""))}else if(Dt.name==="counter"){var fe=Dt.values.filter(GA),Be=fe[0],an=fe[1];if(Be&&$n(Be)){var Ue=j.counters.getCounterValue(Be.value),Ne=an&&$n(an)?xu.parse(j.context,an.value):3;Tt.appendChild(dt.createTextNode(ds(Ue,Ne,!1)))}}else if(Dt.name==="counters"){var Mn=Dt.values.filter(GA),Be=Mn[0],An=Mn[1],an=Mn[2];if(Be&&$n(Be)){var Xe=j.counters.getCounterValues(Be.value),Fe=an&&$n(an)?xu.parse(j.context,an.value):3,bn=An&&An.type===0?An.value:"",xn=Xe.map(function(ai){return ds(ai,Fe,!1)}).join(bn);Tt.appendChild(dt.createTextNode(xn))}}}else if(Dt.type===20)switch(Dt.value){case"open-quote":Tt.appendChild(dt.createTextNode(vd(lt.quotes,j.quoteDepth++,!0)));break;case"close-quote":Tt.appendChild(dt.createTextNode(vd(lt.quotes,--j.quoteDepth,!1)));break;default:Tt.appendChild(dt.createTextNode(Dt.value))}}),Tt.className=Ec+" "+lA;var Ot=_===qA.BEFORE?" "+Ec:" "+lA;return gc(b)?b.className.baseValue+=Ot:b.className+=Ot,Tt}}},E.destroy=function(p){return p.parentNode?(p.parentNode.removeChild(p),!0):!1},E}(),qA;(function(E){E[E.BEFORE=0]="BEFORE",E[E.AFTER=1]="AFTER"})(qA||(qA={}));var bp=function(E,p){var b=E.createElement("iframe");return b.className="html2canvas-container",b.style.visibility="hidden",b.style.position="fixed",b.style.left="-10000px",b.style.top="0px",b.style.border="0",b.width=p.width.toString(),b.height=p.height.toString(),b.scrolling="no",b.setAttribute(Ca,"true"),E.body.appendChild(b),b},xp=function(E){return new Promise(function(p){if(E.complete){p();return}if(!E.src){p();return}E.onload=p,E.onerror=p})},Cp=function(E){return Promise.all([].slice.call(E.images,0).map(xp))},Sp=function(E){return new Promise(function(p,b){var B=E.contentWindow;if(!B)return b("No window assigned for iframe");var _=B.document;B.onload=E.onload=function(){B.onload=E.onload=null;var j=setInterval(function(){_.body.childNodes.length>0&&_.readyState==="complete"&&(clearInterval(j),p(E))},50)}})},Mp=["all","d","content"],yc=function(E,p){for(var b=E.length-1;b>=0;b--){var B=E.item(b);Mp.indexOf(B)===-1&&p.style.setProperty(B,E.getPropertyValue(B))}return p},Hd=function(E){var p="";return E&&(p+=""),p},Tp=function(E,p,b){E&&E.defaultView&&(p!==E.defaultView.pageXOffset||b!==E.defaultView.pageYOffset)&&E.defaultView.scrollTo(p,b)},Fp=function(E){var p=E[0],b=E[1],B=E[2];p.scrollLeft=b,p.scrollTop=B},Gd=":before",wc=":after",Ec="___html2canvas___pseudoelement_before",lA="___html2canvas___pseudoelement_after",Kd=`{ content: "" !important; display: none !important; }`,Op=function(E){ki(E,"."+Ec+Gd+Kd+` .`+lA+wc+Kd)},ki=function(E,p){var b=E.ownerDocument;if(b){var B=b.createElement("style");B.textContent=p,E.appendChild(B)}},Ku=function(){function E(){}return E.getOrigin=function(p){var b=E._link;return b?(b.href=p,b.href=b.href,b.protocol+b.hostname+b.port):"about:blank"},E.isSameOrigin=function(p){return E.getOrigin(p)===E._origin},E.setContext=function(p){E._link=p.document.createElement("a"),E._origin=E.getOrigin(p.location.href)},E._origin="about:blank",E}(),Ip=function(){function E(p,b){this.context=p,this._options=b,this._cache={}}return E.prototype.addImage=function(p){var b=Promise.resolve();return this.has(p)||(zu(p)||wo(p))&&(this._cache[p]=this.loadImage(p)).catch(function(){}),b},E.prototype.match=function(p){return this._cache[p]},E.prototype.loadImage=function(p){return W(this,void 0,void 0,function(){var b,B,_,j,tt=this;return H(this,function(dt){switch(dt.label){case 0:return b=Ku.isSameOrigin(p),B=!bc(p)&&this._options.useCORS===!0&&ni.SUPPORT_CORS_IMAGES&&!b,_=!bc(p)&&!b&&!zu(p)&&typeof this._options.proxy=="string"&&ni.SUPPORT_CORS_XHR&&!B,!b&&this._options.allowTaint===!1&&!bc(p)&&!zu(p)&&!_&&!B?[2]:(j=p,_?[4,this.proxy(j)]:[3,2]);case 1:j=dt.sent(),dt.label=2;case 2:return this.context.logger.debug("Added image "+p.substring(0,256)),[4,new Promise(function(lt,Tt){var Ot=new Image;Ot.onload=function(){return lt(Ot)},Ot.onerror=Tt,(Vd(j)||B)&&(Ot.crossOrigin="anonymous"),Ot.src=j,Ot.complete===!0&&setTimeout(function(){return lt(Ot)},500),tt._options.imageTimeout>0&&setTimeout(function(){return Tt("Timed out ("+tt._options.imageTimeout+"ms) loading image")},tt._options.imageTimeout)})];case 3:return[2,dt.sent()]}})})},E.prototype.has=function(p){return typeof this._cache[p]!="undefined"},E.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},E.prototype.proxy=function(p){var b=this,B=this._options.proxy;if(!B)throw new Error("No proxy defined");var _=p.substring(0,256);return new Promise(function(j,tt){var dt=ni.SUPPORT_RESPONSE_TYPE?"blob":"text",lt=new XMLHttpRequest;lt.onload=function(){if(lt.status===200)if(dt==="text")j(lt.response);else{var Dt=new FileReader;Dt.addEventListener("load",function(){return j(Dt.result)},!1),Dt.addEventListener("error",function(Jt){return tt(Jt)},!1),Dt.readAsDataURL(lt.response)}else tt("Failed to proxy resource "+_+" with status code "+lt.status)},lt.onerror=tt;var Tt=B.indexOf("?")>-1?"&":"?";if(lt.open("GET",""+B+Tt+"url="+encodeURIComponent(p)+"&responseType="+dt),dt!=="text"&< instanceof XMLHttpRequest&&(lt.responseType=dt),b._options.imageTimeout){var Ot=b._options.imageTimeout;lt.timeout=Ot,lt.ontimeout=function(){return tt("Timed out ("+Ot+"ms) proxying "+_)}}lt.send()})},E}(),zd=/^data:image\/svg\+xml/i,Bc=/^data:image\/.*;base64,/i,yo=/^data:image\/.*/i,wo=function(E){return ni.SUPPORT_SVG_DRAWING||!Sa(E)},bc=function(E){return yo.test(E)},Vd=function(E){return Bc.test(E)},zu=function(E){return E.substr(0,4)==="blob"},Sa=function(E){return E.substr(-3).toLowerCase()==="svg"||zd.test(E)},Se=function(){function E(p,b){this.type=0,this.x=p,this.y=b}return E.prototype.add=function(p,b){return new E(this.x+p,this.y+b)},E}(),fs=function(E,p,b){return new Se(E.x+(p.x-E.x)*b,E.y+(p.y-E.y)*b)},cA=function(){function E(p,b,B,_){this.type=1,this.start=p,this.startControl=b,this.endControl=B,this.end=_}return E.prototype.subdivide=function(p,b){var B=fs(this.start,this.startControl,p),_=fs(this.startControl,this.endControl,p),j=fs(this.endControl,this.end,p),tt=fs(B,_,p),dt=fs(_,j,p),lt=fs(tt,dt,p);return b?new E(this.start,B,tt,lt):new E(lt,dt,j,this.end)},E.prototype.add=function(p,b){return new E(this.start.add(p,b),this.startControl.add(p,b),this.endControl.add(p,b),this.end.add(p,b))},E.prototype.reverse=function(){return new E(this.end,this.endControl,this.startControl,this.start)},E}(),Ln=function(E){return E.type===1},ge=function(){function E(p){var b=p.styles,B=p.bounds,_=zA(b.borderTopLeftRadius,B.width,B.height),j=_[0],tt=_[1],dt=zA(b.borderTopRightRadius,B.width,B.height),lt=dt[0],Tt=dt[1],Ot=zA(b.borderBottomRightRadius,B.width,B.height),Dt=Ot[0],Jt=Ot[1],Oe=zA(b.borderBottomLeftRadius,B.width,B.height),fe=Oe[0],Be=Oe[1],an=[];an.push((j+lt)/B.width),an.push((fe+Dt)/B.width),an.push((tt+Be)/B.height),an.push((Tt+Jt)/B.height);var Ue=Math.max.apply(Math,an);Ue>1&&(j/=Ue,tt/=Ue,lt/=Ue,Tt/=Ue,Dt/=Ue,Jt/=Ue,fe/=Ue,Be/=Ue);var Ne=B.width-lt,Mn=B.height-Jt,An=B.width-Dt,Xe=B.height-Be,Fe=b.borderTopWidth,bn=b.borderRightWidth,xn=b.borderBottomWidth,Ze=b.borderLeftWidth,Fr=Gn(b.paddingTop,p.bounds.width),ai=Gn(b.paddingRight,p.bounds.width),Ui=Gn(b.paddingBottom,p.bounds.width),Kn=Gn(b.paddingLeft,p.bounds.width);this.topLeftBorderDoubleOuterBox=j>0||tt>0?Ar(B.left+Ze/3,B.top+Fe/3,j-Ze/3,tt-Fe/3,un.TOP_LEFT):new Se(B.left+Ze/3,B.top+Fe/3),this.topRightBorderDoubleOuterBox=j>0||tt>0?Ar(B.left+Ne,B.top+Fe/3,lt-bn/3,Tt-Fe/3,un.TOP_RIGHT):new Se(B.left+B.width-bn/3,B.top+Fe/3),this.bottomRightBorderDoubleOuterBox=Dt>0||Jt>0?Ar(B.left+An,B.top+Mn,Dt-bn/3,Jt-xn/3,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn/3,B.top+B.height-xn/3),this.bottomLeftBorderDoubleOuterBox=fe>0||Be>0?Ar(B.left+Ze/3,B.top+Xe,fe-Ze/3,Be-xn/3,un.BOTTOM_LEFT):new Se(B.left+Ze/3,B.top+B.height-xn/3),this.topLeftBorderDoubleInnerBox=j>0||tt>0?Ar(B.left+Ze*2/3,B.top+Fe*2/3,j-Ze*2/3,tt-Fe*2/3,un.TOP_LEFT):new Se(B.left+Ze*2/3,B.top+Fe*2/3),this.topRightBorderDoubleInnerBox=j>0||tt>0?Ar(B.left+Ne,B.top+Fe*2/3,lt-bn*2/3,Tt-Fe*2/3,un.TOP_RIGHT):new Se(B.left+B.width-bn*2/3,B.top+Fe*2/3),this.bottomRightBorderDoubleInnerBox=Dt>0||Jt>0?Ar(B.left+An,B.top+Mn,Dt-bn*2/3,Jt-xn*2/3,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn*2/3,B.top+B.height-xn*2/3),this.bottomLeftBorderDoubleInnerBox=fe>0||Be>0?Ar(B.left+Ze*2/3,B.top+Xe,fe-Ze*2/3,Be-xn*2/3,un.BOTTOM_LEFT):new Se(B.left+Ze*2/3,B.top+B.height-xn*2/3),this.topLeftBorderStroke=j>0||tt>0?Ar(B.left+Ze/2,B.top+Fe/2,j-Ze/2,tt-Fe/2,un.TOP_LEFT):new Se(B.left+Ze/2,B.top+Fe/2),this.topRightBorderStroke=j>0||tt>0?Ar(B.left+Ne,B.top+Fe/2,lt-bn/2,Tt-Fe/2,un.TOP_RIGHT):new Se(B.left+B.width-bn/2,B.top+Fe/2),this.bottomRightBorderStroke=Dt>0||Jt>0?Ar(B.left+An,B.top+Mn,Dt-bn/2,Jt-xn/2,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn/2,B.top+B.height-xn/2),this.bottomLeftBorderStroke=fe>0||Be>0?Ar(B.left+Ze/2,B.top+Xe,fe-Ze/2,Be-xn/2,un.BOTTOM_LEFT):new Se(B.left+Ze/2,B.top+B.height-xn/2),this.topLeftBorderBox=j>0||tt>0?Ar(B.left,B.top,j,tt,un.TOP_LEFT):new Se(B.left,B.top),this.topRightBorderBox=lt>0||Tt>0?Ar(B.left+Ne,B.top,lt,Tt,un.TOP_RIGHT):new Se(B.left+B.width,B.top),this.bottomRightBorderBox=Dt>0||Jt>0?Ar(B.left+An,B.top+Mn,Dt,Jt,un.BOTTOM_RIGHT):new Se(B.left+B.width,B.top+B.height),this.bottomLeftBorderBox=fe>0||Be>0?Ar(B.left,B.top+Xe,fe,Be,un.BOTTOM_LEFT):new Se(B.left,B.top+B.height),this.topLeftPaddingBox=j>0||tt>0?Ar(B.left+Ze,B.top+Fe,Math.max(0,j-Ze),Math.max(0,tt-Fe),un.TOP_LEFT):new Se(B.left+Ze,B.top+Fe),this.topRightPaddingBox=lt>0||Tt>0?Ar(B.left+Math.min(Ne,B.width-bn),B.top+Fe,Ne>B.width+bn?0:Math.max(0,lt-bn),Math.max(0,Tt-Fe),un.TOP_RIGHT):new Se(B.left+B.width-bn,B.top+Fe),this.bottomRightPaddingBox=Dt>0||Jt>0?Ar(B.left+Math.min(An,B.width-Ze),B.top+Math.min(Mn,B.height-xn),Math.max(0,Dt-bn),Math.max(0,Jt-xn),un.BOTTOM_RIGHT):new Se(B.left+B.width-bn,B.top+B.height-xn),this.bottomLeftPaddingBox=fe>0||Be>0?Ar(B.left+Ze,B.top+Math.min(Xe,B.height-xn),Math.max(0,fe-Ze),Math.max(0,Be-xn),un.BOTTOM_LEFT):new Se(B.left+Ze,B.top+B.height-xn),this.topLeftContentBox=j>0||tt>0?Ar(B.left+Ze+Kn,B.top+Fe+Fr,Math.max(0,j-(Ze+Kn)),Math.max(0,tt-(Fe+Fr)),un.TOP_LEFT):new Se(B.left+Ze+Kn,B.top+Fe+Fr),this.topRightContentBox=lt>0||Tt>0?Ar(B.left+Math.min(Ne,B.width+Ze+Kn),B.top+Fe+Fr,Ne>B.width+Ze+Kn?0:lt-Ze+Kn,Tt-(Fe+Fr),un.TOP_RIGHT):new Se(B.left+B.width-(bn+ai),B.top+Fe+Fr),this.bottomRightContentBox=Dt>0||Jt>0?Ar(B.left+Math.min(An,B.width-(Ze+Kn)),B.top+Math.min(Mn,B.height+Fe+Fr),Math.max(0,Dt-(bn+ai)),Jt-(xn+Ui),un.BOTTOM_RIGHT):new Se(B.left+B.width-(bn+ai),B.top+B.height-(xn+Ui)),this.bottomLeftContentBox=fe>0||Be>0?Ar(B.left+Ze+Kn,B.top+Xe,Math.max(0,fe-(Ze+Kn)),Be-(xn+Ui),un.BOTTOM_LEFT):new Se(B.left+Ze+Kn,B.top+B.height-(xn+Ui))}return E}(),un;(function(E){E[E.TOP_LEFT=0]="TOP_LEFT",E[E.TOP_RIGHT=1]="TOP_RIGHT",E[E.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",E[E.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(un||(un={}));var Ar=function(E,p,b,B,_){var j=4*((Math.sqrt(2)-1)/3),tt=b*j,dt=B*j,lt=E+b,Tt=p+B;switch(_){case un.TOP_LEFT:return new cA(new Se(E,Tt),new Se(E,Tt-dt),new Se(lt-tt,p),new Se(lt,p));case un.TOP_RIGHT:return new cA(new Se(E,p),new Se(E+tt,p),new Se(lt,Tt-dt),new Se(lt,Tt));case un.BOTTOM_RIGHT:return new cA(new Se(lt,p),new Se(lt,p+dt),new Se(E+tt,Tt),new Se(E,Tt));case un.BOTTOM_LEFT:default:return new cA(new Se(lt,Tt),new Se(lt-tt,Tt),new Se(E,p+dt),new Se(E,p))}},xc=function(E){return[E.topLeftBorderBox,E.topRightBorderBox,E.bottomRightBorderBox,E.bottomLeftBorderBox]},Lp=function(E){return[E.topLeftContentBox,E.topRightContentBox,E.bottomRightContentBox,E.bottomLeftContentBox]},gs=function(E){return[E.topLeftPaddingBox,E.topRightPaddingBox,E.bottomRightPaddingBox,E.bottomLeftPaddingBox]},Np=function(){function E(p,b,B){this.offsetX=p,this.offsetY=b,this.matrix=B,this.type=0,this.target=6}return E}(),Cc=function(){function E(p,b){this.path=p,this.target=b,this.type=1}return E}(),kp=function(){function E(p){this.opacity=p,this.type=2,this.target=6}return E}(),Qp=function(E){return E.type===0},Vu=function(E){return E.type===1},Wu=function(E){return E.type===2},$A=function(E,p){return E.length===p.length?E.some(function(b,B){return b===p[B]}):!1},Up=function(E,p,b,B,_){return E.map(function(j,tt){switch(tt){case 0:return j.add(p,b);case 1:return j.add(p+B,b);case 2:return j.add(p+B,b+_);case 3:return j.add(p,b+_)}return j})},vs=function(){function E(p){this.element=p,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return E}(),tl=function(){function E(p,b){if(this.container=p,this.parent=b,this.effects=[],this.curves=new ge(this.container),this.container.styles.opacity<1&&this.effects.push(new kp(this.container.styles.opacity)),this.container.styles.transform!==null){var B=this.container.bounds.left+this.container.styles.transformOrigin[0].number,_=this.container.bounds.top+this.container.styles.transformOrigin[1].number,j=this.container.styles.transform;this.effects.push(new Np(B,_,j))}if(this.container.styles.overflowX!==0){var tt=xc(this.curves),dt=gs(this.curves);$A(tt,dt)?this.effects.push(new Cc(tt,6)):(this.effects.push(new Cc(tt,2)),this.effects.push(new Cc(dt,4)))}}return E.prototype.getEffects=function(p){for(var b=[2,3].indexOf(this.container.styles.position)===-1,B=this.parent,_=this.effects.slice(0);B;){var j=B.effects.filter(function(lt){return!Vu(lt)});if(b||B.container.styles.position!==0||!B.parent){if(_.unshift.apply(_,j),b=[2,3].indexOf(B.container.styles.position)===-1,B.container.styles.overflowX!==0){var tt=xc(B.curves),dt=gs(B.curves);$A(tt,dt)||_.unshift(new Cc(dt,6))}}else _.unshift.apply(_,j);B=B.parent}return _.filter(function(lt){return Ur(lt.target,p)})},E}(),Qi=function(E,p,b,B){E.container.elements.forEach(function(_){var j=Ur(_.flags,4),tt=Ur(_.flags,2),dt=new tl(_,E);Ur(_.styles.display,2048)&&B.push(dt);var lt=Ur(_.flags,8)?[]:B;if(j||tt){var Tt=j||_.styles.isPositioned()?b:p,Ot=new vs(dt);if(_.styles.isPositioned()||_.styles.opacity<1||_.styles.isTransformed()){var Dt=_.styles.zIndex.order;if(Dt<0){var Jt=0;Tt.negativeZIndex.some(function(fe,Be){return Dt>fe.element.container.styles.zIndex.order?(Jt=Be,!1):Jt>0}),Tt.negativeZIndex.splice(Jt,0,Ot)}else if(Dt>0){var Oe=0;Tt.positiveZIndex.some(function(fe,Be){return Dt>=fe.element.container.styles.zIndex.order?(Oe=Be+1,!1):Oe>0}),Tt.positiveZIndex.splice(Oe,0,Ot)}else Tt.zeroOrAutoZIndexOrTransformedOrOpacity.push(Ot)}else _.styles.isFloating()?Tt.nonPositionedFloats.push(Ot):Tt.nonPositionedInlineLevel.push(Ot);Qi(dt,Ot,j?Ot:b,lt)}else _.styles.isInlineLevel()?p.inlineLevel.push(dt):p.nonInlineLevel.push(dt),Qi(dt,p,b,lt);Ur(_.flags,8)&&Wd(_,lt)})},Wd=function(E,p){for(var b=E instanceof jn?E.start:1,B=E instanceof jn?E.reversed:!1,_=0;_0&&b.intrinsicHeight>0){var j=uA(b),tt=gs(B);this.path(tt),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(_,0,0,b.intrinsicWidth,b.intrinsicHeight,j.left,j.top,j.width,j.height),this.ctx.restore()}},p.prototype.renderNodeContent=function(b){return W(this,void 0,void 0,function(){var B,_,j,tt,dt,lt,Ne,Ne,Tt,Ot,Dt,Jt,An,Oe,fe,Xe,Be,an,Ue,Ne,Mn,An,Xe;return H(this,function(Fe){switch(Fe.label){case 0:this.applyEffects(b.getEffects(4)),B=b.container,_=b.curves,j=B.styles,tt=0,dt=B.textNodes,Fe.label=1;case 1:return tt0&&zr>0&&(xn=j.ctx.createPattern(Xe,"repeat"),j.renderRepeat(Fr,xn,bi,si))):Cv(Ot)&&(Ze=Sc(b,B,[null,null,null]),Fr=Ze[0],ai=Ze[1],Ui=Ze[2],Kn=Ze[3],zr=Ze[4],Ws=Ot.position.length===0?[KA]:Ot.position,bi=Gn(Ws[0],Kn),si=Gn(Ws[Ws.length-1],zr),ps=Bw(Ot,bi,si,Kn,zr),Ta=ps[0],Zs=ps[1],Ta>0&&Zs>0&&(bo=j.ctx.createRadialGradient(ai+bi,Ui+si,0,ai+bi,Ui+si,Ta),dv(Ot.stops,Ta*2).forEach(function(Tc){return bo.addColorStop(Tc.stop,ei(Tc.color))}),j.path(Fr),j.ctx.fillStyle=bo,Ta!==Zs?(xo=b.bounds.left+.5*b.bounds.width,Ya=b.bounds.top+.5*b.bounds.height,Co=Zs/Ta,ms=1/Co,j.ctx.save(),j.ctx.translate(xo,Ya),j.ctx.transform(1,0,0,Co,0,0),j.ctx.translate(-xo,-Ya),j.ctx.fillRect(ai,ms*(Ui-Ya)+Ya,Kn,zr*ms),j.ctx.restore()):j.ctx.fill())),il.label=6;case 6:return B--,[2]}})},j=this,tt=0,dt=b.styles.backgroundImage.slice(0).reverse(),Tt.label=1;case 1:return tt0?Ot.style!==2?[3,5]:[4,this.renderDashedDottedBorder(Ot.color,Ot.width,dt,b.curves,2)]:[3,11]):[3,13];case 4:return Jt.sent(),[3,11];case 5:return Ot.style!==3?[3,7]:[4,this.renderDashedDottedBorder(Ot.color,Ot.width,dt,b.curves,3)];case 6:return Jt.sent(),[3,11];case 7:return Ot.style!==4?[3,9]:[4,this.renderDoubleBorder(Ot.color,Ot.width,dt,b.curves)];case 8:return Jt.sent(),[3,11];case 9:return[4,this.renderSolidBorder(Ot.color,dt,b.curves)];case 10:Jt.sent(),Jt.label=11;case 11:dt++,Jt.label=12;case 12:return lt++,[3,3];case 13:return[2]}})})},p.prototype.renderDashedDottedBorder=function(b,B,_,j,tt){return W(this,void 0,void 0,function(){var dt,lt,Tt,Ot,Dt,Jt,Oe,fe,Be,an,Ue,Ne,Mn,An,Xe,Fe,Xe,Fe;return H(this,function(bn){return this.ctx.save(),dt=ju(j,_),lt=_n(j,_),tt===2&&(this.path(lt),this.ctx.clip()),Ln(lt[0])?(Tt=lt[0].start.x,Ot=lt[0].start.y):(Tt=lt[0].x,Ot=lt[0].y),Ln(lt[1])?(Dt=lt[1].end.x,Jt=lt[1].end.y):(Dt=lt[1].x,Jt=lt[1].y),_===0||_===2?Oe=Math.abs(Tt-Dt):Oe=Math.abs(Ot-Jt),this.ctx.beginPath(),tt===3?this.formatPath(dt):this.formatPath(lt.slice(0,2)),fe=B<3?B*3:B*2,Be=B<3?B*2:B,tt===3&&(fe=B,Be=B),an=!0,Oe<=fe*2?an=!1:Oe<=fe*2+Be?(Ue=Oe/(2*fe+Be),fe*=Ue,Be*=Ue):(Ne=Math.floor((Oe+Be)/(fe+Be)),Mn=(Oe-Ne*fe)/(Ne-1),An=(Oe-(Ne+1)*fe)/Ne,Be=An<=0||Math.abs(Be-Mn)=0&&(M.splice instanceof Function||Object.getOwnPropertyDescriptor(M,M.length-1)&&M.constructor.name!=="String")}},15584:function(X,et,M){var O=M(73893),W=M(33152),H=O(W,"DataView");X.exports=H},97288:function(X,et,M){var O=M(73893),W=M(33152),H=O(W,"Promise");X.exports=H},23599:function(X,et,M){var O=M(73893),W=M(33152),H=O(W,"Set");X.exports=H},98924:function(X,et,M){var O=M(52166),W=M(34776),H=M(40393);function L(I){var N=-1,P=I==null?0:I.length;for(this.__data__=new O;++N-1}X.exports=W},94874:function(X){function et(M,O,W){for(var H=-1,L=M==null?0:M.length;++H0&&N(V)?I>1?H(V,I-1,N,P,k):O(k,V):P||(k[k.length]=V)}return k}X.exports=H},1585:function(X,et,M){var O=M(14018),W=M(55451);function H(L,I){return L&&O(L,I,W)}X.exports=H},89147:function(X,et,M){var O=M(1186),W=M(9171);function H(L,I){I=O(I,L);for(var N=0,P=I.length;L!=null&&NO}X.exports=et},3251:function(X){var et=Object.prototype,M=et.hasOwnProperty;function O(W,H){return W!=null&&M.call(W,H)}X.exports=O},62348:function(X){function et(M,O){return M!=null&&O in Object(M)}X.exports=et},17424:function(X,et,M){var O=M(51533),W=M(8373),H=M(49237);function L(I,N,P){return N===N?H(I,N,P):O(I,W,P)}X.exports=L},77295:function(X,et,M){var O=M(84412),W=M(93913);function H(L,I,N,P,k){return L===I?!0:L==null||I==null||!W(L)&&!W(I)?L!==L&&I!==I:O(L,I,N,P,H,k)}X.exports=H},84412:function(X,et,M){var O=M(91866),W=M(50401),H=M(57710),L=M(4983),I=M(66139),N=M(80744),P=M(57835),k=M(18397),U=1,Z="[object Arguments]",V="[object Array]",Y="[object Object]",nt=Object.prototype,rt=nt.hasOwnProperty;function ft(ct,it,vt,gt,yt,mt){var Mt=N(ct),Ct=N(it),Nt=Mt?V:I(ct),qt=Ct?V:I(it);Nt=Nt==Z?Y:Nt,qt=qt==Z?Y:qt;var Gt=Nt==Y,re=qt==Y,de=Nt==qt;if(de&&P(ct)){if(!P(it))return!1;Mt=!0,Gt=!1}if(de&&!Gt)return mt||(mt=new O),Mt||k(ct)?W(ct,it,vt,gt,yt,mt):H(ct,it,Nt,vt,gt,yt,mt);if(!(vt&U)){var ue=Gt&&rt.call(ct,"__wrapped__"),Me=re&&rt.call(it,"__wrapped__");if(ue||Me){var Ve=ue?ct.value():ct,dn=Me?it.value():it;return mt||(mt=new O),yt(Ve,dn,vt,gt,mt)}}return de?(mt||(mt=new O),L(ct,it,vt,gt,yt,mt)):!1}X.exports=ft},55005:function(X,et,M){var O=M(66139),W=M(93913),H="[object Map]";function L(I){return W(I)&&O(I)==H}X.exports=L},51524:function(X,et,M){var O=M(91866),W=M(77295),H=1,L=2;function I(N,P,k,U){var Z=k.length,V=Z,Y=!U;if(N==null)return!V;for(N=Object(N);Z--;){var nt=k[Z];if(Y&&nt[2]?nt[1]!==N[nt[0]]:!(nt[0]in N))return!1}for(;++Z=P){var vt=Z?null:I(U);if(vt)return N(vt);ft=!1,nt=L,it=new O}else it=Z?[]:ct;t:for(;++YL||k&&U&&V&&!Z&&!Y||N&&U&&V||!I&&V||!P)return 1;if(!N&&!k&&!Y&&H=Z)return V;var Y=I[N];return V*(Y=="desc"?-1:1)}}return H.index-L.index}X.exports=W},15168:function(X,et,M){var O=M(95378),W=M(58966);function H(L,I){return O(L,W(L),I)}X.exports=H},71678:function(X,et,M){var O=M(95378),W=M(66817);function H(L,I){return O(L,W(L),I)}X.exports=H},49164:function(X,et,M){var O=M(24665);function W(H,L){return function(I,N){if(I==null)return I;if(!O(I))return H(I,N);for(var P=I.length,k=L?P:-1,U=Object(I);(L?k--:++k-1?U[Z?N[V]:V]:void 0}}X.exports=L},76106:function(X,et,M){var O=M(36121),W=M(8138),H=M(97341);function L(I){return function(N,P,k){return k&&typeof k!="number"&&W(N,P,k)&&(P=k=void 0),N=H(N),P===void 0?(P=N,N=0):P=H(P),k=k===void 0?Nrt))return!1;var ct=Y.get(P),it=Y.get(k);if(ct&&it)return ct==k&&it==P;var vt=-1,gt=!0,yt=U&I?new O:void 0;for(Y.set(P,k),Y.set(k,P);++vt2?U[2]:void 0;for(Y&&H(U[0],U[1],Y)&&(V=1);++Z1&&L(N,P[0],P[1])?P=[]:k>2&&L(P[0],P[1],P[2])&&(P=[P[0]]),W(N,O(P,1),[])});X.exports=I},4134:function(X){function et(){return[]}X.exports=et},97341:function(X,et,M){var O=M(59406),W=1/0,H=17976931348623157e292;function L(I){if(!I)return I===0?I:0;if(I=O(I),I===W||I===-W){var N=I<0?-1:1;return N*H}return I===I?I:0}X.exports=L},12824:function(X,et,M){var O=M(97341);function W(H){var L=O(H),I=L%1;return L===L?I?L-I:L:0}X.exports=W},59406:function(X,et,M){var O=M(13927),W=M(20816),H=M(45029),L=NaN,I=/^[-+]0x[0-9a-f]+$/i,N=/^0b[01]+$/i,P=/^0o[0-7]+$/i,k=parseInt;function U(Z){if(typeof Z=="number")return Z;if(H(Z))return L;if(W(Z)){var V=typeof Z.valueOf=="function"?Z.valueOf():Z;Z=W(V)?V+"":V}if(typeof Z!="string")return Z===0?Z:+Z;Z=O(Z);var Y=N.test(Z);return Y||P.test(Z)?k(Z.slice(2),Y?2:8):I.test(Z)?L:+Z}X.exports=U},44140:function(X,et,M){var O=M(50230);function W(H){return H==null?"":O(H)}X.exports=W},91116:function(X,et,M){var O=M(74809),W=M(35024),H=M(1585),L=M(95979),I=M(49217),N=M(80744),P=M(57835),k=M(9363),U=M(20816),Z=M(18397);function V(Y,nt,rt){var ft=N(Y),ct=ft||P(Y)||Z(Y);if(nt=L(nt,4),rt==null){var it=Y&&Y.constructor;ct?rt=ft?new it:[]:U(Y)?rt=k(it)?W(I(Y)):{}:rt={}}return(ct?O:H)(Y,function(vt,gt,yt){return nt(rt,vt,gt,yt)}),rt}X.exports=V},44065:function(X,et,M){var O=M(9256),W=M(92918),H=M(29098),L=M(41590),I=W(function(N){return H(O(N,1,L,!0))});X.exports=I},95708:function(X,et,M){var O=M(44140),W=0;function H(L){var I=++W;return O(L)+I}X.exports=H},81229:function(X,et,M){var O=M(20720),W=M(55451);function H(L){return L==null?[]:O(L,W(L))}X.exports=H},65441:function(X,et,M){var O=M(60348),W=M(94484);function H(L,I){return W(L||[],I||[],O)}X.exports=H},34402:function(X,et,M){"use strict";M.r(et),M.d(et,{default:function(){return L}});var O=M(34634);function W(I){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,O.isAnyArray)(I))throw new TypeError("input must be an array");if(I.length===0)throw new TypeError("input must not be empty");var P=N.fromIndex,k=P===void 0?0:P,U=N.toIndex,Z=U===void 0?I.length:U;if(k<0||k>=I.length||!Number.isInteger(k))throw new Error("fromIndex must be a positive integer smaller than length");if(Z<=k||Z>I.length||!Number.isInteger(Z))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var V=I[k],Y=k+1;YV&&(V=I[Y]);return V}function H(I){var N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,O.isAnyArray)(I))throw new TypeError("input must be an array");if(I.length===0)throw new TypeError("input must not be empty");var P=N.fromIndex,k=P===void 0?0:P,U=N.toIndex,Z=U===void 0?I.length:U;if(k<0||k>=I.length||!Number.isInteger(k))throw new Error("fromIndex must be a positive integer smaller than length");if(Z<=k||Z>I.length||!Number.isInteger(Z))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var V=I[k],Y=k+1;Y1&&arguments[1]!==void 0?arguments[1]:{};if((0,O.isAnyArray)(I)){if(I.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var P;if(N.output!==void 0){if(!(0,O.isAnyArray)(N.output))throw new TypeError("output option must be an array if specified");P=N.output}else P=new Array(I.length);var k=H(I),U=W(I);if(k===U)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var Z=N.min,V=Z===void 0?N.autoMinMax?k:0:Z,Y=N.max,nt=Y===void 0?N.autoMinMax?U:1:Y;if(V>=nt)throw new RangeError("min option must be smaller than max option");for(var rt=(nt-V)/(U-k),ft=0;ft{}};function O(){for(var N=0,P=arguments.length,k={},U;N=0&&(U=k.slice(Z+1),k=k.slice(0,Z)),k&&!P.hasOwnProperty(k))throw new Error("unknown type: "+k);return{type:k,name:U}})}W.prototype=O.prototype={constructor:W,on:function(N,P){var k=this._,U=H(N+"",k),Z,V=-1,Y=U.length;if(arguments.length<2){for(;++V0)for(var k=new Array(Z),U=0,Z,V;U=(vt=(Y+ft)/2))?Y=vt:ft=vt,(qt=N>=(gt=(nt+ct)/2))?nt=gt:ct=gt,(Gt=P>=(yt=(rt+it)/2))?rt=yt:it=yt,U=Z,!(Z=Z[re=Gt<<2|qt<<1|Nt]))return U[re]=V,L;if(mt=+L._x.call(null,Z.data),Mt=+L._y.call(null,Z.data),Ct=+L._z.call(null,Z.data),I===mt&&N===Mt&&P===Ct)return V.next=Z,U?U[re]=V:L._root=V,L;do U=U?U[re]=new Array(8):L._root=new Array(8),(Nt=I>=(vt=(Y+ft)/2))?Y=vt:ft=vt,(qt=N>=(gt=(nt+ct)/2))?nt=gt:ct=gt,(Gt=P>=(yt=(rt+it)/2))?rt=yt:it=yt;while((re=Gt<<2|qt<<1|Nt)===(de=(Ct>=yt)<<2|(Mt>=gt)<<1|mt>=vt));return U[de]=Z,U[re]=V,L}function H(L){Array.isArray(L)||(L=Array.from(L));const I=L.length,N=new Float64Array(I),P=new Float64Array(I),k=new Float64Array(I);let U=1/0,Z=1/0,V=1/0,Y=-1/0,nt=-1/0,rt=-1/0;for(let ft=0,ct,it,vt,gt;ftY&&(Y=it),vtnt&&(nt=vt),gtrt&&(rt=gt));if(U>Y||Z>nt||V>rt)return this;this.cover(U,Z,V).cover(Y,nt,rt);for(let ft=0;ftW||W>=k||N>H||H>=U||P>L||L>=Z;)switch(rt=(Lit||(Y=Mt.y0)>vt||(nt=Mt.z0)>gt||(rt=Mt.x1)=Gt)<<2|(L>=qt)<<1|H>=Nt)&&(Mt=yt[yt.length-1],yt[yt.length-1]=yt[yt.length-1-Ct],yt[yt.length-1-Ct]=Mt)}else{var re=H-+this._x.call(null,mt.data),de=L-+this._y.call(null,mt.data),ue=I-+this._z.call(null,mt.data),Me=re*re+de*de+ue*ue;if(MeMath.sqrt(QA(H-N,2)+QA(L-P,2)+QA(I-k,2));function W(H,L,I,N){const P=[],k=H-N,U=L-N,Z=I-N,V=H+N,Y=L+N,nt=I+N;return this.visit((rt,ft,ct,it,vt,gt,yt)=>{if(!rt.length)do{const mt=rt.data;O(H,L,I,this._x(mt),this._y(mt),this._z(mt))<=N&&P.push(mt)}while(rt=rt.next);return ft>V||ct>Y||it>nt||vt=(vt=(U+Y)/2))?U=vt:Y=vt,(Mt=ct>=(gt=(Z+nt)/2))?Z=gt:nt=gt,(Ct=it>=(yt=(V+rt)/2))?V=yt:rt=yt,L=I,!(I=I[Nt=Ct<<2|Mt<<1|mt]))return this;if(!I.length)break;(L[Nt+1&7]||L[Nt+2&7]||L[Nt+3&7]||L[Nt+4&7]||L[Nt+5&7]||L[Nt+6&7]||L[Nt+7&7])&&(N=L,qt=Nt)}for(;I.data!==H;)if(P=I,!(I=I.next))return this;return(k=I.next)&&delete I.next,P?(k?P.next=k:delete P.next,this):L?(k?L[Nt]=k:delete L[Nt],(I=L[0]||L[1]||L[2]||L[3]||L[4]||L[5]||L[6]||L[7])&&I===(L[7]||L[6]||L[5]||L[4]||L[3]||L[2]||L[1]||L[0])&&!I.length&&(N?N[qt]=I:this._root=I),this):(this._root=k,this)}function W(H){for(var L=0,I=H.length;L=(ft=(V+nt)/2))?V=ft:nt=ft,(yt=N>=(ct=(Y+rt)/2))?Y=ct:rt=ct,k=U,!(U=U[mt=yt<<1|gt]))return k[mt]=Z,L;if(it=+L._x.call(null,U.data),vt=+L._y.call(null,U.data),I===it&&N===vt)return Z.next=U,k?k[mt]=Z:L._root=Z,L;do k=k?k[mt]=new Array(4):L._root=new Array(4),(gt=I>=(ft=(V+nt)/2))?V=ft:nt=ft,(yt=N>=(ct=(Y+rt)/2))?Y=ct:rt=ct;while((mt=yt<<1|gt)===(Mt=(vt>=ct)<<1|it>=ft));return k[Mt]=U,k[mt]=Z,L}function H(L){var I,N,P=L.length,k,U,Z=new Array(P),V=new Array(P),Y=1/0,nt=1/0,rt=-1/0,ft=-1/0;for(N=0;Nrt&&(rt=k),Uft&&(ft=U));if(Y>rt||nt>ft)return this;for(this.cover(Y,nt).cover(rt,ft),N=0;NW||W>=N||I>H||H>=P;)switch(V=(Hnt||(Z=it.y0)>rt||(V=it.x1)=yt)<<1|H>=gt)&&(it=ft[ft.length-1],ft[ft.length-1]=ft[ft.length-1-vt],ft[ft.length-1-vt]=it)}else{var mt=H-+this._x.call(null,ct.data),Mt=L-+this._y.call(null,ct.data),Ct=mt*mt+Mt*Mt;if(Ct=(ft=(U+V)/2))?U=ft:V=ft,(vt=rt>=(ct=(Z+Y)/2))?Z=ct:Y=ct,L=I,!(I=I[gt=vt<<1|it]))return this;if(!I.length)break;(L[gt+1&3]||L[gt+2&3]||L[gt+3&3])&&(N=L,yt=gt)}for(;I.data!==H;)if(P=I,!(I=I.next))return this;return(k=I.next)&&delete I.next,P?(k?P.next=k:delete P.next,this):L?(k?L[gt]=k:delete L[gt],(I=L[0]||L[1]||L[2]||L[3])&&I===(L[3]||L[2]||L[1]||L[0])&&!I.length&&(N?N[yt]=I:this._root=I),this):(this._root=k,this)}function W(H){for(var L=0,I=H.length;L=0&&mt._call.call(void 0,Mt),mt=mt._next;--O}function it(){k=(P=Z.now())+U,O=W=0;try{ct()}finally{O=0,gt(),k=0}}function vt(){var mt=Z.now(),Mt=mt-P;Mt>L&&(U-=Mt,P=mt)}function gt(){for(var mt,Mt=I,Ct,Nt=1/0;Mt;)Mt._call?(Nt>Mt._time&&(Nt=Mt._time),mt=Mt,Mt=Mt._next):(Ct=Mt._next,Mt._next=null,Mt=mt?mt._next=Ct:I=Ct);N=mt,yt(Nt)}function yt(mt){if(!O){W&&(W=clearTimeout(W));var Mt=mt-k;Mt>24?(mt<1/0&&(W=setTimeout(it,mt-Z.now()-U)),H&&(H=clearInterval(H))):(H||(P=Z.now(),H=setInterval(vt,L)),O=1,V(it))}}},80813:function(X,et,M){"use strict";M.d(et,{CR:function(){return it},Jh:function(){return nt},Q_:function(){return Me},XA:function(){return ct},ZT:function(){return W},_T:function(){return L},ev:function(){return yt},mG:function(){return Y},pi:function(){return H},pr:function(){return gt}});var O=function(Ht,zt){return O=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(Zt,Et){Zt.__proto__=Et}||function(Zt,Et){for(var It in Et)Object.prototype.hasOwnProperty.call(Et,It)&&(Zt[It]=Et[It])},O(Ht,zt)};function W(Ht,zt){if(typeof zt!="function"&&zt!==null)throw new TypeError("Class extends value "+String(zt)+" is not a constructor or null");O(Ht,zt);function Zt(){this.constructor=Ht}Ht.prototype=zt===null?Object.create(zt):(Zt.prototype=zt.prototype,new Zt)}var H=function(){return H=Object.assign||function(zt){for(var Zt,Et=1,It=arguments.length;Et=0;be--)(ne=Ht[be])&&(Ut=(It<3?ne(Ut):It>3?ne(zt,Zt,Ut):ne(zt,Zt))||Ut);return It>3&&Ut&&Object.defineProperty(zt,Zt,Ut),Ut}function N(Ht,zt){return function(Zt,Et){zt(Zt,Et,Ht)}}function P(Ht,zt,Zt,Et,It,Ut){function ne(Gr){if(Gr!==void 0&&typeof Gr!="function")throw new TypeError("Function expected");return Gr}for(var be=Et.kind,_e=be==="getter"?"get":be==="setter"?"set":"value",Te=!zt&&Ht?Et.static?Ht:Ht.prototype:null,rn=zt||(Te?Object.getOwnPropertyDescriptor(Te,Et.name):{}),rr,sr=!1,Ge=Zt.length-1;Ge>=0;Ge--){var Ke={};for(var me in Et)Ke[me]=me==="access"?{}:Et[me];for(var me in Et.access)Ke.access[me]=Et.access[me];Ke.addInitializer=function(Gr){if(sr)throw new TypeError("Cannot add initializers after decoration has completed");Ut.push(ne(Gr||null))};var We=(0,Zt[Ge])(be==="accessor"?{get:rn.get,set:rn.set}:rn[_e],Ke);if(be==="accessor"){if(We===void 0)continue;if(We===null||typeof We!="object")throw new TypeError("Object expected");(rr=ne(We.get))&&(rn.get=rr),(rr=ne(We.set))&&(rn.set=rr),(rr=ne(We.init))&&It.unshift(rr)}else(rr=ne(We))&&(be==="field"?It.unshift(rr):rn[_e]=rr)}Te&&Object.defineProperty(Te,Et.name,rn),sr=!0}function k(Ht,zt,Zt){for(var Et=arguments.length>2,It=0;It0&&Ut[Ut.length-1])&&(Te[0]===6||Te[0]===2)){Zt=0;continue}if(Te[0]===3&&(!Ut||Te[1]>Ut[0]&&Te[1]=Ht.length&&(Ht=void 0),{value:Ht&&Ht[Et++],done:!Ht}}};throw new TypeError(zt?"Object is not iterable.":"Symbol.iterator is not defined.")}function it(Ht,zt){var Zt=typeof Symbol=="function"&&Ht[Symbol.iterator];if(!Zt)return Ht;var Et=Zt.call(Ht),It,Ut=[],ne;try{for(;(zt===void 0||zt-- >0)&&!(It=Et.next()).done;)Ut.push(It.value)}catch(be){ne={error:be}}finally{try{It&&!It.done&&(Zt=Et.return)&&Zt.call(Et)}finally{if(ne)throw ne.error}}return Ut}function vt(){for(var Ht=[],zt=0;zt1||_e(Ge,me)})},Ke&&(It[Ge]=Ke(It[Ge])))}function _e(Ge,Ke){try{Te(Et[Ge](Ke))}catch(me){sr(Ut[0][3],me)}}function Te(Ge){Ge.value instanceof mt?Promise.resolve(Ge.value.v).then(rn,rr):sr(Ut[0][2],Ge)}function rn(Ge){_e("next",Ge)}function rr(Ge){_e("throw",Ge)}function sr(Ge,Ke){Ge(Ke),Ut.shift(),Ut.length&&_e(Ut[0][0],Ut[0][1])}}function Ct(Ht){var zt,Zt;return zt={},Et("next"),Et("throw",function(It){throw It}),Et("return"),zt[Symbol.iterator]=function(){return this},zt;function Et(It,Ut){zt[It]=Ht[It]?function(ne){return(Zt=!Zt)?{value:mt(Ht[It](ne)),done:!1}:Ut?Ut(ne):ne}:Ut}}function Nt(Ht){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt=Ht[Symbol.asyncIterator],Zt;return zt?zt.call(Ht):(Ht=typeof ct=="function"?ct(Ht):Ht[Symbol.iterator](),Zt={},Et("next"),Et("throw"),Et("return"),Zt[Symbol.asyncIterator]=function(){return this},Zt);function Et(Ut){Zt[Ut]=Ht[Ut]&&function(ne){return new Promise(function(be,_e){ne=Ht[Ut](ne),It(be,_e,ne.done,ne.value)})}}function It(Ut,ne,be,_e){Promise.resolve(_e).then(function(Te){Ut({value:Te,done:be})},ne)}}function qt(Ht,zt){return Object.defineProperty?Object.defineProperty(Ht,"raw",{value:zt}):Ht.raw=zt,Ht}var Gt=Object.create?function(Ht,zt){Object.defineProperty(Ht,"default",{enumerable:!0,value:zt})}:function(Ht,zt){Ht.default=zt},re=function(Ht){return re=Object.getOwnPropertyNames||function(zt){var Zt=[];for(var Et in zt)Object.prototype.hasOwnProperty.call(zt,Et)&&(Zt[Zt.length]=Et);return Zt},re(Ht)};function de(Ht){if(Ht&&Ht.__esModule)return Ht;var zt={};if(Ht!=null)for(var Zt=re(Ht),Et=0;Et