!(function(){var YB=Object.defineProperty,HB=Object.defineProperties;var XB=Object.getOwnPropertyDescriptors;var cw=Object.getOwnPropertySymbols;var KB=Object.prototype.hasOwnProperty,QB=Object.prototype.propertyIsEnumerable;var is=Math.pow,Y0=(U,Q,S)=>Q in U?YB(U,Q,{enumerable:!0,configurable:!0,writable:!0,value:S}):U[Q]=S,Bo=(U,Q)=>{for(var S in Q||(Q={}))KB.call(Q,S)&&Y0(U,S,Q[S]);if(cw)for(var S of cw(Q))QB.call(Q,S)&&Y0(U,S,Q[S]);return U},H0=(U,Q)=>HB(U,XB(Q));var Cn=(U,Q,S)=>Y0(U,typeof Q!="symbol"?Q+"":Q,S);(self.webpackChunk=self.webpackChunk||[]).push([[8305],{66083:function(U,Q,S){"use strict";S.d(Q,{kJ:function(){return sd},RN:function(){return NB}});var A={};S.r(A),S.d(A,{add:function(){return gw},adjoint:function(){return Mt},clone:function(){return ue},copy:function(){return we},create:function(){return Wt},decompose:function(){return bd},determinant:function(){return Yt},equals:function(){return yw},exactEquals:function(){return Sd},frob:function(){return vw},fromQuat:function(){return Wo},fromQuat2:function(){return _r},fromRotation:function(){return ti},fromRotationTranslation:function(){return Mr},fromRotationTranslationScale:function(){return xd},fromRotationTranslationScaleOrigin:function(){return hs},fromScaling:function(){return gn},fromTranslation:function(){return Xn},fromValues:function(){return Ae},fromXRotation:function(){return vi},fromYRotation:function(){return ze},fromZRotation:function(){return Fn},frustum:function(){return Ed},getRotation:function(){return Js},getScaling:function(){return Na},getTranslation:function(){return Tn},identity:function(){return ge},invert:function(){return Ze},lookAt:function(){return og},mul:function(){return cg},multiply:function(){return Jt},multiplyScalar:function(){return pw},multiplyScalarAndAdd:function(){return mw},ortho:function(){return ag},orthoNO:function(){return ig},orthoZO:function(){return sg},perspective:function(){return wd},perspectiveFromFieldOfView:function(){return hw},perspectiveNO:function(){return Kl},perspectiveZO:function(){return uw},rotate:function(){return $e},rotateX:function(){return hn},rotateY:function(){return vn},rotateZ:function(){return nr},scale:function(){return fn},set:function(){return un},str:function(){return fw},sub:function(){return bw},subtract:function(){return lg},targetTo:function(){return dw},translate:function(){return Ht},transpose:function(){return be}});var Z={};S.r(Z),S.d(Z,{circle:function(){return A3},diamond:function(){return T3},rect:function(){return C3},simple:function(){return k3},triangle:function(){return y1},triangleRect:function(){return N3},vee:function(){return O3}});var B=S(33885),N=S(67732),T=S(83652),k=S(94480),_=S(22214),C=S(42403),L=S(42978),z=S(37271),D=z,W=1e-6,X=typeof Float32Array!="undefined"?Float32Array:Array,K=Math.random,rt="zyx";function nt(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}function q(r){X=r}var it=Math.PI/180,at=180/Math.PI;function ut(r){return r*it}function ht(r){return r*at}function xt(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:W;return Math.abs(r-t)<=e*Math.max(1,Math.abs(r),Math.abs(t))}function pt(){var r=new X(3);return X!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function wt(r){var t=new X(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function gt(r){var t=r[0],e=r[1],n=r[2];return Math.sqrt(t*t+e*e+n*n)}function Et(r,t,e){var n=new X(3);return n[0]=r,n[1]=t,n[2]=e,n}function kt(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function zt(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function Ut(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Qt(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function Ee(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function Le(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r}function tn(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r}function er(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r}function $r(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 ca(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 as(r,t){return r[0]=glMatrix.round(t[0]),r[1]=glMatrix.round(t[1]),r[2]=glMatrix.round(t[2]),r}function Pt(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r}function _t(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 It(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 dt(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 St(r){var t=r[0],e=r[1],n=r[2];return t*t+e*e+n*n}function Ct(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r}function Gt(r,t){return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r}function oe(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 ye(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function de(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],l=e[2];return r[0]=i*l-a*o,r[1]=a*s-n*l,r[2]=n*o-i*s,r}function _e(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 Mn(r,t,e,n){var i=Math.acos(Math.min(Math.max(ye(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 Nn(r,t,e,n,i,a){var s=a*a,o=s*(2*a-3)+1,l=s*(a-2)+a,c=s*(a-1),u=s*(3-2*a);return r[0]=t[0]*o+e[0]*l+n[0]*c+i[0]*u,r[1]=t[1]*o+e[1]*l+n[1]*c+i[1]*u,r[2]=t[2]*o+e[2]*l+n[2]*c+i[2]*u,r}function Pe(r,t,e,n,i,a){var s=1-a,o=s*s,l=a*a,c=o*s,u=3*a*o,h=3*l*s,d=l*a;return r[0]=t[0]*c+e[0]*u+n[0]*h+i[0]*d,r[1]=t[1]*c+e[1]*u+n[1]*h+i[1]*d,r[2]=t[2]*c+e[2]*u+n[2]*h+i[2]*d,r}function Se(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 re(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 Oe(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 cr(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-n*c,d=n*l-i*o;return u=u+u,h=h+h,d=d+d,r[0]=o+s*u+i*d-a*h,r[1]=l+s*h+a*u-n*d,r[2]=c+s*d+n*h-i*u,r}function ua(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 ne(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 ss(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 Rr(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2],l=Math.sqrt((e*e+n*n+i*i)*(a*a+s*s+o*o)),c=l&&ye(r,t)/l;return Math.acos(Math.min(Math.max(c,-1),1))}function Hn(r){return r[0]=0,r[1]=0,r[2]=0,r}function Lr(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function os(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function ha(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)<=W*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=W*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=W*Math.max(1,Math.abs(i),Math.abs(o))}var qs=Qt,da=null,Fo=null,ls=It,cs=null,us=gt,Ti=null,Oi=function(){var r=pt();return function(t,e,n,i,a,s){var o,l;for(e||(e=3),n||(n=0),i?l=Math.min(i*e+n,t.length):l=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 H(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],l=e[1]*n[3]-e[3]*n[1],c=e[2]*n[3]-e[3]*n[2],u=t[0],h=t[1],d=t[2],f=t[3];return r[0]=h*c-d*l+f*o,r[1]=-(u*c)+d*s-f*a,r[2]=u*l-h*s+f*i,r[3]=-(u*o)+h*a-d*i,r}function w(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 m(r,t){t=t===void 0?1:t;var e,n,i,a,s,o,l;l=glMatrix.RANDOM(),e=l*2-1,n=(4*glMatrix.RANDOM()-2)*Math.sqrt(l*-l+l),s=e*e+n*n,l=glMatrix.RANDOM(),i=l*2-1,a=(4*glMatrix.RANDOM()-2)*Math.sqrt(l*-l+l),o=i*i+a*a;var c=Math.sqrt((1-s)/o);return r[0]=t*e,r[1]=t*n,r[2]=t*i*c,r[3]=t*a*c,r}function M(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 j(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],l=t[1],c=t[2],u=i*c-a*l,h=a*o-n*c,d=n*l-i*o;return u=u+u,h=h+h,d=d+d,r[0]=o+s*u+i*d-a*h,r[1]=l+s*h+a*u-n*d,r[2]=c+s*d+n*h-i*u,r[3]=t[3],r}function tt(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function et(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function st(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]}function lt(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=t[0],o=t[1],l=t[2],c=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-l)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(l))&&Math.abs(a-c)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(c))}var Tt=null,vt=null,Ft=null,qt=null,Lt=null,Zt=null,le=null,bt=function(){var r=An();return function(t,e,n,i,a,s){var o,l;for(e||(e=4),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;o0?(e[0]=(o*s+u*n+l*a-c*i)*2/h,e[1]=(l*s+u*i+c*n-o*a)*2/h,e[2]=(c*s+u*a+o*i-l*n)*2/h):(e[0]=(o*s+u*n+l*a-c*i)*2,e[1]=(l*s+u*i+c*n-o*a)*2,e[2]=(c*s+u*a+o*i-l*n)*2),Mr(r,t,e),r}function Tn(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Na(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],l=t[8],c=t[9],u=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(l*l+c*c+u*u),r}function Js(r,t){var e=new X(3);Na(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,l=t[2]*a,c=t[4]*n,u=t[5]*i,h=t[6]*a,d=t[8]*n,f=t[9]*i,v=t[10]*a,g=s+u+v,p=0;return g>0?(p=Math.sqrt(g+1)*2,r[3]=.25*p,r[0]=(h-f)/p,r[1]=(d-l)/p,r[2]=(o-c)/p):s>u&&s>v?(p=Math.sqrt(1+s-u-v)*2,r[3]=(h-f)/p,r[0]=.25*p,r[1]=(o+c)/p,r[2]=(d+l)/p):u>v?(p=Math.sqrt(1+u-s-v)*2,r[3]=(d-l)/p,r[0]=(o+c)/p,r[1]=.25*p,r[2]=(h+f)/p):(p=Math.sqrt(1+v-s-u)*2,r[3]=(o-c)/p,r[0]=(d+l)/p,r[1]=(h+f)/p,r[2]=.25*p),r}function bd(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],l=n[5],c=n[6],u=n[8],h=n[9],d=n[10];e[0]=Math.sqrt(i*i+a*a+s*s),e[1]=Math.sqrt(o*o+l*l+c*c),e[2]=Math.sqrt(u*u+h*h+d*d);var f=1/e[0],v=1/e[1],g=1/e[2],p=i*f,y=a*v,b=s*g,E=o*f,O=l*v,P=c*g,R=u*f,F=h*v,I=d*g,V=p+O+I,Y=0;return V>0?(Y=Math.sqrt(V+1)*2,r[3]=.25*Y,r[0]=(P-F)/Y,r[1]=(R-b)/Y,r[2]=(y-E)/Y):p>O&&p>I?(Y=Math.sqrt(1+p-O-I)*2,r[3]=(P-F)/Y,r[0]=.25*Y,r[1]=(y+E)/Y,r[2]=(R+b)/Y):O>I?(Y=Math.sqrt(1+O-p-I)*2,r[3]=(R-b)/Y,r[0]=(y+E)/Y,r[1]=.25*Y,r[2]=(P+F)/Y):(Y=Math.sqrt(1+I-p-O)*2,r[3]=(y-E)/Y,r[0]=(R+b)/Y,r[1]=(P+F)/Y,r[2]=.25*Y),r}function xd(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=i+i,c=a+a,u=s+s,h=i*l,d=i*c,f=i*u,v=a*c,g=a*u,p=s*u,y=o*l,b=o*c,E=o*u,O=n[0],P=n[1],R=n[2];return r[0]=(1-(v+p))*O,r[1]=(d+E)*O,r[2]=(f-b)*O,r[3]=0,r[4]=(d-E)*P,r[5]=(1-(h+p))*P,r[6]=(g+y)*P,r[7]=0,r[8]=(f+b)*R,r[9]=(g-y)*R,r[10]=(1-(h+v))*R,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function hs(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],l=t[3],c=a+a,u=s+s,h=o+o,d=a*c,f=a*u,v=a*h,g=s*u,p=s*h,y=o*h,b=l*c,E=l*u,O=l*h,P=n[0],R=n[1],F=n[2],I=i[0],V=i[1],Y=i[2],J=(1-(g+y))*P,$=(f+O)*P,ot=(v-E)*P,ct=(f-O)*R,ft=(1-(d+y))*R,Nt=(p+b)*R,Ot=(v+E)*F,mt=(p-b)*F,yt=(1-(d+g))*F;return r[0]=J,r[1]=$,r[2]=ot,r[3]=0,r[4]=ct,r[5]=ft,r[6]=Nt,r[7]=0,r[8]=Ot,r[9]=mt,r[10]=yt,r[11]=0,r[12]=e[0]+I-(J*I+ct*V+Ot*Y),r[13]=e[1]+V-($*I+ft*V+mt*Y),r[14]=e[2]+Y-(ot*I+Nt*V+yt*Y),r[15]=1,r}function Wo(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,c=e*s,u=n*s,h=n*o,d=i*s,f=i*o,v=i*l,g=a*s,p=a*o,y=a*l;return r[0]=1-h-v,r[1]=u+y,r[2]=d-p,r[3]=0,r[4]=u-y,r[5]=1-c-v,r[6]=f+g,r[7]=0,r[8]=d+p,r[9]=f-g,r[10]=1-c-h,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function Ed(r,t,e,n,i,a,s){var o=1/(e-t),l=1/(i-n),c=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*l,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*l,r[10]=(s+a)*c,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*c,r[15]=0,r}function Kl(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 wd=Kl;function uw(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 hw(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),l=2/(s+o),c=2/(i+a);return r[0]=l,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=c,r[6]=0,r[7]=0,r[8]=-((s-o)*l*.5),r[9]=(i-a)*c*.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 ig(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=(s+a)*c,r[15]=1,r}var ag=ig;function sg(r,t,e,n,i,a,s){var o=1/(t-e),l=1/(n-i),c=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*l,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=c,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*l,r[14]=a*c,r[15]=1,r}function og(r,t,e,n){var i,a,s,o,l,c,u,h,d,f,v=t[0],g=t[1],p=t[2],y=n[0],b=n[1],E=n[2],O=e[0],P=e[1],R=e[2];return Math.abs(v-O)0&&(f=1/Math.sqrt(f),u*=f,h*=f,d*=f);var v=l*d-c*h,g=c*u-o*d,p=o*h-l*u;return f=v*v+g*g+p*p,f>0&&(f=1/Math.sqrt(f),v*=f,g*=f,p*=f),r[0]=v,r[1]=g,r[2]=p,r[3]=0,r[4]=h*p-d*g,r[5]=d*v-u*p,r[6]=u*g-h*v,r[7]=0,r[8]=u,r[9]=h,r[10]=d,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function fw(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 vw(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 gw(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 lg(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 pw(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 mw(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 Sd(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 yw(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],c=r[7],u=r[8],h=r[9],d=r[10],f=r[11],v=r[12],g=r[13],p=r[14],y=r[15],b=t[0],E=t[1],O=t[2],P=t[3],R=t[4],F=t[5],I=t[6],V=t[7],Y=t[8],J=t[9],$=t[10],ot=t[11],ct=t[12],ft=t[13],Nt=t[14],Ot=t[15];return Math.abs(e-b)<=W*Math.max(1,Math.abs(e),Math.abs(b))&&Math.abs(n-E)<=W*Math.max(1,Math.abs(n),Math.abs(E))&&Math.abs(i-O)<=W*Math.max(1,Math.abs(i),Math.abs(O))&&Math.abs(a-P)<=W*Math.max(1,Math.abs(a),Math.abs(P))&&Math.abs(s-R)<=W*Math.max(1,Math.abs(s),Math.abs(R))&&Math.abs(o-F)<=W*Math.max(1,Math.abs(o),Math.abs(F))&&Math.abs(l-I)<=W*Math.max(1,Math.abs(l),Math.abs(I))&&Math.abs(c-V)<=W*Math.max(1,Math.abs(c),Math.abs(V))&&Math.abs(u-Y)<=W*Math.max(1,Math.abs(u),Math.abs(Y))&&Math.abs(h-J)<=W*Math.max(1,Math.abs(h),Math.abs(J))&&Math.abs(d-$)<=W*Math.max(1,Math.abs(d),Math.abs($))&&Math.abs(f-ot)<=W*Math.max(1,Math.abs(f),Math.abs(ot))&&Math.abs(v-ct)<=W*Math.max(1,Math.abs(v),Math.abs(ct))&&Math.abs(g-ft)<=W*Math.max(1,Math.abs(g),Math.abs(ft))&&Math.abs(p-Nt)<=W*Math.max(1,Math.abs(p),Math.abs(Nt))&&Math.abs(y-Ot)<=W*Math.max(1,Math.abs(y),Math.abs(Ot))}var cg=Jt,bw=lg;function ug(){var r=new X(9);return X!=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 xw(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 qB(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 JB(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 Ew(r,t,e,n,i,a,s,o,l){var c=new X(9);return c[0]=r,c[1]=t,c[2]=e,c[3]=n,c[4]=i,c[5]=a,c[6]=s,c[7]=o,c[8]=l,c}function $B(r,t,e,n,i,a,s,o,l,c){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=l,r[8]=c,r}function tF(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 eF(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 nF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=u*s-o*c,d=-u*a+o*l,f=c*a-s*l,v=e*h+n*d+i*f;return v?(v=1/v,r[0]=h*v,r[1]=(-u*n+i*c)*v,r[2]=(o*n-i*s)*v,r[3]=d*v,r[4]=(u*e-i*l)*v,r[5]=(-o*e+i*a)*v,r[6]=f*v,r[7]=(-c*e+n*l)*v,r[8]=(s*e-n*a)*v,r):null}function rF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8];return r[0]=s*u-o*c,r[1]=i*c-n*u,r[2]=n*o-i*s,r[3]=o*l-a*u,r[4]=e*u-i*l,r[5]=i*a-e*o,r[6]=a*c-s*l,r[7]=n*l-e*c,r[8]=e*s-n*a,r}function iF(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],l=r[7],c=r[8];return t*(c*a-s*l)+e*(-c*i+s*o)+n*(l*i-a*o)}function aF(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=e[0],f=e[1],v=e[2],g=e[3],p=e[4],y=e[5],b=e[6],E=e[7],O=e[8];return r[0]=d*n+f*s+v*c,r[1]=d*i+f*o+v*u,r[2]=d*a+f*l+v*h,r[3]=g*n+p*s+y*c,r[4]=g*i+p*o+y*u,r[5]=g*a+p*l+y*h,r[6]=b*n+E*s+O*c,r[7]=b*i+E*o+O*u,r[8]=b*a+E*l+O*h,r}function sF(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=e[0],f=e[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=s,r[4]=o,r[5]=l,r[6]=d*n+f*s+c,r[7]=d*i+f*o+u,r[8]=d*a+f*l+h,r}function oF(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],l=t[5],c=t[6],u=t[7],h=t[8],d=Math.sin(e),f=Math.cos(e);return r[0]=f*n+d*s,r[1]=f*i+d*o,r[2]=f*a+d*l,r[3]=f*s-d*n,r[4]=f*o-d*i,r[5]=f*l-d*a,r[6]=c,r[7]=u,r[8]=h,r}function lF(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 cF(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 uF(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 hF(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 dF(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 fF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,l=i+i,c=e*s,u=n*s,h=n*o,d=i*s,f=i*o,v=i*l,g=a*s,p=a*o,y=a*l;return r[0]=1-h-v,r[3]=u-y,r[6]=d+p,r[1]=u+y,r[4]=1-c-v,r[7]=f-g,r[2]=d-p,r[5]=f+g,r[8]=1-c-h,r}function vF(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],l=t[6],c=t[7],u=t[8],h=t[9],d=t[10],f=t[11],v=t[12],g=t[13],p=t[14],y=t[15],b=e*o-n*s,E=e*l-i*s,O=e*c-a*s,P=n*l-i*o,R=n*c-a*o,F=i*c-a*l,I=u*g-h*v,V=u*p-d*v,Y=u*y-f*v,J=h*p-d*g,$=h*y-f*g,ot=d*y-f*p,ct=b*ot-E*$+O*J+P*Y-R*V+F*I;return ct?(ct=1/ct,r[0]=(o*ot-l*$+c*J)*ct,r[1]=(l*Y-s*ot-c*V)*ct,r[2]=(s*$-o*Y+c*I)*ct,r[3]=(i*$-n*ot-a*J)*ct,r[4]=(e*ot-i*Y+a*V)*ct,r[5]=(n*Y-e*$-a*I)*ct,r[6]=(g*F-p*R+y*P)*ct,r[7]=(p*O-v*F-y*E)*ct,r[8]=(v*R-g*O+y*b)*ct,r):null}function gF(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 pF(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function mF(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 yF(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 bF(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 xF(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 EF(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 wF(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 SF(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],l=r[6],c=r[7],u=r[8],h=t[0],d=t[1],f=t[2],v=t[3],g=t[4],p=t[5],y=t[6],b=t[7],E=t[8];return Math.abs(e-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(h))&&Math.abs(n-d)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(d))&&Math.abs(i-f)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(f))&&Math.abs(a-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(v))&&Math.abs(s-g)<=glMatrix.EPSILON*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(o-p)<=glMatrix.EPSILON*Math.max(1,Math.abs(o),Math.abs(p))&&Math.abs(l-y)<=glMatrix.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(c-b)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(b))&&Math.abs(u-E)<=glMatrix.EPSILON*Math.max(1,Math.abs(u),Math.abs(E))}var MF=null,AF=null;function Kn(){var r=new X(4);return X!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function TF(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function ka(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 OF(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 CF(r,t){var e=Ow(r,t);return Math.acos(2*e*e-1)}function Pa(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],l=e[1],c=e[2],u=e[3];return r[0]=n*u+s*o+i*c-a*l,r[1]=i*u+s*l+a*o-n*c,r[2]=a*u+s*c+n*l-i*o,r[3]=s*u-n*o-i*l-a*c,r}function NF(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),l=Math.cos(e);return r[0]=n*l+s*o,r[1]=i*l+a*o,r[2]=a*l-i*o,r[3]=s*l-n*o,r}function kF(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),l=Math.cos(e);return r[0]=n*l-a*o,r[1]=i*l+s*o,r[2]=a*l+n*o,r[3]=s*l-i*o,r}function PF(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),l=Math.cos(e);return r[0]=n*l+i*o,r[1]=i*l-n*o,r[2]=a*l+s*o,r[3]=s*l-a*o,r}function RF(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 ww(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),l=s>0?o*Math.sin(s)/s:0;return r[0]=e*l,r[1]=n*l,r[2]=i*l,r[3]=o*Math.cos(s),r}function Sw(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 LF(r,t,e){return Sw(r,t),Tw(r,r,e),ww(r,r),r}function Md(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],l=e[0],c=e[1],u=e[2],h=e[3],d,f,v,g,p;return f=i*l+a*c+s*u+o*h,f<0&&(f=-f,l=-l,c=-c,u=-u,h=-h),1-f>W?(d=Math.acos(f),v=Math.sin(d),g=Math.sin((1-n)*d)/v,p=Math.sin(n*d)/v):(g=1-n,p=n),r[0]=g*i+p*l,r[1]=g*a+p*c,r[2]=g*s+p*u,r[3]=g*o+p*h,r}function _F(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 Ad(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 DF(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r}function Mw(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 Ql(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:rt,a=Math.PI/360;t*=a,n*=a,e*=a;var s=Math.sin(t),o=Math.cos(t),l=Math.sin(e),c=Math.cos(e),u=Math.sin(n),h=Math.cos(n);switch(i){case"xyz":r[0]=s*c*h+o*l*u,r[1]=o*l*h-s*c*u,r[2]=o*c*u+s*l*h,r[3]=o*c*h-s*l*u;break;case"xzy":r[0]=s*c*h-o*l*u,r[1]=o*l*h-s*c*u,r[2]=o*c*u+s*l*h,r[3]=o*c*h+s*l*u;break;case"yxz":r[0]=s*c*h+o*l*u,r[1]=o*l*h-s*c*u,r[2]=o*c*u-s*l*h,r[3]=o*c*h+s*l*u;break;case"yzx":r[0]=s*c*h+o*l*u,r[1]=o*l*h+s*c*u,r[2]=o*c*u-s*l*h,r[3]=o*c*h-s*l*u;break;case"zxy":r[0]=s*c*h-o*l*u,r[1]=o*l*h+s*c*u,r[2]=o*c*u+s*l*h,r[3]=o*c*h-s*l*u;break;case"zyx":r[0]=s*c*h-o*l*u,r[1]=o*l*h+s*c*u,r[2]=o*c*u-s*l*h,r[3]=o*c*h+s*l*u;break;default:throw new Error("Unknown angle order "+i)}return r}function IF(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var BF=dd,Aw=Ui,ql=Ci,hg=zo,FF=Ca,dg=Pa,Tw=vd,Ow=H,zF=w,jF=pd,ZF=null,WF=md,GF=null,Jl=Xl,VF=st;function UF(r,t){return Math.abs(vec4.dot(r,t))>=1-glMatrix.EPSILON}var YF=function(){var r=pt(),t=Et(1,0,0),e=Et(0,1,0);return function(n,i,a){var s=ye(i,a);return s<-.999999?(de(r,t,i),us(r)<1e-6&&de(r,e,i),oe(r,r),ka(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(de(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Jl(n,n))}}(),HF=function(){var r=Kn(),t=Kn();return function(e,n,i,a,s,o){return Md(r,n,s,o),Md(t,i,a,o),Md(e,r,t,2*o*(1-o)),e}}(),XF=function(){var r=ug();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],Jl(t,Mw(t,r))}}();function Td(){var r=new X(2);return X!=Float32Array&&(r[0]=0,r[1]=0),r}function KF(r){var t=new glMatrix.ARRAY_TYPE(2);return t[0]=r[0],t[1]=r[1],t}function QF(r,t){var e=new glMatrix.ARRAY_TYPE(2);return e[0]=r,e[1]=t,e}function Cw(r,t){return r[0]=t[0],r[1]=t[1],r}function Nw(r,t,e){return r[0]=t,r[1]=e,r}function qF(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r}function JF(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r}function $F(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r}function t8(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r}function e8(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r}function n8(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r}function r8(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r}function i8(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r}function a8(r,t){return r[0]=glMatrix.round(t[0]),r[1]=glMatrix.round(t[1]),r}function s8(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r}function o8(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r}function l8(r,t){var e=t[0]-r[0],n=t[1]-r[1];return Math.sqrt(e*e+n*n)}function c8(r,t){var e=t[0]-r[0],n=t[1]-r[1];return e*e+n*n}function u8(r){var t=r[0],e=r[1];return Math.sqrt(t*t+e*e)}function h8(r){var t=r[0],e=r[1];return t*t+e*e}function d8(r,t){return r[0]=-t[0],r[1]=-t[1],r}function f8(r,t){return r[0]=1/t[0],r[1]=1/t[1],r}function kw(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 Pw(r,t){return r[0]*t[0]+r[1]*t[1]}function v8(r,t,e){var n=t[0]*e[1]-t[1]*e[0];return r[0]=r[1]=0,r[2]=n,r}function g8(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 p8(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 m8(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 y8(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 b8(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 x8(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 E8(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 w8(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 S8(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 M8(r){return r[0]=0,r[1]=0,r}function A8(r){return"vec2("+r[0]+", "+r[1]+")"}function Rw(r,t){return r[0]===t[0]&&r[1]===t[1]}function T8(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 O8=null,C8=null,N8=null,k8=null,P8=null,R8=null,L8=null,_8=function(){var r=Td();return function(t,e,n,i,a,s){var o,l;for(e||(e=2),n||(n=0),i?l=Math.min(i*e+n,t.length):l=t.length,o=n;oe?e:r},kn=Lw,G=S(80813),Go={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function fg(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return Go[e]===t.length-1&&"achlmqstvz".includes(e)})}function vg(r){return fg(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function gg(r){return vg(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}var pg={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function mg(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=Go[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,Go[e]))),!!Go[e]););}function _w(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 Dw(r){return r>=48&&r<=57||r===43||r===45||r===46}function $s(r){return r>=48&&r<=57}function Iw(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,l=!1,c;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(c=e.charCodeAt(i),(c===43||c===45)&&(i+=1,c=e.charCodeAt(i)),!$s(c)&&c!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(c!==46){if(a=c===48,i+=1,c=e.charCodeAt(i),a&&i=5760&&t.includes(r)}function $l(r){for(var t=r.pathValue,e=r.max;r.index0;s-=1){if(zw(i)&&(s===3||s===4)?_w(r):Iw(r),r.err.length)return;r.data.push(r.param),$l(r),r.index=r.max||!Dw(e.charCodeAt(r.index)))break}mg(r)}var Zw=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 Ww(r){if(fg(r))return[].concat(r);var t=new Zw(r);for($l(t);t.index=a)s={x:e,y:n};else{var o=Ra([r,t],[e,n],i/a),l=o[0],c=o[1];s={x:l,y:c}}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 yg(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))),l=e*a-n*i<0?-1:1,c=l*Math.acos(s/o);return c}function Uw(r,t,e,n,i,a,s,o,l,c){var u=Math.abs,h=Math.sin,d=Math.cos,f=Math.sqrt,v=Math.PI,g=u(e),p=u(n),y=(i%360+360)%360,b=y*(v/180);if(r===o&&t===l)return{x:r,y:t};if(g===0||p===0)return Od(r,t,o,l,c).point;var E=(r-o)/2,O=(t-l)/2,P={x:d(b)*E+h(b)*O,y:-h(b)*E+d(b)*O},R=Math.pow(P.x,2)/Math.pow(g,2)+Math.pow(P.y,2)/Math.pow(p,2);R>1&&(g*=f(R),p*=f(R));var F=Math.pow(g,2)*Math.pow(p,2)-Math.pow(g,2)*Math.pow(P.y,2)-Math.pow(p,2)*Math.pow(P.x,2),I=Math.pow(g,2)*Math.pow(P.y,2)+Math.pow(p,2)*Math.pow(P.x,2),V=F/I;V=V<0?0:V;var Y=(a!==s?1:-1)*f(V),J={x:Y*(g*P.y/p),y:Y*(-(p*P.x)/g)},$={x:d(b)*J.x-h(b)*J.y+(r+o)/2,y:h(b)*J.x+d(b)*J.y+(t+l)/2},ot={x:(P.x-J.x)/g,y:(P.y-J.y)/p},ct=yg({x:1,y:0},ot),ft={x:(-P.x-J.x)/g,y:(-P.y-J.y)/p},Nt=yg(ot,ft);!s&&Nt>0?Nt-=2*v:s&&Nt<0&&(Nt+=2*v),Nt%=2*v;var Ot=ct+Nt*c,mt=g*d(Ot),yt=p*h(Ot),Rt={x:d(b)*mt-h(b)*yt+$.x,y:h(b)*mt+d(b)*yt+$.y};return Rt}function Yw(r,t,e,n,i,a,s,o,l,c,u){var h,d=u.bbox,f=d===void 0?!0:d,v=u.length,g=v===void 0?!0:v,p=u.sampleSize,y=p===void 0?30:p,b=typeof c=="number",E=r,O=t,P=0,R=[E,O,P],F=[E,O],I=0,V={x:0,y:0},Y=[{x:E,y:O}];b&&c<=0&&(V={x:E,y:O});for(var J=0;J<=y;J+=1){if(I=J/y,h=Uw(r,t,e,n,i,a,s,o,l,I),E=h.x,O=h.y,f&&Y.push({x:E,y:O}),g&&(P+=Zr(F,[E,O])),F=[E,O],b&&P>=c&&c>R[2]){var $=(P-c)/(P-R[2]);V={x:F[0]*(1-$)+R[0]*$,y:F[1]*(1-$)+R[1]*$}}R=[E,O,P]}return b&&c>=P&&(V={x:o,y:l}),{length:P,point:V,min:{x:Math.min.apply(null,Y.map(function(ot){return ot.x})),y:Math.min.apply(null,Y.map(function(ot){return ot.y}))},max:{x:Math.max.apply(null,Y.map(function(ot){return ot.x})),y:Math.max.apply(null,Y.map(function(ot){return ot.y}))}}}function Hw(r,t,e,n,i,a,s,o,l){var c=1-l;return{x:Math.pow(c,3)*r+3*Math.pow(c,2)*l*e+3*c*Math.pow(l,2)*i+Math.pow(l,3)*s,y:Math.pow(c,3)*t+3*Math.pow(c,2)*l*n+3*c*Math.pow(l,2)*a+Math.pow(l,3)*o}}function bg(r,t,e,n,i,a,s,o,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,v=f===void 0?!0:f,g=c.sampleSize,p=g===void 0?10:g,y=typeof l=="number",b=r,E=t,O=0,P=[b,E,O],R=[b,E],F=0,I={x:0,y:0},V=[{x:b,y:E}];y&&l<=0&&(I={x:b,y:E});for(var Y=0;Y<=p;Y+=1){if(F=Y/p,u=Hw(r,t,e,n,i,a,s,o,F),b=u.x,E=u.y,d&&V.push({x:b,y:E}),v&&(O+=Zr(R,[b,E])),R=[b,E],y&&O>=l&&l>P[2]){var J=(O-l)/(O-P[2]);I={x:R[0]*(1-J)+P[0]*J,y:R[1]*(1-J)+P[1]*J}}P=[b,E,O]}return y&&l>=O&&(I={x:s,y:o}),{length:O,point:I,min:{x:Math.min.apply(null,V.map(function($){return $.x})),y:Math.min.apply(null,V.map(function($){return $.y}))},max:{x:Math.max.apply(null,V.map(function($){return $.x})),y:Math.max.apply(null,V.map(function($){return $.y}))}}}function Xw(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 Kw(r,t,e,n,i,a,s,o){var l,c=o.bbox,u=c===void 0?!0:c,h=o.length,d=h===void 0?!0:h,f=o.sampleSize,v=f===void 0?10:f,g=typeof s=="number",p=r,y=t,b=0,E=[p,y,b],O=[p,y],P=0,R={x:0,y:0},F=[{x:p,y}];g&&s<=0&&(R={x:p,y});for(var I=0;I<=v;I+=1){if(P=I/v,l=Xw(r,t,e,n,i,a,P),p=l.x,y=l.y,u&&F.push({x:p,y}),d&&(b+=Zr(O,[p,y])),O=[p,y],g&&b>=s&&s>E[2]){var V=(b-s)/(b-E[2]);R={x:O[0]*(1-V)+E[0]*V,y:O[1]*(1-V)+E[1]*V}}E=[p,y,b]}return g&&s>=b&&(R={x:i,y:a}),{length:b,point:R,min:{x:Math.min.apply(null,F.map(function(Y){return Y.x})),y:Math.min.apply(null,F.map(function(Y){return Y.y}))},max:{x:Math.max.apply(null,F.map(function(Y){return Y.x})),y:Math.max.apply(null,F.map(function(Y){return Y.y}))}}}function xg(r,t,e){for(var n,i,a,s,o,l,c=tc(r),u=typeof t=="number",h,d=[],f,v=0,g=0,p=0,y=0,b,E=[],O=[],P=0,R={x:0,y:0},F=R,I=R,V=R,Y=0,J=0,$=c.length;J<$;J+=1)b=c[J],f=b[0],h=f==="M",d=h?d:[v,g].concat(b.slice(1)),h?(p=b[1],y=b[2],R={x:p,y},F=R,P=0,u&&t<.001&&(V=R)):f==="L"?(n=Od(d[0],d[1],d[2],d[3],(t||0)-Y),P=n.length,R=n.min,F=n.max,I=n.point):f==="A"?(i=Yw(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],d[8],(t||0)-Y,e||{}),P=i.length,R=i.min,F=i.max,I=i.point):f==="C"?(a=bg(d[0],d[1],d[2],d[3],d[4],d[5],d[6],d[7],(t||0)-Y,e||{}),P=a.length,R=a.min,F=a.max,I=a.point):f==="Q"?(s=Kw(d[0],d[1],d[2],d[3],d[4],d[5],(t||0)-Y,e||{}),P=s.length,R=s.min,F=s.max,I=s.point):f==="Z"&&(d=[v,g,p,y],o=Od(d[0],d[1],d[2],d[3],(t||0)-Y),P=o.length,R=o.min,F=o.max,I=o.point),u&&Y=t&&(V=I),O.push(F),E.push(R),Y+=P,l=f!=="Z"?b.slice(-2):[p,y],v=l[0],g=l[1];return u&&t>=Y&&(V={x:v,y:g}),{length:Y,point:V,min:{x:Math.min.apply(null,E.map(function(ot){return ot.x})),y:Math.min.apply(null,E.map(function(ot){return ot.y}))},max:{x:Math.max.apply(null,O.map(function(ot){return ot.x})),y:Math.max.apply(null,O.map(function(ot){return ot.y}))}}}function Qw(r,t){return xg(r,void 0,(0,G.pi)((0,G.pi)({},t),{bbox:!1,length:!0})).length}function Wr(r){return Array.isArray(r)}var ec=function(r){if(Wr(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};function nc(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 t2(r){return gg(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function rc(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 Cd(r,t,e,n,i,a,s,o,l,c){var u=r,h=t,d=e,f=n,v=o,g=l,p=Math.PI*120/180,y=Math.PI/180*(+i||0),b=[],E,O,P,R,F;if(c)O=c[0],P=c[1],R=c[2],F=c[3];else{E=rc(u,h,-y),u=E.x,h=E.y,E=rc(v,g,-y),v=E.x,g=E.y;var I=(u-v)/2,V=(h-g)/2,Y=I*I/(d*d)+V*V/(f*f);Y>1&&(Y=Math.sqrt(Y),d*=Y,f*=Y);var J=d*d,$=f*f,ot=(a===s?-1:1)*Math.sqrt(Math.abs((J*$-J*V*V-$*I*I)/(J*V*V+$*I*I)));R=ot*d*V/f+(u+v)/2,F=ot*-f*I/d+(h+g)/2,O=Math.asin(((h-F)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),P=Math.asin(((g-F)/f*Math.pow(10,9)>>0)/Math.pow(10,9)),O=uP&&(O-=Math.PI*2),!s&&P>O&&(P-=Math.PI*2)}var ct=P-O;if(Math.abs(ct)>p){var ft=P,Nt=v,Ot=g;P=O+p*(s&&P>O?1:-1),v=R+d*Math.cos(P),g=F+f*Math.sin(P),b=Cd(v,g,d,f,i,0,s,Nt,Ot,[P,ft,R,F])}ct=P-O;var mt=Math.cos(O),yt=Math.sin(O),Rt=Math.cos(P),jt=Math.sin(P),Xt=Math.tan(ct/4),ee=4/3*d*Xt,ae=4/3*f*Xt,he=[u,h],ce=[u+ee*yt,h-ae*mt],xe=[v+ee*jt,g-ae*Rt],Ce=[v,g];if(ce[0]=2*he[0]-ce[0],ce[1]=2*he[1]-ce[1],c)return ce.concat(xe,Ce,b);b=ce.concat(xe,Ce,b);for(var je=[],Ue=0,or=b.length;Uer2)return console.warn("Maximum recursion depth reached in equalizeSegments"),[r,t];var i=Sg(r),a=Sg(t),s=i.length,o=a.length,l=i.filter(function(y){return y.l}).length,c=a.filter(function(y){return y.l}).length,u=i.filter(function(y){return y.l}).reduce(function(y,b){var E=b.l;return y+E},0)/l||0,h=a.filter(function(y){return y.l}).reduce(function(y,b){var E=b.l;return y+E},0)/c||0,d=e||Math.max(s,o),f=[u,h],v=[d-s,d-o],g=0,p=[i,a].map(function(y,b){return y.l===d?y.map(function(E){return E.s}):y.map(function(E,O){return g=O&&v[b]&&E.l>=f[b],v[b]-=g?1:0,g?E.ss:[E.s]}).flat()});return p[0].length===p[1].length?p:Mg(p[0],p[1],d,n+1)}function a2(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 s2(r){var t=0,e=0,n=0;return Nd(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],l=s[1],c=s[2],u=s[3],h=s[4],d=s[5];return n=a2(t,e,o,l,c,u,h,d),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function Ag(r){return s2(r)>=0}function o2(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 l2(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function c2(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,l;return s===0||r[o]&&r[o][0]==="M"?(l=r[o],["M"].concat(l.slice(-2))):(o>=t&&(o-=e),r[o])})})}function u2(r,t){var e=r.length-1,n=[],i=0,a=0,s=c2(r);return s.forEach(function(o,l){r.slice(1).forEach(function(c,u){a+=Zr(r[(l+u)%e].slice(-2),t[u%e].slice(-2))}),n[l]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}var h2=function(r){return r===void 0},Te=h2,d2={}.toString,f2=function(r,t){return d2.call(r)==="[object "+t+"]"},Tg=f2,v2=function(r){return Tg(r,"Boolean")},Uo=v2;function fe(r){return typeof r=="function"}var zn=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function g2(r,t,e){return xg(r,t,(0,G.pi)((0,G.pi)({},e),{bbox:!1,length:!0})).point}var se=S(20068),Og=S(58289);function p2(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=(0,Og.Z)(r))!==null;);return r}function kd(){return kd=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=p2(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},kd.apply(null,arguments)}function Cg(r,t,e,n){var i=kd((0,Og.Z)(1&n?r.prototype:r),t,e);return 2&n&&typeof i=="function"?function(a){return i.apply(e,a)}:i}function Ar(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function ic(r,t){var e=Math.min.apply(Math,(0,k.Z)(r)),n=Math.min.apply(Math,(0,k.Z)(t)),i=Math.max.apply(Math,(0,k.Z)(r)),a=Math.max.apply(Math,(0,k.Z)(t));return{x:e,y:n,width:i-e,height:a-n}}function Ng(r){return(r+Math.PI*2)%(Math.PI*2)}function kg(r,t){var e=Math.abs(r);return t>0?e:e*-1}function m2(r,t,e,n,i,a){var s=e,o=n;if(s===0||o===0)return{x:r,y:t};for(var l=i-r,c=a-t,u=Math.abs(l),h=Math.abs(c),d=s*s,f=o*o,v=Math.PI/4,g=0,p=0,y=0;y<4;y++){g=s*Math.cos(v),p=o*Math.sin(v);var b=(d-f)*Math.pow(Math.cos(v),3)/s,E=(f-d)*Math.pow(Math.sin(v),3)/o,O=g-b,P=p-E,R=u-b,F=h-E,I=Math.hypot(P,O),V=Math.hypot(F,R),Y=I*Math.asin((O*F-P*R)/(I*V)),J=Y/Math.sqrt(d+f-g*g-p*p);v+=J,v=Math.min(Math.PI/2,Math.max(0,v))}return{x:r+kg(g,l),y:t+kg(p,c)}}function y2(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 b2(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 x2(r,t,e){return Math.atan(-t/r*Math.tan(e))}function E2(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function w2(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function S2(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function M2(r,t,e,n){var i=Math.atan2(n*r,e*t);return(i+Math.PI*2)%(Math.PI*2)}function Pg(r,t,e){return{x:r*Math.cos(e),y:t*Math.sin(e)}}function Rg(r,t,e){var n=Math.cos(e),i=Math.sin(e);return[r*n-t*i,r*i+t*n]}function A2(r,t,e,n,i,a,s){for(var o=x2(e,n,i),l=1/0,c=-1/0,u=[a,s],h=-Math.PI*2;h<=Math.PI*2;h+=Math.PI){var d=o+h;ac&&(c=v)}for(var g=E2(e,n,i),p=1/0,y=-1/0,b=[a,s],E=-Math.PI*2;E<=Math.PI*2;E+=Math.PI){var O=g+E;ay&&(y=R)}return{x:l,y:p,width:c-l,height:y-p}}function D8(r,t,e,n,i,a,s,o,l){var c=Rg(o-r,l-t,-i),u=_slicedToArray(c,2),h=u[0],d=u[1],f=m2(0,0,e,n,h,d),v=M2(e,n,f.x,f.y);vs&&(f=Pg(e,n,s));var g=Rg(f.x,f.y,i);return{x:g[0]+r,y:g[1]+t}}function I8(r,t,e,n,i,a,s,o){var l=(s-a)*o+a,c=y2(r,t,e,n,i,a,s,l),u=b2(r,t,e,n,i,a,s,l);return Ng(Math.atan2(u,c))}var T2=1e-4;function Lg(r,t,e,n,i,a){var s=-1,o=1/0,l=[e,n],c=20;a&&a>200&&(c=a/10);for(var u=1/c,h=u/10,d=0;d<=c;d++){var f=d*u,v=[i.apply(void 0,(0,k.Z)(r.concat([f]))),i.apply(void 0,(0,k.Z)(t.concat([f])))],g=Ar(l[0],l[1],v[0],v[1]);g=0&&Po?Ar(e,n,i,a):Dg(r,t,e,n,i,a)}function Dg(r,t,e,n,i,a){var s=[e-r,n-t];if(Rw(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];kw(o,o);var l=[i-r,a-t];return Math.abs(Pw(l,o))}function F8(r,t,e,n){return Math.atan2(n-t,e-r)}function ds(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 Ig(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 Bg(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=[],l,c,u;if(Vo(i,0))Vo(a,0)||(l=-s/a,l>=0&&l<=1&&o.push(l));else{var h=a*a-4*i*s;Vo(h,0)?o.push(-a/(2*i)):h>0&&(u=Math.sqrt(h),l=(-a+u)/(2*i),c=(-a-u)/(2*i),l>=0&&l<=1&&o.push(l),c>=0&&c<=1&&o.push(c))}return o}function N2(r,t,e,n,i,a,s,o,l){var c=ds(r,e,i,s,l),u=ds(t,n,a,o,l),h=Yi(r,t,e,n,l),d=Yi(e,n,i,a,l),f=Yi(i,a,s,o,l),v=Yi(h.x,h.y,d.x,d.y,l),g=Yi(d.x,d.y,f.x,f.y,l);return[[r,t,h.x,h.y,v.x,v.y,c,u],[c,u,g.x,g.y,f.x,f.y,s,o]]}function Pd(r,t,e,n,i,a,s,o,l){if(l===0)return O2([r,e,i,s],[t,n,a,o]);var c=N2(r,t,e,n,i,a,s,o,.5),u=[].concat(_toConsumableArray(c[0]),[l-1]),h=[].concat(_toConsumableArray(c[1]),[l-1]);return Pd.apply(void 0,_toConsumableArray(u))+Pd.apply(void 0,_toConsumableArray(h))}function k2(r,t,e,n,i,a,s,o){for(var l=[r,s],c=[t,o],u=Bg(r,e,i,s),h=Bg(t,n,a,o),d=0;d1||t<0||r.length<2)return null;var e=zg(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+h){var d=(t-a)/h;s=Yi(c[0],c[1],u[0],u[1],d);break}a+=h}return s}function Wg(r,t){if(t>1||t<0||r.length<2)return 0;for(var e=zg(r),n=e.segments,i=e.totalLength,a=0,s=0,o=0;o=a&&t<=a+h){s=Math.atan2(u[1]-c[1],u[0]-c[0]);break}a+=h}return s}function Gg(r,t,e){for(var n=1/0,i=0;i=0?[i]:[]}function _2(r,t,e,n,i,a,s){var o=Yo(r,e,i,s),l=Yo(t,n,a,s),c=Yi(r,t,e,n,s),u=Yi(e,n,i,a,s);return[[r,t,c.x,c.y,o,l],[o,l,u.x,u.y,i,a]]}function Rd(r,t,e,n,i,a,s){if(s===0)return(Ar(r,t,e,n)+Ar(e,n,i,a)+Ar(r,t,i,a))/2;var o=_2(r,t,e,n,i,a,.5),l=o[0],c=o[1];return l.push(s-1),c.push(s-1),Rd.apply(void 0,_toConsumableArray(l))+Rd.apply(void 0,_toConsumableArray(c))}function D2(r,t,e,n,i,a){var s=Vg(r,e,i)[0],o=Vg(t,n,a)[0],l=[r,i],c=[t,a];return s!==void 0&&l.push(Yo(r,e,i,s)),o!==void 0&&c.push(Yo(t,n,a,o)),ic(l,c)}function Q8(r,t,e,n,i,a){return Rd(r,t,e,n,i,a,3)}function I2(r,t,e,n,i,a,s,o){return Lg([r,e,i],[t,n,a],s,o,Yo)}function B2(r,t,e,n,i,a,s,o){var l=I2(r,t,e,n,i,a,s,o);return Ar(l.x,l.y,s,o)}var Tr=S(75044),La=S(3202),fs=S(19251),vs=S(75931);var F2=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof S.g!="undefined"?S.g:typeof self!="undefined"?self:{},Ug={exports:{}};(function(r,t){(function(e,n){r.exports=n()})(F2,function(){function e(P,R,F,I,V){n(P,R,F||0,I||P.length-1,V||a)}function n(P,R,F,I,V){for(;I>F;){if(I-F>600){var Y=I-F+1,J=R-F+1,$=Math.log(Y),ot=.5*Math.exp(2*$/3),ct=.5*Math.sqrt($*ot*(Y-ot)/Y)*(J-Y/2<0?-1:1),ft=Math.max(F,Math.floor(R-J*ot/Y+ct)),Nt=Math.min(I,Math.floor(R+(Y-J)*ot/Y+ct));n(P,R,ft,Nt,V)}var Ot=P[R],mt=F,yt=I;for(i(P,F,R),V(P[I],Ot)>0&&i(P,F,I);mt0;)yt--}V(P[F],Ot)===0?i(P,F,yt):(yt++,i(P,yt,I)),yt<=R&&(F=yt+1),R<=yt&&(I=yt-1)}}function i(P,R,F){var I=P[R];P[R]=P[F],P[F]=I}function a(P,R){return PR?1:0}var s=function(R){R===void 0&&(R=9),this._maxEntries=Math.max(4,R),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()};s.prototype.all=function(){return this._all(this.data,[])},s.prototype.search=function(R){var F=this.data,I=[];if(!b(R,F))return I;for(var V=this.toBBox,Y=[];F;){for(var J=0;J=0&&Y[F].children.length>this._maxEntries;)this._split(Y,F),F--;this._adjustParentBBoxes(V,Y,F)},s.prototype._split=function(R,F){var I=R[F],V=I.children.length,Y=this._minEntries;this._chooseSplitAxis(I,Y,V);var J=this._chooseSplitIndex(I,Y,V),$=E(I.children.splice(J,I.children.length-J));$.height=I.height,$.leaf=I.leaf,l(I,this.toBBox),l($,this.toBBox),F?R[F-1].children.push($):this._splitRoot(I,$)},s.prototype._splitRoot=function(R,F){this.data=E([R,F]),this.data.height=R.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},s.prototype._chooseSplitIndex=function(R,F,I){for(var V,Y=1/0,J=1/0,$=F;$<=I-F;$++){var ot=c(R,0,$,this.toBBox),ct=c(R,$,I,this.toBBox),ft=p(ot,ct),Nt=f(ot)+f(ct);ft=F;Nt--){var Ot=R.children[Nt];u($,R.leaf?Y(Ot):Ot),ot+=v($)}return ot},s.prototype._adjustParentBBoxes=function(R,F,I){for(var V=I;V>=0;V--)u(F[V],R)},s.prototype._condense=function(R){for(var F=R.length-1,I=void 0;F>=0;F--)R[F].children.length===0?F>0?(I=R[F-1].children,I.splice(I.indexOf(R[F]),1)):this.clear():l(R[F],this.toBBox)};function o(P,R,F){if(!F)return R.indexOf(P);for(var I=0;I=P.minX&&R.maxY>=P.minY}function E(P){return{children:P,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function O(P,R,F,I,V){for(var Y=[R,F];Y.length;)if(F=Y.pop(),R=Y.pop(),!(F-R<=I)){var J=R+Math.ceil((F-R)/I/2)*I;e(P,J,R,F,V),Y.push(R,J,J,F)}}return s})})(Ug);var z2=Ug.exports,Dt=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}({}),sc=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),_a=function(){function r(){(0,N.Z)(this,r),this.plugins=[]}return(0,T.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)})}}])}(),j2=function(){function r(t){(0,N.Z)(this,r),this.clipSpaceNearZ=sc.NEGATIVE_ONE,this.plugins=[],this.config=(0,B.Z)({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return(0,T.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)}}])}(),Ld=Ut,to=kt,Z2=ca,W2=$r,Yg=Pt,_d=qs,pn=function(){function r(){(0,N.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,T.Z)(r,[{key:"update",value:function(e,n){to(this.center,e),to(this.halfExtents,n),_d(this.min,this.center,this.halfExtents),Ld(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){Ld(this.center,n,e),Yg(this.center,this.center,.5),_d(this.halfExtents,n,e),Yg(this.halfExtents,this.halfExtents,.5),to(this.min,e),to(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,l=o[0],c=o[1],u=o[2],h=i-l,d=i+l,f=a-c,v=a+c,g=s-u,p=s+u,y=e.center,b=y[0],E=y[1],O=y[2],P=e.halfExtents,R=P[0],F=P[1],I=P[2],V=b-R,Y=b+R,J=E-F,$=E+F,ot=O-I,ct=O+I;Vd&&(d=Y),Jv&&(v=$),otp&&(p=ct),n[0]=(h+d)*.5,n[1]=(f+v)*.5,n[2]=(g+p)*.5,o[0]=(d-h)*.5,o[1]=(v-f)*.5,o[2]=(p-g)*.5,this.min[0]=h,this.min[1]=f,this.min[2]=g,this.max[0]=d,this.max[1]=v,this.max[2]=p}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,l=n[0],c=n[4],u=n[8],h=n[1],d=n[5],f=n[9],v=n[2],g=n[6],p=n[10],y=Math.abs(l),b=Math.abs(c),E=Math.abs(u),O=Math.abs(h),P=Math.abs(d),R=Math.abs(f),F=Math.abs(v),I=Math.abs(g),V=Math.abs(p);i[0]=n[12]+l*s[0]+c*s[1]+u*s[2],i[1]=n[13]+h*s[0]+d*s[1]+f*s[2],i[2]=n[14]+v*s[0]+g*s[1]+p*s[2],a[0]=y*o[0]+b*o[1]+E*o[2],a[1]=O*o[0]+P*o[1]+R*o[2],a[2]=F*o[0]+I*o[1]+V*o[2],_d(this.min,i,a),Ld(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=Z2([0,0,0],this.getMin(),e.getMin()),a=W2([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?to([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?to([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}}])}(),G2=function(){function r(t,e){(0,N.Z)(this,r),this.distance=t||0,this.normal=e||Et(0,1,0),this.updatePNVertexFlag()}return(0,T.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 ye(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/us(this.normal);Pt(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),l=o>=0&&o<=1;return l&&i&&_e(i,e,n,o),l}}])}(),eo=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),V2=function(){function r(t){if((0,N.Z)(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new G2)}return(0,T.Z)(r,[{key:"extractFromVPMatrix",value:function(e){var n=(0,L.Z)(e,16),i=n[0],a=n[1],s=n[2],o=n[3],l=n[4],c=n[5],u=n[6],h=n[7],d=n[8],f=n[9],v=n[10],g=n[11],p=n[12],y=n[13],b=n[14],E=n[15];zt(this.planes[0].normal,o-i,h-l,g-d),this.planes[0].distance=E-p,zt(this.planes[1].normal,o+i,h+l,g+d),this.planes[1].distance=E+p,zt(this.planes[2].normal,o+a,h+c,g+f),this.planes[2].distance=E+y,zt(this.planes[3].normal,o-a,h-c,g-f),this.planes[3].distance=E-y,zt(this.planes[4].normal,o-s,h-u,g-v),this.planes[4].distance=E-b,zt(this.planes[5].normal,o+s,h+u,g+v),this.planes[5].distance=E+b,this.planes.forEach(function(O){O.normalize(),O.updatePNVertexFlag()})}}])}(),gr=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,N.Z)(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return(0,T.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}}])}(),no=function(){function r(t,e,n,i){(0,N.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,T.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=Ui(e.x,e.y,0,1),a=Ui(e.x+e.width,e.y,0,1),s=Ui(e.x,e.y+e.height,0,1),o=Ui(e.x+e.width,e.y+e.height,0,1),l=An(),c=An(),u=An(),h=An();M(l,i,n),M(c,a,n),M(u,s,n),M(h,o,n);var d=Math.min(l[0],c[0],u[0],h[0]),f=Math.min(l[1],c[1],u[1],h[1]),v=Math.max(l[0],c[0],u[0],h[0]),g=Math.max(l[1],c[1],u[1],h[1]);return r.fromRect({x:d,y:f,width:v-d,height:g-f})}}])}(),rn="Method not implemented.",ro="Use document.documentElement instead.",U2="Cannot append a destroyed element.";function io(r){return r===void 0?0:r>360||r<-360?r%360:r}var Dd=pt();function Dr(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?wt(r):kt(Dd,r):ie(r)?n?Et(r,t,e):zt(Dd,r,t,e):n?Et(r[0],r[1]||t,r[2]||e):zt(Dd,r[0],r[1]||t,r[2]||e)}var Y2=Math.PI/180;function an(r){return r*Y2}var H2=180/Math.PI;function Gr(r){return r*H2}var X2=.9;function q8(r){return r%=400,r<0&&(r+=400),r*X2}function J8(r){return r/360}function K2(r){return 360*r}var oc=Math.PI/2;function Q2(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,l=i*i,c=a*a,u=s+o+l+c,h=e*a-n*i;return h>.499995*u?(r[0]=oc,r[1]=2*Math.atan2(n,e),r[2]=0):h<-.499995*u?(r[0]=-oc,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*(l+c)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+l))),r}function q2(r,t){var e,n,i=Na(pt(),t),a=(0,L.Z)(i,3),s=a[0],o=a[1],l=a[2],c=Math.asin(-t[2]/s);return c-oc?(e=Math.atan2(t[6]/o,t[10]/l),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]=c,r[2]=n,r}function Id(r,t){return t.length===16?q2(r,t):Q2(r,t)}function J2(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Ew(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function $2(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,l=2*a,c=e-t,u=n-i,h=l/c,d=l/u,f=(e+t)/c,v=(n+i)/u,g,p,y=s-a,b=s*a;return o?(g=-s/y,p=-b/y):(g=-(s+a)/y,p=-2*b/y),r[0]=h,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=d,r[6]=0,r[7]=0,r[8]=f,r[9]=v,r[10]=g,r[11]=-1,r[12]=0,r[13]=0,r[14]=p,r[15]=0,r}function Hg(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&&(tMe[1][2]&&(a[0]=-a[0]),Me[0][2]>Me[2][0]&&(a[1]=-a[1]),Me[1][0]>Me[0][1]&&(a[2]=-a[2]),!0}function eS(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 nS(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 Bd(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 sn=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),Fd=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),gi=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),Kg={UPDATED:"updated"},Qg=2e-4,qg=function(){function r(){(0,N.Z)(this,r),this.clipSpaceNearZ=sc.NEGATIVE_ONE,this.eventEmitter=new D,this.matrix=Wt(),this.right=Et(1,0,0),this.up=Et(0,1,0),this.forward=Et(0,0,1),this.position=Et(0,0,1),this.focalPoint=Et(0,0,0),this.distanceVector=Et(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=Wt(),this.projectionMatrixInverse=Wt(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=sn.EXPLORING,this.trackingMode=Fd.DEFAULT,this.projectionMode=gi.PERSPECTIVE,this.frustum=new V2,this.orthoMatrix=Wt()}return(0,T.Z)(r,[{key:"isOrtho",value:function(){return this.projectionMode===gi.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===sn.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===sn.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!==sn.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 Ze(Wt(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=Xn(Wt(),[e,n,0]);this.jitteredProjectionMatrix=Jt(Wt(),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===gi.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===gi.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===gi.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===gi.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===gi.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===gi.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 l=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),c=l.x,u=l.y,h=Et(c-a,u-s,0),d=ye(h,this.right)/gt(this.right),f=ye(h,this.up)/gt(this.up),v=this.getPosition(),g=(0,L.Z)(v,2),p=g[0],y=g[1],b=this.getFocalPoint(),E=(0,L.Z)(b,2),O=E[0],P=E[1];return this.setPosition(p-d,y-f),this.setFocalPoint(O-d,P-f),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=gi.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(an(.5*this.fov))/this.zoom,l=2*o,c=this.aspect*l,u=-.5*c;if((s=this.view)!==null&&s!==void 0&&s.enabled){var h=this.view.fullWidth,d=this.view.fullHeight;u+=this.view.offsetX*c/h,o-=this.view.offsetY*l/d,c*=this.view.width/h,l*=this.view.height/d}return $2(this.projectionMatrix,u,u+c,o-l,o,e,this.far,this.clipSpaceNearZ===sc.ZERO),Ze(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var l;this.projectionMode=gi.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var c=(this.rright-this.left)/(2*this.zoom),u=(this.top-this.bottom)/(2*this.zoom),h=(this.rright+this.left)/2,d=(this.top+this.bottom)/2,f=h-c,v=h+c,g=d+u,p=d-u;if((l=this.view)!==null&&l!==void 0&&l.enabled){var y=(this.rright-this.left)/this.view.fullWidth/this.zoom,b=(this.top-this.bottom)/this.view.fullHeight/this.zoom;f+=y*this.view.offsetX,v=f+y*this.view.width,g-=b*this.view.offsetY,p=g-b*this.view.height}return this.clipSpaceNearZ===sc.NEGATIVE_ONE?ag(this.projectionMatrix,f,v,g,p,s,o):sg(this.projectionMatrix,f,v,g,p,s,o),Ze(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=Dr(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=Et(0,1,0);if(this.focalPoint=Dr(e,n,i),this.trackingMode===Fd.CINEMATIC){var s=Qt(pt(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=gt(s),l=Gr(Math.asin(n/o)),c=90+Gr(Math.atan2(i,e)),u=Wt();vn(u,u,an(c)),hn(u,u,an(l)),a=re(pt(),[0,1,0],u)}return Ze(this.matrix,og(Wt(),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?hc(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?hc(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=lS.exec(r))?new Vr(t[1],t[2],t[3],1):(t=cS.exec(r))?new Vr(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=uS.exec(r))?hc(t[1],t[2],t[3],t[4]):(t=hS.exec(r))?hc(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=dS.exec(r))?op(t[1],t[2]/100,t[3]/100,1):(t=fS.exec(r))?op(t[1],t[2]/100,t[3]/100,t[4]):ep.hasOwnProperty(r)?ip(ep[r]):r==="transparent"?new Vr(NaN,NaN,NaN,0):null}function ip(r){return new Vr(r>>16&255,r>>8&255,r&255,1)}function hc(r,t,e,n){return n<=0&&(r=t=e=NaN),new Vr(r,t,e,n)}function pS(r){return r instanceof Ko||(r=uc(r)),r?(r=r.rgb(),new Vr(r.r,r.g,r.b,r.opacity)):new Vr}function mS(r,t,e,n){return arguments.length===1?pS(r):new Vr(r,t,e,n==null?1:n)}function Vr(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}zd(Vr,mS,tp(Ko,{brighter(r){return r=r==null?cc:Math.pow(cc,r),new Vr(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?Qo:Math.pow(Qo,r),new Vr(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Vr(gs(this.r),gs(this.g),gs(this.b),dc(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:ap,formatHex:ap,formatHex8:yS,formatRgb:sp,toString:sp}));function ap(){return`#${ps(this.r)}${ps(this.g)}${ps(this.b)}`}function yS(){return`#${ps(this.r)}${ps(this.g)}${ps(this.b)}${ps((isNaN(this.opacity)?1:this.opacity)*255)}`}function sp(){const r=dc(this.opacity);return`${r===1?"rgb(":"rgba("}${gs(this.r)}, ${gs(this.g)}, ${gs(this.b)}${r===1?")":`, ${r})`}`}function dc(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function gs(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function ps(r){return r=gs(r),(r<16?"0":"")+r.toString(16)}function op(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new ki(r,t,e,n)}function lp(r){if(r instanceof ki)return new ki(r.h,r.s,r.l,r.opacity);if(r instanceof Ko||(r=uc(r)),!r)return new ki;if(r instanceof ki)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,l=(a+i)/2;return o?(t===a?s=(e-n)/o+(e0&&l<1?0:s,new ki(s,o,l,r.opacity)}function bS(r,t,e,n){return arguments.length===1?lp(r):new ki(r,t,e,n==null?1:n)}function ki(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}zd(ki,bS,tp(Ko,{brighter(r){return r=r==null?cc:Math.pow(cc,r),new ki(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?Qo:Math.pow(Qo,r),new ki(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 Vr(jd(r>=240?r-240:r+120,i,n),jd(r,i,n),jd(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new ki(cp(this.h),fc(this.s),fc(this.l),dc(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=dc(this.opacity);return`${r===1?"hsl(":"hsla("}${cp(this.h)}, ${fc(this.s)*100}%, ${fc(this.l)*100}%${r===1?")":`, ${r})`}`}}));function cp(r){return r=(r||0)%360,r<0?r+360:r}function fc(r){return Math.max(0,Math.min(1,r||0))}function jd(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 jn(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=so.kUnitType&&this.getType()<=so.kClampType}}],[{key:"isAngle",value:function(e){return e===te.kDegrees||e===te.kRadians||e===te.kGradians||e===te.kTurns}},{key:"isLength",value:function(e){return e>=te.kEms&&e1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},Wd=function(t){return TS(AS(t))},on=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:te.kNumber;(0,N.Z)(this,t),n=(0,_.Z)(this,t);var a;return typeof i=="string"?a=MS(i):a=i,n.unit=a,n.value=e,n}return(0,C.Z)(t,r),(0,T.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 so.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=Wd(this.unit);if(i!==Wd(n)||i===te.kUnknown)return null;var a=up(this.unit)/up(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case te.kUnknown:break;case te.kInteger:s=Number(this.value).toFixed(0);break;case te.kNumber:case te.kPercentage:case te.kEms:case te.kRems:case te.kPixels:case te.kDegrees:case te.kRadians:case te.kGradians:case te.kMilliseconds:case te.kSeconds:case te.kTurns:{var o=-999999,l=999999,c=this.value,u=Zd(this.unit);if(cl){var h=Zd(this.unit);!Number.isFinite(c)||Number.isNaN(c)?s=CS(c,h):s=c+(h||"")}else s="".concat(c).concat(u)}}return a+=s,a}}])}(vc),Ri=new on(0,"px");new on(1,"px");var ms=new on(0,"deg"),Gd=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,N.Z)(this,t),a=(0,_.Z)(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return(0,C.Z)(t,r),(0,T.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,")")}}])}(OS),hp=new pi("unset"),NS=new pi("initial"),kS=new pi("inherit"),Vd={"":hp,unset:hp,initial:NS,inherit:kS},PS=function(t){return Vd[t]||(Vd[t]=new pi(t)),Vd[t]},dp=new Gd(0,0,0,0,!0),fp=new Gd(0,0,0,0),RS=jn(function(r,t,e,n){return new Gd(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),En=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:te.kNumber;return new on(t,e)};new on(50,"%");function LS(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 _S=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(Ot){throw new Error("".concat(t,": ").concat(Ot))}function n(){var Ot=i();return t.length>0&&e("Invalid input not EOF"),Ot}function i(){return E(a)}function a(){return s("linear-gradient",r.linearGradient,l)||s("repeating-linear-gradient",r.repeatingLinearGradient,l)||s("radial-gradient",r.radialGradient,h)||s("repeating-radial-gradient",r.repeatingRadialGradient,h)||s("conic-gradient",r.conicGradient,h)}function s(Ot,mt,yt){return o(mt,function(Rt){var jt=yt();return jt&&(ft(r.comma)||e("Missing comma before color stops")),{type:Ot,orientation:jt,colorStops:E(O)}})}function o(Ot,mt){var yt=ft(Ot);if(yt){ft(r.startCall)||e("Missing (");var Rt=mt(yt);return ft(r.endCall)||e("Missing )"),Rt}}function l(){return c()||u()}function c(){return ct("directional",r.sideOrCorner,1)}function u(){return ct("angular",r.angleValue,1)}function h(){var Ot,mt=d(),yt;return mt&&(Ot=[],Ot.push(mt),yt=t,ft(r.comma)&&(mt=d(),mt?Ot.push(mt):t=yt)),Ot}function d(){var Ot=f()||v();if(Ot)Ot.at=p();else{var mt=g();if(mt){Ot=mt;var yt=p();yt&&(Ot.at=yt)}else{var Rt=y();Rt&&(Ot={type:"default-radial",at:Rt})}}return Ot}function f(){var Ot=ct("shape",/^(circle)/i,0);return Ot&&(Ot.style=ot()||g()),Ot}function v(){var Ot=ct("shape",/^(ellipse)/i,0);return Ot&&(Ot.style=J()||g()),Ot}function g(){return ct("extent-keyword",r.extentKeywords,1)}function p(){if(ct("position",/^at/,0)){var Ot=y();return Ot||e("Missing positioning value"),Ot}}function y(){var Ot=b();if(Ot.x||Ot.y)return{type:"position",value:Ot}}function b(){return{x:J(),y:J()}}function E(Ot){var mt=Ot(),yt=[];if(mt)for(yt.push(mt);ft(r.comma);)mt=Ot(),mt?yt.push(mt):e("One extra comma");return yt}function O(){var Ot=P();return Ot||e("Expected color definition"),Ot.length=J(),Ot}function P(){return F()||V()||I()||R()}function R(){return ct("literal",r.literalColor,0)}function F(){return ct("hex",r.hexColor,1)}function I(){return o(r.rgbColor,function(){return{type:"rgb",value:E(Y)}})}function V(){return o(r.rgbaColor,function(){return{type:"rgba",value:E(Y)}})}function Y(){return ft(r.number)[1]}function J(){return ct("%",r.percentageValue,1)||$()||ot()}function $(){return ct("position-keyword",r.positionKeywords,1)}function ot(){return ct("px",r.pixelValue,1)||ct("em",r.emValue,1)}function ct(Ot,mt,yt){var Rt=ft(mt);if(Rt)return{type:Ot,value:Rt[yt]}}function ft(Ot){var mt=/^[\n\r\t\s]+/.exec(t);mt&&Nt(mt[0].length);var yt=Ot.exec(t);return yt&&Nt(yt[0].length),yt}function Nt(Ot){t=t.substring(Ot)}return function(Ot){return t=Ot,n()}}();function DS(r,t,e,n){var i=an(n.value),a=0,s=0,o=a+t/2,l=s+e/2,c=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),u=r[0]+o-Math.cos(i)*c/2,h=r[1]+l-Math.sin(i)*c/2,d=r[0]+o+Math.cos(i)*c/2,f=r[1]+l+Math.sin(i)*c/2;return{x1:u,y1:h,x2:d,y2:f}}function IS(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===te.kPercentage&&(s=n.value/100*t),i.unit===te.kPercentage&&(o=i.value/100*e);var l=Math.max(Zr([0,0],[s,o]),Zr([0,e],[s,o]),Zr([t,e],[s,o]),Zr([t,0],[s,o]));return a&&(a instanceof on?l=a.value:a instanceof pi&&(a.value==="closest-side"?l=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?l=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(l=Math.min(Zr([0,0],[s,o]),Zr([0,e],[s,o]),Zr([t,e],[s,o]),Zr([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:l}}var BS=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,FS=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,zS=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,vp=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function jS(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=_S(r);return t.map(function(o){var l=o.type,c=o.orientation,u=o.colorStops;jS(u);var h=u.map(function(E){return{offset:En(Number(E.length.value),"%"),color:LS(E)}});if(l==="linear-gradient")return new gc(Da.LinearGradient,{angle:c?WS(c):ms,steps:h});if(l==="radial-gradient"&&(c||(c=[{type:"shape",value:"circle"}]),c[0].type==="shape"&&c[0].value==="circle")){var d=GS(c[0].at),f=d.cx,v=d.cy,g;if(c[0].style){var p=c[0].style,y=p.type,b=p.value;y==="extent-keyword"?g=PS(b):g=En(b,y)}return new gc(Da.RadialGradient,{cx:f,cy:v,size:g,steps:h})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=BS.exec(r);if(n){var i,a=((i=n[2].match(vp))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new gc(Da.LinearGradient,{angle:En(parseFloat(n[1]),"deg"),steps:a.map(function(o){var l=(0,L.Z)(o,2),c=l[0],u=l[1];return{offset:En(Number(c)*100,"%"),color:u}})})]}}else if(e==="r"){var s=US(r);if(s)if(Ge(s))r=s;else return[new gc(Da.RadialGradient,s)]}else if(e==="p")return YS(r)}});function US(r){var t=FS.exec(r);if(t){var e,n=((e=t[4].match(vp))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:En(50,"%"),cy:En(50,"%"),steps:n.map(function(i){var a=(0,L.Z)(i,2),s=a[0],o=a[1];return{offset:En(Number(s)*100,"%"),color:o}})}}return null}function YS(r){var t=zS.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 $8(r){return!!r.type&&!!r.value}function ys(r){return r&&!!r.image}function pc(r){return r&&!me(r.r)&&!me(r.g)&&!me(r.b)}var Jo=jn(function(r){if(ys(r))return(0,B.Z)({repetition:"repeat"},r);if(me(r)&&(r=""),r==="transparent")return fp;if(r==="currentColor")r="black";else if(r==="none")return dp;var t=VS(r);if(t)return t;var e=uc(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),RS.apply(void 0,n)});function HS(r,t){if(!(!pc(r)||!pc(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(kn(n[i],0,255));return n[3]=kn(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function $o(r,t){if(me(t))return En(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return En(Number(t),"px");if("deg".search(r)>=0)return En(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 En(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var gp=function(t){return $o(new RegExp("px","g"),t)},XS=jn(gp),KS=function(t){return $o(new RegExp("%","g"),t)};jn(KS);var pp=function(t){return ie(t)||isFinite(Number(t))?En(Number(t)||0,"px"):$o(new RegExp("px|%|em|rem","g"),t)},Ud=jn(pp),mp=function(t){return $o(new RegExp("deg|rad|grad|turn","g"),t)},QS=jn(mp);function qS(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,l=Wd(r.unit),c=r.convertTo(l),u=t.convertTo(l);return c&&u?(s=c.value,o=u.value,a=Zd(r.unit)):(on.isLength(r.unit)||on.isLength(t.unit))&&(s=ei(r,i,e),o=ei(t,i,e),a="px"),[s,o,function(h){return n&&(h=Math.max(h,0)),h+a}]}function Ur(r){var t=0;return r.unit===te.kDegrees?t=r.value:r.unit===te.kRadians?t=Gr(Number(r.value)):r.unit===te.kTurns?t=K2(Number(r.value)):r.value&&(t=r.value),t}function yp(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):Ge(r)?e=r.split(" ").map(function(n){return Number(n)}):ie(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,k.Z)(e),(0,k.Z)(e)):e}function ei(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===te.kPixels)return Number(r.value);if(r.unit===te.kPercentage&&e){var i=e.nodeName===Dt.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var JS=function(t){return $o(/deg|rad|grad|turn|px|%/g,t)},$S=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function tM(){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,$S.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return JS(a)||Jo(a)})}),t.lastIndex===r.length)return e}return[]}function bp(r){return r.toString()}var xp=function(t){return typeof t=="number"?En(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?En(Number(t)):En(0)},Yd=jn(xp);jn(function(r){return Ge(r)?r.split(" ").map(Yd):r.map(Yd)});function Hd(r,t){return[r,t,bp]}function Xd(r,t){return function(e,n){return[e,n,function(i){return bp(kn(i,r,t))}]}}function Ep(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function Kd(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=Qw(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function eM(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=L2(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function nM(r){for(var t=0;t0&&e.push(n),{polygons:t,polylines:e}}function mc(r,t){return r[0]===t[0]&&r[1]===t[1]}function aM(r,t){for(var e=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-c:c,u=u>Math.PI/2?Math.PI-u:u;var h={xExtra:Math.cos(l/2-c)*(t/2*(1/Math.sin(l/2)))-t/2||0,yExtra:Math.cos(u-l/2)*(t/2*(1/Math.sin(l/2)))-t/2||0};return h}function wp(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var Sp=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},Mp=function(t,e,n,i,a,s,o,l){e=Math.abs(e),n=Math.abs(n),i=Eg(i,360);var c=an(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 u=(t.x-o.x)/2,h=(t.y-o.y)/2,d={x:Math.cos(c)*u+Math.sin(c)*h,y:-Math.sin(c)*u+Math.cos(c)*h},f=Math.pow(d.x,2)/Math.pow(e,2)+Math.pow(d.y,2)/Math.pow(n,2);f>1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var v=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(d.y,2)-Math.pow(n,2)*Math.pow(d.x,2),g=Math.pow(e,2)*Math.pow(d.y,2)+Math.pow(n,2)*Math.pow(d.x,2),p=v/g;p=p<0?0:p;var y=(a!==s?1:-1)*Math.sqrt(p),b={x:y*(e*d.y/n),y:y*(-(n*d.x)/e)},E={x:Math.cos(c)*b.x-Math.sin(c)*b.y+(t.x+o.x)/2,y:Math.sin(c)*b.x+Math.cos(c)*b.y+(t.y+o.y)/2},O={x:(d.x-b.x)/e,y:(d.y-b.y)/n},P=Sp({x:1,y:0},O),R={x:(-d.x-b.x)/e,y:(-d.y-b.y)/n},F=Sp(O,R);!s&&F>0?F-=2*Math.PI:s&&F<0&&(F+=2*Math.PI),F%=2*Math.PI;var I=P+F*l,V=e*Math.cos(I),Y=n*Math.sin(I),J={x:Math.cos(c)*V-Math.sin(c)*Y+E.x,y:Math.sin(c)*V+Math.cos(c)*Y+E.y,ellipticalArcStartAngle:P,ellipticalArcEndAngle:P+F,ellipticalArcAngle:I,ellipticalArcCenter:E,resultantRx:e,resultantRy:n};return J};function sM(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,l=n.xRotation,c=n.arcFlag,u=n.sweepFlag,h=Mp({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},t),d=Mp({x:r.prePoint[0],y:r.prePoint[1]},a,o,l,!!c,!!u,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),f=d.x-h.x,v=d.y-h.y,g=Math.sqrt(f*f+v*v);return{x:-f/g,y:-v/g}}function bc(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Qd(r,t){return bc(r)*bc(t)?(r[0]*t[0]+r[1]*t[1])/(bc(r)*bc(t)):1}function Tp(r,t){return(r[0]*t[1]1&&(e*=Math.sqrt(f),n*=Math.sqrt(f));var v=e*e*(d*d)+n*n*(h*h),g=v?Math.sqrt((e*e*(n*n)-v)/v):1;a===s&&(g*=-1),isNaN(g)&&(g=0);var p=n?g*e*d/n:0,y=e?g*-n*h/e:0,b=(o+c)/2+Math.cos(i)*p-Math.sin(i)*y,E=(l+u)/2+Math.sin(i)*p+Math.cos(i)*y,O=[(h-p)/e,(d-y)/n],P=[(-1*h-p)/e,(-1*d-y)/n],R=Tp([1,0],O),F=Tp(O,P);return Qd(O,P)<=-1&&(F=Math.PI),Qd(O,P)>=1&&(F=0),s===0&&F>0&&(F-=2*Math.PI),s===1&&F<0&&(F+=2*Math.PI),{cx:b,cy:E,rx:mc(r,[c,u])?0:e,ry:mc(r,[c,u])?0:n,startAngle:R,endAngle:R+F,xRotation:i,arcFlag:a,sweepFlag:s}}function lM(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),l=vec3.fromValues(i[3],i[4],0),c=vec3.fromValues(i[5],i[6],0);e&&(vec3.transformMat4(o,o,e),vec3.transformMat4(l,l,e),vec3.transformMat4(c,c,e)),a="".concat(i[0]).concat(o[0],",").concat(o[1],",").concat(l[0],",").concat(l[1],",").concat(c[0],",").concat(c[1])}else if(i[0]==="A"){var u=vec3.fromValues(i[6],i[7],0);e&&vec3.transformMat4(u,u,e),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],",").concat(i[5],",").concat(u[0],",").concat(u[1])}else if(i[0]==="Q"){var h=vec3.fromValues(i[1],i[2],0),d=vec3.fromValues(i[3],i[4],0);e&&(vec3.transformMat4(h,h,e),vec3.transformMat4(d,d,e)),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],"}")}return n+=a},"")}function cM(r,t,e,n){return[["M",r,t],["L",e,n]]}function Op(r,t,e,n){var i=(-1+Math.sqrt(2))/3*4,a=r*i,s=t*i,o=e-r,l=e+r,c=n-t,u=n+t;return[["M",o,n],["C",o,n-s,e-a,c,e,c],["C",e+a,c,l,n-s,l,n],["C",l,n+s,e+a,u,e,u],["C",e-a,u,o,n+s,o,n],["Z"]]}function uM(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 hM(r,t,e,n,i){if(i){var a=_slicedToArray(i,4),s=a[0],o=a[1],l=a[2],c=a[3],u=r>0?1:-1,h=t>0?1:-1,d=u+h!==0?1:0;return[["M",u*s+e,n],["L",r-u*o+e,n],o?["A",o,o,0,0,d,r+e,h*o+n]:null,["L",r+e,t-h*l+n],l?["A",l,l,0,0,d,r+e-u*l,t+n]:null,["L",e+u*c,t+n],c?["A",c,c,0,0,d,e,t+n-h*c]:null,["L",e,h*s+n],s?["A",s,s,0,0,d,u*s+e,n]:null,["Z"]].filter(function(f){return f})}return[["M",e,n],["L",e+r,n],["L",e+r,n+t],["L",e,n+t],["Z"]]}function t9(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:r.getLocalTransform(),e=[];switch(r.nodeName){case Dt.LINE:var n=r.parsedStyle,i=n.x1,a=i===void 0?0:i,s=n.y1,o=s===void 0?0:s,l=n.x2,c=l===void 0?0:l,u=n.y2,h=u===void 0?0:u;e=cM(a,o,c,h);break;case Dt.CIRCLE:{var d=r.parsedStyle,f=d.r,v=f===void 0?0:f,g=d.cx,p=g===void 0?0:g,y=d.cy,b=y===void 0?0:y;e=Op(v,v,p,b);break}case Dt.ELLIPSE:{var E=r.parsedStyle,O=E.rx,P=O===void 0?0:O,R=E.ry,F=R===void 0?0:R,I=E.cx,V=I===void 0?0:I,Y=E.cy,J=Y===void 0?0:Y;e=Op(P,F,V,J);break}case Dt.POLYLINE:case Dt.POLYGON:var $=r.parsedStyle.points;e=uM($.points,r.nodeName===Dt.POLYGON);break;case Dt.RECT:var ot=r.parsedStyle,ct=ot.width,ft=ct===void 0?0:ct,Nt=ot.height,Ot=Nt===void 0?0:Nt,mt=ot.x,yt=mt===void 0?0:mt,Rt=ot.y,jt=Rt===void 0?0:Rt,Xt=ot.radius,ee=Xt&&Xt.some(function(he){return he!==0});e=hM(ft,Ot,yt,jt,ee&&Xt.map(function(he){return clamp(he,0,Math.min(Math.abs(ft)/2,Math.abs(Ot)/2))}));break;case Dt.PATH:var ae=r.parsedStyle.d.absolutePath;e=_toConsumableArray(ae);break}if(e.length)return lM(e,r,t)}function e9(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 l=s[0],c=r[o+1],u=o===0&&(t!==0||e!==0),h=(o===r.length-1||c&&(c[0]==="M"||c[0]==="Z"))&&n!==0&&i!==0,d=u?[t,e]:[0,0],f=_slicedToArray(d,2),v=f[0],g=f[1],p=h?[n,i]:[0,0],y=_slicedToArray(p,2),b=y[0],E=y[1];switch(l){case"M":return"M ".concat(s[1]+v,",").concat(s[2]+g);case"L":return"L ".concat(s[1]+b,",").concat(s[2]+E);case"Q":return"Q ".concat(s[1]," ").concat(s[2],",").concat(s[3]+b," ").concat(s[4]+E);case"C":return"C ".concat(s[1]," ").concat(s[2],",").concat(s[3]," ").concat(s[4],",").concat(s[5]+b," ").concat(s[6]+E);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(h?" 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 Cp=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=tc(t)}catch(f){e=tc(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}nM(e);var n=rM(e),i=iM(e),a=i.polygons,s=i.polylines,o=sM(e),l=aM(o,0),c=l.x,u=l.y,h=l.width,d=l.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(c)?c:0,y:Number.isFinite(u)?u:0,width:Number.isFinite(h)?h:0,height:Number.isFinite(d)?d:0}}},dM=jn(Cp);function Np(r){return Ge(r)?dM(r):Cp(r)}function fM(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=Nd(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=Nd(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=Mg(n,i));var s=Ag(a[0])!==Ag(a[1])?o2(a[0]):l2(a[0]);return[s,u2(a[1],s),function(o){return o}]}function vM(r,t){var e;return Ge(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=(0,L.Z)(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function gM(r,t){return[r.points,t.points,function(e){return e}]}var Pn=null,oo=/\s*(\w+)\(([^)]*)\)/g;function Yr(r){return function(t){var e=0;return r.map(function(n){return n===Pn?t[e++]:n})}}function bs(r){return r}var tl={matrix:["NNNNNN",[Pn,Pn,0,0,Pn,Pn,0,0,0,0,1,0,Pn,Pn,0,1],bs],matrix3d:["NNNNNNNNNNNNNNNN",bs],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",Yr([Pn,Pn,new on(1)]),bs],scaleX:["N",Yr([Pn,new on(1),new on(1)]),Yr([Pn,new on(1)])],scaleY:["N",Yr([new on(1),Pn,new on(1)]),Yr([new on(1),Pn])],scaleZ:["N",Yr([new on(1),new on(1),Pn])],scale3d:["NNN",bs],skew:["Aa",null,bs],skewX:["A",null,Yr([Pn,ms])],skewY:["A",null,Yr([ms,Pn])],translate:["Tt",Yr([Pn,Pn,Ri]),bs],translateX:["T",Yr([Pn,Ri,Ri]),Yr([Pn,Ri])],translateY:["T",Yr([Ri,Pn,Ri]),Yr([Ri,Pn])],translateZ:["L",Yr([Ri,Ri,Pn])],translate3d:["TTL",bs]};function kp(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;NM(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var l in n)if(OM.has(l)){o=!0;break}}var c=Dp(e);c.has("fill")&&n.fill&&(e.parsedStyle.fill=Jo(n.fill)),c.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=Jo(n.stroke)),c.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=Jo(n.shadowColor)),c.has("filter")&&n.filter&&(e.parsedStyle.filter=tM(n.filter)),c.has("radius")&&!me(n.radius)&&(e.parsedStyle.radius=yp(n.radius,4)),c.has("lineDash")&&!me(n.lineDash)&&(e.parsedStyle.lineDash=yp(n.lineDash,"even")),c.has("points")&&n.points&&(e.parsedStyle.points=vM(n.points)),c.has("d")&&n.d===""&&(e.parsedStyle.d=(0,B.Z)({},$g)),c.has("d")&&n.d&&(e.parsedStyle.d=Np(n.d)),c.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[$t.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),c.has("clipPath")&&!Te(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[$t.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),c.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[$t.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),c.has("transform")&&n.transform&&(e.parsedStyle.transform=Pp(n.transform)),c.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=TM(n.transformOrigin)),c.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[$t.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),c.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[$t.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),c.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[$t.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),c.has("zIndex")&&!me(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[$t.Z_INDEX].postProcessor(e),c.has("offsetDistance")&&!me(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[$t.OFFSET_DISTANCE].postProcessor(e),c.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[$t.TRANSFORM].postProcessor(e),c.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[$t.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.geometry.dirty=!0,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 pn),a.renderBounds||(a.renderBounds=new pn);var s=e.parsedStyle,o=i.update(s,e),l=o.cx,c=l===void 0?0:l,u=o.cy,h=u===void 0?0:u,d=o.cz,f=d===void 0?0:d,v=o.hwidth,g=v===void 0?0:v,p=o.hheight,y=p===void 0?0:p,b=o.hdepth,E=b===void 0?0:b,O=[Math.abs(g),Math.abs(y),E],P=s.stroke,R=s.lineWidth,F=R===void 0?1:R,I=s.increasedLineWidthForHitTesting,V=I===void 0?0:I,Y=s.shadowType,J=Y===void 0?"outer":Y,$=s.shadowColor,ot=s.filter,ct=ot===void 0?[]:ot,ft=s.transformOrigin,Nt=[c,h,f];a.contentBounds.update(Nt,O);var Ot=n===Dt.POLYLINE||n===Dt.POLYGON||n===Dt.PATH?Math.SQRT2:.5,mt=P&&!P.isNone;if(mt){var yt=((F||0)+(V||0))*Ot;O[0]+=yt,O[1]+=yt}if(a.renderBounds.update(Nt,O),$&&J&&J!=="inner"){var Rt=a.renderBounds,jt=Rt.min,Xt=Rt.max,ee=s.shadowBlur,ae=s.shadowOffsetX,he=s.shadowOffsetY,ce=ee||0,xe=ae||0,Ce=he||0,je=jt[0]-ce+xe,Ue=Xt[0]+ce+xe,or=jt[1]-ce+Ce,Ke=Xt[1]+ce+Ce;jt[0]=Math.min(jt[0],je),Xt[0]=Math.max(Xt[0],Ue),jt[1]=Math.min(jt[1],or),Xt[1]=Math.max(Xt[1],Ke),a.renderBounds.setMinMax(jt,Xt)}ct.forEach(function(vr){var Aa=vr.name,Sr=vr.params;if(Aa==="blur"){var Jr=Sr[0].value;a.renderBounds.update(a.renderBounds.center,Ut(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[Jr,Jr,0]))}else if(Aa==="drop-shadow"){var Be=Sr[0].value,Qe=Sr[1].value,Fe=Sr[2].value,Ye=a.renderBounds,nn=Ye.min,pe=Ye.max,He=nn[0]-Fe+Be,qe=pe[0]+Fe+Be,tr=nn[1]-Fe+Qe,Je=pe[1]+Fe+Qe;nn[0]=Math.min(nn[0],He),pe[0]=Math.max(pe[0],qe),nn[1]=Math.min(nn[1],tr),pe[1]=Math.max(pe[1],Je),a.renderBounds.setMinMax(nn,pe)}}),e.geometry.dirty=!1;var hi=g<0,Pr=y<0,ns=(hi?-1:1)*(ft?ei(ft[0],0,e,!0):0),wr=(Pr?-1:1)*(ft?ei(ft[1],1,e,!0):0);(ns||wr)&&e.setOrigin(ns,wr)}}},{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===Dt.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===Dt.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function NM(r,t){var e=Dp(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function Dp(r){return r.constructor.PARSED_STYLE_LIST}var kM=function(){function r(){(0,N.Z)(this,r),this.mixer=Hd}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i,a){return Ur(i)}}])}(),PM=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof pi&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtyToRoot(o)}),i}}])}(),RM=function(){function r(){(0,N.Z)(this,r),this.parser=Jo,this.mixer=HS}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof pi?i.value==="none"?dp:fp:i}}])}(),LM=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi?[]:i}}])}();function Ip(r){var t=r.parsedStyle,e=t.fontSize;return me(e)?null:e}var ef=function(){function r(){(0,N.Z)(this,r),this.mixer=Hd}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){if(ie(i))return i;if(on.isRelativeUnit(i.unit)){if(i.unit===te.kPercentage)return 0;if(i.unit===te.kEms){if(a.parentNode){var o=Ip(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===te.kRems){var l;if(a!=null&&(l=a.ownerDocument)!==null&&l!==void 0&&l.documentElement){var c=Ip(a.ownerDocument.documentElement);if(c)return c*=i.value,c}return 0}}else return i.value}}])}(),_M=function(){function r(){(0,N.Z)(this,r),this.mixer=Ep}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),DM=function(){function r(){(0,N.Z)(this,r),this.mixer=Ep}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),IM=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof pi&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),BM=function(){function r(){(0,N.Z)(this,r),this.mixer=Hd}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),FM=function(){function r(){(0,N.Z)(this,r),this.mixer=Xd(0,1)}return(0,T.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===Dt.LINE||s===Dt.PATH||s===Dt.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),zM=function(){function r(){(0,N.Z)(this,r),this.mixer=Xd(0,1)}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),jM=function(){function r(){(0,N.Z)(this,r),this.parser=Np,this.mixer=fM}return(0,T.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof pi&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new no(0,0,0,0)}:i}}])}(),ZM=(0,T.Z)(function r(){(0,N.Z)(this,r),this.mixer=gM}),WM=function(r){function t(){var e;(0,N.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a>>1;Bp(r[i],t)<0?e=i+1:n=i}return e}function Bp(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 Fp(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 zp="px";function XM(r,t,e){rf&&r.style&&(r.style.width=t+zp,r.style.height=e+zp)}function jp(r,t){if(rf)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function KM(r){var t=jp(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function QM(r){var t=jp(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var qM=1,JM={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},af=typeof performance=="object"&&performance.now?performance:Date;function xc(r){return r.nodeName===Dt.FRAGMENT?!0:r.getRootNode().nodeName===Dt.FRAGMENT}function xs(){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 $M=1,tA=function(){return $M++},Ki=typeof self=="object"&&self.self===self?self:typeof S.g=="object"&&S.g.global===S.g?S.g:{},eA=Date.now(),nA=function(){return Ki.performance&&typeof Ki.performance.now=="function"?Ki.performance.now():Date.now()-eA},el={},Zp=Date.now(),rA=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-Zp,i=n>16?0:16-n,a=tA();return el[a]=t,Object.keys(el).length>1||setTimeout(function(){Zp=e;var s=el;el={},Object.keys(s).forEach(function(o){return s[o](nA())})},i),a},iA=function(t){delete el[t]},aA=["","webkit","moz","ms","o"],Wp=function(t){return typeof t!="string"?rA:t===""?Ki.requestAnimationFrame:Ki["".concat(t,"RequestAnimationFrame")]},sA=function(t){return typeof t!="string"?iA:t===""?Ki.cancelAnimationFrame:Ki["".concat(t,"CancelAnimationFrame")]||Ki["".concat(t,"CancelRequestAnimationFrame")]},oA=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},Gp=oA(aA,function(r){return!!Wp(r)}),sf=Wp(Gp),Vp=sA(Gp);Ki.requestAnimationFrame=sf,Ki.cancelAnimationFrame=Vp;var lA=function(){function r(){(0,N.Z)(this,r),this.callbacks=[]}return(0,T.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;u--){var h=c[u].trim();!hA.test(h)&&uA.indexOf(h)<0&&(h='"'.concat(h,'"')),c[u]=h}return"".concat(a," ").concat(s," ").concat(o," ").concat(l," ").concat(c.join(","))},function(r){var t=Up(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)}),dA=1e-6,nl=function(t){return Math.max(t,dA)};function lf(r,t,e){return ge(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var Zn=Wt(),fA=Wt(),vA={scale:function(t){gn(Zn,[t[0].value,t[1].value,1].map(function(e){return nl(e)}))},scaleX:function(t){gn(Zn,[t[0].value,1,1].map(function(e){return nl(e)}))},scaleY:function(t){gn(Zn,[1,t[0].value,1].map(function(e){return nl(e)}))},scaleZ:function(t){gn(Zn,[1,1,t[0].value].map(function(e){return nl(e)}))},scale3d:function(t){gn(Zn,[t[0].value,t[1].value,t[2].value].map(function(e){return nl(e)}))},translate:function(t){Xn(Zn,[t[0].value,t[1].value,0])},translateX:function(t){Xn(Zn,[t[0].value,0,0])},translateY:function(t){Xn(Zn,[0,t[0].value,0])},translateZ:function(t){Xn(Zn,[0,0,t[0].value])},translate3d:function(t){Xn(Zn,[t[0].value,t[1].value,t[2].value])},rotate:function(t){Fn(Zn,an(Ur(t[0])))},rotateX:function(t){vi(Zn,an(Ur(t[0])))},rotateY:function(t){ze(Zn,an(Ur(t[0])))},rotateZ:function(t){Fn(Zn,an(Ur(t[0])))},rotate3d:function(t){ti(Zn,an(Ur(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){lf(Zn,an(t[0].value),an(t[1].value))},skewX:function(t){lf(Zn,an(t[0].value),0)},skewY:function(t){lf(Zn,0,an(t[0].value))},matrix:function(t){un(Zn,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){un.apply(A,[Zn].concat((0,k.Z)(t.map(function(e){return e.value}))))}},gA=Et(1,1,1),pA=pt(),Hp={translate:function(t,e){Vt.sceneGraphService.setLocalScale(t,gA,!1),Vt.sceneGraphService.setLocalEulerAngles(t,pA,void 0,void 0,!1),Vt.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),Vt.sceneGraphService.dirtyLocalTransform(t,t.transformable)}};function Xp(r,t){if(r.length){if(r.length===1&&Hp[r[0].t]){Hp[r[0].t](t,r[0].d);return}for(var e=ge(fA),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}}])}(),On=function(r){function t(){var e;(0,N.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(rn)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(rn)}},{key:"lookupPrefix",value:function(n){throw new Error(rn)}},{key:"normalize",value:function(){throw new Error(rn)}},{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];(l=i.parentNode)!==null&&l!==void 0?l:a.parentNode;){var l;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 c=s.length>o.length?s:o,u=c===s?o:s;if(c[c.length-u.length]===u[0])return c===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var h=c.length-u.length,d=u.length-1;d>=0;d--){var f=u[d],v=c[h+d];if(v!==f){var g=f.parentNode.childNodes;return g.indexOf(f)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}}])}(Qp);On.DOCUMENT_POSITION_DISCONNECTED=1,On.DOCUMENT_POSITION_PRECEDING=2,On.DOCUMENT_POSITION_FOLLOWING=4,On.DOCUMENT_POSITION_CONTAINS=8,On.DOCUMENT_POSITION_CONTAINED_BY=16,On.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var NA=2048,kA=function(){function r(t,e){var n=this;(0,N.Z)(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=Wt(),this.tmpVec3=pt(),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=af.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 l=n.trackingData(i.pointerId),c=n.findMountedTarget(l.pressTargetsByButton[i.button]),u=c;if(c&&!s.composedPath().includes(c)){for(var h=c;h&&!s.composedPath().includes(h);){if(s.currentTarget=h,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var d=s.button===2;n.notifyTarget(s,d?"rightupoutside":"mouseupoutside")}On.isNode(h)&&(h=h.parentNode)}delete l.pressTargetsByButton[i.button],u=h}if(u){var f,v=n.clonePointerEvent(s,"click");v.target=u,v.path=[],l.clicksByButton[i.button]||(l.clicksByButton[i.button]={clickCount:0,target:v.target,timeStamp:a});var g=n.context.renderingContext.root.ownerDocument.defaultView,p=l.clicksByButton[i.button];p.target===v.target&&a-p.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:!l&&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||On.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=YM(n)&&n.getAttribute("cursor");if(i)return i;n=On.isNode(n)&&n.parentNode}}}])}(),uf=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||Vt.offscreenCanvas)this.canvas=e||Vt.offscreenCanvas,this.context=this.canvas.getContext("2d",(0,B.Z)({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",(0,B.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,B.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}}])}(),lo=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}({}),PA=function(){function r(t,e){(0,N.Z)(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new Ir,initAsync:new lA,dirtycheck:new of,cull:new of,beginFrame:new Ir,beforeRender:new Ir,render:new Ir,afterRender:new Ir,endFrame:new Ir,destroy:new Ir,pick:new cA,pickSync:new of,pointerDown:new Ir,pointerUp:new Ir,pointerMove:new Ir,pointerOut:new Ir,pointerOver:new Ir,pointerWheel:new Ir,pointerCancel:new Ir,click:new Ir},this.globalRuntime=t,this.context=e}return(0,T.Z)(r,[{key:"init",value:function(e){var n=this,i=(0,B.Z)((0,B.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(lo.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this;this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0;var s=this.context.renderingContext;if(this.globalRuntime.sceneGraphService.syncHierarchy(s.root),this.globalRuntime.sceneGraphService.triggerPendingEvents(),s.renderReasons.size&&this.inited){s.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var o=s.renderReasons.size===1&&s.renderReasons.has(lo.CAMERA_CHANGED),l=!e.disableRenderHooks||!o;l&&this.renderDisplayObject(s.root,e,s),this.hooks.beginFrame.call(n),l&&s.renderListCurrentFrame.forEach(function(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),this.hooks.endFrame.call(n),s.renderListCurrentFrame=[],s.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,l=s.enableCulling;function c(g){var p=g.renderable,y=g.sortable,b=o?p.dirty||i.dirtyRectangleRenderingDisabled?g:null:g,E=null;b&&(E=l?a.hooks.cull.call(b,a.context.camera):b,E&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(E))),g.dirty(!1),y.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,y.dirty&&(a.sort(g,y),y.dirty=!1,y.dirtyChildren=[],y.dirtyReason=void 0)}for(var u=[e];u.length>0;){var h,d=u.pop();c(d);for(var f=((h=d.sortable)===null||h===void 0||(h=h.sorted)===null||h===void 0?void 0:h.length)>0?d.sortable.sorted:d.childNodes,v=f.length-1;v>=0;v--)u.push(f[v])}}},{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!==lc.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(s){var o=n.sorted.indexOf(s);o>-1&&n.sorted.splice(o,1);var l=e.childNodes.indexOf(s);if(l>-1)if(n.sorted.length===0)n.sorted.push(s);else{var c=HM(n.sorted,s);n.sorted.splice(c,0,s)}}):n.sorted=e.childNodes.slice().sort(Bp),((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(),this.globalRuntime.sceneGraphService.clearPendingEvents()}},{key:"dirtify",value:function(){this.context.renderingContext.renderReasons.add(lo.DISPLAY_OBJECT_CHANGED)}}])}(),RA=/\[\s*(.*)=(.*)\s*\]/,LA=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(l){return((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(l){return l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):null}return n.find(function(l){return n!==l&&l.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(l){return n!==l&&((l==null?void 0:l.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(l){return n!==l&&l.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(l){return n!==l&&(s==="name"?l.name===o:i.attributeToString(l,s)===o)}):[]}return n.findAll(function(l){return n!==l&&l.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(RA),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 me(i)?"":i.toString?i.toString():""}}])}(),De=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}({}),Qi=function(r){function t(e,n,i,a,s,o,l,c){var u;return(0,N.Z)(this,t),u=(0,_.Z)(this,t,[null]),u.relatedNode=n,u.prevValue=i,u.newValue=a,u.attrName=s,u.attrChange=o,u.prevParsedValue=l,u.newParsedValue=c,u.type=e,u}return(0,C.Z)(t,r),(0,T.Z)(t)}(Ec);Qi.ADDITION=2,Qi.MODIFICATION=1,Qi.REMOVAL=3;var _A=new Qi(De.REPARENT,null,"","","",0,"",""),DA=Td(),Sc=pt(),IA=Et(1,1,1),BA=Wt(),FA=Td(),Es=pt(),zA=Wt(),ws=Kn(),jA=pt(),ZA=Kn(),WA=pt(),rl=pt(),Ss=pt(),Mc=Wt(),qp=Kn(),Jp=Kn(),Ac=Kn(),Tc={affectChildren:!0},GA=function(){function r(t){(0,N.Z)(this,r),this.pendingEvents=new Map,this.boundsChangedEvent=new Qn(De.BOUNDS_CHANGED),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return(0,T.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===Dt.FRAGMENT,l=xc(n);e.parentNode=n;var c=o?e.childNodes:[e];ie(i)?c.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):c.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var u=n,h=u.sortable;if((h!=null&&(a=h.sorted)!==null&&a!==void 0&&a.length||h.dirty||e.parsedStyle.zIndex)&&(h.dirtyChildren.indexOf(e)===-1&&h.dirtyChildren.push(e),h.dirty=!0,h.dirtyReason=lc.ADDED),!l){if(o)this.dirtifyFragment(e);else{var d=e.transformable;d&&this.dirtyWorldTransform(e,d)}if(s){var f,v=((f=n.ownerDocument)===null||f===void 0||(f=f.defaultView)===null||f===void 0||(f=f.getConfig())===null||f===void 0||(f=f.future)===null||f===void 0?void 0:f.experimentalCancelEventPropagation)===!0;e.dispatchEvent(_A,v,v)}}}},{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=lc.REMOVED);var l=e.parentNode.childNodes.indexOf(e);l>-1&&e.parentNode.childNodes.splice(l,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 Jg(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;rl[0]=n[0],rl[1]=n[1],rl[2]=(i=n[2])!==null&&i!==void 0?i:0,!ha(s.localPosition,rl)&&(kt(s.localPosition,rl),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=Et(n,i,a));var s=e.transformable;ha(n,Sc)||(cr(n,n,s.localRotation),Ut(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=hg(ws,n,i,a,s));var l=e.transformable;ql(l.localRotation,n),o&&this.dirtyLocalTransform(e,l)}},{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=Et(n,i,a));var s=e.transformable;Ql(Jp,n[0],n[1],n[2]),dg(s.localRotation,s.localRotation,Jp),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;zt(Es,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!ha(Es,s.localScale)&&(kt(s.localScale,Es),a&&this.dirtyLocalTransform(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;Ee(a.localScale,a.localScale,zt(Es,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=Nw(FA,n,i));var s=e.transformable;Cw(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=Et(n,i,a));var o=e.transformable;Ql(o.localRotation,n[0],n[1],n[2]),s&&this.dirtyLocalTransform(e,o)}},{key:"setLocalTransform",value:function(e,n){var i=Tn(jA,n),a=Js(ZA,n),s=Na(WA,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,IA,!1),this.setLocalPosition(e,Sc,!1),this.setLocalEulerAngles(e,Sc,void 0,void 0,!1),this.setLocalSkew(e,DA,void 0,!1),this.dirtyLocalTransform(e,e.transformable)}},{key:"getPosition",value:function(e){var n=e.transformable;return Tn(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Js(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Na(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(Ss[0]=n[0],Ss[1]=n[1],Ss[2]=(i=n[2])!==null&&i!==void 0?i:0,!ha(this.getPosition(e),Ss)){if(kt(a.position,Ss),e.parentNode===null||!e.parentNode.transformable)kt(a.localPosition,Ss);else{var s=e.parentNode.transformable;we(Mc,s.worldTransform),Ze(Mc,Mc),re(a.localPosition,Ss,Mc)}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=zt(Es,n,i,a)),!ha(n,Sc)&&(Ut(Es,this.getPosition(e),n),this.setPosition(e,Es))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=Aw(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var l=this.getRotation(e.parentNode);ql(ws,l),Ad(ws,ws),Pa(o.localRotation,ws,n),Jl(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=Et(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=ws;Ql(o,n[0],n[1],n[2]);var l=this.getRotation(e),c=this.getRotation(e.parentNode);ql(Ac,c),Ad(Ac,Ac),Pa(o,Ac,o),Pa(s.localRotation,o,l),Jl(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=Et(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{Ql(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);ql(qp,Ad(ws,o)),dg(s.localRotation,s.localRotation,qp),this.dirtyLocalTransform(e,s)}}},{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(!pn.isEmpty(a)){var s=i||new pn;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&Vt.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new pn}},{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,l=this.getTransformedGeometryBounds(e,i,o),c=e.childNodes;if(c.forEach(function(d){var f=n.getBounds(d,i);f&&(l?l.add(f):(l=o||new pn,l.update(f.center,f.halfExtents)))}),l||(l=new pn),i){var u=Fp(e);if(u){var h=u.parsedStyle.clipPath.getBounds(i);l?h&&(l=h.intersection(l)):l.update(h.center,h.halfExtents)}}return i?(s.renderBounds=l,s.renderBoundsDirty=!1):(s.bounds=l,s.boundsDirty=!1),l}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=BA;e.parentNode.transformable&&(n=Ze(zA,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!pn.isEmpty(i)){var a=new pn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);pn.isEmpty(a)||(i=new pn,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(),l=(0,L.Z)(o,2),c=l[0],u=l[1],h=i.getMax(),d=(0,L.Z)(h,2),f=d[0],v=d[1];return new no(c+((s==null?void 0:s.left)||0),u+((s==null?void 0:s.top)||0),f-c,v-u)}return new no((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;Jg(e.transformable),sS(e.transformable,i)}},{key:"internalUpdateElement",value:function(e,n){var i,a,s,o,l=((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,c=n[n.length-1],u=(c==null?void 0:c.transformDirty)||((a=e.transformable)===null||a===void 0?void 0:a.localDirtyFlag);if(e.transformable){var h;(h=e.transformable).dirtyFlag||(h.dirtyFlag=u)}if(this.internalUpdateTransform(e),u){var d;(d=e.dirty)===null||d===void 0||d.call(e,!0,!0)}var f=((s=e.renderable)===null||s===void 0?void 0:s.boundsDirty)||((o=e.renderable)===null||o===void 0?void 0:o.renderBoundsDirty);if((u||f)&&(c==null?void 0:c.shapeUpdated)===!1&&l)for(var v=n.length-1;v>=0;){var g,p,y=n[v];if(y.shapeUpdated)break;(g=(p=y.node).dirty)===null||g===void 0||g.call(p,!0,!0),y.shapeUpdated=!0,v-=1}return u}},{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(),l=s[s.length-1];s.length>0&&o.parentNode!==l.node;)l=s.pop();var c=this.internalUpdateElement(o,s);if(o.childNodes.length>0){for(var u=o.childNodes.length-1;u>=0;u--)a.push(o.childNodes[u]);s.push({node:o,transformDirty:c,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(e,n){xc(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtyWorldTransform(e,n))}},{key:"dirtyWorldTransform",value:function(e,n){this.dirtifyWorldInternal(e,n),this.dirtyToRoot(e,!0)}},{key:"dirtifyWorldInternal",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 l=o.transformable;a.dirtifyWorldInternal(o,l)}))}},{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,l;if((o=(l=a).dirty)===null||o===void 0||o.call(l,!0,!0),s)break;a=a.parentNode}i&&e.forEach(function(c){var u;(u=c.dirty)===null||u===void 0||u.call(c,!0,!0)}),this.informDependentDisplayObjects(e),this.pendingEvents.set(e,i)}},{key:"dirtifyFragment",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;othis.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()}}])}(),Ms={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]},tm=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,VA=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,UA=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,YA=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,HA=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,XA=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,KA=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,QA=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,qA=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,JA=new RegExp("".concat(VA.source,"|").concat(YA.source,"|").concat(XA.source,"|").concat(QA.source)),$A=new RegExp("".concat(UA.source,"|").concat(HA.source,"|").concat(KA.source,"|").concat(qA.source)),tT=function(){function r(t){var e=this;(0,N.Z)(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&($A.exec(i)||JA.exec(n)))},this.trimByKinsokuShorui=function(n){var i=(0,k.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 $p(100)}return(0,T.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=Ms.MetricsString+Ms.BaselineSymbol,l=Math.ceil(s.measureText(o).width),c=Math.ceil(s.measureText(Ms.BaselineSymbol).width),u=Ms.HeightMultiplier*c;c=c*Ms.BaselineMultiplier|0,a.width=l,a.height=u,s.fillStyle="#f00",s.fillRect(0,0,l,u),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,c);var h=s.getImageData(0,0,l||1,u||1).data,d=h.length,f=l*4,v=0,g=0,p=!1;for(v=0;vc;--v){for(var b=0;bjt&&yt>=Rt;)yt-=1,mt=mt.slice(0,-1);return{lineTxt:mt,txtLastCharIndex:yt}}function J(mt,yt){if(!(V<=0||V>p)){if(!b[mt]){b[mt]=y;return}var Rt=Y(b[mt],yt,P+1,p-V);b[mt]=Rt.lineTxt+y}}for(var $=0;$=f){$p){J(E,$-1),n.isOverflowing=!0;break}if(O>0&&O+Nt>p){var Ot=Y(b[E],$-1,P+1,p);if(Ot.txtLastCharIndex!==$-1){if(b[E]=Ot.lineTxt,Ot.txtLastCharIndex===s.length-1)break;$=Ot.txtLastCharIndex+1,ot=s[$],ct=s[$-1],ft=s[$+1],Nt=I(ot)}if(E+1>=f){J(E,$-1),n.isOverflowing=!0;break}if(P=$-1,E+=1,O=0,b[E]="",this.isBreakingSpace(ot))continue;this.canBreakInLastChar(ot)||(b=this.trimToBreakable(b),O=this.sumTextWidthByCache(b[E]||"",I)),this.shouldBreakByKinsokuShorui(ot,ft)&&(b=this.trimByKinsokuShorui(b),O+=I(ct||""))}O+=Nt,b[E]+=ot}return b.join(` `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:Ms.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:Ms.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=(0,k.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),l=a+1,c=a+(o?0:1);return n[n.length-1]+=i.slice(l,i.length),n[n.length-2]=i.slice(0,c),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&tm.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(!tm.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,l=a.measureText(e);s=l.width+o,i.put(e,s)}return s}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),Vt={},eT=function(r){var t=new AA,e=new MA;return r={},(0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)(r,Dt.FRAGMENT,null),Dt.CIRCLE,new xA),Dt.ELLIPSE,new EA),Dt.RECT,t),Dt.IMAGE,t),Dt.GROUP,new OA),Dt.LINE,new wA),Dt.TEXT,new TA(Vt)),Dt.POLYLINE,e),Dt.POLYGON,e),(0,se.Z)((0,se.Z)((0,se.Z)(r,Dt.PATH,new SA),Dt.HTML,new CA),Dt.MESH,null)}(),nT=function(r){var t=new RM,e=new ef;return r={},(0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)(r,$t.PERCENTAGE,null),$t.NUMBER,new BM),$t.ANGLE,new kM),$t.DEFINED_PATH,new PM),$t.PAINT,t),$t.COLOR,t),$t.FILTER,new LM),$t.LENGTH,e),$t.LENGTH_PERCENTAGE,e),$t.LENGTH_PERCENTAGE_12,new _M),(0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)(r,$t.LENGTH_PERCENTAGE_14,new DM),$t.COORDINATE,new ef),$t.OFFSET_DISTANCE,new FM),$t.OPACITY_VALUE,new zM),$t.PATH,new jM),$t.LIST_OF_POINTS,new ZM),$t.SHADOW_BLUR,new WM),$t.TEXT,new GM),$t.TEXT_TRANSFORM,new VM),$t.TRANSFORM,new mA),(0,se.Z)((0,se.Z)((0,se.Z)(r,$t.TRANSFORM_ORIGIN,new yA),$t.Z_INDEX,new bA),$t.MARKER,new IM)}(),rT=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof S.g!="undefined"?S.g:{}};Vt.CameraContribution=qg,Vt.AnimationTimeline=null,Vt.EasingFunction=null,Vt.offscreenCanvasCreator=new uf,Vt.sceneGraphSelector=new LA,Vt.sceneGraphService=new GA(Vt),Vt.textService=new tT(Vt),Vt.geometryUpdaterFactory=eT,Vt.CSSPropertySyntaxFactory=nT,Vt.styleValueRegistry=new CM(Vt),Vt.layoutRegistry=null,Vt.globalThis=rT(),Vt.enableStyleSyntax=!0,Vt.enableSizeAttenuation=!1;var em=0;function i9(){em=0}var hf=new Qi(De.INSERTED,null,"","","",0,"",""),df=new Qi(De.REMOVED,null,"","","",0,"",""),nm=new Qn(De.DESTROY),iT=function(r){function t(){var e;(0,N.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?arguments[1]:!1;this.renderable.dirty=n,i&&(this.renderable.boundsDirty=n,this.renderable.renderBoundsDirty=n)}},{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(rn)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(U2);return Vt.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!xc(this)&&n.nodeName===Dt.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(hf.relatedNode=this,n.dispatchEvent(hf)),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 df.relatedNode=this,n.dispatchEvent(df,s,s),(a=n.ownerDocument)!==null&&a!==void 0&&a.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),Vt.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 Vt.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return Vt.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return Vt.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return Vt.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return Vt.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return Vt.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return Vt.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(Vt.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]:{},i={forceUpdateGeometry:!0};Vt.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;Te(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),Cg(t,"setAttribute",this,3)([n,i]))}},{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];Vt.styleValueRegistry.processProperties(this,(0,se.Z)({},n,i),a),this.dirty();var l=this.parsedStyle[n];if(this.isConnected)if(qi.relatedNode=this,qi.prevValue=s,qi.newValue=i,qi.attrName=n,qi.prevParsedValue=o,qi.newParsedValue=l,this.isMutationObserved)this.dispatchEvent(qi);else{var c,u=((c=this.ownerDocument.defaultView.getConfig().future)===null||c===void 0?void 0:c.experimentalCancelEventPropagation)===!0;qi.target=this,this.ownerDocument.defaultView.dispatchEvent(qi,!0,u)}if(this.isCustomElement&&this.isConnected||!this.isCustomElement){var h,d;(h=(d=this).attributeChangedCallback)===null||h===void 0||h.call(d,n,s,i,o,l)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=(0,L.Z)(i,2),s=a[0],o=a[1],l=n.getMax(),c=(0,L.Z)(l,2),u=c[0],h=c[1];return new no(s,o,u-s,h-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 Vt.sceneGraphService.setOrigin(this,Dr(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return Vt.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 Vt.sceneGraphService.setPosition(this,Dr(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 Vt.sceneGraphService.setLocalPosition(this,Dr(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 Vt.sceneGraphService.translate(this,Dr(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 Vt.sceneGraphService.translateLocal(this,Dr(n,i,a,!1)),this}},{key:"getPosition",value:function(){return Vt.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return Vt.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=Dr(n,i,a,!1)),Vt.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=Dr(n,i,a,!1)),Vt.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return Vt.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return Vt.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=Id(il,Vt.sceneGraphService.getWorldTransform(this)),i=(0,L.Z)(n,3),a=i[2];return Gr(a)}},{key:"getLocalEulerAngles",value:function(){var n=Id(il,Vt.sceneGraphService.getLocalRotation(this)),i=(0,L.Z)(n,3),a=i[2];return Gr(a)}},{key:"setEulerAngles",value:function(n){return Vt.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return Vt.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return me(i)&&me(a)?Vt.sceneGraphService.rotateLocal(this,0,0,n):Vt.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return me(i)&&me(a)?Vt.sceneGraphService.rotate(this,0,0,n):Vt.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return Vt.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return Vt.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return Vt.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return Vt.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return Vt.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return Vt.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return Vt.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return Vt.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return Vt.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){Vt.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,k.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,k.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}}])}(iT);yn.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 Ji=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.CIRCLE},e)])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);Ji.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var oT=["style"],ff=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,vs.Z)(n,oT);return(0,N.Z)(this,t),e=(0,_.Z)(this,t,[(0,B.Z)({style:i},a)]),e.isCustomElement=!0,e}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);ff.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var al=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.ELLIPSE},e)])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);al.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var lT=function(r){function t(){return(0,N.Z)(this,t),(0,_.Z)(this,t,[{type:Dt.FRAGMENT}])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);lT.PARSED_STYLE_LIST=new Set(["class","className"]);var rr=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.GROUP},e)])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);rr.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var cT=["style"],co=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,vs.Z)(n,cT);return(0,N.Z)(this,t),e=(0,_.Z)(this,t,[(0,B.Z)({type:Dt.HTML,style:i},a)]),e.cullable.enable=!1,e}return(0,C.Z)(t,r),(0,T.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=Ze(Wt(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!pn.isEmpty(i)){var a=new pn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(yn);co.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var sl=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.IMAGE},e)])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);sl.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var uT=["style"],As=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,vs.Z)(n,uT);(0,N.Z)(this,t),e=(0,_.Z)(this,t,[(0,B.Z)({type:Dt.LINE,style:(0,B.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,l=s.markerEnd;return o&&Ve(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Ve(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,C.Z)(t,r),(0,T.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&&Ve(s)&&(this.markerStartAngle=0,s.remove()),o&&Ve(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&Ve(s)&&(this.markerEndAngle=0,s.remove()),o&&Ve(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,l=i.markerEndOffset,c=i.x1,u=i.x2,h=i.y1,d=i.y2,f=n?a:s;if(!(!f||!Ve(f))){var v=0,g,p,y,b,E,O;n?(y=c,b=h,g=u-c,p=d-h,E=o||0,O=this.markerStartAngle):(y=u,b=d,g=c-u,p=h-d,E=l||0,O=this.markerEndAngle),v=Math.atan2(p,g),f.setLocalEulerAngles(v*180/Math.PI+O),f.setLocalPosition(y+Math.cos(v)*E,b+Math.sin(v)*E)}}},{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,l=a.x2,c=a.y2,u=Yi(s,o,l,c,n),h=u.x,d=u.y,f=re(pt(),Et(h,d,0),i?this.getWorldTransform():this.getLocalTransform());return new gr(f[0],f[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 _g(i,a,s,o)}}])}(yn);As.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var hT=["style"],ni=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,vs.Z)(n,hT);(0,N.Z)(this,t),e=(0,_.Z)(this,t,[(0,B.Z)({type:Dt.PATH,style:i,initialParsedStyle:{miterLimit:4,d:(0,B.Z)({},$g)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,l=s.markerEnd,c=s.markerMid;return o&&Ve(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ve(c)&&e.placeMarkerMid(c),l&&Ve(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,C.Z)(t,r),(0,T.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&&Ve(s)&&(this.markerStartAngle=0,s.remove()),o&&Ve(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ve(s)&&(this.markerEndAngle=0,s.remove()),o&&Ve(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,l=i.markerEndOffset,c=n?a:s;if(!(!c||!Ve(c))){var u=0,h,d,f,v,g,p;if(n){var y=this.getStartTangent(),b=(0,L.Z)(y,2),E=b[0],O=b[1];f=O[0],v=O[1],h=E[0]-O[0],d=E[1]-O[1],g=o||0,p=this.markerStartAngle}else{var P=this.getEndTangent(),R=(0,L.Z)(P,2),F=R[0],I=R[1];f=I[0],v=I[1],h=F[0]-I[0],d=F[1]-I[1],g=l||0,p=this.markerEndAngle}u=Math.atan2(d,h),c.setLocalEulerAngles(u*180/Math.PI+p),c.setLocalPosition(f+Math.cos(u)*g,v+Math.sin(u)*g)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(u){u.remove()}),n&&Ve(n))for(var a=1;a1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=g2(a,n),o=s.x,l=s.y,c=re(pt(),Et(o,l,0),i?this.getWorldTransform():this.getLocalTransform());return new gr(c[0],c[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*Kd(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,l=n[i-1].endTangent;a=[],l?(a.push([o[0]-l[0],o[1]-l[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(yn);ni.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var dT=["style"],Ts=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,vs.Z)(n,dT);(0,N.Z)(this,t),e=(0,_.Z)(this,t,[(0,B.Z)({type:Dt.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,l=s.markerEnd,c=s.markerMid;return o&&Ve(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),c&&Ve(c)&&e.placeMarkerMid(c),l&&Ve(l)&&(e.markerEndAngle=l.getLocalEulerAngles(),e.appendChild(l)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,C.Z)(t,r),(0,T.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&&Ve(s)&&(this.markerStartAngle=0,s.remove()),o&&Ve(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ve(s)&&(this.markerEndAngle=0,s.remove()),o&&Ve(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,l=i.markerEndOffset,c=i.points,u=c||{},h=u.points,d=n?a:s;if(!(!d||!Ve(d)||!h)){var f=0,v,g,p,y,b,E;if(p=h[0][0],y=h[0][1],n)v=h[1][0]-h[0][0],g=h[1][1]-h[0][1],b=o||0,E=this.markerStartAngle;else{var O=h.length;this.parsedStyle.isClosed?(v=h[O-1][0]-h[0][0],g=h[O-1][1]-h[0][1]):(p=h[O-1][0],y=h[O-1][1],v=h[O-2][0]-h[O-1][0],g=h[O-2][1]-h[O-1][1]),b=l||0,E=this.markerEndAngle}f=Math.atan2(g,v),d.setLocalEulerAngles(f*180/Math.PI+E),d.setLocalPosition(p+Math.cos(f)*b,y+Math.sin(f)*b)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(h){h.remove()}),this.markerMidList=[],n&&Ve(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var l=s[o][0],c=s[o][1],u=o===1?n:n.cloneNode(!0);this.markerMidList.push(u),this.appendChild(u),u.setLocalPosition(l,c)}}}])}(yn);Ts.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var fT=["style"],Oc=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,vs.Z)(e,fT);return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"getTotalLength",value:function(){return eM(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,l,c,u=this.getTotalLength();a.forEach(function(y,b){a[b+1]&&(l=[0,0],l[0]=o/u,c=_g(y[0],y[1],a[b+1][0],a[b+1][1]),o+=c,l[1]=o/u,s.push(l))}),this.parsedStyle.points.segments=s}var h=0,d=0;this.parsedStyle.points.segments.forEach(function(y,b){n>=y[0]&&n<=y[1]&&(h=(n-y[0])/(y[1]-y[0]),d=b)});var f=Yi(a[d][0],a[d][1],a[d+1][0],a[d+1][1],h),v=f.x,g=f.y,p=re(pt(),Et(v,g,0),i?this.getWorldTransform():this.getLocalTransform());return new gr(p[0],p[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}}])}(Ts);Oc.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(Ts.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var pr=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.RECT},e)])}return(0,C.Z)(t,r),(0,T.Z)(t)}(yn);pr.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var vT=["style"],Os=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,vs.Z)(e,vT);return(0,N.Z)(this,t),(0,_.Z)(this,t,[(0,B.Z)({type:Dt.TEXT,style:(0,B.Z)({fill:"black"},n)},i)])}return(0,C.Z)(t,r),(0,T.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}}])}(yn);Os.PARSED_STYLE_LIST=new Set([].concat((0,k.Z)(yn.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","textPathSide","textPathStartOffset","metrics","dx","dy"]));var gT=function(){function r(){(0,N.Z)(this,r),this.registry={},this.define(Dt.CIRCLE,Ji),this.define(Dt.ELLIPSE,al),this.define(Dt.RECT,pr),this.define(Dt.IMAGE,sl),this.define(Dt.LINE,As),this.define(Dt.GROUP,rr),this.define(Dt.PATH,ni),this.define(Dt.POLYGON,Ts),this.define(Dt.POLYLINE,Oc),this.define(Dt.TEXT,Os),this.define(Dt.HTML,co)}return(0,T.Z)(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),a9={number:function(t){return new on(t)},percent:function(t){return new on(t,"%")},px:function(t){return new on(t,"px")},em:function(t){return new on(t,"em")},rem:function(t){return new on(t,"rem")},deg:function(t){return new on(t,"deg")},grad:function(t){return new on(t,"grad")},rad:function(t){return new on(t,"rad")},turn:function(t){return new on(t,"turn")},s:function(t){return new on(t,"s")},ms:function(t){return new on(t,"ms")},registerProperty:function(t){var e=t.name,n=t.inherits,i=t.interpolable,a=t.initialValue,s=t.syntax;Vt.styleValueRegistry.registerMetadata({n:e,inh:n,int:i,d:a,syntax:s})},registerLayout:function(t,e){Vt.layoutRegistry.registerLayout(t,e)}},rm=function(r){function t(){var e;(0,N.Z)(this,t),e=(0,_.Z)(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new Vt.AnimationTimeline(e)}catch(i){}var n={};return tf.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=fe(o)?o(Dt.GROUP):o)}),e.documentElement=new rr({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return(0,C.Z)(t,r),(0,T.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"?Os:rr);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(rn)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(n){}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=this.defaultView.context.rBushRoot,l=o.search({minX:n,minY:i,maxX:a,maxY:s}),c=[];return l.forEach(function(u){var h=u.displayObject,d=h.parsedStyle.pointerEvents,f=d===void 0?"auto":d,v=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(f);(!v||v&&h.isVisible())&&!h.isCulled()&&h.isInteractive()&&c.push(h)}),c.sort(function(u,h){return h.sortable.renderOrder-u.sortable.renderOrder}),c}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,l=this.defaultView.getConfig(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return null;var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),g=v.picked;return g&&g[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=(0,La.Z)((0,Tr.Z)().mark(function i(a,s){var o,l,c,u,h,d,f,v,g,p,y;return(0,Tr.Z)().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=1;break}return b.abrupt("return",null);case 1:return f=this.defaultView.viewport2Client({x:l,y:c}),v=f.x,g=f.y,b.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:v,clientY:g},picked:[]});case 2:return p=b.sent,y=p.picked,b.abrupt("return",y&&y[0]||this.documentElement);case 3:case"end":return b.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,l=this.defaultView.getConfig(),c=l.width,u=l.height;if(s<0||o<0||s>c||o>u)return[];var h=this.defaultView.viewport2Client({x:s,y:o}),d=h.x,f=h.y,v=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:d,clientY:f},picked:[]}),g=v.picked;return g[g.length-1]!==this.documentElement&&g.push(this.documentElement),g}},{key:"elementsFromPoint",value:function(){var e=(0,La.Z)((0,Tr.Z)().mark(function i(a,s){var o,l,c,u,h,d,f,v,g,p,y;return(0,Tr.Z)().wrap(function(b){for(;;)switch(b.prev=b.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),l=o.x,c=o.y,u=this.defaultView.getConfig(),h=u.width,d=u.height,!(l<0||c<0||l>h||c>d)){b.next=1;break}return b.abrupt("return",[]);case 1:return f=this.defaultView.viewport2Client({x:l,y:c}),v=f.x,g=f.y,b.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:l,viewportY:c,clientX:v,clientY:g},picked:[]});case 2:return p=b.sent,y=p.picked,y[y.length-1]!==this.documentElement&&y.push(this.documentElement),b.abrupt("return",y);case 3:case"end":return b.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(ro)}},{key:"insertBefore",value:function(n,i){throw new Error(ro)}},{key:"removeChild",value:function(n,i){throw new Error(ro)}},{key:"replaceChild",value:function(n,i,a){throw new Error(ro)}},{key:"append",value:function(){throw new Error(ro)}},{key:"prepend",value:function(){throw new Error(ro)}},{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)}}])}(On),im=function(){function r(t){(0,N.Z)(this,r),this.strategies=t}return(0,T.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(l){if(l){var c,u=l.cullable;if(o.length===0?u.visible=s.unculledEntities.indexOf(l.entity)>-1:u.visible=o.every(function(d){return d.isVisible(i,l)}),!l.isCulled()&&l.isVisible())return l;var h=((c=n.future)===null||c===void 0?void 0:c.experimentalCancelEventPropagation)===!0;return l.dispatchEvent(new Qn(De.CULLED),h,h),null}return l}),a.hooks.afterRender.tap(r.tag,function(l){l.cullable.visibilityPlaneMask=-1})}}])}();im.tag="Culling";var am=function(){function r(){var t=this;(0,N.Z)(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new wc(null),this.rootWheelEvent=new cf(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,fs.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}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,fs.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var l=o.value,c=t.bootstrapEvent(t.rootPointerEvent,l,i,e);t.context.eventService.mapEvent(c)}}catch(u){s.e(u)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return(0,T.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}),l=o.picked;return l[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 l=s.cancelable||!("cancelable"in s);l&&s.preventDefault()}var c=(0,fs.Z)(o),u;try{for(c.s();!(u=c.n()).done;){var h=u.value,d=n.bootstrapEvent(n.rootPointerEvent,h,a,s);n.context.eventService.mapEvent(d)}}catch(f){c.e(f)}finally{c.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(),l=n.context.eventService.isNativeEventFromCanvas(o,s),c=l?"":"outside",u=n.normalizeToPointerEvent(s,a),h=(0,fs.Z)(u),d;try{for(h.s();!(d=h.n()).done;){var f=d.value,v=n.bootstrapEvent(n.rootPointerEvent,f,a,s);v.type+=c,n.context.eventService.mapEvent(v)}}catch(g){h.e(g)}finally{h.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),l=(0,fs.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)})}},{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,l=s.y;e.viewport.x=o,e.viewport.y=l;var c=this.context.eventService.viewport2Canvas(e.viewport),u=c.x,h=c.y;return e.canvas.x=u,e.canvas.y=h,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),l=o.x,c=o.y;return n.canvas.x=l,n.canvas.y=c,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=af.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,l=0,c=a.length;l1&&arguments[1]!==void 0?arguments[1]:!1;if(e.isConnected){var i=e.rBushNode;i.aabb&&this.rBush.remove(i.aabb);var a=e.getRenderBounds();if(a){var s=e.renderable;n&&(s.dirtyRenderBounds||(s.dirtyRenderBounds=new pn),s.dirtyRenderBounds.update(a.center,a.halfExtents));var o=a.getMin(),l=(0,L.Z)(o,2),c=l[0],u=l[1],h=a.getMax(),d=(0,L.Z)(h,2),f=d[0],v=d[1];i.aabb||(i.aabb={}),i.aabb.displayObject=e,i.aabb.minX=c,i.aabb.minY=u,i.aabb.maxX=f,i.aabb.maxY=v}if(i.aabb&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.maxX)&&!isNaN(i.aabb.minX)&&!isNaN(i.aabb.minY))return i.aabb}}},{key:"syncRTree",value:function(){var e=this,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(!n&&(this.syncing||this.syncTasks.size===0))){this.syncing=!0;var i=[],a=new Set,s=function(l){if(!a.has(l)&&l.renderable){var c=e.syncNode(l,n);c&&(i.push(c),a.add(l))}};this.syncTasks.forEach(function(o,l){o&&l.forEach(s);for(var c=l;c;)s(c),c=c.parentElement}),this.rBush.load(i),i.length=0,this.syncing=!1}}}])}();sm.tag="Prepare";function s9(r){return!!r.document}var ri=function(r){return r.READY="ready",r.BEFORE_RENDER="beforerender",r.RERENDER="rerender",r.AFTER_RENDER="afterrender",r.BEFORE_DESTROY="beforedestroy",r.AFTER_DESTROY="afterdestroy",r.RESIZE="resize",r.DIRTY_RECTANGLE="dirtyrectangle",r.RENDERER_CHANGED="rendererchanged",r}({}),om=500,yT=.1,bT=1e3,Cc=new Qn(De.MOUNTED),Nc=new Qn(De.UNMOUNTED),vf=new Qn(ri.BEFORE_RENDER),lm=new Qn(ri.RERENDER),gf=new Qn(ri.AFTER_RENDER),pf=function(r){function t(e){var n;(0,N.Z)(this,t),n=(0,_.Z)(this,t),n.Element=yn,n.inited=!1,n.context={};var i=e.container,a=e.canvas,s=e.renderer,o=e.width,l=e.height,c=e.background,u=e.cursor,h=e.supportsMutipleCanvasesInOneContainer,d=e.cleanUpOnDestroy,f=d===void 0?!0:d,v=e.offscreenCanvas,g=e.devicePixelRatio,p=e.requestAnimationFrame,y=e.cancelAnimationFrame,b=e.createImage,E=e.supportsTouchEvents,O=e.supportsPointerEvents,P=e.isTouchEvent,R=e.isMouseEvent,F=e.dblClickSpeed,I=o,V=l,Y=g||rf&&window.devicePixelRatio||1;return Y=Y>=1?Math.ceil(Y):1,a&&(I=o||KM(a)||a.width/Y,V=l||QM(a)||a.height/Y),n.customElements=new gT,n.devicePixelRatio=Y,n.requestAnimationFrame=p!=null?p:sf.bind(Vt.globalThis),n.cancelAnimationFrame=y!=null?y:Vp.bind(Vt.globalThis),n.createImage=b!=null?b:function(){return new window.Image},n.supportsTouchEvents=E!=null?E:"ontouchstart"in Vt.globalThis,n.supportsPointerEvents=O!=null?O:!!Vt.globalThis.PointerEvent,n.isTouchEvent=P!=null?P:function(J){return n.supportsTouchEvents&&J instanceof Vt.globalThis.TouchEvent},n.isMouseEvent=R!=null?R:function(J){return!Vt.globalThis.MouseEvent||J instanceof Vt.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(J instanceof Vt.globalThis.PointerEvent))},v&&(Vt.offscreenCanvas=v),n.document=new rm,n.document.defaultView=n,h||UM(i,n,f),n.initRenderingContext((0,B.Z)((0,B.Z)({},e),{},{width:I,height:V,background:c!=null?c:"transparent",cursor:u!=null?u:"default",cleanUpOnDestroy:f,devicePixelRatio:Y,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,createImage:n.createImage,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:F!=null?F:200})),n.initDefaultCamera(I,V,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return(0,C.Z)(t,r),(0,T.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 Vt.CameraContribution;o.clipSpaceNearZ=a,o.setType(sn.EXPLORING,Fd.DEFAULT).setPosition(n/2,i/2,om).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,yT,bT),o.canvas=this,o.eventEmitter.on(Kg.UPDATED,function(){s.context.renderingContext.renderReasons.add(lo.CAMERA_CHANGED),Vt.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){Vt.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;jn.clearCache();var s=((n=this.getConfig().future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation)===!0;a||this.dispatchEvent(new Qn(ri.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(),this.context.rBushRoot&&this.context.rBushRoot.clear(),a||this.dispatchEvent(new Qn(ri.AFTER_DESTROY),s,s);var l=function(u){u.currentTarget=null,u.manager=null,u.target=null,u.relatedNode=null};l(Cc),l(Nc),l(vf),l(lm),l(gf),l(qi),l(hf),l(df),l(nm),Vt.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,l=o.getProjectionMode();o.setPosition(n/2,i/2,om).setFocalPoint(n/2,i/2,0),l===gi.ORTHOGRAPHIC?o.setOrthographic(n/-2,n/2,i/2,i/-2,o.getNear(),o.getFar()):o.setAspect(n/i);var c=((a=s.future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;this.dispatchEvent(new Qn(ri.RESIZE,{width:n,height:i}),c,c)}},{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&&(vf.detail=n,gf.detail=n);var s=((i=this.getConfig().future)===null||i===void 0?void 0:i.experimentalCancelEventPropagation)===!0;this.dispatchEvent(vf,s,s);var o=this.getRenderingService();o.render(this.getConfig(),n,function(){a.dispatchEvent(lm,s,s)}),this.dispatchEvent(gf,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.rBushRoot=new z2,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new am,new sm,new im([new mT])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService((0,B.Z)((0,B.Z)({},Vt),this.context)),this.context.renderingService=new PA(Vt,this.context),this.context.eventService=new kA(Vt,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 l=((o=i.getConfig().future)===null||o===void 0?void 0:o.experimentalCancelEventPropagation)===!0;a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new Qn(ri.READY),l,l)}):i.dispatchEvent(new Qn(ri.READY),l,l):i.dispatchEvent(new Qn(ri.RENDERER_CHANGED),l,l),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(c){var u,h;(u=(h=c).dirty)===null||u===void 0||u.call(h,!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(Vt)})}},{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,k.Z)((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(Vt)}),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(Nc);else{var a,s=((a=this.getConfig().future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;Nc.target=n,this.dispatchEvent(Nc,!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]:xc(n);if(this.inited){if(!n.isConnected&&(n.ownerDocument=this.document,n.isConnected=!0,!a))if(n.isMutationObserved)n.dispatchEvent(Cc);else{var s,o=((s=this.getConfig().future)===null||s===void 0?void 0:s.experimentalCancelEventPropagation)===!0;Cc.target=n,this.dispatchEvent(Cc,!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(l){i.mountChildren(l,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})}}])}(Qp);var xT=function(r){function t(){var e;(0,N.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a90)return this;this.computeMatrix()}return this._getAxes(),this.type===sn.ORBITING||this.type===sn.EXPLORING?this._getPosition():this.type===sn.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=Dr(n,i,0),s=wt(this.position);return Ut(s,s,Pt(pt(),this.right,a[0])),Ut(s,s,Pt(pt(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=wt(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===sn.ORBITING||this.type===sn.EXPLORING?this._getDistance():this.type===sn.TRACKING&&Ut(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,l=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},c=l.position,u=c===void 0?this.position:c,h=l.focalPoint,d=h===void 0?this.focalPoint:h,f=l.roll,v=l.zoom,g=new Vt.CameraContribution;g.setType(this.type,void 0),g.setPosition(u[0],(i=u[1])!==null&&i!==void 0?i:this.position[1],(a=u[2])!==null&&a!==void 0?a:this.position[2]),g.setFocalPoint(d[0],(s=d[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=d[2])!==null&&o!==void 0?o:this.focalPoint[2]),g.setRoll(f!=null?f:this.roll),g.setZoom(v!=null?v:this.zoom);var p={name:n,matrix:ue(g.getWorldTransform()),right:wt(g.right),up:wt(g.up),forward:wt(g.forward),position:wt(g.getPosition()),focalPoint:wt(g.getFocalPoint()),distanceVector:wt(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(p),p}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=Ge(n)?this.landmarks.find(function(J){return J.name===n}):n;if(s){var o=ie(a)?{duration:a}:a,l=o.easing,c=l===void 0?"linear":l,u=o.duration,h=u===void 0?100:u,d=o.easingFunction,f=d===void 0?void 0:d,v=o.onfinish,g=v===void 0?void 0:v,p=o.onframe,y=p===void 0?void 0:p,b=.01;this.cancelLandmarkAnimation();var E=s.position,O=s.focalPoint,P=s.zoom,R=s.roll,F=f||Vt.EasingFunction(c),I,V=function(){i.setFocalPoint(O),i.setPosition(E),i.setRoll(R),i.setZoom(P),i.computeMatrix(),i.triggerUpdate(),g==null||g()};if(h===0)return V();var Y=function($){I===void 0&&(I=$);var ot=$-I;if(ot>=h){V();return}var ct=F(ot/h),ft=pt(),Nt=pt(),Ot=1,mt=0;_e(ft,i.focalPoint,O,ct),_e(Nt,i.position,E,ct),mt=i.roll*(1-ct)+R*ct,Ot=i.zoom*(1-ct)+P*ct,i.setFocalPoint(ft),i.setPosition(Nt),i.setRoll(mt),i.setZoom(Ot);var yt=ls(ft,O)+ls(Nt,E);if(yt<=b&&P===void 0&&R===void 0)return V();i.computeMatrix(),i.triggerUpdate(),ot0&&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=0,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new xf(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(rn)}},{key:"addEventListener",value:function(e,n,i){throw new Error(rn)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(rn)}},{key:"dispatchEvent",value:function(e){throw new Error(rn)}},{key:"commitStyles",value:function(){throw new Error(rn)}},{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 xf(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 xf(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),AT=4,TT=.001,OT=1e-7,CT=10,ol=11,Pc=1/(ol-1),NT=typeof Float32Array=="function",hm=function(t,e){return 1-3*e+3*t},dm=function(t,e){return 3*e-6*t},fm=function(t){return 3*t},Rc=function(t,e,n){return((hm(e,n)*t+dm(e,n))*t+fm(e))*t},vm=function(t,e,n){return 3*hm(e,n)*t*t+2*dm(e,n)*t+fm(e)},kT=function(t,e,n,i,a){var s,o,l=0;do o=e+(n-e)/2,s=Rc(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>OT&&++l=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(l){return l};for(var a=NT?new Float32Array(ol):new Array(ol),s=0;s=TT?PT(c,v,t,n):g===0?v:kT(c,u,u+Pc,t,n)};return function(l){return l===0||l===1?l:Rc(o(l),e,i)}},RT=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Lc=function(t){return Math.pow(t,2)},_c=function(t){return Math.pow(t,3)},Dc=function(t){return Math.pow(t,4)},Ic=function(t){return Math.pow(t,5)},Bc=function(t){return Math.pow(t,6)},Fc=function(t){return 1-Math.cos(t*Math.PI/2)},zc=function(t){return 1-Math.sqrt(1-t*t)},jc=function(t){return t*t*(3*t-2)},Zc=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)},Wc=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,L.Z)(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,l=kn(Number(a),1,10),c=kn(Number(o),.1,2);return t===0||t===1?t:-l*Math.pow(2,10*(t-1))*Math.sin((t-1-c/(Math.PI*2)*Math.asin(1/l))*(Math.PI*2)/c)},ll=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=(0,L.Z)(e,4),a=i[0],s=a===void 0?1:a,o=i[1],l=o===void 0?100:o,c=i[2],u=c===void 0?10:c,h=i[3],d=h===void 0?0:h;s=kn(s,.1,1e3),l=kn(l,.1,1e3),u=kn(u,.1,1e3),d=kn(d,.1,1e3);var f=Math.sqrt(l/s),v=u/(2*Math.sqrt(l*s)),g=v<1?f*Math.sqrt(1-v*v):0,p=1,y=v<1?(v*f+-d)/g:-d+f,b=n?n*t/1e3:t;return v<1?b=Math.exp(-b*v*f)*(p*Math.cos(g*b)+y*Math.sin(g*b)):b=(p+y*b)*Math.exp(-b*f),t===0||t===1?t:1-b},wf=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=(0,L.Z)(n,2),a=i[0],s=a===void 0?10:a,o=i[1],l=o==="start"?Math.ceil:Math.floor;return l(kn(t,0,1)*s)/s},gm=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,L.Z)(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return Ef(i,a,s,o)(t)},Gc=Ef(.42,0,1,1),mi=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)}},yi=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}},bi=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}},pm={steps:wf,"step-start":function(t){return wf(t,[1,"start"])},"step-end":function(t){return wf(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":gm,ease:function(t){return gm(t,[.25,.1,.25,1])},in:Gc,out:mi(Gc),"in-out":yi(Gc),"out-in":bi(Gc),"in-quad":Lc,"out-quad":mi(Lc),"in-out-quad":yi(Lc),"out-in-quad":bi(Lc),"in-cubic":_c,"out-cubic":mi(_c),"in-out-cubic":yi(_c),"out-in-cubic":bi(_c),"in-quart":Dc,"out-quart":mi(Dc),"in-out-quart":yi(Dc),"out-in-quart":bi(Dc),"in-quint":Ic,"out-quint":mi(Ic),"in-out-quint":yi(Ic),"out-in-quint":bi(Ic),"in-expo":Bc,"out-expo":mi(Bc),"in-out-expo":yi(Bc),"out-in-expo":bi(Bc),"in-sine":Fc,"out-sine":mi(Fc),"in-out-sine":yi(Fc),"out-in-sine":bi(Fc),"in-circ":zc,"out-circ":mi(zc),"in-out-circ":yi(zc),"out-in-circ":bi(zc),"in-back":jc,"out-back":mi(jc),"in-out-back":yi(jc),"out-in-back":bi(jc),"in-bounce":Zc,"out-bounce":mi(Zc),"in-out-bounce":yi(Zc),"out-in-bounce":bi(Zc),"in-elastic":Wc,"out-elastic":mi(Wc),"in-out-elastic":yi(Wc),"out-in-elastic":bi(Wc),spring:ll,"spring-in":ll,"spring-out":mi(ll),"spring-in-out":yi(ll),"spring-out-in":bi(ll)},LT=function(t){return RT(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},_T=function(t){return pm[LT(t)]||pm.linear},DT=function(t){return t},IT=1,BT=.5,mm=0;function ym(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var Vc="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",FT=new RegExp("cubic-bezier\\(".concat(Vc,",").concat(Vc,",").concat(Vc,",").concat(Vc,"\\)")),zT=/steps\(\s*(\d+)\s*\)/,jT=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Sf(r){var t=FT.exec(r);if(t)return Ef.apply(void 0,(0,k.Z)(t.slice(1).map(Number)));var e=zT.exec(r);if(e)return ym(Number(e[1]),mm);var n=jT.exec(r);return n?ym(Number(n[1]),{start:IT,middle:BT,end:mm}[n[2]]):_T(r)}function ZT(r){return Math.abs(WT(r)/(r.playbackRate||1))}function WT(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 bm=0,Mf=1,Uc=2,xm=3;function GT(r,t,e){if(t===null)return bm;var n=e.endTime;return t=Math.min(e.delay+r+e.endDelay,n)?Uc:xm}function VT(r,t,e,n,i){switch(n){case Mf:return t==="backwards"||t==="both"?0:null;case xm:return e-i;case Uc:return t==="forwards"||t==="both"?r:null;case bm:return null}}function UT(r,t,e,n,i){var a=i;return r===0?t!==Mf&&(a+=e):a+=n/r,a}function YT(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===Uc&&n!==0&&(i!==0||a===0)&&(s=1),s}function HT(r,t,e,n){return r===Uc&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function XT(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 KT(r,t,e){var n=GT(r,t,e),i=VT(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=UT(a,n,e.iterations,i,e.iterationStart),o=YT(s,e.iterationStart,n,e.iterations,i,a),l=HT(n,e.iterations,o,s),c=XT(e.direction,l,o);return e.currentIteration=l,e.progress=c,e.easingFunction(c)}function QT(r,t,e){var n=qT(r,t),i=JT(n,e);return function(a,s){if(s!==null)i.filter(function(l){return s>=l.applyFrom&&s1)throw new Error("Keyframe offsets must be between 0 and 1.");c.computedOffset=h}}else if(u==="composite"&&["replace","add","accumulate","auto"].indexOf(h)===-1)throw new Error("".concat(h," compositing is not supported"));c[u]=h}return c.offset===void 0&&(c.offset=null),c.easing===void 0&&(c.easing=(t==null?void 0:t.easing)||"linear"),c.composite===void 0&&(c.composite="auto"),c}),n=!0,i=-1/0,a=0;a=0&&Number(l.offset)<=1});function o(){var l,c=e,u=c.length;if(e[u-1].computedOffset=Number((l=e[u-1].offset)!==null&&l!==void 0?l:1),u>1){var h;e[0].computedOffset=Number((h=e[0].offset)!==null&&h!==void 0?h:0)}for(var d=0,f=Number(e[0].computedOffset),v=1;v{!Xr.mute&&console.debug(pa(r))},info:r=>{!Xr.mute&&console.info(pa(r))},warn:r=>{!Xr.mute&&console.warn(pa(r))},error:r=>{!Xr.mute&&console.error(pa(r))}};function Om(r){const{theme:t}=r;if(!t)return{};const e=ga(ul.THEME,t);return e||(Xr.warn(`The theme of ${t} is not registered.`),{})}function Cf(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 l;return(l=o[a])===null||l===void 0?void 0:l.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 Nf(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=>me(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Wn(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 hl(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 Cm(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},dO);return zn(e)&&Object.assign(n,e),zn(t)&&Object.assign(n,t),n}function pO(r){if(typeof r=="string"){const t=ga(ul.ANIMATION,r);return t||(Xr.warn(`The animation of ${r} is not registered.`),[])}return r}function mO(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 l=o==null?void 0:o[e];if(l===!1)return[];const c=(a=Om(r)[t])===null||a===void 0?void 0:a.animation,u=(d=[])=>pO(d).map(f=>Object.assign(Object.assign(Object.assign(Object.assign({},fO),zn(s)&&s),f),zn(n)&&n));if(l)return u(l);if(!c)return[];const h=c[e];return h===!1?[]:u(h)}function Nm(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=c=>{var u;if(c){const h=r.getShape(c);if(!h)return null;const d=`get${Yc(c)}Style`,f=((u=r==null?void 0:r[d])===null||u===void 0?void 0:u.bind(r))||(p=>p),v=(f==null?void 0:f(n))||{},g=(f==null?void 0:f(i))||{};return{shape:h,fromStyle:v,toStyle:g}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(c=>{var{fields:u,shape:h,states:d}=c,f=yO(c,["fields","shape","states"]);const v=a(h);if(!v)return null;const{shape:g,fromStyle:p,toStyle:y}=v,b=[{},{}];if(u.forEach(O=>{var P,R;Object.assign(b[0],{[O]:(P=p[O])!==null&&P!==void 0?P:hl(O)}),Object.assign(b[1],{[O]:(R=y[O])!==null&&R!==void 0?R:hl(O)})}),b.some(O=>Object.keys(O).some(P=>["x","y","z"].includes(P)))){const{x:O=0,y:P=0,z:R,transform:F=""}=g.attributes||{};b.forEach(I=>{var V,Y,J;I.transform=Nm((V=I.x)!==null&&V!==void 0?V:O,(Y=I.y)!==null&&Y!==void 0?Y:P,(J=I.z)!==null&&J!==void 0?J:R,F)})}const E=g.animate(Nf(b),f);return h===void 0&&(s=E),E}).filter(Boolean),l=s||(o==null?void 0:o[0]);return l?Cf(l,o.filter(c=>c!==c)):null},xO=[{fields:["opacity"]}],EO=[{fields:["x","y"]}],km=[{fields:["x","y"]}],wO=km,Pm=[{fields:["sourceNode","targetNode"]}],SO=Pm,Rm=[{fields:["childrenNode","x","y"]}],MO=Rm,y9=[{fields:["childrenNode","x","y"]}];var AO=Object.prototype.hasOwnProperty;function TO(r,t){if(!t||!Wr(r))return{};for(var e={},n=fe(t)?t:function(o){return o[t]},i,a=0;at?(n&&(clearTimeout(n),n=null),o=u,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(l,h)),s};return c.cancel=function(){clearTimeout(n),o=0,n=i=a=null},c},kf=function(r){if(typeof r!="object"||r===null)return r;var t;if(Wr(r)){t=[];for(var e=0,n=r.length;etypeof t=="number"):!1}function $i(r,t,e){return r>=t&&r<=e}function ai(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 NO(r=0){const t=ai(r);return t[0]+t[2]}function x9(r=0){const t=ai(r);return t[1]+t[3]}function ta(r){return r.max[0]-r.min[0]}function ea(r){return r.max[1]-r.min[1]}function Ba(r){return[ta(r),ea(r)]}function Fa(r,t){const e=fo(r)?Pf(r):r.getShape("key").getBounds();return t?za(e,t):e}function Pf(r){const[t,e,n=0]=r,i=new pn;return i.setMinMax([t,e,n],[t,e,n]),i}function za(r,t){const[e,n,i,a]=ai(t),[s,o,l]=r.min,[c,u,h]=r.max,d=new pn;return d.setMinMax([s-a,o-e,l],[c+n,u+i,h]),d}function dl(r){if(r.length===0)return new pn;if(r.length===1)return r[0];const t=new pn;t.setMinMax(r[0].min,r[0].max);for(let e=1;e=s&&i<=l&&n>=o&&a<=c}function Li(r,t){return $i(r[0],t.min[0],t.max[0])&&$i(r[1],t.min[1],t.max[1])}function _m(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||$i(r[0],n,a)),l=(r[0]===n||r[0]===a)&&(e||$i(r[1],i,s));return o||l}function PO(r,t){return!Li(r,t)}function Kc(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function fl(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,l=e-i,c=s-e,u=n-a,h=o-n,d=Math.min(l,c,u,h);return d===l?"left":d===c?"right":d===u?"top":d===h?"bottom":"left"}function Ns(r,t){const e=ho(r);if(Li(r,t))switch(fl(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,l]=t.max;e[0]=$i(n,a,o)?n:n0&&f(P[0])}},y=0;y0;)d.push(l.pop());s.push(d)}}return s},Fm=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,s=[],o={},l={},c={},u=[],h=0,d=function p(y){l[y.id]=h,c[y.id]=h,h+=1,s.push(y),o[y.id]=!0;for(var b=Ei(y.id,a,"target").filter(function(F){return n.map(function(I){return I.id}).indexOf(F)>-1}),E=function(I){var V=b[I];if(!l[V]&&l[V]!==0){var Y=n.filter(function(J){return J.id===V});Y.length>0&&p(Y[0]),c[y.id]=Math.min(c[y.id],c[V])}else o[V]&&(c[y.id]=Math.min(c[y.id],l[V]))},O=0;O0;){var R=s.pop();if(o[R.id]=!1,P.push(R),R===y)break}P.length>0&&u.push(P)}},f=0,v=n;f0;)for(var p=f.pop(),y=p.id,b=Ei(y,t.edges),E=function(R){var F,I=b[R],V=t.nodes.find(function(ft){return ft.id===I});if(I===y)s.push((F={},F[I]=p,F));else if(!(I in g))v[I]=p,f.push(V),g[I]=new Set([p]);else if(!g[y].has(V)){for(var Y=!0,J=[V,p],$=v[y];g[I].size&&!g[I].has($)&&(J.push($),$!==v[$.id]);)$=v[$.id];if(J.push($),e&&n?(Y=!1,J.findIndex(function(ft){return e.indexOf(ft.id)>-1})>-1&&(Y=!0)):e&&!n&&J.findIndex(function(ft){return e.indexOf(ft.id)>-1})>-1&&(Y=!1),Y){for(var ot={},ct=1;ct0;){var ct=ot.pop();a.has(ct)&&(a.delete(ct),s[ct.id].forEach(function(ft){ot.push(ft)}),s[ct.id].clear())}},h=function J($,ot,ct){var ft=!1;if(e&&n===!1&&e.indexOf($.id)>-1)return ft;i.push($),a.add($);for(var Nt=ct[$.id],Ot=0;Ot-1});ee-1)?o.push((ot={},ot[Xt.id]=Xt,ot)):jt[Xt.id].push(c[he])}}return{component:Rt,adjList:jt,minIdx:ft}},E=0;E=E}),P=Fm({nodes:O,edges:t.edges}).filter(function(J){return J.length>1});if(P.length===0)break;var R=b(P),F=R.minIdx,I=R.adjList,V=R.component;if(V.length>1){V.forEach(function(J){s[J.id]=new Set});var Y=l[F];if(e&&n&&e.indexOf(Y.id)===-1)return o;h(Y,Y,I),E=F+1}else break}return o},KO=function(t,e,n,i){return i===void 0&&(i=!0),e?Gm(t,n,i):Wm(t,n,i)},Vm=XO,QO={}.toString,qO=function(r,t){return QO.call(r)==="[object "+t+"]"},Jc=qO,Lf=function(r){return Jc(r,"Function")},_f=function(r){return Array.isArray?Array.isArray(r):Jc(r,"Array")},JO=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function $O(r,t){if(r){var e;if(_f(r))for(var n=0,i=r.length;n-1;)eC.call(r,a,1);return r},z9=null,rC=Array.prototype.splice,j9=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,rC.call(t,s,1))}return t},Z9=null,W9=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},G9=null,V9=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},yz=null,bz=function(r,t){if(isArray(r)){for(var e,n=-1/0,i=0;in&&(e=a,n=s)}return e}},xz=function(r,t){if(isArray(r)){for(var e,n=1/0,i=0;io&&u>o);)if(l.push(c),o-=u,s=s.substr(i),!s)return l.join("");for(;c=s.substr(0,1),u=measureTextWidth(c,e),!(u+a>o);)if(l.push(c),o-=u,s=s.substr(1),!s)return l.join("");return""+l.join("")+n},i7=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}(),a7=null,xC=function(t,e,n){for(var i=1/0,a,s=0;sh[P.id]+$?(h[J]=h[P.id]+$,d[J]=[P.id]):h[J]===h[P.id]+$&&d[J].push(P.id)})},g=0;g0&&u.length>0;){var f=u[u.length-1];if(f.length){var v=f.shift();v&&(l.push(v),c[v]=!0,d=i?Ei(v,o,"target"):Ei(v,o),u.push(d.filter(function(y){return!c[y]})))}else{var g=l.pop();c[g]=!1,u.pop();continue}if(l[l.length-1]===n){var p=l.map(function(b){return b});h.push(p);var g=l.pop();c[g]=!1,u.pop()}}return h},SC=function(t,e){for(var n=Qc(t,e),i=[],a=n.length,s=0;si[s][l]+i[l][o]&&(i[s][o]=i[s][l]+i[l][o]);return i},jf=SC,MC=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,l=o===void 0?[]:o,c={},u={};s.forEach(function(O,P){var R=Bm();O.clusterId=R,c[R]={id:R,nodes:[O]},u[O.id]={node:O,idx:P}});var h=Qc(t,e),d=[],f={};h.forEach(function(O,P){var R=0,F=s[P].id;f[F]={},O.forEach(function(I,V){if(I){R+=I;var Y=s[V].id;f[F][Y]=I}}),d.push(R)});for(var v=0,g=function(){var P=!1;if(s.forEach(function(R){var F={};Object.keys(f[R.id]).forEach(function(ft){var Nt=f[R.id][ft],Ot=u[ft].node,mt=Ot.clusterId;F[mt]||(F[mt]=0),F[mt]+=Nt});var I=-1/0,V=[];if(Object.keys(F).forEach(function(ft){I=0&&V.splice(Y,1),V&&V.length){P=!0;var J=c[R.clusterId],$=J.nodes.indexOf(R);J.nodes.splice($,1);var ot=Math.floor(Math.random()*V.length),ct=c[V[ot]];ct.nodes.push(R),R.clusterId=ct.id}}}),!P)return"break";v++};v0&&I>V&&I-VV&&(J=h.map(function(yt){return{node:yt,clusterId:yt.clusterId}}),$=gl(b),V=I),ot||Y>100)break;Y++,Object.keys(b).forEach(function(yt){var Rt=0;f.forEach(function(jt){var Xt=jt.source,ee=jt.target,ae=E[Xt].node.clusterId,he=E[ee].node.clusterId;(ae===yt&&he!==yt||he===yt&&ae!==yt)&&(Rt=Rt+(jt[n]||1))}),b[yt].sumTot=Rt}),h.forEach(function(yt,Rt){var jt=b[yt.clusterId],Xt=0,ee,ae=P[Rt]/(2*F),he=0,ce=jt.nodes;ce.forEach(function(wr){var vr=E[wr.id].idx;he+=O[Rt][vr]||0});var xe=he-jt.sumTot*ae,Ce=ce.filter(function(wr){return wr.id!==yt.id}),je=[];Ce.forEach(function(wr,vr){je[vr]=v[wr.originIndex]});var Ue=Wf(Ce,v)*c,or=R[yt.id];if(Object.keys(or).forEach(function(wr){var vr=E[wr].node,Aa=vr.clusterId;if(Aa!==yt.clusterId){var Sr=b[Aa],Jr=Sr.nodes;if(!(!Jr||!Jr.length)){var Be=0;Jr.forEach(function(He){var qe=E[He.id].idx;Be+=O[Rt][qe]||0});var Qe=Be-Sr.sumTot*ae,Fe=Jr.concat([yt]),Ye=[];Fe.forEach(function(He,qe){Ye[qe]=v[He.originIndex]});var nn=Wf(Fe,v)*c,pe=Qe-xe;a&&(pe=Qe+nn-(xe+Ue)),pe>Xt&&(Xt=pe,ee=Sr)}}}),Xt>0){ee.nodes.push(yt);var Ke=yt.clusterId;yt.clusterId=ee.id;var hi=jt.nodes.indexOf(yt);jt.nodes.splice(hi,1);var Pr=0,ns=0;f.forEach(function(wr){var vr=wr.source,Aa=wr.target,Sr=E[vr].node.clusterId,Jr=E[Aa].node.clusterId;(Sr===ee.id&&Jr!==ee.id||Jr===ee.id&&Sr!==ee.id)&&(Pr=Pr+(wr[n]||1)),(Sr===Ke&&Jr!==Ke||Jr===Ke&&Sr!==Ke)&&(ns=ns+(wr[n]||1))}),ee.sumTot=Pr,jt.sumTot=ns}})}var ct={},ft=0;Object.keys($).forEach(function(yt){var Rt=$[yt];if(!Rt.nodes||!Rt.nodes.length){delete $[yt];return}var jt=String(ft+1);jt!==yt&&(Rt.id=jt,Rt.nodes=Rt.nodes.map(function(Xt){return{id:Xt.id,clusterId:jt}}),$[jt]=Rt,ct[yt]=jt,delete $[yt],ft++)}),J.forEach(function(yt){var Rt=yt.node,jt=yt.clusterId;Rt&&(Rt.clusterId=jt,Rt.clusterId&&ct[Rt.clusterId]&&(Rt.clusterId=ct[Rt.clusterId]))});var Nt=[],Ot={};f.forEach(function(yt){var Rt=yt.source,jt=yt.target,Xt=yt[n]||1,ee=E[Rt].node.clusterId,ae=E[jt].node.clusterId;if(!(!ee||!ae)){var he="".concat(ee,"---").concat(ae);if(Ot[he])Ot[he].weight+=Xt,Ot[he].count++;else{var ce={source:ee,target:ae,weight:Xt,count:1};Ot[he]=ce,Nt.push(ce)}}});var mt=[];return Object.keys($).forEach(function(yt){mt.push($[yt])}),{clusters:mt,clusterEdges:Nt}},ey=PC,RC=function(t,e,n,i,a,s,o,l){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"]),l===void 0&&(l=1),ey(t,e,n,i,!0,a,s,o,l)},LC=RC,_C=function(t,e){var n;e===void 0&&(e=1);for(var i=gl(t),a=i.nodes,s=a===void 0?[]:a,o=i.edges,l=o===void 0?[]:o,c=function(){var d=Rf({nodes:s,edges:l}),f=Object.keys(d);f.sort(function(p,y){var b,E;return((b=d[p])===null||b===void 0?void 0:b.degree)-((E=d[y])===null||E===void 0?void 0:E.degree)});var v=f[0];if(!s.length||((n=d[v])===null||n===void 0?void 0:n.degree)>=e)return"break";var g=s.findIndex(function(p){return p.id===v});s.splice(g,1),l=l.filter(function(p){return!(p.source===v||p.target===v)})};;){var u=c();if(u==="break")break}return{nodes:s,edges:l}},DC=_C,ny=function(t,e,n){var i=[];switch(t){case _i.EuclideanDistance:i=e[n];break;default:i=[];break}return i},IC=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=_i.EuclideanDistance);var o=t.nodes,l=o===void 0?[]:o,c=t.edges,u=c===void 0?[]:c,h={clusters:[{id:"0",nodes:l}],clusterEdges:[]};if(s===_i.EuclideanDistance&&!l.every(function(jt){return jt.hasOwnProperty(n)}))return h;var d=[],f=[];if(s===_i.EuclideanDistance&&(d=nu(l,n),f=ru(d,i,a)),!f.length)return h;for(var v=If(f.map(function(jt){return jt.join("")})),g=Math.min(e,l.length,v.length),p=0;pP&&!y.find(function(Ce){return yC(Ce,ny(s,f,l[ee].originIndex))})&&(P=xe,R=ee)}},I=0;I=0;ct--)E[Number(l[p].clusterId)][ct].id===l[p].id&&E[Number(l[p].clusterId)].splice(ct,1);l[p].clusterId=String(Y),E[Y].push(l[p])}}for(var ft=!1,p=0;p=1e3)break}var yt=[],Rt={};return u.forEach(function(jt){var Xt,ee,ae=jt.source,he=jt.target,ce=(Xt=l.find(function(Ue){return Ue.id===ae}))===null||Xt===void 0?void 0:Xt.clusterId,xe=(ee=l.find(function(Ue){return Ue.id===he}))===null||ee===void 0?void 0:ee.clusterId,Ce="".concat(ce,"---").concat(xe);if(Rt[Ce])Rt[Ce].count++;else{var je={source:ce,target:xe,count:1};Rt[Ce]=je,yt.push(je)}}),{clusters:E,clusterEdges:yt}},BC=IC,FC=function(t,e){var n=new wi(e),i=n.norm2(),a=new wi(t),s=a.norm2(),o=n.dot(a),l=i*s,c=l?o/l:0;return c},ry=FC,zC=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=gl(t.filter(function(d){return d.id!==e.id})),o=t.findIndex(function(d){return d.id===e.id}),l=nu(t,n),c=ru(l,i,a),u=c[o],h=[];return s.forEach(function(d,f){if(d.id!==e.id){var v=c[f],g=ry(v,u);h.push(g),d.cosineSimilarity=g}}),s.sort(function(d,f){return f.cosineSimilarity-d.cosineSimilarity}),{allCosineSimilarity:h,similarNodes:s}},jC=zC,ZC=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}(),UC=VC,YC=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 l=a[0],c=new Set;c.add(l);var u=function(p,y){return e?p.weight-y.weight:0},h=new UC(u);for(qc(l.id,o).forEach(function(g){h.insert(g)});!h.isEmpty();){var d=h.delMin(),f=d.source,v=d.target;c.has(f)&&c.has(v)||(n.push(d),c.has(f)||(c.add(f),qc(f,o).forEach(function(g){h.insert(g)})),c.has(v)||(c.add(v),qc(v,o).forEach(function(g){h.insert(g)})))}return n},iy=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 l=o.map(function(f){return f});e&&l.sort(function(f,v){return f.weight-v.weight});for(var c=new WC(a.map(function(f){return f.id}));l.length>0;){var u=l.shift(),h=u.source,d=u.target;c.connected(h,d)||(n.push(u),c.union(h,d))}return n},HC=function(t,e,n){var i={prim:YC,kruskal:iy};return n?i[n](t,e):iy(t,e)},XC=HC,KC=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,l=o===void 0?[]:o,c=t.edges,u=c===void 0?[]:c,h=l.length,d,f={},v={},g=0;g0&&i>e;){a=0;for(var g=0;g0&&(d+=v[P]/R)}f[y]=n*d,a+=f[y]}}a=(1-a)/h,i=0;for(var g=0;g=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,s=i.toNode;af||i.hasNode(s[d.to])||(e.labelE;P--){var R=O(P);if(R==="break")break}if(y){var F=t.findMinLabel(p);s.dfsEdgeList.push(new ks(g,b,na,F.edgeLabel,na));var I=s.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[I]!==s.dfsEdgeList[I]?!1:h(p[F.edgeLabel].projected)}var V={};y=!1;var Y=0;d.forEach(function(Nt){var Ot=new au(Nt),mt=t.findForwardPureEdges(i,Ot.edges[f[0]],v,Ot);mt.length>0&&(y=!0,Y=g,mt.forEach(function(yt){var Rt="".concat(yt.label,"-").concat(a[yt.to].label);V[Rt]||(V[Rt]={projected:[],edgeLabel:yt.label,nodeLabel2:a[yt.to].label}),V[Rt].projected.push({graphId:i.id,edge:yt,preNode:Nt})}))});for(var J=f.length,$=function(Ot){if(y)return"break";var mt=f[Ot];d.forEach(function(yt){var Rt=new au(yt),jt=t.findForwardRmpathEdges(i,Rt.edges[mt],v,Rt);jt.length>0&&(y=!0,Y=s.dfsEdgeList[mt].fromNode,jt.forEach(function(Xt){var ee="".concat(Xt.label,"-").concat(a[Xt.to].label);V[ee]||(V[ee]={projected:[],edgeLabel:Xt.label,nodeLabel2:a[Xt.to].label}),V[ee].projected.push({graphId:i.id,edge:Xt,preNode:yt})}))})},P=0;P=0;v--){var g=e.findBackwardEdge(h,f.edges[a[v]],f.edges[a[0]],f);if(g){var p="".concat(e.dfsCode.dfsEdgeList[a[v]].fromNode,"-").concat(g.label);c[p]||(c[p]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[v]].fromNode,edgeLabel:g.label}),c[p].projected.push({graphId:u.graphId,edge:g,preNode:u})}}if(!(i>=e.maxNodeNum)){var y=e.findForwardPureEdges(h,f.edges[a[0]],o,f);y.forEach(function(E){var O="".concat(s,"-").concat(E.label,"-").concat(d[E.to].label);l[O]||(l[O]={projected:[],fromNodeId:s,edgeLabel:E.label,nodeLabel2:d[E.to].label}),l[O].projected.push({graphId:u.graphId,edge:E,preNode:u})});for(var b=function(O){var P=e.findForwardRmpathEdges(h,f.edges[a[O]],o,f);P.forEach(function(R){var F="".concat(e.dfsCode.dfsEdgeList[a[O]].fromNode,"-").concat(R.label,"-").concat(d[R.to].label);l[F]||(l[F]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[O]].fromNode,edgeLabel:R.label,nodeLabel2:d[R.to].label}),l[F].projected.push({graphId:u.graphId,edge:R,preNode:u})})},v=0;vE){var O=E;E=b,b=O}var P=y.label,R="".concat(c,"-").concat(b,"-").concat(P,"-").concat(E),F="".concat(b,"-").concat(P,"-").concat(E);if(!s[F]){var I=s[F]||0;I++,s[F]=I}l[R]={graphId:c,nodeLabel1:b,edgeLabel:P,nodeLabel2:E}})})}),Object.keys(a).forEach(function(c){var u=a[c];if(!(u2*e)););if(p<2*e&&(o["".concat(u,"-").concat(g)]={start:u,end:g,distance:a[u][g]},h++,l++,l>=n))return o;if(d++,d>2*e)break}if(hd&&(l=d);var f=n[h.id].inDegree;c>f&&(c=f);var v=n[h.id].outDegree;u>v&&(u=v)}),t[e]={degree:l,inDegree:c,outDegree:u}),{minPatternNodeLabelDegree:l,minPatternNodeLabelInDegree:c,minPatternNodeLabelOutDegree:u}},sN=function(t,e,n,i,a,s,o){var l;if(n===void 0&&(n=!1),s===void 0&&(s="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var c=t.nodes.length;if(c){var u=jf(t,n),h=jf(e,n),d=py(t.nodes,u,n),f=py(e.nodes,h,n),v=vy(t.nodes,s),g=v.nodeMap,p=v.nodeLabelMap,y=vy(e.nodes,s),b=y.nodeMap,E=y.nodeLabelMap;gy(t.edges,o,g);var O=gy(e.edges,o,b).edgeLabelMap,P=[];h==null||h.forEach(function(Be){P=P.concat(Be)}),a||(a=Math.max.apply(Math,(0,G.ev)((0,G.ev)([],P,!1),[2],!1))),i||(i=a);var R=dy(t,u,s,i),F=dy(e,h,s,i),I=Math.min(100,c*(c-1)/2),V=rN(i,c,I,R,u),Y=su(V,R,t),J=10,$=1,ot=1,ct=4,ft={graphs:Y,nodeLabelProp:s,edgeLabelProp:o,minSupport:$,minNodeNum:ot,maxNodeNum:ct,directed:n},Nt=nN(ft).slice(0,J),Ot=Nt.length,mt=[];Nt.forEach(function(Be,Qe){mt[Qe]={},Object.keys(Y).forEach(function(Fe){var Ye=Y[Fe],nn=ou(Ye,Be,s,o);mt[Qe][Fe]=nn})});var yt=iN(mt,Ot,Nt),Rt=yt.structure,jt=yt.structureCountMap,Xt=e.nodes[0],ee=[],ae=(l=e.nodes[0])===null||l===void 0?void 0:l[s],he=-1/0;e.nodes.forEach(function(Be){var Qe=Be[s],Fe=p[Qe];(Fe==null?void 0:Fe.length)>he&&(he=Fe.length,ee=Fe,ae=Qe,Xt=Be)});var ce={},xe={},Ce={},je={},Ue={},or={};Object.keys(E).forEach(function(Be,Qe){Ue[Be]=[],n&&(or[Be]=[]);var Fe=-1/0,Ye=E[Be],nn={};Ye.forEach(function(Je){var Xe=f["".concat(Xt.id,"-").concat(Je.id)];if(Xe&&Ue[Be].push(Xe),FeUe[Be][zr]){Io=!0;break}if(Io)return ee.splice(Xe,1),"continue";var Ai={};di.neighbors.forEach(function(jr){var Vi=d["".concat(Bn.id,"-").concat(jr.id)];Ai["".concat(Bn.id,"-").concat(jr.id)]={start:g[Bn.id].idx,end:g[jr.id].idx,distance:Vi}}),Y=su(Ai,R,t,Y);var oa=[];Object.keys(Ai).forEach(function(jr){if(jt[jr]){oa.push(jt[jr]);return}var Vi=Y[jr];jt[jr]=ou(Vi,Rt,s,o),oa.push(jt[jr])}),oa=oa.sort(function(jr,Vi){return Vi-jr});for(var rs=!1,zr=0;zr=0;tr--)qe(tr)});var Ke=[];ee==null||ee.forEach(function(Be){for(var Qe=g[Be.id].idx,Fe=fy(t.nodes,u[Qe],Qe,s,a),Ye=Fe.neighbors,nn=Ye.length,pe=!1,He=nn-1;He>=0;He--){if(Ye.length+1di){Ye.splice(He,1);continue}if(n){var Yn="".concat(qe.id,"-").concat(Be.id),Ks=d[Yn];Bn=or[tr].length-1;var Io=or[tr][Bn];if(Ks>Io){Ye.splice(He,1);continue}}var zr=jt[Je]?jt[Je]:aN(t,Be,qe,g,Xe,R,Rt,s,o,jt,Y),Ai="".concat(Xt.id,"-").concat(tr),oa=je[Ai][je[Ai].length-1];if(zr=0;Xe--){var Io=Ks(Xe);if(Io==="break")break}if(Yn)return Ke.splice(Qe,1),"continue";Fe.edges=He;var zr=eu(Fe,Fe.nodes[0].id,!1).length;if(Object.keys(zr).reverse().forEach(function(xn){if(!(xn===Fe.nodes[0].id||Yn)){if(zr[xn]===1/0){var fi=pe[xn].node[s];if(nn[fi]--,nn[fi]Pr[la][Pr[la].length-1]){var fi=pe[xn].node[s];if(nn[fi]--,nn[fi]=0;Vi--){var Ta=Fe.nodes[Vi],nw=pe[Ta.id].degree,jB=pe[Ta.id].inDegree,ZB=pe[Ta.id].outDegree,WB=Ta[s],V0=my(ce,WB,b,E),rw=V0.minPatternNodeLabelDegree,GB=V0.minPatternNodeLabelInDegree,VB=V0.minPatternNodeLabelOutDegree,UB=n?nw=0;ud--){var Oa=He[ud];if(!pe[Oa.source]||!pe[Oa.target]){He.splice(ud,1);var hd=Oa[o];if(qe[hd]--,pe[Oa.source]&&(pe[Oa.source].degree--,pe[Oa.source].outDegree--),pe[Oa.target]&&(pe[Oa.target].degree--,pe[Oa.target].inDegree--),O[hd]&&qe[hd]=0;vr--){var Aa=wr(vr);if(Aa==="break")break}for(var Sr=Ke.length,Jr=function(Qe){var Fe=Ke[Qe],Ye={};Fe.edges.forEach(function(He){var qe="".concat(He.source,"-").concat(He.target,"-").concat(He.label);Ye[qe]?Ye[qe]++:Ye[qe]=1});for(var nn=function(qe){var tr=Ke[qe],Je={};tr.edges.forEach(function(Bn){var di="".concat(Bn.source,"-").concat(Bn.target,"-").concat(Bn.label);Je[di]?Je[di]++:Je[di]=1});var Xe=!0;Object.keys(Je).length!==Object.keys(Ye).length?Xe=!1:Object.keys(Ye).forEach(function(Bn){Je[Bn]!==Ye[Bn]&&(Xe=!1)}),Xe&&Ke.splice(qe,1)},pe=Sr-1;pe>Qe;pe--)nn(pe);Sr=Ke.length},vr=0;vr<=Sr-1;vr++)Jr(vr);return Ke}}},oN=sN,lN=function(){function r(t){t===void 0&&(t=10),this.linkedList=new Im,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}(),cN=lN,uN=Vm,c7={getAdjMatrix:Qc,breadthFirstSearch:GO,connectedComponent:zm,getDegree:Rf,getInDegree:UO,getOutDegree:YO,detectCycle:Vm,detectDirectedCycle:uN,detectAllCycles:KO,detectAllDirectedCycle:Gm,detectAllUndirectedCycle:Wm,depthFirstSearch:Zm,dijkstra:eu,findAllPath:wC,findShortestPath:zf,floydWarshall:jf,labelPropagation:AC,louvain:ey,iLouvain:LC,kCore:DC,kMeans:BC,cosineSimilarity:ry,nodesCosineSimilarity:jC,minimumSpanningTree:XC,pageRank:ay,getNeighbors:Ei,Stack:cN,GADDI:oN};function At(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(pa("The datum does not have available id."))}function lu(r){return r.combo}function yy(r,t){const e={nodes:(r.nodes||[]).map(At),edges:(r.edges||[]).map(At),combos:(r.combos||[]).map(At)};return t?Object.values(e).flat():e}const by=(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(At(a),e.direction).length;i.set(At(a),s)}),i}case"betweenness":return hN(r,e.directed,e.weightPropertyName);case"closeness":return dN(r,e.directed,e.weightPropertyName);case"eigenvector":return vN(r,e.directed);case"pagerank":return fN(r,e.epsilon,e.linkProb);default:return xy(r)}},xy=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(At(n),0)}),e},hN=(r,t,e)=>{const n=xy(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=zf(r,At(a),At(s),t,e),l=o.length;o.flat().forEach(c=>{c!==At(a)&&c!==At(s)&&n.set(c,n.get(c)+1/l)})}})}),n},dN=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,l)=>{if(a!==l){const{length:c}=zf(r,At(a),At(l),t,e);o+=c}return o},0);n.set(At(a),1/s)}),n},fN=(r,t,e)=>{var n;const i=new Map,a=ay(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(At(s),a[At(s)])}),i},vN=(r,t)=>{const{nodes:e=[]}=r,n=gN(r,t),i=pN(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(At(s),i[o])}),a},gN=(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(c=>At(c)===a),l=e.findIndex(c=>At(c)===s);t?i[o][l]=1:(i[o][l]=1,i[l][o]=1)}),i},pN=(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 c=0;cc+u*u,0));for(let c=0;cc+(u-i[h])*u,0)),i=o}return i};function ja(r,t,e,n=Wn){const i=new Map(r.map(d=>[e(d),d])),a=new Map(t.map(d=>[e(d),d])),s=new Set(i.keys()),o=new Set(a.keys()),l=[],c=[],u=[],h=[];return o.forEach(d=>{s.has(d)?n(i.get(d),a.get(d))?h.push(a.get(d)):c.push(a.get(d)):l.push(a.get(d))}),s.forEach(d=>{o.has(d)||u.push(i.get(d))}),{enter:l,exit:u,keep:h,update:c}}function Ps(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function mN(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 Gf{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=mN(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=ja(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=ga(e,i);if(!a)return Xr.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 Vf{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 si extends Vf{}class cu extends si{constructor(t,e){super(t,Object.assign({},cu.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(za(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=ja(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(c=>(this.nodeCentralities.has(c.id)||(this.nodeCentralities=by(s,o,i)),{node:c,centrality:this.nodeCentralities.get(c.id)})).sort((c,u)=>u.centrality-c.centrality).map(c=>c.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:l}=this.context;if(fe(i))return n.sort((g,p)=>i(l.getElementDataById(g.id),l.getElementDataById(p.id)));const{node:c=[],edge:u=[],combo:h=[]}=Xc(n,g=>g.type),d=fe(s)?h.sort((g,p)=>s(...l.getComboData([g.id,p.id]))):h,f=fe(a)?c.sort((g,p)=>a(...l.getNodeData([g.id,p.id]))):this.sortNodesByCentrality(c,a),v=fe(o)?u.sort((g,p)=>o(...l.getEdgeData([g.id,p.id]))):u;return[...d,...f,...v]},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:l}=this.detectLabelCollision(s);for(let c=o.length-1;c>=0;c--)this.showLabel(o[c]);l.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Ps(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Ps(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=Lm(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(Kt.BEFORE_RENDER,this.onBeforeRender),t.on(Kt.AFTER_RENDER,this.onAfterRender),t.on(Kt.AFTER_DRAW,this.toggle),t.on(Kt.AFTER_LAYOUT,this.toggle),t.on(Kt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Kt.BEFORE_RENDER,this.onBeforeRender),t.off(Kt.AFTER_RENDER,this.onAfterRender),t.off(Kt.AFTER_DRAW,this.toggle),t.off(Kt.AFTER_LAYOUT,this.toggle),t.off(Kt.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}cu.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};var yN=function(r){if(!Af(r)||!Tg(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},vo=yN,bN=5;function xN(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 Ey(r,t,e,n){e=e||0,n=n||bN;for(var i in t)if(xN(t,i)){var a=t[i];a!==null&&vo(a)?(vo(r[i])||(r[i]={}),ee+t[n])}function ln(r,t){return r.map((e,n)=>e-t[n])}function Di(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Ii(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function wN(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function SN(r,t){const e=pl(r),n=pl(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 Za(r,t){return r.map(e=>e*t)}function bn(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function uu(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function ma(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function Uf(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Di(r,t).reduce((a,s)=>a+s,0)/(bn(r,wy)*bn(t,wy)));return e&&n<0&&(i=2*Math.PI-i),i}function u7(r,t){return r.every((e,n)=>e===t[n])}function hu(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function Yf(r,t){return r.map(e=>e%t)}function Rs(r){return[r[0],r[1]]}function pl(r){return CO(r)?[r[0],r[1],0]:r}function Sy(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function My(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 Ay(r,t){const[e,n]=r,[i,a]=t,s=ln(e,n),o=ln(i,a);return SN(s,o).every(l=>l===0)}function Hf(r,t,e=!1){if(Ay(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])),l=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&&(!$i(o,0,1)||!$i(l,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function Ty(r){if(Array.isArray(r))return $i(r[0],0,1)&&$i(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 ir(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function MN(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function Oy(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 ya(r,t="center"){const e=Ty(t);return Oy(r,e)}function h7(r,t){const e=parseAnchor(t);return Oy(r,e)}const d7=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 yr(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Bi(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function f7(r){return r.sort((t,e)=>t[0]-e[0]||t[1]-e[1])}function v7(r){const t=new Set;return r.filter(e=>{const n=e.join(",");return t.has(n)?!1:(t.add(n),!0)})}function ml(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function Wa(r,t,e,n=!1){if(Wn(r,t))return r;const i=n?ln(r,t):ln(t,r),a=ma(i),s=[a[0]*e,a[1]*e];return Ne(Rs(r),s)}function Cy(r,t){return r[1]===t[1]}function AN(r,t){return r[0]===t[0]}function TN(r,t){return Cy(r,t)||AN(r,t)}function Ny(r,t,e){return Ay([r,t],[t,e])}function ky(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function Py(r,t,e,n=!0,i=!1){for(let a=0;aa!=f>a&&i<(d-u)*(a-h)/(f-h)+u&&(s=!s)}return s}function CN(r,t,e=!1){const n=ya(t,"center"),i=[ya(t,"left-top"),ya(t,"right-top"),ya(t,"right-bottom"),ya(t,"left-bottom")];return Py(r,n,i,!1,e).point}function du(r,t,e=!1){const n=t.center,i=e?ky(r,n):r,a=ln(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=ta(t)/2,l=ea(t)/2,c=n[0]+o*Math.cos(s),u=n[1]+l*Math.sin(s);return[c,u]}function NN(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=bn(i,a);s{const a=PN(r,i);a1?u=1:u<0&&(u=0);const h=e+u*l,d=n+u*c;return[h,d]}function RN(r){const t=r.reduce((e,n)=>Ne(e,n),[0,0]);return Ii(t,r.length)}function Xf(r,t=!0){const e=RN(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),l=Math.atan2(s-e[1],a-e[0]);return t?l-o:o-l})}function Ly(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class Gn{constructor(t,e,n){if(this.phase=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,Gn.instance)return Gn.callbacks[this.phase].push(n),Gn.instance;this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents(),Gn.instance=this,Gn.callbacks[this.phase].push(n)}bindEvents(){const{emitter:t}=this;t.on(Bt.POINTER_DOWN,this.onPointerDown),t.on(Bt.POINTER_MOVE,this.onPointerMove),t.on(Bt.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)){Gn.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),Gn.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;Gn.callbacks.pinchmove.forEach(l=>l(t,{scale:(o-1)*5}))}onPointerUp(t){var e;Gn.callbacks.pinchend.forEach(n=>n(t,{scale:0})),Gn.isPinching=!1,this.initialDistance=null,this.pointerByTouch=[],(e=Gn.instance)===null||e===void 0||e.tryDestroy()}destroy(){this.emitter.off(Bt.POINTER_DOWN,this.onPointerDown),this.emitter.off(Bt.POINTER_MOVE,this.onPointerMove),this.emitter.off(Bt.POINTER_UP,this.onPointerUp),Gn.instance=null}off(t,e){const n=Gn.callbacks[t].indexOf(e);n>-1&&Gn.callbacks[t].splice(n,1),this.tryDestroy()}tryDestroy(){Object.values(Gn.callbacks).every(t=>t.length===0)&&this.destroy()}}Gn.isPinching=!1,Gn.instance=null,Gn.callbacks={pinchstart:[],pinchmove:[],pinchend:[]};const _y=r=>r.map(t=>Ge(t)?t.toLocaleLowerCase():t);class go{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(Bt.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(Bt.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(Bt.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(Bt.PINCH)&&!this.pinchHandler&&(this.boundHandlePinch=this.handlePinch.bind(this),this.pinchHandler=new Gn(this.emitter,"pinchmove",this.boundHandlePinch)),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Wn(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=_y(Array.from(this.recordKey)).sort(),n=_y(t).sort();return Wn(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(Bt.KEY_DOWN,this.onKeyDown),e.on(Bt.KEY_UP,this.onKeyUp),e.on(Bt.WHEEL,this.onWheel),e.on(Bt.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)&&Wn(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(Bt.KEY_DOWN,this.onKeyDown),this.emitter.off(Bt.KEY_UP,this.onKeyUp),this.emitter.off(Bt.WHEEL,this.onWheel),this.emitter.off(Bt.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,"blur",this.onFocus)}}class yl extends si{constructor(t,e){super(t,mr({},yl.defaultOptions,e)),this.shortcut=new go(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 pr({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=fu(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(Ly(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=fu(t,this.context.graph),this.updateElementsStates(Ly(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 l=(o=s.states||[])===null||o===void 0?void 0:o.filter(c=>c!==this.options.state);return a[At(s)]=l,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);let l={};switch(a){case"union":o.forEach(c=>{l[c]=[...e.getElementState(c),i]});break;case"diff":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?u.filter(h=>h!==i):[...u,i]});break;case"intersect":o.forEach(c=>{const u=e.getElementState(c);l[c]=u.includes(i)?[i]:[]});break;case"default":default:o.forEach(c=>{l[c]=[i]});break}fe(s)&&(l=s(l)),e.setElementState(l,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 l=At(o);t.getElementVisibility(l)!=="hidden"&&ON(t.getElementPosition(l),e)&&i.push(l)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:l,target:c}=o;i.includes(l)&&i.includes(c)&&i.push(At(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 fe(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(Bt.POINTER_DOWN,this.onPointerDown),t.on(Bt.POINTER_MOVE,this.onPointerMove),t.on(Bt.POINTER_UP,this.onPointerUp),t.on(va.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(Bt.POINTER_DOWN,this.onPointerDown),t.off(Bt.POINTER_MOVE,this.onPointerMove),t.off(Bt.POINTER_UP,this.onPointerUp),t.off(va.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=mr(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}yl.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 fu=(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]},ba=.8,Ls=["node","edge","combo"];function _s(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)_s(s,t,e,n,i+1);n==="BT"&&t(r,i)}function LN(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 Dy(r,t,e,n,i="both"){if(t==="combo"||t==="node")return Kf(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=Kf(r,a.source,n-1,i),o=Kf(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function Kf(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return LN(t,(o,l)=>{l>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(c=>{const u=At(c);!a.has(u)&&lr.getRelatedEdgesData(o,n).map(l=>l.source===o?l.target:l.source).filter(l=>i.has(l)?!1:(i.add(l),!0))),Array.from(s)}function Qf(r){return r.states||[]}var vu=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class gu extends si{constructor(t,e){super(t,Object.assign({},gu.defaultOptions,e)),this.onClickSelect=n=>vu(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=>vu(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 go(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Ls.forEach(e=>{t.on(`${e}:${Bt.CLICK}`,this.onClickSelect)}),t.on(va.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 Dy(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return vu(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,l=o.getElementData(s.id),c=Qf(l).includes(e)?"unselect":"select",u={},h=this.isMultipleSelect,d=[s.id],f=this.getNeighborIds(t);if(h)if(Object.assign(u,this.getDataStates()),c==="select"){const v=(g,p)=>{g.forEach(y=>{const b=new Set(o.getElementState(y));b.add(p),b.delete(n),u[y]=Array.from(b)})};v(d,e),v(f,i),n&&Object.keys(u).forEach(g=>{const p=u[g];!p.includes(e)&&!p.includes(i)&&!p.includes(n)&&u[g].push(n)})}else{const v=u[s.id];u[s.id]=v.filter(g=>g!==e&&g!==i),v.includes(n)||u[s.id].push(n),f.forEach(g=>{u[g]=u[g].filter(p=>p!==i),u[g].includes(e)||u[g].push(n)})}else if(c==="select"){Object.assign(u,this.getClearStates(!!n));const v=(g,p)=>{g.forEach(y=>{u[y]||(u[y]=o.getElementState(y)),u[y].push(p)})};v(d,e),v(f,i),n&&Object.keys(u).forEach(g=>{!d.includes(g)&&!f.includes(g)&&u[g].push(n)})}else Object.assign(u,this.getClearStates());yield o.setElementState(u,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[At(s)]=Qf(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:l,combos:c}=e.getData(),u={};return[...o,...l,...c].forEach(h=>{const d=Qf(h),f=d.filter(v=>!s.has(v));(t||f.length!==d.length)&&(u[At(h)]=f)}),u}clearState(){return vu(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 fe(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Ls.forEach(e=>{t.off(`${e}:${Bt.CLICK}`,this.onClickSelect)}),t.off(va.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}gu.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function Kr(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}var br=function(r,t,e){for(var n=0,i=Ge(t)?t.split("."):t;r&&n="A"&&e<="Z"}function Iy(r,t){return`${t}${Yc(r)}`}function By(r,t,e=!0){if(!t||!xl(r,t))return r;const n=r.slice(t.length);return e?DN(n):n}function _n(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||xl(i,t)&&Object.assign(n,{[By(i,t)]:a}),n),{});if("opacity"in r){const n=Iy("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 qf(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 Fy(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 g7(r,t,e){return Object.entries(r).reduce((n,[i,a])=>(xl(i,t)?n[Iy(By(i,t,!1),e)]=a:n[i]=a,n),{})}function oi(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var IN=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 ur(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 BN(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:l,visibility:c}=r;return IN(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function FN(r,t){const e=oi(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 jy(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 zN(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=l=>{const c=typeof n=="string"?ga("palette",n):n;if(typeof c=="function"){const u={};return l.forEach(([h,d])=>{u[h]=c(a?1-d:d)}),u}else if(Array.isArray(c)){const u=a?[...c].reverse():c,h={};return l.forEach(([d,f])=>{h[d]=u[f%c.length]}),h}return{}},o=(l,c)=>{var u;return typeof l=="string"?(u=c.data)===null||u===void 0?void 0:u[l]:l==null?void 0:l(c)};if(e==="group"){const l=Xc(r,d=>{if(!i)return"default";const f=o(i,d);return f?String(f):"default"}),c=Object.keys(l),u=s(c.map((d,f)=>[d,f])),h={};return Object.entries(l).forEach(([d,f])=>{f.forEach(v=>{h[At(v)]=u[d]})}),h}else if(e==="value"){const[l,c]=r.reduce(([h,d],f)=>{const v=o(i,f);if(typeof v!="number")throw new Error(pa(`Palette field ${i} is not a number`));return[Math.min(h,v),Math.max(d,v)]},[1/0,-1/0]),u=c-l;return s(r.map(h=>[h.id,(o(i,h)-l)/u]))}}function Zy(r){const t=typeof r=="string"?ga("palette",r):r;if(typeof t!="function")return t}function Wy(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 Gy(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return Wy(a,t)}function jN(r,t,e=1){const n=bn(r[0],r[1])*e;return Wy(n,t)}var ZN={}.toString,WN=function(r){return ZN.call(r).replace(/^\[object /,"").replace(/]$/,"")},GN=WN,VN=Object.prototype,UN=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||VN;return r===e},YN=UN,HN=Object.prototype.hasOwnProperty;function XN(r){if(me(r))return!0;if(cl(r))return!r.length;var t=GN(r);if(t==="Map"||t==="Set")return!r.size;if(YN(r))return!Object.keys(r).length;for(var e in r)if(HN.call(r,e))return!1;return!0}var ra=XN;class El extends ff{constructor(t){Vy(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,l,c,u,h,d,f;const v=this.shapeMap[t];if(n===!1){v&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,v),i.removeChild(v),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,v));return}const g=typeof e=="string"?ga(ul.SHAPE,e):e;if(!g)throw new Error(pa(`Shape ${e} not found`));if(!v||v.destroyed||!(v instanceof g)){v&&((l=a==null?void 0:a.beforeDestroy)===null||l===void 0||l.call(a,v),v==null||v.destroy(),(c=a==null?void 0:a.afterDestroy)===null||c===void 0||c.call(a,v)),(u=a==null?void 0:a.beforeCreate)===null||u===void 0||u.call(a);const p=new g({className:t,style:n});return i.appendChild(p),this.shapeMap[t]=p,(h=a==null?void 0:a.afterCreate)===null||h===void 0||h.call(a,p),p}return(d=a==null?void 0:a.beforeUpdate)===null||d===void 0||d.call(a,v),bv(v,n),(f=a==null?void 0:a.afterUpdate)===null||f===void 0||f.call(a,v),v}update(t={}){const e=Object.assign({},this.attributes,t);Vy(e),K3(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return BN(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(l=>{const{x:c=a,y:u=s,z:h=o}=l;Object.assign(l,{transform:h?[["translate3d",c,u,h]]:[["translate",c,u]]})})}const i=super.animate(t,e);if(i&&(Jf(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,l])=>{const c=`get${Yc(o)}Style`,u=this[c];if(fe(u)){const h=t.map(f=>u.call(this,Object.assign(Object.assign({},this.attributes),f))),d=l.animate(Nf(h),e);d&&(Jf(l,d),n.push(d))}});const s=(o,l)=>{if(!ra(o)){const c=`get${Yc(l)}Style`,u=this[c];if(fe(u)){const h=t.map(d=>u.call(this,Object.assign(Object.assign({},this.attributes),d)));Object.entries(h[0]).map(([d])=>{const f=h.map(g=>g[d]),v=o[d];if(v){const g=v.animate(Nf(f),e);g&&(Jf(v,g),n.push(g))}})}}};this.compositeShapes.forEach(([o,l])=>{const c=qf(this.shapeMap,l);s(c,o)})}}return Cf(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Ps(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function Jf(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function Vy(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=Nm(t,e,n,i);a&&(r.transform=a)}return r}var KN=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 Uy={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 qN(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 Uy?n=a:t.unshift(a),i={type:n},Uy[n].forEach(l=>{a=t.shift(),i[l]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function JN(r){const t=[];return(typeof r=="string"?qN(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 p=v,y=u[(g+1)%u.length];return Wn(p,y)?null:[p,y]}).filter(Boolean),d=kN([o,l],h),f=Ry([o,l],d);if(f&&d&&(c.transform=[["translate",f[0]+e,f[1]+n]],s)){const v=Math.atan((d[0][1]-d[1][1])/(d[0][0]-d[1][0]));c.transform.push(["rotate",v/Math.PI*180]),c.textAlign="center",(t==="right"||t==="left")&&(v>0?c.textBaseline=t==="right"?"bottom":"top":c.textBaseline=t==="right"?"top":"bottom")}return c}var tk=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 nk(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}class $f extends sl{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},mo=this,this.isMutationObserved=!0,this.addEventListener(De.MOUNTED,this.onMounted),this.addEventListener(De.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 l=new pr({style:o});this.style.clipPath=l}}else e&&(this.style.clipPath=null)}}const tv=new WeakMap;let mo=null;const ev=r=>{if(mo&&nk(mo).includes(r)){const t=tv.get(r);t?t.includes(mo)||t.push(mo):tv.set(r,[mo])}},nv=r=>{const t=tv.get(r);t&&t.forEach(e=>e.handleRadius())};class Hy extends El{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()?$f:Os,this.getIconStyle(t),e)}}class Xy extends El{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 pu=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[h]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,l=pu(t,["badges","badgePalette","opacity"]),c=Zy(s),u=_n(this.getGraphicStyle(l),"badge");return a.forEach((h,d)=>{i[d]=Object.assign(Object.assign({backgroundFill:c?c[d%(c==null?void 0:c.length)]:void 0,opacity:o},u),this.getBadgeStyle(h))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=pu(t,["placement","offsetX","offsetY"]),o=O1(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=_n(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,l)=>{const c=o.key||l,u=Object.assign(Object.assign({},a),o);if(M1(u))i[c]=!1;else{const[h,d]=this.getPortXY(t,o);i[c]=Object.assign({transform:[["translate",h,d]]},u)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return pv(rk(this.context,i),n)}getPorts(){return qf(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return CN(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",Hy,n,e),ev(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,po,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,Ji,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",ia,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)&&nv(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Fi.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 rk(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Ps(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}class Ds extends Fi{constructor(t){super(ur({style:Ds.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",Ji,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*ba;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return du(t,n,e)}}Ds.defaultStyleProps={size:32};class mu extends Fi{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",Ts,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 Py(t,s,a,!0,e).point}}class ik extends mu{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return X3(e,n)}}var ak=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);iie(h)?{value:h}:h),a=_n(this.getGraphicStyle(t),"donut"),s=Zy(t.donutPalette);if(!s)return;const o=i.reduce((h,d)=>{var f;return h+((f=d.value)!==null&&f!==void 0?f:0)},0),l=this.parseOuterR(),c=this.parseInnerR();let u=0;i.forEach((h,d)=>{const{value:f=0,color:v=s[d%s.length]}=h,g=ak(h,["value","color"]),p=(o===0?1/i.length:f/o)*360;this.upsert(`round${d}`,ni,Object.assign(Object.assign(Object.assign({},a),{d:lk(l,c,u,u+p),fill:v}),g),e),u+=p})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}yu.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const bu=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],sk=(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"]],ok=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],l=[bu(r,t,n,s),bu(r,t,e,s),bu(r,t,e,o),bu(r,t,n,o)],c=o-s>Math.PI?1:0;return[["M",l[0][0],l[0][1]],["L",l[1][0],l[1][1]],["A",e,e,0,c,1,l[2][0],l[2][1]],["L",l[3][0],l[3][1]],["A",n,n,0,c,0,l[0][0],l[0][1]],["Z"]]},lk=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?sk(i,a,r,t):ok(i,a,r,t,e,n)};class xu extends Fi{constructor(t){super(ur({style:xu.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",al,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*ba;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return du(t,n,e)}}xu.defaultStyleProps={size:[45,35]};class ck extends mu{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return Q3(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*ba;return e?Object.assign({width:n,height:n},e):!1}}function uk(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.r;r.arc(n,a,s,0,Math.PI*2,!1)}function hk(r,t){var e=t.cx,n=e===void 0?0:e,i=t.cy,a=i===void 0?0:i,s=t.rx,o=t.ry;if(r.ellipse)r.ellipse(n,a,s,o,0,0,Math.PI*2,!1);else{var l=s>o?s:o,c=s>o?1:s/o,u=s>o?o/s:1;r.save(),r.scale(c,u),r.arc(n,a,l,0,Math.PI*2)}}function dk(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,l=t.markerStartOffset,c=t.markerEndOffset,u=0,h=0,d=0,f=0,v=0,g,p;s&&Ve(s)&&l&&(g=i-e,p=a-n,v=Math.atan2(p,g),u=Math.cos(v)*(l||0),h=Math.sin(v)*(l||0)),o&&Ve(o)&&c&&(g=e-i,p=n-a,v=Math.atan2(p,g),d=Math.cos(v)*(c||0),f=Math.sin(v)*(c||0)),r.moveTo(e+u,n+h),r.lineTo(i+d,a+f)}function fk(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,l=s.segments,c=0,u=0,h=0,d=0,f=0,v,g;if(e&&Ve(e)&&i){var p=e.parentNode.getStartTangent(),y=(0,L.Z)(p,2),b=y[0],E=y[1];v=b[0]-E[0],g=b[1]-E[1],f=Math.atan2(g,v),c=Math.cos(f)*(i||0),u=Math.sin(f)*(i||0)}if(n&&Ve(n)&&a){var O=n.parentNode.getEndTangent(),P=(0,L.Z)(O,2),R=P[0],F=P[1];v=R[0]-F[0],g=R[1]-F[1],f=Math.atan2(g,v),h=Math.cos(f)*(a||0),d=Math.sin(f)*(a||0)}for(var I=0;Ice?he:ce,Ke=he>ce?1:he/ce,hi=he>ce?ce/he:1;r.translate(ee,ae),r.rotate(je),r.scale(Ke,hi),r.arc(0,0,or,xe,Ce,!!(1-Ue)),r.scale(1/Ke,1/hi),r.rotate(-je),r.translate(-ee,-ae)}ot&&r.lineTo(V[6]+h,V[7]+d);break}case"Z":r.closePath();break}}}function vk(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,l=s[0][0],c=s[0][1],u=s[o-1][0],h=s[o-1][1],d=0,f=0,v=0,g=0,p=0,y,b;e&&Ve(e)&&i&&(y=s[1][0]-s[0][0],b=s[1][1]-s[0][1],p=Math.atan2(b,y),d=Math.cos(p)*(i||0),f=Math.sin(p)*(i||0)),n&&Ve(n)&&a&&(y=s[o-1][0]-s[0][0],b=s[o-1][1]-s[0][1],p=Math.atan2(b,y),v=Math.cos(p)*(a||0),g=Math.sin(p)*(a||0)),r.moveTo(l+(d||v),c+(f||g));for(var E=1;E0?1:-1,f=l>0?1:-1,v=d+f===0,g=s.map(function(P){return kn(P,0,Math.min(Math.abs(c)/2,Math.abs(u)/2))}),p=(0,L.Z)(g,4),y=p[0],b=p[1],E=p[2],O=p[3];r.moveTo(d*y+n,a),r.lineTo(c-d*b+n,a),b!==0&&r.arc(c-d*b+n,f*b+a,b,-f*Math.PI/2,d>0?0:Math.PI,v),r.lineTo(c+n,u-f*E+a),E!==0&&r.arc(c-d*E+n,u-f*E+a,E,d>0?0:Math.PI,f>0?Math.PI/2:1.5*Math.PI,v),r.lineTo(d*O+n,u+a),O!==0&&r.arc(d*O+n,u-f*O+a,O,f>0?Math.PI/2:-Math.PI/2,d>0?Math.PI:0,v),r.lineTo(n,f*y+a),y!==0&&r.arc(d*y+n,f*y+a,y,d>0?Math.PI:0,f>0?Math.PI*1.5:Math.PI/2,v)}}var mk=function(r){function t(){var e;(0,N.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a=l-y&&b<=l+y:!1}function Eu(r,t,e,n){return r/(e*e)+t/(n*n)}function Sk(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,l=n.rx,c=n.ry,u=n.fill,h=n.stroke,d=n.lineWidth,f=d===void 0?1:d,v=n.increasedLineWidthForHitTesting,g=v===void 0?0:v,p=n.pointerEvents,y=p===void 0?"auto":p,b=t.x,E=t.y,O=xs(y,u,h),P=(0,L.Z)(O,2),R=P[0],F=P[1],I=(f+g)/2,V=(b-a)*(b-a),Y=(E-o)*(E-o);return R&&F||e?Eu(V,Y,l+I,c+I)<=1:R?Eu(V,Y,l,c)<=1:F?Eu(V,Y,l-I,c-I)>=1&&Eu(V,Y,l+I,c+I)<=1:!1}function Is(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function Mk(r,t,e,n,i,a,s){var o=i/2;return Is(r-o,t-o,e,i,a,s)||Is(r+e-o,t-o,i,n,a,s)||Is(r+o,t+n-o,e,i,a,s)||Is(r-o,t+o,i,n,a,s)}function wu(r,t,e,n,i,a,s,o){var l=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),c={x:r+e*Math.cos(l),y:t+e*Math.sin(l)};return Ar(c.x,c.y,s,o)<=a/2}function Ga(r,t,e,n,i,a,s){var o=Math.min(r,e),l=Math.max(r,e),c=Math.min(t,n),u=Math.max(t,n),h=i/2;return a>=o-h&&a<=l+h&&s>=c-h&&s<=u+h?Dg(r,t,e,n,a,s)<=i/2:!1}function Qy(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s0!=rv(o[1]-e)>0&&rv(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function Jy(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 Ik=function(r){function t(){var e;(0,N.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&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;iv.length<=0&&av.length<=0||(av.forEach(function(n){return n()}),av=iv.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,l=e.naturalWidth||e.width,c=e.naturalHeight||e.height,u=n-s,h=i-s,d=Math.ceil(l/u),f=Math.ceil(c/h),v={tileSize:[n,i],gridSize:[f,d],tiles:Array(f).fill(null).map(function(){return Array(d).fill(null)})},g=function(b){for(var E=function(R){iv.push(function(){var F=R*u,I=b*h,V=[Math.min(n,l-F),Math.min(i,c-I)],Y=V[0],J=V[1],$=o.createCanvas();$.width=n,$.height=i;var ot=$.getContext("2d");ot.drawImage(e,F,I,Y,J,0,0,Y,J),v.tiles[b][R]={x:F,y:I,tileX:R,tileY:b,data:$},a()})},O=0;OY&&ft>J,P&&(typeof P.resetTransform=="function"?P.resetTransform():P.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(P,0,0,F*R,I*R,s.background))},b=function(O,P){for(var R=[O];R.length>0;){var F,I=R.pop();I.isVisible()&&!I.isCulled()&&(d?i.renderDisplayObjectOptimized(I,P,i.context,aa(i,Vn)[Vn],n):i.renderDisplayObject(I,P,i.context,aa(i,Vn)[Vn],n));for(var V=((F=I.sortable)===null||F===void 0||(F=F.sorted)===null||F===void 0?void 0:F.length)>0?I.sortable.sorted:I.childNodes,Y=V.length-1;Y>=0;Y--)R.push(V[Y])}};l.hooks.endFrame.tap(r.tag,function(){if(y(),c.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}d=s.renderer.getConfig().enableRenderingOptimization,aa(i,Vn)[Vn]={restoreStack:[],prevObject:null,currentContext:aa(i,Vn)[Vn].currentContext},aa(i,Vn)[Vn].currentContext.clear(),i.clearFullScreenLastFrame=!1;var E=f.getContext(),O=f.getDPR();if(gn(i.dprMatrix,[O,O,1]),Jt(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)d?(E.save(),b(c.root,E),E.restore()):b(c.root,E),i.removedRBushNodeAABBs=[];else{var P=i.safeMergeAABB.apply(i,[i.mergeDirtyAABBs(i.renderQueue)].concat((0,k.Z)(i.removedRBushNodeAABBs.map(function(ce){var xe=ce.minX,Ce=ce.minY,je=ce.maxX,Ue=ce.maxY,or=new pn;return or.setMinMax([xe,Ce,0],[je,Ue,0]),or}))));if(i.removedRBushNodeAABBs=[],pn.isEmpty(P)){i.renderQueue=[];return}var R=i.convertAABB2Rect(P),F=R.x,I=R.y,V=R.width,Y=R.height,J=re(i.vec3a,[F,I,0],i.vpMatrix),$=re(i.vec3b,[F+V,I,0],i.vpMatrix),ot=re(i.vec3c,[F,I+Y,0],i.vpMatrix),ct=re(i.vec3d,[F+V,I+Y,0],i.vpMatrix),ft=Math.min(J[0],$[0],ct[0],ot[0]),Nt=Math.min(J[1],$[1],ct[1],ot[1]),Ot=Math.max(J[0],$[0],ct[0],ot[0]),mt=Math.max(J[1],$[1],ct[1],ot[1]),yt=Math.floor(ft),Rt=Math.floor(Nt),jt=Math.ceil(Ot-ft),Xt=Math.ceil(mt-Nt);E.save(),i.clearRect(E,yt,Rt,jt,Xt,s.background),E.beginPath(),E.rect(yt,Rt,jt,Xt),E.clip(),E.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var ee=s.renderer.getConfig(),ae=ee.enableDirtyRectangleRenderingDebug;ae&&v.dispatchEvent(new Qn(ri.DIRTY_RECTANGLE,{dirtyRect:{x:yt,y:Rt,width:jt,height:Xt}}));var he=i.searchDirtyObjects(P);he.sort(function(ce,xe){return ce.sortable.renderOrder-xe.sortable.renderOrder}).forEach(function(ce){ce&&ce.isVisible()&&!ce.isCulled()&&i.renderDisplayObject(ce,E,i.context,aa(i,Vn)[Vn],n)}),E.restore(),i.renderQueue.forEach(function(ce){i.saveDirtyAABB(ce)}),i.renderQueue=[]}aa(i,Vn)[Vn].restoreStack.forEach(function(){E.restore()}),aa(i,Vn)[Vn].restoreStack=[]}),l.hooks.render.tap(r.tag,function(E){i.clearFullScreen||i.renderQueue.push(E)})}},{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,l=!1,c=!1,u=this.context.styleRendererFactory[o],h=this.pathGeneratorFactory[o],d=e.parsedStyle.clipPath;if(d){l=!a.prevObject||!Sd(d.getWorldTransform(),a.prevObject.getWorldTransform()),l&&(this.applyWorldTransform(n,d),a.prevObject=null);var f=this.pathGeneratorFactory[d.nodeName];f&&(n.save(),c=!0,n.beginPath(),f(n,d.parsedStyle),n.closePath(),n.clip())}if(u){l=!a.prevObject||!Sd(e.getWorldTransform(),a.prevObject.getWorldTransform()),l&&this.applyWorldTransform(n,e);var v=!a.prevObject;if(!v){var g=a.prevObject.nodeName;o===Dt.TEXT?v=g!==Dt.TEXT:o===Dt.IMAGE?v=g!==Dt.IMAGE:v=g===Dt.TEXT||g===Dt.IMAGE}u.applyStyleToContext(n,e,v,a),a.prevObject=e}h&&(n.beginPath(),h(n,e.parsedStyle),o!==Dt.LINE&&o!==Dt.PATH&&o!==Dt.POLYLINE&&n.closePath()),u&&u.drawToContext(n,e,aa(this,Vn)[Vn],this,s),c&&n.restore(),e.dirty(!1)}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,l=a.restoreStack[a.restoreStack.length-1];l&&!(e.compareDocumentPosition(l)&On.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var c=this.context.styleRendererFactory[o],u=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){this.applyWorldTransform(n,h);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),a.restoreStack.push(e),n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}c&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),u&&(n.beginPath(),u(n,e.parsedStyle),o!==Dt.LINE&&o!==Dt.PATH&&o!==Dt.POLYLINE&&n.closePath()),c&&(c.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,l=i.lineDash,c=i.lineDashOffset;l&&e.setLineDash(l),me(c)||(e.lineDashOffset=c),me(o)||(e.globalAlpha*=o),!me(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!me(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]),l=Math.ceil(i[1]),c=o-a,u=l-s;return{x:a,y:s,width:c,height:u}}},{key:"mergeDirtyAABBs",value:function(e){var n=new pn;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"searchDirtyObjects",value:function(e){var n=e.getMin(),i=(0,L.Z)(n,2),a=i[0],s=i[1],o=e.getMax(),l=(0,L.Z)(o,2),c=l[0],u=l[1],h=this.rBush.search({minX:a,minY:s,maxX:c,maxY:u});return h.map(function(d){var f=d.displayObject;return f})}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new pn);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(we(this.tmpMat4,n.getLocalTransform()),Jt(this.tmpMat4,i,this.tmpMat4),Jt(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(we(this.tmpMat4,n.getWorldTransform()),Jt(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 pn,n=arguments.length,i=new Array(n),a=0;a0;if(h){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var d=!me(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:qn.strokeStyle;Rn(e,"strokeStyle",d,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&Rn(e,"lineWidth",me(o.lineWidth)?qn.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&Rn(e,"lineDash",o.lineDash||qn.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&Rn(e,"lineDashOffset",me(o.lineDashOffset)?qn.lineDashOffset:o.lineDashOffset,a.currentContext);for(var f=0;f4&&arguments[4]!==void 0?arguments[4]:!1;if(n){Rn(e,"shadowColor",qn.shadowColor,a.currentContext);for(var o=0;o-1&&Rn(e,"filter",c.replace(/drop-shadow\([^)]*\)/,"").trim()||qn.filter,a.currentContext)}else Rn(e,"filter",qn.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle,c=l.fill,u=l.fillRule,h=null;if(Array.isArray(c)&&c.length>0)c.forEach(function(f){var v=Rn(e,"fillStyle",Au(f,n,e,o.imagePool),i.currentContext);h=h!=null?h:v,u?e.fill(u):e.fill()});else{if(ys(c)){var d=Mu(c,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);d&&(e.fillStyle=d,h=!0)}u?e.fill(u):e.fill()}h!==null&&Rn(e,"fillStyle",h,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,l=n.parsedStyle.stroke,c=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=Rn(e,"strokeStyle",Au(d,n,e,o.imagePool),i.currentContext);c=c!=null?c:f,e.stroke()});else{if(ys(l)){var u=Mu(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(u){var h=Rn(e,"strokeStyle",u,i.currentContext);c=c!=null?c:h}}e.stroke()}c!==null&&Rn(e,"strokeStyle",c,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,l=n.nodeName,c=n.parsedStyle,u=c.opacity,h=u===void 0?qn.globalAlpha:u,d=c.fillOpacity,f=d===void 0?qn.fillOpacity:d,v=c.strokeOpacity,g=v===void 0?qn.strokeOpacity:v,p=c.lineWidth,y=p===void 0?qn.lineWidth:p,b=c.fill&&!c.fill.isNone,E=c.stroke&&!c.stroke.isNone&&y>0;if(!(!b&&!E)){var O=!me(c.shadowColor)&&c.shadowBlur>0,P=c.shadowType==="inner",R=((o=c.fill)===null||o===void 0?void 0:o.alpha)===0,F=!!(c.filter&&c.filter.length),I=O&&E&&(l===Dt.PATH||l===Dt.LINE||l===Dt.POLYLINE||R||P),V=null;if(b){I||this.applyShadowAndFilterStyleToContext(e,n,O,i);var Y=h*f;V=Rn(e,"globalAlpha",Y,i.currentContext),this.fillToContext(e,n,i,a,s),I||this.clearShadowAndFilterStyleForContext(e,O,F,i)}if(E){var J=!1,$=h*g,ot=Rn(e,"globalAlpha",$,i.currentContext);if(V=b?V:ot,I&&(this.applyShadowAndFilterStyleToContext(e,n,O,i),J=!0,P)){var ct=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=ct,this.clearShadowAndFilterStyleForContext(e,O,F,i,!0)}this.strokeToContext(e,n,i,a,s),J&&this.clearShadowAndFilterStyleForContext(e,O,F,i)}V!==null&&Rn(e,"globalAlpha",V,i.currentContext)}}}])}(),lv=function(r){function t(){return(0,N.Z)(this,t),(0,_.Z)(this,t,arguments)}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"render",value:function(n,i,a,s,o,l){var c=i.fill,u=i.fillRule,h=i.opacity,d=h===void 0?1:h,f=i.fillOpacity,v=f===void 0?1:f,g=i.stroke,p=i.strokeOpacity,y=p===void 0?1:p,b=i.lineWidth,E=b===void 0?1:b,O=i.lineCap,P=i.lineJoin,R=i.shadowType,F=i.shadowColor,I=i.shadowBlur,V=i.filter,Y=i.miterLimit,J=c&&!c.isNone,$=g&&!g.isNone&&E>0,ot=(c==null?void 0:c.alpha)===0,ct=!!(V&&V.length),ft=!me(F)&&I>0,Nt=a.nodeName,Ot=R==="inner",mt=$&&ft&&(Nt===Dt.PATH||Nt===Dt.LINE||Nt===Dt.POLYLINE||ot||Ot);J&&(n.globalAlpha=d*v,mt||Ou(a,n,ft),r1(n,a,c,u,s,o,l,this.imagePool),mt||this.clearShadowAndFilter(n,ct,ft)),$&&(n.globalAlpha=d*y,n.lineWidth=E,me(Y)||(n.miterLimit=Y),me(O)||(n.lineCap=O),me(P)||(n.lineJoin=P),mt&&(Ot&&(n.globalCompositeOperation="source-atop"),Ou(a,n,!0),Ot&&(cv(n,a,g,s,o,l,this.imagePool),n.globalCompositeOperation=qn.globalCompositeOperation,this.clearShadowAndFilter(n,ct,!0))),cv(n,a,g,s,o,l,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!me(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(Zk);function Ou(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,l=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=l||0)}function r1(r,t,e,n,i,a,s,o){var l=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(c){r.fillStyle=Au(c,t,r,o),l||(n?r.fill(n):r.fill())}):(ys(e)&&(r.fillStyle=Mu(e,t,r,i,a,s,o)),l||(n?r.fill(n):r.fill()))}function cv(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(l){r.strokeStyle=Au(l,t,r,s),o||r.stroke()}):(ys(e)&&(r.strokeStyle=Mu(e,t,r,n,i,a,s)),o||r.stroke())}function Wk(r,t){var e=(0,L.Z)(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=(0,L.Z)(t,4),l=o[0],c=o[1],u=o[2],h=o[3],d=Math.max(n,l),f=Math.max(i,c),v=Math.min(n+a,l+u),g=Math.min(i+s,c+h);return v<=d||g<=f?null:[d,f,v-d,g-f]}function Gk(r,t){var e=re(pt(),[r[0],r[1],0],t),n=re(pt(),[r[0]+r[2],r[1],0],t),i=re(pt(),[r[0],r[1]+r[3],0],t),a=re(pt(),[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 Vk=function(r){function t(){return(0,N.Z)(this,t),(0,_.Z)(this,t,arguments)}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,l=s.imageCache;if(!l.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirtify())}).catch(function(c){console.error(c)});return}n.drawImage(l.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,l=s.imageCache,c=s.imageRect,u=s.drawRect,h=l.size,d=n.getTransform(),f=d.a,v=d.b,g=d.c,p=d.d,y=d.e,b=d.f;if(n.resetTransform(),!(l!=null&&l.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirtify())},a).catch(function(ft){console.error(ft)});return}for(var E=[h[0]/c[2],h[1]/c[3]],O=[l.tileSize[0]/E[0],l.tileSize[1]/E[1]],P=[Math.floor((u[0]-c[0])/O[0]),Math.ceil((u[0]+u[2]-c[0])/O[0])],R=P[0],F=P[1],I=[Math.floor((u[1]-c[1])/O[1]),Math.ceil((u[1]+u[3]-c[1])/O[1])],V=I[0],Y=I[1],J=V;J<=Y;J++)for(var $=R;$<=F;$++){var ot=l.tiles[J][$];if(ot){var ct=[Math.floor(c[0]+ot.tileX*O[0]),Math.floor(c[1]+ot.tileY*O[1]),Math.ceil(O[0]),Math.ceil(O[1])];n.drawImage(ot.data,ct[0],ct[1],ct[2],ct[3])}}n.setTransform(f,v,g,p,y,b)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,l=i.y,c=l===void 0?0:l,u=i.width,h=i.height,d=i.src,f=i.shadowColor,v=i.shadowBlur,g=this.imagePool.getImageSync(d,a),p=g==null?void 0:g.img,y=u,b=h;if(p){y||(y=p.width),b||(b=p.height);var E=!me(f)&&v>0;Ou(a,n,E);try{var O=a.ownerDocument.defaultView.getContextService().getDomElement(),P=O.width,R=O.height,F=n.getTransform(),I=F.a,V=F.b,Y=F.c,J=F.d,$=F.e,ot=F.f,ct=Ae(I,Y,0,0,V,J,0,0,0,0,1,0,$,ot,0,1),ft=Gk([o,c,y,b],ct),Nt=Wk([0,0,P,R],ft);if(!Nt)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:p,drawRect:[o,c,y,b]});return}var Ot=ft[2]/g.size[0];if(Ot<(g.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:d,imageCache:g,drawRect:[o,c,y,b]});return}if(!ov.isSupportTile){t.renderFull(n,i,a,{image:p,drawRect:[o,c,y,b]});return}this.renderTile(n,i,a,{src:d,imageCache:g,imageRect:ft,drawRect:Nt})}catch(mt){}}}},{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]))}}])}(lv),Uk=function(r){function t(){return(0,N.Z)(this,t),(0,_.Z)(this,t,arguments)}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"render",value:function(n,i,a,s,o,l){a.getBounds();var c=i.lineWidth,u=c===void 0?1:c,h=i.textAlign,d=h===void 0?"start":h,f=i.textBaseline,v=f===void 0?"alphabetic":f,g=i.lineJoin,p=g===void 0?"miter":g,y=i.miterLimit,b=y===void 0?10:y,E=i.letterSpacing,O=E===void 0?0:E,P=i.stroke,R=i.fill,F=i.fillRule,I=i.fillOpacity,V=I===void 0?1:I,Y=i.strokeOpacity,J=Y===void 0?1:Y,$=i.opacity,ot=$===void 0?1:$,ct=i.metrics,ft=i.x,Nt=ft===void 0?0:ft,Ot=i.y,mt=Ot===void 0?0:Ot,yt=i.dx,Rt=i.dy,jt=i.shadowColor,Xt=i.shadowBlur,ee=ct.font,ae=ct.lines,he=ct.height,ce=ct.lineHeight,xe=ct.lineMetrics;n.font=ee,n.lineWidth=u,n.textAlign=d==="middle"?"center":d;var Ce=v;Ce==="alphabetic"&&(Ce="bottom"),n.lineJoin=p,me(b)||(n.miterLimit=b);var je=mt;v==="middle"?je+=-he/2-ce/2:v==="bottom"||v==="alphabetic"||v==="ideographic"?je+=-he:(v==="top"||v==="hanging")&&(je+=-ce);var Ue=Nt+(yt||0);je+=Rt||0,ae.length===1&&(Ce==="bottom"?(Ce="middle",je-=.5*he):Ce==="top"&&(Ce="middle",je+=.5*he)),n.textBaseline=Ce;var or=!me(jt)&&Xt>0;Ou(a,n,or);for(var Ke=0;Ke0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),e=(0,_.Z)(this,t),e.name="canvas-renderer",e.options=n,e}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"init",value:function(){var n,i=(0,B.Z)({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new lv(a),o=(n={},(0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)((0,se.Z)(n,Dt.CIRCLE,s),Dt.ELLIPSE,s),Dt.RECT,s),Dt.IMAGE,new Vk(a)),Dt.TEXT,new Uk(a)),Dt.LINE,s),Dt.POLYLINE,s),Dt.POLYGON,s),Dt.PATH,s),Dt.GROUP,void 0),(0,se.Z)((0,se.Z)((0,se.Z)(n,Dt.HTML,void 0),Dt.MESH,void 0),Dt.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new t1(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(_a);var i1=function(){function r(){(0,N.Z)(this,r)}return(0,T.Z)(r,[{key:"apply",value:function(e,n){var i=this,a=e.renderingService,s=e.renderingContext,o=e.config;this.context=e;var l=s.root.ownerDocument.defaultView,c=function(I){a.hooks.pointerMove.call(I)},u=function(I){a.hooks.pointerUp.call(I)},h=function(I){a.hooks.pointerDown.call(I)},d=function(I){a.hooks.pointerOver.call(I)},f=function(I){a.hooks.pointerOut.call(I)},v=function(I){a.hooks.pointerCancel.call(I)},g=function(I){a.hooks.pointerWheel.call(I)},p=function(I){a.hooks.click.call(I)},y=function(I){n.globalThis.document.addEventListener("pointermove",c,!0),I.addEventListener("pointerdown",h,!0),I.addEventListener("pointerleave",f,!0),I.addEventListener("pointerover",d,!0),n.globalThis.addEventListener("pointerup",u,!0),n.globalThis.addEventListener("pointercancel",v,!0)},b=function(I){I.addEventListener("touchstart",h,!0),I.addEventListener("touchend",u,!0),I.addEventListener("touchmove",c,!0),I.addEventListener("touchcancel",v,!0)},E=function(I){n.globalThis.document.addEventListener("mousemove",c,!0),I.addEventListener("mousedown",h,!0),I.addEventListener("mouseout",f,!0),I.addEventListener("mouseover",d,!0),n.globalThis.addEventListener("mouseup",u,!0)},O=function(I){n.globalThis.document.removeEventListener("pointermove",c,!0),I.removeEventListener("pointerdown",h,!0),I.removeEventListener("pointerleave",f,!0),I.removeEventListener("pointerover",d,!0),n.globalThis.removeEventListener("pointerup",u,!0),n.globalThis.removeEventListener("pointercancel",v,!0)},P=function(I){I.removeEventListener("touchstart",h,!0),I.removeEventListener("touchend",u,!0),I.removeEventListener("touchmove",c,!0),I.removeEventListener("touchcancel",v,!0)},R=function(I){n.globalThis.document.removeEventListener("mousemove",c,!0),I.removeEventListener("mousedown",h,!0),I.removeEventListener("mouseout",f,!0),I.removeEventListener("mouseover",d,!0),n.globalThis.removeEventListener("mouseup",u,!0)};a.hooks.init.tap(r.tag,function(){var F=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(F.style.msContentZooming="none",F.style.msTouchAction="none"):l.supportsPointerEvents&&(F.style.touchAction="none"),l.supportsPointerEvents?y(F):E(F),l.supportsTouchEvents&&b(F),o.useNativeClickEvent&&F.addEventListener("click",p,!0),F.addEventListener("wheel",g,{passive:!0,capture:!0})}),a.hooks.destroy.tap(r.tag,function(){var F=i.context.contextService.getDomElement();n.globalThis.navigator.msPointerEnabled?(F.style.msContentZooming="",F.style.msTouchAction=""):l.supportsPointerEvents&&(F.style.touchAction=""),l.supportsPointerEvents?O(F):R(F),l.supportsTouchEvents&&P(F),o.useNativeClickEvent&&F.removeEventListener("click",p,!0),F.removeEventListener("wheel",g,!0)})}}])}();i1.tag="DOMInteraction";var Hk=function(r){function t(){var e;(0,N.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a1&&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 l=s.root.ownerDocument.defaultView,c=l.context.eventService.nativeHTMLMap,u=function(y,b){b.style.transform=i.joinTransformMatrix(y.getWorldTransform(),y.getOrigin())},h=function(y){var b=y.target;if(b.nodeName===Dt.HTML){i.$camera||(i.$camera=i.createCamera(a));var E=i.getOrCreateEl(b);i.$camera.appendChild(E),Object.keys(b.attributes).forEach(function(O){i.updateAttribute(O,b)}),u(b,E),c.set(E,b)}},d=function(y){var b=y.target;if(b.nodeName===Dt.HTML&&i.$camera){var E=i.getOrCreateEl(b);E&&(E.remove(),c.delete(E))}},f=function(y){var b=y.target;if(b.nodeName===Dt.HTML){var E=y.attrName;i.updateAttribute(E,b)}},v=function(y){var b=y.target,E=b.nodeName===Dt.FRAGMENT?b.childNodes:[b];E.forEach(function(O){if(O.nodeName===Dt.HTML){var P=i.getOrCreateEl(O);u(O,P)}})},g=function(){if(i.$camera){var y=i.context.config,b=y.width,E=y.height;i.$camera.parentElement.style.width="".concat(b||0,"px"),i.$camera.parentElement.style.height="".concat(E||0,"px")}};o.hooks.init.tap(r.tag,function(){l.addEventListener(ri.RESIZE,g),l.addEventListener(De.MOUNTED,h),l.addEventListener(De.UNMOUNTED,d),l.addEventListener(De.ATTR_MODIFIED,f),l.addEventListener(De.BOUNDS_CHANGED,v)}),o.hooks.endFrame.tap(r.tag,function(){i.$camera&&s.renderReasons.has(lo.CAMERA_CHANGED)&&(i.$camera.style.transform=i.joinTransformMatrix(a.getOrthoMatrix()))}),o.hooks.destroy.tap(r.tag,function(){i.$camera&&i.$camera.remove(),l.removeEventListener(ri.RESIZE,g),l.removeEventListener(De.MOUNTED,h),l.removeEventListener(De.UNMOUNTED,d),l.removeEventListener(De.ATTR_MODIFIED,f),l.removeEventListener(De.BOUNDS_CHANGED,v)})}},{key:"createCamera",value:function(e){var n=this.context.config,i=n.document,a=n.width,s=n.height,o=this.context.contextService.getDomElement(),l=o.parentNode;if(l){var c=Xk,u=l.querySelector("#".concat(c));if(!u){var h=(i||document).createElement("div");h.style.overflow="hidden",h.style.pointerEvents="none",h.style.position="absolute",h.style.left="0px",h.style.top="0px",h.style.width="".concat(a||0,"px"),h.style.height="".concat(s||0,"px");var d=(i||document).createElement("div");u=d,d.id=c,d.style.position="absolute",d.style.left="".concat(o.offsetLeft||0,"px"),d.style.top="".concat(o.offsetTop||0,"px"),d.style.transformOrigin="left top",d.style.transform=this.joinTransformMatrix(e.getOrthoMatrix()),d.style.pointerEvents="none",d.style.width="100%",d.style.height="100%",h.appendChild(d),l.appendChild(h)}return u}return null}},{key:"getOrCreateEl",value:function(e){var n=this.context.config.document,i=this.displayObjectHTMLElementMap.get(e);return i||(i=(n||document).createElement("div"),e.parsedStyle.$el=i,this.displayObjectHTMLElementMap.set(e,i),e.id&&(i.id=e.id),e.name&&i.setAttribute("name",e.name),e.className&&(i.className=e.className),i.style.position="absolute",i.style["will-change"]="transform",i.style.transform=this.joinTransformMatrix(e.getWorldTransform(),e.getOrigin())),i}},{key:"updateAttribute",value:function(e,n){var i=this.getOrCreateEl(n);switch(e){case"innerHTML":var a=n.parsedStyle.innerHTML;Ge(a)?i.innerHTML=a:(i.innerHTML="",i.appendChild(a));break;case"x":i.style.left="".concat(n.parsedStyle.x,"px");break;case"y":i.style.top="".concat(n.parsedStyle.y,"px");break;case"transformOrigin":var s=n.parsedStyle.transformOrigin;i.style["transform-origin"]="".concat(s[0].buildCSSText(null,null,"")," ").concat(s[1].buildCSSText(null,null,""));break;case"width":var o=n.parsedStyle.width;i.style.width=ie(o)?"".concat(o,"px"):o.toString();break;case"height":var l=n.parsedStyle.height;i.style.height=ie(l)?"".concat(l,"px"):l.toString();break;case"zIndex":var c=n.parsedStyle.zIndex;i.style["z-index"]="".concat(c);break;case"visibility":var u=n.parsedStyle.visibility;i.style.visibility=u;break;case"pointerEvents":var h=n.parsedStyle.pointerEvents,d=h===void 0?"auto":h;i.style.pointerEvents=d;break;case"opacity":var f=n.parsedStyle.opacity;i.style.opacity="".concat(f);break;case"fill":var v=n.parsedStyle.fill,g="";pc(v)?v.isNone?g="transparent":g=n.getAttribute("fill"):Array.isArray(v)?g=n.getAttribute("fill"):ys(v),i.style.background=g;break;case"stroke":var p=n.parsedStyle.stroke,y="";pc(p)?p.isNone?y="transparent":y=n.getAttribute("stroke"):Array.isArray(p)?y=n.getAttribute("stroke"):ys(p),i.style["border-color"]=y,i.style["border-style"]="solid";break;case"lineWidth":var b=n.parsedStyle.lineWidth;i.style["border-width"]="".concat(b||0,"px");break;case"lineDash":i.style["border-style"]="dashed";break;case"filter":var E=n.style.filter;i.style.filter=E;break;default:!me(n.style[e])&&n.style[e]!==""&&(i.style[e]=n.style[e])}}}])}();a1.tag="HTMLRendering";var Kk=function(r){function t(){var e;(0,N.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,l.abrupt("return",this.context.canvas.toDataURL(a,s));case 1:case"end":return l.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),qk=function(r){function t(){var e;(0,N.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);bl(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[Bt.CLICK,Bt.POINTER_DOWN,Bt.POINTER_MOVE,Bt.POINTER_UP,Bt.POINTER_OVER,Bt.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=Bs(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=t3(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,l=this.upsert("key-container",pr,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",co,n,l)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Sl))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 pn,{x:o=0,y:l=0,size:c}=t,[u,h]=oi(c);return s.setMinMax([o-u/2,l-h/2,0],[o+u/2,l+h/2,0]),s}const a=dl(i.map(s=>s.getBounds()));return n?za(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",Hy,n,e),ev(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=_n(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=l1(e,["type"]),a=this.getShape("key"),[s,o]=ya(a.getLocalBounds(),"center"),l=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const c=this.getCollapsedMarkerText(n,t);Object.assign(l,{text:c})}return l}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(At(a))==="node").length.toString():fe(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(l=>!s.isCombo(At(l)));if(o.length>0&&o.some(MN)){const l=o.reduce((c,u)=>Ne(c,ir(u)),[0,0,0]);return Ii(l,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}}),nv(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:l}=i,c=l1(i,["x","y","z","transform"]);return c}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}yo.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class r3 extends yo{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ji,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&&_n(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=oi(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=Ba(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 du(t,n,e)}}class i3 extends yo{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",pr,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&&_n(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}var a3=function(r,t){if(!cl(r))return r;for(var e=[],n=0;n-1:!1},l3=o3,c3=function(r,t){return t===void 0&&(t=[]),s3(r,function(e){return!l3(t,e)})},u3=c3;const h3={padding:10};function c1(r,t,e,n,i,a){const{padding:s}=Object.assign(h3,a),o=Fa(e,s),l=Fa(n,s),c=[r,...i,t];let u=null;const h=[];for(let d=0,f=c.length;da?"N":"S":n===a?e>i?"W":"E":null}function uv(r,t){return t==="N"||t==="S"?ea(r):ta(r)}function h1(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=Br(r,n),s=Br(r,i),o=e?d3[e]:null,l=a===e||a!==o&&s!==e?n:i;return{points:[l],direction:Br(l,t)}}function Pu(r,t,e){if(Kc(r,e)){const n=Ml(r,t,e);return{points:[n],direction:Br(n,t)}}else{const n=Ns(r,e),a=["left","right"].includes(fl(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:Br(a,t)}}}function d1(r,t,e,n){const i=Kc(t,e)?t:Ns(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(l=>PO(l,e)&&!_m(l,e,!0)),o=s.filter(l=>Br(l,r)!==n);if(o.length>0){const l=o.find(c=>Br(r,c)===n)||o[0];return{points:[l],direction:Br(l,t)}}else{const l=u3(a,s)[0],c=Wa(t,l,uv(e,n)/2);return{points:[Ml(c,r,e),c],direction:Br(c,t)}}}function f3(r,t,e,n){let i=Pu(r,t,e);const a=pl(i.points[0]);if(Li(a,n)){i=Pu(t,r,n);const s=pl(i.points[0]);if(Li(s,e)){const o=Wa(r,a,uv(e,Br(r,a))/2),l=Wa(t,s,uv(n,Br(t,s))/2),c=[(o[0]+l[0])/2,(o[1]+l[1])/2],u=Pu(r,c,e),h=d1(c,t,n,u.direction);i.points=[u.points[0],h.points[0]],i.direction=h.direction}}return i}function hv(r,t,e,n,i){const s=dl([e,n]),o=bn(t,s.center)>bn(r,s.center),[l,c]=o?[t,r]:[r,t],u=ea(s)+ta(s);let h;if(i){const v=[l[0]+u*Math.cos(u1[i]),l[1]+u*Math.sin(u1[i])];h=Wa(Ns(v,s),v,.01)}else h=Wa(Ns(l,s),l,-.01);let d=Ml(h,c,s),f=[ml(h,2),ml(d,2)];if(Wn(ml(h),ml(d))){const v=Uf(ln(h,l),[1,0,0])+Math.PI/2;d=[c[0]+u*Math.cos(v),c[1]+u*Math.sin(v),0],d=ml(Wa(Ns(d,s),c,-.01),2);const g=Ml(h,d,s);f=[h,g,d]}return{points:o?f.reverse():f,direction:Br(o?h:d,t)}}function Ml(r,t,e){let n=[r[0],t[1]];return Li(n,e)&&(n=[t[0],r[1]]),n}function f1(r,t,e,n,i){let l=typeof t=="number"?t:.5;t==="start"&&(l=0),t==="end"&&(l=.99);const c=yr(r.getPoint(l)),u=yr(r.getPoint(l+.01));let h=t==="start"?"left":t==="end"?"right":"center";if(Cy(c,u)||!e){const[y,b]=v1(r,l,n,i);return{transform:[["translate",y,b]],textAlign:h}}let d=Math.atan2(u[1]-c[1],u[0]-c[0]);u[0]{const u=s[c-1]||i,h=s[c+1]||a;if(!Ny(u,l,h)&&t){const[d,f]=y3(u,l,h,t);o.push(["L",d[0],d[1]],["Q",l[0],l[1],f[0],f[1]],["L",f[0],f[1]])}else o.push(["L",l[0],l[1]])}),o.push(["L",a[0],a[1]]),e&&o.push(["Z"]),o}function y3(r,t,e,n){const i=uu(r,t),a=uu(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])],l=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,l]}const b3=r=>{const t=Math.PI/2,e=ea(r)/2,n=ta(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 p1(r,t,e,n,i){const a=Fa(r),s=r.getCenter();let o=n&&Ua(n),l=i&&Ua(i);if(!o||!l){const c=b3(a),u=c[t][0],h=c[t][1],[d,f]=Ba(a),v=Math.max(d,f),g=Ne(s,[v*Math.cos(u),v*Math.sin(u),0]),p=Ne(s,[v*Math.cos(h),v*Math.sin(h),0]);o=yv(r,g),l=yv(r,p),e||([o,l]=[l,o])}return[o,l]}function x3(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[l,c]=p1(r,t,e,s,o);const u=E3(r,l,c,n);return s&&(l=Tl(s,u[0])),o&&(c=Tl(o,u.at(-1))),g1(l,c,u)}function E3(r,t,e,n){const i=r.getCenter();if(Wn(t,e)){const a=ln(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[Ne(t,s),Ne(e,Di(s,[1,-1,1]))]}return[Wa(i,t,bn(i,t)+n),Wa(i,e,bn(i,e)+n)]}function w3(r,t,e,n,i,a,s){const o=mv(r),l=o[a||s],c=o[s||a];let[u,h]=p1(r,e,n,l,c);const d=S3(r,u,h,i);return l&&(u=Tl(l,d[0])),c&&(h=Tl(c,d.at(-1))),fv([u,...d,h],t)}function S3(r,t,e,n){const i=[],a=Fa(r);if(Wn(t,e))switch(fl(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=fl(t,a),o=fl(e,a);if(s===o){const l=s;let c,u;switch(l){case"left":c=Math.min(t[0],e[0])-n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"right":c=Math.max(t[0],e[0])+n,i.push([c,t[1]]),i.push([c,e[1]]);break;case"top":u=Math.min(t[1],e[1])-n,i.push([t[0],u]),i.push([e[0],u]);break;case"bottom":u=Math.max(t[1],e[1])+n,i.push([t[0],u]),i.push([e[0],u]);break}}else{const l=(d,f)=>({left:[f[0]-n,f[1]],right:[f[0]+n,f[1]],top:[f[0],f[1]-n],bottom:[f[0],f[1]+n]})[d],c=l(s,t),u=l(o,e),h=Ml(c,u,a);i.push(c,h,u)}}return i}function vv(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 m1(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(At(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(Kr);return e[i]||e.at(-1)}return r}function M3(r,t){return t||(r<4?10:r===4?12:r*2.5)}const A3=(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"]]},y1=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],T3=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],O3=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],C3=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],N3=(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"]]},k3=(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 Ru=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{c in i&&(l[c]=i[c])}),l}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=Fa(i),s=Math.max(ta(a),ea(a)),{placement:o,clockwise:l,dist:c=s}=_n(this.getGraphicStyle(t),"loop");return x3(i,o,l,c,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[l,c]=W3(s,o,i,a);if(!e){const f=l?Ua(l):s.getCenter(),v=c?Ua(c):o.getCenter();return[f,v]}const u=typeof n=="function"?n():n,h=T1(l||s,u[0]||c||o),d=T1(c||o,u[u.length-1]||l||s);return[h,d]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=_n(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=_n(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,l=Ru(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),c=f1(this.shapeMap.key,n,s,i,a),u=this.shapeMap.key.getLocalBounds(),h=jN([u.min,u.max],o);return Object.assign({wordWrapWidth:h},c,l)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=_n(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=Ru(e,["offsetX","offsetY","placement"]);return Object.assign(s,v3(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 l=this.getArrowStyle(t,i),[c,u,h]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],d=o.parsedStyle[c];if(d)d.attr(l);else{const f=l.src?sl:ni,v=new f({style:l});o.style[c]=v}o.style[u]=t[h]||l.width/2+ +l.lineWidth}else{const l=i?"markerStart":"markerEnd";(n=o.style[l])===null||n===void 0||n.destroy(),o.style[l]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=_n(this.getGraphicStyle(t),i),{size:s,type:o}=a,l=Ru(a,["size","type"]),[c,u]=oi(M3(n.lineWidth,s)),d=(fe(o)?o:Z[o]||y1)(c,u);return Object.assign(Bs(n,["stroke","strokeOpacity","fillOpacity"]),{width:c,height:u},Object.assign({},d&&{d,fill:o==="simple"?"":n.stroke}),l)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",ia,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",ni,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",po,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",ni,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))})}}Va.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 Fs extends Va{constructor(t){super(ur({style:Fs.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,p3(a),g3(s),i);return g1(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[dv(t,e,n[0],i[0]),dv(t,e,n[1],i[1])]}}Fs.defaultStyleProps={curvePosition:.5,curveOffset:20};class Lu extends Fs{constructor(t){super(ur({style:Lu.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]]]}}Lu.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class _u extends Fs{constructor(t){super(ur({style:_u.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=ir(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=ir(this.ref),n=bn(t,e),i=Sy(ln(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),l=o-a;return[[t[0]+(l*n[0]+i[0])*Math.cos(s),t[1]+(l*n[0]+i[0])*Math.sin(s)],[e[0]-(l*n[1]-i[0])*Math.cos(s),e[1]-(l*n[1]-i[0])*Math.sin(s)]]}}_u.defaultStyleProps={curvePosition:.5,curveOffset:20};class Du extends Fs{constructor(t){super(ur({style:Du.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]]]}}Du.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class Iu extends Va{constructor(t){super(ur({style:Iu.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}}Iu.defaultStyleProps={};const P3={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:uu},xa=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function zs(r,t){const e=n=>Math.round(n/t);return ie(r)?e(r):r.map(e)}function R3(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function b1(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function x1(r,t,e,n){const i=b1(r,t),a=e[xa(r)],o=b1(a||n,r);return R3(o,i)}const L3=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=za(a.getRenderBounds(),e);for(let o=zs(s.min[0],n);o<=zs(s.max[0],n);o+=1)for(let l=zs(s.min[1],n);l<=zs(s.max[1],n);l+=1)i[`${o}|||${l}`]=!0}),i};function E1(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function _3(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=za(t.getRenderBounds(),a),o=Object.keys(i).reduce((l,c)=>{if(e.includes(c)){const u=i[c],[h,d]=Ba(s),f=[r[0]+u.stepX*h,r[1]+u.stepY*d],v=_O(s);for(let g=0;gzs(l,n.gridSize))},D3=(r,t,e,n,i,a,s)=>{const o=[];let l=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(l);let c=r,u=t[xa(c)];for(;u;){const f=u,v=c;x1(f,v,t,e)&&(l=[f[0]===v[0]?l[0]:f[0]*s,f[1]===v[1]?l[1]:f[1]*s],o.unshift(l)),u=t[xa(f)],c=f}const h=i.map(f=>[f[0]*s,f[1]*s]),d=_3(h,l,uu);return o.unshift(d),o};function I3(r,t,e,n){const i=Rs(r.getCenter()),a=Rs(t.getCenter()),s=Object.assign(P3,n),{gridSize:o}=s,l=s.enableObstacleAvoidance?e:[r,t],c=L3(l,s),u=zs(i,o),h=zs(a,o),d=w1(i,r,s.startDirections,s),f=w1(a,t,s.endDirections,s);d.forEach(I=>delete c[xa(I)]),f.forEach(I=>delete c[xa(I)]);const v={},g={},p={},y={},b={},E=new B3;for(let I=0;Ixa(I));let P=s.maximumLoops,R,F=1/0;for(const[I,V]of Object.entries(v))b[I]<=F&&(F=b[I],R=V);for(;Object.keys(v).length>0&&P>0;){const I=E.minId(!1);if(I)R=v[I];else break;const V=xa(R);if(O.includes(V))return D3(R,p,u,a,d,h,o);delete v[V],E.remove(V),g[V]=!0;for(const Y of Object.values(s.directionMap)){const J=Ne(R,[Y.stepX,Y.stepY]),$=xa(J);if(g[$])continue;const ot=x1(R,J,p,u);if(ot>s.maxAllowedDirectionChange||c[$])continue;v[$]||(v[$]=J);const ct=s.penalties[ot],ft=s.distFunc(R,J)+(isNaN(ct)?o:ct),Nt=y[V]+ft,Ot=y[$];Ot&&Nt>=Ot||(p[$]=R,y[$]=Nt,b[$]=Nt+E1(J,f,s.distFunc),E.add({id:$,value:b[$]}))}P-=1}return[]}class B3{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 Bu extends Va{constructor(t){super(ur({style:Bu.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 l=this.context.element.getNodes();o=I3(n,i,l,e),o.length||(o=c1(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=c1(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 fv(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=Fa(a),o=Math.max(ta(s),ea(s))/4,{placement:l,clockwise:c,dist:u=o}=_n(this.getGraphicStyle(t),"loop");return w3(a,i,l,c,u,e,n)}}Bu.defaultStyleProps={radius:0,controlPoints:[],router:!1};class Fu extends Va{constructor(t){super(ur({style:Fu.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||dv(i,a,e,n);return m3(i,a,s)}}Fu.defaultStyleProps={curvePosition:.5,curveOffset:30};var F3=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;M1(n)&&(t[a=s||i]||(t[a]=ya(r.getShape("key").getBounds(),o)))}),t}function M1(r){const{r:t}=r;return!t||Number(t)===0}function Ua(r){return fo(r)?r:r.getPosition()}function W3(r,t,e,n){const i=A1(r,t,e,n),a=A1(t,r,n,e);return[i,a]}function A1(r,t,e,n){const i=mv(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(c=>Ua(c)),o=G3(t,n),[l]=NN(s,o);return a.find(c=>Ua(c)===l)}function G3(r,t){const e=mv(r);if(t)return[Ua(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>Ua(i)):[r.getCenter()]}function T1(r,t){return gv(r)||Al(r)?yv(r,t):Tl(r,t)}function Tl(r,t){if(!r||!t)return[0,0,0];if(fo(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=fo(t)?t:Al(t)?t.getCenter():t.getPosition();return du(e,r.getBounds())}function yv(r,t){if(!r||!t)return[0,0,0];const e=fo(t)?t:Al(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function O1(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=ya(r,t),[l,c]=i?["bottom","top"]:["top","bottom"],u=a.includes("top")?c:a.includes("bottom")?l:"middle",h=a.includes("left")?"right":a.includes("right")?"left":"center";return{transform:[["translate",s+e,o+n]],textBaseline:u,textAlign:h}}function V3(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 U3(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 Y3(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 H3(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 p7(r,t){return[[r/2,-t/2],[r/2,t/2],[-r/2,t/2],[-r/2,-t/2]]}function X3(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function C1(r){return br(r,["style","visibility"])!=="hidden"}function K3(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:l}=t,c=F3(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,c),n&&r.setAttribute("transform",n),ie(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),l&&r.setAttribute("component",l)}function bv(r,t){"update"in r?r.update(t):r.attr(t)}function Q3(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 q3(r){bl(r,"__to_be_destroyed__",!0)}function Ol(r){return br(r,"__to_be_destroyed__",!1)}var J3=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class zu extends si{constructor(t,e){super(t,Object.assign({},zu.defaultOptions,e)),this.onCollapseExpand=n=>J3(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!z3(i))return;const a=i.id,{model:s,graph:o}=this.context,l=s.getElementDataById(a);if(!l)return!1;const{onCollapse:c,onExpand:u,animation:h,align:d}=this.options;Kr(l)?(yield o.expandElement(a,{animation:h,align:d}),u==null||u(a)):(yield o.collapseElement(a,{animation:h,align:d}),c==null||c(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 fe(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}zu.defaultOptions={enable:!0,animation:!0,trigger:Bt.DBLCLICK,align:!0};var ju={},$3=function(r){return r=r||"g",ju[r]?ju[r]+=1:ju[r]=1,r+ju[r]},Zu=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const tP="g6-create-edge-assist-edge-id",Wu="g6-create-edge-assist-node-id";class Gu extends si{constructor(t,e){super(t,Object.assign({},Gu.defaultOptions,e)),this.drop=n=>Zu(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=>Zu(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:l,batch:c,element:u}=this.context,{style:h}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}c.startBatch(),l.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const d=o.getElementData(this.source);o.addNodeData([{id:Wu,style:{visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=d.style)===null||i===void 0?void 0:i.x,y:(a=d.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:tP,source:this.source,target:Wu,style:Object.assign({pointerEvents:"none"},h)}]),yield(s=u.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>Zu(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(Wu,[n.canvas.x,n.canvas.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:l,onCreate:c}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const h=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],d=`${this.source}-${h}-${$3()}`,f=c({id:d,source:this.source,target:h,style:o});f&&(s.addEdgeData([f]),l(f))},this.cancelEdge=()=>Zu(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([Wu]),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(xi.CLICK,this.handleCreateEdge),t.on(Cs.CLICK,this.handleCreateEdge),t.on(va.CLICK,this.cancelEdge),t.on(Hc.CLICK,this.cancelEdge)):(t.on(xi.DRAG_START,this.handleCreateEdge),t.on(Cs.DRAG_START,this.handleCreateEdge),t.on(Bt.POINTER_UP,this.drop)),t.on(Bt.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 fe(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(xi.CLICK,this.handleCreateEdge),t.off(Cs.CLICK,this.handleCreateEdge),t.off(va.CLICK,this.cancelEdge),t.off(Hc.CLICK,this.cancelEdge),t.off(xi.DRAG_START,this.handleCreateEdge),t.off(Cs.DRAG_START,this.handleCreateEdge),t.off(Bt.POINTER_UP,this.drop),t.off(Bt.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}Gu.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};function eP(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 Cl=eP,N1=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Vu extends si{constructor(t,e){super(t,Object.assign({},Vu.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||Gn.isPinching)return;const l=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,c=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;l|c&&this.translate([l,c],!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=Cl(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new go(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(zn(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(Bt.DRAG_START,this.onDragStart),e.on(Bt.DRAG,this.onDrag),e.on(Bt.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return N1(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Di(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return N1(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 My([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,l,c,u]=ai(this.options.range),h=[s*o,a*l,s*c,a*u],d=za(Pf(n.getCanvasCenter()),h),f=ln(n.getViewportCenter(),[t,e,0]);if(!Li(f,d)){const{min:[v,g],max:[p,y]}=d;(f[0]0||f[0]>p&&t<0)&&(t=0),(f[1]0||f[1]>y&&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(Bt.DRAG_START,this.onDragStart),t.off(Bt.DRAG,this.onDrag),t.off(Bt.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}Vu.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var k1=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Nl extends si{constructor(t,e){super(t,Object.assign({},Nl.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>k1(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(l=>{const c=a.getParentData(l,dn);c&&At(c)===o&&a.refreshComboData(o),a.setParent(l,o,dn)}),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===Bt.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},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}:${Bt.DRAG_START}`,this.onDragStart),t.on(`${i}:${Bt.DRAG}`,this.onDrag),t.on(`${i}:${Bt.DRAG_END}`,this.onDragEnd),t.on(`${i}:${Bt.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${Bt.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(Cs.DROP,this.onDrop),t.on(va.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 Ii([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,[l,c]=ln([+s,+o],this.shadowOrigin);this.moveElement(this.target,[l,c])}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=[]}validate(t){if(this.destroyed||Ol(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}clampByRotation([t,e]){const n=this.context.graph.getRotation();return My([t,e],n)}moveElement(t,e){return k1(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=_n(this.options,"shadow"),n=dl(t.map(c=>this.context.element.getElement(c).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=Ba(n),l={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),l),{visibility:"visible"})):(this.shadow=new pr({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),l),{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(At):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(At)).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}:${Bt.DRAG_START}`,this.onDragStart),t.off(`${i}:${Bt.DRAG}`,this.onDrag),t.off(`${i}:${Bt.DRAG_END}`,this.onDragEnd),t.off(`${i}:${Bt.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${Bt.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${Bt.DROP}`,this.onDrop),t.off(`canvas:${Bt.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}Nl.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),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 nP="*",rP=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 Yu(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)&&Yu(a,t,e,n))return!0;return!1}const P1=()=>!0;class iP{constructor(t){Cn(this,"graph");Cn(this,"nodeFilter");Cn(this,"edgeFilter");Cn(this,"cacheEnabled");Cn(this,"inEdgesMap",new Map);Cn(this,"outEdgesMap",new Map);Cn(this,"bothEdgesMap",new Map);Cn(this,"allNodesMap",new Map);Cn(this,"allEdgesMap",new Map);Cn(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});Cn(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});Cn(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(l=>e.add(l.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)})});Cn(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||P1,n=t.edgeFilter||P1;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];xv([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];Yu(this.getNode(t),new Set,e,i)}}class Un extends Uu{constructor(e){super();Cn(this,"nodeMap",new Map);Cn(this,"edgeMap",new Map);Cn(this,"inEdgesMap",new Map);Cn(this,"outEdgesMap",new Map);Cn(this,"bothEdgesMap",new Map);Cn(this,"treeIndices",new Map);Cn(this,"changes",[]);Cn(this,"batchCount",0);Cn(this,"onChanged",()=>{});Cn(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,l;(o=a.childrenMap.get(e))==null||o.forEach(c=>{a.parentMap.delete(c.id)});const s=a.parentMap.get(e);s&&((l=a.childrenMap.get(s.id))==null||l.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(l=>{this.setParent(l.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 u,h;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&&((u=a.childrenMap.get(o.id))==null||u.delete(s)),a.parentMap.delete(e);return}const l=this.getNode(n);a.parentMap.set(e,l),o&&((h=a.childrenMap.get(o.id))==null||h.delete(s));let c=a.childrenMap.get(l.id);c||(c=new Set,a.childrenMap.set(l.id,c)),c.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:l.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Yu(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return xv([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 xv([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 Yu(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>H0(Bo({},a),{data:Bo({},a.data)})),n=this.getAllEdges().map(a=>H0(Bo({},a),{data:Bo({},a.data)})),i=new Un({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const l=new Map;a.forEach((u,h)=>{l.set(h,i.getNode(u.id))});const c=new Map;s.forEach((u,h)=>{c.set(h,new Set(Array.from(u).map(d=>i.getNode(d.id))))}),i.treeIndices.set(o,{parentMap:l,childrenMap:c})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new iP(Bo({graph:this},e))}}class Hu{constructor(t,e){this.context=t,this.options=e||{}}}var aP=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},sP=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:l=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:l}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:l=[],controlPoints:c=l.slice(1,l.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},c!=null&&c.length?{controlPoints:c.map(yr)}:{})})}),n}function cP(r,t){class e extends Hu{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 l=s.tick(o);return Xu(l)}}}execute(i,a){return aP(this,void 0,void 0,function*(){return Xu(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(mr({},this.options,a))))})}transformOptions(i){if(!("onTick"in i))return i;const a=i.onTick;return i.onTick=s=>a(Xu(s)),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,l=a.map(f=>{const v=At(f),{data:g,style:p,combo:y}=f,b=sP(f,["data","style","combo"]),E={id:v,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:g}),y?{parentId:y}:{}),{style:p}),b)};return p!=null&&p.x&&Object.assign(E.data,{x:p.x}),p!=null&&p.y&&Object.assign(E.data,{y:p.y}),p!=null&&p.z&&Object.assign(E.data,{z:p.z}),E}),c=new Map(l.map(f=>[f.id,f])),u=s.filter(f=>{const{source:v,target:g}=f;return c.has(v)&&c.has(g)}).map(f=>{const{source:v,target:g,data:p,style:y}=f;return{id:At(f),source:v,target:g,data:Object.assign({},p),style:Object.assign({},y)}}),h=o.map(f=>({id:At(f),data:Object.assign({_isCombo:!0},f.data),style:Object.assign({},f.style)})),d=new Un({nodes:[...l,...h],edges:u});return t.model.model.hasTreeStructure(dn)&&(d.attachTreeStructure(dn),l.forEach(f=>{const v=t.model.model.getParent(f.id,dn);v&&d.hasNode(v.id)&&d.setParent(f.id,v.id,dn)})),d}}return e}function Ev(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 R1(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 uP=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class hP extends Nl{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):(Xr.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return uP(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&&Ev(n,"setFixedPosition",t[a],[...Ne([+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&&R1(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&Ev(e,"setFixedPosition",At(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&&R1(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&Ev(t,"setFixedPosition",At(e),[null,null,null])})}}var L1=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Ku extends si{constructor(t,e){super(t,Object.assign({},Ku.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>L1(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:l}=this.options,c=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),u=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),h=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(l),d=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,f=[...c,...h];f.length>0&&f.forEach(v=>this.fixNodeLike(v,d)),this.updateRelatedEdges(),u.length>0&&u.forEach(v=>this.fixEdge(v,d))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],l=((s=o.find(c=>c.shape===i))===null||s===void 0?void 0:s.style)||{};return a in l||(l[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(c=>c.shape!==i),{shape:i,style:l}])),l[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=ek(n);(Array.isArray(a)?a:[a]).forEach(l=>{const{shape:c,fields:u}=l,h=typeof c=="function"?c(s):n.getShape(c);if(h){if(!u){this.scaleEntireElement(n.id,h,i);return}u.forEach(d=>{const f=this.getOriginalFieldValue(n.id,h,d);ie(f)&&(h.style[d]=f/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=At(n),{element:s,model:o}=this.context,l=s.getElement(a);if(!l||this.skipIfExceedViewport(l))return;o.getRelatedEdgesData(a).forEach(h=>this.relatedEdgeToUpdate.add(At(h)));const u=this.options[l.type];if(!u){this.scaleEntireElement(a,l,i);return}this.scaleSpecificShapes(l,i,u)},this.fixEdge=(n,i)=>{const a=At(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=>L1(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(ra(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,l])=>a.style[o]=l)}})});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(At(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(Kt.AFTER_DRAW,this.resetTransform),t.on(Kt.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(Kt.AFTER_DRAW,this.resetTransform),t.off(Kt.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Ku.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 dP=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Qu extends si{constructor(t,e){super(t,Object.assign({},Qu.defaultOptions,e)),this.focus=n=>dP(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.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Ls.forEach(e=>{t.on(`${e}:${Bt.CLICK}`,this.focus)})}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Ls.forEach(e=>{t.off(`${e}:${Bt.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),super.destroy()}}Qu.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0};class qu extends si{constructor(t,e){super(t,Object.assign({},qu.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===Bt.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:l}=this.options,c=this.getActiveIds(n),u={};if(s&&Object.assign(u,this.getElementsState(c,s,i)),l){const h=yy(a.getData(),!0).filter(d=>!c.includes(d));Object.assign(u,this.getElementsState(h,l,i))}a.setElementState(u,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(l=>{const c=s.getElementState(l);a?o[l]=c.includes(i)?c:[...c,i]:o[l]=c.filter(u=>u!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),Ls.forEach(n=>{t.on(`${n}:${Bt.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${Bt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${Bt.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${Bt.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?Dy(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Ol(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;Ls.forEach(n=>{t.off(`${n}:${Bt.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${Bt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${Bt.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${Bt.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}qu.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class fP extends yl{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e,graph:n}=this.context;this.pathShape=new ni({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[fu(t,n)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(fu(t,this.context.graph)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",QN(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 Ju extends si{constructor(t,e){super(t,Object.assign({},Ju.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):Ps(s,i,a)})},this.filterShapes=(n,i)=>{if(fe(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=Cl(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(Kt.BEFORE_TRANSFORM,this.hideShapes),t.on(Kt.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(Kt.BEFORE_TRANSFORM,this.hideShapes),t.off(Kt.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return fe(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Ju.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var _1=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class $u extends si{constructor(t,e){super(t,Object.assign({},$u.defaultOptions,e)),this.onWheel=n=>_1(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 go(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),zn(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(Bt.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,l=>this.scroll([0,-10],l)),this.shortcut.bind(a,l=>this.scroll([0,10],l)),this.shortcut.bind(s,l=>this.scroll([-10,0],l)),this.shortcut.bind(o,l=>this.scroll([10,0],l))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(Bt.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Di(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,l,c,u]=ai(this.options.range),h=[s*o,a*l,s*c,a*u],d=za(Pf(n.getCanvasCenter()),h),f=ln(n.getViewportCenter(),[t,e,0]);if(!Li(f,d)){const{min:[v,g],max:[p,y]}=d;(f[0]0||f[0]>p&&t<0)&&(t=0),(f[1]0||f[1]>y&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return _1(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 fe(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(Bt.WHEEL,this.onWheel),super.destroy()}}$u.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var D1=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class th extends si{constructor(t,e){super(t,Object.assign({},th.defaultOptions,e)),this.zoom=(n,i,a)=>D1(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=yr(i.viewport));const{sensitivity:l,onFinish:c}=this.options,u=1+kn(n,-50,50)*l/100,h=s.getZoom();yield s.zoomTo(h*u,a,o),c==null||c()}),this.onReset=()=>D1(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 go(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(Bt.PINCH))this.shortcut.bind([Bt.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(Bt.WHEEL,this.preventDefault),this.shortcut.bind([...t,Bt.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 fe(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(Bt.WHEEL,this.preventDefault),super.destroy()}}th.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};var eh=S(13722);const vP=(r,t)=>{if(r!=="next"&&r!=="prev")return t},I1=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};class gP{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 I1(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&I1(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,vP)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}}class pP extends gP{}const mP=()=>1,yP=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=xP(r,t||mP);return(e=bP(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()},bP=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)wv(r,t,e,s);for(;s=i.dequeue();)wv(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(wv(r,t,e,s,!0));break}}}return n},wv=(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(l=>{const c=l.data.weight,u=r.getNode(l.source);i&&o.push({v:l.source,w:l.target,in:0,out:0}),u.data.out===void 0&&(u.data.out=0),u.data.out-=c,Sv(t,e,Object.assign({v:u.id},u.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(l=>{const c=l.data.weight,u=l.target,h=r.getNode(u);h.data.in===void 0&&(h.data.in=0),h.data.in-=c,Sv(t,e,Object.assign({v:h.id},h.data))}),r.removeNode(n.v)),i?o:void 0},xP=(r,t)=>{const e=new Un;let n=0,i=0;r.getAllNodes().forEach(l=>{e.addNode({id:l.id,data:{v:l.id,in:0,out:0}})}),r.getAllEdges().forEach(l=>{const c=e.getRelatedEdges(l.source,"out").find(h=>h.target===l.target),u=(t==null?void 0:t(l))||1;c?e.updateEdgeData(c==null?void 0:c.id,Object.assign(Object.assign({},c.data),{weight:c.data.weight+u})):e.addEdge({id:l.id,source:l.source,target:l.target,data:{weight:u}}),i=Math.max(i,e.getNode(l.source).data.out+=u),n=Math.max(n,e.getNode(l.target).data.in+=u)});const a=[],s=i+n+3;for(let l=0;l{Sv(a,o,Object.assign({v:l.id},e.getNode(l.id).data))}),{buckets:a,zeroIdx:o,graph:e}},Sv=(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)},EP=(r,t)=>{const n=t==="greedy"?yP(r,(i=>a=>a.data.weight||1)(r)):wP(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)})})},wP=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},SP=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})})}})},MP=(r,t)=>Number(r)-Number(t),bo=(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},AP=r=>{const t=new Un;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},B1=r=>{const t=new Un;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},F1=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),b7=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},x7=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 F1(t.map(n=>n.id),e)},z1=(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 l,c;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),l=o*i/a,c=o):(i<0&&(s=-s),l=s,c=s*a/i),{x:e+l,y:n+c}},kl=r=>{const t=[],e=Z1(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;nMP(r.getNode(i).data.order,r.getNode(a).data.order));return t},TP=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)})},OP=(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 l=(o.data.rank||0)-i;a[l]||(a[l]=[]),a[l].push(o.id)});let s=0;for(let o=0;o{const u=r.getNode(c);u&&(u.data.rank=u.data.rank||0,u.data.rank+=s)}))}},j1=(r,t,e,n)=>{const i={width:0,height:0};return ie(e)&&ie(n)&&(i.rank=e,i.order=n),bo(r,"border",i,t)},Z1=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},CP=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},Mv=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),W1=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>W1(r,s,e,n,i,a)),e&&a.push(t.id))},G1=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=l=>n?r.getSuccessors(l):r.getNeighbors(l),s=[],o=[];return i.forEach(l=>{if(r.hasNode(l.id))W1(r,l,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${l}`)}),s},NP=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))},V1=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],l=bo(r,"border",s,e);i.data[t][a]=l,r.setParent(l,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:l,data:{weight:1}})},kP=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&U1(r)},PP=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&RP(r),(e==="lr"||e==="rl")&&(LP(r),U1(r))},U1=r=>{r.getAllNodes().forEach(t=>{Y1(t)}),r.getAllEdges().forEach(t=>{Y1(t)})},Y1=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},RP=r=>{r.getAllNodes().forEach(t=>{Av(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Av(n)),t.data.hasOwnProperty("y")&&Av(t.data)})},Av=r=>{r!=null&&r.y&&(r.y=-r.y)},LP=r=>{r.getAllNodes().forEach(t=>{Tv(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Tv(n)),t.data.hasOwnProperty("x")&&Tv(t.data)})},Tv=r=>{const t=r.x;r.x=r.y,r.y=t},_P=r=>{const t=bo(r,"root",{},"_root"),e=DP(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=IP(r)+1;return r.getRoots().forEach(o=>{H1(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},H1=(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 l=j1(r,"_bt"),c=j1(r,"_bb"),u=r.getNode(s);r.setParent(l,s),u.data.borderTop=l,r.setParent(c,s),u.data.borderBottom=c,o==null||o.forEach(h=>{H1(r,t,e,n,i,a,h.id);const d=h.data.borderTop?h.data.borderTop:h.id,f=h.data.borderBottom?h.data.borderBottom:h.id,v=h.data.borderTop?n:2*n,g=d!==f?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:l,target:d,data:{minlen:g,weight:v,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:f,target:c,data:{minlen:g,weight:v,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:l,data:{weight:0,minlen:i+a[s]}})},DP=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},IP=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},BP=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},FP="edge",X1="edge-label",zP=(r,t)=>{r.getAllEdges().forEach(e=>jP(r,e,t))},jP=(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 l,c,u;for(u=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===X1&&(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)})},WP=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,l;for(;s;){if(o=r.getParent(s.id),o?(l=n[o.id],n[o.id]=s.id):(l=i,i=s.id),l&&l!==s.id){t.hasNode(l)||t.addNode({id:l,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${l}-${s.id}`)||t.addEdge({id:`e${l}-${s.id}`,source:l,target:s.id,data:{}});return}s=o}})},GP=(r,t,e)=>{const n=VP(r),i=new Un({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 l=o.source===a.id?o.target:o.source;i.hasNode(l)||i.addNode(Object.assign({},r.getNode(l)));const c=i.getRelatedEdges(l,"out").find(({target:h})=>h===a.id),u=c!==void 0?c.data.weight:0;c?i.updateEdgeData(c.id,Object.assign(Object.assign({},c.data),{weight:o.data.weight+u})):i.addEdge({id:o.id,source:l,target:a.id,data:{weight:o.data.weight+u}})}),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},VP=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},UP=(r,t,e)=>{const n=F1(e,e.map((u,h)=>h)),a=t.map(u=>{const h=r.getRelatedEdges(u,"out").map(d=>({pos:n[d.target]||0,weight:d.data.weight}));return h==null?void 0:h.sort((d,f)=>d.pos-f.pos)}).flat().filter(u=>u!==void 0);let s=1;for(;s{if(u){let h=u.pos+s;l[h]+=u.weight;let d=0;for(;h>0;)h%2&&(d+=l[h+1]),h=h-1>>1,l[h]+=u.weight;c+=u.weight*d}}),c},K1=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=UP(r,t[n-1],t[n]);return e},Q1=r=>{const t={},e=r.getAllNodes(),n=e.map(c=>{var u;return(u=c.data.rank)!==null&&u!==void 0?u:-1/0}),i=Math.max(...n),a=[];for(let c=0;cr.getNode(c.id).data.rank-r.getNode(u.id).data.rank),l=s.filter(c=>r.getNode(c.id).data.fixorder!==void 0).sort((c,u)=>r.getNode(c.id).data.fixorder-r.getNode(u.id).data.fixorder);return l==null||l.forEach(c=>{isNaN(r.getNode(c.id).data.rank)||a[r.getNode(c.id).data.rank].push(c.id),t[c.id]=!0}),s==null||s.forEach(c=>r.dfsTree(c.id,u=>{if(t.hasOwnProperty(u.id))return!0;t[u.id]=!0,isNaN(u.data.rank)||a[u.data.rank].push(u.id)})),a},YP=(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}}),HP=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,l)=>{a[o.v]={i:l,indegree:0,in:[],out:[],vs:[o.v]};const c=a[o.v];o.barycenter!==void 0&&(c.barycenter=o.barycenter,c.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const l=a[o.source],c=a[o.target];l!==void 0&&c!==void 0&&(c.indegree++,l.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 XP(s)},XP=r=>{var t,e;const n=[],i=l=>c=>{c.merged||(c.barycenter===void 0||l.barycenter===void 0||c.barycenter>=l.barycenter)&&KP(l,c)},a=l=>c=>{c.in.push(l),--c.indegree===0&&r.push(c)};for(;r!=null&&r.length;){const l=r.pop();n.push(l),(t=l.in.reverse())===null||t===void 0||t.forEach(c=>i(l)(c)),(e=l.out)===null||e===void 0||e.forEach(c=>a(l)(c))}const s=n.filter(l=>!l.merged),o=["vs","i","barycenter","weight"];return s.map(l=>{const c={};return o==null||o.forEach(u=>{l[u]!==void 0&&(c[u]=l[u])}),c})},KP=(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 QP=HP;const qP=(r,t,e,n)=>{const i=CP(r,d=>{const f=d.hasOwnProperty("fixorder")&&!isNaN(d.fixorder);return n?!f&&d.hasOwnProperty("barycenter"):f||d.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((d,f)=>-d.i- -f.i),o=[];let l=0,c=0,u=0;a==null||a.sort(JP(!!t,!!e)),u=q1(o,s,u),a==null||a.forEach(d=>{var f;u+=(f=d.vs)===null||f===void 0?void 0:f.length,o.push(d.vs),l+=d.barycenter*d.weight,c+=d.weight,u=q1(o,s,u)});const h={vs:o.flat()};return c&&(h.barycenter=l/c,h.weight=c),h},q1=(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},JP=(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},J1=(r,t,e,n,i,a)=>{var s,o,l,c;let u=r.getChildren(t).map(b=>b.id);const h=r.getNode(t),d=h?h.data.borderLeft:void 0,f=h?h.data.borderRight:void 0,v={};d&&(u=u==null?void 0:u.filter(b=>b!==d&&b!==f));const g=YP(r,u||[]);g==null||g.forEach(b=>{var E;if(!((E=r.getChildren(b.v))===null||E===void 0)&&E.length){const O=J1(r,b.v,e,n,a);v[b.v]=O,O.hasOwnProperty("barycenter")&&tR(b,O)}});const p=QP(g,e);$P(p,v),(s=p.filter(b=>b.vs.length>0))===null||s===void 0||s.forEach(b=>{const E=r.getNode(b.vs[0]);E&&(b.fixorder=E.data.fixorder,b.order=E.data.order)});const y=qP(p,n,i,a);if(d&&(y.vs=[d,y.vs,f].flat(),!((o=r.getPredecessors(d))===null||o===void 0)&&o.length)){const b=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||""),E=r.getNode(((c=r.getPredecessors(f))===null||c===void 0?void 0:c[0].id)||"");y.hasOwnProperty("barycenter")||(y.barycenter=0,y.weight=0),y.barycenter=(y.barycenter*y.weight+b.data.order+E.data.order)/(y.weight+2),y.weight+=2}return y},$P=(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()})},tR=(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)},eR=(r,t)=>{const e=Z1(r),n=[],i=[];for(let u=1;u-1;u--)i.push(u);const a=$1(r,n,"in"),s=$1(r,i,"out");let o=Q1(r);Ov(r,o);let l=Number.POSITIVE_INFINITY,c;for(let u=0,h=0;h<4;++u,++h){tb(u%2?a:s,u%4>=2,!1,t),o=kl(r);const d=K1(r,o);d=2,!0,t),o=kl(r);const d=K1(r,o);dt.map(n=>GP(r,n,e)),tb=(r,t,e,n)=>{const i=new Un;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,l=J1(a,o,i,t,e,n);for(let c=0;c<((s=l.vs)===null||s===void 0?void 0:s.length);c++){const u=a.getNode(l.vs[c]);u&&(u.data.order=c)}WP(a,i,l.vs)})},Ov=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},nR=(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))})},rR=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},iR=(r,t,e,n)=>{var i,a;const s=[],o=[],l=Math.min(t[e].low,t[n].low),c=Math.max(t[e].lim,t[n].lim);let u,h;u=e;do u=(i=r.getParent(u))===null||i===void 0?void 0:i.id,s.push(u);while(u&&(t[u].low>l||c>t[u].lim));for(h=u,u=n;u&&u!==h;)o.push(u),u=(a=r.getParent(u))===null||a===void 0?void 0:a.id;return{lca:h,path:s.concat(o.reverse())}},aR=(r,t)=>{const e=rR(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const l=o.data.originalEdge;if(!l)return;const c=iR(r,e,l.source,l.target),u=c.path,h=c.lca;let d=0,f=u[d],v=!0;for(;s!==l.target;){if(o=r.getNode(s),v){for(;f!==h&&((i=r.getNode(f))===null||i===void 0?void 0:i.data.maxRank){const e={},n=(i,a)=>{let s=0,o=0;const l=i.length,c=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((u,h)=>{var d;const f=sR(r,u),v=f?r.getNode(f.id).data.order:l;(f||u===c)&&((d=a.slice(o,h+1))===null||d===void 0||d.forEach(g=>{var p;(p=r.getPredecessors(g))===null||p===void 0||p.forEach(y=>{var b;const E=r.getNode(y.id),O=E.data.order;(O{const e={};function n(o,l,c,u,h){var d,f;let v;for(let g=l;g{const y=r.getNode(p.id);y.data.dummy&&(y.data.orderh)&&rb(e,p.id,v)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,l){const c=i(o);l.get(c)||(n(...o),l.set(c,!0))}const s=(o,l)=>{let c=-1,u,h=0;const d=new Map;return l==null||l.forEach((f,v)=>{var g;if(((g=r.getNode(f))===null||g===void 0?void 0:g.data.dummy)==="border"){const p=r.getPredecessors(f)||[];p.length&&(u=r.getNode(p[0].id).data.order,a([l,h,v,c,u],d),h=v,c=u)}a([l,h,l.length,u,o.length],d)}),l};return t!=null&&t.length&&t.reduce(s),e},sR=(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)},rb=(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},oR=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},ib=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((l,c)=>{i[l]=l,a[l]=l,s[l]=c})}),t==null||t.forEach(o=>{let l=-1;o==null||o.forEach(c=>{let u=n(c).map(h=>h.id);if(u.length){u=u.sort((d,f)=>s[d]-s[f]);const h=(u.length-1)/2;for(let d=Math.floor(h),f=Math.ceil(h);d<=f;++d){const v=u[d];a[c]===c&&l{var o;const l={},c=lR(r,t,e,i,a,s),u=s?"borderLeft":"borderRight",h=(v,g)=>{let p=c.getAllNodes(),y=p.pop();const b={};for(;y;)b[y.id]?v(y.id):(b[y.id]=!0,p.push(y),p=p.concat(g(y.id))),y=p.pop()},d=v=>{l[v]=(c.getRelatedEdges(v,"in")||[]).reduce((g,p)=>Math.max(g,(l[p.source]||0)+p.data.weight),0)},f=v=>{const g=(c.getRelatedEdges(v,"out")||[]).reduce((y,b)=>Math.min(y,(l[b.target]||0)-b.data.weight),Number.POSITIVE_INFINITY),p=r.getNode(v);g!==Number.POSITIVE_INFINITY&&p.data.borderType!==u&&(l[v]=Math.max(l[v],g))};return h(d,c.getPredecessors.bind(c)),h(f,c.getSuccessors.bind(c)),(o=Object.values(n))===null||o===void 0||o.forEach(v=>{l[v]=l[e[v]]}),l},lR=(r,t,e,n,i,a)=>{const s=new Un,o=cR(n,i,a);return t==null||t.forEach(l=>{let c;l==null||l.forEach(u=>{const h=e[u];if(s.hasNode(h)||s.addNode({id:h,data:{}}),c){const d=e[c],f=s.getRelatedEdges(d,"out").find(v=>v.target===h);f?s.updateEdgeData(f.id,Object.assign(Object.assign({},f.data),{weight:Math.max(o(r,u,c),f.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:d,target:h,data:{weight:Math.max(o(r,u,c),0)}})}c=u})}),s},sb=(r,t)=>Mv(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],l=uR(r,s)/2;i=Math.max(o+l,i),a=Math.min(o-l,a)}),i-a});function ob(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,l=r[o];let c;if(l===t)return;const u=Object.values(l);c=s==="l"?n-Math.min(...u):i-Math.max(...u),c&&(r[o]={},Object.keys(l).forEach(h=>{r[o][h]=l[h]+c}))})})}const lb=(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},E7=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=buildLayerMatrix(r),s=Object.assign(eb(r,a),nb(r,a)),o={};let l;["u","d"].forEach(u=>{l=u==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(g=>Object.values(g).reverse()));const d=(u==="u"?r.getPredecessors:r.getSuccessors).bind(r),f=ib(r,l,s,d),v=ab(r,l,f.root,f.align,n,i,h==="r");h==="r"&&Object.keys(v).forEach(g=>{v[g]=-v[g]}),o[u+h]=v})});const c=sb(r,o);return ob(o,c),lb(o,e)},cR=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let l=0,c=0;if(l+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":c=-s.data.width/2;break;case"r":c=s.data.width/2;break}if(c&&(l+=e?c:-c),c=0,l+=(s.data.dummy?t:r)/2,l+=(o.data.dummy?t:r)/2,l+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":c=o.data.width/2;break;case"r":c=-o.data.width/2;break}return c&&(l+=e?c:-c),c=0,l},uR=(r,t)=>r.getNode(t).data.width||0,hR=(r,t)=>{const{ranksep:e=0}=t||{},n=kl(r);let i=0;n==null||n.forEach(a=>{const s=a.map(l=>r.getNode(l).data.height),o=Math.max(...s,0);a==null||a.forEach(l=>{r.getNode(l).data.y=i+o/2}),i+=o+e})},dR=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=kl(r),s=Object.assign(eb(r,a),nb(r,a)),o={};let l=[];["u","d"].forEach(u=>{l=u==="u"?a:Object.values(a).reverse(),["l","r"].forEach(h=>{h==="r"&&(l=l.map(g=>Object.values(g).reverse()));const d=(u==="u"?r.getPredecessors:r.getSuccessors).bind(r),f=ib(r,l,s,d),v=ab(r,l,f.root,f.align,n,i,h==="r");h==="r"&&Object.keys(v).forEach(g=>v[g]=-v[g]),o[u+h]=v})});const c=sb(r,o);return c&&ob(o,c),lb(o,e)},fR=(r,t)=>{var e;const n=B1(r);hR(n,t);const i=dR(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},cb=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 l=e(o.target),c=o.data.minlen,u=l-c;u&&(s===void 0||ur.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},vR=r=>{const t={};let e;const n=s=>{var o;const l=r.getNode(s);if(!l)return 0;if(t[s])return l.data.rank;t[s]=!0;let c;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(u=>{const h=n(u.target),d=u.data.minlen,f=h-d;f&&(c===void 0||fr.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var l;const c=r.getNode(s),u=isNaN(c.data.layer)?o:c.data.layer;(c.data.rank===void 0||c.data.rank{a(h.target,u+h.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},Ya=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,gR=r=>{const t=new Un({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;pR(t,r){const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!Ya(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},mR=r=>{const t=new Un({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;yR(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||!Ya(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},ub=(r,t)=>Mv(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?Ya(t,e):1/0),hb=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},bR=r=>{const t=AP(r);cb(t);const e=gR(t);fb(e),db(e,t);let n,i;for(;n=wR(e);)i=SR(e,t,n),MR(e,t,n,i)},db=(r,t)=>{let e=G1(r,r.getAllNodes(),"post",!1);e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{xR(r,t,n)})},xR=(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=ER(r,t,e)},ER=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(l=>l.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(l=>l.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(l=>{const c=l.source===e,u=c?l.target:l.source;if(u!==i){const h=c===a,d=l.data.weight;if(o+=h?d:-d,TR(r,e,u)){const f=r.getRelatedEdges(e,"both").find(v=>v.source===u||v.target===u).data.cutvalue;o+=h?-f:f}}}),o},fb=(r,t=r.getAllNodes()[0].id)=>{vb(r,{},1,t)},vb=(r,t,e,n,i)=>{var a;const s=e;let o=e;const l=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(c=>{t[c.id]||(o=vb(r,t,o,c.id,n))}),l.data.low=s,l.data.lim=o++,i?l.data.parent=i:delete l.data.parent,o},wR=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),SR=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(u=>u.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,l=!1;a.data.lim>s.data.lim&&(o=s,l=!0);const c=t.getAllEdges().filter(u=>l===gb(r.getNode(u.source),o)&&l!==gb(r.getNode(u.target),o));return Mv(c,u=>Ya(t,u))},MR=(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:{}}),fb(r),db(r,t),AR(r,t)},AR=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=G1(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(l=>l.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(l=>l.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))})},TR=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),gb=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,OR=(r,t)=>{switch(t){case"network-simplex":NR(r);break;case"tight-tree":pb(r);break;case"longest-path":CR(r);break;default:pb(r)}},CR=cb,pb=r=>{vR(r),mR(r)},NR=r=>{bR(r)},kR=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&RR(r,i);const o=FR(r);e&&(t.ranksep=zR(o,{rankdir:a,ranksep:s}));let l;try{l=PR(o,t)}catch(c){if(c.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: `,c);return}throw c}return LR(r,o),l},PR=(r,t)=>{const{acyclicer:e,ranker:n,rankdir:i="tb",nodeOrder:a,keepNodeOrder:s,align:o,nodesep:l=50,edgesep:c=20,ranksep:u=50}=t;XR(r),EP(r,e);const{nestingRoot:h,nodeRankFactor:d}=_P(r);OR(B1(r),n),jR(r),OP(r,d),BP(r,h),TP(r),ZR(r),WR(r);const f=[];zP(r,f),aR(r,f),NP(r),s&&nR(r,a),eR(r,s),KR(r),kP(r,i),fR(r,{align:o,nodesep:l,edgesep:c,ranksep:u}),QR(r),HR(r),ZP(r,f),UR(r),PP(r,i);const{width:v,height:g}=GR(r);return VR(r),YR(r),SP(r),{width:v,height:g}},RR=(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})},LR=(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)})},_R=["width","height","layer","fixorder"],DR={width:0,height:0},IR=["minlen","weight","width","height","labeloffset"],BR={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Cv=["labelpos"],FR=r=>{const t=new Un({tree:[]});return r.getAllNodes().forEach(e=>{const n=yb(r.getNode(e.id).data),i=Object.assign(Object.assign({},DR),n),a=mb(i,_R);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);me(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=yb(r.getEdge(e.id).data),i={};Cv==null||Cv.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},BR,mb(n,IR),i)})}),t},zR=(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},jR=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};bo(r,"edge-proxy",i,"_ep")}})},ZR=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},WR=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))})},GR=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}=t||{},l=c=>{if(!c.data)return;const u=c.data.x,h=c.data.y,d=c.data.width,f=c.data.height;!isNaN(u)&&!isNaN(d)&&(e===void 0&&(e=u-d/2),e=Math.min(e,u-d/2),n=Math.max(n,u+d/2)),!isNaN(h)&&!isNaN(f)&&(i===void 0&&(i=h-f/2),i=Math.min(i,h-f/2),a=Math.max(a,h+f/2))};return r.getAllNodes().forEach(c=>{l(c)}),r.getAllEdges().forEach(c=>{c!=null&&c.data.hasOwnProperty("x")&&l(c)}),e-=s,i-=o,r.getAllNodes().forEach(c=>{c.data.x-=e,c.data.y-=i}),r.getAllEdges().forEach(c=>{var u;(u=c.data.points)===null||u===void 0||u.forEach(h=>{h.x-=e,h.y-=i}),c.data.hasOwnProperty("x")&&(c.data.x-=e),c.data.hasOwnProperty("y")&&(c.data.y-=i)}),{width:n-e+s,height:a-i+o}},VR=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(z1(e.data,i)),t.data.points.push(z1(n.data,a))})},UR=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}})},YR=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},HR=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),l=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),c=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((c==null?void 0:c.data.x)-(l==null?void 0:l.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=((l==null?void 0:l.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)})},XR=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)}})},KR=r=>{const t=kl(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(l=>{bo(r,"selfedge",{width:l.data.width,height:l.data.height,rank:o.data.rank,order:a+ ++n,e:l},"_se")}),delete o.data.selfEdges})})},QR=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}})},mb=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},yb=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t};function Pl(r){if(!r)return[0,0,0];if(ie(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 js(r,t){let e;return fe(t)?e=t:ie(t)?e=()=>t:e=()=>r,e}function Nv(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:zn(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:fe(t)?t:ie(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:zn(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const kv=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:fe(r)?n=r:n=s=>r:n=s=>{var o,l,c;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(l=s.data)===null||l===void 0?void 0:l.bboxSize;if(!((c=s.data)===null||c===void 0)&&c.size){const u=s.data.size;return Array.isArray(u)?u:zn(u)?[u.width,u.height]:u}return e},s=>{const o=n(s),l=i(s);return Math.max(...Pl(o))+l}},Pv=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=>Pv(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=Pv(r[e])}),t}return r},ci=(r,t)=>{const e=Pv(r);return e.data=e.data||{},t&&(ie(e.data.x)||(e.data.x=Math.random()*t[0]),ie(e.data.y)||(e.data.y=Math.random()*t[1])),e},qR={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class JR{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},qR),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return(0,G.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:l,nodesep:c,ranksepFunc:u,nodesepFunc:h,edgeLabelSpace:d,ranker:f,nodeOrder:v,begin:g,controlPoints:p,radial:y,sortByCombo:b,preset:E}=i,O=new Un({tree:[]}),P=js(l||50,u),R=js(c||50,h);let F=R,I=P;(o==="LR"||o==="RL")&&(F=P,I=R);const V=Nv(10,a,!1),Y=e.getAllNodes(),J=e.getAllEdges();Y.forEach(mt=>{const yt=Pl(V(mt)),Rt=I(mt),jt=F(mt),Xt=yt[0]+2*jt,ee=yt[1]+2*Rt,ae=mt.data.layer;ie(ae)?O.addNode({id:mt.id,data:{width:Xt,height:ee,layer:ae}}):O.addNode({id:mt.id,data:{width:Xt,height:ee}})}),b&&(O.attachTreeStructure("combo"),Y.forEach(mt=>{const{parentId:yt}=mt.data;yt!==void 0&&O.hasNode(yt)&&O.setParent(mt.id,yt,"combo")})),J.forEach(mt=>{O.addEdge({id:mt.id,source:mt.source,target:mt.target,data:{weight:mt.data.weight||1}})});let $;E!=null&&E.length&&($=new Un({nodes:E})),kR(O,{prevGraph:$,edgeLabelSpace:d,keepNodeOrder:!!v,nodeOrder:v||[],acyclicer:"greedy",ranker:f,rankdir:o,nodesep:c,align:s});const ot=[0,0];if(g){let mt=1/0,yt=1/0;O.getAllNodes().forEach(Rt=>{mt>Rt.data.x&&(mt=Rt.data.x),yt>Rt.data.y&&(yt=Rt.data.y)}),O.getAllEdges().forEach(Rt=>{var jt;(jt=Rt.data.points)===null||jt===void 0||jt.forEach(Xt=>{mt>Xt.x&&(mt=Xt.x),yt>Xt.y&&(yt=Xt.y)})}),ot[0]=g[0]-mt,ot[1]=g[1]-yt}const ct=o==="LR"||o==="RL";if(!y){const mt=new Set,Rt=o==="BT"||o==="RL"?(ae,he)=>he-ae:(ae,he)=>ae-he;O.getAllNodes().forEach(ae=>{ae.data.x=ae.data.x+ot[0],ae.data.y=ae.data.y+ot[1],mt.add(ct?ae.data.x:ae.data.y)});const jt=Array.from(mt).sort(Rt),Xt=ct?(ae,he)=>ae.x!==he.x:(ae,he)=>ae.y!==he.y,ee=ct?(ae,he,ce)=>{const xe=Math.max(he.y,ce.y),Ce=Math.min(he.y,ce.y);return ae.filter(je=>je.y<=xe&&je.y>=Ce)}:(ae,he,ce)=>{const xe=Math.max(he.x,ce.x),Ce=Math.min(he.x,ce.x);return ae.filter(je=>je.x<=xe&&je.x>=Ce)};O.getAllEdges().forEach((ae,he)=>{var ce;d&&p&&ae.data.type!=="loop"&&(ae.data.controlPoints=$R((ce=ae.data.points)===null||ce===void 0?void 0:ce.map(({x:xe,y:Ce})=>({x:xe+ot[0],y:Ce+ot[1]})),O.getNode(ae.source),O.getNode(ae.target),jt,ct,Xt,ee))})}let ft=[];ft=O.getAllNodes().map(mt=>ci(mt));const Nt=O.getAllEdges();return t&&(ft.forEach(mt=>{e.mergeNodeData(mt.id,{x:mt.data.x,y:mt.data.y})}),Nt.forEach(mt=>{e.mergeEdgeData(mt.id,{controlPoints:mt.data.controlPoints})})),{nodes:ft,edges:Nt}})}}const $R=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:l,y:c}=t.data,{x:u,y:h}=e.data;if(i&&(l=t.data.y,c=t.data.x,u=e.data.y,h=e.data.x),h!==c&&l!==u){const d=n.indexOf(c),f=n[d+1];if(f){const p=o[0],y=i?{x:(c+f)/2,y:(p==null?void 0:p.y)||u}:{x:(p==null?void 0:p.x)||u,y:(c+f)/2};(!p||a(p,y))&&o.unshift(y)}const v=n.indexOf(h),g=Math.abs(v-d);if(g===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(c+h)/2,y:l}:{x:l,y:(c+h)/2});else if(g>1){const p=n[v-1];if(p){const y=o[o.length-1],b=i?{x:(h+p)/2,y:(y==null?void 0:y.y)||u}:{x:(y==null?void 0:y.x)||l,y:(h+p)/2};(!y||a(y,b))&&o.push(b)}}}}return o},Zs=(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}},tL={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class eL{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},tL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return(0,G.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:l,startAngle:c=0,endAngle:u=2*Math.PI,angleRatio:h,ordering:d,clockwise:f,nodeSpacing:v,nodeSize:g}=i,p=e.getAllNodes(),y=e.getAllEdges(),[b,E,O]=rL(a,s,o),P=p==null?void 0:p.length;if(!P||P===1)return Zs(e,t,O);const R=(u-c)/P;let{radius:F,startRadius:I,endRadius:V}=i;if(v){const ct=js(10,v),ft=Nv(10,g);let Nt=-1/0;p.forEach(mt=>{const yt=ft(mt);Nt{yt===0?Ot+=Nt||10:Ot+=(ct(mt)||0)+(Nt||10)}),F=Ot/(2*Math.PI)}else!F&&!I&&!V?F=Math.min(E,b)/2:!I&&V?I=V:I&&!V&&(V=I);const Y=R*h;let J=[];d==="topology"?J=bb(e,p):d==="topology-directed"?J=bb(e,p,!0):d==="degree"?J=nL(e,p):J=p.map(ct=>ci(ct));const $=Math.ceil(P/l);for(let ct=0;ct{e.mergeNodeData(ct.id,{x:ct.data.x,y:ct.data.y})}),{nodes:J,edges:y}})}}const bb=(r,t,e=!1)=>{const n=[ci(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,l)=>{if(l!==0)if((l===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[l+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(ci(o)),i[o.id]=!0,s++;else{const c=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let u=!1;for(let d=0;d{e.push(ci(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const rL=(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]},Ea=Array.isArray,iL={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Rv{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},iL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return(0,G.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:l,maxLevelDiff:c,sweep:u,clockwise:h,equidistant:d,preventOverlap:f,startAngle:v=3/2*Math.PI,nodeSize:g,nodeSpacing:p}=i,y=e.getAllNodes(),b=e.getAllEdges(),E=!s&&typeof window!="undefined"?window.innerWidth:s,O=!o&&typeof window!="undefined"?window.innerHeight:o,P=a||[E/2,O/2];if(!(y!=null&&y.length)||y.length===1)return Zs(e,t,P);const R=[];let F,I=0;Ea(g)?F=Math.max(g[0],g[1]):fe(g)?(F=-1/0,y.forEach(mt=>{const yt=Math.max(...Pl(g(mt)));yt>F&&(F=yt)})):F=g,Ea(p)?I=Math.max(p[0],p[1]):ie(p)&&(I=p),y.forEach(mt=>{const yt=ci(mt);R.push(yt);let Rt=F;const{data:jt}=yt;Ea(jt.size)?Rt=Math.max(jt.size[0],jt.size[1]):ie(jt.size)?Rt=jt.size:zn(jt.size)&&(Rt=Math.max(jt.size.width,jt.size.height)),F=Math.max(F,Rt),fe(p)&&(I=Math.max(p(mt),I))});const V={};R.forEach((mt,yt)=>{V[mt.id]=yt});let Y=l;(!Ge(Y)||R[0].data[Y]===void 0)&&(Y="degree"),Y==="degree"?R.sort((mt,yt)=>e.getDegree(yt.id,"both")-e.getDegree(mt.id,"both")):R.sort((mt,yt)=>yt.data[Y]-mt.data[Y]);const J=R[0],$=(c||(Y==="degree"?e.getDegree(J.id,"both"):J.data[Y]))/4,ot=[{nodes:[]}];let ct=ot[0];R.forEach(mt=>{if(ct.nodes.length>0){const yt=Math.abs(Y==="degree"?e.getDegree(ct.nodes[0].id,"both")-e.getDegree(mt.id,"both"):ct.nodes[0].data[Y]-mt.data[Y]);$&&yt>=$&&(ct={nodes:[]},ot.push(ct))}ct.nodes.push(mt)});let ft=F+I;if(!f){const mt=ot.length>0&&ot[0].nodes.length>1,Rt=(Math.min(E,O)/2-ft)/(ot.length+(mt?1:0));ft=Math.min(ft,Rt)}let Nt=0;if(ot.forEach(mt=>{const yt=u===void 0?2*Math.PI-2*Math.PI/mt.nodes.length:u;if(mt.dTheta=yt/Math.max(1,mt.nodes.length-1),mt.nodes.length>1&&f){const Rt=Math.cos(mt.dTheta)-Math.cos(0),jt=Math.sin(mt.dTheta)-Math.sin(0),Xt=Math.sqrt(ft*ft/(Rt*Rt+jt*jt));Nt=Math.max(Xt,Nt)}mt.r=Nt,Nt+=ft}),d){let mt=0,yt=0;for(let Rt=0;Rt{jt===0&&(yt=Rt.r||0),Rt.r=yt,yt+=mt})}return ot.forEach(mt=>{const yt=mt.dTheta||0,Rt=mt.r||0;mt.nodes.forEach((jt,Xt)=>{const ee=v+(h?1:-1)*yt*Xt;jt.data.x=P[0]+Rt*Math.cos(ee),jt.data.y=P[1]+Rt*Math.sin(ee)})}),t&&R.forEach(mt=>e.mergeNodeData(mt.id,{x:mt.data.x,y:mt.data.y})),{nodes:R,edges:b}})}}var Lv=S(14301),aL=S(7695);const sL=.81,_v=.1;function oL(r,t,e,n,i=2){const a=t/e,s=r.getAllNodes(),o=s.map((u,h)=>{const{nodeStrength:d,x:f,y:v,z:g,size:p}=u.data;return{x:f,y:v,z:g,size:p,index:h,id:u.id,vx:0,vy:0,vz:0,weight:a*d}}),l=(i===2?(0,Lv.Z)(o,u=>u.x,u=>u.y):(0,aL.Z)(o,u=>u.x,u=>u.y,u=>u.z)).visitAfter(lL),c=new Map;return o.forEach(u=>{c.set(u.id,u),uL(u,l,i)}),o.map((u,h)=>{const{id:d,data:f}=s[h],{mass:v=1}=f;n[d]={x:u.vx/v,y:u.vy/v,z:u.vz/v}}),n}function lL(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 l=[e,n,i][s-1],c=a.x-r.x||_v,u=a.y-r.y||_v,h=a.z-r.z||_v,d=[c,u,h],f=l-t;let v=0;for(let y=0;ycL(n,i,a,s,o,r,e))}const hL={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 xb{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},hL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return(0,G.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,G.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:l,width:c,height:u,nodeSize:h,getMass:d,nodeStrength:f,edgeStrength:v,linkDistance:g}=o,p=a.map((I,V)=>Object.assign(Object.assign({},I),{data:Object.assign(Object.assign({},I.data),{x:ie(I.data.x)?I.data.x:Math.random()*c,y:ie(I.data.y)?I.data.y:Math.random()*u,z:ie(I.data.z)?I.data.z:Math.random()*Math.sqrt(c*u),size:h(I)||30,mass:d(I),nodeStrength:f(I)})})),y=s.map(I=>Object.assign(Object.assign({},I),{data:Object.assign(Object.assign({},I.data),{edgeStrength:v(I),linkDistance:g(I,e.getNode(I.source),e.getNode(I.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const b={};a.forEach((I,V)=>{b[I.id]={x:0,y:0,z:0}});const E=new Un({nodes:p,edges:y});this.formatCentripetal(o,E);const{maxIteration:O,minMovement:P,onTick:R}=o;if(this.lastLayoutNodes=p,this.lastLayoutEdges=y,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=E,this.lastOptions=o,this.lastVelMap=b,typeof window=="undefined")return;let F=0;return new Promise(I=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&I({nodes:Dv(e,p),edges:s}),this.runOneStep(E,e,F,b,o),this.updatePosition(e,E,b,o),t&&p.forEach(V=>e.mergeNodeData(V.id,{x:V.data.x,y:V.data.y,z:l===3?V.data.z:void 0})),R==null||R({nodes:Dv(e,p),edges:s}),F++,(F>=O||this.judgingDistance{let c=1;ie(l==null?void 0:l.data.mass)&&(c=l==null?void 0:l.data.mass);const u=e.getDegree(l.id,"both");return!u||u<5?c:u*5*c}),n.nodeSize=kv(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?js(1,t.linkDistance):l=>1+n.nodeSize(e.getNode(l.source))+n.nodeSize(e.getNode(l.target));return n.linkDistance=o,n.nodeStrength=js(1,t.nodeStrength),n.edgeStrength=js(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:l,nodeClusterBy:c}=t,u=e.getAllNodes(),h=i||{leaf:2,single:2,others:1,center:y=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=y=>s);let d,f;if(o&&c&&(d=Eb(e,c),f=Array.from(new Set(u==null?void 0:u.map(y=>y.data[c])))||[],t.centripetalOptions=Object.assign(h,{single:100,leaf:y=>{const{siblingLeaves:b,sameTypeLeaves:E}=d[y.id]||{};return(E==null?void 0:E.length)===(b==null?void 0:b.length)||(f==null?void 0:f.length)===1?1:t.clusterNodeStrength(y)},others:1,center:y=>{const b=e.getDegree(y.id,"both");if(!b)return{x:100,y:100,z:0};let E;if(b===1){const{sameTypeLeaves:O=[]}=d[y.id]||{};O.length===1?E=void 0:O.length>1&&(E=wb(O))}else E=void 0;return{x:E==null?void 0:E.x,y:E==null?void 0:E.y,z:E==null?void 0:E.z}}})),l&&c){d||(d=Eb(e,c)),f||(f=Array.from(new Set(u.map(b=>b.data[c])))),f=f.filter(b=>b!==void 0);const y={};f.forEach(b=>{const E=u.filter(O=>O.data[c]===b).map(O=>e.getNode(O.id));y[b]=wb(E)}),t.centripetalOptions=Object.assign(h,{single:b=>t.clusterNodeStrength(b),leaf:b=>t.clusterNodeStrength(b),others:b=>t.clusterNodeStrength(b),center:b=>{const E=y[b.data[c]];return{x:E==null?void 0:E.x,y:E==null?void 0:E.y,z:E==null?void 0:E.z}}})}const{leaf:v,single:g,others:p}=t.centripetalOptions||{};v&&typeof v!="function"&&(t.centripetalOptions.leaf=()=>v),g&&typeof g!="function"&&(t.centripetalOptions.single=()=>g),p&&typeof p!="function"&&(t.centripetalOptions.others=()=>p)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),l=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:c}=a;if(this.calRepulsive(t,s,a),l&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),c){const u=this.calTotalEnergy(s,o);c({energy:u,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,l=this.options.dimensions===3?t[i.id].z:0,c=s*s+o*o+l*l,{mass:u=1}=i.data;n+=u*c*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;oL(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:l,target:c}=s,u=t.getNode(l),h=t.getNode(c);if(!u||!h)return;let d=h.data.x-u.data.x,f=h.data.y-u.data.y,v=i===3?h.data.z-u.data.z:0;!d&&!f&&(d=Math.random()*.01,f=Math.random()*.01,i===3&&!v&&(v=Math.random()*.01));const g=Math.sqrt(d*d+f*f+v*v);if(g{const{id:g,data:p}=v,{mass:y,x:b,y:E,z:O}=p,P=e.getNode(g);let R=0,F=0,I=0,V=d;const Y=t.getDegree(g,"in"),J=t.getDegree(g,"out"),$=t.getDegree(g,"both"),ot=a==null?void 0:a(P,$);if(ot){const[ct,ft,Nt]=ot;R=b-ct,F=E-ft,V=Nt}else R=b-h[0],F=E-h[1],I=O-h[2];if(V&&(n[g].x-=V*R/y,n[g].y-=V*F/y,n[g].z-=V*I/y),f){const{leaf:ct,single:ft,others:Nt,center:Ot}=f,{x:mt,y:yt,z:Rt,centerStrength:jt}=(Ot==null?void 0:Ot(P,o,l,c,u))||{x:0,y:0,z:0,centerStrength:0};if(!ie(mt)||!ie(yt))return;const Xt=(b-mt)/y,ee=(E-yt)/y,ae=(O-Rt)/y;if(jt&&(n[g].x-=jt*Xt,n[g].y-=jt*ee,n[g].z-=jt*ae),$===0){const ce=ft(P);if(!ce)return;n[g].x-=ce*Xt,n[g].y-=ce*ee,n[g].z-=ce*ae;return}if(Y===0||J===0){const ce=ct(P,o,l);if(!ce)return;n[g].x-=ce*Xt,n[g].y-=ce*ee,n[g].z-=ce*ae;return}const he=Nt(P);if(!he)return;n[g].x-=he*Xt,n[g].y-=he*ee,n[g].z-=he*ae}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:l}=i,c=t.getAllNodes();c!=null&&c.length&&c.forEach(u=>{const{id:h}=u;let d=(n[h].x+e[h].x*o)*a||.01,f=(n[h].y+e[h].y*o)*a||.01,v=l===3?(n[h].z+e[h].z*o)*a||.01:0;const g=Math.sqrt(d*d+f*f+v*v);if(g>s){const p=s/g;d=p*d,f=p*f,v=p*v}n[h]={x:d,y:f,z:v}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,l=e.getAllNodes();if(!(l!=null&&l.length)){this.judgingDistance=0;return}let c=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),l.forEach(u=>{const{id:h}=u,d=t.getNode(h);if(ie(d.data.fx)&&ie(d.data.fy)){e.mergeNodeData(h,{x:d.data.fx,y:d.data.fy,z:o===3?d.data.fz:void 0});return}const f=n[h].x*s,v=n[h].y*s,g=o===3?n[h].z*s:0;e.mergeNodeData(h,{x:u.data.x+f,y:u.data.y+v,z:u.data.z+g});const p=Math.sqrt(f*f+v*v+g*g);switch(a){case"max":this.judgingDistancep&&(this.judgingDistance=p);break;default:c=c+p;break}}),(!a||a==="mean")&&(this.judgingDistance=c/l.length)}}const Eb=(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]=dL(r,"leaf",i,t))}),n},dL=(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(c=>r.getDegree(c.id,"in")===0||r.getDegree(c.id,"out")===0);const l=fL(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:l}},fL=(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},wb=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}},Dv=(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 We=S(88618);const w7=We.XA,S7=We.a_,M7=We.yQ,A7=We.Hs,T7=We.Ec,O7=We.dx,C7=We.LU,N7=We.Rm,Ha=We.y3,k7=We.qK,P7=We.pb,R7=We.j,L7=We.sO,_7=We.BZ,D7=We.EK,I7=We.Db,B7=We.Fx,F7=We.tU,z7=We.Ym,j7=We.rs,Z7=We.QR,W7=We.TB,G7=We.oH,Sb=We.Sc,V7=We.BN,U7=We.it,Y7=We.$r,H7=We.QM,X7=We.AV;var K7=(We.y3,We.y3);const Q7=We.GH,q7=We.SO,J7=We.uZ,$7=We.yU,tj=We.F1,ej=We.re,Mb=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},Ab=(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 l=[];i.push(l)}),n==null||n.forEach(s=>{const{source:o,target:l}=s,c=a[o],u=a[l];c===void 0||u===void 0||(i[c][u]=1,t||(i[u][c]=1))}),i},vL=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},gL=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Ea(s)?s.length===1&&(s=[s[0],s[0]]):ie(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],l=a.data.x-o[0],c=a.data.x+o[0],u=a.data.y-o[1],h=a.data.y+o[1];t>l&&(t=l),e>u&&(e=u),nMath.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),Iv=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let l=0;l{const y=ci(o[p]);y.data.x=g[0]+a[0],y.data.y=g[1]+a[1],f.push(y)}),t&&f.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:f,edges:l}})}}const mL=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)})})},yL=r=>{const e=Ha.mul(Ha.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 Sb(e),o=Ha.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(l=>Ha.mul([l],[o]).toJSON()[0].splice(0,2))};function Bv(r){return!!r.tick&&!!r.stop}const bL={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},xL={center:[0,0],comboPadding:10,treeKey:"combo"};class EL{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},xL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return(0,G.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,l=e.getAllNodes().filter(I=>!I.data._isCombo),c=e.getAllNodes().filter(I=>I.data._isCombo),u=e.getAllEdges(),h=l==null?void 0:l.length;if(!h||h===1)return Zs(e,t,a);const d=[],f=new Map;l.forEach(I=>{f.set(I.id,I)});const v=new Map;c.forEach(I=>{v.set(I.id,I)});const g=new Map,p=this.getInnerGraphs(e,s,f,v,u,i,g);yield Promise.all(p);const y=new Map,b=[],E=new Map;let O=!0;e.getRoots(s).forEach(I=>{const V=g.get(I.id),Y=v.get(I.id)||f.get(I.id),J={id:I.id,data:Object.assign(Object.assign({},I.data),{x:V.data.x||Y.data.x,y:V.data.y||Y.data.y,fx:V.data.fx||Y.data.fx,fy:V.data.fy||Y.data.fy,mass:V.data.mass||Y.data.mass,size:V.data.size})};b.push(J),y.set(I.id,!0),!isNaN(J.data.x)&&J.data.x!==0&&!isNaN(J.data.y)&&J.data.y!==0?O=!1:(J.data.x=Math.random()*100,J.data.y=Math.random()*100),Iv(e,[I],$=>{$.id!==I.id&&E.set($.id,I.id)},"TB",s)});const P=[];u.forEach(I=>{const V=E.get(I.source)||I.source,Y=E.get(I.target)||I.target;V!==Y&&y.has(V)&&y.has(Y)&&P.push({id:I.id,source:V,target:Y,data:{}})});let R;if(b!=null&&b.length){if(b.length===1)b[0].data.x=a[0],b[0].data.y=a[1];else{const I=new Un({nodes:b,edges:P}),V=o||new xb;O&&bL[V.id]&&(yield(b.length<100?new Ob:new Rv).assign(I));const Y=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},V.id==="force"?{gravity:1,factor:4,linkDistance:(J,$,ot)=>{const ct=Math.max(...$.data.size)||32,ft=Math.max(...ot.data.size)||32;return ct/2+ft/2+200}}:{});R=yield Cb(V,I,Y)}g.forEach(I=>{var V;const Y=R.nodes.find(ot=>ot.id===I.id);if(Y){const{x:ot,y:ct}=Y.data;I.data.visited=!0,I.data.x=ot,I.data.y=ct,d.push({id:I.id,data:{x:ot,y:ct}})}const{x:J,y:$}=I.data;(V=I.data.nodes)===null||V===void 0||V.forEach(ot=>{d.push({id:ot.id,data:{x:ot.data.x+J,y:ot.data.y+$}})})}),g.forEach(({data:I})=>{const{x:V,y:Y,visited:J,nodes:$}=I;$==null||$.forEach(ot=>{if(!J){const ct=d.find(ft=>ft.id===ot.id);ct.data.x+=V||0,ct.data.y+=Y||0}})})}return t&&d.forEach(I=>{e.mergeNodeData(I.id,{x:I.data.x,y:I.data.y})}),{nodes:d,edges:u}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(ie(i)?o=()=>i:fe(i)?o=i:o=()=>0,e.spacing=o,!n)s=c=>{const u=o(c);return c.size?Ea(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+u)/2:zn(c.size)?((c.size.width>c.size.height?c.size.width:c.size.height)+u)/2:(c.size+u)/2:32+u/2};else if(fe(n))s=c=>{const u=n(c),h=o(c);return Ea(c.size)?((c.size[0]>c.size[1]?c.size[0]:c.size[1])+h)/2:((u||32)+h)/2};else if(Ea(n)){const u=(n[0]>n[1]?n[0]:n[1])/2;s=h=>u+o(h)/2}else{const c=n/2;s=u=>c+o(u)/2}e.nodeSize=s;let l;return ie(a)?l=()=>a:Ea(a)?l=()=>Math.max.apply(null,a):fe(a)?l=a:l=()=>0,e.comboPadding=l,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:l,comboPadding:c,spacing:u,innerLayout:h}=s,d=h||new Rv({}),f={center:[0,0],preventOverlap:!0,nodeSpacing:u},v=[],g=p=>{let y=(c==null?void 0:c(p))||10;return Ea(y)&&(y=Math.max(...y)),{size:y?[y*2,y*2]:[30,30],padding:y}};return t.getRoots(e).forEach(p=>{o.set(p.id,{id:p.id,data:{nodes:[],size:g(p).size}});let y=Promise.resolve();Iv(t,[p],b=>{var E;if(!b.data._isCombo)return;const{size:O,padding:P}=g(b);if(!(!((E=t.getChildren(b.id,e))===null||E===void 0)&&E.length))o.set(b.id,{id:b.id,data:Object.assign(Object.assign({},b.data),{size:O})});else{const R=o.get(b.id);o.set(b.id,{id:b.id,data:Object.assign({nodes:[]},R==null?void 0:R.data)});const F=new Map,I=t.getChildren(b.id,e).map(J=>{if(J.data._isCombo)return o.has(J.id)||o.set(J.id,{id:J.id,data:Object.assign({},J.data)}),F.set(J.id,!0),o.get(J.id);const $=n.get(J.id)||i.get(J.id);return F.set(J.id,!0),{id:J.id,data:Object.assign(Object.assign({},$.data),J.data)}}),V={nodes:I,edges:a.filter(J=>F.has(J.source)&&F.has(J.target))};let Y=1/0;I.forEach(J=>{var $;let{size:ot}=J.data;ot||(ot=(($=o.get(J.id))===null||$===void 0?void 0:$.data.size)||(l==null?void 0:l(J))||[30,30]),ie(ot)&&(ot=[ot,ot]);const[ct,ft]=ot;Y>ct&&(Y=ct),Y>ft&&(Y=ft),J.data.size=ot}),y=y.then(()=>(0,G.mG)(this,void 0,void 0,function*(){const J=new Un(V);yield Cb(d,J,f,!0);const{minX:$,minY:ot,maxX:ct,maxY:ft}=gL(I),Nt={x:(ct+$)/2,y:(ft+ot)/2};V.nodes.forEach(mt=>{mt.data.x-=Nt.x,mt.data.y-=Nt.y});const Ot=[Math.max(ct-$,Y)+P*2,Math.max(ft-ot,Y)+P*2];o.get(b.id).data.size=Ot,o.get(b.id).data.nodes=I}))}return!0},"BT",e),v.push(y)}),v}}function Cb(r,t,e,n){var i;return(0,G.mG)(this,void 0,void 0,function*(){return Bv(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 ar(r){return function(){return r}}function Xa(r){return(r()-.5)*1e-6}function wL(r){return r.index}function Nb(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function SL(r){var t=wL,e=h,n,i=ar(30),a,s,o,l,c,u=1;r==null&&(r=[]);function h(p){return 1/Math.min(o[p.source.index],o[p.target.index])}function d(p){for(var y=0,b=r.length;y[t(P,R,s),P])),O;for(p=0,o=new Array(y);p(r=(TL*r+OL)%kb)/kb}function NL(r){return r.x}function kL(r){return r.y}var PL=10,RL=Math.PI*(3-Math.sqrt(5));function LL(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,l=(0,AL.HT)(h),c=(0,ML.Z)("tick","end"),u=CL();r==null&&(r=[]);function h(){d(),c.call("tick",t),e1?(p==null?o.delete(g):o.set(g,v(p)),t):o.get(g)},find:function(g,p,y){var b=0,E=r.length,O,P,R,F,I;for(y==null?y=1/0:y*=y,b=0;b1?(c.on(g,p),t):c.on(g)}}}function _L(){var r,t,e,n,i=ar(-30),a,s=1,o=1/0,l=.81;function c(f){var v,g=r.length,p=(0,Lv.Z)(r,NL,kL).visitAfter(h);for(n=f,v=0;v=o)return;(f.data!==t||f.next)&&(y===0&&(y=Xa(e),O+=y*y),b===0&&(b=Xa(e),O+=b*b),Od.index){var J=f-I.x-I.vx,$=v-I.y-I.vy,ot=J*J+$*$;otf+Y||Rv+Y||Fc.r&&(c.r=c[u].r)}function l(){if(t){var c,u=t.length,h;for(e=new Array(u),c=0;ce.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},mr(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return(0,G.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=mr({},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,G.mG)(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:u,data:h})=>Object.assign(Object.assign({id:u},h),Bs(h.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(u=>Object.assign({},u));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const l=new Promise(u=>{this.resolver=u}),c=this.setSimulation(a);return c.nodes(s),(i=c.force("link"))===null||i===void 0||i.links(o),l})}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),Bs(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:l,target:c,data:u})=>({id:o,source:typeof l=="object"?l.id:l,target:typeof c=="object"?c.id:c,data:u}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return LL()}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())})),Pb(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)),Pb(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const Pb=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var Rb=S(92546),GL=S.n(Rb);class nh{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,nh.defaultOptions,t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return(0,G.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,G.mG)(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new Rb.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:c})=>ie(c))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(c=>{const{id:u}=c,h=Object.assign({},c.data);if(i!==void 0){const[d,f]=Pl(fe(i)?i(c):i);Object.assign(h,{width:d,height:f})}a.setNode(u.toString(),h)}),e.getAllEdges().forEach(({id:c,source:u,target:h})=>{a.setEdge(u.toString(),h.toString(),{id:c})}),GL().layout(a);const l={nodes:[],edges:[]};return a.nodes().forEach(c=>{const u=a.node(c);l.nodes.push({id:c,data:u}),t&&e.mergeNodeData(c,u)}),a.edges().forEach(c=>{const u=a.edge(c),{id:h}=u,d=(0,G._T)(u,["id"]),{v:f,w:v}=c;l.edges.push({id:h,source:f,target:v,data:d}),t&&e.mergeEdgeData(h,d)}),l})}}nh.defaultOptions={};class Fv{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 Fv(s)}}class xo{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 xo(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 xo(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 xo(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 xo(i)}}class Eo{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 Eo(this.quad.NW()),this.NE=new Eo(this.quad.NE()),this.SW=new Eo(this.quad.SW()),this.SE=new Eo(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/nci(y,[o,l])),v=i.filter(y=>{const{source:b,target:E}=y;return b!==E}),g=new Un({nodes:f,edges:v}),p=this.getSizes(g,h);if(this.run(g,e,u,p,t,s),c){for(let b=0;b250&&(n.barnesHut=!0),l===void 0&&e>100&&(n.prune=!0),c===0&&!l?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):c===0&&l&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),u||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),h||(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:l,onTick:c}=s,u=t.getAllNodes();let h=0,d=n;const f={},v={},g={};for(let p=0;p0;)h=this.oneStep(t,{iter:d,preventOverlapIters:50,krPrime:100,sg:h,forces:f,preForces:v,bodies:g,sizes:i},s),d--,c==null||c({nodes:u,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:l,bodies:c,sizes:u}=e;let{forces:h}=e;const{preventOverlap:d,barnesHut:f}=n,v=t.getAllNodes();for(let g=0;ga||!d)?h=this.getOptRepGraForces(t,h,c,n):h=this.getRepGraForces(t,i,a,h,s,u,n),this.updatePos(t,h,l,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:l,mode:c,prune:u}=s,h=t.getAllEdges();for(let d=0;d0&&(P=O,R=O),a[f][0]+=P*E[0],a[v][0]-=R*E[0],a[f][1]+=P*E[1],a[v][1]-=R*E[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,l=t.getAllNodes(),c=l.length;let u=9e10,h=-9e10,d=9e10,f=-9e10;for(let b=0;b=h&&(h=O.x),O.x<=u&&(u=O.x),O.y>=f&&(f=O.y),O.y<=d&&(d=O.y))}const v=Math.max(h-u,f-d),g={xmid:(h+u)/2,ymid:(f+d)/2,length:v,massCenter:s,mass:c},p=new xo(g),y=new Eo(p);for(let b=0;b0&&(Y=c*(y+1)*(F+1)/V),i[p.id][0]-=Y*I[0],i[R.id][0]+=Y*I[0],i[p.id][1]-=Y*I[1],i[R.id][1]+=Y*I[1]}const b=[p.data.x-h[0],p.data.y-h[1]],E=Math.hypot(b[0],b[1]);b[0]=b[0]/E,b[1]=b[1]/E;const O=u*(y+1);i[p.id][0]-=O*b[0],i[p.id][1]-=O*b[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:l,ksmax:c}=a,u=t.getAllNodes(),h=u.length,d=[],f=[];let v=0,g=0,p=i;for(let b=0;b1.5*y?1.5*y:p);for(let b=0;bI?I:R;const V=R*e[E][0],Y=R*e[E][1];t.mergeNodeData(E,{x:O.x+V,y:O.y+Y})}return p}}const YL={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},HL=800;class XL{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},YL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return(0,G.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,G.mG)(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:l,clustering:c,nodeClusterBy:u,maxIteration:h,onTick:d}=i,f=e.getAllNodes(),v=e.getAllEdges();if(!(f!=null&&f.length)){const E={nodes:[],edges:v};return this.lastResult=E,E}if(f.length===1){t&&e.mergeNodeData(f[0].id,{x:l[0],y:l[1],z:a===3?l[2]:void 0});const E={nodes:[Object.assign(Object.assign({},f[0]),{data:Object.assign(Object.assign({},f[0].data),{x:l[0],y:l[1],z:a===3?l[2]:void 0})})],edges:v};return this.lastResult=E,E}const g=f.map(E=>ci(E,[s,o])),p=new Un({nodes:g,edges:v}),y={};if(c&&g.forEach(E=>{const O=E.data[u];y[O]||(y[O]={name:O,cx:0,cy:0,count:0})}),this.lastLayoutNodes=g,this.lastLayoutEdges=v,this.lastAssign=t,this.lastGraph=p,this.lastOptions=i,this.lastClusterMap=y,typeof window=="undefined")return;let b=0;return new Promise(E=>{this.timeInterval=window.setInterval(()=>{if(!this.running){E({nodes:g,edges:v});return}this.runOneStep(p,y,i),t&&g.forEach(({id:O,data:P})=>e.mergeNodeData(O,{x:P.x,y:P.y,z:a===3?P.z:void 0})),d==null||d({nodes:g,edges:v}),b++,b>=h&&(window.clearInterval(this.timeInterval),E({nodes:g,edges:v}))},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:l,speed:c,clustering:u,nodeClusterBy:h,clusterGravity:d}=n,f=a*s,v=Math.sqrt(f)/10,g=t.getAllNodes(),p=f/(g.length+1),y=Math.sqrt(p),b={};if(this.applyCalculate(t,b,y,p),u){for(const O in e)e[O].cx=0,e[O].cy=0,e[O].count=0;g.forEach(O=>{const{data:P}=O,R=e[P[h]];ie(P.x)&&(R.cx+=P.x),ie(P.y)&&(R.cy+=P.y),R.count++});for(const O in e)e[O].cx/=e[O].count,e[O].cy/=e[O].count;const E=d||o;g.forEach((O,P)=>{const{id:R,data:F}=O;if(!ie(F.x)||!ie(F.y))return;const I=e[F[h]],V=Math.sqrt((F.x-I.cx)*(F.x-I.cx)+(F.y-I.cy)*(F.y-I.cy)),Y=y*E;b[R].x-=Y*(F.x-I.cx)/V,b[R].y-=Y*(F.y-I.cy)/V})}g.forEach((E,O)=>{const{id:P,data:R}=E;if(!ie(R.x)||!ie(R.y))return;const F=.01*y*o;b[P].x-=F*(R.x-l[0]),b[P].y-=F*(R.y-l[1]),i===3&&(b[P].z-=F*(R.z-l[2]))}),g.forEach((E,O)=>{const{id:P,data:R}=E;if(ie(R.fx)&&ie(R.fy)){R.x=R.fx,R.y=R.fy,i===3&&(R.z=R.fz);return}if(!ie(R.x)||!ie(R.y))return;const F=Math.sqrt(b[P].x*b[P].x+b[P].y*b[P].y+(i===3?b[P].z*b[P].z:0));if(F>0){const I=Math.min(v*(c/HL),F);t.mergeNodeData(P,{x:R.x+b[P].x/F*I,y:R.y+b[P].y/F*I,z:i===3?R.z+b[P].z/F*I: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:l,id:c},u)=>{if(o<=u||!ie(a.x)||!ie(l.x)||!ie(a.y)||!ie(l.y))return;let h=a.x-l.x,d=a.y-l.y,f=this.options.dimensions===3?a.z-l.z:0,v=h*h+d*d+f*f;v===0&&(v=1,h=.01,d=.01,f=.01);const g=n/v,p=h*g,y=d*g,b=f*g;e[s].x+=p,e[s].y+=y,e[c].x-=p,e[c].y-=y,this.options.dimensions===3&&(e[s].z+=b,e[c].z-=b)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:l}=t.getNode(s),{data:c}=t.getNode(o);if(!ie(c.x)||!ie(l.x)||!ie(c.y)||!ie(l.y))return;const u=c.x-l.x,h=c.y-l.y,d=this.options.dimensions===3?c.z-l.z:0,f=Math.sqrt(u*u+h*h+d*d)/n,v=u*f,g=h*f,p=d*f;e[s].x+=v,e[s].y+=g,e[o].x-=v,e[o].y-=g,this.options.dimensions===3&&(e[s].z+=p,e[o].z-=p)})}}const KL={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 QL{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},KL),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return(0,G.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:l,rows:c,cols:u,nodeSpacing:h,nodeSize:d,width:f,height:v,position:g}=i;let{sortBy:p}=i;const y=e.getAllNodes(),b=e.getAllEdges(),E=y==null?void 0:y.length;if(!E||E===1)return Zs(e,t,a);const O=y.map(ft=>ci(ft));p!=="id"&&(!Ge(p)||O[0].data[p]===void 0)&&(p="degree"),p==="degree"?O.sort((ft,Nt)=>e.getDegree(Nt.id,"both")-e.getDegree(ft.id,"both")):p==="id"?O.sort((ft,Nt)=>ie(Nt.id)&&ie(ft.id)?Nt.id-ft.id:`${ft.id}`.localeCompare(`${Nt.id}`)):O.sort((ft,Nt)=>Nt.data[p]-ft.data[p]);const P=!f&&typeof window!="undefined"?window.innerWidth:f,R=!v&&typeof window!="undefined"?window.innerHeight:v,F=E,I={rows:c,cols:u};if(c!=null&&u!=null)I.rows=c,I.cols=u;else if(c!=null&&u==null)I.rows=c,I.cols=Math.ceil(F/I.rows);else if(c==null&&u!=null)I.cols=u,I.rows=Math.ceil(F/I.cols);else{const ft=Math.sqrt(F*R/P);I.rows=Math.round(ft),I.cols=Math.round(P/R*ft)}if(I.rows=Math.max(I.rows,1),I.cols=Math.max(I.cols,1),I.cols*I.rows>F){const ft=rh(I),Nt=ih(I);(ft-1)*Nt>=F?rh(I,ft-1):(Nt-1)*ft>=F&&ih(I,Nt-1)}else for(;I.cols*I.rows=F?ih(I,Nt+1):rh(I,ft+1)}let V=s?0:P/I.cols,Y=s?0:R/I.rows;if(l||h){const ft=js(10,h),Nt=Nv(30,d,!1);O.forEach(Ot=>{(!Ot.data.x||!Ot.data.y)&&(Ot.data.x=0,Ot.data.y=0);const mt=e.getNode(Ot.id),[yt,Rt]=Pl(Nt(mt)||30),jt=ft!==void 0?ft(Ot):o,Xt=yt+jt,ee=Rt+jt;V=Math.max(V,Xt),Y=Math.max(Y,ee)})}const J={},$={row:0,col:0},ot={};for(let ft=0;ft{e.mergeNodeData(ft.id,{x:ft.data.x,y:ft.data.y})}),ct})}}const rh=(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},ih=(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},zv=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,Lb=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,_b=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},qL=(r,t,e,n,i,a,s,o)=>{let l,c;const u=i[r.id];if(u)l=u.col*e+e/2+t[0],c=u.row*n+n/2+t[1];else{for(;zv(o,s);)_b(a,s);l=s.col*e+e/2+t[0],c=s.row*n+n/2+t[1],Lb(o,s),_b(a,s)}r.data.x=l,r.data.y=c},JL=(r,t,e)=>{try{const n=Ha.mul(Ha.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 Sb(n),l=Ha.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(c=>Ha.mul([c],[l]).toJSON()[0].splice(0,r))}catch(n){const i=[];for(let a=0;a{const e=Object.assign(Object.assign({},t_),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:l,focusIdx:c,radii:u=[],nodeSizeFunc:h}=e,d=r.getAllNodes(),f=[],v=a/10;for(let g=0;g{f[y]={x:0,y:0}}),n_(d,n,f,s,u,h),r_(n,f,o,l,c,v,a,u);return n},n_=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((l,c)=>{if(o===c||i[o]!==i[c])return;let u=s.x-l.x,h=s.y-l.y,d=Math.sqrt(u*u+h*h);if(d===0){d=1;const f=o>c?1:-1;u=.01*f,h=.01*f}if(d{const l=a||s/10;return n&&t.forEach((c,u)=>{const h=r[u].x-r[i].x,d=r[u].y-r[i].y,f=Math.sqrt(h*h+d*d);let v=d/f,g=-h/f;const p=Math.sqrt(c.x*c.x+c.y*c.y);let y=Math.acos((v*c.x+g*c.y)/p);y>Math.PI/2&&(y-=Math.PI/2,v*=-1,g*=-1);const b=Math.cos(y)*p;c.x=v*b,c.y=g*b}),r.forEach((c,u)=>{if(u===i)return;const h=Math.sqrt(t[u].x*t[u].x+t[u].y*t[u].y);if(h>0&&u!==i){const d=Math.min(l*(e/$L),h);if(c.x+=t[u].x/h*d,c.y+=t[u].y/h*d,n){let f=c.x-r[i].x,v=c.y-r[i].y;const g=Math.sqrt(f*f+v*v);f=f/g*o[u],v=v/g*o[u],c.x=r[i].x+f,c.y=r[i].y+v}}}),r},i_={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class a_{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},i_),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return(0,G.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:l,unitRadius:c,nodeSize:u,nodeSpacing:h,strictRadial:d,preventOverlap:f,maxPreventOverlapIteration:v,sortBy:g,linkDistance:p=50,sortStrength:y=10,maxIteration:b=1e3}=i,E=e.getAllNodes(),O=e.getAllEdges(),P=!a&&typeof window!="undefined"?window.innerWidth:a,R=!s&&typeof window!="undefined"?window.innerHeight:s,F=o||[P/2,R/2];if(!(E!=null&&E.length)||E.length===1)return Zs(e,t,F);let I=E[0];if(Ge(l)){for(let xe=0;xeF[0]?F[0]:P-F[0],ft=R-F[1]>F[1]?F[1]:R-F[1];ct===0&&(ct=P/2),ft===0&&(ft=R/2);const Nt=Math.min(ct,ft),Ot=Math.max(...ot),mt=[],yt=c||Nt/Ot;ot.forEach((xe,Ce)=>{mt[Ce]=xe*yt});const Rt=s_(E,J,p,mt,yt,g,y),jt=o_(Rt),Xt=JL(p,Rt,p);let ee=Xt.map(([xe,Ce])=>({x:(isNaN(xe)?Math.random()*p:xe)-Xt[V][0],y:(isNaN(Ce)?Math.random()*p:Ce)-Xt[V][1]}));this.run(b,ee,jt,Rt,mt,V);let ae;if(f){ae=kv(u,h);const xe={nodes:E,nodeSizeFunc:ae,positions:ee,radii:mt,height:R,width:P,strictRadial:!!d,focusIdx:V,iterations:v||200,k:ee.length/4.5};ee=e_(e,xe)}const he=[];return ee.forEach((xe,Ce)=>{const je=ci(E[Ce]);je.data.x=xe.x+F[0],je.data.y=xe.y+F[1],he.push(je)}),t&&he.forEach(xe=>e.mergeNodeData(xe.id,{x:xe.data.x,y:xe.data.y})),{nodes:he,edges:O}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const l=o/t;this.oneIteration(l,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((l,c)=>{const u=Tb(l,{x:0,y:0}),h=u===0?0:1/u;if(c===s)return;let d=0,f=0,v=0;e.forEach((p,y)=>{if(c===y)return;const b=Tb(l,p),E=b===0?0:1/b,O=i[y][c];v+=a[c][y],d+=a[c][y]*(p.x+O*(l.x-p.x)*E),f+=a[c][y]*(p.y+O*(l.y-p.y)*E)});const g=n[c]===0?0:1/n[c];v*=o,v+=t*g*g,d*=o,d+=t*g*l.x*h,l.x=d/v,f*=o,f+=t*g*l.y*h,l.y=f/v})}}const s_=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const l={};t.forEach((c,u)=>{const h=[];c.forEach((d,f)=>{var v,g;if(u===f)h.push(0);else if(n[u]===n[f])if(a==="data")h.push(d*(Math.abs(u-f)*s)/(n[u]/i));else if(a){let p,y;if(l[r[u].id])p=l[r[u].id];else{const b=(a==="id"?r[u].id:(v=r[u].data)===null||v===void 0?void 0:v[a])||0;Ge(b)?p=b.charCodeAt(0):p=b,l[r[u].id]=p}if(l[r[f].id])y=l[r[f].id];else{const b=(a==="id"?r[f].id:(g=r[f].data)===null||g===void 0?void 0:g[a])||0;Ge(b)?y=b.charCodeAt(0):y=b,l[r[f].id]=y}h.push(d*(Math.abs(p-y)*s)/(n[u]/i))}else h.push(d*e/(n[u]/i));else{const p=(e+i)/2;h.push(d*p)}}),o.push(h)})}return o},o_=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)},c_=(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},h_={center:[0,0],width:300,height:300};class d_{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},h_),t)}execute(t,e){return(0,G.mG)(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return(0,G.mG)(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return(0,G.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,l=e.getAllNodes(),c=.9,u=!s&&typeof window!="undefined"?window.innerWidth:s,h=!o&&typeof window!="undefined"?window.innerHeight:o,d=a||[u/2,h/2],f=[];return l&&l.forEach(g=>{f.push({id:g.id,data:{x:(Math.random()-.5)*c*u+d[0],y:(Math.random()-.5)*c*h+d[1]}})}),t&&f.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:f,edges:e.getAllEdges()}})}}function f_(r){var t,e,n,i=r||1;function a(o,l){++t>i&&(n=e,s(1),++t),e[o]=l}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 l=e[o];if(l!==void 0)return l;if((l=n[o])!==void 0)return a(o,l),l},set:function(o,l){e[o]!==void 0?e[o]=l:a(o,l)}}}var jv=new Map;function Zv(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=>oi(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:l}=this.context,c=this.formatSize(s);let u=c(t)[0]+i(t);const h=(E,O=0)=>{var P;return O+=n*((E.children||[]).length+1),(P=E.children)===null||P===void 0||P.forEach(R=>{var F;(F=l.getNodeLikeDatum(R).children)===null||F===void 0||F.forEach(V=>{const Y=l.getNodeLikeDatum(V);O=h(Y,O)})}),O},d=E=>{if(E.depth===1)return u;const O=l.getParentData(E.id,"tree");if(wo(E)){const P=l.getParentData(O.id,"tree"),R=g(E)-g(P);return d(O)+R*n/a}else{const P=(O.children||[]).indexOf(E.id),R=l.getNodeData((O.children||[]).slice(P));return f(O)-R.reduce((F,I)=>F+h(I),0)-c(O)[0]/2}},f=Zv(E=>{if(Wv(E))return c(E)[0]/2;const O=l.getParentData(E.id,"tree");if(wo(E))return d(E)+h(E)+c(E)[0]/2;{const P=g(E)-g(O),R=n/a;return d(E)+P*R}},E=>E.id),v=E=>g(l.getParentData(E,"tree")),g=Zv(E=>{if(Wv(E))return o/2;if(wo(E)){const O=l.getParentData(E.id,"tree"),P=O.children.indexOf(E.id);if(P===0)return v(O.id)+a;const R=l.getNodeLikeDatum(O.children[P-1]);if(ra(R.children))return g(R)+a;const F=l.getDescendantsData(R.id);return Math.max(...F.map(I=>wo(I)?v(I.id):g(I)))+a}else{if(ra(E.children))return v(E.id)+a;const O=l.getNodeLikeDatum(E.children.slice(-1)[0]);if(ra(O.children))return g(O)+a;const P=l.getDescendantsData(E.id).slice(-1)[0];return(wo(P)?v(P.id):g(P))+a}},E=>E.id);let p=0;const y={nodes:[],edges:[]},b=E=>{var O;(O=E.children)===null||O===void 0||O.forEach(V=>b(l.getNodeLikeDatum(V)));const P=g(E),R=f(E);if(y.nodes.push({id:E.id,x:R,y:P}),Wv(E))return;const F=l.getRelatedEdgesData(E.id,"in")[0],I=[d(E),wo(E)?P:v(E.id)];y.edges.push({id:At(F),controlPoints:[I],relatedNodeId:E.id}),p=Math.max(p,R+i(E)),E.depth===1&&(u=p)};return b(t),y}placeAlterative(t,e){const n=(e.children||[]).filter((o,l)=>l%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 l=i.getAncestorsData(o,"tree");if(ra(l))return!1;const c=l.length===1?o:l[l.length-2].id;return n.includes(c)};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(l=>[l[0],2*a-l[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 v_(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},ah.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(d=>o(d)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(d=>o(d)[0])));let l=this.doLayout(s,n);this.placeAlterative(l,s),i==="RL"&&(l=this.rightToLeft(l,n));const{model:c}=this.context,u=[],h=[];return l.nodes.forEach(d=>{const{id:f,x:v,y:g}=d,p=c.getNodeLikeDatum(f);u.push(Db(p,{x:v,y:g}))}),l.edges.forEach(d=>{const{id:f,controlPoints:v}=d,g=c.getEdgeDatum(f);h.push(Db(g,{controlPoints:v}))}),{nodes:u,edges:h}})}}ah.defaultOptions={direction:"RL",getRibSep:()=>60};const Db=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),Wv=r=>r.depth===0,wo=r=>(r.depth||(r.depth=0))%2===0;var g_=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class sh extends Hu{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=oi(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(d=>{i[d.id]=0,a[d.id]=0,s[d.id]=[]}),n.forEach(d=>{i[d.target]++,a[d.source]++,s[d.source].push(d.target)});const o=new Set,l=d=>{o.has(d)||(o.add(d),s[d].forEach(l))};if(l(e[0].id),o.size!==e.length)return!1;const c=e.filter(d=>i[d.id]===0),u=e.filter(d=>a[d.id]===0);return!(c.length!==1||u.length!==1||e.filter(d=>i[d.id]===1&&a[d.id]===1).length!==e.length-2)}execute(t,e){return g_(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:l,rowGap:c,clockwise:u,width:h,height:d}=Object.assign({},sh.defaultOptions,this.options,e),[f,v,g,p]=ai(a),y=this.formatSize(t.nodes||[],i),b=Math.ceil((t.nodes||[]).length/o);let E=l||(h-p-v-o*y[0])/(o-1),O=c||(d-f-g-b*y[1])/(b-1);return(O===1/0||O<0)&&(O=0),(E===1/0||E<0)&&(E=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):p_(t))||[]).map((F,I)=>{const V=Math.floor(I/o),Y=I%o,J=u?V%2===0?Y:o-1-Y:V%2===0?o-1-Y:Y,$=p+J*(y[0]+E)+y[0]/2,ot=f+V*(y[1]+O)+y[1]/2;return{id:F.id,style:{x:$,y:ot}}})}})}}sh.defaultOptions={padding:0,cols:5,clockwise:!0};function p_(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(),l=t.find(c=>c.id===o);s.push(l),i[o].forEach(c=>{n[c]--,n[c]===0&&a.push(c)})}return s}const m_=["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)"],y_=["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)"],b_=["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)"],x_=["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)"],E_=["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 w_=function(r,t,e){if(!Wr(r)&&!vo(r))return r;var n=e;return s1(r,function(i,a){n=t(n,i,a)}),n},S_=w_,Gv=function(r,t){return S_(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})};class hr extends Vf{}function So(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 Vv(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 M_=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class oh extends hr{constructor(t,e){super(t,Object.assign({},oh.defaultOptions,e)),this.$element=So("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return M_(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,Gv(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}oh.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function Uv(r,t,e,n,i,a){const s=r,o=t,l=e-s,c=n-o;let u=i-s,h=a-o,d=u*l+h*c,f=0;d<=0?f=0:(u=l-u,h=c-h,d=u*l+h*c,d<=0?f=0:f=d*d/(l*l+c*c));const v=u*u+h*h-f;return v<0?0:v}function Ka(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function Ib(r,t,e,n,i){return Ka(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 Bb(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 dr{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 dr(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 Dn;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Dn||(Dn={}));class Yv{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function lh(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 Yv(Dn.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new Yv(Dn.NONE)}return new Yv(e===0||n===0?Dn.COINCIDENT:Dn.PARALLEL)}function Fb(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 T_(r,t){function e(i,a,s,o){let l=Fb(t,new dr(i,a,s,o));return l=Math.abs(l-.5),l>=0&&l<=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 In;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(In||(In={}));function ch(r,t,e){const n=new Set;return r.width<=0?(n.add(In.LEFT),n.add(In.RIGHT)):tr.x+r.width&&n.add(In.RIGHT),r.height<=0?(n.add(In.TOP),n.add(In.BOTTOM)):er.y+r.height&&n.add(In.BOTTOM),n}function zb(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(ch(r,i,a));if(s.length===0)return!0;let o=ch(r,e,n);for(;o.size!==0;){for(const l of s)if(o.has(l))return!1;if(o.has(In.RIGHT)||o.has(In.LEFT)){let l=r.x;o.has(In.RIGHT)&&(l+=r.width),n=n+(l-e)*(a-n)/(i-e),e=l}else{let l=r.y;o.has(In.BOTTOM)&&(l+=r.height),e=e+(l-n)*(i-e)/(a-n),n=l}o=ch(r,e,n)}return!0}function O_(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,l){let c=Fb(t,new dr(a,s,o,l));c=Math.abs(c-.5),c>=0&&c<=1&&(n++,c1||(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 C_(r,t){let e=0;const n=lh(r,new dr(t.x,t.y,t.x2,t.y));e+=n.state===Dn.POINT?1:0;const i=lh(r,new dr(t.x,t.y,t.x,t.y2));e+=i.state===Dn.POINT?1:0;const a=lh(r,new dr(t.x,t.y2,t.x2,t.y2));e+=a.state===Dn.POINT?1:0;const s=lh(r,new dr(t.x2,t.y,t.x2,t.y2));return e+=s.state===Dn.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Or{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 Or(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 Or(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 Or(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),l=s-i,c=o-a;return new Or(i,a,l,c)}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),l=Math.min(t.j+t.height,this.height);if(!(l<=0||o<=0||a>=n||l>=this.height))for(let c=s;cMath.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 jb(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 Zb(r,t,e){return Wb(Object.assign(Bb(r),{distSquare:(n,i)=>Uv(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function Wb(r,t,e){const n=jb(r,e),i=t.scale(n),a=t.createSub(i,n);return k_(a,t,e,(s,o)=>r.distSquare(s,o)),a}function k_(r,t,e,n){const i=e*e;for(let a=0;a{const o=i.slice(0,s);return L_(t,a,o,e,n)}).flat()}function L_(r,t,e,n,i){const a=Sn(t.cx,t.cy),s=I_(a,e,r);if(s==null)return[];const o=new dr(a.x,a.y,s.cx,s.cy),l=__(o,r,n,i);return D_(l,r)}function __(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o0;){const l=a.pop(),c=Gb(t,l),u=c?C_(l,c):null;if(!c||!u||u.count!==2){s||i.push(l);continue}let h=n,d=dh(c,h,u,!0),f=Qa(d,a)||Qa(d,i),v=hh(d,t);for(;!f&&v&&h>=1;)h/=1.5,d=dh(c,h,u,!0),f=Qa(d,a)||Qa(d,i),v=hh(d,t);if(d&&!f&&!v&&(a.push(new dr(l.x1,l.y1,d.x,d.y)),a.push(new dr(d.x,d.y,l.x2,l.y2)),s=!0),s)continue;h=n,d=dh(c,h,u,!1);let g=Qa(d,a)||Qa(d,i);for(v=hh(d,t);!g&&v&&h>=1;)h/=1.5,d=dh(c,h,u,!1),g=Qa(d,a)||Qa(d,i),v=hh(d,t);d&&!g&&(a.push(new dr(l.x1,l.y1,d.x,d.y)),a.push(new dr(d.x,d.y,l.x2,l.y2)),s=!0),s||i.push(l)}for(;a.length>0;)i.push(a.pop());return i}function D_(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 dr(n.x1,n.y1,i.x2,i.y2);Gb(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function I_(r,t,e){let n=Number.POSITIVE_INFINITY;return t.reduce((i,a)=>{const s=Ka(r.x,r.y,a.cx,a.cy);if(s>n)return i;const o=new dr(r.x,r.y,a.cx,a.cy),l=F_(e,o);return s*(l+1)*(l+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 hh(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function Qa(r,t){return t.some(e=>!!(Ib(e.x1,e.y1,r.x,r.y,.001)||Ib(e.x2,e.y2,r.x,r.y,.001)))}function Gb(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!zb(i,t))continue;const a=O_(i,t);a>=0&&azb(n,t)&&T_(n,t)?e+1:e,0)}function dh(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Dn.POINT){if(i.state===Dn.POINT)return Sn(r.x-t,r.y-t);if(s.state===Dn.POINT)return Sn(r.x-t,r.y2+t);const d=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)o.y?Sn(r.x-t,r.y-t):Sn(r.x2+t,r.y-t):a.ys.x?Sn(r.x-t,r.y-t):Sn(r.x-t,r.y2+t):i.xo.y?Sn(r.x2+t,r.y2+t):Sn(r.x-t,r.y2+t):a.ys.x?Sn(r.x2+t,r.y2+t):Sn(r.x2+t,r.y-t):i.xn)return!1}return!0}function j_(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=[],l=s.closed,c=s.length+3-1+(l?0:2);o.push(a(s,2-(l?0:2),0));for(let u=2-(l?0:2);u{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:A_(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 G_(t)(this)}simplify(t){return j_(t)(this)}bSplines(t){return W_(t)(this)}apply(t){return t(this)}containsElements(t){const e=N_(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 dr(i.x,i.y,i.x,i.y);for(let s=1;st?u+h:u}function a(l,c){let u=Rl;return u=i(l,c,u,1),u=i(l+1,c,u,2),u=i(l,c+1,u,4),u=i(l+1,c+1,u,8),Number.isNaN(u)?-1:u}let s=fh;function o(l,c){let u=l,h=c,d=r.invertScaleX(u),f=r.invertScaleY(h);for(let v=0;vVb(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(zi.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>Vb(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(zi.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(zi.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(zi.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:Ll(e)?uh.from(e):Or.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(zi.EDGES);for(const e of t)this.edges.push({raw:e,obj:dr.from(e),area:null})}}update(){const t=this.dirty.has(zi.MEMBERS),e=this.dirty.has(zi.NON_MEMBERS);let n=this.dirty.has(zi.EDGES);this.dirty.clear();const i=this.members.map(c=>c.obj);if(this.o.virtualEdges&&(t||e)){const c=this.nonMembers.map(d=>d.obj),u=R_(i,c,this.o.maxRoutingIterations,this.o.morphBuffer),h=new Map(this.virtualEdges.map(d=>[d.obj.toString(),d.area]));this.virtualEdges=u.map(d=>{var f;return{raw:d,obj:d,area:(f=h.get(d.toString()))!==null&&f!==void 0?f:null}}),n=!0}let a=!1;if(t||n){const c=this.virtualEdges.concat(this.edges).map(f=>f.obj),u=H_(i,c),h=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,d=Or.from(jb(u,h));d.equals(this.activeRegion)||(a=!0,this.activeRegion=d)}if(a){const c=Math.ceil(this.activeRegion.width/this.o.pixelGroup),u=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Ws.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(h=>h.area=null),this.nonMembers.forEach(h=>h.area=null),this.edges.forEach(h=>h.area=null),this.virtualEdges.forEach(h=>h.area=null)):(c!==this.potentialArea.width||u!==this.potentialArea.height)&&(this.potentialArea=Ws.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=c=>{if(c.area){const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Or?"R":"C"}`;s.set(u,c.area)}},l=c=>{if(c.area)return;const u=`${c.obj.width}x${c.obj.height}x${c.obj instanceof Or?"R":"C"}`;if(s.has(u)){const d=s.get(u);c.area=this.potentialArea.copy(d,{x:c.obj.x-this.o.nodeR1,y:c.obj.y-this.o.nodeR1});return}const h=c.obj instanceof Or?P_(c.obj,this.potentialArea,this.o.nodeR1):Wb(c.obj,this.potentialArea,this.o.nodeR1);c.area=h,s.set(u,h)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(l),this.nonMembers.forEach(c=>{this.activeRegion.intersects(c.obj)?l(c):c.area=null}),this.edges.forEach(c=>{c.area||(c.area=Zb(c.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(c=>{c.area||(c.area=Zb(c.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 Gs([]);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 Y_(e,n,i,a,o=>o.containsElements(s),t)}}function Y_(r,t,e,n,i,a={}){const s=Object.assign({},gh,a);let o=s.threshold,l=s.memberInfluenceFactor,c=s.edgeInfluenceFactor,u=s.nonMemberInfluenceFactor;const h=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),d=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let f=0;f0)u*=.8;else break}return new Gs([])}function H_(r,t){if(r.length===0)return new Or(0,0,0,0);const e=Or.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(Bb(n));return e}function aj(r,t=[],e=[],n={}){if(r.length===0)return new Gs([]);const i=new Xv(n);return i.pushMember(...r),i.pushNonMember(...t),i.pushEdge(...e),i.compute()}var X_=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();Wn(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 wl({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=At(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,l=[...this.avoidMembers.keys()];if(!n&&Wn(a,s)&&Wn(o,l))return this.path;const{enter:c=[],exit:u=[]}=ja(s,a,p=>p),{enter:h=[],exit:d=[]}=ja(l,o,p=>p);n&&(u.push(n),c.push(n));const f=(p,y,b)=>{p.forEach(E=>{const O=b?this.members:this.avoidMembers,P=b?"pushMember":"pushNonMember",R=b?"removeMember":"removeNonMember";if(y){let F;i.getElementType(E)==="edge"?([F]=Q_(i,E),this.bubbleSets.pushEdge(F)):([F]=K_(i,E),this.bubbleSets[P](F)),O.set(E,F)}else{const F=O.get(E);F&&(i.getElementType(E)==="edge"?this.bubbleSets.removeEdge(F):this.bubbleSets[R](F),O.delete(E))}})};f(u,!1,!0),f(c,!0,!0),f(d,!1,!1),f(h,!0,!1);const g=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=Yy(g.points.map(yr)),this.path},this.bindEvents(),this.bubbleSets=new Xv(this.options)}bindEvents(){this.context.graph.on(Kt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(Kt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new Xv(this.options),this.members=new Map,this.avoidMembers=new Map}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=X_(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((l,c)=>(c in gh?l.bubbleSetOptions[c]=s[c]:l.style[c]=s[c],l),{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=fe(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(Kt.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(Kt.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape.destroy(),super.destroy()}}ph.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},gh);const K_=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Or(i.min[0],i.min[1],ta(i),ea(i))}),Q_=(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 dr.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});class sj 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 l=n[s];if(l!==void 0){const c=a(s,l);this.context.canvas.getCamera()[o](c)}})},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 q_(r){return`
    ${r.map(t=>`
  • ${t.name}
  • `).join("")}
`}const J_=` .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 Ub=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class mh extends hr{constructor(t,e){super(t,Object.assign({},mh.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=So("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),Vv("g6-contextmenu-css","style",{},J_,document.head)}show(t){return Ub(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 Ub(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?q_(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)}}mh.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'
Loading...
',getContent:()=>"It is a empty context menu.",enable:()=>!0};class yh extends hr{constructor(t,e){super(t,Object.assign({},yh.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:l}=this.options;let{lambda:c,divisions:u,iterations:h}=this.options;for(let d=0;d{var p;if(g.source===g.target)return;const y=At(g);v[y]=this.getEdgeForces(g,u,c);for(let b=0;b{const f=At(d),v=i.getElement(f);v==null||v.update({d:fv(this.edgePoints[f])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[At(e),Rs(ir(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=At(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(Ii(Ne(s,o),2)),this.edgePoints[a].push(o);else{const c=(this.edgePoints[a].length===0?bn(s,o):rD(this.edgePoints[a]))/(t+1);let u=c;const h=[s];for(let d=1;du;){const p=u/g,y=Ne(f,Di(ln(v,f),p));h.push(y),g-=u,u=c}u-=g}h.push(o),this.edgePoints[a]=h}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=ln(n,e),s=bn(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=$_(n,i),s=tD(n,i),o=eD(n,i),l=nD(n,i);return a*s*o*l}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var l,c;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[l=At(i)]||(t[l]=[]),t[At(i)].push(s),t[c=At(s)]||(t[c]=[]),t[At(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Di(ln(Ne(n,a),Di(i,2)),e)}getElectrostaticForce(t,e){ra(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[At(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[At(a)][t],o=this.edgePoints[At(e)][t],l=ln(s,o),c=bn(s,o);i=Ne(i,Di(l,1/c))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(bn(i,a)*(e+1)),o=[[0,0]],l=At(t);for(let c=1;cMath.abs(wN([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),tD=(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)},eD=(r,t)=>{const e=(r.length+t.length)/2,n=Ii(Ne(r.source,r.target),2),i=Ii(Ne(t.source,t.target),2);return e/(e+bn(n,i))},Yb=(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]},Hb=(r,t)=>{const e=Yb(t.source,r),n=Yb(t.target,r),i=Ii(Ne(e,n),2),a=Ii(Ne(r.source,r.target),2);return bn(e,n)===0?0:Math.max(0,1-2*bn(a,i)/bn(e,n))},nD=(r,t)=>Math.min(Hb(r,t),Hb(t,r)),rD=r=>{let t=0;for(let e=1;e{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=yr(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},iD,this.options.style);this.isLensOn||(this.lens=new Ds({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Bi(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:l}=a;return{nodes:s.filter(c=>n(At(c),"node")),edges:o.filter(c=>n(At(c),"edge")),combos:l.filter(c=>n(At(c),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(c=>bn(ir(c),n)At(c)),l=a.filter(c=>{const{source:u,target:h}=c,d=o.includes(u),f=o.includes(h);switch(this.options.nodeType){case"both":return d&&f;case"either":return d!==f;case"source":return d&&!f;case"target":return!d&&f;default:return!1}});return{nodes:s,edges:l}},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),l=new Set,c=u=>{const h=At(u);l.add(h);const d=n.getElement(h);if(!d)return;const f=this.shapes.get(h)||d.cloneNode();f.setPosition(d.getPosition()),f.id=d.id,this.shapes.has(h)?Object.entries(d.attributes).forEach(([p,y])=>{f.style[p]!==y&&(f.style[p]=y)}):(this.canvas.appendChild(f),this.shapes.set(h,f));const v=i.getElementType(h),g=this.getElementStyle(v,u);f.update(g)};s.forEach(c),o.forEach(c),this.shapes.forEach((u,h)=>{l.has(h)||(u.destroy(),this.shapes.delete(h))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:l}=n,{graph:c,canvas:u}=this.context,h=c.getCanvasByClient([a,s]),d=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||bn(h,d)>this.r)return;const{maxR:f,minR:v}=this.options,g=o+l>0?1/(1-Xb):1-Xb,p=Math.min(...u.getSize())/2;this.r=Math.max(v||0,Math.min(f||p,this.r*g)),this.renderLens(d),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=yr(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||bn(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=yr(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(Bt.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(Bt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(Bt.DRAG_START,this.onDragStart),a.addEventListener(Bt.DRAG,this.onDrag),a.addEventListener(Bt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(Bt.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(Bt.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(Bt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(Bt.DRAG_START,this.onDragStart),a.removeEventListener(Bt.DRAG,this.onDrag),a.removeEventListener(Bt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(Bt.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()}}bh.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const aD={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},Kb=.05,Qb=.1;class xh extends hr{constructor(t,e){super(t,Object.assign({},xh.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=yr(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},aD,this.options.style);this.isLensOn||(this.lens=new Ds({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Bi(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(c=>{const u=ir(c),h=bn(u,i);if(h>this.r)return;const d=a*h/(this.d*h+this.r),[f,v]=u,[g,p]=i,y=(f-g)/h,b=(v-p)/h,E=[g+d*y,p+d*b],O=At(c),P=this.getNodeStyle(c),R=Bs(n.getElementRenderStyle(O),Object.keys(P));s.set(O,Object.assign(Object.assign({},Bi(E)),P)),o.set(O,Object.assign(Object.assign({},Bi(u)),R))}),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:l,keep:c}=ja(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),d=>d),u=new Set,h=(d,f)=>{const v=s.getElement(d);v==null||v.update(f),a.getRelatedEdgesData(d).forEach(g=>{u.add(At(g))})};[...o,...c].forEach(d=>{h(d,n.get(d))}),l.forEach(d=>{h(d,this.prevOriginStyleMap.get(d)),this.prevOriginStyleMap.delete(d)}),u.forEach(d=>{const f=s.getElement(d);f==null||f.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((d,f)=>{this.prevOriginStyleMap.has(f)||this.prevOriginStyleMap.set(f,d)})},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!(bn(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-Kb):1-Kb,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+Qb:this.d-Qb;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=yr(n.canvas),a=this.lens.getCenter();return!(bn(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=yr(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(Bt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(Bt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(Bt.DRAG_START,this.onDragStart),s.addEventListener(Bt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(Bt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(Bt.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(Bt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(Bt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(Bt.DRAG_START,this.onDragStart),s.removeEventListener(Bt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(Bt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(Bt.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()}}xh.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class Eh extends hr{constructor(t,e){super(t,Object.assign({},Eh.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 go(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||!sD()||this.$el.requestFullscreen().catch(t=>{Xr.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()}}Eh.defaultOptions={trigger:{},autoFit:!0};function sD(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class wh extends hr{constructor(t,e){super(t,Object.assign({},wh.defaultOptions,e)),this.$element=So("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 l=a/o,c=Di(s||this.context.graph.getCanvasCenter(),1-l),u=this.baseSize*a,h=Di(this.offset,l),d=Yf(h,u),f=Ne(d,c);this.$element.style.backgroundSize=`${u}px ${u}px`,this.$element.style.backgroundPosition=`${f[0]}px ${f[1]}px`,this.offset=Yf(f,u)},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(Kt.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=Yf(Ne(this.offset,t),e),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}parseFollow(t){var e,n;return Uo(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(Kt.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}wh.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function Kv(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=At(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 qb(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:l=[],ComboRemoved:c=[]}=Xc(r,u=>u.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:l},remove:{nodes:n,edges:s,combos:c}}}function Jb(r,t){for(const e in r)zn(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),Jb(r[e],t[e])):t[e]===void 0&&(t[e]=hl(e))}function oD(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=qb(Kv(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);let d=Object.assign({},l.original);if(e){const f=e.graph.getElementType(At(l.original)),v=f==="edge"?"stroke":"fill",g=e.element.getElementComputedStyle(f,l.original);d=Object.assign(Object.assign({},l.original),{style:Object.assign({[v]:g[v]},l.original.style)})}Jb(h,d),(c=n.current.update)[o]||(c[o]=[]),n.current.update[o].push(h),(u=n.original.update)[o]||(u[o]=[]),n.original.update[o].push(d)}),i[o]&&i[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.add)[o]||(c[o]=[]),n.current.add[o].push(h),(u=n.original.remove)[o]||(u[o]=[]),n.original.remove[o].push(h)}),s[o]&&s[o].forEach(l=>{var c,u;const h=Object.assign({},l.value);(c=n.current.remove)[o]||(c[o]=[]),n.current.remove[o].push(h),(u=n.original.add)[o]||(u[o]=[]),n.original.add[o].push(h)})}),n}class Sh extends hr{constructor(t,e){super(t,Object.assign({},Sh.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,l;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const c=a?i.original:i.current;this.context.graph.addData(c.add),this.context.graph.updateData(c.update),this.context.graph.removeData(yy(c.remove,!1)),(l=this.context.element)===null||l===void 0||l.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===Kt.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(oD(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(Ia.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 Uu;const{graph:n}=this.context;n.on(Kt.AFTER_DRAW,this.addCommand),n.on(Kt.BATCH_START,this.initBatchCommand),n.on(Kt.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(Ia.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(Ia.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(Ia.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(Ia.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(Ia.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(Kt.AFTER_DRAW,this.addCommand),t.off(Kt.BATCH_START,this.initBatchCommand),t.off(Kt.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}Sh.defaultOptions={stackSize:0};const Qv={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 lD{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 l=n;l<=a;l++){const c=this.cellPoints(o,l);for(const u of c)s.push(u)}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 cD(r,t){return new lD(r,t)}const $b=+(Math.pow(2,27)+1);function Mh(r,t,e){const n=r*t,i=$b*r,a=i-r,s=i-a,o=r-s,l=$b*t,c=l-t,u=l-c,h=t-u,v=n-s*u-o*u-s*h,g=o*h-v;return e?(e[0]=g,e[1]=n,e):[g,n]}function uD(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 hD(r,t){const e=r.length;if(e===1){const o=Mh(r[0],t);return o[0]?o:[o[1]]}const n=new Array(2*e),i=[.1,.1],a=[.1,.1];let s=0;Mh(r[0],t,i),i[0]&&(n[s++]=i[0]);for(let o=1;o=n?(v=u,o+=1,o=n?(v=u,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 l=pD*o;return s>=l||s<=-l?s:ED(t,e,n)},function(t,e,n,i){const a=t[0]-i[0],s=e[0]-i[0],o=n[0]-i[0],l=t[1]-i[1],c=e[1]-i[1],u=n[1]-i[1],h=t[2]-i[2],d=e[2]-i[2],f=n[2]-i[2],v=s*u,g=o*c,p=o*l,y=a*u,b=a*c,E=s*l,O=h*(v-g)+d*(p-y)+f*(b-E),P=(Math.abs(v)+Math.abs(g))*Math.abs(h)+(Math.abs(p)+Math.abs(y))*Math.abs(d)+(Math.abs(b)+Math.abs(E))*Math.abs(f),R=mD*P;return O>R||-O>R?O:wD(t,e,n,i)}];function SD(r){let t=Vs[r.length];return t||(t=Vs[r.length]=Th(r.length)),t.apply(void 0,...r)}function MD(r,t,e,n,i,a,s){return function(...l){switch(l.length){case 0:case 1:return 0;case 2:return n(l[0],l[1]);case 3:return i(l[0],l[1],l[2]);case 4:return a(l[0],l[1],l[2],l[3]);case 5:return s(l[0],l[1],l[2],l[3],l[4])}return r(l)}}function AD(){for(;Vs.length<=tx;)Vs.push(Th(Vs.length));const r=MD(void 0,SD,...Vs);for(let t=0;t<=tx;++t)r[t]=Vs[t];return r}var _l=AD();const ex=_l[3];function TD(r){const t=r.length;if(t<3){const o=new Array(t);for(let l=0;l{const c=r[o][0]-r[l][0];return c||r[o][1]-r[l][1]});const n=[e[0],e[1]],i=[e[0],e[1]];for(let o=2;o1&&ex(r[n[u-2]],r[n[u-1]],c)<=0;)u-=1,n.pop();for(n.push(l),u=i.length;u>1&&ex(r[i[u-2]],r[i[u-1]],c)>=0;)u-=1,i.pop();i.push(l)}const a=new Array(i.length+n.length-2);let s=0;for(let o=0,l=n.length;o0;--o)a[s++]=i[o];return a}function OD(r,t,e,n){for(let i=0;i<2;++i){const a=r[i],s=t[i],[o,l]=[Math.min(a,s),Math.max(a,s)],c=e[i],u=n[i],[h,d]=[Math.min(c,u),Math.max(c,u)];if(d0&&a>0||i<0&&a<0)return!1;const s=_l(e,r,t),o=_l(n,r,t);return s>0&&o>0||s<0&&o<0?!1:i===0&&a===0&&s===0&&o===0?OD(r,t,e,n):!0}function ND(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 RD(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 LD(r,t,e){let n=null,i=ax,a=ax,s,o;for(let l=0;li&&o>a&&!rx([r[0],t[l]],e)&&!rx([r[1],t[l]],e)&&(i=s,a=o,n=t[l]);return n}function ix(r,t,e,n,i){let a=!1;for(let s=0;sh||e[1]>d));h>=e[0]&&d>=e[1]&&i.add(l),f!==null&&(r.splice(s+1,0,f),n.removePoint(f),a=!0)}return a?ix(r,t,e,n,i):r}function _D(r,t,e){const n=t||20,i=ND(kD(Qv.toXy(r,e)));if(i.length<4){const h=i.concat([i[0]]);return e?Qv.fromXy(h,e):h}const a=PD(i),s=[a[0]*sx,a[1]*sx],o=TD(i).reverse().map(h=>i[h]);o.push(o[0]);const l=i.filter(function(h){return o.indexOf(h)<0}),c=Math.ceil(1/(i.length/(a[0]*a[1]))),u=ix(o,Math.pow(n,2),s,cD(l,c),new Set);return e?Qv.fromXy(u,e):u}const ax=Math.cos(90/(180/Math.PI)),sx=.6;function DD(r,t,e){if(r.length===1)return ID(r[0],t,e);if(r.length===2)return ox(r,t,e);if(r.length===3){const[n,i,a]=Xf(r);if(Ny(n,i,a))return ox([n,a],t,e)}switch(e){case"smooth":return FD(r,t);case"sharp":return zD(r,t);case"rounded":default:return BD(r,t)}}const ID=(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]]},ox=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?Ne(r[0],Za(ma(ln(r[0],r[1])),t)):r[0],a=e==="sharp"?Ne(r[1],Za(ma(ln(r[1],r[0])),t)):r[1],s=Za(ma(hu(ln(i,a),!1)),t),o=Za(s,-1),l=Ne(i,s),c=Ne(a,s),u=Ne(a,o),h=Ne(i,o);return e==="sharp"?[["M",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["L",h[0],h[1]],["Z"]]:[["M",l[0],l[1]],["L",c[0],c[1]],["A",...n,u[0],u[1]],["L",h[0],h[1]],["A",...n,l[0],l[1]]]},BD=(r,t)=>{const e=Xf(r).map((o,l)=>{const c=(l-2+r.length)%r.length,u=(l-1+r.length)%r.length,h=(l+1)%r.length,d=r[c],f=r[u],v=r[h],g=ln(d,f),p=ln(f,o),y=ln(o,v),b=(F,I)=>Uf(F,I,!0)Za(ma(hu(F,!1)),t),R=P(p);return[{p:Rs(E?Ne(f,P(g)):Ne(f,R)),concave:E&&f},{p:Rs(O?Ne(o,P(y)):Ne(o,R)),concave:O&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,l)=>!e[(l-1+e.length)%e.length][0].concave&&!e[(l-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,l)=>{const c=[],u=a[e.length-1];return l===0&&c.push(["M",...u[1].p]),o[0].concave?s.push(o[0].p,o[1].p):c.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):c.push(["L",...o[1].p]),s.length===3&&(c.pop(),c.push(["C",...s.flat()]),s=[]),c})},FD=(r,t)=>{const e=Xf(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:ma(ln(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=ma(Ne(s,Za(n.v,Uf(s,n.v,!0)n.p))},zD=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],l=pl(Za(ma(hu(ln(o,a),!1)),t));return[Ne(o,l),Ne(a,l)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],l=[n[(s+1)%n.length],n[(s+2)%n.length]];return Hf(o,l,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var jD=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 wl({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Wn(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(At(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(c=>i.getNodeData(c)),o=_D(s.map(ir),this.options.concavity).slice(1).reverse(),l=o.flatMap(c=>s.filter(u=>Wn(ir(u),c)).map(At));return Wn(l,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=l,this.path=DD(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(Kt.AFTER_RENDER,this.drawHull),this.context.graph.on(Kt.AFTER_ELEMENT_UPDATE,this.updateHullPath)}unbindEvents(){this.context.graph.off(Kt.AFTER_RENDER,this.drawHull),this.context.graph.off(Kt.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=jD(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=fe(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()}}Oh.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function lx(r,t){t(r),r.children&&r.children.forEach(function(e){e&&lx(e,t)})}function Dl(r){Ch(r,!0)}function ji(r){Ch(r,!1)}function Ch(r,t){var e=t?"visible":"hidden";lx(r,function(n){n.attr("visibility",e)})}var ZD=5,cx=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=ZD),Object.entries(t).forEach(function(i){var a=(0,G.CR)(i,2),s=a[0],o=a[1],l=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?vo(o)?(vo(r[s])||(l[s]={}),e="A"&&e<="Z"};function ke(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=(0,G.CR)(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(Nh(s,"show")&&Nh(hx(s,"show"),t)!==e)s===YD(t,"show")?n[s]=o:n[s.replace(new RegExp(Jv(t)),"")]=o;else if(!Nh(s,"show")&&Nh(s,t)!==e){var l=hx(s,t);l==="filter"&&typeof o=="function"||(n[l]=o)}}}),n}function Mo(r,t){return Object.entries(r).reduce(function(e,n){var i=(0,G.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(Jv(a))]=s,e},{})}function wa(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,G.CR)(a,2),o=s[0],l=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=l:n[o]=l)}),[n,i]}var XD=function(r){if(!Wr(r))return[];for(var t=[],e=0;e=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function oj(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],l=s-n,c=o-i;return new Cr(n,i,l,c)}var Zi=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=(0,G.CR)(i,2),s=a[0],o=a[1],l=e(o);return[s,{name:l,class:".".concat(l),id:"#".concat(l),toString:function(){return l}}]}));return Object.assign(n,{prefix:e}),n};function kh(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function xr(r){if(ie(r))return[r,r,r,r];if(Wr(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 Qr(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)}var dx=Zi({text:"text"},"title");function tI(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),l=t.getBBox(),c=kh(n),u=(0,G.CR)(xr(s?i:0),4),h=u[0],d=u[1],f=u[2],v=u[3],g=(0,G.CR)(xr(a),4),p=g[0],y=g[1],b=g[2],E=g[3],O=(0,G.CR)([v+d,h+f],2),P=O[0],R=O[1],F=(0,G.CR)([E+y,p+b],2),I=F[0],V=F[1];if(c[0]==="l")return new Cr(o.x,o.y,l.width+o.width+P+I,Math.max(l.height+V,o.height));if(c[0]==="t")return new Cr(o.x,o.y,Math.max(l.width+I,o.width),l.height+o.height+R+V);var Y=(0,G.CR)([t.attributes.width||l.width,t.attributes.height||l.height],2),J=Y[0],$=Y[1];return new Cr(l.x,l.y,J+o.width+P+I,$+o.height+R+V)}function eI(r,t){var e=Object.entries(t).reduce(function(n,i){var a=(0,G.CR)(i,2),s=a[0],o=a[1],l=r.node().attr(s);return l||(n[s]=o),n},{});r.styles(e)}function nI(r){var t,e,n,i,a=r,s=a.width,o=a.height,l=a.position,c=(0,G.CR)([+s/2,+o/2],2),u=c[0],h=c[1],d=(0,G.CR)([+u,+h,"center","middle"],4),f=d[0],v=d[1],g=d[2],p=d[3],y=kh(l);return y.includes("l")&&(t=(0,G.CR)([0,"start"],2),f=t[0],g=t[1]),y.includes("r")&&(e=(0,G.CR)([+s,"end"],2),f=e[0],g=e[1]),y.includes("t")&&(n=(0,G.CR)([0,"top"],2),v=n[0],p=n[1]),y.includes("b")&&(i=(0,G.CR)([+o,"bottom"],2),v=i[0],p=i[1]),{x:f,y:v,textAlign:g,textBaseline:p}}var rI=function(r){(0,G.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,l=n.inset,c=e.querySelector(dx.text.class);if(!c)return new Cr(0,0,+i,+a);var u=c.getBBox(),h=u.width,d=u.height,f=(0,G.CR)(xr(o),4),v=f[0],g=f[1],p=f[2],y=f[3],b=(0,G.CR)([0,0,+i,+a],4),E=b[0],O=b[1],P=b[2],R=b[3],F=kh(s);if(F.includes("i"))return new Cr(E,O,P,R);F.forEach(function(Nt,Ot){var mt,yt,Rt,jt;Nt==="t"&&(mt=(0,G.CR)(Ot===0?[d+p,+a-d-p]:[0,+a],2),O=mt[0],R=mt[1]),Nt==="r"&&(yt=(0,G.CR)([+i-h-y],1),P=yt[0]),Nt==="b"&&(Rt=(0,G.CR)([+a-d-v],1),R=Rt[0]),Nt==="l"&&(jt=(0,G.CR)(Ot===0?[h+g,+i-h-g]:[0,+i],2),E=jt[0],P=jt[1])});var I=(0,G.CR)(xr(l),4),V=I[0],Y=I[1],J=I[2],$=I[3],ot=(0,G.CR)([$+Y,V+J],2),ct=ot[0],ft=ot[1];return new Cr(E+$,O+V,P-ct,R-ft)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new Cr(0,0,0,0)},t.prototype.render=function(e,n){var i=this,a=e.width,s=e.height,o=e.position,l=e.spacing,c=(0,G._T)(e,["width","height","position","spacing"]),u=(0,G.CR)(wa(c),1),h=u[0],d=nI(e),f=d.x,v=d.y,g=d.textAlign,p=d.textBaseline;Qr(!!c.text,ve(n),function(y){i.title=y.maybeAppendByClassName(dx.text,"text").styles(h).call(eI,{x:f,y:v,textAlign:g,textBaseline:p}).node()})},t}(Ln),t0=function(){};function qr(r,t){return fe(r)?r.apply(void 0,(0,G.ev)([],(0,G.CR)(t),!1)):r}function iI(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function aI(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function fx(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,G.CR)(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return aI(r)?r[n]===!1?[n,!1]:[n,(0,G.pi)((0,G.pi)({},r[n]),e)]:[n,e]}))}function Ao(r,t){r?r.finished.then(t):t()}function sI(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function vx(r,t){"update"in r?r.update(t):r.attr(t)}function gx(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return vx(r,{style:n}),null}return r.animate(t,e)}function oI(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function lI(r,t,e,n){if(n===void 0&&(n="destroy"),oI(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&ji(r),t.isVisible()&&Dl(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,l=o===void 0?0:o,c=Math.ceil(+s/2),u=+s/4,h=(0,G.CR)(r.getGeometryBounds().center,2),d=h[0],f=h[1],v=(0,G.CR)(t.getGeometryBounds().center,2),g=v[0],p=v[1],y=(0,G.CR)([(d+g)/2-d,(f+p)/2-f],2),b=y[0],E=y[1],O=r.style.opacity,P=O===void 0?1:O,R=t.style.opacity,F=R===void 0?1:R,I=r.style.transform||"",V=t.style.transform||"",Y=r.animate([{opacity:P,transform:"translate(0, 0) ".concat(I)},{opacity:0,transform:"translate(".concat(b,", ").concat(E,") ").concat(I)}],(0,G.pi)((0,G.pi)({fill:"both"},e),{duration:l+c+u})),J=t.animate([{opacity:0,transform:"translate(".concat(-b,", ").concat(-E,") ").concat(V),offset:.01},{opacity:F,transform:"translate(0, 0) ".concat(V)}],(0,G.pi)((0,G.pi)({fill:"both"},e),{duration:c+u,delay:l+c-u}));return Ao(J,i),[Y,J]}function Wi(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=(0,G.CR)(a,2),o=s[0],l=s[1];if(!me(l)){var c=r.style[o]||r.parsedStyle[o]||0;c!==l&&(n[o]=c,i[o]=l)}}),e?gx(r,[n,i],(0,G.pi)({fill:"both"},e)):(vx(r,i),null)}function cI(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 e0(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 px=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"]]},uI=px,hI=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"]]},dI=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},fI=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"]]},vI=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"]]},gI=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"]]},pI=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"]]},mx=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},mI=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]]},yI=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]]},bI=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},xI=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},yx=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},EI=yx,wI=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]]},SI=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]]},MI=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]]},AI=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 TI(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 OI=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]},CI=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]]},Si=Zi({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"),NI=function(r){(0,G.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:OI(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 rr({class:Si.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new rr({class:Si.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return kn(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,G.CR)(cI(e.map(function(h){var d=h.getBBox(),f=d.width,v=d.height;return[f,v]})).map(function(h){return Math.max.apply(Math,(0,G.ev)([],(0,G.CR)(h),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,l=o===void 0?i:o,c=s.pageHeight,u=c===void 0?a:c;return{pageWidth:l,pageHeight:u}},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,l=s.pageHeight;return new Cr(n,i,o+a.width,l)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,l=a.playWindow,c=a.pageViews;if(o!=="idle"||e<0||c.length<=0||e>=c.length)return null;c[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var u=(0,G.CR)(this.getFollowingPageDiff(e),2),h=u[0],d=u[1];this.playState="running";var f=gx(l,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-h,", ").concat(-d,")")}],i);return Ao(f,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),f},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:kn(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:kn(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(Si.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)?Dl(n):ji(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,l=s.controllerPadding,c=a.getBBox(),u=c.width,h=c.height,d=(0,G.CR)(o==="horizontal"?[-180,0]:[-90,90],2),f=d[0],v=d[1];n.setLocalEulerAngles(f),i.setLocalEulerAngles(v);var g=n.getBBox(),p=g.width,y=g.height,b=i.getBBox(),E=b.width,O=b.height,P=Math.max(p,u,E),R=o==="horizontal"?{offset:[[0,0],[p/2+l,0],[p+u+l*2,0]],textAlign:"start"}:{offset:[[P/2,-y-l],[P/2,0],[P/2,O+l]],textAlign:"center"},F=(0,G.CR)(R.offset,3),I=(0,G.CR)(F[0],2),V=I[0],Y=I[1],J=(0,G.CR)(F[1],2),$=J[0],ot=J[1],ct=(0,G.CR)(F[2],2),ft=ct[0],Nt=ct[1],Ot=R.textAlign,mt=a.querySelector("text");mt&&(mt.style.textAlign=Ot),n.setLocalPosition(V,Y),a.setLocalPosition($,ot),i.setLocalPosition(ft,Nt)},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(Si.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,l=e=2,c=e.maybeAppendByClassName(Si.controller,"g");if(Ch(c.node(),l),!!l){var u=ke(this.attributes,"button"),h=ke(this.attributes,"pageNum"),d=(0,G.CR)(wa(u),2),f=d[0],v=d[1],g=f.size,p=(0,G._T)(f,["size"]),y=!c.select(Si.prevBtnGroup.class).node(),b=c.maybeAppendByClassName(Si.prevBtnGroup,"g").styles(v);this.prevBtnGroup=b.node();var E=b.maybeAppendByClassName(Si.prevBtn,"path"),O=c.maybeAppendByClassName(Si.nextBtnGroup,"g").styles(v);this.nextBtnGroup=O.node();var P=O.maybeAppendByClassName(Si.nextBtn,"path");[E,P].forEach(function(F){F.styles((0,G.pi)((0,G.pi)({},p),{transformOrigin:"center"})),e0(F.node(),g,!0)});var R=c.maybeAppendByClassName(Si.pageInfoGroup,"g");this.pageInfoGroup=R.node(),R.maybeAppendByClassName(Si.pageInfo,"text").styles(h),this.updatePageInfo(),c.node().setLocalPosition(s+i,o/2),y&&(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 l=ve(n);this.renderClipPath(l),this.renderController(l),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Cl(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(De.INSERTED,n),this.playWindow.addEventListener(De.REMOVED,n)},t}(Ln);function kI(r){var t="default";if(zn(r)&&r instanceof Image)t="image";else if(fe(r))t="symbol";else if(Ge(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 PI(r){var t=kI(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var en=function(r){(0,G.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,l=this.getSubShapeStyle(e),c=l.symbol,u=l.size,h=u===void 0?16:u,d=(0,G._T)(l,["symbol","size"]),f=PI(c);Qr(!!f,ve(n),function(v){v.maybeAppendByClassName("marker",f).attr("className","marker ".concat(f,"-marker")).call(function(g){if(f==="image"){var p=h*2;g.styles({img:c,width:p,height:p,x:a-h,y:o-h})}else{var p=h/2,y=fe(c)?c:t.getSymbol(c);g.styles((0,G.pi)({d:y==null?void 0:y(a,o,p)},d))}})})},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}(Ln);en.registerSymbol("cross",mI),en.registerSymbol("hyphen",xI),en.registerSymbol("line",mx),en.registerSymbol("plus",bI),en.registerSymbol("tick",yI),en.registerSymbol("circle",px),en.registerSymbol("point",uI),en.registerSymbol("bowtie",pI),en.registerSymbol("hexagon",gI),en.registerSymbol("square",hI),en.registerSymbol("diamond",dI),en.registerSymbol("triangle",fI),en.registerSymbol("triangle-down",vI),en.registerSymbol("line",mx),en.registerSymbol("dot",yx),en.registerSymbol("dash",EI),en.registerSymbol("smooth",wI),en.registerSymbol("hv",SI),en.registerSymbol("vh",MI),en.registerSymbol("hvh",AI),en.registerSymbol("vhv",TI),en.registerSymbol("focus",CI);function lj(r,t,e){var n=Math.round((r-e)/t);return e+n*t}function RI(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 bx=1.4,xx=.4;function LI(r,t,e){var n=e,i=n*bx,a=n/2,s=n/6,o=r+i*xx;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 _I(r,t,e){var n=e,i=n*bx,a=n/2,s=n/6,o=t+i*xx;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]]}en.registerSymbol("hiddenHandle",RI),en.registerSymbol("verticalHandle",LI),en.registerSymbol("horizontalHandle",_I);var cj=function(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e};function uj(r,t,e,n){var i;n===void 0&&(n=4);var a=__read(r,2),s=a[0],o=a[1],l=__read(t,2),c=l[0],u=l[1],h=__read(e,2),d=h[0],f=h[1],v=__read([c,u],2),g=v[0],p=v[1],y=p-g;return g>p&&(i=__read([p,g],2),g=i[0],p=i[1]),y>o-s?[s,o]:go?f===o&&d===g?[g,o]:[o-y,o]:[g,p]}function n0(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}function hj(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 Ex(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=(0,G.CR)([e,n],2),a=(0,G.CR)(i[0],2),s=a[0],o=a[1],l=(0,G.CR)(i[1],2),c=l[0],u=l[1];return{x:s,y:o,width:c-s,height:u-o,left:s,bottom:u,top:o,right:c}}function dj(r,t){var e=select(r).append("text").node();return e.attr(__assign(__assign({},t),{visibility:"hidden"})),e}function DI(r,t){var e=(0,G.CR)(r,2),n=e[0],i=e[1],a=(0,G.CR)(t,2),s=a[0],o=a[1];return n!==s&&i===o}function fj(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 II(r,t){var e,n,i=t.attributes;try{for(var a=(0,G.XA)(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=(0,G.CR)(s.value,2),l=o[0],c=o[1];l!=="id"&&l!=="className"&&r.attr(l,c)}}catch(u){e={error:u}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function Sa(r){return typeof r=="function"?r():Ge(r)||ie(r)?new $v({style:{text:String(r)}}):r}function BI(r,t){return typeof r=="function"?r():Ge(r)||ie(r)?new co({style:(0,G.pi)((0,G.pi)({},t),{innerHTML:String(r)})}):r}var Ph,r0;function vj(r){r0=r}var FI=Zv(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return r0?r0(r,e):(Ph||(Ph=Vt.offscreenCanvasCreator.getOrCreateContext(void 0)),Ph.font=[a,s,i,"".concat(e,"px"),n].join(" "),Ph.measureText(r).width)},function(r,t){return[r,Object.values(t||wx(r)).join()].join("")},4096),wx=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 Sx(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function Mx(r,t){var e=Sx(r);e&&e.attr(t)}function i0(r,t,e){e===void 0&&(e="..."),Mx(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function a0(r,t){for(var e in t)t.hasOwnProperty(e)&&e!=="constructor"&&t[e]!==void 0&&(r[e]=t[e])}function zI(r,t,e,n){return t&&a0(r,t),e&&a0(r,e),n&&a0(r,n),r}function jI(r){return r instanceof Element||r instanceof Document}var Ie,ZI="component-poptip",Re={CONTAINER:"component-poptip",ARROW:"component-poptip-arrow",TEXT:"component-poptip-text"},Ax=(Ie={},Ie[".".concat(Re.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"},Ie[".".concat(Re.TEXT)]={"text-align":"center"},Ie[".".concat(Re.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, -100%)"},Ie[".".concat(Re.CONTAINER,"[data-position='left']")]={transform:"translate(-100%, -50%)"},Ie[".".concat(Re.CONTAINER,"[data-position='right']")]={transform:"translate(0, -50%)"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},Ie[".".concat(Re.CONTAINER,"[data-position='top-left']")]={transform:"translate(0,-100%)"},Ie[".".concat(Re.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},Ie[".".concat(Re.CONTAINER,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},Ie[".".concat(Re.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},Ie[".".concat(Re.CONTAINER,"[data-position='right-top']")]={transform:"translate(0, 0)"},Ie[".".concat(Re.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},Ie[".".concat(Re.ARROW)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},Ie[".".concat(Re.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},Ie["[data-position='top'] .".concat(Re.ARROW)]={bottom:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},Ie["[data-position='left'] .".concat(Re.ARROW)]={right:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='right']")]={transform:"translate(5px, -50%)"},Ie["[data-position='right'] .".concat(Re.ARROW)]={left:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},Ie["[data-position='bottom'] .".concat(Re.ARROW)]={top:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},Ie["[data-position='top-left'] .".concat(Re.ARROW)]={left:"10px",bottom:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},Ie["[data-position='top-right'] .".concat(Re.ARROW)]={right:"10px",bottom:"-2px"},Ie[".".concat(Re.CONTAINER,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},Ie["[data-position='left-top'] .".concat(Re.ARROW)]={right:"-2px",top:"8px"},Ie[".".concat(Re.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},Ie["[data-position='left-bottom'] .".concat(Re.ARROW)]={right:"-2px",bottom:"8px"},Ie[".".concat(Re.CONTAINER,"[data-position='right-top']")]={transform:"translate(5px, 0)"},Ie["[data-position='right-top'] .".concat(Re.ARROW)]={left:"-2px",top:"8px"},Ie[".".concat(Re.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},Ie["[data-position='right-bottom'] .".concat(Re.ARROW)]={left:"-2px",bottom:"8px"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},Ie["[data-position='bottom-left'] .".concat(Re.ARROW)]={top:"-2px",left:"8px"},Ie[".".concat(Re.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},Ie["[data-position='bottom-right'] .".concat(Re.ARROW)]={top:"-2px",right:"8px"},Ie),WI=void 0;function GI(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,l=s.y,c=s.width,u=s.height;switch(n){case"top":return i?[o+c/2,l]:[r,l];case"left":return i?[o,l+u/2]:[o,t];case"bottom":return i?[o+c/2,l+u]:[r,l+u];case"right":return i?[o+c,l+u/2]:[o+c,t];case"top-right":case"right-top":return[o+c,l];case"left-bottom":case"bottom-left":return[o,l+u];case"right-bottom":case"bottom-right":return[o+c,l+u];case"top-left":case"left-top":default:return[o,l]}}var VI=function(r){var t;return function(){for(var e=[],n=0;n');e.innerHTML=o,Ge(a)?e.innerHTML+=a:a&&jI(a)&&e.appendChild(a),s&&(e.getElementsByClassName(Re.TEXT)[0].textContent=s),this.applyStyles(),this.container.style.visibility=this.visibility},t.prototype.applyStyles=function(){var e=Jn({},Ax,this.style.domStyles),n=Object.entries(e).reduce(function(a,s){var o=(0,G.CR)(s,2),l=o[0],c=o[1],u=Object.entries(c).reduce(function(h,d){var f=(0,G.CR)(d,2),v=f[0],g=f[1];return"".concat(h).concat(v,": ").concat(g,";")},"");return"".concat(a).concat(l,"{").concat(u,"}")},"");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,G.CR)(i,2),s=a[0],o=s===void 0?0:s,l=a[1],c=l===void 0?0:l;this.container.style.left="".concat(e+o,"px"),this.container.style.top="".concat(n+c,"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:Ax,template:'
')}},t}(Ln),Nr=Zi({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"),XI={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 KI(r){var t=r.querySelector(Nr.marker.class);return t?t.style:{}}var QI=function(r){(0,G.ZT)(t,r);function t(e){return r.call(this,e,{span:[1,1],marker:function(){return new Ji({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this}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,l=e.node().getBBox(),c=l.width,u=l.height,h=n.node().getBBox(),d=h.width,f=h.height,v=s?o!=null?o:12:0;return{markerWidth:a,labelWidth:c,valueWidth:d,focusWidth:v,height:Math.max(a,u,f)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=(0,G.CR)(xr(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,l=s.focusWidth,c=s.height,u=this.actualSpace,h=u.labelWidth,d=u.valueWidth,f=(0,G.CR)(this.spacing,3),v=f[0],g=f[1],p=f[2];if(a){var y=a-i-v-g-l-p,b=(0,G.CR)(this.span,2),E=b[0],O=b[1];e=(0,G.CR)([E*y,O*y],2),h=e[0],d=e[1]}var P=o+h+d+v+g+l+p;return{width:P,height:c,markerWidth:o,labelWidth:h,valueWidth:d,focusWidth:l}},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,G.CR)(xr(n),3),s=a[0],o=a[1],l=a[2];return[s,this.showValue?o:0,i?l: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,l=e.height,c=(0,G.CR)(this.spacing,3),u=c[0],h=c[1],d=c[2];return{height:l,width:o,markerWidth:n,labelWidth:i,valueWidth:a,focusWidth:s,position:[n/2,n+u,n+i+u+h,n+i+a+u+h+d+s/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=KI(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,l=o===void 0?e.lineWidth:o,c=n.markerStroke,u=c===void 0?e.stroke:c,h=+(s||l||(u?1:0))*Math.sqrt(2),d=this.markerGroup.node().getBBox(),f=d.width,v=d.height;return(1-h/Math.max(f,v))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes.marker,a=ke(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Nr.markerGroup,"g").style("zIndex",0),Qr(!!i,this.markerGroup,function(){var s,o=n.markerGroup.node(),l=(s=o.childNodes)===null||s===void 0?void 0:s[0],c=typeof i=="string"?new en({style:{symbol:i},className:Nr.marker.name}):i();l?c.nodeName===l.nodeName?l instanceof en?l.update((0,G.pi)((0,G.pi)({},a),{symbol:i})):(II(l,c),ve(l).styles(a)):(l.remove(),ve(c).attr("className",Nr.marker.name).styles(a),o.appendChild(c)):(c instanceof en||ve(c).attr("className",Nr.marker.name).styles(a),o.appendChild(c)),n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var u=e0(n.markerGroup.node(),n.scaleSize,!0);n.markerGroup.node().style._transform="scale(".concat(u,")")})},t.prototype.renderLabel=function(e){var n=ke(this.attributes,"label"),i=n.text,a=(0,G._T)(n,["text"]);this.labelGroup=e.maybeAppendByClassName(Nr.labelGroup,"g").style("zIndex",0),this.labelGroup.maybeAppendByClassName(Nr.label,function(){return Sa(i)}).styles(a)},t.prototype.renderValue=function(e){var n=this,i=ke(this.attributes,"value"),a=i.text,s=(0,G._T)(i,["text"]);this.valueGroup=e.maybeAppendByClassName(Nr.valueGroup,"g").style("zIndex",0),Qr(this.showValue,this.valueGroup,function(){n.valueGroup.maybeAppendByClassName(Nr.value,function(){return Sa(a)}).styles(s)})},t.prototype.createPoptip=function(){var e=this.attributes.poptip,n=e||{},i=n.render,a=(0,G._T)(n,["render"]),s=new HI({style:Jn(XI,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,l=s.valueText,c=s.markerFill,u=typeof o=="string"?o:o==null?void 0:o.attr("text"),h=typeof l=="string"?l:l==null?void 0:l.attr("text");if(typeof i.render=="function")return{html:i.render({label:u,value:h,color:c})};var d="";return(typeof u=="string"||typeof u=="number")&&(d+='
'.concat(u,"
")),(typeof h=="string"||typeof h=="number")&&(d+='
'.concat(h,"
")),{html:d}})}},t.prototype.renderFocus=function(e){var n=this,i=this.attributes,a=i.focus,s=i.focusMarkerSize,o={x:0,y:0,size:s,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};Te(a)||(this.focusGroup=e.maybeAppendByClassName(Nr.focusGroup,"g").style("zIndex",0),Qr(a,this.focusGroup,function(){var l=new en({style:(0,G.pi)((0,G.pi)({},o),{symbol:"focus"})}),c=new Ji({style:{r:o.size/2,fill:"transparent"}}),u=n.focusGroup.node();u.appendChild(c),u.appendChild(l),l.update({opacity:0}),e.node().addEventListener("pointerenter",function(){l.update({opacity:1})}),e.node().addEventListener("pointerleave",function(){l.update({opacity:0})})}))},t.prototype.renderPoptip=function(e){var n=this,i=this.attributes.poptip;if(i){var a=e.maybeAppendByClassName(Nr.value,"g").node(),s=e.maybeAppendByClassName(Nr.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=ke(this.attributes,"background");this.background=e.maybeAppendByClassName(Nr.backgroundGroup,"g").style("zIndex",-1),this.background.maybeAppendByClassName(Nr.background,"rect").styles((0,G.pi)({width:i,height:a},s))},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=(0,G.CR)(e.position,4),o=s[0],l=s[1],c=s[2],u=s[3],h=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(h,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(l,", ").concat(h,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(u,", ").concat(h,")")}),i0(this.labelGroup.select(Nr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(c,", ").concat(h,")")}),i0(this.valueGroup.select(Nr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=ve(n),a=e.x,s=a===void 0?0:a,o=e.y,l=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(l,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.renderPoptip(i),this.renderFocus(i),this.adjustLayout()},t}(Ln),Us=Zi({page:"item-page",navigator:"navigator",item:"item"},"items"),Tx=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},qI=function(r){(0,G.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:t0,mouseenter:t0,mouseleave:t0})||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,l=ke(this.attributes,"item"),c=n.map(function(u,h){var d=u.id,f=d===void 0?h:d,v=u.label,g=u.value;return{id:"".concat(f),index:h,style:(0,G.pi)({layout:i,labelText:v,valueText:g,poptip:a,focus:s,focusMarkerSize:o},Object.fromEntries(Object.entries(l).map(function(p){var y=(0,G.CR)(p,2),b=y[0],E=y[1];return[b,qr(E,[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,l=(0,G.CR)(this.navigatorShape,1),c=l[0],u=(0,G.CR)(this.grid,2),h=u[0],d=u[1],f=d*h,v=0;return this.pageViews.children.map(function(g,p){var y,b,E=Math.floor(p/f),O=p%f,P=e.ifHorizontal(d,h),R=[Math.floor(O/P),O%P];i==="vertical"&&R.reverse();var F=(0,G.CR)(R,2),I=F[0],V=F[1],Y=(a-c-(d-1)*o)/d,J=g.getBBox().height,$=(0,G.CR)([0,0],2),ot=$[0],ct=$[1];return i==="horizontal"?(y=(0,G.CR)([v,I*(J+s)],2),ot=y[0],ct=y[1],v=V===d-1?0:v+Y+o):(b=(0,G.CR)([V*(Y+o),v],2),ot=b[0],ct=b[1],v=I===h-1?0:v+J+s),{page:E,index:p,row:I,col:V,pageIndex:O,width:Y,height:J,x:ot,y:ct}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=(0,G.CR)(this.navigatorShape,1),l=o[0],c=(0,G.CR)(this.grid,2),u=c[0],h=c[1],d=(0,G.CR)([n-l,i],2),f=d[0],v=d[1],g=(0,G.CR)([0,0,0,0,0,0,0,0],8),p=g[0],y=g[1],b=g[2],E=g[3],O=g[4],P=g[5],R=g[6],F=g[7];return this.pageViews.children.map(function(I,V){var Y,J,$,ot,ct=I.getBBox(),ft=ct.width,Nt=ct.height,Ot=R===0?0:s,mt=R+Ot+ft;if(mt<=f&&Tx(O,function(Rt){return Rt0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return n0(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(Us.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(Us.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;this.flattenPage(e);var o=this.dispatchCustomEvent.bind(this);ve(e).selectAll(Us.item.class).data(this.renderData,function(l){return l.id}).join(function(l){return l.append(function(c){var u=c.style;return new QI({style:u})}).attr("className",Us.item.name).on("click",function(){i==null||i(this),o("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),o("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),o("itemMouseleave",{item:this})})},function(l){return l.each(function(c){var u=c.style;this.update(u)})},function(l){return l.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,G.CR)(this.navigatorShape,2),l=o[0],c=o[1];this.navigator.update(i==="grid"?{pageWidth:a-l,pageHeight:s-c}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(iI(this.itemsLayout,"page")).map(function(a){var s=(0,G.CR)(a,2),o=s[0],l=s[1];return{page:o,layouts:l}}),i=(0,G.ev)([],(0,G.CR)(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new rr({className:Us.page.name}));s.forEach(function(l){var c=l.x,u=l.y,h=l.index,d=l.width,f=l.height,v=i[h];o.appendChild(v),bl(v,"__layout__",l),v.update({x:c,y:u,width:d,height:f})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes.orientation,i=ke(this.attributes,"nav"),a=Jn({orientation:n},i),s=this;return e.selectAll(Us.navigator.class).data(["nav"]).join(function(o){return o.append(function(){return new NI({style:a})}).attr("className",Us.navigator.name).each(function(){s.navigator=this})},function(o){return o.each(function(){this.update(a)})},function(o){return o.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(ve(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new Qn(e,{detail:n});this.dispatchEvent(i)},t}(Ln),Il=Zi({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),Ox={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},gj=function(r){(0,G.ZT)(t,r);function t(e){return r.call(this,e,Ox)||this}return t.prototype.render=function(e,n){var i=ve(n).maybeAppendByClassName(Il.markerGroup,"g");this.renderMarker(i);var a=ve(n).maybeAppendByClassName(Il.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.markerSymbol,o=s===void 0?n0(a,"horizontalHandle","verticalHandle"):s;Qr(!!o,e,function(l){var c=ke(n.attributes,"marker"),u=(0,G.pi)({symbol:o},c);n.marker=l.maybeAppendByClassName(Il.marker,function(){return new en({style:u})}).update(u)})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,l=o===void 0?0:o,c=i.formatter;Qr(a,e,function(u){var h,d=ke(n.attributes,"label"),f=d.text,v=(0,G._T)(d,["text"]),g=((h=u.select(Il.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},p=g.width,y=p===void 0?0:p,b=g.height,E=b===void 0?0:b,O=(0,G.CR)(n0(s,[0,E+l,"center","top"],[y+l,0,"start","middle"]),4),P=O[0],R=O[1],F=O[2],I=O[3];u.maybeAppendByClassName(Il.label,"text").styles((0,G.pi)((0,G.pi)({},v),{x:P,y:R,text:c(f).toString(),textAlign:F,textBaseline:I}))})},t}(Ln),Cx={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},JI=Jn({},Cx,{}),pj=Jn({},Cx,Mo(Ox,"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"}),mj=.01,yj=.5,Bl=Zi({title:"title",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"),$I=function(r){(0,G.ZT)(t,r);function t(e){return r.call(this,e,JI)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,l=ke(this.attributes,"title"),c=(0,G.CR)(wa(l),2),u=c[0],h=c[1];this.titleGroup=e.maybeAppendByClassName(Bl.titleGroup,"g").styles(h);var d=(0,G.pi)((0,G.pi)({width:n,height:i},u),{text:s?o:""});this.title=this.titleGroup.maybeAppendByClassName(Bl.title,function(){return new rI({style:d})}).update(d)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,l=ke(this.attributes,"title",!0),c=(0,G.CR)(wa(l),2),u=c[0],h=c[1],d=(0,G.pi)((0,G.pi)({},u),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(Bl.itemsGroup,"g").styles((0,G.pi)((0,G.pi)({},h),{transform:"translate(".concat(i,", ").concat(a,")")}));var f=this;this.itemsGroup.selectAll(Bl.items.class).data(["items"]).join(function(v){return v.append(function(){return new qI({style:d})}).attr("className",Bl.items.name).each(function(){f.items=ve(this)})},function(v){return v.update(d)},function(v){return v.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 Cr(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):tI(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,l=o===void 0?0:o,c=i.y,u=c===void 0?0:c,h=ve(n);n.style.transform="translate(".concat(l,", ").concat(u,")"),this.renderTitle(h,a,s),this.renderItems(h,this.availableSpace),this.adjustLayout()},t}(Ln);function Rh(r){const{width:t,height:e,renderer:n}=r,i=t6(r),a=new pf({width:t,height:e,container:i,renderer:n||new Sl});return[i,a]}function t6(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=So(n,!1),{width:s,height:o,containerStyle:l}=r,[c,u]=e6(r);return Object.assign(a.style,Object.assign({position:"absolute",left:c+"px",top:u+"px",width:s+"px",height:o+"px"},l)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function e6(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,l]=Ty(n);return[o*(a-t),l*(s-e)]}var n6=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(Kt.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=br(n,[s,"id"]),l=br(n,[s,"style","labelText"]),[c]=o.split("__"),u=this.fieldMap[c].get(l)||[];a.setElementState(Object.fromEntries(u==null?void 0:u.map(h=>[h,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=br(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=br(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:l,combos:c}=a.getData(),u={},h=p=>fe(n)?n(p):n,d={node:"circle",edge:"line",combo:"rect"},f={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"},v=(p,y)=>s==null?void 0:s.getElementComputedStyle(p,y),g=(p,y)=>{p.forEach(b=>{const{id:E}=b,O=br(b,["data",h(b)]),P=(s==null?void 0:s.getElementType(y,b))||"circle",R=v(y,b),F=(y==="edge"?R==null?void 0:R.stroke:R==null?void 0:R.fill)||"#1783ff";E&&O&&O.replace(/\s+/g,"")&&(this.setFieldMap(O,E,y),u[O]||(u[O]={id:`${y}__${E}`,label:O,marker:f[P]||d[y],elementType:y,lineWidth:1,stroke:F,fill:F}))})};switch(i){case"node":g(o,"node");break;case"edge":g(l,"edge");break;case"combo":g(c,"combo");break;default:return[]}return Object.values(u)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:l,trigger:c,position:u,container:h,containerStyle:d,className:f}=n,v=n6(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),g=this.getMarkerData(s,"node"),p=this.getMarkerData(o,"edge"),y=this.getMarkerData(l,"combo"),b=[...g,...y,...p],E=Object.assign({width:i,height:a,data:b,itemMarkerLineWidth:({lineWidth:R})=>R,itemMarker:({marker:R})=>R,itemMarkerStroke:({stroke:R})=>R,itemMarkerFill:({fill:R})=>R,gridCol:g.length},v,this.getEvents()),O=new $I({className:"legend",style:E});this.category=O,this.upsertCanvas().appendChild(O),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:l,className:c}=this.options,[u,h]=Rh({width:i,height:a,graphCanvas:t,container:o,containerStyle:l,placement:s,className:"legend"});return this.container=u,c&&u.classList.add(c),this.canvas=h,this.canvas}destroy(){this.clear(),this.context.graph.off(Kt.AFTER_DRAW,this.createElement),super.destroy()}}Lh.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class _h extends hr{constructor(t,e){super(t,Object.assign({},_h.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:l,top:c,width:u,height:h}=this.mask.style,[,,d,f]=this.maskBBox;let v=parseInt(l)+s,g=parseInt(c)+o,p=parseInt(u),y=parseInt(h);v<0&&(v=0),g<0&&(g=0),v+p>i&&(v=Ja(i-p,0)),g+y>a&&(g=Ja(a-y,0)),p0?(v=Ja(v-s,0),p=qa(p+s,i)):s<0&&(p=qa(p-s,i))),y0?(g=Ja(g-o,0),y=qa(y+o,a)):o<0&&(y=qa(y-o,a))),Object.assign(this.mask.style,{left:v+"px",top:g+"px",width:p+"px",height:y+"px"});const b=parseInt(l)-v,E=parseInt(c)-g;if(b===0&&E===0)return;const O=this.context.canvas.getCamera().getZoom(),P=this.canvas.getCamera().getZoom(),R=O/P;this.context.graph.translateBy([b*R,E*R],!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=Lm(()=>{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=Cl(()=>{this.renderMinimap(),this.renderMask()},this.options.delay)}bindEvents(){const{graph:t}=this.context;t.on(Kt.AFTER_DRAW,this.onDraw),t.on(Kt.AFTER_RENDER,this.onRender),t.on(Kt.AFTER_ANIMATE,this.onRender),t.on(Kt.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Kt.AFTER_DRAW,this.onDraw),t.off(Kt.AFTER_RENDER,this.onRender),t.off(Kt.AFTER_ANIMATE,this.onRender),t.off(Kt.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(c=>n==null?void 0:n.getElement(At(c))),edges:i.edges.filter(c=>{const u=n==null?void 0:n.getElement(At(c));return u&&C1(u)}),combos:i.combos.filter(c=>n==null?void 0:n.getElement(At(c)))};if(!t)return a;const{nodes:s,edges:o,combos:l}=a;return{nodes:s.filter(c=>t(At(c),"node")),edges:o.filter(c=>t(At(c),"edge")),combos:l.filter(c=>t(At(c),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context,l=(c,u)=>{const h=At(c),d=o==null?void 0:o.getElement(h);if(!d)return;const f=d.getShape("key");let v;if(typeof s=="string"){const g=s;v=d.getShape(g).cloneNode()}else{const g=s(h,u,d);g===d?v=g.cloneNode(!0):v=g}v.setPosition(f.getPosition()),d.style.zIndex&&(v.style.zIndex=d.style.zIndex),v.id=d.id,t.appendChild(v)};t.removeChildren(),i.forEach(c=>l(c,"edge")),a.forEach(c=>l(c,"combo")),n.forEach(c=>l(c,"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,[l,c]=Rh({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&l.classList.add(i),this.container=l,this.canvas=c}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,l,c,u]=ai(s),{min:h,max:d,center:f}=e.getBounds("elements"),v=d[0]-h[0],g=d[1]-h[1],p=i-u-l,y=a-o-c,b=p/v,E=y/g,O=Math.min(b,E),P=this.createLandmark(f,f,O);n.gotoLandmark(P,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Bi(n)),s=this.canvas.canvas2Viewport(Bi(i)),o=s.x-a.x,l=s.y-a.y;return[a.x,a.y,o,l]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=qa(a+n,t),n=0),i<0&&(s=qa(s+i,e),i=0),n+a>t&&(a=Ja(t-n,0)),i+s>e&&(s=Ja(e-i,0)),[qa(n,t),qa(i,e),Ja(a,0),Ja(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()}}_h.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 qa=(r,t)=>Math.min(r,t),Ja=(r,t)=>Math.max(r,t);var s0=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};const o0={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class Dh extends hr{constructor(t,e){super(t,Object.assign({},Dh.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new As({style:Object.assign(Object.assign({},o0),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new As({style:Object.assign(Object.assign({},o0),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>s0(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:l}=this.options,{min:[c,u],max:[h,d],center:[f,v]}=i;let g=0,p=0;s!==null&&(kr(h,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,l],max:[c,u],center:[h,d]}=i;let f=null,v=null,g=null,p=null,y=null,b=null;return this.getNodes().some(E=>{if(Wn(n.id,E.id))return!1;const O=Nx(E,s).getRenderBounds(),{min:[P,R],max:[F,I],center:[V,Y]}=O;return f===null&&(kr(V,h){this.initSnapline()},this.onDrag=n=>s0(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=Nx(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 C1(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||o0.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[l,c]=this.context.canvas.getSize(),{offset:u}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:u===1/0?0:s-u,y1:a,x2:u===1/0?l:o+u,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:u===1/0?0:n-u,x2:e,y2:u===1/0?c:i+u,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Ii([t.dx,t.dy],e)}bindEvents(){return s0(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(xi.DRAG_START,this.onDragStart),t.on(xi.DRAG,this.onDrag),t.on(xi.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(xi.DRAG_START,this.onDragStart),t.off(xi.DRAG,this.onDrag),t.off(xi.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()}}Dh.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const kr=(r,t)=>Math.abs(r-t),Nx=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var kx=null,r6=null;function Ih(r){return r instanceof Date?r:new Date(r)}function i6(r){for(var t=__read(r,2),e=t[0],n=t[1],i=kx.indexOf(e),a=kx.indexOf(n),s="",o=i;o<=a;o+=1)if(s+=r6[o],o2&&(l=":"),s+=l}return s}function Fr(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 bj(r,t){return Ih(r).getTime()-Ih(t).getTime()}function xj(r,t){var e=__read([Ih(r),Ih(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 Ej(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),Fr(e,i6(["year",t]))}function a6(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i180?1:0,I=r>t?0:1,V=!1;return V?"M".concat(e,",").concat(n,",L").concat(v,",").concat(g,",A").concat(o,",").concat(l,",0,").concat(F,",").concat(I,",").concat(y,",").concat(b,",L").concat(e,",").concat(n):"M".concat(v,",").concat(g,",A").concat(o,",").concat(l,",0,").concat(F,",").concat(I,",").concat(y,",").concat(b)}function E6(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return(0,G.ev)((0,G.ev)([e,n],(0,G.CR)(i),!1),[a],!1)}function w6(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius;return r.selectAll(cn.line.class).data([{d:jx.apply(void 0,(0,G.ev)((0,G.ev)([i,a],(0,G.CR)(s),!1),[o],!1))}],function(l,c){return c}).join(function(l){return l.append("path").attr("className",cn.line.name).styles(t).styles({d:function(c){return c.d}})},function(l){return l.transition(function(){var c=this,u=y6(this,E6(this),(0,G.ev)((0,G.ev)([i,a],(0,G.CR)(s),!1),[o],!1),n.update);if(u){var h=function(){var d=br(c.attributes,"__keyframe_data__");c.style.d=jx.apply(void 0,(0,G.ev)([],(0,G.CR)(d),!1))};u.onframe=h,u.onfinish=h}return u}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function S6(r,t){var e=t.truncRange,n=t.truncShape,i=t.lineExtension}function M6(r,t,e){e===void 0&&(e=[0,0]);var n=(0,G.CR)([r,t,e],3),i=(0,G.CR)(n[0],2),a=i[0],s=i[1],o=(0,G.CR)(n[1],2),l=o[0],c=o[1],u=(0,G.CR)(n[2],2),h=u[0],d=u[1],f=(0,G.CR)([l-a,c-s],2),v=f[0],g=f[1],p=Math.sqrt(Math.pow(v,2)+Math.pow(g,2)),y=(0,G.CR)([-h/p,d/p],2),b=y[0],E=y[1];return[b*v,b*g,E*v,E*g]}function Zx(r){var t=(0,G.CR)(r,2),e=(0,G.CR)(t[0],2),n=e[0],i=e[1],a=(0,G.CR)(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function A6(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,l=t.lineExtension,c=(0,G.CR)([a,s],2),u=(0,G.CR)(c[0],2),h=u[0],d=u[1],f=(0,G.CR)(c[1],2),v=f[0],g=f[1],p=(0,G.CR)(l?M6(a,s,l):new Array(4).fill(0),4),y=p[0],b=p[1],E=p[2],O=p[3],P=function(mt){return r.selectAll(cn.line.class).data(mt,function(yt,Rt){return Rt}).join(function(yt){return yt.append("line").attr("className",function(Rt){return"".concat(cn.line.name," ").concat(Rt.className)}).styles(e).transition(function(Rt){return Wi(this,Zx(Rt.line),!1)})},function(yt){return yt.styles(e).transition(function(Rt){var jt=Rt.line;return Wi(this,Zx(jt),n.update)})},function(yt){return yt.remove()}).transitions()};if(!i||!o)return P([{line:[[h+y,d+b],[v+E,g+O]],className:cn.line.name}]);var R=(0,G.CR)(o,2),F=R[0],I=R[1],V=v-h,Y=g-d,J=(0,G.CR)([h+V*F,d+Y*F],2),$=J[0],ot=J[1],ct=(0,G.CR)([h+V*I,d+Y*I],2),ft=ct[0],Nt=ct[1],Ot=P([{line:[[h+y,d+b],[$,ot]],className:cn.lineFirst.name},{line:[[ft,Nt],[v+E,g+O]],className:cn.lineSecond.name}]);return S6(r,t),Ot}function T6(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,l=e.lineArrowSize,c;if(t==="arc"?c=r.select(cn.line.class):a?c=r.select(cn.lineSecond.class):c=r.select(cn.line.class),!i||!s||e.type==="arc"&&zx(e.startAngle,e.endAngle)){var u=c.node();u&&(u.style.markerEnd=void 0);return}var h=Sa(s);h.attr(n),e0(h,l,!0),c.style("markerEnd",h).style("markerEndOffset",-o)}function O6(r,t,e){var n=t.type,i,a=ke(t,"line");return n==="linear"?i=A6(r,t,Dx(a,"arrow"),e):i=w6(r,t,Dx(a,"arrow"),e),T6(r,n,t,a),i}function C6(r,t){return f0(r,t.gridDirection,t)}function Wx(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function N6(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=(0,G.CR)(zh(a,t),2),o=s[0],l=s[1],c=(0,G.CR)(Ma(C6(a,t),e),2),u=c[0],h=c[1];return{id:i,points:[[o,l],[o+u,l+h]]}})}function k6(r,t){var e=t.gridControlAngles,n=Wx(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,G.CR)(n,2),a=i[0],s=i[1];return r.map(function(o,l){var c=o.value,u=(0,G.CR)(zh(c,t),2),h=u[0],d=u[1],f=(0,G.CR)([h-a,d-s],2),v=f[0],g=f[1],p=[];return e.forEach(function(y){var b=To(y),E=(0,G.CR)([Math.cos(b),Math.sin(b)],2),O=E[0],P=E[1],R=v*O-g*P+a,F=v*P+g*O+s;p.push([R,F])}),{points:p,id:l}})}function P6(r,t,e,n){var i=ke(e,"grid"),a=i.type,s=i.areaFill,o=Wx(e),l=d0(t,e.gridFilter),c=a==="segment"?N6(l,e):k6(l,e),u=(0,G.pi)((0,G.pi)({},i),{center:o,areaFill:fe(s)?l.map(function(h,d){return qr(s,[h,d,l])}):s,animate:n,data:c});return r.selectAll(cn.grid.class).data([1]).join(function(h){return h.append(function(){return new v6({style:u})}).attr("className",cn.grid.name)},function(h){return h.transition(function(){return this.update(u)})},function(h){return h.remove()}).transitions()}function Er(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,b=n-l,E=i-c,O=d*E-f*b;if(O<0===y)return!1;var P=v*E-g*b;return!(P<0===y||O>p===y||P>p===y)}function Ux(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 Vx(t,n)})}var Tj={lineToLine:Vx,intersectBoxLine:Ux,getBounds:jh};function z6(r,t,e){var n,i,a=jh(r,e).flat(1),s=jh(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 l=(0,G.XA)(o),c=l.next();!c.done;c=l.next()){var u=c.value;if(Ux(s,u))return!0}}catch(h){n={error:h}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}return!1}function j6(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,G.CR)(a,2),l=o[0],c=o[1],u=n==="negative"?0:i,h=-s-u,d=s+u,f=(0,G.CR)(xr(t),4),v=f[0],g=f[1],p=f[2],y=f[3];return new g0(l+h-y,c+h-v,l+d+g,c+d+p)}var b=(0,G.CR)(r.startPos,2),E=b[0],O=b[1],P=(0,G.CR)(r.endPos,2),R=P[0],F=P[1],I=(0,G.CR)(Fx(r)?[-t,0,t,0]:[0,t,0,-t],4),V=I[0],Y=I[1],J=I[2],$=I[3],ot=Co(0,r),ct=Ma(ot,i),ft=new g0(E,O,R,F);return ft.x1+=$,ft.y1+=V,ft.x2+=Y+ct[0],ft.y2+=J+ct[1],ft}function Zh(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,l=j6(t,a),c=function(v){return l?F6(l,v):!0},u=function(v,g){return!v||!v.firstChild?!0:!z6(v.firstChild,g.firstChild,xr(e))};try{for(var h=(0,G.XA)(r),d=h.next();!d.done;d=h.next()){var f=d.value;c(f)?!o||u(o,f)?o=f:(s.add(o),s.add(f)):s.add(f)}}catch(v){n={error:v}}finally{try{d&&!d.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return Array.from(s)}function p0(r,t){return t===void 0&&(t={}),me(r)?0:typeof r=="number"?r:Math.floor(FI(r,t))}function Z6(r,t,e,n){if(!(r.length<=0)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,l=o===void 0?1/0:o,c=t.step,u=c===void 0?" ":c,h=t.margin,d=h===void 0?[0,0,0,0]:h,f=wx(n.getTextShape(r[0])),v=p0(u,f),g=s?p0(s,f):v,p=p0(l,f);(me(p)||p===1/0)&&(p=Math.max.apply(null,r.map(function(ct){return ct.getBBox().width})));for(var y=r.slice(),b=(0,G.CR)(d,4),E=b[0],O=E===void 0?0:E,P=b[1],R=P===void 0?0:P,F=b[2],I=F===void 0?O:F,V=b[3],Y=V===void 0?R:V,J=function(ct){if(y.forEach(function(ft){n.ellipsis(n.getTextShape(ft),ct,a)}),y=Zh(r,e,d),y.length<1)return{value:void 0}},$=p;$>g+v;$-=v){var ot=J($);if(typeof ot=="object")return ot.value}}}var W6=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},G6={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(ji(i),!1):!0})}},V6=function(r){return r.filter(W6)};function U6(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=G6.parity,l=function(E){return E.forEach(n.show),E},c=2,u=r.slice(),h=r.slice(),d=Math.min.apply(Math,(0,G.ev)([1],(0,G.CR)(r.map(function(E){return E.getBBox().width})),!1));if(e.type==="linear"&&(v0(e)||Fx(e))){var f=Ex(r[0]).left,v=Ex(r[i-1]).right,g=Math.abs(v-f)||1;c=Math.max(Math.floor(i*d/g),c)}var p,y;for(a&&(p=u.splice(0,1)[0]),s&&(y=u.splice(-1,1)[0],u.reverse()),l(u);co)){if(e.type==="linear"&&v0(e)){if(y(o),g())return}else for(var b=v;b<=o;b++)if(y(b),g())return;c&&y(f)}}var K6=new Map([["hide",U6],["rotate",Y6],["ellipsis",Z6],["wrap",X6]]);function Q6(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!GD(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 q6(r,t,e,n){var i=t.labelOverlap,a=i===void 0?[]:i;a.length&&a.forEach(function(s){var o=s.type,l=K6.get(o);Q6(r,t,o)&&(l==null||l(r,s,t,n,e))})}function J6(){for(var r=[],t=0;td[0]&&R0&&Number.isFinite(r)?t:e},Rj=function(r,t){return r*t},Lj=function(r,t){return r/2+(t||0)/2},b0=function(r){return r};class nE{constructor(t){this.options=mr({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=mr({},this.options,t),this.rescale(t)}rescale(t){}}function x0(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function Wh(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function g5(r,t,e,n,i){let a=e||0,s=n||r.length;const o=i||(l=>l);for(;at?s=l:a=l+1}return a}var p5=S(75196),m5=S.n(p5);function E0(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 y5(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=E0(s,a,t+1/3),l=E0(s,a,t),c=E0(s,a,t-1/3);return[o*255,l*255,c*255,i]}function rE(r){const t=m5().get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?y5(n):null}const Gh=(r,t)=>e=>r*(1-e)+t*e,b5=(r,t)=>{const e=rE(r),n=rE(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let u=0;u<4;u+=1){const h=e[u],d=n[u];a[u]=h*(1-i)+d*i}const[s,o,l,c]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(l)}, ${c})`}},x5=(r,t)=>typeof r=="number"&&typeof t=="number"?Gh(r,t):typeof r=="string"&&typeof t=="string"?b5(r,t):()=>r,E5=(r,t)=>{const e=Gh(r,t);return n=>Math.round(e(n))};function w5(r){return r===null}function iE(r){return!Te(r)&&!w5(r)&&!Number.isNaN(r)}const w0=Math.sqrt(50),S0=Math.sqrt(10),M0=Math.sqrt(2);function Vh(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/is(10,i);return i>=0?(a>=w0?10:a>=S0?5:a>=M0?2:1)*is(10,i):-is(10,-i)/(a>=w0?10:a>=S0?5:a>=M0?2:1)}function _j(r,t,e){const n=Math.abs(t-r)/Math.max(0,e);let i=is(10,Math.floor(Math.log(n)/Math.LN10));const a=n/i;return a>=w0?i*=10:a>=S0?i*=5:a>=M0&&(i*=2),t{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],l;return o0?(s=Math.floor(s/l)*l,o=Math.ceil(o/l)*l,l=Vh(s,o,e)):l<0&&(s=Math.ceil(s*l)/l,o=Math.floor(o*l)/l,l=Vh(s,o,e)),l>0?(n[i]=Math.floor(s/l)*l,n[a]=Math.ceil(o/l)*l):l<0&&(n[i]=Math.ceil(s*l)/l,n[a]=Math.floor(o*l)/l),n};function M5(r,t){const e=tt?r:t;return i=>Math.min(Math.max(e,i),n)}const A5=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,l;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,l=s?[...t].reverse():t;for(let c=0;c{const u=g5(r,c,1,n)-1,h=i[u],d=a[u];return Wh(d,h)(c)}},aE=(r,t,e,n)=>(Math.min(r.length,t.length)>2?T5:A5)(r,t,n?E5:e);class O5 extends nE{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:Gh,tickCount:5}}map(t){return iE(t)?this.output(t):this.options.unknown}invert(t){return iE(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 S5}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?M5(i[0],i[a-1]):b0}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=aE(n.map(t),i,s,a);this.output=Wh(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=aE(a,i.map(t),Gh);this.input=Wh(e,n,s)}}const C5=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=Vh(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 l=0;l`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class T0 extends nE{getDefaultOptions(){return{domain:[],range:[],unknown:A0}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&lE(this.domainIndexMap,this.getDomain(),this.domainKey),cE({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&lE(this.rangeIndexMap,this.getRange(),this.rangeKey),cE({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=uE(e),this.rangeKey=uE(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 T0(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 R5(r){const t=Math.min(...r);return r.map(e=>e/t)}function L5(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 _5(r){return Math.round(r*1e12)/1e12}function D5(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,l=t.length,c=L5(a,l),[u,h]=e,d=h-u,f=2/l*n+1-1/l*i,v=d/f,g=v*i/l,p=v-l*g,y=R5(c),b=y.reduce(($,ot)=>$+ot),E=p/b,O=new oE(t.map(($,ot)=>{const ct=y[ot]*E;return[$,s?Math.floor(ct):ct]})),P=new oE(t.map(($,ot)=>{const ft=y[ot]*E+g;return[$,s?Math.floor(ft):ft]})),R=Array.from(P.values()).reduce(($,ot)=>$+ot),I=(d-(R-R/l*i))*o,V=u+I;let Y=s?Math.round(V):V;const J=new Array(l);for(let $=0;$d+E*u);return{valueStep:u,valueBandWidth:h,adjustedRange:y}}class O0 extends T0{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:A0,flex:[]}}constructor(t){super(t)}clone(){return new O0(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:l}=I5({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=l,this.valueBandWidth=o,this.adjustedRange=s}}var B5=function(r){(0,G.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,G._T)(e,["style"]);return n=r.call(this,mr({},{type:"column"},(0,G.pi)({style:i},a)))||this,n.columnsGroup=new rr({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,")"),ve(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(Jn({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(yn),F5=function(r){(0,G.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,G._T)(e,["style"]);return n=r.call(this,mr({},{type:"lines"},(0,G.pi)({style:i},a)))||this,n.linesGroup=n.appendChild(new rr),n.areasGroup=n.appendChild(new rr),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(Jn({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){ve(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){ve(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}(yn);function z5(r,t,e,n){var i,a=[],s=!!n,o,l,c=[1/0,1/0],u=[-1/0,-1/0],h,d,f;if(s){i=(0,G.CR)(n,2),c=i[0],u=i[1];for(var v=0,g=r.length;vs&&(e=(0,G.CR)([s,o],2),o=e[0],s=e[1]),r.map(function(l){var c=l.map(function(u,h){return[n.map(h),kn(i.map(u),o,s)]});return c})}function Gl(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return(0,G.ev)([a===e?"M":"L"],(0,G.CR)(i),!1)});return t?n.reverse():n}function Uh(r,t){if(t===void 0&&(t=!1),r.length<=2)return Gl(r);for(var e=[],n=r.length,i=0;i=0;i-=1){var a=r[i],s=Gl(a),o=void 0;if(i===0)o=C0(s,t,e);else{var l=r[i-1],c=Gl(l,!0);c[0][0]="L",o=(0,G.ev)((0,G.ev)((0,G.ev)([],(0,G.CR)(s),!1),(0,G.CR)(c),!1),[["Z"]],!1)}n.push(o)}return n}function V5(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=Uh(a),o=void 0;if(i===0)o=C0(s,t,e);else{var l=r[i-1],c=Uh(l,!0),u=a[0];c[0][0]="L",o=(0,G.ev)((0,G.ev)((0,G.ev)([],(0,G.CR)(s),!1),(0,G.CR)(c),!1),[(0,G.ev)(["M"],(0,G.CR)(u),!1),["Z"]],!1)}n.push(o)}return n}var U5=function(r,t){if(Wr(r)){for(var e,n=1/0,i=0;in&&(e=a,n=s)}return e}};function hE(r){return r.length===0?[0,0]:[ec(U5(r,function(t){return ec(t)||0})),nc(Y5(r,function(t){return nc(t)||0}))]}function dE(r){for(var t=ho(r),e=t[0].length,n=(0,G.CR)([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s=0?(o[l]+=i[l],i[l]=o[l]):(o[l]+=a[l],a[l]=o[l]);return t}var H5=function(r){(0,G.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=ho(e);return ie(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?dE(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,G.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=ke(this.attributes,"area"),l=ke(this.attributes,"line"),c=this.containerShape.width,u=this.data;if(u[0].length===0)return{lines:[],areas:[]};var h=this.scales,d=h.x,f=h.y,v=Z5(u,{type:"line",x:d,y:f}),g=[];if(o){var p=this.baseline;a?g=s?V5(v,c,p):G5(v,c,p):g=W5(v,s,c,p)}return{lines:v.map(function(y,b){return(0,G.pi)({stroke:e.getColor(b),d:s?Uh(y):Gl(y)},l)}),areas:g.map(function(y,b){return(0,G.pi)({d:y,fill:e.getColor(b)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=ke(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 l=this.containerShape.height,c=this.rawData;if(!c)return{columns:[]};a&&(c=dE(c));var u=this.createScales(c),h=u.x,d=u.y,f=(0,G.CR)(hE(c),2),v=f[0],g=f[1],p=new Wl({domain:[0,g-(v>0?0:v)],range:[0,l*o]}),y=h.getBandWidth(),b=this.rawData;return{columns:c.map(function(E,O){return E.map(function(P,R){var F=y/c.length,I=function(){return{x:h.map(R)+F*O,y:P>=0?d.map(P):d.map(0),width:F,height:p.map(Math.abs(P))}},V=function(){return{x:h.map(R),y:d.map(P),width:y,height:p.map(b[O][R])}};return(0,G.pi)((0,G.pi)({fill:e.getColor(O)},n),a?V():I())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){$D(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),l=(0,G.pi)({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);ve(n).selectAll(".spark").data([i]).join(function(c){return c.append(function(u){return u==="line"?new F5({className:o,style:l}):new B5({className:o,style:l})}).attr("className","spark ".concat(o))},function(c){return c.update(l)},function(c){return c.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Wr(n)?n[e%n.length]:fe(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,l=a.range,c=l===void 0?[]:l,u=a.spacing,h=this.containerShape,d=h.width,f=h.height,v=(0,G.CR)(hE(e),2),g=v[0],p=v[1],y=new Wl({domain:[(n=c[0])!==null&&n!==void 0?n:g,(i=c[1])!==null&&i!==void 0?i:p],range:[f,f*(1-o)]});return s==="line"?{type:s,x:new Wl({domain:[0,e[0].length-1],range:[0,d]}),y}:{type:s,x:new O0({domain:e[0].map(function(b,E){return E}),range:[0,d],paddingInner:u,paddingOuter:u/2,align:.5}),y}},t.tag="sparkline",t}(Ln),fE={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},vE={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},gE={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},sa=Zi({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),$a=Zi({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),X5=function(r){(0,G.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,l=e.radius,c=l===void 0?o/4:l,u=e.orientation,h=(0,G._T)(e,["x","y","size","radius","orientation"]),d=o,f=d*2.4,v=ve(n).maybeAppendByClassName($a.iconRect,"rect").styles((0,G.pi)((0,G.pi)({},h),{width:d,height:f,radius:c,x:i-d/2,y:a-f/2,transformOrigin:"center"})),g=i+1/3*d-d/2,p=i+2/3*d-d/2,y=a+1/4*f-f/2,b=a+3/4*f-f/2;v.maybeAppendByClassName("".concat($a.iconLine,"-1"),"line").styles((0,G.pi)({x1:g,x2:g,y1:y,y2:b},h)),v.maybeAppendByClassName("".concat($a.iconLine,"-2"),"line").styles((0,G.pi)({x1:p,x2:p,y1:y,y2:b},h)),u==="vertical"&&(v.node().style.transform="rotate(90)")},t}(Ln),K5=function(r){(0,G.ZT)(t,r);function t(e){return r.call(this,e,gE)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,l=ke(this.attributes,"label"),c=l.x,u=c===void 0?0:c,h=l.y,d=h===void 0?0:h,f=l.transform,v=l.transformOrigin,g=(0,G._T)(l,["x","y","transform","transformOrigin"]),p=(0,G.CR)(wa(g,[]),2),y=p[0],b=p[1],E=ve(e).maybeAppendByClassName($a.labelGroup,"g").styles(b),O=(0,G.pi)((0,G.pi)({},vE),y),P=O.text,R=(0,G._T)(O,["text"]);Qr(!!o,E,function(F){n.label=F.maybeAppendByClassName($a.label,"text").styles((0,G.pi)((0,G.pi)({},R),{x:a+u,y:s+d,transform:f,transformOrigin:v,text:"".concat(P)})),n.label.on("mousedown",function(I){I.stopPropagation()}),n.label.on("touchstart",function(I){I.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,l=(0,G.pi)((0,G.pi)({x:i,y:a,orientation:s},fE),ke(this.attributes,"icon")),c=this.attributes.iconShape,u=c===void 0?function(){return new X5({style:l})}:c,h=ve(e).maybeAppendByClassName($a.iconGroup,"g");h.selectAll($a.icon.class).data([u]).join(function(d){return d.append(typeof u=="string"?u:function(){return u(o)}).attr("className",$a.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}(Ln),Q5=function(r){(0,G.ZT)(t,r);function t(e){var n=r.call(this,e,(0,G.pi)((0,G.pi)((0,G.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},Mo(gE,"handle")),Mo(fE,"handleIcon")),Mo(vE,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(eE(a));var s=n.availableSpace,o=s.x,l=s.y,c=n.getBBox(),u=c.x,h=c.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,l])-n.getOrientVal([+u,+h])),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,l=a.type;i.stopPropagation();var c=n.getOrientVal(eE(i)),u=c-n.prevPos;if(u){var h=n.getRatio(u);switch(n.target){case"start":s&&n.setValuesOffset(h);break;case"end":s&&n.setValuesOffset(0,h);break;case"selection":s&&n.setValuesOffset(h,h);break;case"track":if(!o)return;n.selectionWidth+=h,l==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break;default:break}n.prevPos=c}},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,l=o==="range"?i:i[1],c=o==="range"?n.getValues():n.getValues()[1],u=new Qn("valuechange",{detail:{oldValue:l,value:c}});n.dispatchEvent(u),s==null||s(c)},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=ke(this.attributes,"sparkline");return(0,G.pi)((0,G.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,G.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,G.CR)(xr(a),4),o=s[0],l=s[1],c=s[2],u=s[3],h=this.shape,d=h.width,f=h.height;return{x:u,y:o,width:d-(u+l),height:f-(o+c)}},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(sa.selection.class).each(function(i,a){Wi(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&Wi(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&Wi(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=ke(this.attributes,"track");this.trackShape=ve(e).maybeAppendByClassName(sa.track,"rect").styles((0,G.pi)((0,G.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=ve(e).maybeAppendByClassName(sa.brushArea,"rect").styles((0,G.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,l=ve(e).maybeAppendByClassName(sa.sparklineGroup,"g");Qr(o==="horizontal",l,function(c){var u=(0,G.pi)((0,G.pi)({},n.sparklineStyle),{x:a,y:s});c.maybeAppendByClassName(sa.sparkline,function(){return new H5({style:u})}).update(u)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],l=a?o:[],c=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(sa.handle.class).data(l.map(function(u){return{type:u}}),function(u){return u.type}).join(function(u){return u.append(function(h){var d=h.type;return new K5({style:e.getHandleStyle(d)})}).each(function(h){var d=h.type;this.attr("class","".concat(sa.handle.name," ").concat(d,"-handle"));var f="".concat(d,"Handle");c[f]=this,this.addEventListener("pointerdown",c.onDragStart(d))})},function(u){return u.each(function(h){var d=h.type;this.update(c.getHandleStyle(d))})},function(u){return u.each(function(h){var d=h.type,f="".concat(d,"Handle");c[f]=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=ve(e).maybeAppendByClassName(sa.foreground,"g");var l=ke(this.attributes,"selection"),c=function(h){return h.style("visibility",function(d){return d.show?"visible":"hidden"}).style("cursor",function(d){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles((0,G.pi)((0,G.pi)({},l),{transform:"translate(".concat(i,", ").concat(a,")")}))},u=this;this.foregroundGroup.selectAll(sa.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(h,d){return{style:(0,G.pi)({},h),index:d,show:o==="select"?d===1:d!==1}}),function(h){return h.index}).join(function(h){return h.append("rect").attr("className",sa.selection.name).call(c).each(function(d,f){var v=this;f===1?(u.selectionShape=ve(this),this.on("pointerdown",function(g){v.attr("cursor","grabbing"),u.onDragStart("selection")(g)}),u.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),u.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),u.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){v.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){v.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){v.attr("cursor","pointer")})):this.on("pointerdown",u.onDragStart("track"))})},function(h){return h.call(c)},function(h){return h.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,G.CR)(this.range,2),s=a[0],o=a[1],l=(0,G.CR)(this.getValues().map(function(p){return y0(p,n)}),2),c=l[0],u=l[1],h=Array.isArray(e)?e:[c,e!=null?e:u],d=(0,G.CR)((h||[c,u]).map(function(p){return y0(p,n)}),2),f=d[0],v=d[1];if(this.attributes.type==="value")return[0,kn(v,s,o)];f>v&&(i=(0,G.CR)([v,f],2),f=i[0],v=i[1]);var g=v-f;return g>o-s?[s,o]:fo?u===o&&c===f?[f,o]:[o-g,o]:[f,v]},t.prototype.calcSelectionArea=function(e){var n=(0,G.CR)(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,l=s.y,c=s.width,u=s.height;return this.getOrientVal([[{y:l,height:u,x:o,width:i*c},{y:l,height:u,x:i*c+o,width:(a-i)*c},{y:l,height:u,x:a*c,width:(1-a)*c}],[{x:o,width:c,y:l,height:i*u},{x:o,width:c,y:i*u+l,height:(a-i)*u},{x:o,width:c,y:a*u,height:(1-a)*u}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,l=i.height,c=(0,G.CR)(this.clampValues(),2),u=c[0],h=c[1],d=e==="start"?-n:n,f=(e==="start"?u:h)*this.getOrientVal([o,l])+d;return{x:a+this.getOrientVal([f,o/2]),y:s+this.getOrientVal([l/2,f])}},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,l=i.autoFitLabel,c=ke(this.attributes,"handle"),u=ke(c,"label"),h=c.spacing,d=this.getHandleSize(),f=this.clampValues(),v=e==="start"?f[0]:f[1],g=o(v),p=new $v({style:(0,G.pi)((0,G.pi)((0,G.pi)({},u),this.inferTextStyle(e)),{text:g})}),y=p.getBBox(),b=y.width,E=y.height;if(p.destroy(),!l){if(a==="value")return{text:g,x:0,y:-E-h};var O=h+d+(s==="horizontal"?b/2:0);return n={text:g},n[s==="horizontal"?"x":"y"]=e==="start"?-O:O,n}var P=0,R=0,F=this.availableSpace,I=F.width,V=F.height,Y=this.calcSelectionArea()[1],J=Y.x,$=Y.y,ot=Y.width,ct=Y.height,ft=h+d;if(s==="horizontal"){var Nt=ft+b/2;if(e==="start"){var Ot=J-ft-b;P=Ot>0?-Nt:Nt}else{var mt=I-J-ot-ft>b;P=mt?Nt:-Nt}}else{var yt=ft,Rt=E+ft;e==="start"?R=$-d>E?-Rt:yt:R=V-($+ct)-d>E?Rt:-yt}return{x:P,y:R,text:g}},t.prototype.getHandleLabelStyle=function(e){var n=ke(this.attributes,"handleLabel");return(0,G.pi)((0,G.pi)((0,G.pi)({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=ke(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return(0,G.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,l=n.orientation,c=this.calcHandlePosition(e),u=c.x,h=c.y,d=this.calcHandleText(e),f=s;return!s&&o&&(this.target?f=!0:f=!1),(0,G.pi)((0,G.pi)((0,G.pi)({},Mo(this.getHandleIconStyle(),"icon")),Mo((0,G.pi)((0,G.pi)({},this.getHandleLabelStyle(e)),d),"label")),{transform:"translate(".concat(u+i,", ").concat(h+a,")"),orientation:l,showLabel:f,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,G.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,G.CR)(this.getValues(),2),s=a[0],o=a[1],l=i==="range"?e:0,c=[s+l,o+n].sort();this.innerSetValues(c,!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 Qn(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}(Ln),q5={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},N0=Zi({background:"background",labelGroup:"label-group",label:"label"},"indicator"),J5=function(r){(0,G.ZT)(t,r);function t(e){var n=r.call(this,e,q5)||this;return n.point=[0,0],n.group=n.appendChild(new rr({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=(0,G.CR)(xr(i),4),s=a[0],o=a[1],l=a[2],c=a[3],u=this.label.node().getLocalBounds(),h=u.min,d=u.max,f=new Cr(h[0]-c,h[1]-s,d[0]+o-h[0]+c,d[1]+l-h[1]+s),v=this.getPath(n,f),g=ke(this.attributes,"background");this.background=ve(this.group).maybeAppendByClassName(N0.background,"path").styles((0,G.pi)((0,G.pi)({},g),{d:v})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=ke(this.attributes,"label"),s=(0,G.CR)(wa(a),2),o=s[0],l=s[1],c=o.text,u=(0,G._T)(o,["text"]);if(this.label=ve(this.group).maybeAppendByClassName(N0.labelGroup,"g").styles(l),!!i){var h=this.label.maybeAppendByClassName(N0.label,function(){return Sa(n(i))}).style("text",n(i).toString());h.selectAll("text").styles(u)}},t.prototype.adjustLayout=function(){var e=(0,G.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,l=n.height,c=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+l-i],["A",i,i,0,0,1,a+o-i,s+l],["L",a+i,s+l],["A",i,i,0,0,1,a,s+l-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],u={top:4,right:6,bottom:0,left:2},h=u[e],d=this.createCorner([c[h].slice(-2),c[h+1].slice(-2)]);return c.splice.apply(c,(0,G.ev)([h+1,1],(0,G.CR)(d),!1)),c[0][0]="M",c},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=DI.apply(void 0,(0,G.ev)([],(0,G.CR)(e),!1)),s=(0,G.CR)(e,2),o=(0,G.CR)(s[0],2),l=o[0],c=o[1],u=(0,G.CR)(s[1],2),h=u[0],d=u[1],f=(0,G.CR)(a?[h-l,[l,h]]:[d-c,[c,d]],2),v=f[0],g=(0,G.CR)(f[1],2),p=g[0],y=g[1],b=v/2,E=v/Math.abs(v),O=n*E,P=O/2,R=O*Math.sqrt(3)/2*i,F=(0,G.CR)([p,p+b-P,p+b,p+b+P,y],5),I=F[0],V=F[1],Y=F[2],J=F[3],$=F[4];return a?(this.point=[Y,c-R],[["L",I,c],["L",V,c],["L",Y,c-R],["L",J,c],["L",$,c]]):(this.point=[l+R,Y],[["L",l,I],["L",l,V],["L",l+R,Y],["L",l,J],["L",l,$]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?ji(this):Dl(this)},t.prototype.bindEvents=function(){this.label.on(De.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(Ln),$5=function(r){(0,G.ZT)(t,r);function t(e){var n=r.call(this,Jn({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new pr({})),n.label=n.background.appendChild(new rr({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return xr(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=ke(this.attributes,"label");ve(this.label).maybeAppend(".label",function(){return Sa(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=(0,G.CR)(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],l=e.width,c=e.height,u=l+o+a,h=c+i+s,d=ke(this.attributes,"background"),f=this.style,v=f.width,g=v===void 0?0:v,p=f.height,y=p===void 0?0:p,b=f.selected;this.background.attr((0,G.pi)((0,G.pi)({},d),{width:Math.max(u,g),height:Math.max(h,y),fill:b?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((h-c)/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}(Ln),t4=function(r){(0,G.ZT)(t,r);function t(e){var n,i,a=r.call(this,Jn({},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 pr({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new pr({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 xr(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,l=i.height,c=i.bordered,u=i.showDropdownIcon,h=ke(this.attributes,"select"),d=ke(this.attributes,"placeholder");this.select.attr((0,G.pi)((0,G.pi)({x:a,y:s,width:o,height:l},h),{fill:"#fff",strokeWidth:c?1:0}));var f=this.dropdownPadding,v=10;u&&ve(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-v-f[1]-f[3],", ").concat(s+l/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(E){return E.value===e.currentValue}),p=(0,G.pi)({x:a+f[3]},d);ve(this.select).selectAll(".placeholder").data(g?[]:[1]).join(function(E){return E.append("text").attr("className","placeholder").styles(p).style("y",function(){var O=this.getBBox();return s+(l-O.height)/2})},function(E){return E.styles(p)},function(E){return E.remove()});var y=ke(this.attributes,"optionLabel"),b=(0,G.pi)({x:a+f[3]},y);ve(this.select).selectAll(".value").data(g?[g]:[]).join(function(E){return E.append(function(O){return Sa(O.label)}).attr("className","value").styles(b).style("y",function(){var O=this.getBBox();return s+(l-O.height)/2})},function(E){return E.styles(b)},function(E){return E.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,l=a.width,c=a.height,u=a.options,h=a.onSelect,d=a.open,f=ke(this.attributes,"dropdown"),v=ke(this.attributes,"option"),g=this.dropdownPadding;ve(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(u,function(b){return b.value}).join(function(b){return b.append(function(E){return new $5({className:"dropdown-item",style:(0,G.pi)((0,G.pi)((0,G.pi)({},E),v),{width:l-g[1]-g[3],selected:E.value===e.currentValue,onClick:function(O,P,R){e.setValue(O),h==null||h(O,P,R),e.dispatchEvent(new Qn("change",{detail:{value:O,option:P,item:R}})),ji(e.dropdown)}})})}).each(function(E,O){var P,R=(P=this.parentNode)===null||P===void 0?void 0:P.children,F=R.reduce(function(I,V,Y){return Ya.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,l=e.controllerHeight,c=kn(+s-l,0,+s),u=new Cr(n,i+ +s-l,+a,l),h,d=0;o==="chart"?(d=35,h=new Cr(n,i+c-d,+a,d)):h=new Cr;var f=o==="time"?10:c,v=new Cr(n,i+(o==="time"?c:c-f),+a,f-d);return{axisBBox:h,controllerBBox:u,timelineBBox:v}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=(0,G.CR)(Array.isArray(e)?e:[0,e],2),o=s[0],l=s[1],c=a.length,u=a[Math.floor(o*c)],h=a[Math.ceil(l*c)-(Array.isArray(e)?0:1)];this.states.values=[(n=u==null?void 0:u.time)!==null&&n!==void 0?n:a[0].time,(i=h==null?void 0:h.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=(0,G.CR)(Array.isArray(e)?e:[void 0,e],2),l=o[0],c=o[1],u=s.find(function(d){var f=d.time;return f===l}),h=s.find(function(d){var f=d.time;return f===c});this.states.values=[(n=u==null?void 0:u.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=h==null?void 0:h.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,l=(0,G.CR)(e,2),c=l[0],u=l[1];this.states.values=[(i=(n=o[c])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[u])===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,G.CR)(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],l=this.data,c=l.length,u=i==="value",h=function(){var f=l.findIndex(function(v){var g=v.time;return g===s});return u?0:f>-1?f/c:0},d=function(){if(o===1/0)return 1;var f=l.findIndex(function(v){var g=v.time;return g===o});return f>-1?f/c:u?.5:1};return[h(),d()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=(0,G.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 v4({style:{type:i,height:n,iconSize:n/6}})}:function(){return new As({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,l=this.states,c=l.selectionType,u=l.chartType,h=this.data,d=this.attributes,f=d.type,v=d.labelFormatter,g=ke(this.attributes,"chart"),p=g.type,y=(0,G._T)(g,["type"]),b=c==="range";if(f==="time")return(0,G.pi)({handleIconShape:function(){return new f4({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:b?-15:0,autoFitLabel:b,handleSpacing:b?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:c,values:this.sliderValues,formatter:function(P){if(v)return v(P);var R=n.getDatumByRatio(P).time;return typeof R=="number"?mE(R):Fr(R,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},y);var E=c==="range"?5:0,O=h.map(function(P){var R=P.value;return R});return(0,G.pi)({handleIconOffset:E,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:O,sparklineType:u,sparklineScale:.8,trackLength:s,trackSize:o,type:c,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},y)},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=ke(this.attributes,"axis"),l=e.x,c=e.y,u=e.width,h=(0,G.ev)((0,G.ev)([],(0,G.CR)(n),!1),[{time:0}],!1).map(function(f,v,g){var p=f.time;return{label:"".concat(p),value:v/(g.length-1),time:p}}),d=(0,G.pi)({startPos:[l,c],endPos:[l+u,c],data:h,labelFilter:function(f,v){return va?l==="value"?[0,0]:c==="acc"?[F(P),F(P)]:[0,F(R-P)]:P<0?c==="acc"?[0,F(R)]:[F(P+a-R),a]:[F(P),F(R)]},b=y(p);return this.setByIndex(b),this.updateSelection(),b},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,l=this.states.speed,c=l===void 0?1:l;this.playInterval=window.setInterval(function(){var u=n.internalForward();u[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/c),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}(Ln);function y4(r){return r instanceof Date}var b4=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},x4=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 v;const g=Object.assign(Object.assign({x:d[0]/2-l/2,y:f,onChange:p=>{const y=(Wr(p)?p:[p,p]).map(b=>y4(b)?b.getTime():b);this.options.mode==="modify"?this.filterElements(y):this.hiddenElements(y),n==null||n(y)}},h),{data:a.map(p=>ie(p)?{time:p,value:0}:p),width:l,height:c,type:i});this.timebar?this.timebar.update(g):(this.timebar=new m4({style:g}),(v=this.canvas)===null||v===void 0||v.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,[l,c]=Rh({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=l,t&&l.classList.add(t),this.canvas=c,this.canvas}filterElements(t){return b4(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=yE(this.originalData);n.forEach(c=>{const u=`${c}s`;o[u]=(this.originalData[u]||[]).filter(h=>{const d=i(h);return!!bE(d,t)})});const l=[...o.nodes,...o.combos].map(c=>At(c));o.edges=o.edges.filter(c=>{const u=c.source,h=c.target;return l.includes(u)&&l.includes(h)}),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 l;const c=`${o}s`;(((l=this.originalData)===null||l===void 0?void 0:l[c])||[]).forEach(h=>{const d=At(h),f=i(h);bE(f,t)?s.push(d):a.push(d)})}),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()}}Yh.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>w4(r,E4,void 0),loop:!1};const yE=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},bE=(r,t)=>{if(ie(t))return r===t;const[e,n]=t;return r>=e&&r<=n},w4=(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(Kt.AFTER_RENDER,this.onRender),t.on(Kt.AFTER_ANIMATE,this.onRender)}unbindEvents(){const{graph:t}=this.context;t.off(Kt.AFTER_RENDER,this.onRender),t.off(Kt.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:l,height:c}=this.canvas.getConfig();(i!==l||o!==c)&&this.canvas.resize(i,o)}else{const l={left:"left-top",center:"top",right:"right-top"},[c,u]=Rh({width:i,height:o,placement:l[n]||l.left,className:"title-canvas",graphCanvas:this.context.canvas});e&&c.classList.add(e),this.container=c,this.canvas=u}return this.canvas}renderTitle(t){const e=new C4({options:this.options,ctx:this.context});t.removeChildren(),e.getTitle().forEach(n=>{n&&t.appendChild(n)})}}class C4{get padding(){return ai(this.options.padding)}constructor(t){const{options:e,ctx:n}=t;this.options=e,this.context=n}getTitle(){const t=this.options,e=D0,n=t[e],i=EE,a=t[i],{spacing:s=44,padding:o,align:l}=t,c=S4(t,[typeof e=="symbol"?e:e+"",typeof i=="symbol"?i:i+"","spacing","padding","align"]),u=n,h=a,d=_n(c,D0),f=_n(c,EE),[v]=this.context.graph.getSize(),[g=0,p=0,,y=0]=this.padding,b=v,E=b-y-p;let O=null,P=y,R="left";switch(l){case"left":P=y,R="left";break;case"center":P=b/2,R="center";break;case"right":P=b-p,R="right";break;default:P=y,R="left"}const F=new ia({className:D0,style:Object.assign(Object.assign(Object.assign(Object.assign({},M4),{wordWrapWidth:E-5,x:P,y:g,textAlign:R}),d),{text:u})}),I=F.getBBox();return h&&(O=new ia({className:"subTitle",style:Object.assign(Object.assign(Object.assign(Object.assign({},A4),{wordWrapWidth:E-5,x:P,y:I.height+s+g,textAlign:R}),f),{text:h})})),[F,O]}}function N4(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 k4=` .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; } `,P4=` `;var wE=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Hh extends hr{constructor(t,e){super(t,Object.assign({},Hh.defaultOptions,e)),this.$element=So("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),Vv("g6-toolbar-css","style",{},k4,document.head),Vv("g6-toolbar-svgicon","div",{display:"none"},P4),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return wE(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,N4(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return wE(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>{var n;return`
`}).join("")})}}Hh.defaultOptions={position:"top-left"};function I0(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function R4(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 L4=R4,SE=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,(0,G.ev)([],(0,G.CR)(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function B0(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 ME={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function _4(r){var t;r===void 0&&(r="");var e=B0(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,G.pi)({flex:1},ME),t[".".concat(e.VALUE)]=(0,G.pi)({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},ME),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 D4=function(r){(0,G.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=B0(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:_4(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,l=o===void 0?"":o,c=a.color,u=c===void 0?"black":c,h=a.index,d=(0,G._T)(a,["name","color","index"]),f=(0,G.pi)({name:l,color:u,index:h!=null?h:s},d);return I0(L4(i.item,f))})},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=I0(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:SE(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,l=i.style,c=i.content,u=B0(a.prefixCls),h=this.element;if(this.element.style.pointerEvents=o?"auto":"none",c)this.renderCustomContent();else{s?(h.innerHTML=a.title,h.getElementsByClassName(u.TITLE)[0].innerHTML=s):(n=(e=h.getElementsByClassName(u.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var d=this.HTMLTooltipItemsElements,f=document.createElement("ul");f.className=u.LIST,SE(f,d);var v=this.element.querySelector(".".concat(u.LIST));v?v.replaceWith(f):h.appendChild(f)}HD(h,l)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),l={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},c=this.elementSize,u=c.width,h=c.height,d=[-u/2,-h/2];return o.forEach(function(f){var v=(0,G.CR)(d,2),g=v[0],p=v[1],y=(0,G.CR)(l[f],2),b=y[0],E=y[1];d=[g+(u/2+a[0])*b,p+(h/2+a[1])*E]}),d},t.prototype.setOffsetPosition=function(e){var n=(0,G.CR)(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,l=o===void 0?0:o,c=s.y,u=c===void 0?0:c,h=s.container,d=h.x,f=h.y;this.element.style.left="".concat(+l+d+i,"px"),this.element.style.top="".concat(+u+f+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.timestampb+O,top:pE+P},F=[];u.split("-").forEach(function(V){R[V]?F.push(y[V]):F.push(V)});var I=F.join("-");return this.getRelativeOffsetFromCursor(I)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,l=i.height;return new Cr(a,s,o,l).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}(Ln),AE=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class Xh extends hr{constructor(t,e){super(t,Object.assign({},Xh.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=>AE(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=>AE(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Ol(n.target))return;const l=this.context.graph.getElementType(o),{getContent:c,title:u}=this.options,h=this.getElementData(o,l);if(!this.tooltipElement||!this.isEnable(n,h))return;let d={};if(c){if(d.content=yield c(n,h),!d.content)return}else{const g=this.context.graph.getElementRenderStyle(o),p=l==="node"?g.fill:g.stroke;d={title:u||l,data:h.map(y=>({name:"ID",value:y.id||`${y.source} -> ${y.target}`,color:p}))}}this.currentTarget=o;let f,v;if(s)f=s.x,v=s.y;else{const g=br(h,"0.style",{x:0,y:0});f=g.x,v=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:f,y:v,style:{".tooltip":{visibility:"visible"}}}),d))}),this.hide=n=>{var i,a,s,o,l;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:c,y:u}}=n;(l=(o=this.options).onOpenChange)===null||l===void 0||l.call(o,!1),this.tooltipElement.hide(c,u),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new D4({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:l,container:c={x:-a,y:-i},title:u,offset:h}=this.options,[d,f]=e,[v,g]=t.getSize();return{x:d,y:f,container:c,title:u,bounding:{x:0,y:0,width:v,height:g},position:o,enterable:l,offset:h,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}Xh.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var TE=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};let No;function OE(r,t){return No||(No=document.createElement("canvas")),No.width=r,No.height=t,No.getContext("2d").clearRect(0,0,r,t),No}function I4(r,t,e,n){return TE(this,void 0,void 0,function*(){const i=OE(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:l,textFontSize:c,textFontFamily:u,textFontVariant:h,textFontWeight:d,textAlign:f,textBaseline:v}=n;return a.textAlign=f,a.textBaseline=v,a.translate(r/2,t/2),a.font=`${c}px ${u} ${h} ${d}`,s&&a.rotate(s),o&&(a.globalAlpha=o),l&&(a.fillStyle=l,a.fillText(`${e}`,0,0)),i.toDataURL()})}function B4(r,t,e,n){return TE(this,void 0,void 0,function*(){const i=OE(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const l=new Image;return l.crossOrigin="anonymous",l.src=e,new Promise(c=>{l.onload=function(){const u=r>l.width?(r-l.width)/2:0,h=t>l.height?(t-l.height)/2:0;a.drawImage(l,0,0,l.width,l.height,u,h,r-u*2,t-h*2),c(i.toDataURL())}})})}var F4=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},z4=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 F4(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,l=z4(n,["width","height","text","imageURL"]);Object.keys(l).forEach(u=>{u.startsWith("background")&&(this.$element.style[u]=t[u])});const c=o?yield B4(i,a,o,l):yield I4(i,a,s,l);this.$element.style.backgroundImage=`url(${c})`})}destroy(){super.destroy(),this.$element.remove()}}Kh.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const j4=["#7E92B5","#F4664A","#FFBE3A"],Z4={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},W4={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function CE(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:l=.06,nodeIconOpacityInactive:c=.85,nodeOpacityInactive:u=.25,nodeBadgePalette:h=j4,nodePaletteOptions:d=Z4,edgeColor:f,edgeColorDisabled:v,edgePaletteOptions:g=W4,comboColor:p,comboColorDisabled:y,comboStroke:b,comboStrokeDisabled:E,edgeColorInactive:O}=r;return{background:t,node:{palette:d,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:h,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:u,donutOpacity:u,fillOpacity:u,iconOpacity:c,labelFill:e,labelFillOpacity:u,strokeOpacity:u},disabled:{badgeBackgroundOpacity:.25,donutOpacity:l,fill:i,fillOpacity:l,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:l}},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:f,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:f,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:O,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:v,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:p,halo:!1,haloLineWidth:12,haloStroke:b,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:b},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:y,fillOpacity:.25,labelOpacity:.25,stroke:E,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 G4=CE({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"}),V4=CE({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 ts extends Vf{beforeDraw(t,e){return t}afterLayout(t,e){}}class U4 extends ts{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,l)=>{const u=e.getAncestorsData(l,"combo").map(h=>At(h)).reverse();s.push([l,o,u.length])}),new Map(s.sort(([,,o],[,,l])=>l-o).map(([o,l])=>[o,l]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function ui(r,t,e,n,i){const a=At(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(([l,c])=>{t===l?c[s].set(a,o):c[s].delete(a)})}function Qh(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class Y4 extends ts{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(dn))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,l]=s.pop();if(Kr(l)){const c=n.getDescendantsData(o),u=c.map(At),{internal:h,external:d}=vv(u,f=>n.getRelatedEdgesData(f));c.forEach(f=>{const v=At(f),g=s.findIndex(([y])=>y===v);g!==-1&&s.splice(g,1);const p=n.getElementType(v);ui(t,"remove",p,f)}),h.forEach(f=>ui(t,"remove","edge",f)),d.forEach(f=>{var v;const g=At(f);((v=this.context.element)===null||v===void 0?void 0:v.getElement(g))?a.edges.set(g,f):i.edges.set(g,f)})}else{const c=n.getChildrenData(o),u=c.map(At),{edges:h}=vv(u,d=>n.getRelatedEdgesData(d));[...c,...h].forEach(d=>{var f;const v=At(d),g=n.getElementType(v);((f=this.context.element)===null||f===void 0?void 0:f.getElement(v))?ui(t,"update",g,d):ui(t,"add",g,d),g==="combo"&&s.push([v,d])})}}return t}}const NE=(r,t,e,n)=>{const i=`${e}s`,a=At(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(At(n),n)};class H4 extends ts{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(NE(e,"add","node",t),Kr(t))return;const n=At(t);NE(e,"add","node",t),this.context.model.getRelatedEdgesData(n).forEach(s=>{ui(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(ii))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,l=new Map;i.forEach((u,h)=>{Kr(u)&&o.set(h,u)}),a.forEach(u=>{if(e.getElementType(u.source)!=="node")return;const h=e.getNodeData(u.source);Kr(h)&&o.set(u.source,h)}),s.forEach((u,h)=>{const d=this.getElement(h);if(!d)return;const f=d.attributes.collapsed;Kr(u)?f||o.set(h,u):f&&l.set(h,u)});const c=new Set;return o.forEach((u,h)=>{n.getDescendantsData(h).forEach(f=>{const v=At(f);if(c.has(v))return;ui(t,"remove","node",f),n.getRelatedEdgesData(v).forEach(p=>{ui(t,"remove","edge",p)}),c.add(v)})}),l.forEach((u,h)=>{if(n.getAncestorsData(h,ii).some(Kr)){ui(t,"remove","node",u);return}this.handleExpand(u,t)}),t}}const F0=new WeakMap;function Fj(r,t,e){F0.has(r)||F0.set(r,{});const n=F0.get(r);if(!n[t])return n[t]=e,!0;const i=n[t];return kE(i,e)?!1:(n[t]=e,!0)}const kE=(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(!kE(s,o,e-1))return!1}else if(s!==o)return!1}return!0};function X4(r,t,e){Of[r][t]&&Xr.warn(`The extension ${t} of ${r} has been registered before, and will be overridden.`),Object.assign(Of[r],{[t]:e})}var PE=function(){function r(t){(0,N.Z)(this,r),this.dragndropPluginOptions=t}return(0,T.Z)(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,l=function(u){var h=u.target,d=h===s,f=d&&n.dragndropPluginOptions.isDocumentDraggable?s:h.closest&&h.closest("[draggable=true]");if(f){var v=!1,g=u.timeStamp,p=[u.clientX,u.clientY],y=null,b=[u.clientX,u.clientY],E=function(){var P=(0,La.Z)((0,Tr.Z)().mark(function R(F){var I,V,Y,J,$,ot;return(0,Tr.Z)().wrap(function(ct){for(;;)switch(ct.prev=ct.next){case 0:if(v){ct.next=2;break}if(I=F.timeStamp-g,V=Zr([F.clientX,F.clientY],p),!(I<=n.dragndropPluginOptions.dragstartTimeThreshold||V<=n.dragndropPluginOptions.dragstartDistanceThreshold)){ct.next=1;break}return ct.abrupt("return");case 1:F.type="dragstart",f.dispatchEvent(F),v=!0;case 2:if(F.type="drag",F.dx=F.clientX-b[0],F.dy=F.clientY-b[1],f.dispatchEvent(F),b=[F.clientX,F.clientY],d){ct.next=4;break}return Y=n.dragndropPluginOptions.overlap==="pointer"?[F.canvasX,F.canvasY]:h.getBounds().center,ct.next=3,s.elementsFromPoint(Y[0],Y[1]);case 3:J=ct.sent,$=J[J.indexOf(h)+1],ot=($==null?void 0:$.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),y!==ot&&(y&&(F.type="dragleave",F.target=y,y.dispatchEvent(F)),ot&&(F.type="dragenter",F.target=ot,ot.dispatchEvent(F)),y=ot,y&&(F.type="dragover",F.target=y,y.dispatchEvent(F)));case 4:case"end":return ct.stop()}},R)}));return function(F){return P.apply(this,arguments)}}();o.addEventListener("pointermove",E);var O=function(R){if(v){R.detail={preventClick:!0};var F=R.clone();y&&(F.type="drop",F.target=y,y.dispatchEvent(F)),F.type="dragend",f.dispatchEvent(F),v=!1}o.removeEventListener("pointermove",E)};h.addEventListener("pointerup",O,{once:!0}),h.addEventListener("pointerupoutside",O,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",l)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",l)})}}])}();PE.tag="Dragndrop";var K4=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,N.Z)(this,t),e=(0,_.Z)(this,t),e.name="dragndrop",e.options=n,e}return(0,C.Z)(t,r),(0,T.Z)(t,[{key:"init",value:function(){this.addRenderingPlugin(new PE((0,B.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)}}])}(_a),RE=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},LE=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 d=new pf(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:c[h],background:s?h==="background"?i:void 0:i}));return[h,d]}));FE(u),this.extends={config:this.config,renderer:n,renderers:c,layers:u}}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 dl(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=BE(t,this.config.enableMultiLayer?DE:_E);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),FE(this.getLayers())}getCanvasByViewport(t){return yr(this.getLayer().viewport2Canvas(Bi(t)))}getViewportByCanvas(t){return yr(this.getLayer().canvas2Viewport(Bi(t)))}getViewportByClient(t){return yr(this.getLayer().client2Viewport(Bi(t)))}getClientByViewport(t){return yr(this.getLayer().viewport2Client(Bi(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Bi(t));return yr(e.viewport2Canvas(n))}toDataURL(){return RE(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=LE(t,["mode"]);let[a,s,o,l]=[0,0,0,0];if(n==="viewport")[o,l]=this.getSize();else if(n==="overall"){const y=this.getBounds(),b=Ba(y);[a,s]=y.min,[o,l]=b}const c=I0('
    '),u=new pf({width:o,height:l,renderer:new Sl,devicePixelRatio:e,container:c,background:this.extends.config.background});yield u.ready,u.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),u.appendChild(this.getRoot().cloneNode(!0));const h=this.getLayer("label").getRoot().cloneNode(!0),d=u.viewport2Canvas({x:0,y:0}),f=this.getCanvasByViewport([0,0]);h.translate([f[0]-d.x,f[1]-d.y]),h.scale(1/this.getCamera().getZoom()),u.appendChild(h),u.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const v=this.getCamera(),g=u.getCamera();if(n==="viewport")g.setZoom(v.getZoom()),g.setPosition(v.getPosition()),g.setFocalPoint(v.getFocalPoint());else if(n==="overall"){const[y,b,E]=g.getPosition(),[O,P,R]=g.getFocalPoint();g.setPosition([y+a,b+s,E]),g.setFocalPoint([O+a,P+s,R])}const p=u.getContextService();return new Promise(y=>{u.addEventListener(ri.RERENDER,()=>RE(this,void 0,void 0,function*(){yield new Promise(E=>setTimeout(E,300));const b=yield p.toDataURL(i);y(b)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function BE(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new Sl;return n instanceof Sl&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new K4({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function FE(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 ko=r=>r?parseInt(r):0;function q4(r){const t=getComputedStyle(r),e=r.clientWidth||ko(t.width),n=r.clientHeight||ko(t.height),i=ko(t.paddingLeft)+ko(t.paddingRight),a=ko(t.paddingTop)+ko(t.paddingBottom);return[e-i,n-a]}function zE(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=q4(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(ie(t)?t:a,a),Math.max(ie(e)?e:s,s)]}class qh{constructor(t){this.type=t}}class $n extends qh{constructor(t,e){super(t),this.data=e}}class Mi extends qh{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class Po extends qh{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Jh extends qh{constructor(t,e){super(t),this.data=e}}function sr(r,t){r.emit(t.type,t)}function J4(r){if(!r)return null;if(r instanceof rm)return{type:"canvas",element:r};let t=r;for(;t;){if(Al(t))return{type:"node",element:t};if(S1(t))return{type:"edge",element:t};if(gv(t))return{type:"combo",element:t};t=t.parentElement}return null}function jE(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const Ro="cachedStyle",$h=r=>`__${r}__`;function $4(r,t){const e=Array.isArray(t)?t:[t];br(r,Ro)||bl(r,Ro,{}),e.forEach(n=>{bl(br(r,Ro),$h(n),r.attributes[n])})}function ZE(r,t){return br(r,[Ro,$h(t)])}function tB(r,t){return $h(t)in(br(r,Ro)||{})}function zj(r,t,e){set(r,[Ro,$h(t)],e)}class eB{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(([c,u])=>{var h,d,f;const{element:v,elementType:g,stage:p}=c,y=mO(this.context.options,g,p,t);(h=u==null?void 0:u.before)===null||h===void 0||h.call(u);const b=y.length?bO(v,this.inferStyle(c,n),y):null;return b?((d=u==null?void 0:u.beforeAnimate)===null||d===void 0||d.call(u,b),b.finished.then(()=>{var E,O;(E=u==null?void 0:u.afterAnimate)===null||E===void 0||E.call(u,b),(O=u==null?void 0:u.after)===null||O===void 0||O.call(u),this.animations.delete(b)})):(f=u==null?void 0:u.after)===null||f===void 0||f.call(u),b}).filter(Boolean);o.forEach(c=>this.animations.add(c));const l=Cf(o);return l?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,l),l.finished.then(()=>{var c,u;(c=e==null?void 0:e.afterAnimate)===null||c===void 0||c.call(e,l),(u=e==null?void 0:e.after)===null||u===void 0||u.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),l}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:l,updatedStyle:c={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},l),c));const{modifiedStyle:u}=t,h={},d={};if(o==="enter")Object.assign(h,{opacity:0});else if(o==="exit")Object.assign(d,{opacity:0});else if(o==="show")Object.assign(h,{opacity:0}),Object.assign(d,{opacity:(n=ZE(a,"opacity"))!==null&&n!==void 0?n:hl("opacity")});else if(o==="hide")Object.assign(h,{opacity:(i=ZE(a,"opacity"))!==null&&i!==void 0?i:hl("opacity")}),Object.assign(d,{opacity:0});else if(o==="collapse"){const{collapse:f}=e||{},{target:v,descendants:g,position:p}=f;if(s==="node"){if(g.includes(a.id)){const[y,b,E]=p;Object.assign(d,{x:y,y:b,z:E})}}else if(s==="combo"){if(a.id===v||g.includes(a.id)){const[y,b]=p;Object.assign(d,{x:y,y:b,childrenNode:l.childrenNode})}}else s==="edge"&&Object.assign(d,{sourceNode:u.sourceNode,targetNode:u.targetNode})}else if(o==="expand"){const{expand:f}=e||{},{target:v,descendants:g,position:p}=f;if(s==="node"){if(a.id===v||g.includes(a.id)){const[y,b,E]=p;Object.assign(h,{x:y,y:b,z:E})}}else if(s==="combo"){if(a.id===v||g.includes(a.id)){const[y,b,E]=p;Object.assign(h,{x:y,y:b,z:E,childrenNode:u.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:u.sourceNode,targetNode:u.targetNode})}return[Object.keys(h).length>0?Object.assign({},l,h):l,Object.keys(d).length>0?Object.assign({},u,d):u]}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 nB{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 $n(Kt.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new $n(Kt.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class rB extends Gf{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=J4(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:l}=i;if("destroyed"in l&&(Ol(l)||l.destroyed))return;const{type:c,detail:u,button:h}=e,d=Object.assign(Object.assign({},e),{target:l,targetType:o,originalTarget:n});c===Bt.POINTER_MOVE&&(this.currentTarget!==l&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${Bt.POINTER_LEAVE}`,Object.assign(Object.assign({},d),{type:Bt.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),l&&(Object.assign(d,{type:Bt.POINTER_ENTER}),a.emit(`${o}:${Bt.POINTER_ENTER}`,d))),this.currentTarget=l,this.currentTargetType=o),c===Bt.CLICK&&h===2||(a.emit(`${o}:${c}`,d),a.emit(c,d)),c===Bt.CLICK&&u===2&&(Object.assign(d,{type:Bt.DBLCLICK}),a.emit(`${o}:${Bt.DBLCLICK}`,d),a.emit(Bt.DBLCLICK,d)),c===Bt.POINTER_DOWN&&h===2&&(Object.assign(d,{type:Bt.CONTEXT_MENU,preventDefault:()=>{var f;(f=s.getContainer())===null||f===void 0||f.addEventListener(Bt.CONTEXT_MENU,v=>v.preventDefault(),{once:!0})}}),a.emit(`${o}:${Bt.CONTEXT_MENU}`,d),a.emit(Bt.CONTEXT_MENU,d))},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&&[uo.KEY_DOWN,uo.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[Bt.CLICK,Bt.DBLCLICK,Bt.POINTER_OVER,Bt.POINTER_LEAVE,Bt.POINTER_ENTER,Bt.POINTER_MOVE,Bt.POINTER_OUT,Bt.POINTER_DOWN,Bt.POINTER_UP,Bt.CONTEXT_MENU,Bt.DRAG_START,Bt.DRAG,Bt.DRAG_END,Bt.DRAG_ENTER,Bt.DRAG_OVER,Bt.DRAG_LEAVE,Bt.DROP,Bt.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[uo.KEY_DOWN,uo.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function iB(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;nv.length!==g.length?!1:v.every((p,y)=>p===g[y]),f=(v,g)=>{const p=Object.keys(v),y=Object.keys(g);return p.length!==y.length?!1:p.every(b=>v[b]===g[b])};return!(!f(s,h)||!d(a,u)||!d(e,o)||!f(n,l)||!f(i,c))}var aB=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);i0}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=fr(n);return this.isCombo(At(i))||(t===void 0||t.includes(At(i)))&&e.push(i),e},[])}getEdgeDatum(t){return fr(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=fr(n);return(t===void 0||t.includes(At(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=fr(n);return this.isCombo(At(i))&&(t===void 0||t.includes(At(i)))&&e.push(i),e},[])}getRootsData(t=ii){return this.model.getRoots(t).map(fr)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(fr)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return _s(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(At(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){Xr.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?fr(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?ii:dn,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(fr)}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 fr(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=fr(n);return t?t.includes(At(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(fr)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(fr)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),l=ja(a,e,h=>At(h),Lo),c=ja(s,n,h=>At(h),Lo),u=ja(o,i,h=>At(h),Lo);this.batch(()=>{const h={nodes:l.enter,edges:c.enter,combos:u.enter};this.addData(h),this.computeZIndex(h,"add",!0);const d={nodes:l.update,edges:c.update,combos:u.update};this.updateData(d),this.computeZIndex(d,"update",!0);const f={nodes:l.exit.map(At),edges:c.exit.map(At),combos:u.exit.map(At)};this.removeData(f)})}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:wn.NodeAdded}),j0(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:wn.EdgeAdded}),j0(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(dn)||e.attachTreeStructure(dn),e.addNodes(t.map(n=>(this.comboIds.add(At(n)),this.pushChange({value:n,type:wn.ComboAdded}),j0(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(At);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 l,c,u;const h=At(o);if(e==="add"&&ie((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o))return;const d=this.getParentData(h,dn),f=d?((u=(c=d.style)===null||c===void 0?void 0:c.zIndex)!==null&&u!==void 0?u:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:h,style:{zIndex:f}}])})}),i.forEach(o=>{var l,c,u;const h=At(o);if(e==="add"&&ie((l=o.style)===null||l===void 0?void 0:l.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let d=0;const f=this.getParentData(h,dn);if(f)d=(((c=f.style)===null||c===void 0?void 0:c.zIndex)||0)+1;else{const v=this.getParentData(h,ii);v&&(d=((u=v==null?void 0:v.style)===null||u===void 0?void 0:u.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:h,style:{zIndex:d}}])})}),a.forEach(o=>{var l,c,u,h,d;if(ie((l=o.style)===null||l===void 0?void 0:l.zIndex))return;let{id:f,source:v,target:g}=o;if(!f)f=At(o);else{const b=this.getEdgeDatum(f);v=b.source,g=b.target}if(!v||!g)return;const p=((u=(c=this.getNodeLikeDatum(v))===null||c===void 0?void 0:c.style)===null||u===void 0?void 0:u.zIndex)||0,y=((d=(h=this.getNodeLikeDatum(g))===null||h===void 0?void 0:h.style)===null||d===void 0?void 0:d.zIndex)||0;this.updateEdgeData([{id:At(o),style:{zIndex:Math.max(p,y)-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=>At(s)!==t)}),n==="combo"&&!Kr(i)){const s=new Set(this.getAncestorsData(t,dn).map(At));a.nodes=a.nodes.filter(o=>!s.has(At(o))),a.combos=a.combos.filter(o=>!s.has(At(o))),a.edges=a.edges.filter(({source:o,target:l})=>!s.has(o)&&!s.has(l))}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=At(n),a=lu(n);a!==void 0&&(e.hasTreeStructure(dn)||e.attachTreeStructure(dn),a===null&&this.refreshComboData(i),this.setParent(i,lu(n),dn));const s=n.children||[];if(s.length){e.hasTreeStructure(ii)||e.attachTreeStructure(ii);const o=s.filter(l=>e.hasNode(l));o.forEach(l=>this.setParent(l,i,ii)),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=At(i),s=fr(e.getNode(a));if(Lo(s,i))return;const o=es(s,i);this.pushChange({value:o,original:s,type:wn.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:wn.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:wn.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:wn.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=At(t);if(!e.hasNode(n))return;const i=fr(e.getNode(n)),a=es(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=At(t);if(!e.hasEdge(n))return;const i=fr(e.getEdge(n)),a=es(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=At(n),a=fr(e.getEdge(i));if(Lo(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=es(a,n);this.pushChange({value:s,original:a,type:wn.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=At(i),s=fr(e.getNode(a));if(Lo(s,i))return;const o=es(s,i);this.pushChange({value:o,original:s,type:wn.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=lu(a);if(s!==e&&n===dn){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===dn&&iB([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,dn);e&&this.pushChange({value:e,original:e,type:wn.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:wn.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return ir(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=Ne(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(l=>l===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;_s(s,l=>{const c=At(l);if(o.has(c))return;o.add(c);const[u,h,d]=ir(l),f=es(l,{style:{x:u+n,y:h+i,z:d+a}});this.pushChange({value:f,original:l,type:this.isCombo(c)?wn.ComboUpdated:wn.NodeUpdated}),this.model.mergeNodeData(c,f)},l=>this.getChildrenData(At(l)),"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[l,c,u]=ir(o),h=i-l,d=a-c,f=s-u;_s(o,v=>{const g=At(v),[p,y,b]=ir(v),E=es(v,{style:{x:p+h,y:y+d,z:b+f}});this.pushChange({value:E,original:v,type:this.isCombo(g)?wn.ComboUpdated:wn.NodeUpdated}),this.model.mergeNodeData(g,E)},v=>this.getChildrenData(At(v)),"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(At)),this.pushChange({value:this.getNodeData([e])[0],type:wn.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:wn.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:wn.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(dn)){const e=lu(this.getNodeLikeDatum(t));this.setParent(t,void 0,dn,!1),this.model.getChildren(t,dn).forEach(n=>{const i=fr(n),a=At(i);this.setParent(At(i),e,dn,!1);const s=es(i,{id:At(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?wn.ComboUpdated:wn.NodeUpdated}),this.model.mergeNodeData(At(i),s)}),me(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(pa(`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 Yl=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class lB{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 rr({className:"elements"}))}}emit(t,e){e.silence||sr(this.context.graph,t)}forEachElementData(t){Ls.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=((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 Om(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({},jy((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),jy((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,zN(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[At(e.datum)]=zy(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[At(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=At(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),l=this.getThemeStateStyle(t,this.getElementState(n)),c=this.getStateStyle(n),u=Object.assign({},i,a,s,o,l,c);if(t==="combo"){const h=this.context.model.getChildrenData(n),f=!!u.collapsed?[]:h.map(At).filter(v=>this.getElement(v));Object.assign(u,{childrenNode:f,childrenData:h})}return u}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 Yl(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:l}=a;return this.destroyElements(l,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:l}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new $n(Kt.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render"}),t),beforeAnimate:c=>this.emit(new Mi(Kt.BEFORE_ANIMATE,Hr.DRAW,c,s),t),afterAnimate:c=>this.emit(new Mi(Kt.AFTER_ANIMATE,Hr.DRAW,c,s),t),after:()=>this.emit(new $n(Kt.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:l==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=Kv(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:l=[],EdgeUpdated:c=[],EdgeRemoved:u=[],ComboAdded:h=[],ComboUpdated:d=[],ComboRemoved:f=[]}=Xc(i,y=>y.type),v=y=>new Map(y.map(b=>{const E=b.value;return[At(E),E]})),g={add:{nodes:v(a),edges:v(l),combos:v(h)},update:{nodes:v(s),edges:v(c),combos:v(d)},remove:{nodes:v(o),edges:v(u),combos:v(f)}},p=this.transformData(g,t);return e.clearChanges(),{dataChanges:n,drawData:p}}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=At(e);if(this.getElement(a))return;const o=this.getElementType(t,e),l=this.getElementComputedStyle(t,e),c=ga(t,o);if(!c)return Xr.warn(`The element ${o} of ${t} is not registered.`);this.emit(new Po(Kt.BEFORE_ELEMENT_CREATE,t,e),n);const u=this.container.appendChild(new c({id:a,context:this.context,style:l}));this.shapeTypeMap[a]=o,this.elementMap[a]=u;const{stage:h="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:u,elementType:t,stage:h,originalStyle:Object.assign({},u.attributes),updatedStyle:l},{after:()=>{var d;this.emit(new Po(Kt.AFTER_ELEMENT_CREATE,t,e),n),(d=u.onCreate)===null||d===void 0||d.call(u)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.createElement(o,c,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=At(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new Po(Kt.BEFORE_ELEMENT_UPDATE,t,e),n);const l=this.getElementType(t,e),c=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==l&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const u=s!=="visibility"?s:c.visibility==="hidden"?"hide":"show";u==="hide"&&delete c.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:u,originalStyle:Object.assign({},o.attributes),updatedStyle:c},{before:()=>{const h=this.elementMap[a];s!=="collapse"&&bv(h,c),s==="visibility"&&(tB(h,"opacity")||$4(h,"opacity"),this.visibilityCache.set(h,u==="show"?"visible":"hidden"),u==="show"&&Ps(h,"visible"))},after:()=>{var h;const d=this.elementMap[a];s==="collapse"&&bv(d,c),u==="hide"&&Ps(d,this.visibilityCache.get(d)),this.emit(new Po(Kt.AFTER_ELEMENT_UPDATE,t,e),n),(h=d.onUpdate)===null||h===void 0||h.call(d)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,l])=>{l.forEach(c=>this.updateElement(o,c,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=At(n),a=this.getElement(i);a&&q3(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=At(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new Po(Kt.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 l;this.clearElement(s),o.destroy(),(l=o.onDestroy)===null||l===void 0||l.call(o),this.emit(new Po(Kt.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,l])=>{l.forEach(c=>this.destroyElement(o,c,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=>At(s)===e);if(a){const s=ir(this.context.model.getNodeLikeDatum(e)),o=ir(a),l=ln(s,o);(i=t.nodes)===null||i===void 0||i.forEach(c=>{var u,h,d;!((u=c.style)===null||u===void 0)&&u.x&&(c.style.x+=l[0]),!((h=c.style)===null||h===void 0)&&h.y&&(c.style.y+=l[1]),!((d=c.style)===null||d===void 0)&&d.z&&(c.style.z+=l[2]||0)})}}collapseNode(t,e){return Yl(this,void 0,void 0,function*(){var n;const{animation:i}=e,{model:a}=this.context,s=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!s)return;const{drawData:o}=s,{add:l,remove:c,update:u}=o;this.markDestroyElement(o);const h={animation:i,stage:"collapse",data:o};this.destroyElements(c,h),this.createElements(l,h),this.updateElements(u,h),yield(n=this.context.animation.animate(i,{beforeAnimate:d=>this.emit(new Mi(Kt.BEFORE_ANIMATE,Hr.COLLAPSE,d,o),h),afterAnimate:d=>this.emit(new Mi(Kt.AFTER_ANIMATE,Hr.COLLAPSE,d,o),h)},{collapse:{target:t,descendants:Array.from(c.nodes).map(([,d])=>At(d)),position:ir(u.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return Yl(this,void 0,void 0,function*(){var n;const{model:i,layout:a}=this.context,{animation:s,align:o}=e,l=ir(i.getNodeData([t])[0]),c=this.computeChangesAndDrawData({stage:"expand",animation:s});if(this.createElements(c.drawData.add,{animation:!1,stage:"expand",target:t}),this.context.animation.clear(),this.computeStyle("expand"),!c)return;const{drawData:u}=c,{update:h,add:d}=u,f={animation:s,stage:"expand",data:u};d.edges.forEach(v=>h.edges.set(At(v),v)),d.nodes.forEach(v=>h.nodes.set(At(v),v)),this.updateElements(h,f),yield(n=this.context.animation.animate(s,{beforeAnimate:v=>this.emit(new Mi(Kt.BEFORE_ANIMATE,Hr.EXPAND,v,u),f),afterAnimate:v=>this.emit(new Mi(Kt.AFTER_ANIMATE,Hr.EXPAND,v,u),f)},{expand:{target:t,descendants:Array.from(d.nodes).map(([,v])=>At(v)),position:l}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return Yl(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,dn).some(g=>Kr(g)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),l=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!l)return;const{dataChanges:c,drawData:u}=l;this.markDestroyElement(u);const{update:h,remove:d}=u,f={animation:e,stage:"collapse",data:u};this.destroyElements(d,f),this.updateElements(h,f);const v=g=>Array.from(g).map(([,p])=>At(p));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new $n(Kt.BEFORE_DRAW,{dataChanges:c,animation:e}),f),beforeAnimate:g=>this.emit(new Mi(Kt.BEFORE_ANIMATE,Hr.COLLAPSE,g,u),f),afterAnimate:g=>this.emit(new Mi(Kt.AFTER_ANIMATE,Hr.COLLAPSE,g,u),f),after:()=>this.emit(new $n(Kt.AFTER_DRAW,{dataChanges:c,animation:e}),f)},{collapse:{target:t,descendants:[...v(d.nodes),...v(d.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return Yl(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=ir(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:l}=s,{add:c,update:u}=l,h={animation:e,stage:"expand",data:l,target:t};this.createElements(c,h),this.updateElements(u,h);const d=f=>Array.from(f).map(([,v])=>At(v));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new $n(Kt.BEFORE_DRAW,{dataChanges:o,animation:e}),h),beforeAnimate:f=>this.emit(new Mi(Kt.BEFORE_ANIMATE,Hr.EXPAND,f,l),h),afterAnimate:f=>this.emit(new Mi(Kt.AFTER_ANIMATE,Hr.EXPAND,f,l),h),after:()=>this.emit(new $n(Kt.AFTER_DRAW,{dataChanges:o,animation:e}),h)},{expand:{target:t,descendants:[...d(c.nodes),...d(c.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 WE=Symbol("Comlink.proxy"),cB=Symbol("Comlink.endpoint"),GE=Symbol("Comlink.releaseProxy"),Z0=Symbol("Comlink.finalizer"),td=Symbol("Comlink.thrown"),VE=r=>typeof r=="object"&&r!==null||typeof r=="function",uB={canHandle:r=>VE(r)&&r[WE],serialize(r){const{port1:t,port2:e}=new MessageChannel;return YE(r,t),[e,[e]]},deserialize(r){return r.start(),XE(r)}},hB={canHandle:r=>VE(r)&&td 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}},UE=new Map([["proxy",uB],["throw",hB]]);function dB(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function YE(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!dB(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),l=(i.data.argumentList||[]).map(Xs);let c;try{const u=o.slice(0,-1).reduce((d,f)=>d[f],r),h=o.reduce((d,f)=>d[f],r);switch(s){case"GET":c=h;break;case"SET":u[o.slice(-1)[0]]=Xs(i.data.value),c=!0;break;case"APPLY":c=h.apply(u,l);break;case"CONSTRUCT":{const d=new h(...l);c=yB(d)}break;case"ENDPOINT":{const{port1:d,port2:f}=new MessageChannel;YE(r,f),c=mB(d,[d])}break;case"RELEASE":c=void 0;break;default:return}}catch(u){c={value:u,[td]:0}}Promise.resolve(c).catch(u=>({value:u,[td]:0})).then(u=>{const[h,d]=id(u);t.postMessage(Object.assign(Object.assign({},h),{id:a}),d),s==="RELEASE"&&(t.removeEventListener("message",n),HE(t),Z0 in r&&typeof r[Z0]=="function"&&r[Z0]())}).catch(u=>{const[h,d]=id({value:new TypeError("Unserializable return value"),[td]:0});t.postMessage(Object.assign(Object.assign({},h),{id:a}),d)})}),t.start&&t.start()}function fB(r){return r.constructor.name==="MessagePort"}function HE(r){fB(r)&&r.close()}function XE(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)}}),W0(r,e,[],t)}function ed(r){if(r)throw new Error("Proxy has been released and is not useable")}function KE(r){return _o(r,new Map,{type:"RELEASE"}).then(()=>{HE(r)})}const nd=new WeakMap,rd="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=(nd.get(r)||0)-1;nd.set(r,t),t===0&&KE(r)});function vB(r,t){const e=(nd.get(t)||0)+1;nd.set(t,e),rd&&rd.register(r,t,r)}function gB(r){rd&&rd.unregister(r)}function W0(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(ed(i),o===GE)return()=>{gB(a),KE(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const l=_o(r,t,{type:"GET",path:e.map(c=>c.toString())}).then(Xs);return l.then.bind(l)}return W0(r,t,[...e,o])},set(s,o,l){ed(i);const[c,u]=id(l);return _o(r,t,{type:"SET",path:[...e,o].map(h=>h.toString()),value:c},u).then(Xs)},apply(s,o,l){ed(i);const c=e[e.length-1];if(c===cB)return _o(r,t,{type:"ENDPOINT"}).then(Xs);if(c==="bind")return W0(r,t,e.slice(0,-1));const[u,h]=QE(l);return _o(r,t,{type:"APPLY",path:e.map(d=>d.toString()),argumentList:u},h).then(Xs)},construct(s,o){ed(i);const[l,c]=QE(o);return _o(r,t,{type:"CONSTRUCT",path:e.map(u=>u.toString()),argumentList:l},c).then(Xs)}});return vB(a,r),a}function pB(r){return Array.prototype.concat.apply([],r)}function QE(r){const t=r.map(id);return[t.map(e=>e[0]),pB(t.map(e=>e[1]))]}const qE=new WeakMap;function mB(r,t){return qE.set(r,t),r}function yB(r){return Object.assign(r,{[WE]:!0})}function Zj(r,t=globalThis,e="*"){return{postMessage:(n,i)=>r.postMessage(n,e,i),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function id(r){for(const[t,e]of UE)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},qE.get(r)||[]]}function Xs(r){switch(r.type){case"HANDLER":return UE.get(r.name).deserialize(r.value);case"RAW":return r.value}}function _o(r,t,e,n){return new Promise(i=>{const a=bB();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function bB(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class xB extends Uu{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=XE(new Worker(new URL(S.p+S.u(1157),S.b),{type:void 0})),this.running&&(this.running=!1,this.execute())}execute(){var t;return(0,G.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,G._T)(e,["onTick"]),a={};Object.keys(i).forEach(c=>{fe(i[c])||(a[c]=i[c])});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]),[l]=yield this.proxy.calculateLayout(s,[o]);return l})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[GE]()}isRunning(){return this.running}}var Do=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})},EB=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=At(u),d=l.nodes.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),(i=c==null?void 0:c.edges)===null||i===void 0||i.forEach(u=>{const h=At(u),d=l.edges.get(h);o.syncEdgeDatum(u),d&&Object.assign(d.style,u.style)}),(a=c==null?void 0:c.combos)===null||a===void 0||a.forEach(u=>{const h=At(u),d=l.combos.get(h);o.syncNodeLikeDatum(u),d&&Object.assign(d.style,u.style)}),sr(s,new $n(Kt.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return Do(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;sr(n,new $n(Kt.BEFORE_LAYOUT,{type:"post"}));for(let i=0;ii.afterLayout(t,e))}simulate(){return Do(this,void 0,void 0,function*(){if(!this.options)return{};const t=Array.isArray(this.options)?this.options:[this.options];let e={};for(let n=0;n{this.updateElementPosition(c,!1)}}):(o.execute(t),o.stop(),o.tick(s));const l=yield o.execute(t);if(i){const c=this.updateElementPosition(l,i);yield c==null?void 0:c.finished}return l})}treeLayout(t,e,n){return Do(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=ga("layout",i);if(!s)return{};const{nodes:o=[],edges:l=[]}=t,c=new Un({nodes:o.map(v=>({id:At(v),data:v.data||{}})),edges:l.map(v=>({id:At(v),source:v.source,target:v.target,data:v.data||{}}))});sB(c);const u={nodes:[],edges:[]},h={nodes:[],edges:[]};c.getRoots(ii).forEach(v=>{_s(v,E=>{E.children=c.getSuccessors(E.id)},E=>c.getSuccessors(E.id),"TB");const g=s(v,e),{x:p,y,z:b=0}=g;_s(g,E=>{const{id:O,x:P,y:R,z:F=0}=E;u.nodes.push({id:O,style:{x:p,y,z:b}}),h.nodes.push({id:O,style:{x:P,y:R,z:F}})},E=>E.children,"TB")});const f=this.inferTreeLayoutOffset(h);if(JE(h,f),a){JE(u,f),this.updateElementPosition(u,!1);const v=this.updateElementPosition(h,a);yield v==null?void 0:v.finished}return h})}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:p=0,y=0}=g.style||{};n=Math.min(n,p),i=Math.max(i,p),a=Math.min(a,y),s=Math.max(s,y)});const{canvas:o}=this.context,l=o.getSize(),[c,u]=o.getCanvasByViewport([0,0]),[h,d]=o.getCanvasByViewport(l);if(n>=c&&i<=h&&a>=u&&s<=d)return[0,0];const f=(c+h)/2,v=(u+d)/2;return[f-(n+i)/2,v-(a+s)/2]}stopLayout(){this.instance&&Bv(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:l}=this.context.model.getData(),{element:c,model:u}=this.context,h=y=>c.getElement(y),d=i?y=>{var b;return!a&&(((b=y.style)===null||b===void 0?void 0:b.visibility)==="hidden"||u.getAncestorsData(y.id,ii).some(Kr)||u.getAncestorsData(y.id,dn).some(Kr))?!1:e(y)}:y=>{const b=At(y),E=h(b);return!E||Ol(E)?!1:e(y)},f=s.filter(d),v=l.filter(n),g=new Map(f.map(y=>[At(y),y]));v.forEach(y=>g.set(At(y),y));const p=o.filter(({source:y,target:b})=>g.has(y)&&g.has(b));return{nodes:f,edges:p,combos:v}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:l}=t,c=EB(t,["type","enableWorker","animation","iterations"]),[u,h]=i.getCanvasSize(),d=[u/2,h/2],f=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:b=>{const E=n==null?void 0:n.getElement(b.id);return E?E.attributes.size:n==null?void 0:n.getElementComputedStyle("node",b).size},v=ga("layout",a);if(!v)return Xr.warn(`The layout of ${a} is not registered.`);const g=Object.getPrototypeOf(v.prototype)===Hu.prototype?v:cP(v,this.context),p=new g(this.context),y={nodeSize:f,width:u,height:h,center:d};switch(p.id){case"d3-force":case"d3-force-3d":Object.assign(y,{center:{x:u/2,y:h/2,z:0}});break;default:break}return mr(p.options,y,c),p}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 JE=(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 SB(r){return[MB].reduce((e,n)=>n(e),r)}function MB(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 AB extends Gf{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;Xr.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 ad=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class TB extends Gf{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...ad.slice(0,ad.length-1),...t,ad[ad.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var Hl=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class OB{get padding(){return ai(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 l=s.apply(e,o);return a.forEach(c=>{c[n].apply(c,o)}),l}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=Cm(this.context.options,t);return e?Bs(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(),[l,c]=this.getCanvasCenter(),[u=0,h=0,d=0]=i,f=Ii([-u,-h,-d],a);return n==="relative"?{position:Ne(s,f),focalPoint:Ne(o,f)}:{position:Ne([l,c,s[2]],f),focalPoint:Ne([l,c,o[2]],f)}}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 kn(i==="relative"?n*a:a,...e)}transform(t,e){return Hl(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const l=this.getAnimation(e);if(sr(n,new Jh(Kt.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!l){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),sr(n,new Jh(Kt.AFTER_TRANSFORM,t));return}const c={};if(i&&Object.assign(c,this.getTranslateOptions(t)),ie(a)&&Object.assign(c,this.getRotateOptions(t)),ie(s)&&Object.assign(c,{zoom:this.getZoomOptions(t)}),l)return sr(n,new Mi(Kt.BEFORE_ANIMATE,Hr.TRANSFORM,null,t)),new Promise(u=>{this.transformResolver=u,this.camera.gotoLandmark(this.createLandmark(c),Object.assign(Object.assign({},l),{onfinish:()=>{sr(n,new Mi(Kt.AFTER_ANIMATE,Hr.TRANSFORM,null,t)),sr(n,new Jh(Kt.AFTER_TRANSFORM,t)),this.transformResolver=void 0,u()}}))});this.camera.gotoLandmark(this.createLandmark(c),{duration:0}),sr(n,new Jh(Kt.AFTER_TRANSFORM,t))})}fitView(t,e){return Hl(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:l="both"}=t||{},[c,u]=this.context.canvas.getSize(),h=c-s-i,d=u-n-a,f=this.context.canvas.getBounds(),v=this.getBBoxInViewport(f),[g,p]=Ba(v),y=l==="x"&&g>=h||l==="y"&&p>=d||l==="both"&&g>=h&&p>=d;if(o==="overflow"&&!y)return yield this.fitCenter({animation:e});const b=h/g,E=d/p,O=l==="x"?b:l==="y"?E:Math.min(b,E),P=this.getAnimation(e);Number.isFinite(O)&&(yield this.transform({mode:"relative",scale:O,translate:Ne(ln(this.getCanvasCenter(),this.getBBoxInViewport(f).center),Ii(this.paddingOffset,O))},P))})}fitCenter(t){return Hl(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return Hl(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=dl(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return Hl(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=ln(i,n);yield this.transform({mode:"relative",translate:Ne(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,l]=i.getViewportByCanvas(n),c=new pn;return c.setMinMax([a,s,0],[o,l,0]),c}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[l,c]=i.getCanvasByViewport(a);let u=new pn;return u.setMinMax([s,o,0],[l,c,0]),n&&(u=za(u,n)),fo(t)?Li(t,u):e?kO(t,u):u.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 mn=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(u){try{c(n.next(u))}catch(h){s(h)}}function l(u){try{c(n.throw(u))}catch(h){s(h)}}function c(u){u.done?a(u.value):i(u.value).then(o,l)}c((n=n.apply(r,t||[])).next())})};class sd extends Uu{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new oB},this.isCollapsingExpanding=!1,this.onResize=Cl(()=>{this.resize()},300),this._setOptions(Object.assign({},sd.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,SB(t)),e){const{data:d}=t;d&&this.addData(d);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:l,plugins:c,theme:u,transforms:h}=t;n&&this.setBehaviors(n),a&&this.setData(a),l&&this.setNode(l),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),u&&this.setTheme(u),c&&this.setPlugins(c),h&&this.setTransforms(h)}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=fe(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=fe(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=fe(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=fe(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=fe(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(fe(t)?t(this.getData()):t)}addData(t){this.context.model.addData(fe(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(fe(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(fe(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(fe(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(fe(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(fe(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(fe(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(fe(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(fe(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(fe(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(fe(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(fe(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 mn(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:l,devicePixelRatio:c=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof IE)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const u=Ge(e)?document.getElementById(e):e,h=zE(u);this.emit(Kt.BEFORE_CANVAS_INIT,{container:u,width:n,height:i});const d=Object.assign(Object.assign({},l),{container:u,width:n||h[0],height:i||h[1],background:o,renderer:a,cursor:s,devicePixelRatio:c}),f=new IE(d);this.context.canvas=f,yield f.ready,this.emit(Kt.AFTER_CANVAS_INIT,{canvas:f})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,l=this.context.canvas;l&&(i&&(this.emit(Kt.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),l.setRenderer(i),this.emit(Kt.AFTER_RENDERER_CHANGE,{renderer:i})),a&&l.setCursor(a),(ie(o)||ie(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 nB(this.context)),this.context.plugin||(this.context.plugin=new AB(this.context)),this.context.viewport||(this.context.viewport=new OB(this.context)),this.context.transform||(this.context.transform=new TB(this.context)),this.context.element||(this.context.element=new lB(this.context)),this.context.animation||(this.context.animation=new eB(this.context)),this.context.layout||(this.context.layout=new wB(this.context)),this.context.behavior||(this.context.behavior=new rB(this.context))}prepare(){return mn(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed){console.error(pa("The graph instance has been destroyed"));return}yield this.initCanvas(),this.initRuntime()})}render(){return mn(this,void 0,void 0,function*(){if(yield this.prepare(),sr(this,new $n(Kt.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&lP(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,sr(this,new $n(Kt.AFTER_RENDER))})}draw(){return mn(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 mn(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return mn(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;sr(this,new $n(Kt.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:l}=this.context;l==null||l.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,sr(this,new $n(Kt.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=zE((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();Wn(a,s)||(sr(this,new $n(Kt.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),sr(this,new $n(Kt.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return mn(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 mn(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 mn(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(Ge(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 mn(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 mn(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return mn(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 mn(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return mn(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 mn(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return mn(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return ln([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return mn(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=zn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeBy(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return mn(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=zn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(l).forEach(([u,h])=>this.context.model.translateNodeLikeTo(u,h)),yield(o=this.context.element.draw({animation:c,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return Gv(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return mn(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=zn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([f,v])=>{const g=this.getElementType(f);u[`${g}s`].push({id:f,style:{visibility:v}})});const{model:h,element:d}=this.context;h.preventUpdateNodeLikeHierarchy(()=>{h.updateData(u)}),yield(o=d.draw({animation:c,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return mn(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 mn(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 mn(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=zn(t)?t:{[t]:e};Object.entries(a).forEach(([l,c])=>{const u=this.getElementType(l);i[`${u}s`].push({id:l,style:{zIndex:c}})});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 mn(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 l=n.getAncestorsData(a,dn).at(-1)||this.getComboData(a),c=[l,...n.getDescendantsData(At(l))],u=s-jE(l);c.forEach(d=>{i[At(d)]=this.getElementZIndex(At(d))+u});const{internal:h}=vv(c.map(At),d=>n.getRelatedEdgesData(d));h.forEach(d=>{const f=At(d);i[f]=this.getElementZIndex(f)+u})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return jE(this.context.model.getElementDataById(t))}setElementState(t,e){return mn(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[l,c]=zn(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],u=d=>d?Array.isArray(d)?d:[d]:[],h={nodes:[],edges:[],combos:[]};Object.entries(l).forEach(([d,f])=>{const v=this.getElementType(d);h[`${v}s`].push({id:d,states:u(f)})}),this.updateData(h),yield(o=this.context.element.draw({animation:c,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 mn(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(Kr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});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 mn(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!Kr(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!0});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 mn(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)}}sd.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var CB=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=l,!o.children)return o;const{children:c}=o,u=CB(o,["children"]);return Object.assign(Object.assign({},u),{children:c.map(h=>h.id)})},getEdgeData:n=(o,l)=>({source:o.id,target:l.id}),getChildren:i=o=>o.children||[]}=t||{},a=[],s=[];return _s(r,(o,l)=>{a.push(e(o,l));const c=i(o);for(const u of c)s.push(n(o,u))},o=>i(o),"TB"),{nodes:a,edges:s}}class kB extends ts{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{$E(i,a)}),t}}const $E=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=m1(i,h=>r.getParentData(h,dn)),o=m1(a,h=>r.getParentData(h,dn)),l=At(s),c=At(o),u={sourceNode:l,targetNode:c};return t.style?Object.assign(t.style,u):t.style=u,t},PB=(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)},RB=(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)},LB=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,l=Math.pow((r-i)/(a-i),n);return s+l*(o-s)},_B=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class od extends ts{constructor(t,e){super(t,mr({},od.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,l)=>{const c=[i,a],u=[s[0],o[0]],h=[s[1],o[1]],d=[s[2],o[2]],f=(v,g)=>{if(typeof l=="function")return l(v,c,g);switch(l){case"linear":return PB(v,c,g);case"log":return RB(v,c,g);case"pow":return LB(v,c,g,2);case"sqrt":return _B(v,c,g);default:return g[0]}};return[f(n,u),f(n,h),f(n,d)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=oi(this.options.maxSize),a=oi(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,l=s.size>0?Math.min(...s.values()):0;return n.forEach(c=>{var u;const h=this.assignSizeByCentrality(s.get(At(c))||0,l,o,a,i,this.options.scale),d=(u=this.context.element)===null||u===void 0?void 0:u.getElement(At(c)),f={size:h};this.assignLabelStyle(f,h,c,d),(!d||!Qh(f,d.attributes))&&ui(t,d?"update":"add","node",mr(c,{style:f}),!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,Bs(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+NO(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 by(n,i,t)}}od.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class ld extends ts{constructor(t,e){super(t,Object.assign({},ld.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=ir(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(At(s)===At(this.ref))return;const l=Sy(ln(ir(s),e)),c=Math.abs(l)>Math.PI/2,u=!s.children||s.children.length===0,h=At(s),d=(o=this.context.element)===null||o===void 0?void 0:o.getElement(h);if(!d||!d.isVisible())return;const f=oi(n.getElementRenderStyle(h).size)[0]/2,v=(u?1:-1)*(f+this.options.offset),g=[["translate",v*Math.cos(l),v*Math.sin(l)],["rotate",c?Gr(l)+180:Gr(l)]];i.updateNodeData([{id:At(s),style:{labelTextAlign:c===u?"right":"left",labelTextBaseline:"middle",labelTransform:g}}])}),n.draw()}}ld.defaultOptions={offset:5};const DB="quadratic",tw=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class cd extends ts{constructor(t,e){super(t,Object.assign({},cd.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:l}}=n,{model:c}=this.context,u=new Map,h=(v,g)=>{c.getRelatedEdgesData(g).forEach(y=>!u.has(At(y))&&u.set(At(y),y))};a.forEach(h),o.forEach(h);const d=v=>{const g=new Set(n.remove.edges.keys()),p=c.getEdgeData().filter(y=>!g.has(At(y))).map(y=>$E(c,y));IB(v,p,!0).forEach(y=>{const b=At(y);u.has(b)||u.set(b,y)})};if(l.size&&l.forEach(d),i.size&&i.forEach(d),s.size){const v=qb(Kv(c.getChanges())).update.edges;s.forEach(g=>{var p;d(g);const y=(p=v.find(b=>At(b.value)===At(g)))===null||p===void 0?void 0:p.original;y&&!G0(g,y)&&d(y)})}ra(this.options.edges)||u.forEach((v,g)=>!this.options.edges.includes(g)&&u.delete(g));const f=c.getEdgeData().map(At);return new Map([...u].sort((v,g)=>f.indexOf(v[0])-f.indexOf(g[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=ew(i);s.forEach(l=>{l.forEach((c,u,h)=>{var d;const f=h.length,v=c.style||{};if(c.source===c.target){const y=tw.length;v.loopPlacement=tw[u%y],v.loopDist=Math.floor(u/y)*a+50}else if(f===1)v.curveOffset=0;else{const y=(u%2===0?1:-1)*(o[`${c.source}|${c.target}|${u}`]?-1:1);v.curveOffset=f%2===1?y*Math.ceil(u/2)*a*2:y*(Math.floor(u/2)*a*2+a)}const g=Object.assign(c,{type:DB,style:v}),p=(d=this.context.element)===null||d===void 0?void 0:d.getElement(At(c));(!p||!Qh(g.style,p.attributes))&&ui(n,p?"update":"add","edge",g,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(At(n))||{};return Object.keys(a).forEach(s=>{Wn(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}=ew(i);a.forEach(o=>{var l;if(o.length===1){const u=o[0],h=(l=this.context.element)===null||l===void 0?void 0:l.getElement(At(u)),d=this.resetEdgeStyle(u);(!h||!Qh(d,h.attributes))&&ui(n,h?"update":"add","edge",d);return}const c=o.map(({source:u,target:h,style:d={}},f)=>{const{startArrow:v,endArrow:g}=d,p={},[y,b]=s[`${u}|${h}|${f}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return Uo(v)&&(p[y]=v),Uo(g)&&(p[b]=g),p}).reduce((u,h)=>Object.assign(Object.assign({},u),h),{});o.forEach((u,h,d)=>{var f;if(h!==0){ui(n,"remove","edge",u);return}const v=Object.assign({},fe(this.options.style)?this.options.style(d):this.options.style,{childrenData:d});this.cacheMergeStyle.set(At(u),v);const g=Object.assign(Object.assign({},u),{type:"line",style:Object.assign(Object.assign(Object.assign({},u.style),c),v)}),p=(f=this.context.element)===null||f===void 0?void 0:f.getElement(At(u));(!p||!Qh(g.style,p.attributes))&&ui(n,p?"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}}cd.defaultOptions={mode:"bundle",distance:15};const ew=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:l}=s,c=`${o}-${l}`;t.has(c)||(t.set(c,[]),i.set(c,new Set));const u=t.get(c),h=i.get(c);u&&h&&!h.has(a)&&(u.push(s),h.add(a),e.add(a));for(const[d,f]of r)if(!(e.has(d)||d===a)&&G0(s,f)){const v=t.get(c),g=i.get(c);v&&g&&!g.has(d)&&(v.push(f),g.add(d),o===f.target&&l===f.source&&(n[`${f.source}|${f.target}|${v.length-1}`]=!0),e.add(d))}}return{edgeMap:t,reverses:n}},IB=(r,t,e)=>t.filter(n=>(e||At(n)!==At(r))&&G0(n,r)),G0=(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 BB extends ts{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,l=(c,u)=>{i.getRelatedEdgesData(u).forEach(d=>!s.has(At(d))&&s.set(At(d),d))};return a.forEach(l),o.forEach(l),t}}const FB={animation:{"combo-collapse":Rm,"combo-expand":MO,"node-collapse":km,"node-expand":wO,"path-in":Pm,"path-out":SO,fade:xO,translate:EO},behavior:{"brush-select":yl,"click-select":gu,"collapse-expand":zu,"create-edge":Gu,"drag-canvas":Vu,"drag-element-force":hP,"drag-element":Nl,"fix-element-size":Ku,"focus-element":Qu,"hover-activate":qu,"lasso-select":fP,"auto-adapt-label":cu,"optimize-viewport-transform":Ju,"scroll-canvas":$u,"zoom-canvas":th},combo:{circle:r3,rect:i3},edge:{cubic:Fs,line:Iu,polyline:Bu,quadratic:Fu,"cubic-horizontal":Lu,"cubic-radial":_u,"cubic-vertical":Du},layout:{"antv-dagre":JR,"combo-combined":EL,"compact-box":eh.compactBox,"d3-force":WL,"force-atlas2":UL,circular:eL,concentric:Rv,dagre:nh,dendrogram:eh.dendrogram,fishbone:ah,force:xb,fruchterman:XL,grid:QL,indented:eh.indented,mds:Ob,mindmap:eh.mindmap,radial:a_,random:d_,snake:sh},node:{circle:Ds,diamond:ik,ellipse:xu,hexagon:ck,html:Cu,image:Nu,rect:e3,star:n3,donut:yu,triangle:ku},palette:{spectral:m_,tableau:y_,oranges:b_,greens:x_,blues:E_},theme:{dark:G4,light:V4},plugin:{"bubble-sets":ph,"edge-bundling":yh,"edge-filter-lens":bh,"grid-line":wh,background:oh,contextmenu:mh,fisheye:xh,fullscreen:Eh,history:Sh,hull:Oh,legend:Lh,minimap:_h,snapline:Dh,timebar:Yh,title:O4,toolbar:Hh,tooltip:Xh,watermark:Kh},transform:{"arrange-draw-order":U4,"collapse-expand-combo":Y4,"collapse-expand-node":H4,"get-edge-actual-ends":kB,"map-node-size":od,"place-radial-labels":ld,"process-parallel-edges":cd,"update-related-edges":BB},shape:{circle:Ji,ellipse:al,group:rr,html:co,image:$f,line:As,path:ni,polygon:Ts,polyline:Oc,rect:pr,text:Os,label:ia,badge:po}};function zB(){Object.entries(FB).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{X4(r,e,n)})})}zB();const Wj={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"}},13722:function(U){(function(S,A){U.exports=A()})(typeof self!="undefined"?self:this,function(){return function(Q){var S={};function A(Z){if(S[Z])return S[Z].exports;var B=S[Z]={i:Z,l:!1,exports:{}};return Q[Z].call(B.exports,B,B.exports,A),B.l=!0,B.exports}return A.m=Q,A.c=S,A.d=function(Z,B,N){A.o(Z,B)||Object.defineProperty(Z,B,{configurable:!1,enumerable:!0,get:N})},A.n=function(Z){var B=Z&&Z.__esModule?function(){return Z.default}:function(){return Z};return A.d(B,"a",B),B},A.o=function(Z,B){return Object.prototype.hasOwnProperty.call(Z,B)},A.p="",A(A.s=5)}([function(Q,S){function A(Z,B,N,T){return T===void 0&&(T="height"),N==="center"?(Z[T]+B[T])/2:Z.height}Q.exports={assign:Object.assign,getHeight:A}},function(Q,S,A){var Z=A(3),B=function(){function N(k,_){_===void 0&&(_={});var C=this;C.options=_,C.rootNode=Z(k,_)}var T=N.prototype;return T.execute=function(){throw new Error("please override this method")},N}();Q.exports=B},function(Q,S,A){var Z=A(4),B=["LR","RL","TB","BT","H","V"],N=["LR","RL","H"],T=function(L){return N.indexOf(L)>-1},k=B[0];Q.exports=function(C,L,z){var D=L.direction||k;if(L.isHorizontal=T(D),D&&B.indexOf(D)===-1)throw new TypeError("Invalid direction: "+D);if(D===B[0])z(C,L);else if(D===B[1])z(C,L),C.right2left();else if(D===B[2])z(C,L);else if(D===B[3])z(C,L),C.bottom2top();else if(D===B[4]||D===B[5]){var W=Z(C,L),X=W.left,K=W.right;z(X,L),z(K,L),L.isHorizontal?X.right2left():X.bottom2top(),K.translate(X.x-K.x,X.y-K.y),C.x=X.x,C.y=K.y;var rt=C.getBoundingBox();L.isHorizontal?rt.top<0&&C.translate(0,-rt.top):rt.left<0&&C.translate(-rt.left,0)}var nt=L.fixedRoot;return nt===void 0&&(nt=!0),nt&&C.translate(-(C.x+C.width/2+C.hgap),-(C.y+C.height/2+C.vgap)),_(C,L),C};function _(C,L){if(L.radial){var z=L.isHorizontal?["x","y"]:["y","x"],D=z[0],W=z[1],X={x:1/0,y:1/0},K={x:-1/0,y:-1/0},rt=0;C.DFTraverse(function(it){rt++;var at=it.x,ut=it.y;X.x=Math.min(X.x,at),X.y=Math.min(X.y,ut),K.x=Math.max(K.x,at),K.y=Math.max(K.y,ut)});var nt=K[W]-X[W];if(nt===0)return;var q=Math.PI*2/rt;C.DFTraverse(function(it){var at=(it[W]-X[W])/nt*(Math.PI*2-q)+q,ut=it[D]-C[D];it.x=Math.cos(at)*ut,it.y=Math.sin(at)*ut})}}},function(Q,S,A){var Z=A(0),B=18,N=B*2,T=B,k={getId:function(z){return z.id||z.name},getPreH:function(z){return z.preH||0},getPreV:function(z){return z.preV||0},getHGap:function(z){return z.hgap||T},getVGap:function(z){return z.vgap||T},getChildren:function(z){return z.children},getHeight:function(z){return z.height||N},getWidth:function(z){var D=z.label||" ";return z.width||D.split("").length*B}};function _(L,z){var D=this;if(D.vgap=D.hgap=0,L instanceof _)return L;D.data=L;var W=z.getHGap(L),X=z.getVGap(L);return D.preH=z.getPreH(L),D.preV=z.getPreV(L),D.width=z.getWidth(L),D.height=z.getHeight(L),D.width+=D.preH,D.height+=D.preV,D.id=z.getId(L),D.x=D.y=0,D.depth=0,D.children||(D.children=[]),D.addGap(W,X),D}Z.assign(_.prototype,{isRoot:function(){return this.depth===0},isLeaf:function(){return this.children.length===0},addGap:function(z,D){var W=this;W.hgap+=z,W.vgap+=D,W.width+=2*z,W.height+=2*D},eachNode:function(z){for(var D=this,W=[D],X;X=W.shift();)z(X),W=X.children.concat(W)},DFTraverse:function(z){this.eachNode(z)},BFTraverse:function(z){for(var D=this,W=[D],X;X=W.shift();)z(X),W=W.concat(X.children)},getBoundingBox:function(){var z={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(function(D){z.left=Math.min(z.left,D.x),z.top=Math.min(z.top,D.y),z.width=Math.max(z.width,D.x+D.width),z.height=Math.max(z.height,D.y+D.height)}),z},translate:function(z,D){z===void 0&&(z=0),D===void 0&&(D=0),this.eachNode(function(W){W.x+=z,W.y+=D,W.x+=W.preH,W.y+=W.preV})},right2left:function(){var z=this,D=z.getBoundingBox();z.eachNode(function(W){W.x=W.x-(W.x-D.left)*2-W.width}),z.translate(D.width,0)},bottom2top:function(){var z=this,D=z.getBoundingBox();z.eachNode(function(W){W.y=W.y-(W.y-D.top)*2-W.height}),z.translate(0,D.height)}});function C(L,z,D){z===void 0&&(z={}),z=Z.assign({},k,z);var W=new _(L,z),X=[W],K;if(!D&&!L.collapsed){for(;K=X.shift();)if(!K.data.collapsed){var rt=z.getChildren(K.data),nt=rt?rt.length:0;if(K.children=new Array(nt),rt&&nt)for(var q=0;qkt.low&&(kt=kt.nxt);var Le=Ut+zt.prelim+zt.w-(Ee+Qt.prelim);Le>0&&(Ee+=Le,X(gt,Et,kt.index,Le));var tn=nt(zt),er=nt(Qt);tn<=er&&(zt=rt(zt),zt!==null&&(Ut+=zt.mod)),tn>=er&&(Qt=K(Qt),Qt!==null&&(Ee+=Qt.mod))}!zt&&Qt?q(gt,Et,Qt,Ee):zt&&!Qt&&it(gt,Et,zt,Ut)}function X(gt,Et,kt,zt){gt.c[Et].mod+=zt,gt.c[Et].msel+=zt,gt.c[Et].mser+=zt,ht(gt,Et,kt,zt)}function K(gt){return gt.cs===0?gt.tl:gt.c[0]}function rt(gt){return gt.cs===0?gt.tr:gt.c[gt.cs-1]}function nt(gt){return gt.y+gt.h}function q(gt,Et,kt,zt){var Ut=gt.c[0].el;Ut.tl=kt;var Qt=zt-kt.mod-gt.c[0].msel;Ut.mod+=Qt,Ut.prelim-=Qt,gt.c[0].el=gt.c[Et].el,gt.c[0].msel=gt.c[Et].msel}function it(gt,Et,kt,zt){var Ut=gt.c[Et].er;Ut.tr=kt;var Qt=zt-kt.mod-gt.c[Et].mser;Ut.mod+=Qt,Ut.prelim-=Qt,gt.c[Et].er=gt.c[Et-1].er,gt.c[Et].mser=gt.c[Et-1].mser}function at(gt){gt.prelim=(gt.c[0].prelim+gt.c[0].mod+gt.c[gt.cs-1].mod+gt.c[gt.cs-1].prelim+gt.c[gt.cs-1].w)/2-gt.w/2}function ut(gt,Et){Et+=gt.mod,gt.x=gt.prelim+Et,xt(gt);for(var kt=0;kt=kt.low;)kt=kt.nxt;return{low:gt,index:Et,nxt:kt}}k(_,L);var wt=A.fromNode(_,L);return z(wt),ut(wt,0),T(wt,_,L),N(_,L),_}},function(Q,S,A){function Z(D,W){D.prototype=Object.create(W.prototype),D.prototype.constructor=D,B(D,W)}function B(D,W){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,K){return X.__proto__=K,X},B(D,W)}var N=A(1),T=A(9),k=A(2),_=A(0),C=function(D){function W(){return D.apply(this,arguments)||this}Z(W,D);var X=W.prototype;return X.execute=function(){var rt=this;return rt.rootNode.width=0,k(rt.rootNode,rt.options,T)},W}(N),L={};function z(D,W){return W=_.assign({},L,W),new C(D,W).execute()}Q.exports=z},function(Q,S,A){var Z=A(0);function B(k,_){k===void 0&&(k=0),_===void 0&&(_=[]);var C=this;C.x=C.y=0,C.leftChild=C.rightChild=null,C.height=0,C.children=_}var N={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function T(k,_,C){C?(_.x=k.x,_.y=k.y):(_.x=k.y,_.y=k.x),k.children.forEach(function(L,z){T(L,_.children[z],C)})}Q.exports=function(k,_){_===void 0&&(_={}),_=Z.assign({},N,_);var C=0;function L(K){if(!K)return null;K.width=0,K.depth&&K.depth>C&&(C=K.depth);var rt=K.children,nt=rt.length,q=new B(K.height,[]);return rt.forEach(function(it,at){var ut=L(it);q.children.push(ut),at===0&&(q.leftChild=ut),at===nt-1&&(q.rightChild=ut)}),q.originNode=K,q.isLeaf=K.isLeaf(),q}function z(K){if(K.isLeaf||K.children.length===0)K.drawingDepth=C;else{var rt=K.children.map(function(q){return z(q)}),nt=Math.min.apply(null,rt);K.drawingDepth=nt-1}return K.drawingDepth}var D;function W(K){K.x=K.drawingDepth*_.rankSep,K.isLeaf?(K.y=0,D&&(K.y=D.y+D.height+_.nodeSep,K.originNode.parent!==D.originNode.parent&&(K.y+=_.subTreeSep)),D=K):(K.children.forEach(function(rt){W(rt)}),K.y=(K.leftChild.y+K.rightChild.y)/2)}var X=L(k);return z(X),W(X),T(X,k,_.isHorizontal),k}},function(Q,S,A){function Z(X,K){X.prototype=Object.create(K.prototype),X.prototype.constructor=X,B(X,K)}function B(X,K){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(rt,nt){return rt.__proto__=nt,rt},B(X,K)}var N=A(1),T=A(11),k=A(4),_=A(0),C=["LR","RL","H"],L=C[0],z=function(X){function K(){return X.apply(this,arguments)||this}Z(K,X);var rt=K.prototype;return rt.execute=function(){var q=this,it=q.options,at=q.rootNode;it.isHorizontal=!0;var ut=it.indent,ht=ut===void 0?20:ut,xt=it.dropCap,pt=xt===void 0?!0:xt,wt=it.direction,gt=wt===void 0?L:wt,Et=it.align;if(gt&&C.indexOf(gt)===-1)throw new TypeError("Invalid direction: "+gt);if(gt===C[0])T(at,ht,pt,Et);else if(gt===C[1])T(at,ht,pt,Et),at.right2left();else if(gt===C[2]){var kt=k(at,it),zt=kt.left,Ut=kt.right;T(zt,ht,pt,Et),zt.right2left(),T(Ut,ht,pt,Et);var Qt=zt.getBoundingBox();Ut.translate(Qt.width,0),at.x=Ut.x-at.width/2}return at},K}(N),D={};function W(X,K){return K=_.assign({},D,K),new z(X,K).execute()}Q.exports=W},function(Q,S,A){var Z=A(0);function B(N,T,k,_,C){var L=(typeof k=="function"?k(N):k)*N.depth;if(!_)try{if(N.id===N.parent.children[0].id){N.x+=L,N.y=T?T.y:0;return}}catch(W){}if(N.x+=L,T){if(N.y=T.y+Z.getHeight(T,N,C),T.parent&&N.parent.id!==T.parent.id){var z=T.parent,D=z.y+Z.getHeight(z,N,C);N.y=D>N.y?D:N.y}}else N.y=0}Q.exports=function(N,T,k,_){var C=null;N.eachNode(function(L){B(L,C,T,k,_),C=L})}},function(Q,S,A){function Z(D,W){D.prototype=Object.create(W.prototype),D.prototype.constructor=D,B(D,W)}function B(D,W){return B=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(X,K){return X.__proto__=K,X},B(D,W)}var N=A(1),T=A(13),k=A(2),_=A(0),C=function(D){function W(){return D.apply(this,arguments)||this}Z(W,D);var X=W.prototype;return X.execute=function(){var rt=this;return k(rt.rootNode,rt.options,T)},W}(N),L={};function z(D,W){return W=_.assign({},L,W),new C(D,W).execute()}Q.exports=z},function(Q,S,A){var Z=A(0);function B(k,_){var C=0;return k.children.length?k.children.forEach(function(L){C+=B(L,_)}):C=k.height,k._subTreeSep=_.getSubTreeSep(k.data),k.totalHeight=Math.max(k.height,C)+2*k._subTreeSep,k.totalHeight}function N(k){var _=k.children,C=_.length;if(C){_.forEach(function(K){N(K)});var L=_[0],z=_[C-1],D=z.y-L.y+z.height,W=0;if(_.forEach(function(K){W+=K.totalHeight}),D>k.height)k.y=L.y+D/2-k.height/2;else if(_.length!==1||k.height>W){var X=k.y+(k.height-D)/2-L.y;_.forEach(function(K){K.translate(0,X)})}else k.y=(L.y+L.height/2+z.y+z.height/2)/2-k.height/2}}var T={getSubTreeSep:function(){return 0}};Q.exports=function(k,_){_===void 0&&(_={}),_=Z.assign({},T,_),k.parent={x:0,width:0,height:0,y:0},k.BFTraverse(function(C){C.x=C.parent.x+C.parent.width}),k.parent=null,B(k,_),k.startY=0,k.y=k.totalHeight/2-k.height/2,k.eachNode(function(C){var L=C.children,z=L.length;if(z){var D=L[0];if(D.startY=C.startY+C._subTreeSep,z===1)D.y=C.y+C.height/2-D.height/2;else{D.y=D.startY+D.totalHeight/2-D.height/2;for(var W=1;Wit in q?T(q,it,{enumerable:!0,configurable:!0,writable:!0,value:at}):q[it]=at,W=(q,it)=>{for(var at in it||(it={}))L.call(it,at)&&D(q,at,it[at]);if(C)for(var at of C(it))z.call(it,at)&&D(q,at,it[at]);return q},X=(q,it)=>k(q,_(it));function K(q,it,at=1/3,ut){let ht=q*Math.PI*2,xt=it*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(pt,wt){return ptxt?Math.cos(xt)*(1+Math.cos(wt)*at):Math.cos(pt)*(1+Math.cos(wt)*at)},y:function(pt,wt){return ptxt?Math.sin(xt)*(1+Math.cos(wt)*at):Math.sin(pt)*(1+Math.cos(wt)*at)},z:function(pt,wt){return pt<-Math.PI*.5?Math.sin(pt):pt>Math.PI*2.5?Math.sin(pt)*ut*.1:Math.sin(wt)>0?1*ut*.1:-1}}}function rt({pieData:q=[],internalDiameterRatio:it=1/3}){var at,ut,ht,xt;const pt=[],wt=q==null?void 0:q.reduce((Ut,Qt)=>(Ut||0)+((Qt==null?void 0:Qt.value)||0),0);let gt=0,Et=0;const kt=[];for(let Ut=0;Ut<(q==null?void 0:q.length);Ut++){Et=gt+(wt==0?1:((at=q==null?void 0:q[Ut])==null?void 0:at.value)||0);const Qt={itemStyle:((ut=q==null?void 0:q[Ut])==null?void 0:ut.itemStyle)||{},name:((ht=q==null?void 0:q[Ut])==null?void 0:ht.name)||`name${Ut}`,type:"surface",parametric:!0,parametricEquation:K(gt/(wt||(q==null?void 0:q.length)),Et/(wt||(q==null?void 0:q.length)),it,((xt=q==null?void 0:q[Ut])==null?void 0:xt.value)||(wt==0?25:0)),wireframe:{show:!1},pieData:q==null?void 0:q[Ut]};kt.push(Qt.name),pt.push(Qt),gt=Et}return pt.push({name:"pie2d",type:"pie",showEmptyCircle:!0,label:{show:!0,formatter:Ut=>`${Ut.value} ${Ut.name}`},startAngle:-35,radius:["49%","50%"],center:["50%","40%"],data:[...q||[]].reverse(),itemStyle:{opacity:0}}),{legend:{left:"50%",top:"center",textStyle:{fontSize:12},data:kt},xAxis3D:{},yAxis3D:{},zAxis3D:{},grid3D:{viewControl:{alpha:45,rotateSensitivity:0,zoomSensitivity:0,panSensitivity:0,autoRotate:!1},left:"center",top:"-10%",show:!1,boxHeight:25},series:pt}}const nt=({dataSource:q=[{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:it="",style:at={},legend:ut={},internalDiameterRatio:ht=1/3})=>{const[xt,pt]=(0,A.useState)([]),wt=(0,A.useCallback)(kt=>{const zt=kt.selected||{},Ut=q.map(Qt=>Qt.name).filter(Qt=>zt[Qt]===!1);pt(Ut)},[q]),gt=(0,A.useMemo)(()=>q.filter(kt=>!xt.includes(kt.name)),[q,xt]),Et=(0,A.useMemo)(()=>{const kt=rt({pieData:gt,internalDiameterRatio:ht}),zt=q.map(Qt=>Qt.name),Ut=q.reduce((Qt,Ee)=>(Qt[Ee.name]=!xt.includes(Ee.name),Qt),{});return kt.legend=X(W(W({},kt.legend),ut),{data:zt,selected:Ut}),kt},[gt,ut,ht,q,xt]);return A.createElement(Z.Z,{onEvents:{legendselectchanged:wt},className:`w-full h-full ${it}`,option:Et,style:W({height:"100%"},at)})};Q.Z=nt},88618:function(U,Q,S){"use strict";var A,Z=Object.defineProperty,B=H=>{throw TypeError(H)},N=Math.pow,T=(H,x,w)=>x in H?Z(H,x,{enumerable:!0,configurable:!0,writable:!0,value:w}):H[x]=w,k=(H,x,w)=>T(H,typeof x!="symbol"?x+"":x,w),_=(H,x,w)=>x.has(H)||B("Cannot "+w),C=(H,x,w)=>(_(H,x,"read from private field"),w?w.call(H):x.get(H)),L=(H,x,w)=>x.has(H)?B("Cannot add the same private member more than once"):x instanceof WeakSet?x.add(H):x.set(H,w),z=(H,x,w,m)=>(_(H,x,"write to private field"),m?m.call(H,w):x.set(H,w),w),D=(H,x,w)=>(_(H,x,"access private method"),w),W,X,K;A={value:!0};var rt=S(34634),nt=S(34402);const q=" ".repeat(2),it=" ".repeat(4);function at(){return ut(this)}function ut(H,x={}){const{maxRows:w=15,maxColumns:m=10,maxNumSize:M=8,padMinus:j="auto"}=x;return`${H.constructor.name} { ${q}[ ${it}${ht(H,w,m,M,j)} ${q}] ${q}rows: ${H.rows} ${q}columns: ${H.columns} }`}function ht(H,x,w,m,M){const{rows:j,columns:tt}=H,et=Math.min(j,x),st=Math.min(tt,w),lt=[];if(M==="auto"){M=!1;t:for(let Tt=0;Tt=0&&w?` ${pt(H,x-1)}`:pt(H,x)).padEnd(x)}function pt(H,x){let w=H.toString();if(w.length<=x)return w;let m=H.toFixed(x);if(m.length>x&&(m=H.toFixed(Math.max(0,x-(m.length-x)))),m.length<=x&&!m.startsWith("0.000")&&!m.startsWith("-0.000"))return m;let M=H.toExponential(x);return M.length>x&&(M=H.toExponential(Math.max(0,x-(M.length-x)))),M.slice(0)}function wt(H,x){H.prototype.add=function(m){return typeof m=="number"?this.addS(m):this.addM(m)},H.prototype.addS=function(m){for(let M=0;M>m);return this},H.prototype.signPropagatingRightShiftM=function(m){if(m=x.checkMatrix(m),this.rows!==m.rows||this.columns!==m.columns)throw new RangeError("Matrices dimensions must be equal");for(let M=0;M>m.get(M,j));return this},H.signPropagatingRightShift=function(m,M){return new x(m).signPropagatingRightShift(M)},H.prototype.rightShift=function(m){return typeof m=="number"?this.rightShiftS(m):this.rightShiftM(m)},H.prototype.rightShiftS=function(m){for(let M=0;M>>m);return this},H.prototype.rightShiftM=function(m){if(m=x.checkMatrix(m),this.rows!==m.rows||this.columns!==m.columns)throw new RangeError("Matrices dimensions must be equal");for(let M=0;M>>m.get(M,j));return this},H.rightShift=function(m,M){return new x(m).rightShift(M)},H.prototype.zeroFillRightShift=H.prototype.rightShift,H.prototype.zeroFillRightShiftS=H.prototype.rightShiftS,H.prototype.zeroFillRightShiftM=H.prototype.rightShiftM,H.zeroFillRightShift=H.rightShift,H.prototype.not=function(){for(let m=0;mm)throw new RangeError("Row index out of range")}function Et(H,x,w){let m=w?H.columns:H.columns-1;if(x<0||x>m)throw new RangeError("Column index out of range")}function kt(H,x){if(x.to1DArray&&(x=x.to1DArray()),x.length!==H.columns)throw new RangeError("vector size must be the same as the number of columns");return x}function zt(H,x){if(x.to1DArray&&(x=x.to1DArray()),x.length!==H.rows)throw new RangeError("vector size must be the same as the number of rows");return x}function Ut(H,x){if(!rt.isAnyArray(x))throw new TypeError("row indices must be an array");for(let w=0;w=H.rows)throw new RangeError("row indices are out of range")}function Qt(H,x){if(!rt.isAnyArray(x))throw new TypeError("column indices must be an array");for(let w=0;w=H.columns)throw new RangeError("column indices are out of range")}function Ee(H,x,w,m,M){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(tn("startRow",x),tn("endRow",w),tn("startColumn",m),tn("endColumn",M),x>w||m>M||x<0||x>=H.rows||w<0||w>=H.rows||m<0||m>=H.columns||M<0||M>=H.columns)throw new RangeError("Submatrix indices are out of range")}function Le(H,x=0){let w=[];for(let m=0;m=j)throw new RangeError("min must be smaller than max");let et=j-M,st=new ne(x,w);for(let lt=0;ltm?(j=!0,m=w):(M=!1,j=!0);x++}return M}isReducedEchelonForm(){let x=0,w=0,m=-1,M=!0,j=!1;for(;xm?(j=!0,m=w):(M=!1,j=!0);for(let tt=w+1;ttx.get(M,m)&&(M=j);if(x.get(M,m)===0)m++;else{x.swapRows(w,M);let j=x.get(w,m);for(let tt=m;tt=0;)if(x.maxRow(M)===0)M--;else{let j=0,tt=!1;for(;jw[m]&&(w[m]=this.get(m,M));return w}case"column":{const w=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let m=0;mw[M]&&(w[M]=this.get(m,M));return w}case void 0:{let w=this.get(0,0);for(let m=0;mw&&(w=this.get(m,M));return w}default:throw new Error(`invalid option: ${x}`)}}maxIndex(){er(this);let x=this.get(0,0),w=[0,0];for(let m=0;mx&&(x=this.get(m,M),w[0]=m,w[1]=M);return w}min(x){if(this.isEmpty())return NaN;switch(x){case"row":{const w=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let m=0;mw&&(w=this.get(x,m));return w}maxRowIndex(x){gt(this,x),er(this);let w=this.get(x,0),m=[x,0];for(let M=1;Mw&&(w=this.get(x,M),m[1]=M);return m}minRow(x){if(gt(this,x),this.isEmpty())return NaN;let w=this.get(x,0);for(let m=1;mw&&(w=this.get(m,x));return w}maxColumnIndex(x){Et(this,x),er(this);let w=this.get(0,x),m=[0,x];for(let M=1;Mw&&(w=this.get(M,x),m[0]=M);return m}minColumn(x){if(Et(this,x),this.isEmpty())return NaN;let w=this.get(0,x);for(let m=1;m=1;M/=2)M&1&&(w=w.mmul(m)),m=m.mmul(m);return w}strassen2x2(x){x=ne.checkMatrix(x);let w=new ne(2,2);const m=this.get(0,0),M=x.get(0,0),j=this.get(0,1),tt=x.get(0,1),et=this.get(1,0),st=x.get(1,0),lt=this.get(1,1),Tt=x.get(1,1),vt=(m+lt)*(M+Tt),Ft=(et+lt)*M,qt=m*(tt-Tt),Lt=lt*(st-M),Zt=(m+j)*Tt,le=(et-m)*(M+tt),bt=(j-lt)*(st+Tt),Wt=vt+Lt-Zt+bt,ue=qt+Zt,we=Ft+Lt,Ae=vt-Ft+qt+le;return w.set(0,0,Wt),w.set(0,1,ue),w.set(1,0,we),w.set(1,1,Ae),w}strassen3x3(x){x=ne.checkMatrix(x);let w=new ne(3,3);const m=this.get(0,0),M=this.get(0,1),j=this.get(0,2),tt=this.get(1,0),et=this.get(1,1),st=this.get(1,2),lt=this.get(2,0),Tt=this.get(2,1),vt=this.get(2,2),Ft=x.get(0,0),qt=x.get(0,1),Lt=x.get(0,2),Zt=x.get(1,0),le=x.get(1,1),bt=x.get(1,2),Wt=x.get(2,0),ue=x.get(2,1),we=x.get(2,2),Ae=(m+M+j-tt-et-Tt-vt)*le,un=(m-tt)*(-qt+le),ge=et*(-Ft+qt+Zt-le-bt-Wt+we),be=(-m+tt+et)*(Ft-qt+le),Ze=(tt+et)*(-Ft+qt),Mt=m*Ft,Yt=(-m+lt+Tt)*(Ft-Lt+bt),Jt=(-m+lt)*(Lt-bt),Ht=(lt+Tt)*(-Ft+Lt),fn=(m+M+j-et-st-lt-Tt)*bt,$e=Tt*(-Ft+Lt+Zt-le-bt-Wt+ue),hn=(-j+Tt+vt)*(le+Wt-ue),vn=(j-vt)*(le-ue),nr=j*Wt,Xn=(Tt+vt)*(-Wt+ue),gn=(-j+et+st)*(bt+Wt-we),ti=(j-st)*(bt-we),vi=(et+st)*(-Wt+we),ze=M*Zt,Fn=st*ue,Mr=tt*Lt,_r=lt*qt,Tn=vt*we,Na=Mt+nr+ze,Js=Ae+be+Ze+Mt+hn+nr+Xn,bd=Mt+Yt+Ht+fn+nr+gn+vi,xd=un+ge+be+Mt+nr+gn+ti,hs=un+be+Ze+Mt+Fn,Wo=nr+gn+ti+vi+Mr,Ed=Mt+Yt+Jt+$e+hn+vn+nr,Kl=hn+vn+nr+Xn+_r,wd=Mt+Yt+Jt+Ht+Tn;return w.set(0,0,Na),w.set(0,1,Js),w.set(0,2,bd),w.set(1,0,xd),w.set(1,1,hs),w.set(1,2,Wo),w.set(2,0,Ed),w.set(2,1,Kl),w.set(2,2,wd),w}mmulStrassen(x){x=ne.checkMatrix(x);let w=this.clone(),m=w.rows,M=w.columns,j=x.rows,tt=x.columns;M!==j&&console.warn(`Multiplying ${m} x ${M} and ${j} x ${tt} matrix: dimensions do not match.`);function et(vt,Ft,qt){let Lt=vt.rows,Zt=vt.columns;if(Lt===Ft&&Zt===qt)return vt;{let le=re.zeros(Ft,qt);return le=le.setSubMatrix(vt,0,0),le}}let st=Math.max(m,j),lt=Math.max(M,tt);w=et(w,st,lt),x=et(x,st,lt);function Tt(vt,Ft,qt,Lt){if(qt<=512||Lt<=512)return vt.mmul(Ft);qt%2===1&&Lt%2===1?(vt=et(vt,qt+1,Lt+1),Ft=et(Ft,qt+1,Lt+1)):qt%2===1?(vt=et(vt,qt+1,Lt),Ft=et(Ft,qt+1,Lt)):Lt%2===1&&(vt=et(vt,qt,Lt+1),Ft=et(Ft,qt,Lt+1));let Zt=parseInt(vt.rows/2,10),le=parseInt(vt.columns/2,10),bt=vt.subMatrix(0,Zt-1,0,le-1),Wt=Ft.subMatrix(0,Zt-1,0,le-1),ue=vt.subMatrix(0,Zt-1,le,vt.columns-1),we=Ft.subMatrix(0,Zt-1,le,Ft.columns-1),Ae=vt.subMatrix(Zt,vt.rows-1,0,le-1),un=Ft.subMatrix(Zt,Ft.rows-1,0,le-1),ge=vt.subMatrix(Zt,vt.rows-1,le,vt.columns-1),be=Ft.subMatrix(Zt,Ft.rows-1,le,Ft.columns-1),Ze=Tt(re.add(bt,ge),re.add(Wt,be),Zt,le),Mt=Tt(re.add(Ae,ge),Wt,Zt,le),Yt=Tt(bt,re.sub(we,be),Zt,le),Jt=Tt(ge,re.sub(un,Wt),Zt,le),Ht=Tt(re.add(bt,ue),be,Zt,le),fn=Tt(re.sub(Ae,bt),re.add(Wt,we),Zt,le),$e=Tt(re.sub(ue,ge),re.add(un,be),Zt,le),hn=re.add(Ze,Jt);hn.sub(Ht),hn.add($e);let vn=re.add(Yt,Ht),nr=re.add(Mt,Jt),Xn=re.sub(Ze,Mt);Xn.add(Yt),Xn.add(fn);let gn=re.zeros(2*hn.rows,2*hn.columns);return gn=gn.setSubMatrix(hn,0,0),gn=gn.setSubMatrix(vn,hn.rows,0),gn=gn.setSubMatrix(nr,0,hn.columns),gn=gn.setSubMatrix(Xn,hn.rows,hn.columns),gn.subMatrix(0,qt-1,0,Lt-1)}return Tt(w,x,st,lt)}scaleRows(x={}){if(typeof x!="object")throw new TypeError("options must be an object");const{min:w=0,max:m=1}=x;if(!Number.isFinite(w))throw new TypeError("min must be a number");if(!Number.isFinite(m))throw new TypeError("max must be a number");if(w>=m)throw new RangeError("min must be smaller than max");let M=new ne(this.rows,this.columns);for(let j=0;j0&&nt(tt,{min:w,max:m,output:tt}),M.setRow(j,tt)}return M}scaleColumns(x={}){if(typeof x!="object")throw new TypeError("options must be an object");const{min:w=0,max:m=1}=x;if(!Number.isFinite(w))throw new TypeError("min must be a number");if(!Number.isFinite(m))throw new TypeError("max must be a number");if(w>=m)throw new RangeError("min must be smaller than max");let M=new ne(this.rows,this.columns);for(let j=0;jm||w<0||w>=this.columns||m<0||m>=this.columns)throw new RangeError("Argument out of range");let M=new ne(x.length,m-w+1);for(let j=0;j=this.rows)throw new RangeError(`Row index out of range: ${x[j]}`);M.set(j,tt-w,this.get(x[j],tt))}return M}subMatrixColumn(x,w,m){if(w===void 0&&(w=0),m===void 0&&(m=this.rows-1),w>m||w<0||w>=this.rows||m<0||m>=this.rows)throw new RangeError("Argument out of range");let M=new ne(m-w+1,x.length);for(let j=0;j=this.columns)throw new RangeError(`Column index out of range: ${x[j]}`);M.set(tt-w,j,this.get(tt,x[j]))}return M}setSubMatrix(x,w,m){if(x=ne.checkMatrix(x),x.isEmpty())return this;let M=w+x.rows-1,j=m+x.columns-1;Ee(this,w,M,m,j);for(let tt=0;tttypeof x=="number")}re.random=re.rand,re.randomInt=re.randInt,re.diagonal=re.diag,re.prototype.diagonal=re.prototype.diag,re.identity=re.eye,re.prototype.negate=re.prototype.neg,re.prototype.tensorProduct=re.prototype.kroneckerProduct;const ua=class X0 extends re{constructor(x,w){if(super(),L(this,W),k(this,"data"),X0.isMatrix(x))D(this,W,X).call(this,x.rows,x.columns),X0.copy(x,this);else if(Number.isInteger(x)&&x>=0)D(this,W,X).call(this,x,w);else if(rt.isAnyArray(x)){const m=x;if(x=m.length,w=x?m[0].length:0,typeof w!="number")throw new TypeError("Data must be a 2D array with at least one element");this.data=[];for(let M=0;M=0)for(let w=0;w=0)z(this,K,new ne(x,x));else if(z(this,K,new ne(x)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return C(this,K).size}get rows(){return C(this,K).rows}get columns(){return C(this,K).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(x){return ne.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 K0(this.diagonalSize);for(const[w,m,M]of this.upperRightEntries())x.set(w,m,M);return x}toMatrix(){return new ne(this)}get(x,w){return C(this,K).get(x,w)}set(x,w,m){return C(this,K).set(x,w,m),C(this,K).set(w,x,m),this}removeCross(x){return C(this,K).removeRow(x),C(this,K).removeColumn(x),this}addCross(x,w){w===void 0&&(w=x,x=this.diagonalSize);const m=w.slice();return m.splice(x,1),C(this,K).addRow(x,m),C(this,K).addColumn(x,w),this}applyMask(x){if(x.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const w=[];for(const[m,M]of x.entries())M||w.push(m);w.reverse();for(const m of w)this.removeCross(m);return this}toCompact(){const{diagonalSize:x}=this,w=new Array(x*(x+1)/2);for(let m=0,M=0,j=0;j=x&&(m=++M);return w}static fromCompact(x){const w=x.length,m=(Math.sqrt(8*w+1)-1)/2;if(!Number.isInteger(m))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(x)}`);const M=new K0(m);for(let j=0,tt=0,et=0;et=m&&(j=++tt);return M}*upperRightEntries(){for(let x=0,w=0;x=this.diagonalSize&&(w=++x)}}*upperRightValues(){for(let x=0,w=0;x=this.diagonalSize&&(w=++x)}};K=new WeakMap;let Rr=ss;Rr.prototype.klassType="SymmetricMatrix";class Hn extends Rr{static isDistanceMatrix(x){return Rr.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,w,m){return x===w&&(m=0),super.set(x,w,m)}addCross(x,w){return w===void 0&&(w=x,x=this.diagonalSize),w=w.slice(),w[x]=0,super.addCross(x,w)}toSymmetricMatrix(){return new Rr(this)}clone(){const x=new Hn(this.diagonalSize);for(const[w,m,M]of this.upperRightEntries())w!==m&&x.set(w,m,M);return x}toCompact(){const{diagonalSize:x}=this,w=(x-1)*x/2,m=new Array(w);for(let M=1,j=0,tt=0;tt=x&&(M=++j+1);return m}static fromCompact(x){const w=x.length;if(w===0)return new this(0);const m=(Math.sqrt(8*w+1)+1)/2;if(!Number.isInteger(m))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(x)}`);const M=new this(m);for(let j=1,tt=0,et=0;et=m&&(j=++tt+1);return M}}Hn.prototype.klassSubType="DistanceMatrix";class Lr extends re{constructor(x,w,m){super(),this.matrix=x,this.rows=w,this.columns=m}}class os extends Lr{constructor(x,w){Et(x,w),super(x,x.rows,1),this.column=w}set(x,w,m){return this.matrix.set(x,this.column,m),this}get(x){return this.matrix.get(x,this.column)}}class ha extends Lr{constructor(x,w){Qt(x,w),super(x,x.rows,w.length),this.columnIndices=w}set(x,w,m){return this.matrix.set(x,this.columnIndices[w],m),this}get(x,w){return this.matrix.get(x,this.columnIndices[w])}}class qs extends Lr{constructor(x){super(x,x.rows,x.columns)}set(x,w,m){return this.matrix.set(x,this.columns-w-1,m),this}get(x,w){return this.matrix.get(x,this.columns-w-1)}}class da extends Lr{constructor(x){super(x,x.rows,x.columns)}set(x,w,m){return this.matrix.set(this.rows-x-1,w,m),this}get(x,w){return this.matrix.get(this.rows-x-1,w)}}class Fo extends Lr{constructor(x,w){gt(x,w),super(x,1,x.columns),this.row=w}set(x,w,m){return this.matrix.set(this.row,w,m),this}get(x,w){return this.matrix.get(this.row,w)}}class ls extends Lr{constructor(x,w){Ut(x,w),super(x,w.length,x.columns),this.rowIndices=w}set(x,w,m){return this.matrix.set(this.rowIndices[x],w,m),this}get(x,w){return this.matrix.get(this.rowIndices[x],w)}}class cs extends Lr{constructor(x,w,m){Ut(x,w),Qt(x,m),super(x,w.length,m.length),this.rowIndices=w,this.columnIndices=m}set(x,w,m){return this.matrix.set(this.rowIndices[x],this.columnIndices[w],m),this}get(x,w){return this.matrix.get(this.rowIndices[x],this.columnIndices[w])}}class us extends Lr{constructor(x,w,m,M,j){Ee(x,w,m,M,j),super(x,m-w+1,j-M+1),this.startRow=w,this.startColumn=M}set(x,w,m){return this.matrix.set(this.startRow+x,this.startColumn+w,m),this}get(x,w){return this.matrix.get(this.startRow+x,this.startColumn+w)}}class Ti extends Lr{constructor(x){super(x,x.columns,x.rows)}set(x,w,m){return this.matrix.set(w,x,m),this}get(x,w){return this.matrix.get(w,x)}}class Oi extends re{constructor(x,w={}){const{rows:m=1}=w;if(x.length%m!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=m,this.columns=x.length/m,this.data=x}set(x,w,m){let M=this._calculateIndex(x,w);return this.data[M]=m,this}get(x,w){let m=this._calculateIndex(x,w);return this.data[m]}_calculateIndex(x,w){return x*this.columns+w}}class An extends re{constructor(x){super(),this.data=x,this.rows=x.length,this.columns=x[0].length}set(x,w,m){return this.data[x][w]=m,this}get(x,w){return this.data[x][w]}}function dd(H,x){if(rt.isAnyArray(H))return H[0]&&rt.isAnyArray(H[0])?new An(H):new Oi(H,x);throw new Error("the argument is not an array")}class Ui{constructor(x){x=An.checkMatrix(x);let w=x.clone(),m=w.rows,M=w.columns,j=new Float64Array(m),tt=1,et,st,lt,Tt,vt,Ft,qt,Lt,Zt;for(et=0;etMath.abs(Lt[Tt])&&(Tt=et);if(Tt!==st){for(lt=0;lt=0;lt--){for(st=0;sttt?M.set(j,tt,x.get(j,tt)):j===tt?M.set(j,tt,1):M.set(j,tt,0);return M}get upperTriangularMatrix(){let x=this.LU,w=x.rows,m=x.columns,M=new ne(w,m);for(let j=0;jMath.abs(x)?(w=x/H,Math.abs(H)*Math.sqrt(1+w*w)):x!==0?(w=H/x,Math.abs(x)*Math.sqrt(1+w*w)):0}class zo{constructor(x){x=An.checkMatrix(x);let w=x.clone(),m=x.rows,M=x.columns,j=new Float64Array(M),tt,et,st,lt;for(st=0;st=0;lt--){for(st=0;st=0;et--){for(j=0;j=0;Mt--)if(Lt[Mt]!==0){for(let Yt=Mt+1;Yt=0;Mt--){if(Mt0;){let Mt,Yt;for(Mt=ge-2;Mt>=-1&&Mt!==-1;Mt--){const Jt=Number.MIN_VALUE+Ze*Math.abs(Lt[Mt]+Math.abs(Lt[Mt+1]));if(Math.abs(bt[Mt])<=Jt||Number.isNaN(bt[Mt])){bt[Mt]=0;break}}if(Mt===ge-2)Yt=4;else{let Jt;for(Jt=ge-1;Jt>=Mt&&Jt!==Mt;Jt--){let Ht=(Jt!==ge?Math.abs(bt[Jt]):0)+(Jt!==Mt+1?Math.abs(bt[Jt-1]):0);if(Math.abs(Lt[Jt])<=Ze*Ht){Lt[Jt]=0;break}}Jt===Mt?Yt=3:Jt===ge-1?Yt=1:(Yt=2,Mt=Jt)}switch(Mt++,Yt){case 1:{let Jt=bt[ge-2];bt[ge-2]=0;for(let Ht=ge-2;Ht>=Mt;Ht--){let fn=Ci(Lt[Ht],Jt),$e=Lt[Ht]/fn,hn=Jt/fn;if(Lt[Ht]=fn,Ht!==Mt&&(Jt=-hn*bt[Ht-1],bt[Ht-1]=$e*bt[Ht-1]),lt)for(let vn=0;vn=Lt[Mt+1]);){let Jt=Lt[Mt];if(Lt[Mt]=Lt[Mt+1],Lt[Mt+1]=Jt,lt&&Mtw&&j.set(Tt,vt,x.get(Tt,vt)/this.s[vt]);let tt=this.U,et=tt.rows,st=tt.columns,lt=new ne(m,et);for(let Tt=0;Ttx&&w++;return w}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 ne.diag(this.s)}}function Q0(H,x=!1){return H=An.checkMatrix(H),x?new Ca(H).inverse():fd(H,ne.eye(H.rows))}function fd(H,x,w=!1){return H=An.checkMatrix(H),x=An.checkMatrix(x),w?new Ca(H).solve(x):H.isSquare()?new Ui(H).solve(x):new zo(H).solve(x)}function jo(H){if(H=ne.checkMatrix(H),H.isSquare()){if(H.columns===0)return 1;let x,w,m,M;if(H.columns===2)return x=H.get(0,0),w=H.get(0,1),m=H.get(1,0),M=H.get(1,1),x*M-w*m;if(H.columns===3){let j,tt,et;return j=new cs(H,[1,2],[1,2]),tt=new cs(H,[1,2],[0,2]),et=new cs(H,[1,2],[0,1]),x=H.get(0,0),w=H.get(0,1),m=H.get(0,2),x*jo(j)-w*jo(tt)+m*jo(et)}else return new Ui(H).determinant}else throw Error("determinant can only be calculated for a square matrix")}function q0(H,x){let w=[];for(let m=0;mM)return new Array(x.rows+1).fill(0);{let j=x.addRow(w,[0]);for(let tt=0;ttx?j[tt]=1/j[tt]:j[tt]=0;return M.mmul(ne.diag(j).mmul(m.transpose()))}function eg(H,x=H,w={}){H=new ne(H);let m=!1;if(typeof x=="object"&&!ne.isMatrix(x)&&!rt.isAnyArray(x)?(w=x,x=H,m=!0):x=new ne(x),H.rows!==x.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:M=!0}=w;M&&(H=H.center("column"),m||(x=x.center("column")));const j=H.transpose().mmul(x);for(let tt=0;tt0?M.set(j,j+1,w[j]):w[j]<0&&M.set(j,j-1,w[j])}return M}}function ng(H,x,w,m){let M,j,tt,et,st,lt,Tt,vt;for(st=0;st0;et--){for(vt=0,tt=0,lt=0;lt0&&(j=-j),x[et]=vt*j,tt=tt-M*j,w[et-1]=M-j,st=0;stlt)do{for(M=w[lt],vt=(w[lt+1]-M)/(2*x[lt]),Ft=Ci(vt,1),vt<0&&(Ft=-Ft),w[lt]=x[lt]/(vt+Ft),w[lt+1]=x[lt]*(vt+Ft),qt=w[lt+1],j=M-w[lt],tt=lt+2;tt=lt;tt--)for(le=Zt,Zt=Lt,ue=Wt,M=Lt*x[tt],j=Lt*vt,Ft=Ci(vt,x[tt]),x[tt+1]=Wt*Ft,Wt=x[tt]/Ft,Lt=vt/Ft,vt=Lt*w[tt]-Wt*M,w[tt+1]=j+Wt*(Lt*M+Wt*w[tt]),st=0;stun*Ae);w[lt]=w[lt]+we,x[lt]=0}for(tt=0;tt=vt;lt--)w[lt]=x.get(lt,vt-1)/Ft,st+=w[lt]*w[lt];for(et=Math.sqrt(st),w[vt]>0&&(et=-et),st=st-w[vt]*et,w[vt]=w[vt]-et,Tt=vt;Tt=vt;lt--)tt+=w[lt]*x.get(lt,Tt);for(tt=tt/st,lt=vt;lt<=j;lt++)x.set(lt,Tt,x.get(lt,Tt)-tt*w[lt])}for(lt=0;lt<=j;lt++){for(tt=0,Tt=j;Tt>=vt;Tt--)tt+=w[Tt]*x.get(lt,Tt);for(tt=tt/st,Tt=vt;Tt<=j;Tt++)x.set(lt,Tt,x.get(lt,Tt)-tt*w[Tt])}w[vt]=Ft*w[vt],x.set(vt,vt-1,Ft*et)}}for(lt=0;lt=M+1;vt--)if(x.get(vt,vt-1)!==0){for(lt=vt+1;lt<=j;lt++)w[lt]=x.get(lt,vt-1);for(Tt=vt;Tt<=j;Tt++){for(et=0,lt=vt;lt<=j;lt++)et+=w[lt]*m.get(lt,Tt);for(et=et/w[vt]/x.get(vt,vt-1),lt=vt;lt<=j;lt++)m.set(lt,Tt,m.get(lt,Tt)+et*w[lt])}}}function md(H,x,w,m,M){let j=H-1,tt=0,et=H-1,st=Number.EPSILON,lt=0,Tt=0,vt=0,Ft=0,qt=0,Lt=0,Zt=0,le=0,bt,Wt,ue,we,Ae,un,ge,be,Ze,Mt,Yt,Jt,Ht,fn,$e;for(bt=0;btet)&&(w[bt]=M.get(bt,bt),x[bt]=0),Wt=Math.max(bt-1,0);Wt=tt;){for(we=j;we>tt&&(Lt=Math.abs(M.get(we-1,we-1))+Math.abs(M.get(we,we)),Lt===0&&(Lt=Tt),!(Math.abs(M.get(we,we-1))=0){for(Zt=vt>=0?vt+Zt:vt-Zt,w[j-1]=be+Zt,w[j]=w[j-1],Zt!==0&&(w[j]=be-ge/Zt),x[j-1]=0,x[j]=0,be=M.get(j,j-1),Lt=Math.abs(be)+Math.abs(Zt),vt=be/Lt,Ft=Zt/Lt,qt=Math.sqrt(vt*vt+Ft*Ft),vt=vt/qt,Ft=Ft/qt,Wt=j-1;Wt0)){for(Lt=Math.sqrt(Lt),Ze=we&&(Zt=M.get(Ae,Ae),qt=be-Zt,Lt=Ze-Zt,vt=(qt*Lt-ge)/M.get(Ae+1,Ae)+M.get(Ae,Ae+1),Ft=M.get(Ae+1,Ae+1)-Zt-qt-Lt,qt=M.get(Ae+2,Ae+1),Lt=Math.abs(vt)+Math.abs(Ft)+Math.abs(qt),vt=vt/Lt,Ft=Ft/Lt,qt=qt/Lt,!(Ae===we||Math.abs(M.get(Ae,Ae-1))*(Math.abs(Ft)+Math.abs(qt))Ae+2&&M.set(bt,bt-3,0);for(ue=Ae;ue<=j-1&&(fn=ue!==j-1,ue!==Ae&&(vt=M.get(ue,ue-1),Ft=M.get(ue+1,ue-1),qt=fn?M.get(ue+2,ue-1):0,be=Math.abs(vt)+Math.abs(Ft)+Math.abs(qt),be!==0&&(vt=vt/be,Ft=Ft/be,qt=qt/be)),be!==0);ue++)if(Lt=Math.sqrt(vt*vt+Ft*Ft+qt*qt),vt<0&&(Lt=-Lt),Lt!==0){for(ue!==Ae?M.set(ue,ue-1,-Lt*be):we!==Ae&&M.set(ue,ue-1,-M.get(ue,ue-1)),vt=vt+Lt,be=vt/Lt,Ze=Ft/Lt,Zt=qt/Lt,Ft=Ft/vt,qt=qt/vt,Wt=ue;Wt=0;j--)if(vt=w[j],Ft=x[j],Ft===0)for(we=j,M.set(j,j,1),bt=j-1;bt>=0;bt--){for(ge=M.get(bt,bt)-vt,qt=0,Wt=we;Wt<=j;Wt++)qt=qt+M.get(bt,Wt)*M.get(Wt,j);if(x[bt]<0)Zt=ge,Lt=qt;else if(we=bt,x[bt]===0?M.set(bt,j,ge!==0?-qt/ge:-qt/(st*Tt)):(be=M.get(bt,bt+1),Ze=M.get(bt+1,bt),Ft=(w[bt]-vt)*(w[bt]-vt)+x[bt]*x[bt],un=(be*Lt-Zt*qt)/Ft,M.set(bt,j,un),M.set(bt+1,j,Math.abs(be)>Math.abs(Zt)?(-qt-ge*un)/be:(-Lt-Ze*un)/Zt)),un=Math.abs(M.get(bt,j)),st*un*un>1)for(Wt=bt;Wt<=j;Wt++)M.set(Wt,j,M.get(Wt,j)/un)}else if(Ft<0)for(we=j-1,Math.abs(M.get(j,j-1))>Math.abs(M.get(j-1,j))?(M.set(j-1,j-1,Ft/M.get(j,j-1)),M.set(j-1,j,-(M.get(j,j)-vt)/M.get(j,j-1))):($e=Zo(0,-M.get(j-1,j),M.get(j-1,j-1)-vt,Ft),M.set(j-1,j-1,$e[0]),M.set(j-1,j,$e[1])),M.set(j,j-1,0),M.set(j,j,1),bt=j-2;bt>=0;bt--){for(Mt=0,Yt=0,Wt=we;Wt<=j;Wt++)Mt=Mt+M.get(bt,Wt)*M.get(Wt,j-1),Yt=Yt+M.get(bt,Wt)*M.get(Wt,j);if(ge=M.get(bt,bt)-vt,x[bt]<0)Zt=ge,qt=Mt,Lt=Yt;else if(we=bt,x[bt]===0?($e=Zo(-Mt,-Yt,ge,Ft),M.set(bt,j-1,$e[0]),M.set(bt,j,$e[1])):(be=M.get(bt,bt+1),Ze=M.get(bt+1,bt),Jt=(w[bt]-vt)*(w[bt]-vt)+x[bt]*x[bt]-Ft*Ft,Ht=(w[bt]-vt)*2*Ft,Jt===0&&Ht===0&&(Jt=st*Tt*(Math.abs(ge)+Math.abs(Ft)+Math.abs(be)+Math.abs(Ze)+Math.abs(Zt))),$e=Zo(be*qt-Zt*Mt+Ft*Yt,be*Lt-Zt*Yt-Ft*Mt,Jt,Ht),M.set(bt,j-1,$e[0]),M.set(bt,j,$e[1]),Math.abs(be)>Math.abs(Zt)+Math.abs(Ft)?(M.set(bt+1,j-1,(-Mt-ge*M.get(bt,j-1)+Ft*M.get(bt,j))/be),M.set(bt+1,j,(-Yt-ge*M.get(bt,j)-Ft*M.get(bt,j-1))/be)):($e=Zo(-qt-Ze*M.get(bt,j-1),-Lt-Ze*M.get(bt,j),Zt,Ft),M.set(bt+1,j-1,$e[0]),M.set(bt+1,j,$e[1]))),un=Math.max(Math.abs(M.get(bt,j-1)),Math.abs(M.get(bt,j))),st*un*un>1)for(Wt=bt;Wt<=j;Wt++)M.set(Wt,j-1,M.get(Wt,j-1)/un),M.set(Wt,j,M.get(Wt,j)/un)}for(bt=0;btet)for(Wt=bt;Wt=tt;Wt--)for(bt=tt;bt<=et;bt++){for(Zt=0,ue=tt;ue<=Math.min(Wt,et);ue++)Zt=Zt+m.get(bt,ue)*M.get(ue,Wt);m.set(bt,Wt,Zt)}}}function Zo(H,x,w,m){let M,j;return Math.abs(w)>Math.abs(m)?(M=m/w,j=w+M*m,[(H+M*x)/j,(x-M*H)/j]):(M=w/m,j=m+M*w,[(M*H+x)/j,(M*x-H)/j])}class yd{constructor(x){if(x=An.checkMatrix(x),!x.isSymmetric())throw new Error("Matrix is not symmetric");let w=x,m=w.rows,M=new ne(m,m),j=!0,tt,et,st;for(et=0;et0),M.set(et,et,Math.sqrt(Math.max(lt,0))),st=et+1;st=0;st--)for(et=0;ettt;qt++)vt=x.transpose().mmul(et).div(et.transpose().mmul(et).get(0,0)),vt=vt.div(vt.norm()),lt=x.mmul(vt).div(vt.transpose().mmul(vt).get(0,0)),qt>0&&(st=lt.clone().sub(Ft).pow(2).sum()),Ft=lt.clone(),m?(Tt=m.transpose().mmul(lt).div(lt.transpose().mmul(lt).get(0,0)),Tt=Tt.div(Tt.norm()),et=m.mmul(Tt).div(Tt.transpose().mmul(Tt).get(0,0))):et=lt;if(m){let qt=x.transpose().mmul(lt).div(lt.transpose().mmul(lt).get(0,0));qt=qt.div(qt.norm());let Lt=x.clone().sub(lt.clone().mmul(qt.transpose())),Zt=et.transpose().mmul(lt).div(lt.transpose().mmul(lt).get(0,0)),le=m.clone().sub(lt.clone().mulS(Zt.get(0,0)).mmul(Tt.transpose()));this.t=lt,this.p=qt.transpose(),this.w=vt.transpose(),this.q=Tt,this.u=et,this.s=lt.transpose().mmul(lt),this.xResidual=Lt,this.yResidual=le,this.betas=Zt}else this.w=vt.transpose(),this.s=lt.transpose().mmul(lt).sqrt(),M?this.t=lt.clone().div(this.s.get(0,0)):this.t=lt,this.xResidual=x.sub(lt.mmul(vt.transpose()))}}Q.XA=re,Q.a_=yd,Q.yQ=yd,Q.Hs=Hn,Q.Ec=gd,Q.dx=gd,Q.LU=Ui,Q.Rm=Ui,Q.y3=ne,Q.qK=ha,Q.pb=os,Q.j=qs,Q.sO=da,Q.BZ=ls,Q.EK=Fo,Q.Db=cs,Q.Fx=us,Q.tU=Ti,Q.Ym=Xl,Q.rs=Xl,Q.QR=zo,Q.TB=zo,Q.oH=Ca,Q.Sc=Ca,Q.BN=Rr,Q.it=Oi,Q.$r=An,Q.QM=vd,Q.AV=eg,A=ne,Q.GH=jo,Q.SO=Q0,Q.uZ=$0,Q.yU=tg,Q.F1=fd,Q.re=dd},45411:function(U){"use strict";U.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(U,Q,S){var A=S(45411),Z=S(81683),B=Object.hasOwnProperty,N=Object.create(null);for(var T in A)B.call(A,T)&&(N[A[T]]=T);var k=U.exports={to:{},get:{}};k.get=function(L){var z=L.substring(0,3).toLowerCase(),D,W;switch(z){case"hsl":D=k.get.hsl(L),W="hsl";break;case"hwb":D=k.get.hwb(L),W="hwb";break;default:D=k.get.rgb(L),W="rgb";break}return D?{model:W,value:D}:null},k.get.rgb=function(L){if(!L)return null;var z=/^#([a-f0-9]{3,4})$/i,D=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,W=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,X=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,K=/^(\w+)$/,rt=[0,0,0,1],nt,q,it;if(nt=L.match(D)){for(it=nt[2],nt=nt[1],q=0;q<3;q++){var at=q*2;rt[q]=parseInt(nt.slice(at,at+2),16)}it&&(rt[3]=parseInt(it,16)/255)}else if(nt=L.match(z)){for(nt=nt[1],it=nt[3],q=0;q<3;q++)rt[q]=parseInt(nt[q]+nt[q],16);it&&(rt[3]=parseInt(it+it,16)/255)}else if(nt=L.match(W)){for(q=0;q<3;q++)rt[q]=parseInt(nt[q+1],0);nt[4]&&(nt[5]?rt[3]=parseFloat(nt[4])*.01:rt[3]=parseFloat(nt[4]))}else if(nt=L.match(X)){for(q=0;q<3;q++)rt[q]=Math.round(parseFloat(nt[q+1])*2.55);nt[4]&&(nt[5]?rt[3]=parseFloat(nt[4])*.01:rt[3]=parseFloat(nt[4]))}else return(nt=L.match(K))?nt[1]==="transparent"?[0,0,0,0]:B.call(A,nt[1])?(rt=A[nt[1]],rt[3]=1,rt):null:null;for(q=0;q<3;q++)rt[q]=_(rt[q],0,255);return rt[3]=_(rt[3],0,1),rt},k.get.hsl=function(L){if(!L)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*)?\)$/,D=L.match(z);if(D){var W=parseFloat(D[4]),X=(parseFloat(D[1])%360+360)%360,K=_(parseFloat(D[2]),0,100),rt=_(parseFloat(D[3]),0,100),nt=_(isNaN(W)?1:W,0,1);return[X,K,rt,nt]}return null},k.get.hwb=function(L){if(!L)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*)?\)$/,D=L.match(z);if(D){var W=parseFloat(D[4]),X=(parseFloat(D[1])%360+360)%360,K=_(parseFloat(D[2]),0,100),rt=_(parseFloat(D[3]),0,100),nt=_(isNaN(W)?1:W,0,1);return[X,K,rt,nt]}return null},k.to.hex=function(){var L=Z(arguments);return"#"+C(L[0])+C(L[1])+C(L[2])+(L[3]<1?C(Math.round(L[3]*255)):"")},k.to.rgb=function(){var L=Z(arguments);return L.length<4||L[3]===1?"rgb("+Math.round(L[0])+", "+Math.round(L[1])+", "+Math.round(L[2])+")":"rgba("+Math.round(L[0])+", "+Math.round(L[1])+", "+Math.round(L[2])+", "+L[3]+")"},k.to.rgb.percent=function(){var L=Z(arguments),z=Math.round(L[0]/255*100),D=Math.round(L[1]/255*100),W=Math.round(L[2]/255*100);return L.length<4||L[3]===1?"rgb("+z+"%, "+D+"%, "+W+"%)":"rgba("+z+"%, "+D+"%, "+W+"%, "+L[3]+")"},k.to.hsl=function(){var L=Z(arguments);return L.length<4||L[3]===1?"hsl("+L[0]+", "+L[1]+"%, "+L[2]+"%)":"hsla("+L[0]+", "+L[1]+"%, "+L[2]+"%, "+L[3]+")"},k.to.hwb=function(){var L=Z(arguments),z="";return L.length>=4&&L[3]!==1&&(z=", "+L[3]),"hwb("+L[0]+", "+L[1]+"%, "+L[2]+"%"+z+")"},k.to.keyword=function(L){return N[L.slice(0,3)]};function _(L,z,D){return Math.min(Math.max(z,L),D)}function C(L){var z=Math.round(L).toString(16).toUpperCase();return z.length<2?"0"+z:z}},92546:function(U,Q,S){U.exports={graphlib:S(76626),layout:S(47194),debug:S(11303),util:{time:S(53063).time,notime:S(53063).notime},version:S(11897)}},81255:function(U,Q,S){"use strict";var A=S(72361),Z=S(39240);U.exports={run:B,undo:T};function B(k){var _=k.graph().acyclicer==="greedy"?Z(k,C(k)):N(k);A.forEach(_,function(L){var z=k.edge(L);k.removeEdge(L),z.forwardName=L.name,z.reversed=!0,k.setEdge(L.w,L.v,z,A.uniqueId("rev"))});function C(L){return function(z){return L.edge(z).weight}}}function N(k){var _=[],C={},L={};function z(D){A.has(L,D)||(L[D]=!0,C[D]=!0,A.forEach(k.outEdges(D),function(W){A.has(C,W.w)?_.push(W):z(W.w)}),delete C[D])}return A.forEach(k.nodes(),z),_}function T(k){A.forEach(k.edges(),function(_){var C=k.edge(_);if(C.reversed){k.removeEdge(_);var L=C.forwardName;delete C.reversed,delete C.forwardName,k.setEdge(_.w,_.v,C,L)}})}},60765:function(U,Q,S){var A=S(72361),Z=S(53063);U.exports=B;function B(T){function k(_){var C=T.children(_),L=T.node(_);if(C.length&&A.forEach(C,k),A.has(L,"minRank")){L.borderLeft=[],L.borderRight=[];for(var z=L.minRank,D=L.maxRank+1;z0;--q)if(nt=D[q].dequeue(),nt){X=X.concat(_(z,D,W,nt,!0));break}}}return X}function _(z,D,W,X,K){var rt=K?[]:void 0;return A.forEach(z.inEdges(X.v),function(nt){var q=z.edge(nt),it=z.node(nt.v);K&&rt.push({v:nt.v,w:nt.w}),it.out-=q,L(D,W,it)}),A.forEach(z.outEdges(X.v),function(nt){var q=z.edge(nt),it=nt.w,at=z.node(it);at.in-=q,L(D,W,at)}),z.removeNode(X.v),rt}function C(z,D){var W=new Z,X=0,K=0;A.forEach(z.nodes(),function(q){W.setNode(q,{v:q,in:0,out:0})}),A.forEach(z.edges(),function(q){var it=W.edge(q.v,q.w)||0,at=D(q),ut=it+at;W.setEdge(q.v,q.w,ut),K=Math.max(K,W.node(q.v).out+=at),X=Math.max(X,W.node(q.w).in+=at)});var rt=A.range(K+X+3).map(function(){return new B}),nt=X+1;return A.forEach(W.nodes(),function(q){L(rt,nt,W.node(q))}),{graph:W,buckets:rt,zeroIdx:nt}}function L(z,D,W){W.out?W.in?z[W.out-W.in+D].enqueue(W):z[z.length-1].enqueue(W):z[0].enqueue(W)}},47194:function(U,Q,S){"use strict";var A=S(72361),Z=S(81255),B=S(27163),N=S(64505),T=S(53063).normalizeRanks,k=S(71970),_=S(53063).removeEmptyRanks,C=S(31733),L=S(60765),z=S(13257),D=S(62852),W=S(93021),X=S(53063),K=S(76626).Graph;U.exports=rt;function rt(dt,St){var Ct=St&&St.debugTiming?X.time:X.notime;Ct("layout",function(){var Gt=Ct(" buildLayoutGraph",function(){return Et(dt)});Ct(" runLayout",function(){nt(Gt,Ct)}),Ct(" updateInputGraph",function(){q(dt,Gt)})})}function nt(dt,St){St(" makeSpaceForEdgeLabels",function(){kt(dt)}),St(" removeSelfEdges",function(){ca(dt)}),St(" acyclic",function(){Z.run(dt)}),St(" nestingGraph.run",function(){C.run(dt)}),St(" rank",function(){N(X.asNonCompoundGraph(dt))}),St(" injectEdgeLabelProxies",function(){zt(dt)}),St(" removeEmptyRanks",function(){_(dt)}),St(" nestingGraph.cleanup",function(){C.cleanup(dt)}),St(" normalizeRanks",function(){T(dt)}),St(" assignRankMinMax",function(){Ut(dt)}),St(" removeEdgeLabelProxies",function(){Qt(dt)}),St(" normalize.run",function(){B.run(dt)}),St(" parentDummyChains",function(){k(dt)}),St(" addBorderSegments",function(){L(dt)}),St(" order",function(){D(dt)}),St(" insertSelfEdges",function(){as(dt)}),St(" adjustCoordinateSystem",function(){z.adjust(dt)}),St(" position",function(){W(dt)}),St(" positionSelfEdges",function(){Pt(dt)}),St(" removeBorderNodes",function(){$r(dt)}),St(" normalize.undo",function(){B.undo(dt)}),St(" fixupEdgeLabelCoords",function(){tn(dt)}),St(" undoCoordinateSystem",function(){z.undo(dt)}),St(" translateGraph",function(){Ee(dt)}),St(" assignNodeIntersects",function(){Le(dt)}),St(" reversePoints",function(){er(dt)}),St(" acyclic.undo",function(){Z.undo(dt)})}function q(dt,St){A.forEach(dt.nodes(),function(Ct){var Gt=dt.node(Ct),oe=St.node(Ct);Gt&&(Gt.x=oe.x,Gt.y=oe.y,St.children(Ct).length&&(Gt.width=oe.width,Gt.height=oe.height))}),A.forEach(dt.edges(),function(Ct){var Gt=dt.edge(Ct),oe=St.edge(Ct);Gt.points=oe.points,A.has(oe,"x")&&(Gt.x=oe.x,Gt.y=oe.y)}),dt.graph().width=St.graph().width,dt.graph().height=St.graph().height}var it=["nodesep","edgesep","ranksep","marginx","marginy"],at={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},ut=["acyclicer","ranker","rankdir","align"],ht=["width","height"],xt={width:0,height:0},pt=["minlen","weight","width","height","labeloffset"],wt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},gt=["labelpos"];function Et(dt){var St=new K({multigraph:!0,compound:!0}),Ct=It(dt.graph());return St.setGraph(A.merge({},at,_t(Ct,it),A.pick(Ct,ut))),A.forEach(dt.nodes(),function(Gt){var oe=It(dt.node(Gt));St.setNode(Gt,A.defaults(_t(oe,ht),xt)),St.setParent(Gt,dt.parent(Gt))}),A.forEach(dt.edges(),function(Gt){var oe=It(dt.edge(Gt));St.setEdge(Gt,A.merge({},wt,_t(oe,pt),A.pick(oe,gt)))}),St}function kt(dt){var St=dt.graph();St.ranksep/=2,A.forEach(dt.edges(),function(Ct){var Gt=dt.edge(Ct);Gt.minlen*=2,Gt.labelpos.toLowerCase()!=="c"&&(St.rankdir==="TB"||St.rankdir==="BT"?Gt.width+=Gt.labeloffset:Gt.height+=Gt.labeloffset)})}function zt(dt){A.forEach(dt.edges(),function(St){var Ct=dt.edge(St);if(Ct.width&&Ct.height){var Gt=dt.node(St.v),oe=dt.node(St.w),ye={rank:(oe.rank-Gt.rank)/2+Gt.rank,e:St};X.addDummyNode(dt,"edge-proxy",ye,"_ep")}})}function Ut(dt){var St=0;A.forEach(dt.nodes(),function(Ct){var Gt=dt.node(Ct);Gt.borderTop&&(Gt.minRank=dt.node(Gt.borderTop).rank,Gt.maxRank=dt.node(Gt.borderBottom).rank,St=A.max(St,Gt.maxRank))}),dt.graph().maxRank=St}function Qt(dt){A.forEach(dt.nodes(),function(St){var Ct=dt.node(St);Ct.dummy==="edge-proxy"&&(dt.edge(Ct.e).labelRank=Ct.rank,dt.removeNode(St))})}function Ee(dt){var St=Number.POSITIVE_INFINITY,Ct=0,Gt=Number.POSITIVE_INFINITY,oe=0,ye=dt.graph(),de=ye.marginx||0,_e=ye.marginy||0;function Mn(Nn){var Pe=Nn.x,Se=Nn.y,re=Nn.width,Oe=Nn.height;St=Math.min(St,Pe-re/2),Ct=Math.max(Ct,Pe+re/2),Gt=Math.min(Gt,Se-Oe/2),oe=Math.max(oe,Se+Oe/2)}A.forEach(dt.nodes(),function(Nn){Mn(dt.node(Nn))}),A.forEach(dt.edges(),function(Nn){var Pe=dt.edge(Nn);A.has(Pe,"x")&&Mn(Pe)}),St-=de,Gt-=_e,A.forEach(dt.nodes(),function(Nn){var Pe=dt.node(Nn);Pe.x-=St,Pe.y-=Gt}),A.forEach(dt.edges(),function(Nn){var Pe=dt.edge(Nn);A.forEach(Pe.points,function(Se){Se.x-=St,Se.y-=Gt}),A.has(Pe,"x")&&(Pe.x-=St),A.has(Pe,"y")&&(Pe.y-=Gt)}),ye.width=Ct-St+de,ye.height=oe-Gt+_e}function Le(dt){A.forEach(dt.edges(),function(St){var Ct=dt.edge(St),Gt=dt.node(St.v),oe=dt.node(St.w),ye,de;Ct.points?(ye=Ct.points[0],de=Ct.points[Ct.points.length-1]):(Ct.points=[],ye=oe,de=Gt),Ct.points.unshift(X.intersectRect(Gt,ye)),Ct.points.push(X.intersectRect(oe,de))})}function tn(dt){A.forEach(dt.edges(),function(St){var Ct=dt.edge(St);if(A.has(Ct,"x"))switch((Ct.labelpos==="l"||Ct.labelpos==="r")&&(Ct.width-=Ct.labeloffset),Ct.labelpos){case"l":Ct.x-=Ct.width/2+Ct.labeloffset;break;case"r":Ct.x+=Ct.width/2+Ct.labeloffset;break}})}function er(dt){A.forEach(dt.edges(),function(St){var Ct=dt.edge(St);Ct.reversed&&Ct.points.reverse()})}function $r(dt){A.forEach(dt.nodes(),function(St){if(dt.children(St).length){var Ct=dt.node(St),Gt=dt.node(Ct.borderTop),oe=dt.node(Ct.borderBottom),ye=dt.node(A.last(Ct.borderLeft)),de=dt.node(A.last(Ct.borderRight));Ct.width=Math.abs(de.x-ye.x),Ct.height=Math.abs(oe.y-Gt.y),Ct.x=ye.x+Ct.width/2,Ct.y=Gt.y+Ct.height/2}}),A.forEach(dt.nodes(),function(St){dt.node(St).dummy==="border"&&dt.removeNode(St)})}function ca(dt){A.forEach(dt.edges(),function(St){if(St.v===St.w){var Ct=dt.node(St.v);Ct.selfEdges||(Ct.selfEdges=[]),Ct.selfEdges.push({e:St,label:dt.edge(St)}),dt.removeEdge(St)}})}function as(dt){var St=X.buildLayerMatrix(dt);A.forEach(St,function(Ct){var Gt=0;A.forEach(Ct,function(oe,ye){var de=dt.node(oe);de.order=ye+Gt,A.forEach(de.selfEdges,function(_e){X.addDummyNode(dt,"selfedge",{width:_e.label.width,height:_e.label.height,rank:de.rank,order:ye+ ++Gt,e:_e.e,label:_e.label},"_se")}),delete de.selfEdges})})}function Pt(dt){A.forEach(dt.nodes(),function(St){var Ct=dt.node(St);if(Ct.dummy==="selfedge"){var Gt=dt.node(Ct.e.v),oe=Gt.x+Gt.width/2,ye=Gt.y,de=Ct.x-oe,_e=Gt.height/2;dt.setEdge(Ct.e,Ct.label),dt.removeNode(St),Ct.label.points=[{x:oe+2*de/3,y:ye-_e},{x:oe+5*de/6,y:ye-_e},{x:oe+de,y:ye},{x:oe+5*de/6,y:ye+_e},{x:oe+2*de/3,y:ye+_e}],Ct.label.x=Ct.x,Ct.label.y=Ct.y}})}function _t(dt,St){return A.mapValues(A.pick(dt,St),Number)}function It(dt){var St={};return A.forEach(dt,function(Ct,Gt){St[Gt.toLowerCase()]=Ct}),St}},72361:function(U,Q,S){var A;try{A={cloneDeep:S(20250),constant:S(13503),defaults:S(28548),each:S(76934),filter:S(64725),find:S(79785),flatten:S(40151),forEach:S(99204),forIn:S(23190),has:S(99946),isUndefined:S(16513),last:S(10611),map:S(9924),mapValues:S(70642),max:S(95987),merge:S(28440),min:S(73376),minBy:S(83296),now:S(5795),pick:S(89409),range:S(60859),reduce:S(16473),sortBy:S(351),uniqueId:S(95708),values:S(81229),zipObject:S(65441)}}catch(Z){}A||(A=window._),U.exports=A},31733:function(U,Q,S){var A=S(72361),Z=S(53063);U.exports={run:B,cleanup:_};function B(C){var L=Z.addDummyNode(C,"root",{},"_root"),z=T(C),D=A.max(A.values(z))-1,W=2*D+1;C.graph().nestingRoot=L,A.forEach(C.edges(),function(K){C.edge(K).minlen*=W});var X=k(C)+1;A.forEach(C.children(),function(K){N(C,L,W,X,D,z,K)}),C.graph().nodeRankFactor=W}function N(C,L,z,D,W,X,K){var rt=C.children(K);if(!rt.length){K!==L&&C.setEdge(L,K,{weight:0,minlen:z});return}var nt=Z.addBorderNode(C,"_bt"),q=Z.addBorderNode(C,"_bb"),it=C.node(K);C.setParent(nt,K),it.borderTop=nt,C.setParent(q,K),it.borderBottom=q,A.forEach(rt,function(at){N(C,L,z,D,W,X,at);var ut=C.node(at),ht=ut.borderTop?ut.borderTop:at,xt=ut.borderBottom?ut.borderBottom:at,pt=ut.borderTop?D:2*D,wt=ht!==xt?1:W-X[K]+1;C.setEdge(nt,ht,{weight:pt,minlen:wt,nestingEdge:!0}),C.setEdge(xt,q,{weight:pt,minlen:wt,nestingEdge:!0})}),C.parent(K)||C.setEdge(L,nt,{weight:0,minlen:W+X[K]})}function T(C){var L={};function z(D,W){var X=C.children(D);X&&X.length&&A.forEach(X,function(K){z(K,W+1)}),L[D]=W}return A.forEach(C.children(),function(D){z(D,1)}),L}function k(C){return A.reduce(C.edges(),function(L,z){return L+C.edge(z).weight},0)}function _(C){var L=C.graph();C.removeNode(L.nestingRoot),delete L.nestingRoot,A.forEach(C.edges(),function(z){var D=C.edge(z);D.nestingEdge&&C.removeEdge(z)})}},27163:function(U,Q,S){"use strict";var A=S(72361),Z=S(53063);U.exports={run:B,undo:T};function B(k){k.graph().dummyChains=[],A.forEach(k.edges(),function(_){N(k,_)})}function N(k,_){var C=_.v,L=k.node(C).rank,z=_.w,D=k.node(z).rank,W=_.name,X=k.edge(_),K=X.labelRank;if(D!==L+1){k.removeEdge(_);var rt,nt,q;for(q=0,++L;L0;)K%2&&(rt+=D[K+1]),K=K-1>>1,D[K]+=X.weight;W+=X.weight*rt})),W}},62852:function(U,Q,S){"use strict";var A=S(72361),Z=S(18043),B=S(45456),N=S(86490),T=S(59105),k=S(52205),_=S(76626).Graph,C=S(53063);U.exports=L;function L(X){var K=C.maxRank(X),rt=z(X,A.range(1,K+1),"inEdges"),nt=z(X,A.range(K-1,-1,-1),"outEdges"),q=Z(X);W(X,q);for(var it=Number.POSITIVE_INFINITY,at,ut=0,ht=0;ht<4;++ut,++ht){D(ut%2?rt:nt,ut%4>=2),q=C.buildLayerMatrix(X);var xt=B(X,q);xt=z.barycenter)&&N(z,D)}}function C(z){return function(D){D.in.push(z),--D.indegree===0&&T.push(D)}}for(;T.length;){var L=T.pop();k.push(L),A.forEach(L.in.reverse(),_(L)),A.forEach(L.out,C(L))}return A.map(A.filter(k,function(z){return!z.merged}),function(z){return A.pick(z,["vs","i","barycenter","weight"])})}function N(T,k){var _=0,C=0;T.weight&&(_+=T.barycenter*T.weight,C+=T.weight),k.weight&&(_+=k.barycenter*k.weight,C+=k.weight),T.vs=k.vs.concat(T.vs),T.barycenter=_/C,T.weight=C,T.i=Math.min(k.i,T.i),k.merged=!0}},86490:function(U,Q,S){var A=S(72361),Z=S(99506),B=S(45926),N=S(1349);U.exports=T;function T(C,L,z,D){var W=C.children(L),X=C.node(L),K=X?X.borderLeft:void 0,rt=X?X.borderRight:void 0,nt={};K&&(W=A.filter(W,function(xt){return xt!==K&&xt!==rt}));var q=Z(C,W);A.forEach(q,function(xt){if(C.children(xt.v).length){var pt=T(C,xt.v,z,D);nt[xt.v]=pt,A.has(pt,"barycenter")&&_(xt,pt)}});var it=B(q,z);k(it,nt);var at=N(it,D);if(K&&(at.vs=A.flatten([K,at.vs,rt],!0),C.predecessors(K).length)){var ut=C.node(C.predecessors(K)[0]),ht=C.node(C.predecessors(rt)[0]);A.has(at,"barycenter")||(at.barycenter=0,at.weight=0),at.barycenter=(at.barycenter*at.weight+ut.order+ht.order)/(at.weight+2),at.weight+=2}return at}function k(C,L){A.forEach(C,function(z){z.vs=A.flatten(z.vs.map(function(D){return L[D]?L[D].vs:D}),!0)})}function _(C,L){A.isUndefined(C.barycenter)?(C.barycenter=L.barycenter,C.weight=L.weight):(C.barycenter=(C.barycenter*C.weight+L.barycenter*L.weight)/(C.weight+L.weight),C.weight+=L.weight)}},1349:function(U,Q,S){var A=S(72361),Z=S(53063);U.exports=B;function B(k,_){var C=Z.partition(k,function(nt){return A.has(nt,"barycenter")}),L=C.lhs,z=A.sortBy(C.rhs,function(nt){return-nt.i}),D=[],W=0,X=0,K=0;L.sort(T(!!_)),K=N(D,z,K),A.forEach(L,function(nt){K+=nt.vs.length,D.push(nt.vs),W+=nt.barycenter*nt.weight,X+=nt.weight,K=N(D,z,K)});var rt={vs:A.flatten(D,!0)};return X&&(rt.barycenter=W/X,rt.weight=X),rt}function N(k,_,C){for(var L;_.length&&(L=A.last(_)).i<=C;)_.pop(),k.push(L.vs),C++;return C}function T(k){return function(_,C){return _.barycenterC.barycenter?1:k?C.i-_.i:_.i-C.i}}},71970:function(U,Q,S){var A=S(72361);U.exports=Z;function Z(T){var k=N(T);A.forEach(T.graph().dummyChains,function(_){for(var C=T.node(_),L=C.edgeObj,z=B(T,k,L.v,L.w),D=z.path,W=z.lca,X=0,K=D[X],rt=!0;_!==L.w;){if(C=T.node(_),rt){for(;(K=D[X])!==W&&T.node(K).maxRankD||W>k[X].lim));for(K=X,X=C;(X=T.parent(X))!==K;)z.push(X);return{path:L.concat(z.reverse()),lca:K}}function N(T){var k={},_=0;function C(L){var z=_;A.forEach(T.children(L),C),k[L]={low:z,lim:_++}}return A.forEach(T.children(),C),k}},92080:function(U,Q,S){"use strict";var A=S(72361),Z=S(76626).Graph,B=S(53063);U.exports={positionX:rt,findType1Conflicts:N,findType2Conflicts:T,addConflict:_,hasConflict:C,verticalAlignment:L,horizontalCompaction:z,alignCoordinates:X,findSmallestWidthAlignment:W,balance:K};function N(it,at){var ut={};function ht(xt,pt){var wt=0,gt=0,Et=xt.length,kt=A.last(pt);return A.forEach(pt,function(zt,Ut){var Qt=k(it,zt),Ee=Qt?it.node(Qt).order:Et;(Qt||zt===kt)&&(A.forEach(pt.slice(gt,Ut+1),function(Le){A.forEach(it.predecessors(Le),function(tn){var er=it.node(tn),$r=er.order;($rkt)&&_(ut,Qt,zt)})})}function xt(pt,wt){var gt=-1,Et,kt=0;return A.forEach(wt,function(zt,Ut){if(it.node(zt).dummy==="border"){var Qt=it.predecessors(zt);Qt.length&&(Et=it.node(Qt[0]).order,ht(wt,kt,Ut,gt,Et),kt=Ut,gt=Et)}ht(wt,kt,wt.length,Et,pt.length)}),wt}return A.reduce(at,xt),ut}function k(it,at){if(it.node(at).dummy)return A.find(it.predecessors(at),function(ut){return it.node(ut).dummy})}function _(it,at,ut){if(at>ut){var ht=at;at=ut,ut=ht}var xt=it[at];xt||(it[at]=xt={}),xt[ut]=!0}function C(it,at,ut){if(at>ut){var ht=at;at=ut,ut=ht}return A.has(it[at],ut)}function L(it,at,ut,ht){var xt={},pt={},wt={};return A.forEach(at,function(gt){A.forEach(gt,function(Et,kt){xt[Et]=Et,pt[Et]=Et,wt[Et]=kt})}),A.forEach(at,function(gt){var Et=-1;A.forEach(gt,function(kt){var zt=ht(kt);if(zt.length){zt=A.sortBy(zt,function(tn){return wt[tn]});for(var Ut=(zt.length-1)/2,Qt=Math.floor(Ut),Ee=Math.ceil(Ut);Qt<=Ee;++Qt){var Le=zt[Qt];pt[kt]===kt&&EtEt.lim&&(kt=Et,zt=!0);var Ut=A.filter(ht.edges(),function(Qt){return zt===at(ut,ut.node(Qt.v),kt)&&zt!==at(ut,ut.node(Qt.w),kt)});return A.minBy(Ut,function(Qt){return B(ht,Qt)})}function nt(ut,ht,xt,pt){var wt=xt.v,gt=xt.w;ut.removeEdge(wt,gt),ut.setEdge(pt.v,pt.w,{}),W(ut),L(ut,ht),q(ut,ht)}function q(ut,ht){var xt=A.find(ut.nodes(),function(wt){return!ht.node(wt).parent}),pt=T(ut,xt);pt=pt.slice(1),A.forEach(pt,function(wt){var gt=ut.node(wt).parent,Et=ht.edge(wt,gt),kt=!1;Et||(Et=ht.edge(gt,wt),kt=!0),ht.node(wt).rank=ht.node(gt).rank+(kt?Et.minlen:-Et.minlen)})}function it(ut,ht,xt){return ut.hasEdge(ht,xt)}function at(ut,ht,xt){return xt.low<=ht.lim&&ht.lim<=xt.lim}},2416:function(U,Q,S){"use strict";var A=S(72361);U.exports={longestPath:Z,slack:B};function Z(N){var T={};function k(_){var C=N.node(_);if(A.has(T,_))return C.rank;T[_]=!0;var L=A.min(A.map(N.outEdges(_),function(z){return k(z.w)-N.edge(z).minlen}));return(L===Number.POSITIVE_INFINITY||L===void 0||L===null)&&(L=0),C.rank=L}A.forEach(N.sources(),k)}function B(N,T){return N.node(T.w).rank-N.node(T.v).rank-N.edge(T).minlen}},53063:function(U,Q,S){"use strict";var A=S(72361),Z=S(76626).Graph;U.exports={addDummyNode:B,simplify:N,asNonCompoundGraph:T,successorWeights:k,predecessorWeights:_,intersectRect:C,buildLayerMatrix:L,normalizeRanks:z,removeEmptyRanks:D,addBorderNode:W,maxRank:X,partition:K,time:rt,notime:nt};function B(q,it,at,ut){var ht;do ht=A.uniqueId(ut);while(q.hasNode(ht));return at.dummy=it,q.setNode(ht,at),ht}function N(q){var it=new Z().setGraph(q.graph());return A.forEach(q.nodes(),function(at){it.setNode(at,q.node(at))}),A.forEach(q.edges(),function(at){var ut=it.edge(at.v,at.w)||{weight:0,minlen:1},ht=q.edge(at);it.setEdge(at.v,at.w,{weight:ut.weight+ht.weight,minlen:Math.max(ut.minlen,ht.minlen)})}),it}function T(q){var it=new Z({multigraph:q.isMultigraph()}).setGraph(q.graph());return A.forEach(q.nodes(),function(at){q.children(at).length||it.setNode(at,q.node(at))}),A.forEach(q.edges(),function(at){it.setEdge(at,q.edge(at))}),it}function k(q){var it=A.map(q.nodes(),function(at){var ut={};return A.forEach(q.outEdges(at),function(ht){ut[ht.w]=(ut[ht.w]||0)+q.edge(ht).weight}),ut});return A.zipObject(q.nodes(),it)}function _(q){var it=A.map(q.nodes(),function(at){var ut={};return A.forEach(q.inEdges(at),function(ht){ut[ht.v]=(ut[ht.v]||0)+q.edge(ht).weight}),ut});return A.zipObject(q.nodes(),it)}function C(q,it){var at=q.x,ut=q.y,ht=it.x-at,xt=it.y-ut,pt=q.width/2,wt=q.height/2;if(!ht&&!xt)throw new Error("Not possible to find intersection inside of the rectangle");var gt,Et;return Math.abs(xt)*pt>Math.abs(ht)*wt?(xt<0&&(wt=-wt),gt=wt*ht/xt,Et=wt):(ht<0&&(pt=-pt),gt=pt,Et=pt*xt/ht),{x:at+gt,y:ut+Et}}function L(q){var it=A.map(A.range(X(q)+1),function(){return[]});return A.forEach(q.nodes(),function(at){var ut=q.node(at),ht=ut.rank;A.isUndefined(ht)||(it[ht][ut.order]=at)}),it}function z(q){var it=A.min(A.map(q.nodes(),function(at){return q.node(at).rank}));A.forEach(q.nodes(),function(at){var ut=q.node(at);A.has(ut,"rank")&&(ut.rank-=it)})}function D(q){var it=A.min(A.map(q.nodes(),function(xt){return q.node(xt).rank})),at=[];A.forEach(q.nodes(),function(xt){var pt=q.node(xt).rank-it;at[pt]||(at[pt]=[]),at[pt].push(xt)});var ut=0,ht=q.graph().nodeRankFactor;A.forEach(at,function(xt,pt){A.isUndefined(xt)&&pt%ht!==0?--ut:ut&&A.forEach(xt,function(wt){q.node(wt).rank+=ut})})}function W(q,it,at,ut){var ht={width:0,height:0};return arguments.length>=4&&(ht.rank=at,ht.order=ut),B(q,"border",ht,it)}function X(q){return A.max(A.map(q.nodes(),function(it){var at=q.node(it).rank;if(!A.isUndefined(at))return at}))}function K(q,it){var at={lhs:[],rhs:[]};return A.forEach(q,function(ut){it(ut)?at.lhs.push(ut):at.rhs.push(ut)}),at}function rt(q,it){var at=A.now();try{return it()}finally{console.log(q+" time: "+(A.now()-at)+"ms")}}function nt(q,it){return it()}},11897:function(U){U.exports="0.8.5"},37271:function(U){"use strict";var Q=Object.prototype.hasOwnProperty,S="~";function A(){}Object.create&&(A.prototype=Object.create(null),new A().__proto__||(S=!1));function Z(k,_,C){this.fn=k,this.context=_,this.once=C||!1}function B(k,_,C,L,z){if(typeof C!="function")throw new TypeError("The listener must be a function");var D=new Z(C,L||k,z),W=S?S+_:_;return k._events[W]?k._events[W].fn?k._events[W]=[k._events[W],D]:k._events[W].push(D):(k._events[W]=D,k._eventsCount++),k}function N(k,_){--k._eventsCount===0?k._events=new A:delete k._events[_]}function T(){this._events=new A,this._eventsCount=0}T.prototype.eventNames=function(){var _=[],C,L;if(this._eventsCount===0)return _;for(L in C=this._events)Q.call(C,L)&&_.push(S?L.slice(1):L);return Object.getOwnPropertySymbols?_.concat(Object.getOwnPropertySymbols(C)):_},T.prototype.listeners=function(_){var C=S?S+_:_,L=this._events[C];if(!L)return[];if(L.fn)return[L.fn];for(var z=0,D=L.length,W=new Array(D);z0&&(W=D.removeMin(),X=z[W],X.distance!==Number.POSITIVE_INFINITY);)L(W).forEach(K);return z}},59324:function(U,Q,S){var A=S(95329),Z=S(94558);U.exports=B;function B(N){return A.filter(Z(N),function(T){return T.length>1||T.length===1&&N.hasEdge(T[0],T[0])})}},22893:function(U,Q,S){var A=S(95329);U.exports=B;var Z=A.constant(1);function B(T,k,_){return N(T,k||Z,_||function(C){return T.outEdges(C)})}function N(T,k,_){var C={},L=T.nodes();return L.forEach(function(z){C[z]={},C[z][z]={distance:0},L.forEach(function(D){z!==D&&(C[z][D]={distance:Number.POSITIVE_INFINITY})}),_(z).forEach(function(D){var W=D.v===z?D.w:D.v,X=k(D);C[z][W]={distance:X,predecessor:z}})}),L.forEach(function(z){var D=C[z];L.forEach(function(W){var X=C[W];L.forEach(function(K){var rt=X[z],nt=D[K],q=X[K],it=rt.distance+nt.distance;it0;){if(z=L.removeMin(),A.has(C,z))_.setEdge(z,C[z]);else{if(W)throw new Error("Input graph is not connected: "+T);W=!0}T.nodeEdges(z).forEach(D)}return _}},94558:function(U,Q,S){var A=S(95329);U.exports=Z;function Z(B){var N=0,T=[],k={},_=[];function C(L){var z=k[L]={onStack:!0,lowlink:N,index:N++};if(T.push(L),B.successors(L).forEach(function(X){A.has(k,X)?k[X].onStack&&(z.lowlink=Math.min(z.lowlink,k[X].index)):(C(X),z.lowlink=Math.min(z.lowlink,k[X].lowlink))}),z.lowlink===z.index){var D=[],W;do W=T.pop(),k[W].onStack=!1,D.push(W);while(L!==W);_.push(D)}}return B.nodes().forEach(function(L){A.has(k,L)||C(L)}),_}},7793:function(U,Q,S){var A=S(95329);U.exports=Z,Z.CycleException=B;function Z(N){var T={},k={},_=[];function C(L){if(A.has(k,L))throw new B;A.has(T,L)||(k[L]=!0,T[L]=!0,A.each(N.predecessors(L),C),delete k[L],_.push(L))}if(A.each(N.sinks(),C),A.size(T)!==N.nodeCount())throw new B;return _}function B(){}B.prototype=new Error},36614:function(U,Q,S){var A=S(95329);U.exports=Z;function Z(){this._arr=[],this._keyIndices={}}Z.prototype.size=function(){return this._arr.length},Z.prototype.keys=function(){return this._arr.map(function(B){return B.key})},Z.prototype.has=function(B){return A.has(this._keyIndices,B)},Z.prototype.priority=function(B){var N=this._keyIndices[B];if(N!==void 0)return this._arr[N].priority},Z.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},Z.prototype.add=function(B,N){var T=this._keyIndices;if(B=String(B),!A.has(T,B)){var k=this._arr,_=k.length;return T[B]=_,k.push({key:B,priority:N}),this._decrease(_),!0}return!1},Z.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var B=this._arr.pop();return delete this._keyIndices[B.key],this._heapify(0),B.key},Z.prototype.decrease=function(B,N){var T=this._keyIndices[B];if(N>this._arr[T].priority)throw new Error("New priority is greater than current priority. Key: "+B+" Old: "+this._arr[T].priority+" New: "+N);this._arr[T].priority=N,this._decrease(T)},Z.prototype._heapify=function(B){var N=this._arr,T=2*B,k=T+1,_=B;T>1,!(N[k].priority1?K.setNode(rt,W):K.setNode(rt)}),this},T.prototype.setNode=function(D,W){return A.has(this._nodes,D)?(arguments.length>1&&(this._nodes[D]=W),this):(this._nodes[D]=arguments.length>1?W:this._defaultNodeLabelFn(D),this._isCompound&&(this._parent[D]=B,this._children[D]={},this._children[B][D]=!0),this._in[D]={},this._preds[D]={},this._out[D]={},this._sucs[D]={},++this._nodeCount,this)},T.prototype.node=function(D){return this._nodes[D]},T.prototype.hasNode=function(D){return A.has(this._nodes,D)},T.prototype.removeNode=function(D){var W=this;if(A.has(this._nodes,D)){var X=function(K){W.removeEdge(W._edgeObjs[K])};delete this._nodes[D],this._isCompound&&(this._removeFromParentsChildList(D),delete this._parent[D],A.each(this.children(D),function(K){W.setParent(K)}),delete this._children[D]),A.each(A.keys(this._in[D]),X),delete this._in[D],delete this._preds[D],A.each(A.keys(this._out[D]),X),delete this._out[D],delete this._sucs[D],--this._nodeCount}return this},T.prototype.setParent=function(D,W){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(A.isUndefined(W))W=B;else{W+="";for(var X=W;!A.isUndefined(X);X=this.parent(X))if(X===D)throw new Error("Setting "+W+" as parent of "+D+" would create a cycle");this.setNode(W)}return this.setNode(D),this._removeFromParentsChildList(D),this._parent[D]=W,this._children[W][D]=!0,this},T.prototype._removeFromParentsChildList=function(D){delete this._children[this._parent[D]][D]},T.prototype.parent=function(D){if(this._isCompound){var W=this._parent[D];if(W!==B)return W}},T.prototype.children=function(D){if(A.isUndefined(D)&&(D=B),this._isCompound){var W=this._children[D];if(W)return A.keys(W)}else{if(D===B)return this.nodes();if(this.hasNode(D))return[]}},T.prototype.predecessors=function(D){var W=this._preds[D];if(W)return A.keys(W)},T.prototype.successors=function(D){var W=this._sucs[D];if(W)return A.keys(W)},T.prototype.neighbors=function(D){var W=this.predecessors(D);if(W)return A.union(W,this.successors(D))},T.prototype.isLeaf=function(D){var W;return this.isDirected()?W=this.successors(D):W=this.neighbors(D),W.length===0},T.prototype.filterNodes=function(D){var W=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});W.setGraph(this.graph());var X=this;A.each(this._nodes,function(nt,q){D(q)&&W.setNode(q,nt)}),A.each(this._edgeObjs,function(nt){W.hasNode(nt.v)&&W.hasNode(nt.w)&&W.setEdge(nt,X.edge(nt))});var K={};function rt(nt){var q=X.parent(nt);return q===void 0||W.hasNode(q)?(K[nt]=q,q):q in K?K[q]:rt(q)}return this._isCompound&&A.each(W.nodes(),function(nt){W.setParent(nt,rt(nt))}),W},T.prototype.setDefaultEdgeLabel=function(D){return A.isFunction(D)||(D=A.constant(D)),this._defaultEdgeLabelFn=D,this},T.prototype.edgeCount=function(){return this._edgeCount},T.prototype.edges=function(){return A.values(this._edgeObjs)},T.prototype.setPath=function(D,W){var X=this,K=arguments;return A.reduce(D,function(rt,nt){return K.length>1?X.setEdge(rt,nt,W):X.setEdge(rt,nt),nt}),this},T.prototype.setEdge=function(){var D,W,X,K,rt=!1,nt=arguments[0];typeof nt=="object"&&nt!==null&&"v"in nt?(D=nt.v,W=nt.w,X=nt.name,arguments.length===2&&(K=arguments[1],rt=!0)):(D=nt,W=arguments[1],X=arguments[3],arguments.length>2&&(K=arguments[2],rt=!0)),D=""+D,W=""+W,A.isUndefined(X)||(X=""+X);var q=C(this._isDirected,D,W,X);if(A.has(this._edgeLabels,q))return rt&&(this._edgeLabels[q]=K),this;if(!A.isUndefined(X)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(D),this.setNode(W),this._edgeLabels[q]=rt?K:this._defaultEdgeLabelFn(D,W,X);var it=L(this._isDirected,D,W,X);return D=it.v,W=it.w,Object.freeze(it),this._edgeObjs[q]=it,k(this._preds[W],D),k(this._sucs[D],W),this._in[W][q]=it,this._out[D][q]=it,this._edgeCount++,this},T.prototype.edge=function(D,W,X){var K=arguments.length===1?z(this._isDirected,arguments[0]):C(this._isDirected,D,W,X);return this._edgeLabels[K]},T.prototype.hasEdge=function(D,W,X){var K=arguments.length===1?z(this._isDirected,arguments[0]):C(this._isDirected,D,W,X);return A.has(this._edgeLabels,K)},T.prototype.removeEdge=function(D,W,X){var K=arguments.length===1?z(this._isDirected,arguments[0]):C(this._isDirected,D,W,X),rt=this._edgeObjs[K];return rt&&(D=rt.v,W=rt.w,delete this._edgeLabels[K],delete this._edgeObjs[K],_(this._preds[W],D),_(this._sucs[D],W),delete this._in[W][K],delete this._out[D][K],this._edgeCount--),this},T.prototype.inEdges=function(D,W){var X=this._in[D];if(X){var K=A.values(X);return W?A.filter(K,function(rt){return rt.v===W}):K}},T.prototype.outEdges=function(D,W){var X=this._out[D];if(X){var K=A.values(X);return W?A.filter(K,function(rt){return rt.w===W}):K}},T.prototype.nodeEdges=function(D,W){var X=this.inEdges(D,W);if(X)return X.concat(this.outEdges(D,W))};function k(D,W){D[W]?D[W]++:D[W]=1}function _(D,W){--D[W]||delete D[W]}function C(D,W,X,K){var rt=""+W,nt=""+X;if(!D&&rt>nt){var q=rt;rt=nt,nt=q}return rt+N+nt+N+(A.isUndefined(K)?Z:K)}function L(D,W,X,K){var rt=""+W,nt=""+X;if(!D&&rt>nt){var q=rt;rt=nt,nt=q}var it={v:rt,w:nt};return K&&(it.name=K),it}function z(D,W){return C(D,W.v,W.w,W.name)}},89224:function(U,Q,S){U.exports={Graph:S(6349),version:S(16544)}},17401:function(U,Q,S){var A=S(95329),Z=S(6349);U.exports={write:B,read:k};function B(_){var C={options:{directed:_.isDirected(),multigraph:_.isMultigraph(),compound:_.isCompound()},nodes:N(_),edges:T(_)};return A.isUndefined(_.graph())||(C.value=A.clone(_.graph())),C}function N(_){return A.map(_.nodes(),function(C){var L=_.node(C),z=_.parent(C),D={v:C};return A.isUndefined(L)||(D.value=L),A.isUndefined(z)||(D.parent=z),D})}function T(_){return A.map(_.edges(),function(C){var L=_.edge(C),z={v:C.v,w:C.w};return A.isUndefined(C.name)||(z.name=C.name),A.isUndefined(L)||(z.value=L),z})}function k(_){var C=new Z(_.options).setGraph(_.value);return A.each(_.nodes,function(L){C.setNode(L.v,L.value),L.parent&&C.setParent(L.v,L.parent)}),A.each(_.edges,function(L){C.setEdge({v:L.v,w:L.w,name:L.name},L.value)}),C}},95329:function(U,Q,S){var A;try{A={clone:S(76833),constant:S(13503),each:S(76934),filter:S(64725),has:S(99946),isArray:S(80744),isEmpty:S(61627),isFunction:S(9363),isUndefined:S(16513),keys:S(55451),map:S(9924),reduce:S(16473),size:S(40617),transform:S(91116),union:S(44065),values:S(81229)}}catch(Z){}A||(A=window._),U.exports=A},16544:function(U){U.exports="2.1.8"},34634:function(U,Q,S){"use strict";S.r(Q),S.d(Q,{isAnyArray:function(){return Z}});const A=Object.prototype.toString;function Z(B){const N=A.call(B);return N.endsWith("Array]")&&!N.includes("Big")}},55973:function(U){U.exports=function(S){return!S||typeof S=="string"?!1:S instanceof Array||Array.isArray(S)||S.length>=0&&(S.splice instanceof Function||Object.getOwnPropertyDescriptor(S,S.length-1)&&S.constructor.name!=="String")}},15584:function(U,Q,S){var A=S(73893),Z=S(33152),B=A(Z,"DataView");U.exports=B},97288:function(U,Q,S){var A=S(73893),Z=S(33152),B=A(Z,"Promise");U.exports=B},23599:function(U,Q,S){var A=S(73893),Z=S(33152),B=A(Z,"Set");U.exports=B},98924:function(U,Q,S){var A=S(52166),Z=S(34776),B=S(40393);function N(T){var k=-1,_=T==null?0:T.length;for(this.__data__=new A;++k<_;)this.add(T[k])}N.prototype.add=N.prototype.push=Z,N.prototype.has=B,U.exports=N},26873:function(U,Q,S){var A=S(73893),Z=S(33152),B=A(Z,"WeakMap");U.exports=B},74809:function(U){function Q(S,A){for(var Z=-1,B=S==null?0:S.length;++Z-1}U.exports=Z},94874:function(U){function Q(S,A,Z){for(var B=-1,N=S==null?0:S.length;++B0&&k(D)?T>1?B(D,T-1,k,_,C):A(C,D):_||(C[C.length]=D)}return C}U.exports=B},1585:function(U,Q,S){var A=S(14018),Z=S(55451);function B(N,T){return N&&A(N,T,Z)}U.exports=B},89147:function(U,Q,S){var A=S(1186),Z=S(9171);function B(N,T){T=A(T,N);for(var k=0,_=T.length;N!=null&&k<_;)N=N[Z(T[k++])];return k&&k==_?N:void 0}U.exports=B},75635:function(U,Q,S){var A=S(57095),Z=S(80744);function B(N,T,k){var _=T(N);return Z(N)?_:A(_,k(N))}U.exports=B},40302:function(U){function Q(S,A){return S>A}U.exports=Q},3251:function(U){var Q=Object.prototype,S=Q.hasOwnProperty;function A(Z,B){return Z!=null&&S.call(Z,B)}U.exports=A},62348:function(U){function Q(S,A){return S!=null&&A in Object(S)}U.exports=Q},17424:function(U,Q,S){var A=S(51533),Z=S(8373),B=S(49244);function N(T,k,_){return k===k?B(T,k,_):A(T,Z,_)}U.exports=N},77295:function(U,Q,S){var A=S(84412),Z=S(93913);function B(N,T,k,_,C){return N===T?!0:N==null||T==null||!Z(N)&&!Z(T)?N!==N&&T!==T:A(N,T,k,_,B,C)}U.exports=B},84412:function(U,Q,S){var A=S(91866),Z=S(50401),B=S(57710),N=S(4983),T=S(66139),k=S(80744),_=S(57835),C=S(18397),L=1,z="[object Arguments]",D="[object Array]",W="[object Object]",X=Object.prototype,K=X.hasOwnProperty;function rt(nt,q,it,at,ut,ht){var xt=k(nt),pt=k(q),wt=xt?D:T(nt),gt=pt?D:T(q);wt=wt==z?W:wt,gt=gt==z?W:gt;var Et=wt==W,kt=gt==W,zt=wt==gt;if(zt&&_(nt)){if(!_(q))return!1;xt=!0,Et=!1}if(zt&&!Et)return ht||(ht=new A),xt||C(nt)?Z(nt,q,it,at,ut,ht):B(nt,q,wt,it,at,ut,ht);if(!(it&L)){var Ut=Et&&K.call(nt,"__wrapped__"),Qt=kt&&K.call(q,"__wrapped__");if(Ut||Qt){var Ee=Ut?nt.value():nt,Le=Qt?q.value():q;return ht||(ht=new A),ut(Ee,Le,it,at,ht)}}return zt?(ht||(ht=new A),N(nt,q,it,at,ut,ht)):!1}U.exports=rt},55005:function(U,Q,S){var A=S(66139),Z=S(93913),B="[object Map]";function N(T){return Z(T)&&A(T)==B}U.exports=N},51524:function(U,Q,S){var A=S(91866),Z=S(77295),B=1,N=2;function T(k,_,C,L){var z=C.length,D=z,W=!L;if(k==null)return!D;for(k=Object(k);z--;){var X=C[z];if(W&&X[2]?X[1]!==k[X[0]]:!(X[0]in k))return!1}for(;++z=_){var it=z?null:T(L);if(it)return k(it);rt=!1,X=N,q=new A}else q=z?[]:nt;t:for(;++WN||C&&L&&D&&!z&&!W||k&&L&&D||!T&&D||!_)return 1;if(!k&&!C&&!W&&B=z)return D;var W=T[k];return D*(W=="desc"?-1:1)}}return B.index-N.index}U.exports=Z},15168:function(U,Q,S){var A=S(95378),Z=S(58966);function B(N,T){return A(N,Z(N),T)}U.exports=B},71678:function(U,Q,S){var A=S(95378),Z=S(66817);function B(N,T){return A(N,Z(N),T)}U.exports=B},49164:function(U,Q,S){var A=S(24665);function Z(B,N){return function(T,k){if(T==null)return T;if(!A(T))return B(T,k);for(var _=T.length,C=N?_:-1,L=Object(T);(N?C--:++C<_)&&k(L[C],C,L)!==!1;);return T}}U.exports=Z},19554:function(U,Q,S){var A=S(95979),Z=S(24665),B=S(55451);function N(T){return function(k,_,C){var L=Object(k);if(!Z(k)){var z=A(_,3);k=B(k),_=function(W){return z(L[W],W,L)}}var D=T(k,_,C);return D>-1?L[z?k[D]:D]:void 0}}U.exports=N},76106:function(U,Q,S){var A=S(36121),Z=S(8138),B=S(97341);function N(T){return function(k,_,C){return C&&typeof C!="number"&&Z(k,_,C)&&(_=C=void 0),k=B(k),_===void 0?(_=k,k=0):_=B(_),C=C===void 0?k<_?1:-1:B(C),A(k,_,C,T)}}U.exports=N},47506:function(U,Q,S){var A=S(23599),Z=S(9958),B=S(79679),N=1/0,T=A&&1/B(new A([,-0]))[1]==N?function(k){return new A(k)}:Z;U.exports=T},50401:function(U,Q,S){var A=S(98924),Z=S(64045),B=S(1931),N=1,T=2;function k(_,C,L,z,D,W){var X=L&N,K=_.length,rt=C.length;if(K!=rt&&!(X&&rt>K))return!1;var nt=W.get(_),q=W.get(C);if(nt&&q)return nt==C&&q==_;var it=-1,at=!0,ut=L&T?new A:void 0;for(W.set(_,C),W.set(C,_);++it2?L[2]:void 0;for(W&&B(L[0],L[1],W)&&(D=1);++z1&&N(k,_[0],_[1])?_=[]:C>2&&N(_[0],_[1],_[2])&&(_=[_[0]]),Z(k,A(_,1),[])});U.exports=T},4134:function(U){function Q(){return[]}U.exports=Q},97341:function(U,Q,S){var A=S(59406),Z=1/0,B=17976931348623157e292;function N(T){if(!T)return T===0?T:0;if(T=A(T),T===Z||T===-Z){var k=T<0?-1:1;return k*B}return T===T?T:0}U.exports=N},12824:function(U,Q,S){var A=S(97341);function Z(B){var N=A(B),T=N%1;return N===N?T?N-T:N:0}U.exports=Z},59406:function(U,Q,S){var A=S(13927),Z=S(20816),B=S(45029),N=NaN,T=/^[-+]0x[0-9a-f]+$/i,k=/^0b[01]+$/i,_=/^0o[0-7]+$/i,C=parseInt;function L(z){if(typeof z=="number")return z;if(B(z))return N;if(Z(z)){var D=typeof z.valueOf=="function"?z.valueOf():z;z=Z(D)?D+"":D}if(typeof z!="string")return z===0?z:+z;z=A(z);var W=k.test(z);return W||_.test(z)?C(z.slice(2),W?2:8):T.test(z)?N:+z}U.exports=L},44140:function(U,Q,S){var A=S(50230);function Z(B){return B==null?"":A(B)}U.exports=Z},91116:function(U,Q,S){var A=S(74809),Z=S(35024),B=S(1585),N=S(95979),T=S(49217),k=S(80744),_=S(57835),C=S(9363),L=S(20816),z=S(18397);function D(W,X,K){var rt=k(W),nt=rt||_(W)||z(W);if(X=N(X,4),K==null){var q=W&&W.constructor;nt?K=rt?new q:[]:L(W)?K=C(q)?Z(T(W)):{}:K={}}return(nt?A:B)(W,function(it,at,ut){return X(K,it,at,ut)}),K}U.exports=D},44065:function(U,Q,S){var A=S(9256),Z=S(92918),B=S(29098),N=S(41590),T=Z(function(k){return B(A(k,1,N,!0))});U.exports=T},95708:function(U,Q,S){var A=S(44140),Z=0;function B(N){var T=++Z;return A(N)+T}U.exports=B},81229:function(U,Q,S){var A=S(20720),Z=S(55451);function B(N){return N==null?[]:A(N,Z(N))}U.exports=B},65441:function(U,Q,S){var A=S(60348),Z=S(94484);function B(N,T){return Z(N||[],T||[],A)}U.exports=B},34402:function(U,Q,S){"use strict";S.r(Q),S.d(Q,{default:function(){return N}});var A=S(34634);function Z(T){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,A.isAnyArray)(T))throw new TypeError("input must be an array");if(T.length===0)throw new TypeError("input must not be empty");var _=k.fromIndex,C=_===void 0?0:_,L=k.toIndex,z=L===void 0?T.length:L;if(C<0||C>=T.length||!Number.isInteger(C))throw new Error("fromIndex must be a positive integer smaller than length");if(z<=C||z>T.length||!Number.isInteger(z))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var D=T[C],W=C+1;WD&&(D=T[W]);return D}function B(T){var k=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,A.isAnyArray)(T))throw new TypeError("input must be an array");if(T.length===0)throw new TypeError("input must not be empty");var _=k.fromIndex,C=_===void 0?0:_,L=k.toIndex,z=L===void 0?T.length:L;if(C<0||C>=T.length||!Number.isInteger(C))throw new Error("fromIndex must be a positive integer smaller than length");if(z<=C||z>T.length||!Number.isInteger(z))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var D=T[C],W=C+1;W1&&arguments[1]!==void 0?arguments[1]:{};if((0,A.isAnyArray)(T)){if(T.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var _;if(k.output!==void 0){if(!(0,A.isAnyArray)(k.output))throw new TypeError("output option must be an array if specified");_=k.output}else _=new Array(T.length);var C=B(T),L=Z(T);if(C===L)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var z=k.min,D=z===void 0?k.autoMinMax?C:0:z,W=k.max,X=W===void 0?k.autoMinMax?L:1:W;if(D>=X)throw new RangeError("min option must be smaller than max option");for(var K=(X-D)/(L-C),rt=0;rt{}};function A(){for(var k=0,_=arguments.length,C={},L;k<_;++k){if(!(L=arguments[k]+"")||L in C||/[\s.]/.test(L))throw new Error("illegal type: "+L);C[L]=[]}return new Z(C)}function Z(k){this._=k}function B(k,_){return k.trim().split(/^|\s+/).map(function(C){var L="",z=C.indexOf(".");if(z>=0&&(L=C.slice(z+1),C=C.slice(0,z)),C&&!_.hasOwnProperty(C))throw new Error("unknown type: "+C);return{type:C,name:L}})}Z.prototype=A.prototype={constructor:Z,on:function(k,_){var C=this._,L=B(k+"",C),z,D=-1,W=L.length;if(arguments.length<2){for(;++D0)for(var C=new Array(z),L=0,z,D;L=(it=(W+rt)/2))?W=it:rt=it,(gt=k>=(at=(X+nt)/2))?X=at:nt=at,(Et=_>=(ut=(K+q)/2))?K=ut:q=ut,L=z,!(z=z[kt=Et<<2|gt<<1|wt]))return L[kt]=D,N;if(ht=+N._x.call(null,z.data),xt=+N._y.call(null,z.data),pt=+N._z.call(null,z.data),T===ht&&k===xt&&_===pt)return D.next=z,L?L[kt]=D:N._root=D,N;do L=L?L[kt]=new Array(8):N._root=new Array(8),(wt=T>=(it=(W+rt)/2))?W=it:rt=it,(gt=k>=(at=(X+nt)/2))?X=at:nt=at,(Et=_>=(ut=(K+q)/2))?K=ut:q=ut;while((kt=Et<<2|gt<<1|wt)===(zt=(pt>=ut)<<2|(xt>=at)<<1|ht>=it));return L[zt]=z,L[kt]=D,N}function B(N){Array.isArray(N)||(N=Array.from(N));const T=N.length,k=new Float64Array(T),_=new Float64Array(T),C=new Float64Array(T);let L=1/0,z=1/0,D=1/0,W=-1/0,X=-1/0,K=-1/0;for(let rt=0,nt,q,it,at;rtW&&(W=q),itX&&(X=it),atK&&(K=at));if(L>W||z>X||D>K)return this;this.cover(L,z,D).cover(W,X,K);for(let rt=0;rtZ||Z>=C||k>B||B>=L||_>N||N>=z;)switch(K=(N<_)<<2|(Bq||(W=xt.y0)>it||(X=xt.z0)>at||(K=xt.x1)=Et)<<2|(N>=gt)<<1|B>=wt)&&(xt=ut[ut.length-1],ut[ut.length-1]=ut[ut.length-1-pt],ut[ut.length-1-pt]=xt)}else{var kt=B-+this._x.call(null,ht.data),zt=N-+this._y.call(null,ht.data),Ut=T-+this._z.call(null,ht.data),Qt=kt*kt+zt*zt+Ut*Ut;if(QtMath.sqrt(is(B-k,2)+is(N-_,2)+is(T-C,2));function Z(B,N,T,k){const _=[],C=B-k,L=N-k,z=T-k,D=B+k,W=N+k,X=T+k;return this.visit((K,rt,nt,q,it,at,ut)=>{if(!K.length)do{const ht=K.data;A(B,N,T,this._x(ht),this._y(ht),this._z(ht))<=k&&_.push(ht)}while(K=K.next);return rt>D||nt>W||q>X||it=(it=(L+W)/2))?L=it:W=it,(xt=nt>=(at=(z+X)/2))?z=at:X=at,(pt=q>=(ut=(D+K)/2))?D=ut:K=ut,N=T,!(T=T[wt=pt<<2|xt<<1|ht]))return this;if(!T.length)break;(N[wt+1&7]||N[wt+2&7]||N[wt+3&7]||N[wt+4&7]||N[wt+5&7]||N[wt+6&7]||N[wt+7&7])&&(k=N,gt=wt)}for(;T.data!==B;)if(_=T,!(T=T.next))return this;return(C=T.next)&&delete T.next,_?(C?_.next=C:delete _.next,this):N?(C?N[wt]=C:delete N[wt],(T=N[0]||N[1]||N[2]||N[3]||N[4]||N[5]||N[6]||N[7])&&T===(N[7]||N[6]||N[5]||N[4]||N[3]||N[2]||N[1]||N[0])&&!T.length&&(k?k[gt]=T:this._root=T),this):(this._root=C,this)}function Z(B){for(var N=0,T=B.length;N=(rt=(D+X)/2))?D=rt:X=rt,(ut=k>=(nt=(W+K)/2))?W=nt:K=nt,C=L,!(L=L[ht=ut<<1|at]))return C[ht]=z,N;if(q=+N._x.call(null,L.data),it=+N._y.call(null,L.data),T===q&&k===it)return z.next=L,C?C[ht]=z:N._root=z,N;do C=C?C[ht]=new Array(4):N._root=new Array(4),(at=T>=(rt=(D+X)/2))?D=rt:X=rt,(ut=k>=(nt=(W+K)/2))?W=nt:K=nt;while((ht=ut<<1|at)===(xt=(it>=nt)<<1|q>=rt));return C[xt]=L,C[ht]=z,N}function B(N){var T,k,_=N.length,C,L,z=new Array(_),D=new Array(_),W=1/0,X=1/0,K=-1/0,rt=-1/0;for(k=0;k<_;++k)isNaN(C=+this._x.call(null,T=N[k]))||isNaN(L=+this._y.call(null,T))||(z[k]=C,D[k]=L,CK&&(K=C),Lrt&&(rt=L));if(W>K||X>rt)return this;for(this.cover(W,X).cover(K,rt),k=0;k<_;++k)Z(this,z[k],D[k],N[k]);return this}},51097:function(U,Q,S){"use strict";S.d(Q,{Z:function(){return A}});function A(Z,B){if(isNaN(Z=+Z)||isNaN(B=+B))return this;var N=this._x0,T=this._y0,k=this._x1,_=this._y1;if(isNaN(N))k=(N=Math.floor(Z))+1,_=(T=Math.floor(B))+1;else{for(var C=k-N||1,L=this._root,z,D;N>Z||Z>=k||T>B||B>=_;)switch(D=(BX||(z=q.y0)>K||(D=q.x1)<_||(W=q.y1)=ut)<<1|B>=at)&&(q=rt[rt.length-1],rt[rt.length-1]=rt[rt.length-1-it],rt[rt.length-1-it]=q)}else{var ht=B-+this._x.call(null,nt.data),xt=N-+this._y.call(null,nt.data),pt=ht*ht+xt*xt;if(pt=(rt=(L+D)/2))?L=rt:D=rt,(it=K>=(nt=(z+W)/2))?z=nt:W=nt,N=T,!(T=T[at=it<<1|q]))return this;if(!T.length)break;(N[at+1&3]||N[at+2&3]||N[at+3&3])&&(k=N,ut=at)}for(;T.data!==B;)if(_=T,!(T=T.next))return this;return(C=T.next)&&delete T.next,_?(C?_.next=C:delete _.next,this):N?(C?N[at]=C:delete N[at],(T=N[0]||N[1]||N[2]||N[3])&&T===(N[3]||N[2]||N[1]||N[0])&&!T.length&&(k?k[ut]=T:this._root=T),this):(this._root=C,this)}function Z(B){for(var N=0,T=B.length;N=0&&ht._call.call(void 0,xt),ht=ht._next;--A}function q(){C=(_=z.now())+L,A=Z=0;try{nt()}finally{A=0,at(),C=0}}function it(){var ht=z.now(),xt=ht-_;xt>N&&(L-=xt,_=ht)}function at(){for(var ht,xt=T,pt,wt=1/0;xt;)xt._call?(wt>xt._time&&(wt=xt._time),ht=xt,xt=xt._next):(pt=xt._next,xt._next=null,xt=ht?ht._next=pt:T=pt);k=ht,ut(wt)}function ut(ht){if(!A){Z&&(Z=clearTimeout(Z));var xt=ht-C;xt>24?(ht<1/0&&(Z=setTimeout(q,ht-z.now()-L)),B&&(B=clearInterval(B))):(B||(_=z.now(),B=setInterval(it,N)),A=1,D(q))}}},80813:function(U,Q,S){"use strict";S.d(Q,{CR:function(){return q},Jh:function(){return X},Q_:function(){return Qt},XA:function(){return nt},ZT:function(){return Z},_T:function(){return N},ev:function(){return ut},mG:function(){return W},pi:function(){return B},pr:function(){return at}});var A=function(Pt,_t){return A=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(It,dt){It.__proto__=dt}||function(It,dt){for(var St in dt)Object.prototype.hasOwnProperty.call(dt,St)&&(It[St]=dt[St])},A(Pt,_t)};function Z(Pt,_t){if(typeof _t!="function"&&_t!==null)throw new TypeError("Class extends value "+String(_t)+" is not a constructor or null");A(Pt,_t);function It(){this.constructor=Pt}Pt.prototype=_t===null?Object.create(_t):(It.prototype=_t.prototype,new It)}var B=function(){return B=Object.assign||function(_t){for(var It,dt=1,St=arguments.length;dt=0;oe--)(Gt=Pt[oe])&&(Ct=(St<3?Gt(Ct):St>3?Gt(_t,It,Ct):Gt(_t,It))||Ct);return St>3&&Ct&&Object.defineProperty(_t,It,Ct),Ct}function k(Pt,_t){return function(It,dt){_t(It,dt,Pt)}}function _(Pt,_t,It,dt,St,Ct){function Gt(cr){if(cr!==void 0&&typeof cr!="function")throw new TypeError("Function expected");return cr}for(var oe=dt.kind,ye=oe==="getter"?"get":oe==="setter"?"set":"value",de=!_t&&Pt?dt.static?Pt:Pt.prototype:null,_e=_t||(de?Object.getOwnPropertyDescriptor(de,dt.name):{}),Mn,Nn=!1,Pe=It.length-1;Pe>=0;Pe--){var Se={};for(var re in dt)Se[re]=re==="access"?{}:dt[re];for(var re in dt.access)Se.access[re]=dt.access[re];Se.addInitializer=function(cr){if(Nn)throw new TypeError("Cannot add initializers after decoration has completed");Ct.push(Gt(cr||null))};var Oe=(0,It[Pe])(oe==="accessor"?{get:_e.get,set:_e.set}:_e[ye],Se);if(oe==="accessor"){if(Oe===void 0)continue;if(Oe===null||typeof Oe!="object")throw new TypeError("Object expected");(Mn=Gt(Oe.get))&&(_e.get=Mn),(Mn=Gt(Oe.set))&&(_e.set=Mn),(Mn=Gt(Oe.init))&&St.unshift(Mn)}else(Mn=Gt(Oe))&&(oe==="field"?St.unshift(Mn):_e[ye]=Mn)}de&&Object.defineProperty(de,dt.name,_e),Nn=!0}function C(Pt,_t,It){for(var dt=arguments.length>2,St=0;St<_t.length;St++)It=dt?_t[St].call(Pt,It):_t[St].call(Pt);return dt?It:void 0}function L(Pt){return typeof Pt=="symbol"?Pt:"".concat(Pt)}function z(Pt,_t,It){return typeof _t=="symbol"&&(_t=_t.description?"[".concat(_t.description,"]"):""),Object.defineProperty(Pt,"name",{configurable:!0,value:It?"".concat(It," ",_t):_t})}function D(Pt,_t){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(Pt,_t)}function W(Pt,_t,It,dt){function St(Ct){return Ct instanceof It?Ct:new It(function(Gt){Gt(Ct)})}return new(It||(It=Promise))(function(Ct,Gt){function oe(_e){try{de(dt.next(_e))}catch(Mn){Gt(Mn)}}function ye(_e){try{de(dt.throw(_e))}catch(Mn){Gt(Mn)}}function de(_e){_e.done?Ct(_e.value):St(_e.value).then(oe,ye)}de((dt=dt.apply(Pt,_t||[])).next())})}function X(Pt,_t){var It={label:0,sent:function(){if(Ct[0]&1)throw Ct[1];return Ct[1]},trys:[],ops:[]},dt,St,Ct,Gt=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return Gt.next=oe(0),Gt.throw=oe(1),Gt.return=oe(2),typeof Symbol=="function"&&(Gt[Symbol.iterator]=function(){return this}),Gt;function oe(de){return function(_e){return ye([de,_e])}}function ye(de){if(dt)throw new TypeError("Generator is already executing.");for(;Gt&&(Gt=0,de[0]&&(It=0)),It;)try{if(dt=1,St&&(Ct=de[0]&2?St.return:de[0]?St.throw||((Ct=St.return)&&Ct.call(St),0):St.next)&&!(Ct=Ct.call(St,de[1])).done)return Ct;switch(St=0,Ct&&(de=[de[0]&2,Ct.value]),de[0]){case 0:case 1:Ct=de;break;case 4:return It.label++,{value:de[1],done:!1};case 5:It.label++,St=de[1],de=[0];continue;case 7:de=It.ops.pop(),It.trys.pop();continue;default:if(Ct=It.trys,!(Ct=Ct.length>0&&Ct[Ct.length-1])&&(de[0]===6||de[0]===2)){It=0;continue}if(de[0]===3&&(!Ct||de[1]>Ct[0]&&de[1]=Pt.length&&(Pt=void 0),{value:Pt&&Pt[dt++],done:!Pt}}};throw new TypeError(_t?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(Pt,_t){var It=typeof Symbol=="function"&&Pt[Symbol.iterator];if(!It)return Pt;var dt=It.call(Pt),St,Ct=[],Gt;try{for(;(_t===void 0||_t-- >0)&&!(St=dt.next()).done;)Ct.push(St.value)}catch(oe){Gt={error:oe}}finally{try{St&&!St.done&&(It=dt.return)&&It.call(dt)}finally{if(Gt)throw Gt.error}}return Ct}function it(){for(var Pt=[],_t=0;_t1||ye(Pe,re)})},Se&&(St[Pe]=Se(St[Pe])))}function ye(Pe,Se){try{de(dt[Pe](Se))}catch(re){Nn(Ct[0][3],re)}}function de(Pe){Pe.value instanceof ht?Promise.resolve(Pe.value.v).then(_e,Mn):Nn(Ct[0][2],Pe)}function _e(Pe){ye("next",Pe)}function Mn(Pe){ye("throw",Pe)}function Nn(Pe,Se){Pe(Se),Ct.shift(),Ct.length&&ye(Ct[0][0],Ct[0][1])}}function pt(Pt){var _t,It;return _t={},dt("next"),dt("throw",function(St){throw St}),dt("return"),_t[Symbol.iterator]=function(){return this},_t;function dt(St,Ct){_t[St]=Pt[St]?function(Gt){return(It=!It)?{value:ht(Pt[St](Gt)),done:!1}:Ct?Ct(Gt):Gt}:Ct}}function wt(Pt){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var _t=Pt[Symbol.asyncIterator],It;return _t?_t.call(Pt):(Pt=typeof nt=="function"?nt(Pt):Pt[Symbol.iterator](),It={},dt("next"),dt("throw"),dt("return"),It[Symbol.asyncIterator]=function(){return this},It);function dt(Ct){It[Ct]=Pt[Ct]&&function(Gt){return new Promise(function(oe,ye){Gt=Pt[Ct](Gt),St(oe,ye,Gt.done,Gt.value)})}}function St(Ct,Gt,oe,ye){Promise.resolve(ye).then(function(de){Ct({value:de,done:oe})},Gt)}}function gt(Pt,_t){return Object.defineProperty?Object.defineProperty(Pt,"raw",{value:_t}):Pt.raw=_t,Pt}var Et=Object.create?function(Pt,_t){Object.defineProperty(Pt,"default",{enumerable:!0,value:_t})}:function(Pt,_t){Pt.default=_t},kt=function(Pt){return kt=Object.getOwnPropertyNames||function(_t){var It=[];for(var dt in _t)Object.prototype.hasOwnProperty.call(_t,dt)&&(It[It.length]=dt);return It},kt(Pt)};function zt(Pt){if(Pt&&Pt.__esModule)return Pt;var _t={};if(Pt!=null)for(var It=kt(Pt),dt=0;dt