!(function(){var D8=Object.defineProperty,P8=Object.defineProperties;var _8=Object.getOwnPropertyDescriptors;var RM=Object.getOwnPropertySymbols;var H8=Object.prototype.hasOwnProperty,G8=Object.prototype.propertyIsEnumerable;var PA=Math.pow,hw=(X,st,T)=>st in X?D8(X,st,{enumerable:!0,configurable:!0,writable:!0,value:T}):X[st]=T,lu=(X,st)=>{for(var T in st||(st={}))H8.call(st,T)&&hw(X,T,st[T]);if(RM)for(var T of RM(st))G8.call(st,T)&&hw(X,T,st[T]);return X},dw=(X,st)=>P8(X,_8(st));var wr=(X,st,T)=>hw(X,typeof st!="symbol"?st+"":st,T);(self.webpackChunk=self.webpackChunk||[]).push([[1791],{88055:function(X,st,T){"use strict";T.d(st,{kJ:function(){return rv},RN:function(){return E8}});var I={};T.r(I),T.d(I,{add:function(){return ad},adjoint:function(){return Ft},clone:function(){return Ee},copy:function(){return He},create:function(){return $t},decompose:function(){return uu},determinant:function(){return te},equals:function(){return gv},exactEquals:function(){return Kr},frob:function(){return id},fromQuat:function(){return KA},fromQuat2:function(){return ei},fromRotation:function(){return qi},fromRotationTranslation:function(){return ti},fromRotationTranslationScale:function(){return go},fromRotationTranslationScaleOrigin:function(){return vo},fromScaling:function(){return Dn},fromTranslation:function(){return Tr},fromValues:function(){return je},fromXRotation:function(){return $i},fromYRotation:function(){return fn},fromZRotation:function(){return Er},frustum:function(){return hu},getRotation:function(){return Xo},getScaling:function(){return Ds},getTranslation:function(){return Pn},identity:function(){return Ie},invert:function(){return on},lookAt:function(){return rd},mul:function(){return po},multiply:function(){return ue},multiplyScalar:function(){return dv},multiplyScalarAndAdd:function(){return fv},ortho:function(){return gu},orthoNO:function(){return fu},orthoZO:function(){return vu},perspective:function(){return du},perspectiveFromFieldOfView:function(){return Za},perspectiveNO:function(){return Xl},perspectiveZO:function(){return cv},rotate:function(){return Qn},rotateX:function(){return jn},rotateY:function(){return qn},rotateZ:function(){return Qr},scale:function(){return Jn},set:function(){return Wn},str:function(){return hv},sub:function(){return vv},subtract:function(){return pu},targetTo:function(){return uv},translate:function(){return se},transpose:function(){return De}});var W={};T.r(W),T.d(W,{circle:function(){return AQ},diamond:function(){return lQ},rect:function(){return uQ},simple:function(){return dQ},triangle:function(){return Ex},triangleRect:function(){return hQ},vee:function(){return cQ}});var z=T(85899),P=T(38705),N=T(17212),G=T(77654),K=T(96885),_=T(39153),H=T(72190),J=T(94856),Z=J,$=1e-6,ct=typeof Float32Array!="undefined"?Float32Array:Array,ht=Math.random,Ct="zyx";function pt(r){return r>=0?Math.round(r):r%.5===0?Math.floor(r):Math.round(r)}function ut(r){ct=r}var Bt=Math.PI/180,wt=180/Math.PI;function Tt(r){return r*Bt}function kt(r){return r*wt}function _t(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:$;return Math.abs(r-t)<=e*Math.max(1,Math.abs(r),Math.abs(t))}function Ot(){var r=new ct(3);return ct!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function Gt(r){var t=new ct(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t}function ae(r){var t=r[0],e=r[1],n=r[2];return Math.sqrt(t*t+e*e+n*n)}function Wt(r,t,e){var n=new ct(3);return n[0]=r,n[1]=t,n[2]=e,n}function ie(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r}function ve(r,t,e,n){return r[0]=t,r[1]=e,r[2]=n,r}function de(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function Oe(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function sn(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}function dn(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r}function Xn(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r[2]=Math.ceil(t[2]),r}function Jr(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r[2]=Math.floor(t[2]),r}function ji(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 As(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 ho(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 zt(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r}function jt(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 gt(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 Mt(r){var t=r[0],e=r[1],n=r[2];return t*t+e*e+n*n}function Lt(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r}function ee(r,t){return r[0]=1/t[0],r[1]=1/t[1],r[2]=1/t[2],r}function be(r,t){var e=t[0],n=t[1],i=t[2],a=e*e+n*n+i*i;return a>0&&(a=1/Math.sqrt(a)),r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r}function _e(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]}function Me(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[0],o=e[1],A=e[2];return r[0]=i*A-a*o,r[1]=a*s-n*A,r[2]=n*o-i*s,r}function nn(r,t,e,n){var i=t[0],a=t[1],s=t[2];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r}function rr(r,t,e,n){var i=Math.acos(Math.min(Math.max(_e(t,e),-1),1)),a=Math.sin(i),s=Math.sin((1-n)*i)/a,o=Math.sin(n*i)/a;return r[0]=s*t[0]+o*e[0],r[1]=s*t[1]+o*e[1],r[2]=s*t[2]+o*e[2],r}function or(r,t,e,n,i,a){var s=a*a,o=s*(2*a-3)+1,A=s*(a-2)+a,l=s*(a-1),c=s*(3-2*a);return r[0]=t[0]*o+e[0]*A+n[0]*l+i[0]*c,r[1]=t[1]*o+e[1]*A+n[1]*l+i[1]*c,r[2]=t[2]*o+e[2]*A+n[2]*l+i[2]*c,r}function Ge(r,t,e,n,i,a){var s=1-a,o=s*s,A=a*a,l=o*s,c=3*a*o,u=3*A*s,h=A*a;return r[0]=t[0]*l+e[0]*c+n[0]*u+i[0]*h,r[1]=t[1]*l+e[1]*c+n[1]*u+i[1]*h,r[2]=t[2]*l+e[2]*c+n[2]*u+i[2]*h,r}function ze(r,t){t=t===void 0?1:t;var e=glMatrix.RANDOM()*2*Math.PI,n=glMatrix.RANDOM()*2-1,i=Math.sqrt(1-n*n)*t;return r[0]=Math.cos(e)*i,r[1]=Math.sin(e)*i,r[2]=n*t,r}function me(r,t,e){var n=t[0],i=t[1],a=t[2],s=e[3]*n+e[7]*i+e[11]*a+e[15];return s=s||1,r[0]=(e[0]*n+e[4]*i+e[8]*a+e[12])/s,r[1]=(e[1]*n+e[5]*i+e[9]*a+e[13])/s,r[2]=(e[2]*n+e[6]*i+e[10]*a+e[14])/s,r}function Ve(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 zr(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],A=t[1],l=t[2],c=i*l-a*A,u=a*o-n*l,h=n*A-i*o;return c=c+c,u=u+u,h=h+h,r[0]=o+s*c+i*h-a*u,r[1]=A+s*u+a*c-n*h,r[2]=l+s*h+n*u-i*c,r}function Zi(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2],a[0]=i[0],a[1]=i[1]*Math.cos(n)-i[2]*Math.sin(n),a[2]=i[1]*Math.sin(n)+i[2]*Math.cos(n),r[0]=a[0]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function pe(r,t,e,n){var i=[],a=[];return i[0]=t[0]-e[0],i[1]=t[1]-e[1],i[2]=t[2]-e[2],a[0]=i[2]*Math.sin(n)+i[0]*Math.cos(n),a[1]=i[1],a[2]=i[2]*Math.cos(n)-i[0]*Math.sin(n),r[0]=a[0]+e[0],r[1]=a[1]+e[1],r[2]=a[2]+e[2],r}function Wa(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 kr(r,t){var e=r[0],n=r[1],i=r[2],a=t[0],s=t[1],o=t[2],A=Math.sqrt((e*e+n*n+i*i)*(a*a+s*s+o*o)),l=A&&_e(r,t)/A;return Math.acos(Math.min(Math.max(l,-1),1))}function Fr(r){return r[0]=0,r[1]=0,r[2]=0,r}function fi(r){return"vec3("+r[0]+", "+r[1]+", "+r[2]+")"}function ls(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]}function Yi(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)<=$*Math.max(1,Math.abs(e),Math.abs(a))&&Math.abs(n-s)<=$*Math.max(1,Math.abs(n),Math.abs(s))&&Math.abs(i-o)<=$*Math.max(1,Math.abs(i),Math.abs(o))}var cs=Oe,Li=null,qr=null,Ba=jt,ba=null,la=ae,xa=null,$r=function(){var r=Ot();return function(t,e,n,i,a,s){var o,A;for(e||(e=3),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;o0&&(s=1/Math.sqrt(s)),r[0]=e*s,r[1]=n*s,r[2]=i*s,r[3]=a*s,r}function Y(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]*t[3]}function C(r,t,e,n){var i=e[0]*n[1]-e[1]*n[0],a=e[0]*n[2]-e[2]*n[0],s=e[0]*n[3]-e[3]*n[0],o=e[1]*n[2]-e[2]*n[1],A=e[1]*n[3]-e[3]*n[1],l=e[2]*n[3]-e[3]*n[2],c=t[0],u=t[1],h=t[2],d=t[3];return r[0]=u*l-h*A+d*o,r[1]=-(c*l)+h*s-d*a,r[2]=c*A-u*s+d*i,r[3]=-(c*o)+u*a-h*i,r}function S(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3];return r[0]=i+n*(e[0]-i),r[1]=a+n*(e[1]-a),r[2]=s+n*(e[2]-s),r[3]=o+n*(e[3]-o),r}function w(r,t){t=t===void 0?1:t;var e,n,i,a,s,o,A;A=glMatrix.RANDOM(),e=A*2-1,n=(4*glMatrix.RANDOM()-2)*Math.sqrt(A*-A+A),s=e*e+n*n,A=glMatrix.RANDOM(),i=A*2-1,a=(4*glMatrix.RANDOM()-2)*Math.sqrt(A*-A+A),o=i*i+a*a;var l=Math.sqrt((1-s)/o);return r[0]=t*e,r[1]=t*n,r[2]=t*i*l,r[3]=t*a*l,r}function 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 k(r,t,e){var n=e[0],i=e[1],a=e[2],s=e[3],o=t[0],A=t[1],l=t[2],c=i*l-a*A,u=a*o-n*l,h=n*A-i*o;return c=c+c,u=u+u,h=h+h,r[0]=o+s*c+i*h-a*u,r[1]=A+s*u+a*c-n*h,r[2]=l+s*h+n*u-i*c,r[3]=t[3],r}function nt(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r}function rt(r){return"vec4("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}function ot(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]}function At(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=t[0],o=t[1],A=t[2],l=t[3];return Math.abs(e-s)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(s))&&Math.abs(n-o)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(o))&&Math.abs(i-A)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(A))&&Math.abs(a-l)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(l))}var It=null,vt=null,Zt=null,ce=null,Ht=null,qt=null,Ce=null,Et=function(){var r=Ar();return function(t,e,n,i,a,s){var o,A;for(e||(e=4),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;o0?(e[0]=(o*s+c*n+A*a-l*i)*2/u,e[1]=(A*s+c*i+l*n-o*a)*2/u,e[2]=(l*s+c*a+o*i-A*n)*2/u):(e[0]=(o*s+c*n+A*a-l*i)*2,e[1]=(A*s+c*i+l*n-o*a)*2,e[2]=(l*s+c*a+o*i-A*n)*2),ti(r,t,e),r}function Pn(r,t){return r[0]=t[12],r[1]=t[13],r[2]=t[14],r}function Ds(r,t){var e=t[0],n=t[1],i=t[2],a=t[4],s=t[5],o=t[6],A=t[8],l=t[9],c=t[10];return r[0]=Math.sqrt(e*e+n*n+i*i),r[1]=Math.sqrt(a*a+s*s+o*o),r[2]=Math.sqrt(A*A+l*l+c*c),r}function Xo(r,t){var e=new ct(3);Ds(e,t);var n=1/e[0],i=1/e[1],a=1/e[2],s=t[0]*n,o=t[1]*i,A=t[2]*a,l=t[4]*n,c=t[5]*i,u=t[6]*a,h=t[8]*n,d=t[9]*i,f=t[10]*a,g=s+c+f,v=0;return g>0?(v=Math.sqrt(g+1)*2,r[3]=.25*v,r[0]=(u-d)/v,r[1]=(h-A)/v,r[2]=(o-l)/v):s>c&&s>f?(v=Math.sqrt(1+s-c-f)*2,r[3]=(u-d)/v,r[0]=.25*v,r[1]=(o+l)/v,r[2]=(h+A)/v):c>f?(v=Math.sqrt(1+c-s-f)*2,r[3]=(h-A)/v,r[0]=(o+l)/v,r[1]=.25*v,r[2]=(u+d)/v):(v=Math.sqrt(1+f-s-c)*2,r[3]=(o-l)/v,r[0]=(h+A)/v,r[1]=(u+d)/v,r[2]=.25*v),r}function uu(r,t,e,n){t[0]=n[12],t[1]=n[13],t[2]=n[14];var i=n[0],a=n[1],s=n[2],o=n[4],A=n[5],l=n[6],c=n[8],u=n[9],h=n[10];e[0]=Math.sqrt(i*i+a*a+s*s),e[1]=Math.sqrt(o*o+A*A+l*l),e[2]=Math.sqrt(c*c+u*u+h*h);var d=1/e[0],f=1/e[1],g=1/e[2],v=i*d,p=a*f,y=s*g,x=o*d,F=A*f,O=l*g,L=c*d,U=u*f,R=h*g,j=v+F+R,q=0;return j>0?(q=Math.sqrt(j+1)*2,r[3]=.25*q,r[0]=(O-U)/q,r[1]=(L-y)/q,r[2]=(p-x)/q):v>F&&v>R?(q=Math.sqrt(1+v-F-R)*2,r[3]=(O-U)/q,r[0]=.25*q,r[1]=(p+x)/q,r[2]=(L+y)/q):F>R?(q=Math.sqrt(1+F-v-R)*2,r[3]=(L-y)/q,r[0]=(p+x)/q,r[1]=.25*q,r[2]=(O+U)/q):(q=Math.sqrt(1+R-v-F)*2,r[3]=(p-x)/q,r[0]=(L+y)/q,r[1]=(O+U)/q,r[2]=.25*q),r}function go(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],A=i+i,l=a+a,c=s+s,u=i*A,h=i*l,d=i*c,f=a*l,g=a*c,v=s*c,p=o*A,y=o*l,x=o*c,F=n[0],O=n[1],L=n[2];return r[0]=(1-(f+v))*F,r[1]=(h+x)*F,r[2]=(d-y)*F,r[3]=0,r[4]=(h-x)*O,r[5]=(1-(u+v))*O,r[6]=(g+p)*O,r[7]=0,r[8]=(d+y)*L,r[9]=(g-p)*L,r[10]=(1-(u+f))*L,r[11]=0,r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r}function vo(r,t,e,n,i){var a=t[0],s=t[1],o=t[2],A=t[3],l=a+a,c=s+s,u=o+o,h=a*l,d=a*c,f=a*u,g=s*c,v=s*u,p=o*u,y=A*l,x=A*c,F=A*u,O=n[0],L=n[1],U=n[2],R=i[0],j=i[1],q=i[2],et=(1-(g+p))*O,it=(d+F)*O,dt=(f-x)*O,ft=(d-F)*L,mt=(1-(h+p))*L,Rt=(v+y)*L,Qt=(f+x)*U,yt=(v-y)*U,xt=(1-(h+g))*U;return r[0]=et,r[1]=it,r[2]=dt,r[3]=0,r[4]=ft,r[5]=mt,r[6]=Rt,r[7]=0,r[8]=Qt,r[9]=yt,r[10]=xt,r[11]=0,r[12]=e[0]+R-(et*R+ft*j+Qt*q),r[13]=e[1]+j-(it*R+mt*j+yt*q),r[14]=e[2]+q-(dt*R+Rt*j+xt*q),r[15]=1,r}function KA(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,A=i+i,l=e*s,c=n*s,u=n*o,h=i*s,d=i*o,f=i*A,g=a*s,v=a*o,p=a*A;return r[0]=1-u-f,r[1]=c+p,r[2]=h-v,r[3]=0,r[4]=c-p,r[5]=1-l-f,r[6]=d+g,r[7]=0,r[8]=h+v,r[9]=d-g,r[10]=1-l-u,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function hu(r,t,e,n,i,a,s){var o=1/(e-t),A=1/(i-n),l=1/(a-s);return r[0]=a*2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a*2*A,r[6]=0,r[7]=0,r[8]=(e+t)*o,r[9]=(i+n)*A,r[10]=(s+a)*l,r[11]=-1,r[12]=0,r[13]=0,r[14]=s*a*2*l,r[15]=0,r}function Xl(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 du=Xl;function cv(r,t,e,n,i){var a=1/Math.tan(t/2);if(r[0]=a/e,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=a,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,i!=null&&i!==1/0){var s=1/(n-i);r[10]=i*s,r[14]=i*n*s}else r[10]=-1,r[14]=-n;return r}function Za(r,t,e,n){var i=Math.tan(t.upDegrees*Math.PI/180),a=Math.tan(t.downDegrees*Math.PI/180),s=Math.tan(t.leftDegrees*Math.PI/180),o=Math.tan(t.rightDegrees*Math.PI/180),A=2/(s+o),l=2/(i+a);return r[0]=A,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=l,r[6]=0,r[7]=0,r[8]=-((s-o)*A*.5),r[9]=(i-a)*l*.5,r[10]=n/(e-n),r[11]=-1,r[12]=0,r[13]=0,r[14]=n*e/(e-n),r[15]=0,r}function fu(r,t,e,n,i,a,s){var o=1/(t-e),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*l,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*A,r[14]=(s+a)*l,r[15]=1,r}var gu=fu;function vu(r,t,e,n,i,a,s){var o=1/(t-e),A=1/(n-i),l=1/(a-s);return r[0]=-2*o,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*A,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=l,r[11]=0,r[12]=(t+e)*o,r[13]=(i+n)*A,r[14]=a*l,r[15]=1,r}function rd(r,t,e,n){var i,a,s,o,A,l,c,u,h,d,f=t[0],g=t[1],v=t[2],p=n[0],y=n[1],x=n[2],F=e[0],O=e[1],L=e[2];return Math.abs(f-F)<$&&Math.abs(g-O)<$&&Math.abs(v-L)<$?Ie(r):(c=f-F,u=g-O,h=v-L,d=1/Math.sqrt(c*c+u*u+h*h),c*=d,u*=d,h*=d,i=y*h-x*u,a=x*c-p*h,s=p*u-y*c,d=Math.sqrt(i*i+a*a+s*s),d?(d=1/d,i*=d,a*=d,s*=d):(i=0,a=0,s=0),o=u*s-h*a,A=h*i-c*s,l=c*a-u*i,d=Math.sqrt(o*o+A*A+l*l),d?(d=1/d,o*=d,A*=d,l*=d):(o=0,A=0,l=0),r[0]=i,r[1]=o,r[2]=c,r[3]=0,r[4]=a,r[5]=A,r[6]=u,r[7]=0,r[8]=s,r[9]=l,r[10]=h,r[11]=0,r[12]=-(i*f+a*g+s*v),r[13]=-(o*f+A*g+l*v),r[14]=-(c*f+u*g+h*v),r[15]=1,r)}function uv(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=n[0],A=n[1],l=n[2],c=i-e[0],u=a-e[1],h=s-e[2],d=c*c+u*u+h*h;d>0&&(d=1/Math.sqrt(d),c*=d,u*=d,h*=d);var f=A*h-l*u,g=l*c-o*h,v=o*u-A*c;return d=f*f+g*g+v*v,d>0&&(d=1/Math.sqrt(d),f*=d,g*=d,v*=d),r[0]=f,r[1]=g,r[2]=v,r[3]=0,r[4]=u*v-h*g,r[5]=h*f-c*v,r[6]=c*g-u*f,r[7]=0,r[8]=c,r[9]=u,r[10]=h,r[11]=0,r[12]=i,r[13]=a,r[14]=s,r[15]=1,r}function hv(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 id(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 ad(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 pu(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 dv(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 fv(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r[2]=t[2]+e[2]*n,r[3]=t[3]+e[3]*n,r[4]=t[4]+e[4]*n,r[5]=t[5]+e[5]*n,r[6]=t[6]+e[6]*n,r[7]=t[7]+e[7]*n,r[8]=t[8]+e[8]*n,r[9]=t[9]+e[9]*n,r[10]=t[10]+e[10]*n,r[11]=t[11]+e[11]*n,r[12]=t[12]+e[12]*n,r[13]=t[13]+e[13]*n,r[14]=t[14]+e[14]*n,r[15]=t[15]+e[15]*n,r}function Kr(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]}function gv(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],A=r[6],l=r[7],c=r[8],u=r[9],h=r[10],d=r[11],f=r[12],g=r[13],v=r[14],p=r[15],y=t[0],x=t[1],F=t[2],O=t[3],L=t[4],U=t[5],R=t[6],j=t[7],q=t[8],et=t[9],it=t[10],dt=t[11],ft=t[12],mt=t[13],Rt=t[14],Qt=t[15];return Math.abs(e-y)<=$*Math.max(1,Math.abs(e),Math.abs(y))&&Math.abs(n-x)<=$*Math.max(1,Math.abs(n),Math.abs(x))&&Math.abs(i-F)<=$*Math.max(1,Math.abs(i),Math.abs(F))&&Math.abs(a-O)<=$*Math.max(1,Math.abs(a),Math.abs(O))&&Math.abs(s-L)<=$*Math.max(1,Math.abs(s),Math.abs(L))&&Math.abs(o-U)<=$*Math.max(1,Math.abs(o),Math.abs(U))&&Math.abs(A-R)<=$*Math.max(1,Math.abs(A),Math.abs(R))&&Math.abs(l-j)<=$*Math.max(1,Math.abs(l),Math.abs(j))&&Math.abs(c-q)<=$*Math.max(1,Math.abs(c),Math.abs(q))&&Math.abs(u-et)<=$*Math.max(1,Math.abs(u),Math.abs(et))&&Math.abs(h-it)<=$*Math.max(1,Math.abs(h),Math.abs(it))&&Math.abs(d-dt)<=$*Math.max(1,Math.abs(d),Math.abs(dt))&&Math.abs(f-ft)<=$*Math.max(1,Math.abs(f),Math.abs(ft))&&Math.abs(g-mt)<=$*Math.max(1,Math.abs(g),Math.abs(mt))&&Math.abs(v-Rt)<=$*Math.max(1,Math.abs(v),Math.abs(Rt))&&Math.abs(p-Qt)<=$*Math.max(1,Math.abs(p),Math.abs(Qt))}var po=ue,vv=pu;function sd(){var r=new ct(9);return ct!=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 pv(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 vw(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 mu(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 Jl(r,t,e,n,i,a,s,o,A){var l=new ct(9);return l[0]=r,l[1]=t,l[2]=e,l[3]=n,l[4]=i,l[5]=a,l[6]=s,l[7]=o,l[8]=A,l}function mv(r,t,e,n,i,a,s,o,A,l){return r[0]=t,r[1]=e,r[2]=n,r[3]=i,r[4]=a,r[5]=s,r[6]=o,r[7]=A,r[8]=l,r}function pw(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 mo(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 yu(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8],u=c*s-o*l,h=-c*a+o*A,d=l*a-s*A,f=e*u+n*h+i*d;return f?(f=1/f,r[0]=u*f,r[1]=(-c*n+i*l)*f,r[2]=(o*n-i*s)*f,r[3]=h*f,r[4]=(c*e-i*A)*f,r[5]=(-o*e+i*a)*f,r[6]=d*f,r[7]=(-l*e+n*A)*f,r[8]=(s*e-n*a)*f,r):null}function od(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8];return r[0]=s*c-o*l,r[1]=i*l-n*c,r[2]=n*o-i*s,r[3]=o*A-a*c,r[4]=e*c-i*A,r[5]=i*a-e*o,r[6]=a*l-s*A,r[7]=n*A-e*l,r[8]=e*s-n*a,r}function mw(r){var t=r[0],e=r[1],n=r[2],i=r[3],a=r[4],s=r[5],o=r[6],A=r[7],l=r[8];return t*(l*a-s*A)+e*(-l*i+s*o)+n*(A*i-a*o)}function yw(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=e[0],d=e[1],f=e[2],g=e[3],v=e[4],p=e[5],y=e[6],x=e[7],F=e[8];return r[0]=h*n+d*s+f*l,r[1]=h*i+d*o+f*c,r[2]=h*a+d*A+f*u,r[3]=g*n+v*s+p*l,r[4]=g*i+v*o+p*c,r[5]=g*a+v*A+p*u,r[6]=y*n+x*s+F*l,r[7]=y*i+x*o+F*c,r[8]=y*a+x*A+F*u,r}function ww(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=e[0],d=e[1];return r[0]=n,r[1]=i,r[2]=a,r[3]=s,r[4]=o,r[5]=A,r[6]=h*n+d*s+l,r[7]=h*i+d*o+c,r[8]=h*a+d*A+u,r}function Ew(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=t[4],A=t[5],l=t[6],c=t[7],u=t[8],h=Math.sin(e),d=Math.cos(e);return r[0]=d*n+h*s,r[1]=d*i+h*o,r[2]=d*a+h*A,r[3]=d*s-h*n,r[4]=d*o-h*i,r[5]=d*A-h*a,r[6]=l,r[7]=c,r[8]=u,r}function Bw(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 bw(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 xw(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 Cw(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 Sw(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 Mw(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e+e,o=n+n,A=i+i,l=e*s,c=n*s,u=n*o,h=i*s,d=i*o,f=i*A,g=a*s,v=a*o,p=a*A;return r[0]=1-u-f,r[3]=c-p,r[6]=h+v,r[1]=c+p,r[4]=1-l-f,r[7]=d-g,r[2]=h-v,r[5]=d+g,r[8]=1-l-u,r}function Fw(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=t[4],o=t[5],A=t[6],l=t[7],c=t[8],u=t[9],h=t[10],d=t[11],f=t[12],g=t[13],v=t[14],p=t[15],y=e*o-n*s,x=e*A-i*s,F=e*l-a*s,O=n*A-i*o,L=n*l-a*o,U=i*l-a*A,R=c*g-u*f,j=c*v-h*f,q=c*p-d*f,et=u*v-h*g,it=u*p-d*g,dt=h*p-d*v,ft=y*dt-x*it+F*et+O*q-L*j+U*R;return ft?(ft=1/ft,r[0]=(o*dt-A*it+l*et)*ft,r[1]=(A*q-s*dt-l*j)*ft,r[2]=(s*it-o*q+l*R)*ft,r[3]=(i*it-n*dt-a*et)*ft,r[4]=(e*dt-i*q+a*j)*ft,r[5]=(n*q-e*it-a*R)*ft,r[6]=(g*U-v*L+p*O)*ft,r[7]=(v*F-f*U-p*x)*ft,r[8]=(f*L-g*F+p*y)*ft,r):null}function Tw(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 wu(r){return"mat3("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+", "+r[4]+", "+r[5]+", "+r[6]+", "+r[7]+", "+r[8]+")"}function Ow(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 Iw(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 Nw(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 Lw(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 kw(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 Qw(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 Uw(r,t){var e=r[0],n=r[1],i=r[2],a=r[3],s=r[4],o=r[5],A=r[6],l=r[7],c=r[8],u=t[0],h=t[1],d=t[2],f=t[3],g=t[4],v=t[5],p=t[6],y=t[7],x=t[8];return Math.abs(e-u)<=glMatrix.EPSILON*Math.max(1,Math.abs(e),Math.abs(u))&&Math.abs(n-h)<=glMatrix.EPSILON*Math.max(1,Math.abs(n),Math.abs(h))&&Math.abs(i-d)<=glMatrix.EPSILON*Math.max(1,Math.abs(i),Math.abs(d))&&Math.abs(a-f)<=glMatrix.EPSILON*Math.max(1,Math.abs(a),Math.abs(f))&&Math.abs(s-g)<=glMatrix.EPSILON*Math.max(1,Math.abs(s),Math.abs(g))&&Math.abs(o-v)<=glMatrix.EPSILON*Math.max(1,Math.abs(o),Math.abs(v))&&Math.abs(A-p)<=glMatrix.EPSILON*Math.max(1,Math.abs(A),Math.abs(p))&&Math.abs(l-y)<=glMatrix.EPSILON*Math.max(1,Math.abs(l),Math.abs(y))&&Math.abs(c-x)<=glMatrix.EPSILON*Math.max(1,Math.abs(c),Math.abs(x))}var Rw=null,Ad=null;function Br(){var r=new ct(4);return ct!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function yv(r){return r[0]=0,r[1]=0,r[2]=0,r[3]=1,r}function ca(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 VA(r,t){var e=Math.acos(t[3])*2,n=Math.sin(e/2);return n>glMatrix.EPSILON?(r[0]=t[0]/n,r[1]=t[1]/n,r[2]=t[2]/n):(r[0]=1,r[1]=0,r[2]=0),e}function $n(r,t){var e=Hs(r,t);return Math.acos(2*e*e-1)}function Ps(r,t,e){var n=t[0],i=t[1],a=t[2],s=t[3],o=e[0],A=e[1],l=e[2],c=e[3];return r[0]=n*c+s*o+i*l-a*A,r[1]=i*c+s*A+a*o-n*l,r[2]=a*c+s*l+n*A-i*o,r[3]=s*c-n*o-i*A-a*l,r}function ld(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A+s*o,r[1]=i*A+a*o,r[2]=a*A-i*o,r[3]=s*A-n*o,r}function wv(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A-a*o,r[1]=i*A+s*o,r[2]=a*A+n*o,r[3]=s*A-i*o,r}function WA(r,t,e){e*=.5;var n=t[0],i=t[1],a=t[2],s=t[3],o=Math.sin(e),A=Math.cos(e);return r[0]=n*A+i*o,r[1]=i*A-n*o,r[2]=a*A+s*o,r[3]=s*A-a*o,r}function us(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 Ev(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=Math.sqrt(e*e+n*n+i*i),o=Math.exp(a),A=s>0?o*Math.sin(s)/s:0;return r[0]=e*A,r[1]=n*A,r[2]=i*A,r[3]=o*Math.cos(s),r}function _s(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 Ur(r,t,e){return _s(r,t),ua(r,r,e),Ev(r,r),r}function ql(r,t,e,n){var i=t[0],a=t[1],s=t[2],o=t[3],A=e[0],l=e[1],c=e[2],u=e[3],h,d,f,g,v;return d=i*A+a*l+s*c+o*u,d<0&&(d=-d,A=-A,l=-l,c=-c,u=-u),1-d>$?(h=Math.acos(d),f=Math.sin(h),g=Math.sin((1-n)*h)/f,v=Math.sin(n*h)/f):(g=1-n,v=n),r[0]=g*i+v*A,r[1]=g*a+v*l,r[2]=g*s+v*c,r[3]=g*o+v*u,r}function gi(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 jA(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 yo(r,t){return r[0]=-t[0],r[1]=-t[1],r[2]=-t[2],r[3]=t[3],r}function ZA(r,t){var e=t[0]+t[4]+t[8],n;if(e>0)n=Math.sqrt(e+1),r[3]=.5*n,n=.5/n,r[0]=(t[5]-t[7])*n,r[1]=(t[6]-t[2])*n,r[2]=(t[1]-t[3])*n;else{var i=0;t[4]>t[0]&&(i=1),t[8]>t[i*3+i]&&(i=2);var a=(i+1)%3,s=(i+2)%3;n=Math.sqrt(t[i*3+i]-t[a*3+a]-t[s*3+s]+1),r[i]=.5*n,n=.5/n,r[3]=(t[a*3+s]-t[s*3+a])*n,r[a]=(t[a*3+i]+t[i*3+a])*n,r[s]=(t[s*3+i]+t[i*3+s])*n}return r}function Gn(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:Ct,a=Math.PI/360;t*=a,n*=a,e*=a;var s=Math.sin(t),o=Math.cos(t),A=Math.sin(e),l=Math.cos(e),c=Math.sin(n),u=Math.cos(n);switch(i){case"xyz":r[0]=s*l*u+o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u-s*A*c;break;case"xzy":r[0]=s*l*u-o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u+s*A*c;break;case"yxz":r[0]=s*l*u+o*A*c,r[1]=o*A*u-s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u+s*A*c;break;case"yzx":r[0]=s*l*u+o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u-s*A*c;break;case"zxy":r[0]=s*l*u-o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c+s*A*u,r[3]=o*l*u-s*A*c;break;case"zyx":r[0]=s*l*u-o*A*c,r[1]=o*A*u+s*l*c,r[2]=o*l*c-s*A*u,r[3]=o*l*u+s*A*c;break;default:throw new Error("Unknown angle order "+i)}return r}function Bv(r){return"quat("+r[0]+", "+r[1]+", "+r[2]+", "+r[3]+")"}var bv=jo,cd=Xi,YA=Ji,XA=fo,xv=ja,Eu=Ps,ua=Wl,Hs=Y,wo=S,ni=Ca,Eo=null,Cv=zA,Sv=null,Jo=Yl,Mv=ot;function Dw(r,t){return Math.abs(vec4.dot(r,t))>=1-glMatrix.EPSILON}var $l=function(){var r=Ot(),t=Wt(1,0,0),e=Wt(0,1,0);return function(n,i,a){var s=_e(i,a);return s<-.999999?(Me(r,t,i),la(r)<1e-6&&Me(r,e,i),be(r,r),ca(n,r,Math.PI),n):s>.999999?(n[0]=0,n[1]=0,n[2]=0,n[3]=1,n):(Me(r,i,a),n[0]=r[0],n[1]=r[1],n[2]=r[2],n[3]=1+s,Jo(n,n))}}(),Gs=function(){var r=Br(),t=Br();return function(e,n,i,a,s,o){return ql(r,n,s,o),ql(t,i,a,o),ql(e,r,t,2*o*(1-o)),e}}(),Pw=function(){var r=sd();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],Jo(t,ZA(t,r))}}();function Bu(){var r=new ct(2);return ct!=Float32Array&&(r[0]=0,r[1]=0),r}function bu(r){var t=new glMatrix.ARRAY_TYPE(2);return t[0]=r[0],t[1]=r[1],t}function Fv(r,t){var e=new glMatrix.ARRAY_TYPE(2);return e[0]=r,e[1]=t,e}function Tv(r,t){return r[0]=t[0],r[1]=t[1],r}function Ov(r,t,e){return r[0]=t,r[1]=e,r}function Ya(r,t,e){return r[0]=t[0]+e[0],r[1]=t[1]+e[1],r}function Iv(r,t,e){return r[0]=t[0]-e[0],r[1]=t[1]-e[1],r}function _w(r,t,e){return r[0]=t[0]*e[0],r[1]=t[1]*e[1],r}function Hw(r,t,e){return r[0]=t[0]/e[0],r[1]=t[1]/e[1],r}function xu(r,t){return r[0]=Math.ceil(t[0]),r[1]=Math.ceil(t[1]),r}function Gw(r,t){return r[0]=Math.floor(t[0]),r[1]=Math.floor(t[1]),r}function Nv(r,t,e){return r[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r}function Lv(r,t,e){return r[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r}function kv(r,t){return r[0]=glMatrix.round(t[0]),r[1]=glMatrix.round(t[1]),r}function Qv(r,t,e){return r[0]=t[0]*e,r[1]=t[1]*e,r}function Uv(r,t,e,n){return r[0]=t[0]+e[0]*n,r[1]=t[1]+e[1]*n,r}function Rv(r,t){var e=t[0]-r[0],n=t[1]-r[1];return Math.sqrt(e*e+n*n)}function Dv(r,t){var e=t[0]-r[0],n=t[1]-r[1];return e*e+n*n}function Pv(r){var t=r[0],e=r[1];return Math.sqrt(t*t+e*e)}function zw(r){var t=r[0],e=r[1];return t*t+e*e}function Cu(r,t){return r[0]=-t[0],r[1]=-t[1],r}function Kw(r,t){return r[0]=1/t[0],r[1]=1/t[1],r}function _v(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 Su(r,t){return r[0]*t[0]+r[1]*t[1]}function Vw(r,t,e){var n=t[0]*e[1]-t[1]*e[0];return r[0]=r[1]=0,r[2]=n,r}function Hv(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 Ww(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 jw(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 Zw(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 Yw(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 Xw(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 JA(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 Jw(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 qw(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 Mu(r){return r[0]=0,r[1]=0,r}function $w(r){return"vec2("+r[0]+", "+r[1]+")"}function Gv(r,t){return r[0]===t[0]&&r[1]===t[1]}function tE(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 eE=null,Fu=null,nE=null,rE=null,iE=null,aE=null,Tu=null,sE=function(){var r=Bu();return function(t,e,n,i,a,s){var o,A;for(e||(e=2),n||(n=0),i?A=Math.min(i*e+n,t.length):A=t.length,o=n;oe?e:r},dr=zv,D=T(80813),qA={a:7,c:6,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,z:0};function ud(r){return Array.isArray(r)&&r.every(function(t){var e=t[0].toLowerCase();return qA[e]===t.length-1&&"achlmqstvz".includes(e)})}function hd(r){return ud(r)&&r.every(function(t){var e=t[0];return e===e.toUpperCase()})}function dd(r){return hd(r)&&r.every(function(t){var e=t[0];return"ACLMQZ".includes(e)})}var fd={x1:0,y1:0,x2:0,y2:0,x:0,y:0,qx:null,qy:null};function gd(r){for(var t=r.pathValue[r.segmentStart],e=t.toLowerCase(),n=r.data;n.length>=qA[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,qA[e]))),!!qA[e]););}function Kv(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 tc(r){return r>=48&&r<=57||r===43||r===45||r===46}function qo(r){return r>=48&&r<=57}function Vv(r){var t=r.max,e=r.pathValue,n=r.index,i=n,a=!1,s=!1,o=!1,A=!1,l;if(i>=t){r.err="[path-util]: Invalid path value at index ".concat(i,', "pathValue" is missing param');return}if(l=e.charCodeAt(i),(l===43||l===45)&&(i+=1,l=e.charCodeAt(i)),!qo(l)&&l!==46){r.err="[path-util]: Invalid path value at index ".concat(i,', "').concat(e[i],'" is not a number');return}if(l!==46){if(a=l===48,i+=1,l=e.charCodeAt(i),a&&i=5760&&t.includes(r)}function ec(r){for(var t=r.pathValue,e=r.max;r.index0;s-=1){if(Ou(i)&&(s===3||s===4)?Kv(r):Vv(r),r.err.length)return;r.data.push(r.param),ec(r),r.index=r.max||!tc(e.charCodeAt(r.index)))break}gd(r)}var jv=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 Zv(r){if(ud(r))return[].concat(r);var t=new jv(r);for(ec(t);t.index=a)s={x:e,y:n};else{var o=zs([r,t],[e,n],i/a),A=o[0],l=o[1];s={x:A,y:l}}return{length:a,point:s,min:{x:Math.min(r,e),y:Math.min(t,n)},max:{x:Math.max(r,e),y:Math.max(t,n)}}}function pd(r,t){var e=r.x,n=r.y,i=t.x,a=t.y,s=e*i+n*a,o=Math.sqrt((Math.pow(e,2)+Math.pow(n,2))*(Math.pow(i,2)+Math.pow(a,2))),A=e*a-n*i<0?-1:1,l=A*Math.acos(s/o);return l}function Jv(r,t,e,n,i,a,s,o,A,l){var c=Math.abs,u=Math.sin,h=Math.cos,d=Math.sqrt,f=Math.PI,g=c(e),v=c(n),p=(i%360+360)%360,y=p*(f/180);if(r===o&&t===A)return{x:r,y:t};if(g===0||v===0)return $o(r,t,o,A,l).point;var x=(r-o)/2,F=(t-A)/2,O={x:h(y)*x+u(y)*F,y:-u(y)*x+h(y)*F},L=Math.pow(O.x,2)/Math.pow(g,2)+Math.pow(O.y,2)/Math.pow(v,2);L>1&&(g*=d(L),v*=d(L));var U=Math.pow(g,2)*Math.pow(v,2)-Math.pow(g,2)*Math.pow(O.y,2)-Math.pow(v,2)*Math.pow(O.x,2),R=Math.pow(g,2)*Math.pow(O.y,2)+Math.pow(v,2)*Math.pow(O.x,2),j=U/R;j=j<0?0:j;var q=(a!==s?1:-1)*d(j),et={x:q*(g*O.y/v),y:q*(-(v*O.x)/g)},it={x:h(y)*et.x-u(y)*et.y+(r+o)/2,y:u(y)*et.x+h(y)*et.y+(t+A)/2},dt={x:(O.x-et.x)/g,y:(O.y-et.y)/v},ft=pd({x:1,y:0},dt),mt={x:(-O.x-et.x)/g,y:(-O.y-et.y)/v},Rt=pd(dt,mt);!s&&Rt>0?Rt-=2*f:s&&Rt<0&&(Rt+=2*f),Rt%=2*f;var Qt=ft+Rt*l,yt=g*h(Qt),xt=v*u(Qt),Dt={x:h(y)*yt-u(y)*xt+it.x,y:u(y)*yt+h(y)*xt+it.y};return Dt}function qv(r,t,e,n,i,a,s,o,A,l,c){var u,h=c.bbox,d=h===void 0?!0:h,f=c.length,g=f===void 0?!0:f,v=c.sampleSize,p=v===void 0?30:v,y=typeof l=="number",x=r,F=t,O=0,L=[x,F,O],U=[x,F],R=0,j={x:0,y:0},q=[{x,y:F}];y&&l<=0&&(j={x,y:F});for(var et=0;et<=p;et+=1){if(R=et/p,u=Jv(r,t,e,n,i,a,s,o,A,R),x=u.x,F=u.y,d&&q.push({x,y:F}),g&&(O+=ki(U,[x,F])),U=[x,F],y&&O>=l&&l>L[2]){var it=(O-l)/(O-L[2]);j={x:U[0]*(1-it)+L[0]*it,y:U[1]*(1-it)+L[1]*it}}L=[x,F,O]}return y&&l>=O&&(j={x:o,y:A}),{length:O,point:j,min:{x:Math.min.apply(null,q.map(function(dt){return dt.x})),y:Math.min.apply(null,q.map(function(dt){return dt.y}))},max:{x:Math.max.apply(null,q.map(function(dt){return dt.x})),y:Math.max.apply(null,q.map(function(dt){return dt.y}))}}}function $v(r,t,e,n,i,a,s,o,A){var l=1-A;return{x:Math.pow(l,3)*r+3*Math.pow(l,2)*A*e+3*l*Math.pow(A,2)*i+Math.pow(A,3)*s,y:Math.pow(l,3)*t+3*Math.pow(l,2)*A*n+3*l*Math.pow(A,2)*a+Math.pow(A,3)*o}}function md(r,t,e,n,i,a,s,o,A,l){var c,u=l.bbox,h=u===void 0?!0:u,d=l.length,f=d===void 0?!0:d,g=l.sampleSize,v=g===void 0?10:g,p=typeof A=="number",y=r,x=t,F=0,O=[y,x,F],L=[y,x],U=0,R={x:0,y:0},j=[{x:y,y:x}];p&&A<=0&&(R={x:y,y:x});for(var q=0;q<=v;q+=1){if(U=q/v,c=$v(r,t,e,n,i,a,s,o,U),y=c.x,x=c.y,h&&j.push({x:y,y:x}),f&&(F+=ki(L,[y,x])),L=[y,x],p&&F>=A&&A>O[2]){var et=(F-A)/(F-O[2]);R={x:L[0]*(1-et)+O[0]*et,y:L[1]*(1-et)+O[1]*et}}O=[y,x,F]}return p&&A>=F&&(R={x:s,y:o}),{length:F,point:R,min:{x:Math.min.apply(null,j.map(function(it){return it.x})),y:Math.min.apply(null,j.map(function(it){return it.y}))},max:{x:Math.max.apply(null,j.map(function(it){return it.x})),y:Math.max.apply(null,j.map(function(it){return it.y}))}}}function tp(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 ep(r,t,e,n,i,a,s,o){var A,l=o.bbox,c=l===void 0?!0:l,u=o.length,h=u===void 0?!0:u,d=o.sampleSize,f=d===void 0?10:d,g=typeof s=="number",v=r,p=t,y=0,x=[v,p,y],F=[v,p],O=0,L={x:0,y:0},U=[{x:v,y:p}];g&&s<=0&&(L={x:v,y:p});for(var R=0;R<=f;R+=1){if(O=R/f,A=tp(r,t,e,n,i,a,O),v=A.x,p=A.y,c&&U.push({x:v,y:p}),h&&(y+=ki(F,[v,p])),F=[v,p],g&&y>=s&&s>x[2]){var j=(y-s)/(y-x[2]);L={x:F[0]*(1-j)+x[0]*j,y:F[1]*(1-j)+x[1]*j}}x=[v,p,y]}return g&&s>=y&&(L={x:i,y:a}),{length:y,point:L,min:{x:Math.min.apply(null,U.map(function(q){return q.x})),y:Math.min.apply(null,U.map(function(q){return q.y}))},max:{x:Math.max.apply(null,U.map(function(q){return q.x})),y:Math.max.apply(null,U.map(function(q){return q.y}))}}}function yd(r,t,e){for(var n,i,a,s,o,A,l=rc(r),c=typeof t=="number",u,h=[],d,f=0,g=0,v=0,p=0,y,x=[],F=[],O=0,L={x:0,y:0},U=L,R=L,j=L,q=0,et=0,it=l.length;et=t&&(j=R),F.push(U),x.push(L),q+=O,A=d!=="Z"?y.slice(-2):[v,p],f=A[0],g=A[1];return c&&t>=q&&(j={x:f,y:g}),{length:q,point:j,min:{x:Math.min.apply(null,x.map(function(dt){return dt.x})),y:Math.min.apply(null,x.map(function(dt){return dt.y}))},max:{x:Math.max.apply(null,F.map(function(dt){return dt.x})),y:Math.max.apply(null,F.map(function(dt){return dt.y}))}}}function np(r,t){return yd(r,void 0,(0,D.pi)((0,D.pi)({},t),{bbox:!1,length:!0})).length}function Qi(r){return Array.isArray(r)}var ic=function(r){if(Qi(r))return r.reduce(function(t,e){return Math.min(t,e)},r[0])};function ac(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 ip(r){return dd(r)&&r.every(function(t){var e=t[0];return"MC".includes(e)})}function sc(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 oc(r,t,e,n,i,a,s,o,A,l){var c=r,u=t,h=e,d=n,f=o,g=A,v=Math.PI*120/180,p=Math.PI/180*(+i||0),y=[],x,F,O,L,U;if(l)F=l[0],O=l[1],L=l[2],U=l[3];else{x=sc(c,u,-p),c=x.x,u=x.y,x=sc(f,g,-p),f=x.x,g=x.y;var R=(c-f)/2,j=(u-g)/2,q=R*R/(h*h)+j*j/(d*d);q>1&&(q=Math.sqrt(q),h*=q,d*=q);var et=h*h,it=d*d,dt=(a===s?-1:1)*Math.sqrt(Math.abs((et*it-et*j*j-it*R*R)/(et*j*j+it*R*R)));L=dt*h*j/d+(c+f)/2,U=dt*-d*R/h+(u+g)/2,F=Math.asin(((u-U)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),O=Math.asin(((g-U)/d*Math.pow(10,9)>>0)/Math.pow(10,9)),F=cO&&(F-=Math.PI*2),!s&&O>F&&(O-=Math.PI*2)}var ft=O-F;if(Math.abs(ft)>v){var mt=O,Rt=f,Qt=g;O=F+v*(s&&O>F?1:-1),f=L+h*Math.cos(O),g=U+d*Math.sin(O),y=oc(f,g,h,d,i,0,s,Rt,Qt,[O,mt,L,U])}ft=O-F;var yt=Math.cos(F),xt=Math.sin(F),Dt=Math.cos(O),Xt=Math.sin(O),ne=Math.tan(ft/4),le=4/3*h*ne,ge=4/3*d*ne,xe=[c,u],Qe=[c+le*xt,u-ge*yt],Pe=[f+le*Xt,g-ge*Dt],en=[f,g];if(Qe[0]=2*xe[0]-Qe[0],Qe[1]=2*xe[1]-Qe[1],l)return Qe.concat(Pe,en,y);y=Qe.concat(Pe,en,y);for(var mn=[],an=0,er=y.length;anop)return console.warn("Maximum recursion depth reached in equalizeSegments"),[r,t];var i=bd(r),a=bd(t),s=i.length,o=a.length,A=i.filter(function(p){return p.l}).length,l=a.filter(function(p){return p.l}).length,c=i.filter(function(p){return p.l}).reduce(function(p,y){var x=y.l;return p+x},0)/A||0,u=a.filter(function(p){return p.l}).reduce(function(p,y){var x=y.l;return p+x},0)/l||0,h=e||Math.max(s,o),d=[c,u],f=[h-s,h-o],g=0,v=[i,a].map(function(p,y){return p.l===h?p.map(function(x){return x.s}):p.map(function(x,F){return g=F&&f[y]&&x.l>=d[y],f[y]-=g?1:0,g?x.ss:[x.s]}).flat()});return v[0].length===v[1].length?v:xd(v[0],v[1],h,n+1)}function Rr(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 lp(r){var t=0,e=0,n=0;return Iu(r).map(function(i){var a;switch(i[0]){case"M":return t=i[1],e=i[2],0;default:var s=i.slice(1),o=s[0],A=s[1],l=s[2],c=s[3],u=s[4],h=s[5];return n=Rr(t,e,o,A,l,c,u,h),a=i.slice(-2),t=a[0],e=a[1],n}}).reduce(function(i,a){return i+a},0)}function Cd(r){return lp(r)>=0}function cp(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 up(r){return r.map(function(t){return Array.isArray(t)?[].concat(t):t})}function hp(r){var t=r.length,e=t-1;return r.map(function(n,i){return r.map(function(a,s){var o=i+s,A;return s===0||r[o]&&r[o][0]==="M"?(A=r[o],["M"].concat(A.slice(-2))):(o>=t&&(o-=e),r[o])})})}function Sd(r,t){var e=r.length-1,n=[],i=0,a=0,s=hp(r);return s.forEach(function(o,A){r.slice(1).forEach(function(l,c){a+=ki(r[(A+c)%e].slice(-2),t[c%e].slice(-2))}),n[A]=a,a=0}),i=n.indexOf(Math.min.apply(null,n)),s[i]}var dp=function(r){return r===void 0},Ze=dp,fp={}.toString,gp=function(r,t){return fp.call(r)==="[object "+t+"]"},Md=gp,vp=function(r){return Md(r,"Boolean")},eA=vp;function Vt(r){return typeof r=="function"}var br=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function pp(r,t,e){return yd(r,t,(0,D.pi)((0,D.pi)({},e),{bbox:!1,length:!0})).point}var we=T(18642),Sa=T(38882);function mp(r,t){for(;!{}.hasOwnProperty.call(r,t)&&(r=(0,Sa.Z)(r))!==null;);return r}function Ac(){return Ac=typeof Reflect!="undefined"&&Reflect.get?Reflect.get.bind():function(r,t,e){var n=mp(r,t);if(n){var i=Object.getOwnPropertyDescriptor(n,t);return i.get?i.get.call(arguments.length<3?r:e):i.value}},Ac.apply(null,arguments)}function Ks(r,t,e,n){var i=Ac((0,Sa.Z)(1&n?r.prototype:r),t,e);return 2&n&&typeof i=="function"?function(a){return i.apply(e,a)}:i}var lc=T(13750);function vi(r,t,e,n){var i=r-e,a=t-n;return Math.sqrt(i*i+a*a)}function cc(r,t){var e=Math.min.apply(Math,(0,G.Z)(r)),n=Math.min.apply(Math,(0,G.Z)(t)),i=Math.max.apply(Math,(0,G.Z)(r)),a=Math.max.apply(Math,(0,G.Z)(t));return{x:e,y:n,width:i-e,height:a-n}}function Fd(r){return(r+Math.PI*2)%(Math.PI*2)}function Vs(r,t){var e=Math.abs(r);return t>0?e:e*-1}function Nu(r,t,e,n,i,a){var s=e,o=n;if(s===0||o===0)return{x:r,y:t};for(var A=i-r,l=a-t,c=Math.abs(A),u=Math.abs(l),h=s*s,d=o*o,f=Math.PI/4,g=0,v=0,p=0;p<4;p++){g=s*Math.cos(f),v=o*Math.sin(f);var y=(h-d)*Math.pow(Math.cos(f),3)/s,x=(d-h)*Math.pow(Math.sin(f),3)/o,F=g-y,O=v-x,L=c-y,U=u-x,R=Math.hypot(O,F),j=Math.hypot(U,L),q=R*Math.asin((F*U-O*L)/(R*j)),et=q/Math.sqrt(h+d-g*g-v*v);f+=et,f=Math.min(Math.PI/2,Math.max(0,f))}return{x:r+Vs(g,A),y:t+Vs(v,l)}}function Lu(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 yp(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 Td(r,t,e){return Math.atan(-t/r*Math.tan(e))}function wp(r,t,e){return Math.atan(t/(r*Math.tan(e)))}function ku(r,t,e,n,i,a){return e*Math.cos(i)*Math.cos(a)-n*Math.sin(i)*Math.sin(a)+r}function Ep(r,t,e,n,i,a){return e*Math.sin(i)*Math.cos(a)+n*Math.cos(i)*Math.sin(a)+t}function Bp(r,t,e,n){var i=Math.atan2(n*r,e*t);return(i+Math.PI*2)%(Math.PI*2)}function Od(r,t,e){return{x:r*Math.cos(e),y:t*Math.sin(e)}}function Id(r,t,e){var n=Math.cos(e),i=Math.sin(e);return[r*n-t*i,r*i+t*n]}function bp(r,t,e,n,i,a,s){for(var o=Td(e,n,i),A=1/0,l=-1/0,c=[a,s],u=-Math.PI*2;u<=Math.PI*2;u+=Math.PI){var h=o+u;al&&(l=f)}for(var g=wp(e,n,i),v=1/0,p=-1/0,y=[a,s],x=-Math.PI*2;x<=Math.PI*2;x+=Math.PI){var F=g+x;ap&&(p=L)}return{x:A,y:v,width:l-A,height:p-v}}function oE(r,t,e,n,i,a,s,o,A){var l=Id(o-r,A-t,-i),c=_slicedToArray(l,2),u=c[0],h=c[1],d=Nu(0,0,e,n,u,h),f=Bp(e,n,d.x,d.y);fs&&(d=Od(e,n,s));var g=Id(d.x,d.y,i);return{x:g[0]+r,y:g[1]+t}}function AE(r,t,e,n,i,a,s,o){var A=(s-a)*o+a,l=Lu(r,t,e,n,i,a,s,A),c=yp(r,t,e,n,i,a,s,A);return Fd(Math.atan2(c,l))}var xp=1e-4;function Qu(r,t,e,n,i,a){var s=-1,o=1/0,A=[e,n],l=20;a&&a>200&&(l=a/10);for(var c=1/l,u=c/10,h=0;h<=l;h++){var d=h*c,f=[i.apply(void 0,(0,G.Z)(r.concat([d]))),i.apply(void 0,(0,G.Z)(t.concat([d])))],g=vi(A[0],A[1],f[0],f[1]);g=0&&Oo?vi(e,n,i,a):tl(r,t,e,n,i,a)}function tl(r,t,e,n,i,a){var s=[e-r,n-t];if(Gv(s,[0,0]))return Math.sqrt((i-r)*(i-r)+(a-t)*(a-t));var o=[-s[1],s[0]];_v(o,o);var A=[i-r,a-t];return Math.abs(Su(A,o))}function cE(r,t,e,n){return Math.atan2(n-t,e-r)}function hs(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 uc(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 Uu(r,t,e,n){var i=-3*r+9*t-9*e+3*n,a=6*r-12*t+6*e,s=3*t-3*r,o=[],A,l,c;if(tA(i,0))tA(a,0)||(A=-s/a,A>=0&&A<=1&&o.push(A));else{var u=a*a-4*i*s;tA(u,0)?o.push(-a/(2*i)):u>0&&(c=Math.sqrt(u),A=(-a+c)/(2*i),l=(-a-c)/(2*i),A>=0&&A<=1&&o.push(A),l>=0&&l<=1&&o.push(l))}return o}function Ld(r,t,e,n,i,a,s,o,A){var l=hs(r,e,i,s,A),c=hs(t,n,a,o,A),u=Ma(r,t,e,n,A),h=Ma(e,n,i,a,A),d=Ma(i,a,s,o,A),f=Ma(u.x,u.y,h.x,h.y,A),g=Ma(h.x,h.y,d.x,d.y,A);return[[r,t,u.x,u.y,f.x,f.y,l,c],[l,c,g.x,g.y,d.x,d.y,s,o]]}function Ru(r,t,e,n,i,a,s,o,A){if(A===0)return Cp([r,e,i,s],[t,n,a,o]);var l=Ld(r,t,e,n,i,a,s,o,.5),c=[].concat(_toConsumableArray(l[0]),[A-1]),u=[].concat(_toConsumableArray(l[1]),[A-1]);return Ru.apply(void 0,_toConsumableArray(c))+Ru.apply(void 0,_toConsumableArray(u))}function kd(r,t,e,n,i,a,s,o){for(var A=[r,s],l=[t,o],c=Uu(r,e,i,s),u=Uu(t,n,a,o),h=0;h1||t<0||r.length<2)return null;var e=_u(r),n=e.segments,i=e.totalLength;if(i===0)return{x:r[0][0],y:r[0][1]};for(var a=0,s=null,o=0;o=a&&t<=a+u){var h=(t-a)/u;s=Ma(l[0],l[1],c[0],c[1],h);break}a+=u}return s}function Rd(r,t){if(t>1||t<0||r.length<2)return 0;for(var e=_u(r),n=e.segments,i=e.totalLength,a=0,s=0,o=0;o=a&&t<=a+u){s=Math.atan2(c[1]-l[1],c[0]-l[0]);break}a+=u}return s}function Dd(r,t,e){for(var n=1/0,i=0;i=0?[i]:[]}function Gu(r,t,e,n,i,a,s){var o=nA(r,e,i,s),A=nA(t,n,a,s),l=Ma(r,t,e,n,s),c=Ma(e,n,i,a,s);return[[r,t,l.x,l.y,o,A],[o,A,c.x,c.y,i,a]]}function fc(r,t,e,n,i,a,s){if(s===0)return(vi(r,t,e,n)+vi(e,n,i,a)+vi(r,t,i,a))/2;var o=Gu(r,t,e,n,i,a,.5),A=o[0],l=o[1];return A.push(s-1),l.push(s-1),fc.apply(void 0,_toConsumableArray(A))+fc.apply(void 0,_toConsumableArray(l))}function ri(r,t,e,n,i,a){var s=Pd(r,e,i)[0],o=Pd(t,n,a)[0],A=[r,i],l=[t,a];return s!==void 0&&A.push(nA(r,e,i,s)),o!==void 0&&l.push(nA(t,n,a,o)),cc(A,l)}function gc(r,t,e,n,i,a){return fc(r,t,e,n,i,a,3)}function Tp(r,t,e,n,i,a,s,o){return Qu([r,e,i],[t,n,a],s,o,nA)}function Op(r,t,e,n,i,a,s,o){var A=Tp(r,t,e,n,i,a,s,o);return vi(A.x,A.y,s,o)}var ii=T(73001),Xa=T(11576),Ws=T(72054),Ja=T(42244);var Kt=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}({}),vc=function(r){return r[r.ZERO=0]="ZERO",r[r.NEGATIVE_ONE=1]="NEGATIVE_ONE",r}({}),ds=function(){function r(){(0,P.Z)(this,r),this.plugins=[]}return(0,N.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)})}}])}(),Ip=function(){function r(t){(0,P.Z)(this,r),this.clipSpaceNearZ=vc.NEGATIVE_ONE,this.plugins=[],this.config=(0,z.Z)({enableDirtyCheck:!0,enableCulling:!1,enableAutoRendering:!0,enableDirtyRectangleRendering:!0,enableDirtyRectangleRenderingDebug:!1,enableSizeAttenuation:!0,enableRenderingOptimization:!1},t)}return(0,N.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)}}])}(),zu=de,rA=ie,_d=As,Hd=ji,Ku=Pt,pc=cs,Zn=function(){function r(){(0,P.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,N.Z)(r,[{key:"update",value:function(e,n){rA(this.center,e),rA(this.halfExtents,n),pc(this.min,this.center,this.halfExtents),zu(this.max,this.center,this.halfExtents)}},{key:"setMinMax",value:function(e,n){zu(this.center,n,e),Ku(this.center,this.center,.5),pc(this.halfExtents,n,e),Ku(this.halfExtents,this.halfExtents,.5),rA(this.min,e),rA(this.max,n)}},{key:"getMin",value:function(){return this.min}},{key:"getMax",value:function(){return this.max}},{key:"add",value:function(e){if(!r.isEmpty(e)){if(r.isEmpty(this)){this.setMinMax(e.getMin(),e.getMax());return}var n=this.center,i=n[0],a=n[1],s=n[2],o=this.halfExtents,A=o[0],l=o[1],c=o[2],u=i-A,h=i+A,d=a-l,f=a+l,g=s-c,v=s+c,p=e.center,y=p[0],x=p[1],F=p[2],O=e.halfExtents,L=O[0],U=O[1],R=O[2],j=y-L,q=y+L,et=x-U,it=x+U,dt=F-R,ft=F+R;jh&&(h=q),etf&&(f=it),dtv&&(v=ft),n[0]=(u+h)*.5,n[1]=(d+f)*.5,n[2]=(g+v)*.5,o[0]=(h-u)*.5,o[1]=(f-d)*.5,o[2]=(v-g)*.5,this.min[0]=u,this.min[1]=d,this.min[2]=g,this.max[0]=h,this.max[1]=f,this.max[2]=v}}},{key:"setFromTransformedAABB",value:function(e,n){var i=this.center,a=this.halfExtents,s=e.center,o=e.halfExtents,A=n[0],l=n[4],c=n[8],u=n[1],h=n[5],d=n[9],f=n[2],g=n[6],v=n[10],p=Math.abs(A),y=Math.abs(l),x=Math.abs(c),F=Math.abs(u),O=Math.abs(h),L=Math.abs(d),U=Math.abs(f),R=Math.abs(g),j=Math.abs(v);i[0]=n[12]+A*s[0]+l*s[1]+c*s[2],i[1]=n[13]+u*s[0]+h*s[1]+d*s[2],i[2]=n[14]+f*s[0]+g*s[1]+v*s[2],a[0]=p*o[0]+y*o[1]+x*o[2],a[1]=F*o[0]+O*o[1]+L*o[2],a[2]=U*o[0]+R*o[1]+j*o[2],pc(this.min,i,a),zu(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=_d([0,0,0],this.getMin(),e.getMin()),a=Hd([0,0,0],this.getMax(),e.getMax());return n.setMinMax(i,a),n}},{key:"getNegativeFarPoint",value:function(e){return e.pnVertexFlag===273?rA([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?rA([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}}])}(),Np=function(){function r(t,e){(0,P.Z)(this,r),this.distance=t||0,this.normal=e||Wt(0,1,0),this.updatePNVertexFlag()}return(0,N.Z)(r,[{key:"updatePNVertexFlag",value:function(){this.pnVertexFlag=(+(this.normal[0]>=0)<<8)+(+(this.normal[1]>=0)<<4)+ +(this.normal[2]>=0)}},{key:"distanceToPoint",value:function(e){return _e(e,this.normal)-this.distance}},{key:"normalize",value:function(){var e=1/la(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),A=o>=0&&o<=1;return A&&i&&nn(i,e,n,o),A}}])}(),iA=function(r){return r[r.OUTSIDE=4294967295]="OUTSIDE",r[r.INSIDE=0]="INSIDE",r[r.INDETERMINATE=2147483647]="INDETERMINATE",r}({}),Lp=function(){function r(t){if((0,P.Z)(this,r),this.planes=[],t)this.planes=t;else for(var e=0;e<6;e++)this.planes.push(new Np)}return(0,N.Z)(r,[{key:"extractFromVPMatrix",value:function(e){var n=(0,H.Z)(e,16),i=n[0],a=n[1],s=n[2],o=n[3],A=n[4],l=n[5],c=n[6],u=n[7],h=n[8],d=n[9],f=n[10],g=n[11],v=n[12],p=n[13],y=n[14],x=n[15];ve(this.planes[0].normal,o-i,u-A,g-h),this.planes[0].distance=x-v,ve(this.planes[1].normal,o+i,u+A,g+h),this.planes[1].distance=x+v,ve(this.planes[2].normal,o+a,u+l,g+d),this.planes[2].distance=x+p,ve(this.planes[3].normal,o-a,u-l,g-d),this.planes[3].distance=x-p,ve(this.planes[4].normal,o-s,u-c,g-f),this.planes[4].distance=x-y,ve(this.planes[5].normal,o+s,u+c,g+f),this.planes[5].distance=x+y,this.planes.forEach(function(F){F.normalize(),F.updatePNVertexFlag()})}}])}(),ai=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,P.Z)(this,r),this.x=0,this.y=0,this.x=t,this.y=e}return(0,N.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}}])}(),fs=function(){function r(t,e,n,i){(0,P.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,N.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=Xi(e.x,e.y,0,1),a=Xi(e.x+e.width,e.y,0,1),s=Xi(e.x,e.y+e.height,0,1),o=Xi(e.x+e.width,e.y+e.height,0,1),A=Ar(),l=Ar(),c=Ar(),u=Ar();M(A,i,n),M(l,a,n),M(c,s,n),M(u,o,n);var h=Math.min(A[0],l[0],c[0],u[0]),d=Math.min(A[1],l[1],c[1],u[1]),f=Math.max(A[0],l[0],c[0],u[0]),g=Math.max(A[1],l[1],c[1],u[1]);return r.fromRect({x:h,y:d,width:f-h,height:g-d})}}])}(),On="Method not implemented.",aA="Use document.documentElement instead.",Gd="Cannot append a destroyed element.";function js(r){return r===void 0?0:r>360||r<-360?r%360:r}var mc=Ot();function pi(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?Gt(r):ie(mc,r):ye(r)?n?Wt(r,t,e):ve(mc,r,t,e):n?Wt(r[0],r[1]||t,r[2]||e):ve(mc,r[0],r[1]||t,r[2]||e)}var zd=Math.PI/180;function Un(r){return r*zd}var yc=180/Math.PI;function bi(r){return r*yc}var Kd=.9;function yE(r){return r%=400,r<0&&(r+=400),r*Kd}function wE(r){return r/360}function Vd(r){return 360*r}var gs=Math.PI/2;function Vu(r,t){var e=t[0],n=t[1],i=t[2],a=t[3],s=e*e,o=n*n,A=i*i,l=a*a,c=s+o+A+l,u=e*a-n*i;return u>.499995*c?(r[0]=gs,r[1]=2*Math.atan2(n,e),r[2]=0):u<-.499995*c?(r[0]=-gs,r[1]=2*Math.atan2(n,e),r[2]=0):(r[0]=Math.asin(2*(e*i-a*n)),r[1]=Math.atan2(2*(e*a+n*i),1-2*(A+l)),r[2]=Math.atan2(2*(e*n+i*a),1-2*(o+A))),r}function wc(r,t){var e,n,i=Ds(Ot(),t),a=(0,H.Z)(i,3),s=a[0],o=a[1],A=a[2],l=Math.asin(-t[2]/s);return l-gs?(e=Math.atan2(t[6]/o,t[10]/A),n=Math.atan2(t[1]/s,t[0]/s)):(n=0,e=-Math.atan2(t[4]/o,t[5]/o)):(n=0,e=Math.atan2(t[4]/o,t[5]/o)),r[0]=e,r[1]=l,r[2]=n,r}function Wu(r,t){return t.length===16?wc(r,t):Vu(r,t)}function kp(r,t,e,n,i){var a=Math.cos(r),s=Math.sin(r);return Jl(n*a,i*s,0,-n*s,i*a,0,t,e,1)}function Qp(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1,A=2*a,l=e-t,c=n-i,u=A/l,h=A/c,d=(e+t)/l,f=(n+i)/c,g,v,p=s-a,y=s*a;return o?(g=-s/p,v=-y/p):(g=-(s+a)/p,v=-2*y/p),r[0]=u,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=h,r[6]=0,r[7]=0,r[8]=d,r[9]=f,r[10]=g,r[11]=-1,r[12]=0,r[13]=0,r[14]=v,r[15]=0,r}function Wd(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&&(tKe[1][2]&&(a[0]=-a[0]),Ke[0][2]>Ke[2][0]&&(a[1]=-a[1]),Ke[1][0]>Ke[0][1]&&(a[2]=-a[2]),!0}function Zd(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 Up(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 oA(r,t,e,n,i){r[0]=t[0]*n+e[0]*i,r[1]=t[1]*n+e[1]*i,r[2]=t[2]*n+e[2]*i}var In=function(r){return r[r.ORBITING=0]="ORBITING",r[r.EXPLORING=1]="EXPLORING",r[r.TRACKING=2]="TRACKING",r}({}),Bc=function(r){return r[r.DEFAULT=0]="DEFAULT",r[r.ROTATIONAL=1]="ROTATIONAL",r[r.TRANSLATIONAL=2]="TRANSLATIONAL",r[r.CINEMATIC=3]="CINEMATIC",r}({}),ea=function(r){return r[r.ORTHOGRAPHIC=0]="ORTHOGRAPHIC",r[r.PERSPECTIVE=1]="PERSPECTIVE",r}({}),Yd={UPDATED:"updated"},ju=2e-4,Zu=function(){function r(){(0,P.Z)(this,r),this.clipSpaceNearZ=vc.NEGATIVE_ONE,this.eventEmitter=new Z,this.matrix=$t(),this.right=Wt(1,0,0),this.up=Wt(0,1,0),this.forward=Wt(0,0,1),this.position=Wt(0,0,1),this.focalPoint=Wt(0,0,0),this.distanceVector=Wt(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=$t(),this.projectionMatrixInverse=$t(),this.jitteredProjectionMatrix=void 0,this.enableUpdate=!0,this.type=In.EXPLORING,this.trackingMode=Bc.DEFAULT,this.projectionMode=ea.PERSPECTIVE,this.frustum=new Lp,this.orthoMatrix=$t()}return(0,N.Z)(r,[{key:"isOrtho",value:function(){return this.projectionMode===ea.ORTHOGRAPHIC}},{key:"getProjectionMode",value:function(){return this.projectionMode}},{key:"getPerspective",value:function(){return this.jitteredProjectionMatrix||this.projectionMatrix}},{key:"getPerspectiveInverse",value:function(){return this.projectionMatrixInverse}},{key:"getFrustum",value:function(){return this.frustum}},{key:"getPosition",value:function(){return this.position}},{key:"getFocalPoint",value:function(){return this.focalPoint}},{key:"getDollyingStep",value:function(){return this.dollyingStep}},{key:"getNear",value:function(){return this.near}},{key:"getFar",value:function(){return this.far}},{key:"getZoom",value:function(){return this.zoom}},{key:"getOrthoMatrix",value:function(){return this.orthoMatrix}},{key:"getView",value:function(){return this.view}},{key:"setEnableUpdate",value:function(e){this.enableUpdate=e}},{key:"setType",value:function(e,n){return this.type=e,this.type===In.EXPLORING?this.setWorldRotation(!0):this.setWorldRotation(!1),this._getAngles(),this.type===In.TRACKING&&n!==void 0&&this.setTrackingMode(n),this}},{key:"setProjectionMode",value:function(e){return this.projectionMode=e,this}},{key:"setTrackingMode",value:function(e){if(this.type!==In.TRACKING)throw new Error("Impossible to set a tracking mode if the camera is not of tracking type");return this.trackingMode=e,this}},{key:"setWorldRotation",value:function(e){return this.rotateWorld=e,this._getAngles(),this}},{key:"getViewTransform",value:function(){return on($t(),this.matrix)}},{key:"getWorldTransform",value:function(){return this.matrix}},{key:"jitterProjectionMatrix",value:function(e,n){var i=Tr($t(),[e,n,0]);this.jitteredProjectionMatrix=ue($t(),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===ea.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===ea.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===ea.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===ea.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===ea.ORTHOGRAPHIC?this.setOrthographic(this.left,this.rright,this.top,this.bottom,this.near,this.far):this.projectionMode===ea.PERSPECTIVE&&this.setPerspective(this.near,this.far,this.fov,this.aspect),this}},{key:"setZoomByViewportPoint",value:function(e,n){var i=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),a=i.x,s=i.y,o=this.roll;this.rotate(0,0,-o),this.setPosition(a,s),this.setFocalPoint(a,s),this.setZoom(e),this.rotate(0,0,o);var A=this.canvas.viewport2Canvas({x:n[0],y:n[1]}),l=A.x,c=A.y,u=Wt(l-a,c-s,0),h=_e(u,this.right)/ae(this.right),d=_e(u,this.up)/ae(this.up),f=this.getPosition(),g=(0,H.Z)(f,2),v=g[0],p=g[1],y=this.getFocalPoint(),x=(0,H.Z)(y,2),F=x[0],O=x[1];return this.setPosition(v-h,p-d),this.setFocalPoint(F-h,O-d),this}},{key:"setPerspective",value:function(e,n,i,a){var s;this.projectionMode=ea.PERSPECTIVE,this.fov=i,this.near=e,this.far=n,this.aspect=a;var o=this.near*Math.tan(Un(.5*this.fov))/this.zoom,A=2*o,l=this.aspect*A,c=-.5*l;if((s=this.view)!==null&&s!==void 0&&s.enabled){var u=this.view.fullWidth,h=this.view.fullHeight;c+=this.view.offsetX*l/u,o-=this.view.offsetY*A/h,l*=this.view.width/u,A*=this.view.height/h}return Qp(this.projectionMatrix,c,c+l,o-A,o,e,this.far,this.clipSpaceNearZ===vc.ZERO),on(this.projectionMatrixInverse,this.projectionMatrix),this.triggerUpdate(),this}},{key:"setOrthographic",value:function(e,n,i,a,s,o){var A;this.projectionMode=ea.ORTHOGRAPHIC,this.rright=n,this.left=e,this.top=i,this.bottom=a,this.near=s,this.far=o;var l=(this.rright-this.left)/(2*this.zoom),c=(this.top-this.bottom)/(2*this.zoom),u=(this.rright+this.left)/2,h=(this.top+this.bottom)/2,d=u-l,f=u+l,g=h+c,v=h-c;if((A=this.view)!==null&&A!==void 0&&A.enabled){var p=(this.rright-this.left)/this.view.fullWidth/this.zoom,y=(this.top-this.bottom)/this.view.fullHeight/this.zoom;d+=p*this.view.offsetX,f=d+p*this.view.width,g-=y*this.view.offsetY,v=g-y*this.view.height}return this.clipSpaceNearZ===vc.NEGATIVE_ONE?gu(this.projectionMatrix,d,f,g,v,s,o):vu(this.projectionMatrix,d,f,g,v,s,o),on(this.projectionMatrixInverse,this.projectionMatrix),this._getOrthoMatrix(),this.triggerUpdate(),this}},{key:"setPosition",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.position[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.position[2],a=pi(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=Wt(0,1,0);if(this.focalPoint=pi(e,n,i),this.trackingMode===Bc.CINEMATIC){var s=Oe(Ot(),this.focalPoint,this.position);e=s[0],n=s[1],i=s[2];var o=ae(s),A=bi(Math.asin(n/o)),l=90+bi(Math.atan2(i,e)),c=$t();qn(c,c,Un(l)),jn(c,c,Un(A)),a=me(Ot(),[0,1,0],c)}return on(this.matrix,rd($t(),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?dA(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):e===4?dA(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=nl.exec(r))?new Ui(t[1],t[2],t[3],1):(t=Dp.exec(r))?new Ui(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Pp.exec(r))?dA(t[1],t[2],t[3],t[4]):(t=_p.exec(r))?dA(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=Hp.exec(r))?Fc(t[1],t[2]/100,t[3]/100,1):(t=Gp.exec(r))?Fc(t[1],t[2]/100,t[3]/100,t[4]):xc.hasOwnProperty(r)?Sc(xc[r]):r==="transparent"?new Ui(NaN,NaN,NaN,0):null}function Sc(r){return new Ui(r>>16&255,r>>8&255,r&255,1)}function dA(r,t,e,n){return n<=0&&(r=t=e=NaN),new Ui(r,t,e,n)}function $d(r){return r instanceof uA||(r=Cc(r)),r?(r=r.rgb(),new Ui(r.r,r.g,r.b,r.opacity)):new Ui}function Vp(r,t,e,n){return arguments.length===1?$d(r):new Ui(r,t,e,n==null?1:n)}function Ui(r,t,e,n){this.r=+r,this.g=+t,this.b=+e,this.opacity=+n}Bo(Ui,Vp,qa(uA,{brighter(r){return r=r==null?el:Math.pow(el,r),new Ui(this.r*r,this.g*r,this.b*r,this.opacity)},darker(r){return r=r==null?hA:Math.pow(hA,r),new Ui(this.r*r,this.g*r,this.b*r,this.opacity)},rgb(){return this},clamp(){return new Ui(bo(this.r),bo(this.g),bo(this.b),Mc(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:Yu,formatHex:Yu,formatHex8:Wp,formatRgb:tf,toString:tf}));function Yu(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}`}function Wp(){return`#${xo(this.r)}${xo(this.g)}${xo(this.b)}${xo((isNaN(this.opacity)?1:this.opacity)*255)}`}function tf(){const r=Mc(this.opacity);return`${r===1?"rgb(":"rgba("}${bo(this.r)}, ${bo(this.g)}, ${bo(this.b)}${r===1?")":`, ${r})`}`}function Mc(r){return isNaN(r)?1:Math.max(0,Math.min(1,r))}function bo(r){return Math.max(0,Math.min(255,Math.round(r)||0))}function xo(r){return r=bo(r),(r<16?"0":"")+r.toString(16)}function Fc(r,t,e,n){return n<=0?r=t=e=NaN:e<=0||e>=1?r=t=NaN:t<=0&&(r=NaN),new Oa(r,t,e,n)}function ef(r){if(r instanceof Oa)return new Oa(r.h,r.s,r.l,r.opacity);if(r instanceof uA||(r=Cc(r)),!r)return new Oa;if(r instanceof Oa)return r;r=r.rgb();var t=r.r/255,e=r.g/255,n=r.b/255,i=Math.min(t,e,n),a=Math.max(t,e,n),s=NaN,o=a-i,A=(a+i)/2;return o?(t===a?s=(e-n)/o+(e0&&A<1?0:s,new Oa(s,o,A,r.opacity)}function Xu(r,t,e,n){return arguments.length===1?ef(r):new Oa(r,t,e,n==null?1:n)}function Oa(r,t,e,n){this.h=+r,this.s=+t,this.l=+e,this.opacity=+n}Bo(Oa,Xu,qa(uA,{brighter(r){return r=r==null?el:Math.pow(el,r),new Oa(this.h,this.s,this.l*r,this.opacity)},darker(r){return r=r==null?hA:Math.pow(hA,r),new Oa(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 Ui(fA(r>=240?r-240:r+120,i,n),fA(r,i,n),fA(r<120?r+240:r-120,i,n),this.opacity)},clamp(){return new Oa(Se(this.h),ms(this.s),ms(this.l),Mc(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=Mc(this.opacity);return`${r===1?"hsl(":"hsla("}${Se(this.h)}, ${ms(this.s)*100}%, ${ms(this.l)*100}%${r===1?")":`, ${r})`}`}}));function Se(r){return r=(r||0)%360,r<0?r+360:r}function ms(r){return Math.max(0,Math.min(1,r||0))}function fA(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 Nn(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=ys.kUnitType&&this.getType()<=ys.kClampType}}],[{key:"isAngle",value:function(e){return e===fe.kDegrees||e===fe.kRadians||e===fe.kGradians||e===fe.kTurns}},{key:"isLength",value:function(e){return e>=fe.kEms&&e1&&arguments[1]!==void 0?arguments[1]:"",n="";return Number.isFinite(t)?n="NaN":t>0?n="infinity":n="-infinity",n+=e},$u=function(t){return Xp(Yp(t))},_n=function(r){function t(e){var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fe.kNumber;(0,P.Z)(this,t),n=(0,K.Z)(this,t);var a;return typeof i=="string"?a=Oc(i):a=i,n.unit=a,n.value=e,n}return(0,_.Z)(t,r),(0,N.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 ys.kUnitType}},{key:"convertTo",value:function(n){if(this.unit===n)return new t(this.value,this.unit);var i=$u(this.unit);if(i!==$u(n)||i===fe.kUnknown)return null;var a=Ju(this.unit)/Ju(n);return new t(this.value*a,n)}},{key:"buildCSSText",value:function(n,i,a){var s;switch(this.unit){case fe.kUnknown:break;case fe.kInteger:s=Number(this.value).toFixed(0);break;case fe.kNumber:case fe.kPercentage:case fe.kEms:case fe.kRems:case fe.kPixels:case fe.kDegrees:case fe.kRadians:case fe.kGradians:case fe.kMilliseconds:case fe.kSeconds:case fe.kTurns:{var o=-999999,A=999999,l=this.value,c=qu(this.unit);if(lA){var u=qu(this.unit);!Number.isFinite(l)||Number.isNaN(l)?s=nf(l,u):s=l+(u||"")}else s="".concat(l).concat(c)}}return a+=s,a}}])}(rl),Ia=new _n(0,"px");new _n(1,"px");var Co=new _n(0,"deg"),th=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,P.Z)(this,t),a=(0,K.Z)(this,t,["rgb"]),a.r=e,a.g=n,a.b=i,a.alpha=s,a.isNone=o,a}return(0,_.Z)(t,r),(0,N.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,")")}}])}(Jp),al=new Ri("unset"),da=new Ri("initial"),rf=new Ri("inherit"),gA={"":al,unset:al,initial:da,inherit:rf},qp=function(t){return gA[t]||(gA[t]=new Ri(t)),gA[t]},af=new th(0,0,0,0,!0),Ic=new th(0,0,0,0),vA=Nn(function(r,t,e,n){return new th(r,t,e,n)},function(r,t,e,n){return"rgba(".concat(r,",").concat(t,",").concat(e,",").concat(n,")")}),Yn=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:fe.kNumber;return new _n(t,e)};new _n(50,"%");function $p(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 pA=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(Qt){throw new Error("".concat(t,": ").concat(Qt))}function n(){var Qt=i();return t.length>0&&e("Invalid input not EOF"),Qt}function i(){return x(a)}function a(){return s("linear-gradient",r.linearGradient,A)||s("repeating-linear-gradient",r.repeatingLinearGradient,A)||s("radial-gradient",r.radialGradient,u)||s("repeating-radial-gradient",r.repeatingRadialGradient,u)||s("conic-gradient",r.conicGradient,u)}function s(Qt,yt,xt){return o(yt,function(Dt){var Xt=xt();return Xt&&(mt(r.comma)||e("Missing comma before color stops")),{type:Qt,orientation:Xt,colorStops:x(F)}})}function o(Qt,yt){var xt=mt(Qt);if(xt){mt(r.startCall)||e("Missing (");var Dt=yt(xt);return mt(r.endCall)||e("Missing )"),Dt}}function A(){return l()||c()}function l(){return ft("directional",r.sideOrCorner,1)}function c(){return ft("angular",r.angleValue,1)}function u(){var Qt,yt=h(),xt;return yt&&(Qt=[],Qt.push(yt),xt=t,mt(r.comma)&&(yt=h(),yt?Qt.push(yt):t=xt)),Qt}function h(){var Qt=d()||f();if(Qt)Qt.at=v();else{var yt=g();if(yt){Qt=yt;var xt=v();xt&&(Qt.at=xt)}else{var Dt=p();Dt&&(Qt={type:"default-radial",at:Dt})}}return Qt}function d(){var Qt=ft("shape",/^(circle)/i,0);return Qt&&(Qt.style=dt()||g()),Qt}function f(){var Qt=ft("shape",/^(ellipse)/i,0);return Qt&&(Qt.style=et()||g()),Qt}function g(){return ft("extent-keyword",r.extentKeywords,1)}function v(){if(ft("position",/^at/,0)){var Qt=p();return Qt||e("Missing positioning value"),Qt}}function p(){var Qt=y();if(Qt.x||Qt.y)return{type:"position",value:Qt}}function y(){return{x:et(),y:et()}}function x(Qt){var yt=Qt(),xt=[];if(yt)for(xt.push(yt);mt(r.comma);)yt=Qt(),yt?xt.push(yt):e("One extra comma");return xt}function F(){var Qt=O();return Qt||e("Expected color definition"),Qt.length=et(),Qt}function O(){return U()||j()||R()||L()}function L(){return ft("literal",r.literalColor,0)}function U(){return ft("hex",r.hexColor,1)}function R(){return o(r.rgbColor,function(){return{type:"rgb",value:x(q)}})}function j(){return o(r.rgbaColor,function(){return{type:"rgba",value:x(q)}})}function q(){return mt(r.number)[1]}function et(){return ft("%",r.percentageValue,1)||it()||dt()}function it(){return ft("position-keyword",r.positionKeywords,1)}function dt(){return ft("px",r.pixelValue,1)||ft("em",r.emValue,1)}function ft(Qt,yt,xt){var Dt=mt(yt);if(Dt)return{type:Qt,value:Dt[xt]}}function mt(Qt){var yt=/^[\n\r\t\s]+/.exec(t);yt&&Rt(yt[0].length);var xt=Qt.exec(t);return xt&&Rt(xt[0].length),xt}function Rt(Qt){t=t.substring(Qt)}return function(Qt){return t=Qt,n()}}();function tm(r,t,e,n){var i=Un(n.value),a=0,s=0,o=a+t/2,A=s+e/2,l=Math.abs(t*Math.cos(i))+Math.abs(e*Math.sin(i)),c=r[0]+o-Math.cos(i)*l/2,u=r[1]+A-Math.sin(i)*l/2,h=r[0]+o+Math.cos(i)*l/2,d=r[1]+A+Math.sin(i)*l/2;return{x1:c,y1:u,x2:h,y2:d}}function em(r,t,e,n,i,a){var s=n.value,o=i.value;n.unit===fe.kPercentage&&(s=n.value/100*t),i.unit===fe.kPercentage&&(o=i.value/100*e);var A=Math.max(ki([0,0],[s,o]),ki([0,e],[s,o]),ki([t,e],[s,o]),ki([t,0],[s,o]));return a&&(a instanceof _n?A=a.value:a instanceof Ri&&(a.value==="closest-side"?A=Math.min(s,t-s,o,e-o):a.value==="farthest-side"?A=Math.max(s,t-s,o,e-o):a.value==="closest-corner"&&(A=Math.min(ki([0,0],[s,o]),ki([0,e],[s,o]),ki([t,e],[s,o]),ki([t,0],[s,o]))))),{x:s+r[0],y:o+r[1],r:A}}var sf=/^l\s*\(\s*([\d.]+)\s*\)\s*(.*)/i,nm=/^r\s*\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)\s*\)\s*(.*)/i,of=/^p\s*\(\s*([axyn])\s*\)\s*(.*)/i,Af=/[\d.]+:(#[^\s]+|[^\)]+\))/gi;function rm(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=pA(r);return t.map(function(o){var A=o.type,l=o.orientation,c=o.colorStops;rm(c);var u=c.map(function(x){return{offset:Yn(Number(x.length.value),"%"),color:$p(x)}});if(A==="linear-gradient")return new il(ws.LinearGradient,{angle:l?am(l):Co,steps:u});if(A==="radial-gradient"&&(l||(l=[{type:"shape",value:"circle"}]),l[0].type==="shape"&&l[0].value==="circle")){var h=sm(l[0].at),d=h.cx,f=h.cy,g;if(l[0].style){var v=l[0].style,p=v.type,y=v.value;p==="extent-keyword"?g=qp(y):g=Yn(y,p)}return new il(ws.RadialGradient,{cx:d,cy:f,size:g,steps:u})}})}var e=r[0];if(r[1]==="("||r[2]==="("){if(e==="l"){var n=sf.exec(r);if(n){var i,a=((i=n[2].match(Af))===null||i===void 0?void 0:i.map(function(o){return o.split(":")}))||[];return[new il(ws.LinearGradient,{angle:Yn(parseFloat(n[1]),"deg"),steps:a.map(function(o){var A=(0,H.Z)(o,2),l=A[0],c=A[1];return{offset:Yn(Number(l)*100,"%"),color:c}})})]}}else if(e==="r"){var s=Am(r);if(s)if(gn(s))r=s;else return[new il(ws.RadialGradient,s)]}else if(e==="p")return lm(r)}});function Am(r){var t=nm.exec(r);if(t){var e,n=((e=t[4].match(Af))===null||e===void 0?void 0:e.map(function(i){return i.split(":")}))||[];return{cx:Yn(50,"%"),cy:Yn(50,"%"),steps:n.map(function(i){var a=(0,H.Z)(i,2),s=a[0],o=a[1];return{offset:Yn(Number(s)*100,"%"),color:o}})}}return null}function lm(r){var t=of.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 EE(r){return!!r.type&&!!r.value}function So(r){return r&&!!r.image}function Nc(r){return r&&!Re(r.r)&&!Re(r.g)&&!Re(r.b)}var sl=Nn(function(r){if(So(r))return(0,z.Z)({repetition:"repeat"},r);if(Re(r)&&(r=""),r==="transparent")return Ic;if(r==="currentColor")r="black";else if(r==="none")return af;var t=om(r);if(t)return t;var e=Cc(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),vA.apply(void 0,n)});function cm(r,t){if(!(!Nc(r)||!Nc(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(dr(n[i],0,255));return n[3]=dr(n[3],0,1),"rgba(".concat(n.join(","),")")}]}function ol(r,t){if(Re(t))return Yn(0,"px");if(t="".concat(t).trim().toLowerCase(),isFinite(Number(t))){if("px".search(r)>=0)return Yn(Number(t),"px");if("deg".search(r)>=0)return Yn(Number(t),"deg")}var e=[];t=t.replace(r,function(i){return e.push(i),"U".concat(i)});var n="U(".concat(r.source,")");return e.map(function(i){return Yn(Number(t.replace(new RegExp("U".concat(i),"g"),"").replace(new RegExp(n,"g"),"*0")),i)})[0]}var E=function(t){return ol(new RegExp("px","g"),t)},m=Nn(E),b=function(t){return ol(new RegExp("%","g"),t)};Nn(b);var B=function(t){return ye(t)||isFinite(Number(t))?Yn(Number(t)||0,"px"):ol(new RegExp("px|%|em|rem","g"),t)},Q=Nn(B),V=function(t){return ol(new RegExp("deg|rad|grad|turn","g"),t)},tt=Nn(V);function lt(r,t,e,n){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a="",s=r.value||0,o=t.value||0,A=$u(r.unit),l=r.convertTo(A),c=t.convertTo(A);return l&&c?(s=l.value,o=c.value,a=qu(r.unit)):(_n.isLength(r.unit)||_n.isLength(t.unit))&&(s=St(r,i,e),o=St(t,i,e),a="px"),[s,o,function(u){return n&&(u=Math.max(u,0)),u+a}]}function at(r){var t=0;return r.unit===fe.kDegrees?t=r.value:r.unit===fe.kRadians?t=bi(Number(r.value)):r.unit===fe.kTurns?t=Vd(Number(r.value)):r.value&&(t=r.value),t}function bt(r,t){var e;return Array.isArray(r)?e=r.map(function(n){return Number(n)}):gn(r)?e=r.split(" ").map(function(n){return Number(n)}):ye(r)&&(e=[r]),t===2?e.length===1?[e[0],e[0]]:[e[0],e[1]]:t===4?e.length===1?[e[0],e[0],e[0],e[0]]:e.length===2?[e[0],e[1],e[0],e[1]]:e.length===3?[e[0],e[1],e[2],e[1]]:[e[0],e[1],e[2],e[3]]:t==="even"&&e.length%2===1?[].concat((0,G.Z)(e),(0,G.Z)(e)):e}function St(r,t,e){var n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(r.unit===fe.kPixels)return Number(r.value);if(r.unit===fe.kPercentage&&e){var i=e.nodeName===Kt.GROUP?e.getLocalBounds():e.getGeometryBounds();return(n?i.min[t]:0)+r.value/100*i.halfExtents[t]*2}return 0}var Ut=function(t){return ol(/deg|rad|grad|turn|px|%/g,t)},Jt=["blur","brightness","drop-shadow","contrast","grayscale","sepia","saturate","hue-rotate","invert"];function Te(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"";if(r=r.toLowerCase().trim(),r==="none")return[];for(var t=/\s*([\w-]+)\(([^)]*)\)/g,e=[],n,i=0;n=t.exec(r);){if(n.index!==i)return[];if(i=n.index+n[0].length,Jt.indexOf(n[1])>-1&&e.push({name:n[1],params:n[2].split(" ").map(function(a){return Ut(a)||sl(a)})}),t.lastIndex===r.length)return e}return[]}function he(r){return r.toString()}var Be=function(t){return typeof t=="number"?Yn(t):/^\s*[-+]?(\d*\.)?\d+\s*$/.test(t)?Yn(Number(t)):Yn(0)},rn=Nn(Be);Nn(function(r){return gn(r)?r.split(" ").map(rn):r.map(rn)});function Ue(r,t){return[r,t,he]}function Le(r,t){return function(e,n){return[e,n,function(i){return he(dr(i,r,t))}]}}function Mn(r,t){if(r.length===t.length)return[r,t,function(e){return e}]}function An(r){return r.parsedStyle.d.totalLength===0&&(r.parsedStyle.d.totalLength=np(r.parsedStyle.d.absolutePath)),r.parsedStyle.d.totalLength}function Ye(r){return r.parsedStyle.points.totalLength===0&&(r.parsedStyle.points.totalLength=Hu(r.parsedStyle.points.points)),r.parsedStyle.points.totalLength}function Fe(r){for(var t=0;t0&&e.push(n),{polygons:t,polylines:e}}function We(r,t){return r[0]===t[0]&&r[1]===t[1]}function Or(r,t){for(var e=[],n=[],i=[],a=0;aMath.PI/2?Math.PI-l:l,c=c>Math.PI/2?Math.PI-c:c;var u={xExtra:Math.cos(A/2-l)*(t/2*(1/Math.sin(A/2)))-t/2||0,yExtra:Math.cos(c-A/2)*(t/2*(1/Math.sin(A/2)))-t/2||0};return u}function Di(r,t){return[t[0]+(t[0]-r[0]),t[1]+(t[1]-r[1])]}var zn=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},Vr=function(t,e,n,i,a,s,o,A){e=Math.abs(e),n=Math.abs(n),i=Ed(i,360);var l=Un(i);if(t.x===o.x&&t.y===o.y)return{x:t.x,y:t.y,ellipticalArcAngle:0};if(e===0||n===0)return{x:0,y:0,ellipticalArcAngle:0};var c=(t.x-o.x)/2,u=(t.y-o.y)/2,h={x:Math.cos(l)*c+Math.sin(l)*u,y:-Math.sin(l)*c+Math.cos(l)*u},d=Math.pow(h.x,2)/Math.pow(e,2)+Math.pow(h.y,2)/Math.pow(n,2);d>1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var f=Math.pow(e,2)*Math.pow(n,2)-Math.pow(e,2)*Math.pow(h.y,2)-Math.pow(n,2)*Math.pow(h.x,2),g=Math.pow(e,2)*Math.pow(h.y,2)+Math.pow(n,2)*Math.pow(h.x,2),v=f/g;v=v<0?0:v;var p=(a!==s?1:-1)*Math.sqrt(v),y={x:p*(e*h.y/n),y:p*(-(n*h.x)/e)},x={x:Math.cos(l)*y.x-Math.sin(l)*y.y+(t.x+o.x)/2,y:Math.sin(l)*y.x+Math.cos(l)*y.y+(t.y+o.y)/2},F={x:(h.x-y.x)/e,y:(h.y-y.y)/n},O=zn({x:1,y:0},F),L={x:(-h.x-y.x)/e,y:(-h.y-y.y)/n},U=zn(F,L);!s&&U>0?U-=2*Math.PI:s&&U<0&&(U+=2*Math.PI),U%=2*Math.PI;var R=O+U*A,j=e*Math.cos(R),q=n*Math.sin(R),et={x:Math.cos(l)*j-Math.sin(l)*q+x.x,y:Math.sin(l)*j+Math.cos(l)*q+x.y,ellipticalArcStartAngle:O,ellipticalArcEndAngle:O+U,ellipticalArcAngle:R,ellipticalArcCenter:x,resultantRx:e,resultantRy:n};return et};function Xs(r){for(var t=[],e=null,n=null,i=null,a=0,s=r.length,o=0;o2&&arguments[2]!==void 0?arguments[2]:!0,n=r.arcParams,i=n.rx,a=i===void 0?0:i,s=n.ry,o=s===void 0?0:s,A=n.xRotation,l=n.arcFlag,c=n.sweepFlag,u=Vr({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},t),h=Vr({x:r.prePoint[0],y:r.prePoint[1]},a,o,A,!!l,!!c,{x:r.currentPoint[0],y:r.currentPoint[1]},e?t+.005:t-.005),d=h.x-u.x,f=h.y-u.y,g=Math.sqrt(d*d+f*f);return{x:-d/g,y:-f/g}}function oi(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Es(r,t){return oi(r)*oi(t)?(r[0]*t[0]+r[1]*t[1])/(oi(r)*oi(t)):1}function Na(r,t){return(r[0]*t[1]1&&(e*=Math.sqrt(d),n*=Math.sqrt(d));var f=e*e*(h*h)+n*n*(u*u),g=f?Math.sqrt((e*e*(n*n)-f)/f):1;a===s&&(g*=-1),isNaN(g)&&(g=0);var v=n?g*e*h/n:0,p=e?g*-n*u/e:0,y=(o+l)/2+Math.cos(i)*v-Math.sin(i)*p,x=(A+c)/2+Math.sin(i)*v+Math.cos(i)*p,F=[(u-v)/e,(h-p)/n],O=[(-1*u-v)/e,(-1*h-p)/n],L=Na([1,0],F),U=Na(F,O);return Es(F,O)<=-1&&(U=Math.PI),Es(F,O)>=1&&(U=0),s===0&&U>0&&(U-=2*Math.PI),s===1&&U<0&&(U+=2*Math.PI),{cx:y,cy:x,rx:We(r,[l,c])?0:e,ry:We(r,[l,c])?0:n,startAngle:L,endAngle:L+U,xRotation:i,arcFlag:a,sweepFlag:s}}function Mo(r,t,e){return r.reduce(function(n,i){var a="";if(i[0]==="M"||i[0]==="L"){var s=vec3.fromValues(i[1],i[2],0);e&&vec3.transformMat4(s,s,e),a="".concat(i[0]).concat(s[0],",").concat(s[1])}else if(i[0]==="Z")a=i[0];else if(i[0]==="C"){var o=vec3.fromValues(i[1],i[2],0),A=vec3.fromValues(i[3],i[4],0),l=vec3.fromValues(i[5],i[6],0);e&&(vec3.transformMat4(o,o,e),vec3.transformMat4(A,A,e),vec3.transformMat4(l,l,e)),a="".concat(i[0]).concat(o[0],",").concat(o[1],",").concat(A[0],",").concat(A[1],",").concat(l[0],",").concat(l[1])}else if(i[0]==="A"){var c=vec3.fromValues(i[6],i[7],0);e&&vec3.transformMat4(c,c,e),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],",").concat(i[5],",").concat(c[0],",").concat(c[1])}else if(i[0]==="Q"){var u=vec3.fromValues(i[1],i[2],0),h=vec3.fromValues(i[3],i[4],0);e&&(vec3.transformMat4(u,u,e),vec3.transformMat4(h,h,e)),a="".concat(i[0]).concat(i[1],",").concat(i[2],",").concat(i[3],",").concat(i[4],"}")}return n+=a},"")}function Fo(r,t,e,n){return[["M",r,t],["L",e,n]]}function $a(r,t,e,n){var i=(-1+Math.sqrt(2))/3*4,a=r*i,s=t*i,o=e-r,A=e+r,l=n-t,c=n+t;return[["M",o,n],["C",o,n-s,e-a,l,e,l],["C",e+a,l,A,n-s,A,n],["C",A,n+s,e+a,c,e,c],["C",e-a,c,o,n+s,o,n],["Z"]]}function To(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 Bs(r,t,e,n,i){if(i){var a=_slicedToArray(i,4),s=a[0],o=a[1],A=a[2],l=a[3],c=r>0?1:-1,u=t>0?1:-1,h=c+u!==0?1:0;return[["M",c*s+e,n],["L",r-c*o+e,n],o?["A",o,o,0,0,h,r+e,u*o+n]:null,["L",r+e,t-u*A+n],A?["A",A,A,0,0,h,r+e-c*A,t+n]:null,["L",e+c*l,t+n],l?["A",l,l,0,0,h,e,t+n-u*l]:null,["L",e,u*s+n],s?["A",s,s,0,0,h,c*s+e,n]:null,["Z"]].filter(function(d){return d})}return[["M",e,n],["L",e+r,n],["L",e+r,n+t],["L",e,n+t],["Z"]]}function Al(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:r.getLocalTransform(),e=[];switch(r.nodeName){case Kt.LINE:var n=r.parsedStyle,i=n.x1,a=i===void 0?0:i,s=n.y1,o=s===void 0?0:s,A=n.x2,l=A===void 0?0:A,c=n.y2,u=c===void 0?0:c;e=Fo(a,o,l,u);break;case Kt.CIRCLE:{var h=r.parsedStyle,d=h.r,f=d===void 0?0:d,g=h.cx,v=g===void 0?0:g,p=h.cy,y=p===void 0?0:p;e=$a(f,f,v,y);break}case Kt.ELLIPSE:{var x=r.parsedStyle,F=x.rx,O=F===void 0?0:F,L=x.ry,U=L===void 0?0:L,R=x.cx,j=R===void 0?0:R,q=x.cy,et=q===void 0?0:q;e=$a(O,U,j,et);break}case Kt.POLYLINE:case Kt.POLYGON:var it=r.parsedStyle.points;e=To(it.points,r.nodeName===Kt.POLYGON);break;case Kt.RECT:var dt=r.parsedStyle,ft=dt.width,mt=ft===void 0?0:ft,Rt=dt.height,Qt=Rt===void 0?0:Rt,yt=dt.x,xt=yt===void 0?0:yt,Dt=dt.y,Xt=Dt===void 0?0:Dt,ne=dt.radius,le=ne&&ne.some(function(xe){return xe!==0});e=Bs(mt,Qt,xt,Xt,le&&ne.map(function(xe){return clamp(xe,0,Math.min(Math.abs(mt)/2,Math.abs(Qt)/2))}));break;case Kt.PATH:var ge=r.parsedStyle.d.absolutePath;e=_toConsumableArray(ge);break}if(e.length)return Mo(e,r,t)}function Lc(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,n=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,a=r.map(function(s,o){var A=s[0],l=r[o+1],c=o===0&&(t!==0||e!==0),u=(o===r.length-1||l&&(l[0]==="M"||l[0]==="Z"))&&n!==0&&i!==0,h=c?[t,e]:[0,0],d=_slicedToArray(h,2),f=d[0],g=d[1],v=u?[n,i]:[0,0],p=_slicedToArray(v,2),y=p[0],x=p[1];switch(A){case"M":return"M ".concat(s[1]+f,",").concat(s[2]+g);case"L":return"L ".concat(s[1]+y,",").concat(s[2]+x);case"Q":return"Q ".concat(s[1]," ").concat(s[2],",").concat(s[3]+y," ").concat(s[4]+x);case"C":return"C ".concat(s[1]," ").concat(s[2],",").concat(s[3]," ").concat(s[4],",").concat(s[5]+y," ").concat(s[6]+x);case"A":return"A ".concat(s[1]," ").concat(s[2]," ").concat(s[3]," ").concat(s[4]," ").concat(s[5]," ").concat(s[6]," ").concat(s[7]).concat(u?" L ".concat(s[6]+n,",").concat(s[7]+i):"");case"Z":return"Z";default:return null}}).filter(function(s){return s!==null}).join(" ");return~a.indexOf("NaN")?"":a}var BE=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=rc(t)}catch(d){e=rc(""),console.error("[g]: Invalid SVG Path definition: ".concat(t))}Fe(e);var n=bn(e),i=xn(e),a=i.polygons,s=i.polylines,o=Xs(e),A=Or(o,0),l=A.x,c=A.y,u=A.width,h=A.height;return{absolutePath:e,hasArc:n,segments:o,polygons:a,polylines:s,totalLength:0,rect:{x:Number.isFinite(l)?l:0,y:Number.isFinite(c)?c:0,width:Number.isFinite(u)?u:0,height:Number.isFinite(h)?h:0}}},DM=Nn(BE);function bE(r){return gn(r)?DM(r):BE(r)}function PM(r,t,e){var n=r.curve,i=t.curve;(!n||n.length===0)&&(n=Iu(r.absolutePath,!1),r.curve=n),(!i||i.length===0)&&(i=Iu(t.absolutePath,!1),t.curve=i);var a=[n,i];n.length!==i.length&&(a=xd(n,i));var s=Cd(a[0])!==Cd(a[1])?cp(a[0]):up(a[0]);return[s,Sd(a[1],s),function(o){return o}]}function _M(r,t){var e;return gn(r)?e=r.split(" ").map(function(n){var i=n.split(","),a=(0,H.Z)(i,2),s=a[0],o=a[1];return[Number(s),Number(o)]}):e=r,{points:e,totalLength:0,segments:[]}}function HM(r,t){return[r.points,t.points,function(e){return e}]}var Cr=null,kc=/\s*(\w+)\(([^)]*)\)/g;function fa(r){return function(t){var e=0;return r.map(function(n){return n===Cr?t[e++]:n})}}function ll(r){return r}var eh={matrix:["NNNNNN",[Cr,Cr,0,0,Cr,Cr,0,0,0,0,1,0,Cr,Cr,0,1],ll],matrix3d:["NNNNNNNNNNNNNNNN",ll],rotate:["A"],rotateX:["A"],rotateY:["A"],rotateZ:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",fa([Cr,Cr,new _n(1)]),ll],scaleX:["N",fa([Cr,new _n(1),new _n(1)]),fa([Cr,new _n(1)])],scaleY:["N",fa([new _n(1),Cr,new _n(1)]),fa([new _n(1),Cr])],scaleZ:["N",fa([new _n(1),new _n(1),Cr])],scale3d:["NNN",ll],skew:["Aa",null,ll],skewX:["A",null,fa([Cr,Co])],skewY:["A",null,fa([Co,Cr])],translate:["Tt",fa([Cr,Cr,Ia]),ll],translateX:["T",fa([Cr,Ia,Ia]),fa([Cr,Ia])],translateY:["T",fa([Ia,Cr,Ia]),fa([Ia,Cr])],translateZ:["L",fa([Ia,Ia,Cr])],translate3d:["TTL",ll]};function xE(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;eF(e,n);var o=!!i.forceUpdateGeometry;if(!o){for(var A in n)if($M.has(A)){o=!0;break}}var l=TE(e);l.has("fill")&&n.fill&&(e.parsedStyle.fill=sl(n.fill)),l.has("stroke")&&n.stroke&&(e.parsedStyle.stroke=sl(n.stroke)),l.has("shadowColor")&&n.shadowColor&&(e.parsedStyle.shadowColor=sl(n.shadowColor)),l.has("filter")&&n.filter&&(e.parsedStyle.filter=Te(n.filter)),l.has("radius")&&!Re(n.radius)&&(e.parsedStyle.radius=bt(n.radius,4)),l.has("lineDash")&&!Re(n.lineDash)&&(e.parsedStyle.lineDash=bt(n.lineDash,"even")),l.has("points")&&n.points&&(e.parsedStyle.points=_M(n.points)),l.has("d")&&n.d===""&&(e.parsedStyle.d=(0,z.Z)({},vs)),l.has("d")&&n.d&&(e.parsedStyle.d=bE(n.d)),l.has("textTransform")&&n.textTransform&&this.runtime.CSSPropertySyntaxFactory[oe.TEXT_TRANSFORM].calculator(null,null,{value:n.textTransform},e,null),l.has("clipPath")&&!Ze(n.clipPath)&&this.runtime.CSSPropertySyntaxFactory[oe.DEFINED_PATH].calculator("clipPath",a,n.clipPath,e,this.runtime),l.has("offsetPath")&&n.offsetPath&&this.runtime.CSSPropertySyntaxFactory[oe.DEFINED_PATH].calculator("offsetPath",s,n.offsetPath,e,this.runtime),l.has("transform")&&n.transform&&(e.parsedStyle.transform=CE(n.transform)),l.has("transformOrigin")&&n.transformOrigin&&(e.parsedStyle.transformOrigin=qM(n.transformOrigin)),l.has("markerStart")&&n.markerStart&&(e.parsedStyle.markerStart=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator(null,n.markerStart,n.markerStart,null,null)),l.has("markerEnd")&&n.markerEnd&&(e.parsedStyle.markerEnd=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator(null,n.markerEnd,n.markerEnd,null,null)),l.has("markerMid")&&n.markerMid&&(e.parsedStyle.markerMid=this.runtime.CSSPropertySyntaxFactory[oe.MARKER].calculator("",n.markerMid,n.markerMid,null,null)),l.has("zIndex")&&!Re(n.zIndex)&&this.runtime.CSSPropertySyntaxFactory[oe.Z_INDEX].postProcessor(e),l.has("offsetDistance")&&!Re(n.offsetDistance)&&this.runtime.CSSPropertySyntaxFactory[oe.OFFSET_DISTANCE].postProcessor(e),l.has("transform")&&n.transform&&this.runtime.CSSPropertySyntaxFactory[oe.TRANSFORM].postProcessor(e),l.has("transformOrigin")&&n.transformOrigin&&this.runtime.CSSPropertySyntaxFactory[oe.TRANSFORM_ORIGIN].postProcessor(e),o&&(e.dirty(!0,!0),i.forceUpdateGeometry||this.runtime.sceneGraphService.dirtyToRoot(e))}},{key:"updateGeometry",value:function(e){var n=e.nodeName,i=this.runtime.geometryUpdaterFactory[n];if(i){var a=e.geometry;a.contentBounds||(a.contentBounds=new Zn),a.renderBounds||(a.renderBounds=new Zn);var s=e.parsedStyle,o=i.update(s,e),A=o.cx,l=A===void 0?0:A,c=o.cy,u=c===void 0?0:c,h=o.cz,d=h===void 0?0:h,f=o.hwidth,g=f===void 0?0:f,v=o.hheight,p=v===void 0?0:v,y=o.hdepth,x=y===void 0?0:y,F=[Math.abs(g),Math.abs(p),x],O=s.stroke,L=s.lineWidth,U=L===void 0?1:L,R=s.increasedLineWidthForHitTesting,j=R===void 0?0:R,q=s.shadowType,et=q===void 0?"outer":q,it=s.shadowColor,dt=s.filter,ft=dt===void 0?[]:dt,mt=s.transformOrigin,Rt=[l,u,d];a.contentBounds.update(Rt,F);var Qt=n===Kt.POLYLINE||n===Kt.POLYGON||n===Kt.PATH?Math.SQRT2:.5,yt=O&&!O.isNone;if(yt){var xt=((U||0)+(j||0))*Qt;F[0]+=xt,F[1]+=xt}if(a.renderBounds.update(Rt,F),it&&et&&et!=="inner"){var Dt=a.renderBounds,Xt=Dt.min,ne=Dt.max,le=s.shadowBlur,ge=s.shadowOffsetX,xe=s.shadowOffsetY,Qe=le||0,Pe=ge||0,en=xe||0,mn=Xt[0]-Qe+Pe,an=ne[0]+Qe+Pe,er=Xt[1]-Qe+en,kn=ne[1]+Qe+en;Xt[0]=Math.min(Xt[0],mn),ne[0]=Math.max(ne[0],an),Xt[1]=Math.min(Xt[1],er),ne[1]=Math.max(ne[1],kn),a.renderBounds.setMinMax(Xt,ne)}ft.forEach(function(Bn){var Us=Bn.name,hi=Bn.params;if(Us==="blur"){var Vi=hi[0].value;a.renderBounds.update(a.renderBounds.center,de(a.renderBounds.halfExtents,a.renderBounds.halfExtents,[Vi,Vi,0]))}else if(Us==="drop-shadow"){var cn=hi[0].value,Fn=hi[1].value,hn=hi[2].value,Sn=a.renderBounds,Rn=Sn.min,ke=Sn.max,Tn=Rn[0]-hn+cn,En=ke[0]+hn+cn,ur=Rn[1]-hn+Fn,qe=ke[1]+hn+Fn;Rn[0]=Math.min(Rn[0],Tn),ke[0]=Math.max(ke[0],En),Rn[1]=Math.min(Rn[1],ur),ke[1]=Math.max(ke[1],qe),a.renderBounds.setMinMax(Rn,ke)}}),e.geometry.dirty=!1;var Cn=g<0,vr=p<0,wa=(Cn?-1:1)*(mt?St(mt[0],0,e,!0):0),Hn=(vr?-1:1)*(mt?St(mt[1],1,e,!0):0);(wa||Hn)&&e.setOrigin(wa,Hn)}}},{key:"updateSizeAttenuation",value:function(e,n){e.style.isSizeAttenuation?(e.style.rawLineWidth||(e.style.rawLineWidth=e.style.lineWidth),e.style.lineWidth=(e.style.rawLineWidth||1)/n,e.nodeName===Kt.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===Kt.CIRCLE&&e.style.rawR&&(e.style.r=e.style.rawR,delete e.style.rawR))}}])}();function eF(r,t){var e=TE(r);for(var n in t)e.has(n)&&(r.parsedStyle[n]=t[n])}function TE(r){return r.constructor.PARSED_STYLE_LIST}var nF=function(){function r(){(0,P.Z)(this,r),this.mixer=Ue}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i,a){return at(i)}}])}(),rF=function(){function r(){(0,P.Z)(this,r)}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){return i instanceof Ri&&(i=null),s.sceneGraphService.updateDisplayObjectDependency(e,n,i,a),e==="clipPath"&&a.forEach(function(o){o.childNodes.length===0&&s.sceneGraphService.dirtyToRoot(o)}),i}}])}(),iF=function(){function r(){(0,P.Z)(this,r),this.parser=sl,this.mixer=cm}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i,a){return i instanceof Ri?i.value==="none"?af:Ic:i}}])}(),aF=function(){function r(){(0,P.Z)(this,r)}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof Ri?[]:i}}])}();function OE(r){var t=r.parsedStyle,e=t.fontSize;return Re(e)?null:e}var gm=function(){function r(){(0,P.Z)(this,r),this.mixer=Ue}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i,a,s){if(ye(i))return i;if(_n.isRelativeUnit(i.unit)){if(i.unit===fe.kPercentage)return 0;if(i.unit===fe.kEms){if(a.parentNode){var o=OE(a.parentNode);if(o)return o*=i.value,o}return 0}if(i.unit===fe.kRems){var A;if(a!=null&&(A=a.ownerDocument)!==null&&A!==void 0&&A.documentElement){var l=OE(a.ownerDocument.documentElement);if(l)return l*=i.value,l}return 0}}else return i.value}}])}(),sF=function(){function r(){(0,P.Z)(this,r),this.mixer=Mn}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),oF=function(){function r(){(0,P.Z)(this,r),this.mixer=Mn}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i.map(function(a){return a.value})}}])}(),AF=function(){function r(){(0,P.Z)(this,r)}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i,a){var s;i instanceof Ri&&(i=null);var o=(s=i)===null||s===void 0?void 0:s.cloneNode(!0);return o&&(o.style.isMarker=!0),o}}])}(),lF=function(){function r(){(0,P.Z)(this,r),this.mixer=Ue}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),cF=function(){function r(){(0,P.Z)(this,r),this.mixer=Le(0,1)}return(0,N.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===Kt.LINE||s===Kt.PATH||s===Kt.POLYLINE){var o=i.getPoint(a);o&&e.setLocalPosition(o.x,o.y)}}}}])}(),uF=function(){function r(){(0,P.Z)(this,r),this.mixer=Le(0,1)}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i.value}}])}(),hF=function(){function r(){(0,P.Z)(this,r),this.parser=bE,this.mixer=PM}return(0,N.Z)(r,[{key:"calculator",value:function(e,n,i){return i instanceof Ri&&i.value==="unset"?{absolutePath:[],hasArc:!1,segments:[],polygons:[],polylines:[],curve:null,totalLength:0,rect:new fs(0,0,0,0)}:i}}])}(),dF=(0,N.Z)(function r(){(0,P.Z)(this,r),this.mixer=HM}),fF=function(r){function t(){var e;(0,P.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a>>1;IE(r[i],t)<0?e=i+1:n=i}return e}function IE(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 NE(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 LE="px";function wF(r,t,e){pm&&r.style&&(r.style.width=t+LE,r.style.height=e+LE)}function kE(r,t){if(pm)return document.defaultView.getComputedStyle(r,null).getPropertyValue(t)}function EF(r){var t=kE(r,"width");return t==="auto"?r.offsetWidth:parseFloat(t)}function BF(r){var t=kE(r,"height");return t==="auto"?r.offsetHeight:parseFloat(t)}var bF=1,xF={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},mm=typeof performance=="object"&&performance.now?performance:Date;function lf(r){return r.nodeName===Kt.FRAGMENT?!0:r.getRootNode().nodeName===Kt.FRAGMENT}function cl(){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 CF=1,SF=function(){return CF++},qs=typeof self=="object"&&self.self===self?self:typeof T.g=="object"&&T.g.global===T.g?T.g:{},MF=Date.now(),FF=function(){return qs.performance&&typeof qs.performance.now=="function"?qs.performance.now():Date.now()-MF},nh={},QE=Date.now(),TF=function(t){if(typeof t!="function")throw new TypeError("".concat(t," is not a function"));var e=Date.now(),n=e-QE,i=n>16?0:16-n,a=SF();return nh[a]=t,Object.keys(nh).length>1||setTimeout(function(){QE=e;var s=nh;nh={},Object.keys(s).forEach(function(o){return s[o](FF())})},i),a},OF=function(t){delete nh[t]},IF=["","webkit","moz","ms","o"],UE=function(t){return typeof t!="string"?TF:t===""?qs.requestAnimationFrame:qs["".concat(t,"RequestAnimationFrame")]},NF=function(t){return typeof t!="string"?OF:t===""?qs.cancelAnimationFrame:qs["".concat(t,"CancelAnimationFrame")]||qs["".concat(t,"CancelRequestAnimationFrame")]},LF=function(t,e){for(var n=0;t[n]!==void 0;){if(e(t[n]))return t[n];n+=1}},RE=LF(IF,function(r){return!!UE(r)}),ym=UE(RE),DE=NF(RE);qs.requestAnimationFrame=ym,qs.cancelAnimationFrame=DE;var kF=function(){function r(){(0,P.Z)(this,r),this.callbacks=[]}return(0,N.Z)(r,[{key:"getCallbacksNum",value:function(){return this.callbacks.length}},{key:"tapPromise",value:function(e,n){this.callbacks.push(n)}},{key:"promise",value:function(){for(var e=arguments.length,n=new Array(e),i=0;i=0;c--){var u=l[c].trim();!RF.test(u)&&UF.indexOf(u)<0&&(u='"'.concat(u,'"')),l[c]=u}return"".concat(a," ").concat(s," ").concat(o," ").concat(A," ").concat(l.join(","))},function(r){var t=PE(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)}),DF=1e-6,rh=function(t){return Math.max(t,DF)};function Em(r,t,e){return Ie(r),r[4]=Math.tan(t),r[1]=Math.tan(e),r}var Dr=$t(),PF=$t(),_F={scale:function(t){Dn(Dr,[t[0].value,t[1].value,1].map(function(e){return rh(e)}))},scaleX:function(t){Dn(Dr,[t[0].value,1,1].map(function(e){return rh(e)}))},scaleY:function(t){Dn(Dr,[1,t[0].value,1].map(function(e){return rh(e)}))},scaleZ:function(t){Dn(Dr,[1,1,t[0].value].map(function(e){return rh(e)}))},scale3d:function(t){Dn(Dr,[t[0].value,t[1].value,t[2].value].map(function(e){return rh(e)}))},translate:function(t){Tr(Dr,[t[0].value,t[1].value,0])},translateX:function(t){Tr(Dr,[t[0].value,0,0])},translateY:function(t){Tr(Dr,[0,t[0].value,0])},translateZ:function(t){Tr(Dr,[0,0,t[0].value])},translate3d:function(t){Tr(Dr,[t[0].value,t[1].value,t[2].value])},rotate:function(t){Er(Dr,Un(at(t[0])))},rotateX:function(t){$i(Dr,Un(at(t[0])))},rotateY:function(t){fn(Dr,Un(at(t[0])))},rotateZ:function(t){Er(Dr,Un(at(t[0])))},rotate3d:function(t){qi(Dr,Un(at(t[3])),[t[0].value,t[1].value,t[2].value])},skew:function(t){Em(Dr,Un(t[0].value),Un(t[1].value))},skewX:function(t){Em(Dr,Un(t[0].value),0)},skewY:function(t){Em(Dr,0,Un(t[0].value))},matrix:function(t){Wn(Dr,t[0].value,t[1].value,0,0,t[2].value,t[3].value,0,0,0,0,1,0,t[4].value,t[5].value,0,1)},matrix3d:function(t){Wn.apply(I,[Dr].concat((0,G.Z)(t.map(function(e){return e.value}))))}},HF=Wt(1,1,1),GF=Ot(),HE={translate:function(t,e){re.sceneGraphService.setLocalScale(t,HF,!1),re.sceneGraphService.setLocalEulerAngles(t,GF,void 0,void 0,!1),re.sceneGraphService.setLocalPosition(t,[e[0].value,e[1].value,0],!1),re.sceneGraphService.dirtyLocalTransform(t,t.transformable)}};function GE(r,t){if(r.length){if(r.length===1&&HE[r[0].t]){HE[r[0].t](t,r[0].d);return}for(var e=Ie(PF),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}}])}(),pr=function(r){function t(){var e;(0,P.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&arguments[0]!==void 0?arguments[0]:{};return this.parentNode?this.parentNode.getRootNode(n):n.composed&&this.host?this.host.getRootNode(n):this}},{key:"hasChildNodes",value:function(){return this.childNodes.length>0}},{key:"isDefaultNamespace",value:function(n){throw new Error(On)}},{key:"lookupNamespaceURI",value:function(n){throw new Error(On)}},{key:"lookupPrefix",value:function(n){throw new Error(On)}},{key:"normalize",value:function(){throw new Error(On)}},{key:"isEqualNode",value:function(n){return this===n}},{key:"isSameNode",value:function(n){return this.isEqualNode(n)}},{key:"parent",get:function(){return this.parentNode}},{key:"parentElement",get:function(){return null}},{key:"nextSibling",get:function(){return null}},{key:"previousSibling",get:function(){return null}},{key:"firstChild",get:function(){return this.childNodes.length>0?this.childNodes[0]:null}},{key:"lastChild",get:function(){return this.childNodes.length>0?this.childNodes[this.childNodes.length-1]:null}},{key:"compareDocumentPosition",value:function(n){if(n===this)return 0;for(var i=n,a=this,s=[i],o=[a];(A=i.parentNode)!==null&&A!==void 0?A:a.parentNode;){var A;i=i.parentNode?(s.push(i.parentNode),i.parentNode):i,a=a.parentNode?(o.push(a.parentNode),a.parentNode):a}if(i!==a)return t.DOCUMENT_POSITION_DISCONNECTED|t.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC|t.DOCUMENT_POSITION_PRECEDING;var l=s.length>o.length?s:o,c=l===s?o:s;if(l[l.length-c.length]===c[0])return l===s?t.DOCUMENT_POSITION_CONTAINED_BY|t.DOCUMENT_POSITION_FOLLOWING:t.DOCUMENT_POSITION_CONTAINS|t.DOCUMENT_POSITION_PRECEDING;for(var u=l.length-c.length,h=c.length-1;h>=0;h--){var d=c[h],f=l[u+h];if(f!==d){var g=d.parentNode.childNodes;return g.indexOf(d)0&&i;)i=i.parentNode,n--;return i}},{key:"forEach",value:function(n){for(var i=[this];i.length>0;){var a=i.pop(),s=n(a);if(s===!1)break;for(var o=a.childNodes.length-1;o>=0;o--)i.push(a.childNodes[o])}}}],[{key:"isNode",value:function(n){return!!n.childNodes}}])}(KE);pr.DOCUMENT_POSITION_DISCONNECTED=1,pr.DOCUMENT_POSITION_PRECEDING=2,pr.DOCUMENT_POSITION_FOLLOWING=4,pr.DOCUMENT_POSITION_CONTAINS=8,pr.DOCUMENT_POSITION_CONTAINED_BY=16,pr.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC=32;var eT=2048,nT=function(){function r(t,e){var n=this;(0,P.Z)(this,r),this.nativeHTMLMap=new WeakMap,this.cursor="default",this.mappingTable={},this.mappingState={trackingData:{}},this.eventPool=new Map,this.tmpMatrix=$t(),this.tmpVec3=Ot(),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=mm.now(),s=n.createPointerEvent(i,void 0,void 0,n.context.config.alwaysTriggerPointerEventOnCanvas?n.rootTarget:void 0);if(n.dispatchEvent(s,"pointerup"),s.pointerType==="touch")n.dispatchEvent(s,"touchend");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var o=s.button===2;n.dispatchEvent(s,o?"rightup":"mouseup")}var A=n.trackingData(i.pointerId),l=n.findMountedTarget(A.pressTargetsByButton[i.button]),c=l;if(l&&!s.composedPath().includes(l)){for(var u=l;u&&!s.composedPath().includes(u);){if(s.currentTarget=u,n.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch")n.notifyTarget(s,"touchendoutside");else if(s.pointerType==="mouse"||s.pointerType==="pen"){var h=s.button===2;n.notifyTarget(s,h?"rightupoutside":"mouseupoutside")}pr.isNode(u)&&(u=u.parentNode)}delete A.pressTargetsByButton[i.button],c=u}if(c){var d,f=n.clonePointerEvent(s,"click");f.target=c,f.path=[],A.clicksByButton[i.button]||(A.clicksByButton[i.button]={clickCount:0,target:f.target,timeStamp:a});var g=n.context.renderingContext.root.ownerDocument.defaultView,v=A.clicksByButton[i.button];v.target===f.target&&a-v.timeStamp=1;a--)if(e.currentTarget=i[a],this.notifyTarget(e,n),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,n),!(e.propagationStopped||e.propagationImmediatelyStopped)){var s=i.indexOf(e.currentTarget);e.eventPhase=e.BUBBLING_PHASE;for(var o=s+1;os||i>o?null:!A&&this.pickHandler(e)||this.rootTarget||null}},{key:"isNativeEventFromCanvas",value:function(e,n){var i,a=n==null?void 0:n.target;if((i=a)!==null&&i!==void 0&&i.shadowRoot&&(a=n.composedPath()[0]),a){if(a===e)return!0;if(e&&e.contains)return e.contains(a)}return n!=null&&n.composedPath?n.composedPath().indexOf(e)>-1:!1}},{key:"getExistedHTML",value:function(e){if(e.nativeEvent.composedPath)for(var n=0,i=e.nativeEvent.composedPath();n=0;i--){var a=e[i];if(a===this.rootTarget||pr.isNode(a)&&a.parentNode===n)n=e[i];else break}return n}},{key:"getCursor",value:function(e){for(var n=e;n;){var i=mF(n)&&n.getAttribute("cursor");if(i)return i;n=pr.isNode(n)&&n.parentNode}}}])}(),bm=function(){function r(){(0,P.Z)(this,r)}return(0,N.Z)(r,[{key:"getOrCreateCanvas",value:function(e,n){if(this.canvas)return this.canvas;if(e||re.offscreenCanvas)this.canvas=e||re.offscreenCanvas,this.context=this.canvas.getContext("2d",(0,z.Z)({willReadFrequently:!0},n));else try{this.canvas=new window.OffscreenCanvas(0,0),this.context=this.canvas.getContext("2d",(0,z.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,z.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}}])}(),Qc=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}({}),rT=function(){function r(t,e){(0,P.Z)(this,r),this.inited=!1,this.stats={total:0,rendered:0},this.zIndexCounter=0,this.hooks={init:new na,initAsync:new kF,dirtycheck:new wm,cull:new wm,beginFrame:new na,beforeRender:new na,render:new na,afterRender:new na,endFrame:new na,destroy:new na,pick:new QF,pickSync:new wm,pointerDown:new na,pointerUp:new na,pointerMove:new na,pointerOut:new na,pointerOver:new na,pointerWheel:new na,pointerCancel:new na,click:new na},this.globalRuntime=t,this.context=e}return(0,N.Z)(r,[{key:"init",value:function(e){var n=this,i=(0,z.Z)((0,z.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(Qc.CAMERA_CHANGED)}},{key:"render",value:function(e,n,i){var a=this,s=e.getConfig(),o=this.context.renderingContext;if(this.stats.total=0,this.stats.rendered=0,this.zIndexCounter=0,this.globalRuntime.sceneGraphService.syncHierarchy(o.root),this.globalRuntime.sceneGraphService.notifyMutationObservers(e),o.renderReasons.size&&this.inited){o.dirtyRectangleRenderingDisabled=this.disableDirtyRectangleRendering();var A=o.renderReasons.size===1&&o.renderReasons.has(Qc.CAMERA_CHANGED),l=!s.disableRenderHooks||!A;l&&this.renderDisplayObject(o.root,s,o),this.hooks.beginFrame.call(n),l&&o.renderListCurrentFrame.forEach(function(c){a.hooks.beforeRender.call(c),a.hooks.render.call(c),a.hooks.afterRender.call(c)}),this.hooks.endFrame.call(n),o.renderListCurrentFrame=[],o.renderReasons.clear(),i()}}},{key:"renderDisplayObject",value:function(e,n,i){var a=this,s=n.renderer.getConfig(),o=s.enableDirtyCheck,A=s.enableCulling;function l(g){var v=g.renderable,p=g.sortable,y=o?v.dirty||i.dirtyRectangleRenderingDisabled?g:null:g,x=null;y&&(x=A?a.hooks.cull.call(y,a.context.camera):y,x&&(a.stats.rendered+=1,i.renderListCurrentFrame.push(x))),g.dirty(!1),p.renderOrder=a.zIndexCounter,a.zIndexCounter+=1,a.stats.total+=1,p.dirty&&(a.sort(g,p),p.dirty=!1,p.dirtyChildren=[],p.dirtyReason=void 0)}for(var c=[e];c.length>0;){var u,h=c.pop();l(h);for(var d=((u=h.sortable)===null||u===void 0||(u=u.sorted)===null||u===void 0?void 0:u.length)>0?h.sortable.sorted:h.childNodes,f=d.length-1;f>=0;f--)c.push(d[f])}}},{key:"sort",value:function(e,n){var i,a;(n==null||(i=n.sorted)===null||i===void 0?void 0:i.length)>0&&n.dirtyReason!==bc.Z_INDEX_CHANGED?n.dirtyChildren.forEach(function(s){var o=n.sorted.indexOf(s);o>-1&&n.sorted.splice(o,1);var A=e.childNodes.indexOf(s);if(A>-1)if(n.sorted.length===0)n.sorted.push(s);else{var l=yF(n.sorted,s);n.sorted.splice(l,0,s)}}):n.sorted=e.childNodes.slice().sort(IE),((a=n.sorted)===null||a===void 0?void 0:a.length)>0&&e.childNodes.filter(function(s){return s.parsedStyle.zIndex}).length===0&&(n.sorted=[])}},{key:"destroy",value:function(){this.inited=!1,this.hooks.destroy.call()}},{key:"dirty",value:function(){this.context.renderingContext.renderReasons.add(Qc.DISPLAY_OBJECT_CHANGED)}}])}(),iT=/\[\s*(.*)=(.*)\s*\]/,aT=function(){function r(){(0,P.Z)(this,r)}return(0,N.Z)(r,[{key:"selectOne",value:function(e,n){var i=this;if(e.startsWith("."))return n.find(function(A){return((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.find(function(A){return A.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.find(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):null}return n.find(function(A){return n!==A&&A.nodeName===e})}},{key:"selectAll",value:function(e,n){var i=this;if(e.startsWith("."))return n.findAll(function(A){return n!==A&&((A==null?void 0:A.classList)||[]).indexOf(i.getIdOrClassname(e))>-1});if(e.startsWith("#"))return n.findAll(function(A){return n!==A&&A.id===i.getIdOrClassname(e)});if(e.startsWith("[")){var a=this.getAttribute(e),s=a.name,o=a.value;return s?n.findAll(function(A){return n!==A&&(s==="name"?A.name===o:i.attributeToString(A,s)===o)}):[]}return n.findAll(function(A){return n!==A&&A.nodeName===e})}},{key:"is",value:function(e,n){if(e.startsWith("."))return n.className===this.getIdOrClassname(e);if(e.startsWith("#"))return n.id===this.getIdOrClassname(e);if(e.startsWith("[")){var i=this.getAttribute(e),a=i.name,s=i.value;return a==="name"?n.name===s:this.attributeToString(n,a)===s}return n.nodeName===e}},{key:"getIdOrClassname",value:function(e){return e.substring(1)}},{key:"getAttribute",value:function(e){var n=e.match(iT),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 Re(i)?"":i.toString?i.toString():""}}])}(),yn=function(r){return r.ATTR_MODIFIED="DOMAttrModified",r.INSERTED="DOMNodeInserted",r.MOUNTED="DOMNodeInsertedIntoDocument",r.REMOVED="removed",r.UNMOUNTED="DOMNodeRemovedFromDocument",r.REPARENT="reparent",r.DESTROY="destroy",r.BOUNDS_CHANGED="bounds-changed",r.CULLED="culled",r}({}),$s=function(r){function t(e,n,i,a,s,o,A,l){var c;return(0,P.Z)(this,t),c=(0,K.Z)(this,t,[null]),c.relatedNode=n,c.prevValue=i,c.newValue=a,c.attrName=s,c.attrChange=o,c.prevParsedValue=A,c.newParsedValue=l,c.type=e,c}return(0,_.Z)(t,r),(0,N.Z)(t)}(cf);$s.ADDITION=2,$s.MODIFICATION=1,$s.REMOVAL=3;var sT=new $s(yn.REPARENT,null,"","","",0,"",""),oT=Bu(),hf=Ot(),AT=Wt(1,1,1),lT=$t(),cT=Bu(),ul=Ot(),uT=$t(),hl=Br(),hT=Ot(),dT=Br(),fT=Ot(),ih=Ot(),dl=Ot(),df=$t(),VE=Br(),WE=Br(),ff=Br(),gT=function(){function r(t){(0,P.Z)(this,r),this.displayObjectDependencyMap=new WeakMap,this.runtime=t}return(0,N.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===Kt.FRAGMENT,A=lf(n);e.parentNode=n;var l=o?e.childNodes:[e];ye(i)?l.forEach(function(g){n.childNodes.splice(i,0,g),g.parentNode=n}):l.forEach(function(g){n.childNodes.push(g),g.parentNode=n});var c=n,u=c.sortable;if((u!=null&&(a=u.sorted)!==null&&a!==void 0&&a.length||u.dirty||e.parsedStyle.zIndex)&&(u.dirtyChildren.indexOf(e)===-1&&u.dirtyChildren.push(e),u.dirty=!0,u.dirtyReason=bc.ADDED),!A){if(o)this.dirtyFragment(e);else{var h=e.transformable;h&&this.dirtyWorldTransform(e,h)}if(s){var d,f=((d=n.ownerDocument)===null||d===void 0||(d=d.defaultView)===null||d===void 0||(d=d.getConfig())===null||d===void 0||(d=d.future)===null||d===void 0?void 0:d.experimentalCancelEventPropagation)===!0;e.dispatchEvent(sT,f,f)}}}},{key:"detach",value:function(e){var n,i;if(e.parentNode){var a=e.transformable,s=e.parentNode,o=s.sortable;(o!=null&&(n=o.sorted)!==null&&n!==void 0&&n.length||(i=e.style)!==null&&i!==void 0&&i.zIndex)&&(o.dirtyChildren.indexOf(e)===-1&&o.dirtyChildren.push(e),o.dirty=!0,o.dirtyReason=bc.REMOVED);var A=e.parentNode.childNodes.indexOf(e);A>-1&&e.parentNode.childNodes.splice(A,1),a&&this.dirtyWorldTransform(e,a),e.parentNode=null}}},{key:"getLocalPosition",value:function(e){return e.transformable.localPosition}},{key:"getLocalRotation",value:function(e){return e.transformable.localRotation}},{key:"getLocalScale",value:function(e){return e.transformable.localScale}},{key:"getLocalSkew",value:function(e){return e.transformable.localSkew}},{key:"getLocalTransform",value:function(e){var n=e.transformable;return Zs(n),n.localTransform}},{key:"setLocalPosition",value:function(e,n){var i,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,s=e.transformable;ih[0]=n[0],ih[1]=n[1],ih[2]=(i=n[2])!==null&&i!==void 0?i:0,!Yi(s.localPosition,ih)&&(ie(s.localPosition,ih),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=Wt(n,i,a));var s=e.transformable;Yi(n,hf)||(zr(n,n,s.localRotation),de(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=XA(hl,n,i,a,s));var A=e.transformable;YA(A.localRotation,n),o&&this.dirtyLocalTransform(e,A)}},{key:"rotateLocal",value:function(e,n){var i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,a=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0;typeof n=="number"&&(n=Wt(n,i,a));var s=e.transformable;Gn(WE,n[0],n[1],n[2]),Eu(s.localRotation,s.localRotation,WE),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;ve(ul,n[0],n[1],(i=n[2])!==null&&i!==void 0?i:s.localScale[2]),!Yi(ul,s.localScale)&&(ie(s.localScale,ul),a&&this.dirtyLocalTransform(e,s))}},{key:"scaleLocal",value:function(e,n){var i,a=e.transformable;sn(a.localScale,a.localScale,ve(ul,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=Ov(cT,n,i));var s=e.transformable;Tv(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=Wt(n,i,a));var o=e.transformable;Gn(o.localRotation,n[0],n[1],n[2]),s&&this.dirtyLocalTransform(e,o)}},{key:"setLocalTransform",value:function(e,n){var i=Pn(hT,n),a=Xo(dT,n),s=Ds(fT,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,AT,!1),this.setLocalPosition(e,hf,!1),this.setLocalEulerAngles(e,hf,void 0,void 0,!1),this.setLocalSkew(e,oT,void 0,!1),this.dirtyLocalTransform(e,e.transformable)}},{key:"getPosition",value:function(e){var n=e.transformable;return Pn(n.position,this.getWorldTransform(e,n))}},{key:"getRotation",value:function(e){var n=e.transformable;return Xo(n.rotation,this.getWorldTransform(e,n))}},{key:"getScale",value:function(e){var n=e.transformable;return Ds(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(dl[0]=n[0],dl[1]=n[1],dl[2]=(i=n[2])!==null&&i!==void 0?i:0,!Yi(this.getPosition(e),dl)){if(ie(a.position,dl),e.parentNode===null||!e.parentNode.transformable)ie(a.localPosition,dl);else{var s=e.parentNode.transformable;He(df,s.worldTransform),on(df,df),me(a.localPosition,dl,df)}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=ve(ul,n,i,a)),!Yi(n,hf)&&(de(ul,this.getPosition(e),n),this.setPosition(e,ul))}},{key:"setRotation",value:function(e,n,i,a,s){var o=e.transformable;if(typeof n=="number"&&(n=cd(n,i,a,s)),e.parentNode===null||!e.parentNode.transformable)this.setLocalRotation(e,n);else{var A=this.getRotation(e.parentNode);YA(hl,A),jA(hl,hl),Ps(o.localRotation,hl,n),Jo(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=Wt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.rotateLocal(e,n);else{var o=hl;Gn(o,n[0],n[1],n[2]);var A=this.getRotation(e),l=this.getRotation(e.parentNode);YA(ff,l),jA(ff,ff),Ps(o,ff,o),Ps(s.localRotation,o,A),Jo(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=Wt(n,i,a));var s=e.transformable;if(e.parentNode===null||!e.parentNode.transformable)this.setLocalEulerAngles(e,n);else{Gn(s.localRotation,n[0],n[1],n[2]);var o=this.getRotation(e.parentNode);YA(VE,jA(hl,o)),Eu(s.localRotation,s.localRotation,VE),this.dirtyLocalTransform(e,s)}}},{key:"getGeometryBounds",value:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,i=e,a=i.geometry;a.dirty&&re.styleValueRegistry.updateGeometry(e);var s=n?a.renderBounds:a.contentBounds||null;return s||new Zn}},{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(!Zn.isEmpty(a)){var s=i||new Zn;return s.setFromTransformedAABB(a,this.getWorldTransform(e)),s}return null}},{key:"getBounds",value:function(e){var n=this,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=a.renderable;if(!s.boundsDirty&&!i&&s.bounds)return s.bounds;if(!s.renderBoundsDirty&&i&&s.renderBounds)return s.renderBounds;var o=i?s.renderBounds:s.bounds,A=this.getTransformedGeometryBounds(e,i,o),l=e.childNodes;if(l.forEach(function(h){var d=n.getBounds(h,i);d&&(A?A.add(d):(A=o||new Zn,A.update(d.center,d.halfExtents)))}),A||(A=new Zn),i){var c=NE(e);if(c){var u=c.parsedStyle.clipPath.getBounds(i);A?u&&(A=u.intersection(A)):A.update(u.center,u.halfExtents)}}return i?(s.renderBounds=A,s.renderBoundsDirty=!1):(s.bounds=A,s.boundsDirty=!1),A}},{key:"getLocalBounds",value:function(e){if(e.parentNode){var n=lT;e.parentNode.transformable&&(n=on(uT,this.getWorldTransform(e.parentNode)));var i=this.getBounds(e);if(!Zn.isEmpty(i)){var a=new Zn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds(e)}},{key:"getBoundingClientRect",value:function(e){var n,i,a=this.getGeometryBounds(e);Zn.isEmpty(a)||(i=new Zn,i.setFromTransformedAABB(a,this.getWorldTransform(e)));var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0?void 0:n.getContextService().getBoundingClientRect();if(i){var o=i.getMin(),A=(0,H.Z)(o,2),l=A[0],c=A[1],u=i.getMax(),h=(0,H.Z)(u,2),d=h[0],f=h[1];return new fs(l+((s==null?void 0:s.left)||0),c+((s==null?void 0:s.top)||0),d-l,f-c)}return new fs((s==null?void 0:s.left)||0,(s==null?void 0:s.top)||0,0,0)}},{key:"internalUpdateTransform",value:function(e){var n,i=(n=e.parentNode)===null||n===void 0?void 0:n.transformable;Zs(e.transformable),cA(e.transformable,i)}},{key:"internalUpdateElement",value:function(e,n){var i,a,s,o,A=((i=e.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0,l=n[n.length-1],c=(l==null?void 0:l.transformDirty)||((a=e.transformable)===null||a===void 0?void 0:a.localDirtyFlag);if(e.transformable){var u;(u=e.transformable).dirtyFlag||(u.dirtyFlag=c)}if(this.internalUpdateTransform(e),c){var h;(h=e.dirty)===null||h===void 0||h.call(e,!0,!0)}var d=((s=e.renderable)===null||s===void 0?void 0:s.boundsDirty)||((o=e.renderable)===null||o===void 0?void 0:o.renderBoundsDirty);if((c||d)&&(l==null?void 0:l.shapeUpdated)===!1&&A)for(var f=n.length-1;f>=0;){var g,v,p=n[f];if(p.shapeUpdated)break;(g=(v=p.node).dirty)===null||g===void 0||g.call(v,!0,!0),p.shapeUpdated=!0,f-=1}return c}},{key:"syncHierarchy",value:function(e){for(var n,i,a=[e],s=e.parentNode?[{node:e.parentNode,transformDirty:((n=e.parentNode.transformable)===null||n===void 0?void 0:n.localDirtyFlag)||((i=e.parentNode.transformable)===null||i===void 0?void 0:i.dirtyFlag),shapeUpdated:!1}]:[];a.length>0;){for(var o=a.pop(),A=s[s.length-1];s.length>0&&o.parentNode!==A.node;)A=s.pop();var l=this.internalUpdateElement(o,s);if(o.childNodes.length>0){for(var c=o.childNodes.length-1;c>=0;c--)a.push(o.childNodes[c]);s.push({node:o,transformDirty:l,shapeUpdated:!1})}}}},{key:"dirtyLocalTransform",value:function(e,n){lf(e)||n.localDirtyFlag||(n.localDirtyFlag=!0,n.dirtyFlag||this.dirtyWorldTransform(e,n))}},{key:"dirtyWorldTransform",value:function(e,n){this.dirtyWorldInternal(e,n),this.dirtyToRoot(e,!0)}},{key:"dirtyWorldInternal",value:function(e,n){var i,a=this,s=((i=e.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig())===null||i===void 0||(i=i.future)===null||i===void 0?void 0:i.experimentalAttributeUpdateOptimization)===!0;n.dirtyFlag||(n.dirtyFlag=!0,e.dirty(!0,!0),s||e.childNodes.forEach(function(o){var A=o.transformable;a.dirtyWorldInternal(o,A)}))}},{key:"dirtyToRoot",value:function(e){for(var n,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=e,s=((n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalAttributeUpdateOptimization)===!0;a;){var o,A;if((o=(A=a).dirty)===null||o===void 0||o.call(A,!0,!0),s)break;a=a.parentNode}i&&e.forEach(function(u){var h;(h=u.dirty)===null||h===void 0||h.call(u,!0,!0)}),this.informDependentDisplayObjects(e);var l=e.mutations||[],c=l.find(function(u){return u.type==="attributes"&&u._boundsChangeData});c?c._boundsChangeData={affectChildren:c._boundsChangeData.affectChildren||i}:(c={type:"attributes",target:e,_boundsChangeData:{affectChildren:i}},l.push(c)),e.mutations=l}},{key:"dirtyFragment",value:function(e){var n,i,a=e.transformable;a&&(a.dirtyFlag=!0,a.localDirtyFlag=!0),(n=(i=e).dirty)===null||n===void 0||n.call(i,!0,!0);for(var s=e.childNodes.length,o=0;o0){var i=new Wr(yn.BOUNDS_CHANGED,{detail:Array.from(n)});e.dispatchEvent(i,!0,!0)}}},{key:"updateDisplayObjectDependency",value:function(e,n,i,a){if(n&&n!==i){var s=this.displayObjectDependencyMap.get(n);if(s&&s[e]){var o=s[e].indexOf(a);s[e].splice(o,1)}}if(i){var A=this.displayObjectDependencyMap.get(i);A||(this.displayObjectDependencyMap.set(i,{}),A=this.displayObjectDependencyMap.get(i)),A[e]||(A[e]=[]),A[e].push(a)}}},{key:"informDependentDisplayObjects",value:function(e){var n,i=this,a=this.displayObjectDependencyMap.get(e);if(a){var s=(n=e.ownerDocument)===null||n===void 0||(n=n.defaultView)===null||n===void 0||(n=n.getConfig())===null||n===void 0||(n=n.future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation;Object.keys(a).forEach(function(o){a[o].forEach(function(A){i.dirtyToRoot(A,!0),A.dispatchEvent(new $s(yn.ATTR_MODIFIED,A,i,i,o,$s.MODIFICATION,i,i),s,s),A.isCustomElement&&A.isConnected&&A.attributeChangedCallback&&A.attributeChangedCallback(o,i,i)})})}}}])}(),jE=function(){function r(t){if((0,P.Z)(this,r),t<=0)throw new Error("LRU capacity must be a positive number.");this.capacity=t,this.cache=new Map}return(0,N.Z)(r,[{key:"get",value:function(e){if(this.cache.has(e)){var n=this.cache.get(e);return this.cache.delete(e),this.cache.set(e,n),n}}},{key:"put",value:function(e,n){if(this.cache.has(e)&&this.cache.delete(e),this.cache.set(e,n),this.cache.size>this.capacity){var i=this.cache.keys().next().value;this.cache.delete(i)}}},{key:"len",value:function(){return this.cache.size}},{key:"clear",value:function(){this.cache.clear()}}])}(),fl={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]},ZE=/[a-zA-Z0-9\u00C0-\u00D6\u00D8-\u00f6\u00f8-\u00ff!"#$%&'()*+,-./:;]/,vT=/[!%),.:;?\]}¢°·'""†‡›℃∶、。〃〆〕〗〞﹚﹜!"%'),.:;?!]}~]/,pT=/[$(£¥·'"〈《「『【〔〖〝﹙﹛$(.[{£¥]/,mT=/[!),.:;?\]}¢·–—'"•"、。〆〞〕〉》」︰︱︲︳﹐﹑﹒﹓﹔﹕﹖﹘﹚﹜!),.:;?︶︸︺︼︾﹀﹂﹗]|}、]/,yT=/[([{£¥'"‵〈《「『〔〝︴﹙﹛({︵︷︹︻︽︿﹁﹃﹏]/,wT=/[)\]}〕〉》」』】〙〗〟'"⦆»ヽヾーァィゥェォッャュョヮヵヶぁぃぅぇぉっゃゅょゎゕゖㇰㇱㇲㇳㇴㇵㇶㇷㇸㇹㇺㇻㇼㇽㇾㇿ々〻‐゠–〜?!‼⁇⁈⁉・、:;,。.]/,ET=/[([{〔〈《「『【〘〖〝'"⦅«—...‥〳〴〵]/,BT=/[!%),.:;?\]}¢°'"†‡℃〆〈《「『〕!%),.:;?]}]/,bT=/[$([{£¥'"々〇〉》」〔$([{⦆¥₩#]/,xT=new RegExp("".concat(vT.source,"|").concat(mT.source,"|").concat(wT.source,"|").concat(BT.source)),CT=new RegExp("".concat(pT.source,"|").concat(yT.source,"|").concat(ET.source,"|").concat(bT.source)),ST=function(){function r(t){var e=this;(0,P.Z)(this,r),this.fontMetricsCache={},this.shouldBreakByKinsokuShorui=function(n,i){return e.isBreakingSpace(i)?!1:!!(n&&(CT.exec(i)||xT.exec(n)))},this.trimByKinsokuShorui=function(n){var i=(0,G.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 jE(100)}return(0,N.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=fl.MetricsString+fl.BaselineSymbol,A=Math.ceil(s.measureText(o).width),l=Math.ceil(s.measureText(fl.BaselineSymbol).width),c=fl.HeightMultiplier*l;l=l*fl.BaselineMultiplier|0,a.width=A,a.height=c,s.fillStyle="#f00",s.fillRect(0,0,A,c),s.font=e,s.textBaseline="alphabetic",s.fillStyle="#000",s.fillText(o,0,l);var u=s.getImageData(0,0,A||1,c||1).data,h=u.length,d=A*4,f=0,g=0,v=!1;for(f=0;fl;--f){for(var y=0;yXt&&xt>=Dt;)xt-=1,yt=yt.slice(0,-1);return{lineTxt:yt,txtLastCharIndex:xt}}function et(yt,xt){if(!(j<=0||j>v)){if(!y[yt]){y[yt]=p;return}var Dt=q(y[yt],xt,O+1,v-j);y[yt]=Dt.lineTxt+p}}for(var it=0;it=d){itv){et(x,it-1),n.isOverflowing=!0;break}if(F>0&&F+Rt>v){var Qt=q(y[x],it-1,O+1,v);if(Qt.txtLastCharIndex!==it-1){if(y[x]=Qt.lineTxt,Qt.txtLastCharIndex===s.length-1)break;it=Qt.txtLastCharIndex+1,dt=s[it],ft=s[it-1],mt=s[it+1],Rt=R(dt)}if(x+1>=d){et(x,it-1),n.isOverflowing=!0;break}if(O=it-1,x+=1,F=0,y[x]="",this.isBreakingSpace(dt))continue;this.canBreakInLastChar(dt)||(y=this.trimToBreakable(y),F=this.sumTextWidthByCache(y[x]||"",R)),this.shouldBreakByKinsokuShorui(dt,mt)&&(y=this.trimByKinsokuShorui(y),F+=R(ft||""))}F+=Rt,y[x]+=dt}return y.join(` `)}},{key:"isBreakingSpace",value:function(e){return typeof e!="string"?!1:fl.BreakingSpaces.indexOf(e.charCodeAt(0))>=0}},{key:"isNewline",value:function(e){return typeof e!="string"?!1:fl.Newlines.indexOf(e.charCodeAt(0))>=0}},{key:"trimToBreakable",value:function(e){var n=(0,G.Z)(e),i=n[n.length-2],a=this.findBreakableIndex(i);if(a===-1||!i)return n;var s=i.slice(a,a+1),o=this.isBreakingSpace(s),A=a+1,l=a+(o?0:1);return n[n.length-1]+=i.slice(A,i.length),n[n.length-2]=i.slice(0,l),n}},{key:"canBreakInLastChar",value:function(e){return!(e&&ZE.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(!ZE.test(e[n]))return n;return-1}},{key:"getFromCache",value:function(e,n,i,a){var s=i.get(e);if(typeof s!="number"){var o=e.length*n,A=a.measureText(e);s=A.width+o,i.put(e,s)}return s}},{key:"clearCache",value:function(){this.fontMetricsCache={},this.charWidthCache.clear()}}])}(),re={},MT=function(r){var t=new JF,e=new XF;return r={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,Kt.FRAGMENT,null),Kt.CIRCLE,new WF),Kt.ELLIPSE,new jF),Kt.RECT,t),Kt.IMAGE,t),Kt.GROUP,new $F),Kt.LINE,new ZF),Kt.TEXT,new qF(re)),Kt.POLYLINE,e),Kt.POLYGON,e),(0,we.Z)((0,we.Z)((0,we.Z)(r,Kt.PATH,new YF),Kt.HTML,new tT),Kt.MESH,null)}(),FT=function(r){var t=new iF,e=new gm;return r={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,oe.PERCENTAGE,null),oe.NUMBER,new lF),oe.ANGLE,new nF),oe.DEFINED_PATH,new rF),oe.PAINT,t),oe.COLOR,t),oe.FILTER,new aF),oe.LENGTH,e),oe.LENGTH_PERCENTAGE,e),oe.LENGTH_PERCENTAGE_12,new sF),(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(r,oe.LENGTH_PERCENTAGE_14,new oF),oe.COORDINATE,new gm),oe.OFFSET_DISTANCE,new cF),oe.OPACITY_VALUE,new uF),oe.PATH,new hF),oe.LIST_OF_POINTS,new dF),oe.SHADOW_BLUR,new fF),oe.TEXT,new gF),oe.TEXT_TRANSFORM,new vF),oe.TRANSFORM,new zF),(0,we.Z)((0,we.Z)((0,we.Z)(r,oe.TRANSFORM_ORIGIN,new KF),oe.Z_INDEX,new VF),oe.MARKER,new AF)}(),TT=function(){return typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof T.g!="undefined"?T.g:{}};re.CameraContribution=Zu,re.AnimationTimeline=null,re.EasingFunction=null,re.offscreenCanvasCreator=new bm,re.sceneGraphSelector=new aT,re.sceneGraphService=new gT(re),re.textService=new ST(re),re.geometryUpdaterFactory=MT,re.CSSPropertySyntaxFactory=FT,re.styleValueRegistry=new tF(re),re.layoutRegistry=null,re.globalThis=TT(),re.enableStyleSyntax=!0,re.enableSizeAttenuation=!1;var YE=0;function V8(){YE=0}var xm=new $s(yn.INSERTED,null,"","","",0,"",""),Cm=new $s(yn.REMOVED,null,"","","",0,"",""),XE=new Wr(yn.DESTROY),OT=function(r){function t(){var e;(0,P.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1?arguments[1]:void 0;this.renderable.dirty=n,i!==void 0&&(this.renderable.boundsDirty=i,this.renderable.renderBoundsDirty=i,this.geometry.dirty=i)}},{key:"className",get:function(){return this.getAttribute("class")||""},set:function(n){this.setAttribute("class",n)}},{key:"classList",get:function(){return this.className.split(" ").filter(function(n){return n!==""})}},{key:"tagName",get:function(){return this.nodeName}},{key:"children",get:function(){return this.childNodes}},{key:"childElementCount",get:function(){return this.childNodes.length}},{key:"firstElementChild",get:function(){return this.firstChild}},{key:"lastElementChild",get:function(){return this.lastChild}},{key:"parentElement",get:function(){return this.parentNode}},{key:"nextSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n+1]||null}return null}},{key:"previousSibling",get:function(){if(this.parentNode){var n=this.parentNode.childNodes.indexOf(this);return this.parentNode.childNodes[n-1]||null}return null}},{key:"cloneNode",value:function(n){throw new Error(On)}},{key:"appendChild",value:function(n,i){var a;if(n.destroyed)throw new Error(Gd);return re.sceneGraphService.attach(n,this,i),(a=this.ownerDocument)!==null&&a!==void 0&&a.defaultView&&(!lf(this)&&n.nodeName===Kt.FRAGMENT?this.ownerDocument.defaultView.mountFragment(n):this.ownerDocument.defaultView.mountChildren(n)),this.isMutationObserved&&(xm.relatedNode=this,n.dispatchEvent(xm)),n}},{key:"insertBefore",value:function(n,i){if(!i)this.appendChild(n);else{n.parentElement&&n.parentElement.removeChild(n);var a=this.childNodes.indexOf(i);a===-1?this.appendChild(n):this.appendChild(n,a)}return n}},{key:"replaceChild",value:function(n,i){var a=this.childNodes.indexOf(i);return this.removeChild(i),this.appendChild(n,a),i}},{key:"removeChild",value:function(n){var i,a,s=((i=this.ownerDocument)===null||i===void 0||(i=i.defaultView)===null||i===void 0||(i=i.getConfig().future)===null||i===void 0?void 0:i.experimentalCancelEventPropagation)===!0;return Cm.relatedNode=this,n.dispatchEvent(Cm,s,s),(a=n.ownerDocument)!==null&&a!==void 0&&a.defaultView&&n.ownerDocument.defaultView.unmountChildren(n),re.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 re.sceneGraphService.matches(n,this)}},{key:"getElementById",value:function(n){return re.sceneGraphService.querySelector("#".concat(n),this)}},{key:"getElementsByName",value:function(n){return re.sceneGraphService.querySelectorAll('[name="'.concat(n,'"]'),this)}},{key:"getElementsByClassName",value:function(n){return re.sceneGraphService.querySelectorAll(".".concat(n),this)}},{key:"getElementsByTagName",value:function(n){return re.sceneGraphService.querySelectorAll(n,this)}},{key:"querySelector",value:function(n){return re.sceneGraphService.querySelector(n,this)}},{key:"querySelectorAll",value:function(n){return re.sceneGraphService.querySelectorAll(n,this)}},{key:"closest",value:function(n){var i=this;do{if(re.sceneGraphService.matches(n,i))return i;i=i.parentElement}while(i!==null);return null}},{key:"find",value:function(n){var i=this,a=null;return this.forEach(function(s){return s!==i&&n(s)?(a=s,!1):!0}),a}},{key:"findAll",value:function(n){var i=this,a=[];return this.forEach(function(s){s!==i&&n(s)&&a.push(s)}),a}},{key:"after",value:function(){var n=this;if(this.parentNode){for(var i=this.parentNode.childNodes.indexOf(this),a=arguments.length,s=new Array(a),o=0;o0&&arguments[0]!==void 0?arguments[0]:!1;return re.sceneGraphService.getGeometryBounds(this,n)}},{key:"getTransformedGeometryBounds",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;return re.sceneGraphService.getTransformedGeometryBounds(this,n)}},{key:"getBounds",value:function(){return re.sceneGraphService.getBounds(this)}},{key:"getRenderBounds",value:function(){return re.sceneGraphService.getBounds(this,!0)}},{key:"getLocalBounds",value:function(){return re.sceneGraphService.getLocalBounds(this)}},{key:"getBoundingClientRect",value:function(){return re.sceneGraphService.getBoundingClientRect(this)}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"computedStyleMap",value:function(){return new Map(Object.entries(this.computedStyle))}},{key:"getAttributeNames",value:function(){return Object.keys(this.attributes)}},{key:"getAttribute",value:function(n){if(typeof n!="symbol"){var i=this.attributes[n];return i}}},{key:"hasAttribute",value:function(n){return this.getAttributeNames().includes(n)}},{key:"hasAttributes",value:function(){return!!this.getAttributeNames().length}},{key:"removeAttribute",value:function(n){this.setAttribute(n,null),delete this.attributes[n]}},{key:"setAttribute",value:function(n,i){this.attributes[n]=i}},{key:"getAttributeNS",value:function(n,i){throw new Error(On)}},{key:"getAttributeNode",value:function(n){throw new Error(On)}},{key:"getAttributeNodeNS",value:function(n,i){throw new Error(On)}},{key:"hasAttributeNS",value:function(n,i){throw new Error(On)}},{key:"removeAttributeNS",value:function(n,i){throw new Error(On)}},{key:"removeAttributeNode",value:function(n){throw new Error(On)}},{key:"setAttributeNS",value:function(n,i,a){throw new Error(On)}},{key:"setAttributeNode",value:function(n){throw new Error(On)}},{key:"setAttributeNodeNS",value:function(n){throw new Error(On)}},{key:"toggleAttribute",value:function(n,i){throw new Error(On)}}])}(pr);function Ln(r){return!!(r!=null&&r.nodeName)}var IT=re.globalThis.Proxy?re.globalThis.Proxy:function(){},to=new $s(yn.ATTR_MODIFIED,null,null,null,null,$s.MODIFICATION,null,null),ah=Ot(),NT=Br(),ir=function(r){function t(e){var n;return(0,P.Z)(this,t),n=(0,K.Z)(this,t),n.isCustomElement=!1,n.isMutationObserved=!1,n.activeAnimations=[],n.config=e,n.id=e.id||"",n.name=e.name||"",(e.className||e.class)&&(n.className=e.className||e.class),n.nodeName=e.type||Kt.GROUP,e.initialParsedStyle&&Object.assign(n.parsedStyle,e.initialParsedStyle),n.initAttributes(e.style),re.enableStyleSyntax&&(n.style=new IT({setProperty:function(a,s){n.setAttribute(a,s)},getPropertyValue:function(a){return n.getAttribute(a)},removeProperty:function(a){n.removeAttribute(a)},item:function(){return""}},{get:function(a,s){return a[s]!==void 0?a[s]:n.getAttribute(s)},set:function(a,s,o){return n.setAttribute(s,o),!0}})),n}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"destroy",value:function(){Ks(t,"destroy",this,3)([]),this.getAnimations().forEach(function(n){n.cancel()})}},{key:"cloneNode",value:function(n,i){var a=(0,z.Z)({},this.attributes);for(var s in a){var o=a[s];Ln(o)&&s!=="clipPath"&&s!=="offsetPath"&&s!=="textPath"&&(a[s]=o.cloneNode(n)),i&&(a[s]=i(s,o))}var A=new this.constructor((0,z.Z)((0,z.Z)({},this.config),{},{style:a}));return A.setLocalTransform(this.getLocalTransform()),n&&this.children.forEach(function(l){if(!l.style.isMarker){var c=l.cloneNode(n);A.appendChild(c)}}),A}},{key:"initAttributes",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i={forceUpdateGeometry:!0};re.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;Ze(i)||(a||i!==this.attributes[n])&&(this.internalSetAttribute(n,i,{memoize:s}),Ks(t,"setAttribute",this,3)([n,i]))}},{key:"setAttributes",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=i.skipDispatchAttrModifiedEvent,s=a===void 0?!1:a,o,A;if(s||(o=(0,z.Z)({},this.attributes),A=(0,z.Z)({},this.parsedStyle)),re.styleValueRegistry.processProperties(this,n,i),this.dirty(),!s)for(var l in n)this.dispatchAttrModifiedEvent(l,o[l],n[l],A[l])}},{key:"internalSetAttribute",value:function(n,i){var a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},s=this.attributes[n],o=this.parsedStyle[n];re.styleValueRegistry.processProperties(this,(0,we.Z)({},n,i),a),this.dirty(),this.dispatchAttrModifiedEvent(n,s,i,o)}},{key:"dispatchAttrModifiedEvent",value:function(n,i,a,s){var o=this.parsedStyle[n];if(this.isConnected)if(to.relatedNode=this,to.prevValue=i,to.newValue=a,to.attrName=n,to.prevParsedValue=s,to.newParsedValue=o,this.isMutationObserved)this.dispatchEvent(to);else{var A,l=((A=this.ownerDocument.defaultView.getConfig().future)===null||A===void 0?void 0:A.experimentalCancelEventPropagation)===!0;to.target=this,this.ownerDocument.defaultView.dispatchEvent(to,!0,l)}if(this.isCustomElement&&this.isConnected||!this.isCustomElement){var c,u;(c=(u=this).attributeChangedCallback)===null||c===void 0||c.call(u,n,i,a,s,o)}}},{key:"getBBox",value:function(){var n=this.getBounds(),i=n.getMin(),a=(0,H.Z)(i,2),s=a[0],o=a[1],A=n.getMax(),l=(0,H.Z)(A,2),c=l[0],u=l[1];return new fs(s,o,c-s,u-o)}},{key:"setOrigin",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0;return re.sceneGraphService.setOrigin(this,pi(n,i,a,!1)),this}},{key:"getOrigin",value:function(){return re.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 re.sceneGraphService.setPosition(this,pi(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 re.sceneGraphService.setLocalPosition(this,pi(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 re.sceneGraphService.translate(this,pi(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 re.sceneGraphService.translateLocal(this,pi(n,i,a,!1)),this}},{key:"getPosition",value:function(){return re.sceneGraphService.getPosition(this)}},{key:"getLocalPosition",value:function(){return re.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=pi(n,i,a,!1)),re.sceneGraphService.scaleLocal(this,n),this}},{key:"setLocalScale",value:function(n,i,a){return typeof n=="number"&&(i=i||n,a=a||n,n=pi(n,i,a,!1)),re.sceneGraphService.setLocalScale(this,n),this}},{key:"getLocalScale",value:function(){return re.sceneGraphService.getLocalScale(this)}},{key:"getScale",value:function(){return re.sceneGraphService.getScale(this)}},{key:"getEulerAngles",value:function(){var n=Wu(ah,re.sceneGraphService.getWorldTransform(this)),i=(0,H.Z)(n,3),a=i[2];return bi(a)}},{key:"getLocalEulerAngles",value:function(){var n=Wu(ah,re.sceneGraphService.getLocalRotation(this)),i=(0,H.Z)(n,3),a=i[2];return bi(a)}},{key:"setEulerAngles",value:function(n){return re.sceneGraphService.setEulerAngles(this,0,0,n),this}},{key:"setLocalEulerAngles",value:function(n){return re.sceneGraphService.setLocalEulerAngles(this,0,0,n),this}},{key:"rotateLocal",value:function(n,i,a){return Re(i)&&Re(a)?re.sceneGraphService.rotateLocal(this,0,0,n):re.sceneGraphService.rotateLocal(this,n,i,a),this}},{key:"rotate",value:function(n,i,a){return Re(i)&&Re(a)?re.sceneGraphService.rotate(this,0,0,n):re.sceneGraphService.rotate(this,n,i,a),this}},{key:"setRotation",value:function(n,i,a,s){return re.sceneGraphService.setRotation(this,n,i,a,s),this}},{key:"setLocalRotation",value:function(n,i,a,s){return re.sceneGraphService.setLocalRotation(this,n,i,a,s),this}},{key:"setLocalSkew",value:function(n,i){return re.sceneGraphService.setLocalSkew(this,n,i),this}},{key:"getRotation",value:function(){return re.sceneGraphService.getRotation(this)}},{key:"getLocalRotation",value:function(){return re.sceneGraphService.getLocalRotation(this)}},{key:"getLocalSkew",value:function(){return re.sceneGraphService.getLocalSkew(this)}},{key:"getLocalTransform",value:function(){return re.sceneGraphService.getLocalTransform(this)}},{key:"getWorldTransform",value:function(){return re.sceneGraphService.getWorldTransform(this)}},{key:"setLocalTransform",value:function(n){return re.sceneGraphService.setLocalTransform(this,n),this}},{key:"resetLocalTransform",value:function(){re.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,G.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,G.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}}])}(OT);ir.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","display","draggable","droppable","fill","fillOpacity","fillRule","filter","increasedLineWidthForHitTesting","lineCap","lineDash","lineDashOffset","lineJoin","lineWidth","miterLimit","hitArea","offsetDistance","offsetPath","offsetX","offsetY","opacity","pointerEvents","shadowColor","shadowType","shadowBlur","shadowOffsetX","shadowOffsetY","stroke","strokeOpacity","strokeWidth","strokeLinecap","strokeLineJoin","strokeDasharray","strokeDashoffset","transform","transformOrigin","textTransform","visibility","zIndex"]);var eo=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.CIRCLE},e)])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);eo.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["cx","cy","cz","r","isBillboard","isSizeAttenuation"]));var LT=["style"],sh=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Ja.Z)(n,LT);return(0,P.Z)(this,t),e=(0,K.Z)(this,t,[(0,z.Z)({style:i},a)]),e.isCustomElement=!0,e}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);sh.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var oh=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.ELLIPSE},e)])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);oh.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["cx","cy","cz","rx","ry","isBillboard","isSizeAttenuation"]));var kT=function(r){function t(){return(0,P.Z)(this,t),(0,K.Z)(this,t,[{type:Kt.FRAGMENT}])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);kT.PARSED_STYLE_LIST=new Set(["class","className"]);var Ai=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.GROUP},e)])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);Ai.PARSED_STYLE_LIST=new Set(["class","className","clipPath","cursor","draggable","droppable","opacity","pointerEvents","transform","transformOrigin","zIndex","visibility"]);var QT=["style"],gl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Ja.Z)(n,QT);return(0,P.Z)(this,t),e=(0,K.Z)(this,t,[(0,z.Z)({type:Kt.HTML,style:i},a)]),e.cullable.enable=!1,e}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"getDomElement",value:function(){return this.parsedStyle.$el}},{key:"getClientRects",value:function(){return[this.getBoundingClientRect()]}},{key:"getLocalBounds",value:function(){if(this.parentNode){var n=on($t(),this.parentNode.getWorldTransform()),i=this.getBounds();if(!Zn.isEmpty(i)){var a=new Zn;return a.setFromTransformedAABB(i,n),a}}return this.getBounds()}}])}(ir);gl.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["x","y","$el","innerHTML","width","height"]));var Ah=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.IMAGE},e)])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);Ah.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["x","y","z","src","width","height","isBillboard","billboardRotation","isSizeAttenuation","keepAspectRatio"]));var UT=["style"],vl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Ja.Z)(n,UT);(0,P.Z)(this,t),e=(0,K.Z)(this,t,[(0,z.Z)({type:Kt.LINE,style:(0,z.Z)({x1:0,y1:0,x2:0,y2:0,z1:0,z2:0},i)},a)]),e.markerStartAngle=0,e.markerEndAngle=0;var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd;return o&&Ln(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),A&&Ln(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,_.Z)(t,r),(0,N.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&&Ln(s)&&(this.markerStartAngle=0,s.remove()),o&&Ln(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"&&(s&&Ln(s)&&(this.markerEndAngle=0,s.remove()),o&&Ln(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1)))}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=i.x1,c=i.x2,u=i.y1,h=i.y2,d=n?a:s;if(!(!d||!Ln(d))){var f=0,g,v,p,y,x,F;n?(p=l,y=u,g=c-l,v=h-u,x=o||0,F=this.markerStartAngle):(p=c,y=h,g=l-c,v=u-h,x=A||0,F=this.markerEndAngle),f=Math.atan2(v,g),d.setLocalEulerAngles(f*180/Math.PI+F),d.setLocalPosition(p+Math.cos(f)*x,y+Math.sin(f)*x)}}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle,s=a.x1,o=a.y1,A=a.x2,l=a.y2,c=Ma(s,o,A,l,n),u=c.x,h=c.y,d=me(Ot(),Wt(u,h,0),i?this.getWorldTransform():this.getLocalTransform());return new ai(d[0],d[1])}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getTotalLength",value:function(){var n=this.parsedStyle,i=n.x1,a=n.y1,s=n.x2,o=n.y2;return Nd(i,a,s,o)}}])}(ir);vl.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["x1","y1","x2","y2","z1","z2","isBillboard","isSizeAttenuation","markerStart","markerEnd","markerStartOffset","markerEndOffset"]));var RT=["style"],Pi=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Ja.Z)(n,RT);(0,P.Z)(this,t),e=(0,K.Z)(this,t,[(0,z.Z)({type:Kt.PATH,style:i,initialParsedStyle:{miterLimit:4,d:(0,z.Z)({},vs)}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd,l=s.markerMid;return o&&Ln(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Ln(l)&&e.placeMarkerMid(l),A&&Ln(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,_.Z)(t,r),(0,N.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&&Ln(s)&&(this.markerStartAngle=0,s.remove()),o&&Ln(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ln(s)&&(this.markerEndAngle=0,s.remove()),o&&Ln(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=n?a:s;if(!(!l||!Ln(l))){var c=0,u,h,d,f,g,v;if(n){var p=this.getStartTangent(),y=(0,H.Z)(p,2),x=y[0],F=y[1];d=F[0],f=F[1],u=x[0]-F[0],h=x[1]-F[1],g=o||0,v=this.markerStartAngle}else{var O=this.getEndTangent(),L=(0,H.Z)(O,2),U=L[0],R=L[1];d=R[0],f=R[1],u=U[0]-R[0],h=U[1]-R[1],g=A||0,v=this.markerEndAngle}c=Math.atan2(h,u),l.setLocalEulerAngles(c*180/Math.PI+v),l.setLocalPosition(d+Math.cos(c)*g,f+Math.sin(c)*g)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.d.segments;if(this.markerMidList.forEach(function(c){c.remove()}),n&&Ln(n))for(var a=1;a1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.d.absolutePath,s=pp(a,n),o=s.x,A=s.y,l=me(Ot(),Wt(o,A,0),i?this.getWorldTransform():this.getLocalTransform());return new ai(l[0],l[1])}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPointAtLength(n*An(this),i)}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.d.segments,i=[];if(n.length>1){var a=n[0].currentPoint,s=n[1].currentPoint,o=n[1].startTangent;i=[],o?(i.push([a[0]-o[0],a[1]-o[1]]),i.push([a[0],a[1]])):(i.push([s[0],s[1]]),i.push([a[0],a[1]]))}return i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.d.segments,i=n.length,a=[];if(i>1){var s=n[i-2].currentPoint,o=n[i-1].currentPoint,A=n[i-1].endTangent;a=[],A?(a.push([o[0]-A[0],o[1]-A[1]]),a.push([o[0],o[1]])):(a.push([s[0],s[1]]),a.push([o[0],o[1]]))}return a}}])}(ir);Pi.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["d","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard","isSizeAttenuation"]));var DT=["style"],pl=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},i=n.style,a=(0,Ja.Z)(n,DT);(0,P.Z)(this,t),e=(0,K.Z)(this,t,[(0,z.Z)({type:Kt.POLYGON,style:i,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!0}},a)]),e.markerStartAngle=0,e.markerEndAngle=0,e.markerMidList=[];var s=e.parsedStyle,o=s.markerStart,A=s.markerEnd,l=s.markerMid;return o&&Ln(o)&&(e.markerStartAngle=o.getLocalEulerAngles(),e.appendChild(o)),l&&Ln(l)&&e.placeMarkerMid(l),A&&Ln(A)&&(e.markerEndAngle=A.getLocalEulerAngles(),e.appendChild(A)),e.transformMarker(!0),e.transformMarker(!1),e}return(0,_.Z)(t,r),(0,N.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&&Ln(s)&&(this.markerStartAngle=0,s.remove()),o&&Ln(o)&&(this.markerStartAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!0))):n==="markerEnd"?(s&&Ln(s)&&(this.markerEndAngle=0,s.remove()),o&&Ln(o)&&(this.markerEndAngle=o.getLocalEulerAngles(),this.appendChild(o),this.transformMarker(!1))):n==="markerMid"&&this.placeMarkerMid(o)}},{key:"transformMarker",value:function(n){var i=this.parsedStyle,a=i.markerStart,s=i.markerEnd,o=i.markerStartOffset,A=i.markerEndOffset,l=i.points,c=l||{},u=c.points,h=n?a:s;if(!(!h||!Ln(h)||!u)){var d=0,f,g,v,p,y,x;if(v=u[0][0],p=u[0][1],n)f=u[1][0]-u[0][0],g=u[1][1]-u[0][1],y=o||0,x=this.markerStartAngle;else{var F=u.length;this.parsedStyle.isClosed?(f=u[F-1][0]-u[0][0],g=u[F-1][1]-u[0][1]):(v=u[F-1][0],p=u[F-1][1],f=u[F-2][0]-u[F-1][0],g=u[F-2][1]-u[F-1][1]),y=A||0,x=this.markerEndAngle}d=Math.atan2(g,f),h.setLocalEulerAngles(d*180/Math.PI+x),h.setLocalPosition(v+Math.cos(d)*y,p+Math.sin(d)*y)}}},{key:"placeMarkerMid",value:function(n){var i=this.parsedStyle.points,a=i||{},s=a.points;if(this.markerMidList.forEach(function(u){u.remove()}),this.markerMidList=[],n&&Ln(n)&&s)for(var o=1;o<(this.parsedStyle.isClosed?s.length:s.length-1);o++){var A=s[o][0],l=s[o][1],c=o===1?n:n.cloneNode(!0);this.markerMidList.push(c),this.appendChild(c),c.setLocalPosition(A,l)}}}])}(ir);pl.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isClosed","isBillboard","isSizeAttenuation"]));var PT=["style"],gf=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,Ja.Z)(e,PT);return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.POLYLINE,style:n,initialParsedStyle:{points:{points:[],totalLength:0,segments:[]},miterLimit:4,isClosed:!1}},i)])}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"getTotalLength",value:function(){return Ye(this)}},{key:"getPointAtLength",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return this.getPoint(n/this.getTotalLength(),i)}},{key:"getPoint",value:function(n){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,a=this.parsedStyle.points.points;if(this.parsedStyle.points.segments.length===0){var s=[],o=0,A,l,c=this.getTotalLength();a.forEach(function(p,y){a[y+1]&&(A=[0,0],A[0]=o/c,l=Nd(p[0],p[1],a[y+1][0],a[y+1][1]),o+=l,A[1]=o/c,s.push(A))}),this.parsedStyle.points.segments=s}var u=0,h=0;this.parsedStyle.points.segments.forEach(function(p,y){n>=p[0]&&n<=p[1]&&(u=(n-p[0])/(p[1]-p[0]),h=y)});var d=Ma(a[h][0],a[h][1],a[h+1][0],a[h+1][1],u),f=d.x,g=d.y,v=me(Ot(),Wt(f,g,0),i?this.getWorldTransform():this.getLocalTransform());return new ai(v[0],v[1])}},{key:"getStartTangent",value:function(){var n=this.parsedStyle.points.points,i=[];return i.push([n[1][0],n[1][1]]),i.push([n[0][0],n[0][1]]),i}},{key:"getEndTangent",value:function(){var n=this.parsedStyle.points.points,i=n.length-1,a=[];return a.push([n[i-1][0],n[i-1][1]]),a.push([n[i][0],n[i][1]]),a}}])}(pl);gf.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(pl.PARSED_STYLE_LIST),["points","markerStart","markerMid","markerEnd","markerStartOffset","markerEndOffset","isBillboard"]));var Ci=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.RECT},e)])}return(0,_.Z)(t,r),(0,N.Z)(t)}(ir);Ci.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["x","y","z","width","height","isBillboard","isSizeAttenuation","radius"]));var _T=["style"],ml=function(r){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.style,i=(0,Ja.Z)(e,_T);return(0,P.Z)(this,t),(0,K.Z)(this,t,[(0,z.Z)({type:Kt.TEXT,style:(0,z.Z)({fill:"black"},n)},i)])}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"getComputedTextLength",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.maxLineWidth)||0}},{key:"getLineBoundingRects",value:function(){var n;return this.getGeometryBounds(),((n=this.parsedStyle.metrics)===null||n===void 0?void 0:n.lineMetrics)||[]}},{key:"isOverflowing",value:function(){return this.getGeometryBounds(),!!this.parsedStyle.isOverflowing}}])}(ir);ml.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(ir.PARSED_STYLE_LIST),["x","y","z","isBillboard","billboardRotation","isSizeAttenuation","text","textAlign","textBaseline","fontStyle","fontSize","fontFamily","fontWeight","fontVariant","lineHeight","letterSpacing","leading","wordWrap","wordWrapWidth","maxLines","textOverflow","isOverflowing","textPath","textDecorationLine","textDecorationColor","textDecorationStyle","textDecorationThickness","textPathSide","textPathStartOffset","metrics","dx","dy"]));var HT=function(){function r(){(0,P.Z)(this,r),this.registry={},this.define(Kt.CIRCLE,eo),this.define(Kt.ELLIPSE,oh),this.define(Kt.RECT,Ci),this.define(Kt.IMAGE,Ah),this.define(Kt.LINE,vl),this.define(Kt.GROUP,Ai),this.define(Kt.PATH,Pi),this.define(Kt.POLYGON,pl),this.define(Kt.POLYLINE,gf),this.define(Kt.TEXT,ml),this.define(Kt.HTML,gl)}return(0,N.Z)(r,[{key:"define",value:function(e,n){this.registry[e]=n}},{key:"get",value:function(e){return this.registry[e]}}])}(),GT={number:function(t){return new _n(t)},percent:function(t){return new _n(t,"%")},px:function(t){return new _n(t,"px")},em:function(t){return new _n(t,"em")},rem:function(t){return new _n(t,"rem")},deg:function(t){return new _n(t,"deg")},grad:function(t){return new _n(t,"grad")},rad:function(t){return new _n(t,"rad")},turn:function(t){return new _n(t,"turn")},s:function(t){return new _n(t,"s")},ms:function(t){return new _n(t,"ms")},registerProperty:function(t){var e=t.name,n=t.inherits,i=t.interpolable,a=t.initialValue,s=t.syntax;re.styleValueRegistry.registerMetadata({n:e,inh:n,int:i,d:a,syntax:s})},registerLayout:function(t,e){re.layoutRegistry.registerLayout(t,e)}},JE=function(r){function t(){var e;(0,P.Z)(this,t),e=(0,K.Z)(this,t),e.defaultView=null,e.ownerDocument=null,e.nodeName="document";try{e.timeline=new re.AnimationTimeline(e)}catch(i){}var n={};return fm.forEach(function(i){var a=i.n,s=i.inh,o=i.d;s&&o&&(n[a]=Vt(o)?o(Kt.GROUP):o)}),e.documentElement=new Ai({id:"g-root",style:n}),e.documentElement.ownerDocument=e,e.documentElement.parentNode=e,e.childNodes=[e.documentElement],e}return(0,_.Z)(t,r),(0,N.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"?ml:Ai);var s=new a(i);return s.ownerDocument=this,s}},{key:"createElementNS",value:function(n,i,a){return this.createElement(i,a)}},{key:"cloneNode",value:function(n){throw new Error(On)}},{key:"destroy",value:function(){try{this.documentElement.destroyChildren(),this.timeline.destroy()}catch(n){}}},{key:"elementsFromBBox",value:function(n,i,a,s){var o=[],A=function(c){if(!(!c.isInteractive()||c.isCulled())){var u=c.parsedStyle.pointerEvents,h=u===void 0?"auto":u,d=["auto","visiblepainted","visiblefill","visiblestroke","visible"].includes(h);if(!d||c.isVisible()){var f=c.getTransformedGeometryBounds(!0);f&&!Zn.isEmpty(f)&&f.max[0]>=n&&f.min[0]<=a&&f.max[1]>=i&&f.min[1]<=s&&o.push(c)}c.childNodes&&c.childNodes.forEach(function(g){g instanceof ir&&A(g)})}};return A(this.documentElement),o.sort(function(l,c){return c.sortable.renderOrder-l.sortable.renderOrder}),o}},{key:"elementFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,A=this.defaultView.getConfig(),l=A.width,c=A.height;if(s<0||o<0||s>l||o>c)return null;var u=this.defaultView.viewport2Client({x:s,y:o}),h=u.x,d=u.y,f=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!0,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:h,clientY:d},picked:[]}),g=f.picked;return g&&g[0]||this.documentElement}},{key:"elementFromPoint",value:function(){var e=(0,Xa.Z)((0,ii.Z)().mark(function i(a,s){var o,A,l,c,u,h,d,f,g,v,p;return(0,ii.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),A=o.x,l=o.y,c=this.defaultView.getConfig(),u=c.width,h=c.height,!(A<0||l<0||A>u||l>h)){y.next=1;break}return y.abrupt("return",null);case 1:return d=this.defaultView.viewport2Client({x:A,y:l}),f=d.x,g=d.y,y.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!0,position:{x:a,y:s,viewportX:A,viewportY:l,clientX:f,clientY:g},picked:[]});case 2:return v=y.sent,p=v.picked,y.abrupt("return",p&&p[0]||this.documentElement);case 3:case"end":return y.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"elementsFromPointSync",value:function(n,i){var a=this.defaultView.canvas2Viewport({x:n,y:i}),s=a.x,o=a.y,A=this.defaultView.getConfig(),l=A.width,c=A.height;if(s<0||o<0||s>l||o>c)return[];var u=this.defaultView.viewport2Client({x:s,y:o}),h=u.x,d=u.y,f=this.defaultView.getRenderingService().hooks.pickSync.call({topmost:!1,position:{x:n,y:i,viewportX:s,viewportY:o,clientX:h,clientY:d},picked:[]}),g=f.picked;return g[g.length-1]!==this.documentElement&&g.push(this.documentElement),g}},{key:"elementsFromPoint",value:function(){var e=(0,Xa.Z)((0,ii.Z)().mark(function i(a,s){var o,A,l,c,u,h,d,f,g,v,p;return(0,ii.Z)().wrap(function(y){for(;;)switch(y.prev=y.next){case 0:if(o=this.defaultView.canvas2Viewport({x:a,y:s}),A=o.x,l=o.y,c=this.defaultView.getConfig(),u=c.width,h=c.height,!(A<0||l<0||A>u||l>h)){y.next=1;break}return y.abrupt("return",[]);case 1:return d=this.defaultView.viewport2Client({x:A,y:l}),f=d.x,g=d.y,y.next=2,this.defaultView.getRenderingService().hooks.pick.promise({topmost:!1,position:{x:a,y:s,viewportX:A,viewportY:l,clientX:f,clientY:g},picked:[]});case 2:return v=y.sent,p=v.picked,p[p.length-1]!==this.documentElement&&p.push(this.documentElement),y.abrupt("return",p);case 3:case"end":return y.stop()}},i,this)}));function n(i,a){return e.apply(this,arguments)}return n}()},{key:"appendChild",value:function(n,i){throw new Error(aA)}},{key:"insertBefore",value:function(n,i){throw new Error(aA)}},{key:"removeChild",value:function(n,i){throw new Error(aA)}},{key:"replaceChild",value:function(n,i,a){throw new Error(aA)}},{key:"append",value:function(){throw new Error(aA)}},{key:"prepend",value:function(){throw new Error(aA)}},{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)}}])}(pr),qE=function(){function r(t){(0,P.Z)(this,r),this.strategies=t}return(0,N.Z)(r,[{key:"apply",value:function(e){var n=e.config,i=e.camera,a=e.renderingService,s=e.renderingContext,o=this.strategies;a.hooks.cull.tap(r.tag,function(A){if(A){var l,c=A.cullable;if(o.length===0?c.visible=s.unculledEntities.indexOf(A.entity)>-1:c.visible=o.every(function(h){return h.isVisible(i,A)}),!A.isCulled()&&A.isVisible())return A;var u=((l=n.future)===null||l===void 0?void 0:l.experimentalCancelEventPropagation)===!0;return A.dispatchEvent(new Wr(yn.CULLED),u,u),null}return A}),a.hooks.afterRender.tap(r.tag,function(A){A.cullable.visibilityPlaneMask=-1})}}])}();qE.tag="Culling";var $E=function(){function r(){var t=this;(0,P.Z)(this,r),this.autoPreventDefault=!1,this.rootPointerEvent=new uf(null),this.rootWheelEvent=new Bm(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,Ws.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var A=o.value,l=t.bootstrapEvent(t.rootPointerEvent,A,i,e);t.context.eventService.mapEvent(l)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}},this.onClick=function(e){var n,i=(n=t.context.renderingContext.root)===null||n===void 0||(n=n.ownerDocument)===null||n===void 0?void 0:n.defaultView,a=t.normalizeToPointerEvent(e,i),s=(0,Ws.Z)(a),o;try{for(s.s();!(o=s.n()).done;){var A=o.value,l=t.bootstrapEvent(t.rootPointerEvent,A,i,e);t.context.eventService.mapEvent(l)}}catch(c){s.e(c)}finally{s.f()}t.setCursor(t.context.eventService.cursor)}}return(0,N.Z)(r,[{key:"apply",value:function(e){var n=this;this.context=e;var i=e.renderingService,a=this.context.renderingContext.root.ownerDocument.defaultView;this.context.eventService.setPickHandler(function(s){var o=n.context.renderingService.hooks.pickSync.call({position:s,picked:[],topmost:!0}),A=o.picked;return A[0]||null}),i.hooks.pointerWheel.tap(r.tag,function(s){var o=n.normalizeWheelEvent(s);n.context.eventService.mapEvent(o)}),i.hooks.pointerDown.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.normalizeToPointerEvent(s,a);if(n.autoPreventDefault&&o[0].isNormalized){var A=s.cancelable||!("cancelable"in s);A&&s.preventDefault()}var l=(0,Ws.Z)(o),c;try{for(l.s();!(c=l.n()).done;){var u=c.value,h=n.bootstrapEvent(n.rootPointerEvent,u,a,s);n.context.eventService.mapEvent(h)}}catch(d){l.e(d)}finally{l.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerUp.tap(r.tag,function(s){if(!(a.supportsTouchEvents&&s.pointerType==="touch")){var o=n.context.contextService.getDomElement(),A=n.context.eventService.isNativeEventFromCanvas(o,s),l=A?"":"outside",c=n.normalizeToPointerEvent(s,a),u=(0,Ws.Z)(c),h;try{for(u.s();!(h=u.n()).done;){var d=h.value,f=n.bootstrapEvent(n.rootPointerEvent,d,a,s);f.type+=l,n.context.eventService.mapEvent(f)}}catch(g){u.e(g)}finally{u.f()}n.setCursor(n.context.eventService.cursor)}}),i.hooks.pointerMove.tap(r.tag,this.onPointerMove),i.hooks.pointerOver.tap(r.tag,this.onPointerMove),i.hooks.pointerOut.tap(r.tag,this.onPointerMove),i.hooks.click.tap(r.tag,this.onClick),i.hooks.pointerCancel.tap(r.tag,function(s){var o=n.normalizeToPointerEvent(s,a),A=(0,Ws.Z)(o),l;try{for(A.s();!(l=A.n()).done;){var c=l.value,u=n.bootstrapEvent(n.rootPointerEvent,c,a,s);n.context.eventService.mapEvent(u)}}catch(h){A.e(h)}finally{A.f()}n.setCursor(n.context.eventService.cursor)})}},{key:"bootstrapEvent",value:function(e,n,i,a){e.view=i,e.originalEvent=null,e.nativeEvent=a,e.pointerId=n.pointerId,e.width=n.width,e.height=n.height,e.isPrimary=n.isPrimary,e.pointerType=n.pointerType,e.pressure=n.pressure,e.tangentialPressure=n.tangentialPressure,e.tiltX=n.tiltX,e.tiltY=n.tiltY,e.twist=n.twist,this.transferMouseData(e,n);var s=this.context.eventService.client2Viewport({x:n.clientX,y:n.clientY}),o=s.x,A=s.y;e.viewport.x=o,e.viewport.y=A;var l=this.context.eventService.viewport2Canvas(e.viewport),c=l.x,u=l.y;return e.canvas.x=c,e.canvas.y=u,e.global.copyFrom(e.canvas),e.offset.copyFrom(e.canvas),e.isTrusted=a.isTrusted,e.type==="pointerleave"&&(e.type="pointerout"),e.type.startsWith("mouse")&&(e.type=e.type.replace("mouse","pointer")),e.type.startsWith("touch")&&(e.type=xF[e.type]||e.type),e}},{key:"normalizeWheelEvent",value:function(e){var n=this.rootWheelEvent;this.transferMouseData(n,e),n.deltaMode=e.deltaMode,n.deltaX=e.deltaX,n.deltaY=e.deltaY,n.deltaZ=e.deltaZ;var i=this.context.eventService.client2Viewport({x:e.clientX,y:e.clientY}),a=i.x,s=i.y;n.viewport.x=a,n.viewport.y=s;var o=this.context.eventService.viewport2Canvas(n.viewport),A=o.x,l=o.y;return n.canvas.x=A,n.canvas.y=l,n.global.copyFrom(n.canvas),n.offset.copyFrom(n.canvas),n.nativeEvent=e,n.type=e.type,n}},{key:"transferMouseData",value:function(e,n){e.isTrusted=n.isTrusted,e.srcElement=n.srcElement,e.timeStamp=mm.now(),e.type=n.type,e.altKey=n.altKey,e.metaKey=n.metaKey,e.shiftKey=n.shiftKey,e.ctrlKey=n.ctrlKey,e.button=n.button,e.buttons=n.buttons,e.client.x=n.clientX,e.client.y=n.clientY,e.movement.x=n.movementX,e.movement.y=n.movementY,e.page.x=n.pageX,e.page.y=n.pageY,e.screen.x=n.screenX,e.screen.y=n.screenY,e.relatedTarget=null}},{key:"setCursor",value:function(e){this.context.contextService.applyCursorStyle(e||this.context.config.cursor||"default")}},{key:"normalizeToPointerEvent",value:function(e,n){var i=[];if(n.isTouchEvent(e))for(var a=0;a-1,A=0,l=a.length;A=1?Math.ceil(q):1,a&&(R=o||EF(a)||a.width/q,j=A||BF(a)||a.height/q),n.customElements=new HT,n.devicePixelRatio=q,n.requestAnimationFrame=v!=null?v:ym.bind(re.globalThis),n.cancelAnimationFrame=p!=null?p:DE.bind(re.globalThis),n.createImage=y!=null?y:function(){return new window.Image},n.supportsTouchEvents=x!=null?x:"ontouchstart"in re.globalThis,n.supportsPointerEvents=F!=null?F:!!re.globalThis.PointerEvent,n.isTouchEvent=O!=null?O:function(et){return n.supportsTouchEvents&&et instanceof re.globalThis.TouchEvent},n.isMouseEvent=L!=null?L:function(et){return!re.globalThis.MouseEvent||et instanceof re.globalThis.MouseEvent&&(!n.supportsPointerEvents||!(et instanceof re.globalThis.PointerEvent))},f&&(re.offscreenCanvas=f),n.document=new JE,n.document.defaultView=n,u||pF(i,n,d),n.initRenderingContext((0,z.Z)((0,z.Z)({},e),{},{width:R,height:j,background:l!=null?l:"transparent",cursor:c!=null?c:"default",cleanUpOnDestroy:d,devicePixelRatio:q,requestAnimationFrame:n.requestAnimationFrame,cancelAnimationFrame:n.cancelAnimationFrame,createImage:n.createImage,supportsTouchEvents:n.supportsTouchEvents,supportsPointerEvents:n.supportsPointerEvents,isTouchEvent:n.isTouchEvent,isMouseEvent:n.isMouseEvent,dblClickSpeed:U!=null?U:200})),n.initDefaultCamera(R,j,s.clipSpaceNearZ),n.initRenderer(s,!0),n}return(0,_.Z)(t,r),(0,N.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 re.CameraContribution;o.clipSpaceNearZ=a,o.setType(In.EXPLORING,Bc.DEFAULT).setPosition(n/2,i/2,eB).setFocalPoint(n/2,i/2,0).setOrthographic(n/-2,n/2,i/2,i/-2,VT,WT),o.canvas=this,o.eventEmitter.on(Yd.UPDATED,function(){s.context.renderingContext.renderReasons.add(Qc.CAMERA_CHANGED),re.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){re.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;Nn.clearCache();var s=((n=this.getConfig().future)===null||n===void 0?void 0:n.experimentalCancelEventPropagation)===!0;a||this.dispatchEvent(new Wr(La.BEFORE_DESTROY),s,s),this.frameId&&this.cancelAnimationFrame(this.frameId);var o=this.getRoot();i&&(this.unmountChildren(o),this.document.destroy(),this.getEventService().destroy()),this.getRenderingService().destroy(),this.getContextService().destroy(),a||this.dispatchEvent(new Wr(La.AFTER_DESTROY),s,s);var A=function(c){c.currentTarget=null,c.manager=null,c.target=null,c.relatedNode=null};A(vf),A(pf),A(Sm),A(nB),A(Mm),A(to),A(xm),A(Cm),A(XE),re.textService.clearCache()}},{key:"changeSize",value:function(n,i){this.resize(n,i)}},{key:"resize",value:function(n,i){var a,s=this.context.config;s.width=n,s.height=i,this.getContextService().resize(n,i);var o=this.context.camera,A=o.getProjectionMode();o.setPosition(n/2,i/2,eB).setFocalPoint(n/2,i/2,0),A===ea.ORTHOGRAPHIC?o.setOrthographic(n/-2,n/2,i/2,i/-2,o.getNear(),o.getFar()):o.setAspect(n/i);var l=((a=s.future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;this.dispatchEvent(new Wr(La.RESIZE,{width:n,height:i}),l,l)}},{key:"appendChild",value:function(n,i){return this.document.documentElement.appendChild(n,i)}},{key:"insertBefore",value:function(n,i){return this.document.documentElement.insertBefore(n,i)}},{key:"removeChild",value:function(n){return this.document.documentElement.removeChild(n)}},{key:"removeChildren",value:function(){this.document.documentElement.removeChildren()}},{key:"destroyChildren",value:function(){this.document.documentElement.destroyChildren()}},{key:"render",value:function(n){var i,a=this;n&&(Sm.detail=n,Mm.detail=n);var s=((i=this.getConfig().future)===null||i===void 0?void 0:i.experimentalCancelEventPropagation)===!0;this.dispatchEvent(Sm,s,s);var o=this.getRenderingService();o.render(this,n,function(){a.dispatchEvent(nB,s,s)}),this.dispatchEvent(Mm,s,s)}},{key:"run",value:function(){var n=this,i=function(s,o){n.render(o),n.frameId=n.requestAnimationFrame(i)};i()}},{key:"initRenderer",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!n)throw new Error("Renderer is required.");this.inited=!1,this.readyPromise=void 0,this.context.renderingPlugins=[],this.context.renderingPlugins.push(new $E,new tB,new qE([new KT])),this.loadRendererContainerModule(n),this.context.contextService=new this.context.ContextService((0,z.Z)((0,z.Z)({},re),this.context)),this.context.renderingService=new rT(re,this.context),this.context.eventService=new nT(re,this.context),this.context.eventService.init(),this.context.contextService.init?(this.context.contextService.init(),this.initRenderingService(n,a,!0)):this.context.contextService.initAsync().then(function(){i.initRenderingService(n,a)}).catch(function(s){console.error(s)})}},{key:"initRenderingService",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.context.renderingService.init(function(){var o;i.inited=!0;var A=((o=i.getConfig().future)===null||o===void 0?void 0:o.experimentalCancelEventPropagation)===!0;a?s?i.requestAnimationFrame(function(){i.dispatchEvent(new Wr(La.READY),A,A)}):i.dispatchEvent(new Wr(La.READY),A,A):i.dispatchEvent(new Wr(La.RENDERER_CHANGED),A,A),i.readyPromise&&i.resolveReadyPromise(),a||i.getRoot().forEach(function(l){var c,u;(c=(u=l).dirty)===null||c===void 0||c.call(u,!0,!0)}),i.mountChildren(i.getRoot()),n.getConfig().enableAutoRendering&&i.run()})}},{key:"loadRendererContainerModule",value:function(n){var i=this,a=n.getPlugins();a.forEach(function(s){s.context=i.context,s.init(re)})}},{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,G.Z)((a==null?void 0:a.getPlugins())||[]).reverse().forEach(function(s){s.destroy(re)}),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(pf);else{var a,s=((a=this.getConfig().future)===null||a===void 0?void 0:a.experimentalCancelEventPropagation)===!0;pf.target=n,this.dispatchEvent(pf,!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]:lf(n);if(this.inited){if(!n.isConnected&&(n.ownerDocument=this.document,n.isConnected=!0,!a))if(n.isMutationObserved)n.dispatchEvent(vf);else{var s,o=((s=this.getConfig().future)===null||s===void 0?void 0:s.experimentalCancelEventPropagation)===!0;vf.target=n,this.dispatchEvent(vf,!0,o)}}else console.warn("[g]: You are trying to call `canvas.appendChild` before canvas' initialization finished. You can either await `canvas.ready` or listen to `CanvasEvent.READY` manually.","appended child: ",n.nodeName);n.childNodes.forEach(function(A){i.mountChildren(A,a)}),n.isCustomElement&&n.connectedCallback&&n.connectedCallback()}},{key:"mountFragment",value:function(n){this.mountChildren(n,!1)}},{key:"client2Viewport",value:function(n){return this.getEventService().client2Viewport(n)}},{key:"viewport2Client",value:function(n){return this.getEventService().viewport2Client(n)}},{key:"viewport2Canvas",value:function(n){return this.getEventService().viewport2Canvas(n)}},{key:"canvas2Viewport",value:function(n){return this.getEventService().canvas2Viewport(n)}},{key:"getPointByClient",value:function(n,i){return this.client2Viewport({x:n,y:i})}},{key:"getClientByPoint",value:function(n,i){return this.viewport2Client({x:n,y:i})}}])}(KE),j8=0,rB=new WeakMap,iB=null,Z8=null,Y8=null,mf,Oo;function X8(r,t){return mf=new iB(r,t)}function J8(r){return Oo||(Oo=iB.copy(mf),Oo.oldValue=r,Oo)}function q8(){mf=Oo=void 0}function jT(r){return r===Oo||r===mf}function $8(r,t){return r===t?r:Oo&&jT(r)?Oo:null}function ZT(r){r.nodes.forEach(function(t){var e=rB.get(t);e&&e.forEach(function(n){n.observer===r&&n.removeTransientObservers()})})}function tG(r,t){for(var e=r;e;e=e.parentNode){var n=rB.get(e);if(n)for(var i=0;i0&&arguments[0]!==void 0?arguments[0]:r.api;r.rafId&&(e.cancelAnimationFrame(r.rafId),r.rafId=null)}},{key:"executeTask",value:function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:r.api;Nm.length<=0&&Lm.length<=0||(Lm.forEach(function(n){return n()}),Lm=Nm.splice(0,r.TASK_NUM_PER_FRAME),r.rafId=e.requestAnimationFrame(function(){r.executeTask(e)}))}},{key:"sliceImage",value:function(e,n,i,a){for(var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0,o=arguments.length>5&&arguments[5]!==void 0?arguments[5]:r.api,A=e.naturalWidth||e.width,l=e.naturalHeight||e.height,c=n-s,u=i-s,h=Math.ceil(A/c),d=Math.ceil(l/u),f={tileSize:[n,i],gridSize:[d,h],tiles:Array(d).fill(null).map(function(){return Array(h).fill(null)})},g=function(y){for(var x=function(L){Nm.push(function(){var U=L*c,R=y*u,j=[Math.min(n,A-U),Math.min(i,l-R)],q=j[0],et=j[1],it=o.createCanvas();it.width=n,it.height=i;var dt=it.getContext("2d");dt.drawImage(e,U,R,q,et,0,0,q,et),f.tiles[y][L]={x:U,y:R,tileX:L,tileY:y,data:it},a()})},F=0;F1&&arguments[1]!==void 0?arguments[1]:[0,0,0];return"matrix(".concat([e[0],e[1],e[4],e[5],e[12]+n[0],e[13]+n[1]].join(","),")")}},{key:"apply",value:function(e,n){var i=this,a=e.camera,s=e.renderingContext,o=e.renderingService;this.context=e;var A=s.root.ownerDocument.defaultView,l=A.context.eventService.nativeHTMLMap,c=function(p,y){y.style.transform=i.joinTransformMatrix(p.getWorldTransform(),p.getOrigin())},u=function(p){var y=p.target;if(y.nodeName===Kt.HTML){i.$camera||(i.$camera=i.createCamera(a));var x=i.getOrCreateEl(y);i.$camera.appendChild(x),Object.keys(y.attributes).forEach(function(F){i.updateAttribute(F,y)}),c(y,x),l.set(x,y)}},h=function(p){var y=p.target;if(y.nodeName===Kt.HTML&&i.$camera){var x=i.getOrCreateEl(y);x&&(x.remove(),l.delete(x))}},d=function(p){var y=p.target;if(y.nodeName===Kt.HTML){var x=p.attrName;i.updateAttribute(x,y)}},f=function(p){for(var y=p.detail,x=0;x0&&Number(this._currentTime)>=this._totalDuration||this._playbackRate<0&&Number(this._currentTime)<=0)}},{key:"totalDuration",get:function(){return this._totalDuration}},{key:"_needsTick",get:function(){return this.pending||this.playState==="running"||!this._finishedFlag}},{key:"updatePromises",value:function(){var e;if((e=this.effect.target)!==null&&e!==void 0&&e.destroyed)return this.readyPromise=void 0,this.finishedPromise=void 0,!1;var n=this.oldPlayState,i=this.pending?"pending":this.playState;return this.readyPromise&&i!==n&&(i==="idle"?(this.rejectReadyPromise(),this.readyPromise=void 0):n==="pending"?this.resolveReadyPromise():i==="pending"&&(this.readyPromise=void 0)),this.finishedPromise&&i!==n&&(i==="idle"?(this.rejectFinishedPromise(),this.finishedPromise=void 0):i==="finished"?this.resolveFinishedPromise():n==="finished"&&(this.finishedPromise=void 0)),this.oldPlayState=i,this.readyPromise||this.finishedPromise}},{key:"play",value:function(){this.updatePromises(),this._paused=!1,(this._isFinished||this._idle)&&(this.rewind(),this._startTime=null),this._finishedFlag=!1,this._idle=!1,this.ensureAlive(),this.timeline.applyDirtiedAnimation(this),this.timeline.animations.indexOf(this)===-1&&this.timeline.animations.push(this),this.updatePromises()}},{key:"pause",value:function(){this.updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),!this._isFinished&&!this._paused&&!this._idle?this.currentTimePending=!0:this._idle&&(this.rewind(),this._idle=!1),this._startTime=null,this._paused=!0,this.updatePromises()}},{key:"finish",value:function(){this.updatePromises(),!this._idle&&(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this.currentTimePending=!1,this.timeline.applyDirtiedAnimation(this),this.updatePromises())}},{key:"cancel",value:function(){var e=this;if(this.updatePromises(),!!this._inEffect&&(this._inEffect=!1,this._idle=!0,this._paused=!1,this._finishedFlag=!0,this._currentTime=null,this._startTime=null,this.effect.update(null),this.timeline.applyDirtiedAnimation(this),this.updatePromises(),this.oncancel)){var n=new Um(null,this,this.currentTime,null);setTimeout(function(){e.oncancel(n)})}}},{key:"reverse",value:function(){this.updatePromises();var e=this.currentTime;this.playbackRate*=-1,this.play(),e!==null&&(this.currentTime=e),this.updatePromises()}},{key:"updatePlaybackRate",value:function(e){this.playbackRate=e}},{key:"targetAnimations",value:function(){var e,n=(e=this.effect)===null||e===void 0?void 0:e.target;return n.getAnimations()}},{key:"markTarget",value:function(){var e=this.targetAnimations();e.indexOf(this)===-1&&e.push(this)}},{key:"unmarkTarget",value:function(){var e=this.targetAnimations(),n=e.indexOf(this);n!==-1&&e.splice(n,1)}},{key:"tick",value:function(e,n){!this._idle&&!this._paused&&(this._startTime===null?n&&(this.startTime=e-this._currentTime/this.playbackRate):this._isFinished||this.tickCurrentTime((e-this._startTime)*this.playbackRate)),n&&(this.currentTimePending=!1,this.fireEvents(e))}},{key:"rewind",value:function(){if(this.playbackRate>=0)this.currentTime=0;else if(this._totalDuration<1/0)this.currentTime=this._totalDuration;else throw new Error("Unable to rewind negative playback rate animation with infinite duration")}},{key:"persist",value:function(){throw new Error(On)}},{key:"addEventListener",value:function(e,n,i){throw new Error(On)}},{key:"removeEventListener",value:function(e,n,i){throw new Error(On)}},{key:"dispatchEvent",value:function(e){throw new Error(On)}},{key:"commitStyles",value:function(){throw new Error(On)}},{key:"ensureAlive",value:function(){if(this.playbackRate<0&&this.currentTime===0){var e;this._inEffect=!!((e=this.effect)!==null&&e!==void 0&&e.update(-1))}else{var n;this._inEffect=!!((n=this.effect)!==null&&n!==void 0&&n.update(this.currentTime))}!this._inTimeline&&(this._inEffect||!this._finishedFlag)&&(this._inTimeline=!0,this.timeline.animations.push(this))}},{key:"tickCurrentTime",value:function(e,n){e!==this._currentTime&&(this._currentTime=e,this._isFinished&&!n&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this.ensureAlive())}},{key:"fireEvents",value:function(e){var n=this;if(this._isFinished){if(!this._finishedFlag){if(this.onfinish){var i=new Um(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 Um(null,this,this.currentTime,e);this.onframe(a)}this._finishedFlag=!1}}}])}(),sO=4,oO=.001,AO=1e-7,lO=10,lh=11,wf=1/(lh-1),cO=typeof Float32Array=="function",lB=function(t,e){return 1-3*e+3*t},cB=function(t,e){return 3*e-6*t},uB=function(t){return 3*t},Ef=function(t,e,n){return((lB(e,n)*t+cB(e,n))*t+uB(e))*t},hB=function(t,e,n){return 3*lB(e,n)*t*t+2*cB(e,n)*t+uB(e)},uO=function(t,e,n,i,a){var s,o,A=0;do o=e+(n-e)/2,s=Ef(o,i,a)-t,s>0?n=o:e=o;while(Math.abs(s)>AO&&++A=0&&t<=1&&n>=0&&n<=1))throw new Error("bezier x values must be in [0, 1] range");if(t===e&&n===i)return function(A){return A};for(var a=cO?new Float32Array(lh):new Array(lh),s=0;s=oO?hO(l,f,t,n):g===0?f:uO(l,c,c+wf,t,n)};return function(A){return A===0||A===1?A:Ef(o(A),e,i)}},dO=function(t){return t=t.replace(/([A-Z])/g,function(e){return"-".concat(e.toLowerCase())}),t.charAt(0)==="-"?t.substring(1):t},Bf=function(t){return Math.pow(t,2)},bf=function(t){return Math.pow(t,3)},xf=function(t){return Math.pow(t,4)},Cf=function(t){return Math.pow(t,5)},Sf=function(t){return Math.pow(t,6)},Mf=function(t){return 1-Math.cos(t*Math.PI/2)},Ff=function(t){return 1-Math.sqrt(1-t*t)},Tf=function(t){return t*t*(3*t-2)},Of=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)},If=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,H.Z)(e,2),i=n[0],a=i===void 0?1:i,s=n[1],o=s===void 0?.5:s,A=dr(Number(a),1,10),l=dr(Number(o),.1,2);return t===0||t===1?t:-A*Math.pow(2,10*(t-1))*Math.sin((t-1-l/(Math.PI*2)*Math.asin(1/A))*(Math.PI*2)/l)},ch=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,i=(0,H.Z)(e,4),a=i[0],s=a===void 0?1:a,o=i[1],A=o===void 0?100:o,l=i[2],c=l===void 0?10:l,u=i[3],h=u===void 0?0:u;s=dr(s,.1,1e3),A=dr(A,.1,1e3),c=dr(c,.1,1e3),h=dr(h,.1,1e3);var d=Math.sqrt(A/s),f=c/(2*Math.sqrt(A*s)),g=f<1?d*Math.sqrt(1-f*f):0,v=1,p=f<1?(f*d+-h)/g:-h+d,y=n?n*t/1e3:t;return f<1?y=Math.exp(-y*f*d)*(v*Math.cos(g*y)+p*Math.sin(g*y)):y=(v+p*y)*Math.exp(-y*d),t===0||t===1?t:1-y},Dm=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=e,i=(0,H.Z)(n,2),a=i[0],s=a===void 0?10:a,o=i[1],A=o==="start"?Math.ceil:Math.floor;return A(dr(t,0,1)*s)/s},dB=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],n=(0,H.Z)(e,4),i=n[0],a=n[1],s=n[2],o=n[3];return Rm(i,a,s,o)(t)},Nf=Rm(.42,0,1,1),ts=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)}},es=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}},ns=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}},fB={steps:Dm,"step-start":function(t){return Dm(t,[1,"start"])},"step-end":function(t){return Dm(t,[1,"end"])},linear:function(t){return t},"cubic-bezier":dB,ease:function(t){return dB(t,[.25,.1,.25,1])},in:Nf,out:ts(Nf),"in-out":es(Nf),"out-in":ns(Nf),"in-quad":Bf,"out-quad":ts(Bf),"in-out-quad":es(Bf),"out-in-quad":ns(Bf),"in-cubic":bf,"out-cubic":ts(bf),"in-out-cubic":es(bf),"out-in-cubic":ns(bf),"in-quart":xf,"out-quart":ts(xf),"in-out-quart":es(xf),"out-in-quart":ns(xf),"in-quint":Cf,"out-quint":ts(Cf),"in-out-quint":es(Cf),"out-in-quint":ns(Cf),"in-expo":Sf,"out-expo":ts(Sf),"in-out-expo":es(Sf),"out-in-expo":ns(Sf),"in-sine":Mf,"out-sine":ts(Mf),"in-out-sine":es(Mf),"out-in-sine":ns(Mf),"in-circ":Ff,"out-circ":ts(Ff),"in-out-circ":es(Ff),"out-in-circ":ns(Ff),"in-back":Tf,"out-back":ts(Tf),"in-out-back":es(Tf),"out-in-back":ns(Tf),"in-bounce":Of,"out-bounce":ts(Of),"in-out-bounce":es(Of),"out-in-bounce":ns(Of),"in-elastic":If,"out-elastic":ts(If),"in-out-elastic":es(If),"out-in-elastic":ns(If),spring:ch,"spring-in":ch,"spring-out":ts(ch),"spring-in-out":es(ch),"spring-out-in":ns(ch)},fO=function(t){return dO(t).replace(/^ease-/,"").replace(/(\(|\s).+/,"").toLowerCase().trim()},gO=function(t){return fB[fO(t)]||fB.linear},vO=function(t){return t},pO=1,mO=.5,gB=0;function vB(r,t){return function(e){if(e>=1)return 1;var n=1/r;return e+=t*n,e-e%n}}var Lf="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",yO=new RegExp("cubic-bezier\\(".concat(Lf,",").concat(Lf,",").concat(Lf,",").concat(Lf,"\\)")),wO=/steps\(\s*(\d+)\s*\)/,EO=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/;function Pm(r){var t=yO.exec(r);if(t)return Rm.apply(void 0,(0,G.Z)(t.slice(1).map(Number)));var e=wO.exec(r);if(e)return vB(Number(e[1]),gB);var n=EO.exec(r);return n?vB(Number(n[1]),{start:pO,middle:mO,end:gB}[n[2]]):gO(r)}function BO(r){return Math.abs(bO(r)/(r.playbackRate||1))}function bO(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 pB=0,_m=1,kf=2,mB=3;function xO(r,t,e){if(t===null)return pB;var n=e.endTime;return t=Math.min(e.delay+r+e.endDelay,n)?kf:mB}function CO(r,t,e,n,i){switch(n){case _m:return t==="backwards"||t==="both"?0:null;case mB:return e-i;case kf:return t==="forwards"||t==="both"?r:null;case pB:return null}}function SO(r,t,e,n,i){var a=i;return r===0?t!==_m&&(a+=e):a+=n/r,a}function MO(r,t,e,n,i,a){var s=r===1/0?t%1:r%1;return s===0&&e===kf&&n!==0&&(i!==0||a===0)&&(s=1),s}function FO(r,t,e,n){return r===kf&&t===1/0?1/0:e===1?Math.floor(n)-1:Math.floor(n)}function TO(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 OO(r,t,e){var n=xO(r,t,e),i=CO(r,e.fill,t,n,e.delay);if(i===null)return null;var a=e.duration==="auto"?0:e.duration,s=SO(a,n,e.iterations,i,e.iterationStart),o=MO(s,e.iterationStart,n,e.iterations,i,a),A=FO(n,e.iterations,o,s),l=TO(e.direction,A,o);return e.currentIteration=A,e.progress=l,e.easingFunction(l)}function IO(r,t,e){var n=NO(r,t),i=LO(n,e);return function(a,s){if(s!==null)i.filter(function(A){return s>=A.applyFrom&&s1)throw new Error("Keyframe offsets must be between 0 and 1.");l.computedOffset=u}}else if(c==="composite"&&["replace","add","accumulate","auto"].indexOf(u)===-1)throw new Error("".concat(u," compositing is not supported"));l[c]=u}return l.offset===void 0&&(l.offset=null),l.easing===void 0&&(l.easing=(t==null?void 0:t.easing)||"linear"),l.composite===void 0&&(l.composite="auto"),l}),n=!0,i=-1/0,a=0;a=0&&Number(A.offset)<=1});function o(){var A,l=e,c=l.length;if(e[c-1].computedOffset=Number((A=e[c-1].offset)!==null&&A!==void 0?A:1),c>1){var u;e[0].computedOffset=Number((u=e[0].offset)!==null&&u!==void 0?u:0)}for(var h=0,d=Number(e[0].computedOffset),f=1;f90)return this;this.computeMatrix()}return this._getAxes(),this.type===In.ORBITING||this.type===In.EXPLORING?this._getPosition():this.type===In.TRACKING&&this._getFocalPoint(),this._update(),this}},{key:"pan",value:function(n,i){var a=pi(n,i,0),s=Gt(this.position);return de(s,s,Pt(Ot(),this.right,a[0])),de(s,s,Pt(Ot(),this.up,a[1])),this._setPosition(s),this.triggerUpdate(),this}},{key:"dolly",value:function(n){var i=this.forward,a=Gt(this.position),s=n*this.dollyingStep,o=this.distance+n*this.dollyingStep;return s=Math.max(Math.min(o,this.maxDistance),this.minDistance)-this.distance,a[0]+=s*i[0],a[1]+=s*i[1],a[2]+=s*i[2],this._setPosition(a),this.type===In.ORBITING||this.type===In.EXPLORING?this._getDistance():this.type===In.TRACKING&&de(this.focalPoint,a,this.distanceVector),this.triggerUpdate(),this}},{key:"cancelLandmarkAnimation",value:function(){this.landmarkAnimationID!==void 0&&this.canvas.cancelAnimationFrame(this.landmarkAnimationID)}},{key:"createLandmark",value:function(n){var i,a,s,o,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=A.position,c=l===void 0?this.position:l,u=A.focalPoint,h=u===void 0?this.focalPoint:u,d=A.roll,f=A.zoom,g=new re.CameraContribution;g.setType(this.type,void 0),g.setPosition(c[0],(i=c[1])!==null&&i!==void 0?i:this.position[1],(a=c[2])!==null&&a!==void 0?a:this.position[2]),g.setFocalPoint(h[0],(s=h[1])!==null&&s!==void 0?s:this.focalPoint[1],(o=h[2])!==null&&o!==void 0?o:this.focalPoint[2]),g.setRoll(d!=null?d:this.roll),g.setZoom(f!=null?f:this.zoom);var v={name:n,matrix:Ee(g.getWorldTransform()),right:Gt(g.right),up:Gt(g.up),forward:Gt(g.forward),position:Gt(g.getPosition()),focalPoint:Gt(g.getFocalPoint()),distanceVector:Gt(g.getDistanceVector()),distance:g.getDistance(),dollyingStep:g.getDollyingStep(),azimuth:g.getAzimuth(),elevation:g.getElevation(),roll:g.getRoll(),relAzimuth:g.relAzimuth,relElevation:g.relElevation,relRoll:g.relRoll,zoom:g.getZoom()};return this.landmarks.push(v),v}},{key:"gotoLandmark",value:function(n){var i=this,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=gn(n)?this.landmarks.find(function(et){return et.name===n}):n;if(s){var o=ye(a)?{duration:a}:a,A=o.easing,l=A===void 0?"linear":A,c=o.duration,u=c===void 0?100:c,h=o.easingFunction,d=h===void 0?void 0:h,f=o.onfinish,g=f===void 0?void 0:f,v=o.onframe,p=v===void 0?void 0:v,y=.01;this.cancelLandmarkAnimation();var x=s.position,F=s.focalPoint,O=s.zoom,L=s.roll,U=d||re.EasingFunction(l),R,j=function(){i.setFocalPoint(F),i.setPosition(x),i.setRoll(L),i.setZoom(O),i.computeMatrix(),i.triggerUpdate(),g==null||g()};if(u===0)return j();var q=function(it){R===void 0&&(R=it);var dt=it-R;if(dt>=u){j();return}var ft=U(dt/u),mt=Ot(),Rt=Ot(),Qt=1,yt=0;nn(mt,i.focalPoint,F,ft),nn(Rt,i.position,x,ft),yt=i.roll*(1-ft)+L*ft,Qt=i.zoom*(1-ft)+O*ft,i.setFocalPoint(mt),i.setPosition(Rt),i.setRoll(yt),i.setZoom(Qt);var xt=Ba(mt,F)+Ba(Rt,x);if(xt<=y&&O===void 0&&L===void 0)return j();i.computeMatrix(),i.triggerUpdate(),dtft*ft+mt*mt&&(R=q,j=et),{cx:R,cy:j,x0:-c,y0:-u,x1:R*(i/O-1),y1:j*(i/O-1)}}function Io(r,t){return t=t<0&&r>=0?t+JO:t,t-r<=Hm?0:1}var eI=function(r){function t(e){var n;return(0,P.Z)(this,t),n=(0,K.Z)(this,t,[e]),n.updatePath(),n}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"setAttribute",value:function(n,i,a){Ks(t,"setAttribute",this,3)([n,i,a]),["startAngle","endAngle","sr","sr0","radius"].indexOf(n)>-1&&this.updatePath()}},{key:"updatePath",value:function(){var n=this.parsedStyle,i=n.x,a=n.y,s=n.startAngle,o=n.endAngle,A=n.sr,l=n.sr0,c=n.radius,u=this.createPath(i,a,s?Un(s):0,o?Un(o):Math.PI*2,A||0,l||0,c||[0,0,0,0]);Ks(t,"setAttribute",this,3)(["d",u])}},{key:"createPath",value:function(n,i,a,s,o,A,l){if(!(o<=0)){var c=bs(n,i,o,a),u=bs(n,i,o,s),h=bs(n,i,A,a),d=bs(n,i,A,s);if(tA(s-a,Math.PI*2)){var f=bs(n,i,o,a+Math.PI),g=bs(n,i,A,a+Math.PI),v=[["M",c.x,c.y],["A",o,o,0,1,1,f.x,f.y],["A",o,o,0,1,1,u.x,u.y],["M",h.x,h.y]];return A&&(v.push(["A",A,A,0,1,0,g.x,g.y]),v.push(["A",A,A,0,1,0,d.x,d.y])),v.push(["M",c.x,c.y]),v.push(["Z"]),v}var p=s-a,y=o*Qf(a),x=o*uh(a),F=A*Qf(s),O=A*uh(s),L=o*Qf(s),U=o*uh(s),R=A*Qf(a),j=A*uh(a),q=(0,H.Z)(l,4),et=q[0],it=q[1],dt=q[2],ft=q[3],mt=(o-A)/2,Rt=no(mt,et),Qt=no(mt,it),yt=no(mt,dt),xt=no(mt,ft),Dt=Gm(Rt,Qt),Xt=Gm(yt,xt),ne=Dt,le=Xt;if((Dt>Uc||Xt>Uc)&&pUc){var vr=no(et,ne),wa=no(it,ne),Hn=Uf(R,j,y,x,o,vr,kn),Bn=Uf(L,U,F,O,o,wa,kn);if(Cn.push(["M",n+Hn.cx+Hn.x0,i+Hn.cy+Hn.y0]),ne0){var Vi=_i(Hn.y0,Hn.x0),cn=_i(Hn.y1,Hn.x1),Fn=bs(n,i,o,cn);Cn.push(["A",vr,vr,0,Io(Vi,cn),1,Fn.x,Fn.y])}var hn=_i(Hn.cy+Hn.y1,Hn.cx+Hn.x1),Sn=_i(Bn.cy+Bn.y1,Bn.cx+Bn.x1),Rn=bs(n,i,o,Sn);if(Cn.push(["A",o,o,0,Io(hn,Sn),1,Rn.x,Rn.y]),wa>0){var ke=_i(Bn.y1,Bn.x1),Tn=_i(Bn.y0,Bn.x0);Cn.push(["A",wa,wa,0,Io(ke,Tn),1,n+Bn.cx+Bn.x0,i+Bn.cy+Bn.y0])}}}else Cn.push(["M",c.x,c.y]),Cn.push(["A",o,o,0,er,1,u.x,u.y]);if(AUc){var En=no(ft,le),ur=no(dt,le),qe=Uf(F,O,0,0,A-o,ur,kn),Je=Uf(0,0,R,j,A-o,En,kn);if(Cn.push(["L",n+qe.cx+qe.x0,i+qe.cy+qe.y0]),le0){var zo=_i(qe.y0,qe.x0),Ko=_i(qe.y1,qe.x1),Bi=bs(n,i,A-o,Ko);Cn.push(["A",ur,ur,0,Io(zo,Ko),1,Bi.x,Bi.y])}var Ea=_i(qe.cy+qe.y1,qe.cx+qe.x1),Ga=_i(Je.cy+Je.y1,Je.cx+Je.x1),za=bs(n,i,A,Ga);if(Cn.push(["A",A,A,0,Io(Ga,Ea),0,za.x,za.y]),Cn.push(["L",za.x,za.y]),En>0){var Ni=_i(Je.y1,Je.x1),Ka=_i(Je.y0,Je.x0);Cn.push(["A",En,En,0,Io(Ni,Ka),1,n+Je.cx+Je.x0,i+Je.cy+Je.y0])}}}else Cn.push(["L",d.x,d.y]),Cn.push(["A",A,A,0,er,0,h.x,h.y]);return Cn.push(["Z"]),Cn}}}])}(Pi);eI.PARSED_STYLE_LIST=new Set([].concat((0,G.Z)(Pi.PARSED_STYLE_LIST),["x","y","sr","sr0","radius","startAngle","endAngle"]));var MB=function(r){return Re(r)?"":r.toString()},nI=function(r){var t=MB(r);return t.charAt(0).toUpperCase()+t.substring(1)},Rf=nI,rI=function(r){return typeof r=="object"&&r!==null},zm=rI,iI=function(r){return r!==null&&typeof r!="function"&&isFinite(r.length)},dh=iI,Km=function(r,t){if(r===t)return!0;if(!r||!t||gn(r)||gn(t))return!1;if(dh(r)||dh(t)){if(r.length!==t.length)return!1;for(var e=!0,n=0;n{!va.mute&&console.debug(ko(r))},info:r=>{!va.mute&&console.info(ko(r))},warn:r=>{!va.mute&&console.warn(ko(r))},error:r=>{!va.mute&&console.error(ko(r))}};function FB(r){const{theme:t}=r;if(!t)return{};const e=Lo(fh.THEME,t);return e||(va.warn(`The theme of ${t} is not registered.`),{})}function Wm(r,t){if(Array.isArray(r)&&r.length===0)return null;const e=Array.isArray(r)?r[0]:r,n=Array.isArray(r)?r.slice(1):t||[];return new Proxy(e,{get(i,a){return typeof i[a]=="function"&&!["onframe","onfinish"].includes(a)?(...s)=>{i[a](...s),n.forEach(o=>{var A;return(A=o[a])===null||A===void 0?void 0:A.call(o,...s)})}:a==="finished"?Promise.all([e.finished,...n.map(s=>s.finished)]):Reflect.get(i,a)},set(i,a,s){return["onframe","onfinish"].includes(a)||n.forEach(o=>{o[a]=s}),Reflect.set(i,a,s)}})}function jm(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=>Re(a))||i.every(a=>!["sourceNode","targetNode","childrenNode"].includes(n)&&Pr(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 gh(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 TB(r,t){const{animation:e}=r;if(e===!1||t===!1)return!1;const n=Object.assign({},aI);return br(e)&&Object.assign(n,e),br(t)&&Object.assign(n,t),n}function lI(r){if(typeof r=="string"){const t=Lo(fh.ANIMATION,r);return t||(va.warn(`The animation of ${r} is not registered.`),[])}return r}function cI(r,t,e,n){var i,a;const{animation:s}=r;if(s===!1||n===!1)return[];const o=(i=r==null?void 0:r[t])===null||i===void 0?void 0:i.animation;if(o===!1)return[];const A=o==null?void 0:o[e];if(A===!1)return[];const l=(a=FB(r)[t])===null||a===void 0?void 0:a.animation,c=(h=[])=>lI(h).map(d=>Object.assign(Object.assign(Object.assign(Object.assign({},sI),br(s)&&s),d),br(n)&&n));if(A)return c(A);if(!l)return[];const u=l[e];return u===!1?[]:c(u)}function OB(r,t,e,n=[]){if(!n&&r===0&&t===0&&e===0)return null;if(Array.isArray(n)){let a=-1;const s=[];for(let o=0;o{if(!e.length)return null;const[n,i]=t,a=l=>{var c;if(l){const u=r.getShape(l);if(!u)return null;const h=`get${Rf(l)}Style`,d=((c=r==null?void 0:r[h])===null||c===void 0?void 0:c.bind(r))||(v=>v),f=(d==null?void 0:d(n))||{},g=(d==null?void 0:d(i))||{};return{shape:u,fromStyle:f,toStyle:g}}else return{shape:r,fromStyle:n,toStyle:i}};let s;const o=e.map(l=>{var{fields:c,shape:u,states:h}=l,d=uI(l,["fields","shape","states"]);const f=a(u);if(!f)return null;const{shape:g,fromStyle:v,toStyle:p}=f,y=[{},{}];if(c.forEach(F=>{var O,L;Object.assign(y[0],{[F]:(O=v[F])!==null&&O!==void 0?O:gh(F)}),Object.assign(y[1],{[F]:(L=p[F])!==null&&L!==void 0?L:gh(F)})}),y.some(F=>Object.keys(F).some(O=>["x","y","z"].includes(O)))){const{x:F=0,y:O=0,z:L,transform:U=""}=g.attributes||{};y.forEach(R=>{var j,q,et;R.transform=OB((j=R.x)!==null&&j!==void 0?j:F,(q=R.y)!==null&&q!==void 0?q:O,(et=R.z)!==null&&et!==void 0?et:L,U)})}const x=g.animate(jm(y),d);return u===void 0&&(s=x),x}).filter(Boolean),A=s||(o==null?void 0:o[0]);return A?Wm(A,o.filter(l=>l!==l)):null},dI=[{fields:["opacity"]}],fI=[{fields:["x","y"]}],IB=[{fields:["x","y"]}],gI=IB,NB=[{fields:["sourceNode","targetNode"]}],vI=NB,LB=[{fields:["childrenNode","x","y"]}],pI=LB,uG=[{fields:["childrenNode","x","y"]}];var mI=Object.prototype.hasOwnProperty;function yI(r,t){if(!t||!Qi(r))return{};for(var e={},n=Vt(t)?t:function(o){return o[t]},i,a=0;at?(n&&(clearTimeout(n),n=null),o=c,s=r.apply(i,a),n||(i=a=null)):!n&&e.trailing!==!1&&(n=setTimeout(A,u)),s};return l.cancel=function(){clearTimeout(n),o=0,n=i=a=null},l},Zm=function(r){if(typeof r!="object"||r===null)return r;var t;if(Qi(r)){t=[];for(var e=0,n=r.length;etypeof t=="number"):!1}function ro(r,t,e){return r>=t&&r<=e}function Ua(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 BI(r=0){const t=Ua(r);return t[0]+t[2]}function dG(r=0){const t=Ua(r);return t[1]+t[3]}function io(r){return r.max[0]-r.min[0]}function ao(r){return r.max[1]-r.min[1]}function yA(r){return[io(r),ao(r)]}function wA(r,t){const e=Pc(r)?Ym(r):r.getShape("key").getBounds();return t?EA(e,t):e}function Ym(r){const[t,e,n=0]=r,i=new Zn;return i.setMinMax([t,e,n],[t,e,n]),i}function EA(r,t){const[e,n,i,a]=Ua(t),[s,o,A]=r.min,[l,c,u]=r.max,h=new Zn;return h.setMinMax([s-a,o-e,A],[l+n,c+i,u]),h}function vh(r){if(r.length===0)return new Zn;if(r.length===1)return r[0];const t=new Zn;t.setMinMax(r[0].min,r[0].max);for(let e=1;e=s&&i<=A&&n>=o&&a<=l}function xs(r,t){return ro(r[0],t.min[0],t.max[0])&&ro(r[1],t.min[1],t.max[1])}function QB(r,t,e=!1){const{min:[n,i],max:[a,s]}=t,o=(r[1]===i||r[1]===s)&&(e||ro(r[0],n,a)),A=(r[0]===n||r[0]===a)&&(e||ro(r[1],i,s));return o||A}function xI(r,t){return!xs(r,t)}function _f(r,t){const{center:e}=t;return r[0]===e[0]&&r[1]===e[1]}function ph(r,t){const[e,n]=r,[i,a]=t.min,[s,o]=t.max,A=e-i,l=s-e,c=n-a,u=o-n,h=Math.min(A,l,c,u);return h===A?"left":h===l?"right":h===c?"top":h===u?"bottom":"left"}function wl(r,t){const e=Dc(r);if(xs(r,t))switch(ph(r,t)){case"left":e[0]=t.min[0];break;case"right":e[0]=t.max[0];break;case"top":e[1]=t.min[1];break;case"bottom":e[1]=t.max[1];break}else{const[n,i]=r,[a,s]=t.min,[o,A]=t.max;e[0]=ro(n,a,o)?n:n0&&d(O[0])}},p=0;p0;)h.push(A.pop());s.push(h)}}return s},PB=function(t){for(var e=t.nodes,n=e===void 0?[]:e,i=t.edges,a=i===void 0?[]:i,s=[],o={},A={},l={},c=[],u=0,h=function v(p){A[p.id]=u,l[p.id]=u,u+=1,s.push(p),o[p.id]=!0;for(var y=is(p.id,a,"target").filter(function(U){return n.map(function(R){return R.id}).indexOf(U)>-1}),x=function(R){var j=y[R];if(!A[j]&&A[j]!==0){var q=n.filter(function(et){return et.id===j});q.length>0&&v(q[0]),l[p.id]=Math.min(l[p.id],l[j])}else o[j]&&(l[p.id]=Math.min(l[p.id],A[j]))},F=0;F0;){var L=s.pop();if(o[L.id]=!1,O.push(L),L===p)break}O.length>0&&c.push(O)}},d=0,f=n;d0;)for(var v=d.pop(),p=v.id,y=is(p,t.edges),x=function(L){var U,R=y[L],j=t.nodes.find(function(mt){return mt.id===R});if(R===p)s.push((U={},U[R]=v,U));else if(!(R in g))f[R]=v,d.push(j),g[R]=new Set([v]);else if(!g[p].has(j)){for(var q=!0,et=[j,v],it=f[p];g[R].size&&!g[R].has(it)&&(et.push(it),it!==f[it.id]);)it=f[it.id];if(et.push(it),e&&n?(q=!1,et.findIndex(function(mt){return e.indexOf(mt.id)>-1})>-1&&(q=!0)):e&&!n&&et.findIndex(function(mt){return e.indexOf(mt.id)>-1})>-1&&(q=!1),q){for(var dt={},ft=1;ft0;){var ft=dt.pop();a.has(ft)&&(a.delete(ft),s[ft.id].forEach(function(mt){dt.push(mt)}),s[ft.id].clear())}},u=function et(it,dt,ft){var mt=!1;if(e&&n===!1&&e.indexOf(it.id)>-1)return mt;i.push(it),a.add(it);for(var Rt=ft[it.id],Qt=0;Qt-1});le-1)?o.push((dt={},dt[ne.id]=ne,dt)):Xt[ne.id].push(l[xe])}}return{component:Dt,adjList:Xt,minIdx:mt}},x=0;x=x}),O=PB({nodes:F,edges:t.edges}).filter(function(et){return et.length>1});if(O.length===0)break;var L=y(O),U=L.minIdx,R=L.adjList,j=L.component;if(j.length>1){j.forEach(function(et){s[et.id]=new Set});var q=A[U];if(e&&n&&e.indexOf(q.id)===-1)return o;u(q,q,R),x=U+1}else break}return o},GI=function(t,e,n,i){return i===void 0&&(i=!0),e?KB(t,n,i):zB(t,n,i)},VB=HI,zI={}.toString,KI=function(r,t){return zI.call(r)==="[object "+t+"]"},zf=KI,Jm=function(r){return zf(r,"Function")},qm=function(r){return Array.isArray?Array.isArray(r):zf(r,"Array")},VI=function(r){var t=typeof r;return r!==null&&t==="object"||t==="function"};function WI(r,t){if(r){var e;if(qm(r))for(var n=0,i=r.length;n-1;)ZI.call(r,a,1);return r},NG=null,XI=Array.prototype.splice,LG=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,XI.call(t,s,1))}return t},kG=null,QG=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},UG=null,RG=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},u9=null,h9=function(r,t){if(isArray(r)){for(var e,n=-1/0,i=0;in&&(e=a,n=s)}return e}},d9=function(r,t){if(isArray(r)){for(var e,n=1/0,i=0;io&&c>o);)if(A.push(l),o-=c,s=s.substr(i),!s)return A.join("");for(;l=s.substr(0,1),c=measureTextWidth(l,e),!(c+a>o);)if(A.push(l),o-=c,s=s.substr(1),!s)return A.join("");return""+A.join("")+n},J9=function(){function r(){this.map={}}return r.prototype.has=function(t){return this.map[t]!==void 0},r.prototype.get=function(t,e){var n=this.map[t];return n===void 0?e:n},r.prototype.set=function(t,e){this.map[t]=e},r.prototype.clear=function(){this.map={}},r.prototype.delete=function(t){delete this.map[t]},r.prototype.size=function(){return Object.keys(this.map).length},r}(),q9=null,dN=function(t,e,n){for(var i=1/0,a,s=0;su[O.id]+it?(u[et]=u[O.id]+it,h[et]=[O.id]):u[et]===u[O.id]+it&&h[et].push(O.id)})},g=0;g0&&c.length>0;){var d=c[c.length-1];if(d.length){var f=d.shift();f&&(A.push(f),l[f]=!0,h=i?is(f,o,"target"):is(f,o),c.push(h.filter(function(p){return!l[p]})))}else{var g=A.pop();l[g]=!1,c.pop();continue}if(A[A.length-1]===n){var v=A.map(function(y){return y});u.push(v);var g=A.pop();l[g]=!1,c.pop()}}return u},vN=function(t,e){for(var n=Hf(t,e),i=[],a=n.length,s=0;si[s][A]+i[A][o]&&(i[s][o]=i[s][A]+i[A][o]);return i},iy=vN,pN=function(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e3);var a=t.nodes,s=a===void 0?[]:a,o=t.edges,A=o===void 0?[]:o,l={},c={};s.forEach(function(F,O){var L=DB();F.clusterId=L,l[L]={id:L,nodes:[F]},c[F.id]={node:F,idx:O}});var u=Hf(t,e),h=[],d={};u.forEach(function(F,O){var L=0,U=s[O].id;d[U]={},F.forEach(function(R,j){if(R){L+=R;var q=s[j].id;d[U][q]=R}}),h.push(L)});for(var f=0,g=function(){var O=!1;if(s.forEach(function(L){var U={};Object.keys(d[L.id]).forEach(function(mt){var Rt=d[L.id][mt],Qt=c[mt].node,yt=Qt.clusterId;U[yt]||(U[yt]=0),U[yt]+=Rt});var R=-1/0,j=[];if(Object.keys(U).forEach(function(mt){R=0&&j.splice(q,1),j&&j.length){O=!0;var et=l[L.clusterId],it=et.nodes.indexOf(L);et.nodes.splice(it,1);var dt=Math.floor(Math.random()*j.length),ft=l[j[dt]];ft.nodes.push(L),L.clusterId=ft.id}}}),!O)return"break";f++};f0&&R>j&&R-jj&&(et=u.map(function(xt){return{node:xt,clusterId:xt.clusterId}}),it=yh(y),j=R),dt||q>100)break;q++,Object.keys(y).forEach(function(xt){var Dt=0;d.forEach(function(Xt){var ne=Xt.source,le=Xt.target,ge=x[ne].node.clusterId,xe=x[le].node.clusterId;(ge===xt&&xe!==xt||xe===xt&&ge!==xt)&&(Dt=Dt+(Xt[n]||1))}),y[xt].sumTot=Dt}),u.forEach(function(xt,Dt){var Xt=y[xt.clusterId],ne=0,le,ge=O[Dt]/(2*U),xe=0,Qe=Xt.nodes;Qe.forEach(function(Hn){var Bn=x[Hn.id].idx;xe+=F[Dt][Bn]||0});var Pe=xe-Xt.sumTot*ge,en=Qe.filter(function(Hn){return Hn.id!==xt.id}),mn=[];en.forEach(function(Hn,Bn){mn[Bn]=f[Hn.originIndex]});var an=sy(en,f)*l,er=L[xt.id];if(Object.keys(er).forEach(function(Hn){var Bn=x[Hn].node,Us=Bn.clusterId;if(Us!==xt.clusterId){var hi=y[Us],Vi=hi.nodes;if(!(!Vi||!Vi.length)){var cn=0;Vi.forEach(function(Tn){var En=x[Tn.id].idx;cn+=F[Dt][En]||0});var Fn=cn-hi.sumTot*ge,hn=Vi.concat([xt]),Sn=[];hn.forEach(function(Tn,En){Sn[En]=f[Tn.originIndex]});var Rn=sy(hn,f)*l,ke=Fn-Pe;a&&(ke=Fn+Rn-(Pe+an)),ke>ne&&(ne=ke,le=hi)}}}),ne>0){le.nodes.push(xt);var kn=xt.clusterId;xt.clusterId=le.id;var Cn=Xt.nodes.indexOf(xt);Xt.nodes.splice(Cn,1);var vr=0,wa=0;d.forEach(function(Hn){var Bn=Hn.source,Us=Hn.target,hi=x[Bn].node.clusterId,Vi=x[Us].node.clusterId;(hi===le.id&&Vi!==le.id||Vi===le.id&&hi!==le.id)&&(vr=vr+(Hn[n]||1)),(hi===kn&&Vi!==kn||Vi===kn&&hi!==kn)&&(wa=wa+(Hn[n]||1))}),le.sumTot=vr,Xt.sumTot=wa}})}var ft={},mt=0;Object.keys(it).forEach(function(xt){var Dt=it[xt];if(!Dt.nodes||!Dt.nodes.length){delete it[xt];return}var Xt=String(mt+1);Xt!==xt&&(Dt.id=Xt,Dt.nodes=Dt.nodes.map(function(ne){return{id:ne.id,clusterId:Xt}}),it[Xt]=Dt,ft[xt]=Xt,delete it[xt],mt++)}),et.forEach(function(xt){var Dt=xt.node,Xt=xt.clusterId;Dt&&(Dt.clusterId=Xt,Dt.clusterId&&ft[Dt.clusterId]&&(Dt.clusterId=ft[Dt.clusterId]))});var Rt=[],Qt={};d.forEach(function(xt){var Dt=xt.source,Xt=xt.target,ne=xt[n]||1,le=x[Dt].node.clusterId,ge=x[Xt].node.clusterId;if(!(!le||!ge)){var xe="".concat(le,"---").concat(ge);if(Qt[xe])Qt[xe].weight+=ne,Qt[xe].count++;else{var Qe={source:le,target:ge,weight:ne,count:1};Qt[xe]=Qe,Rt.push(Qe)}}});var yt=[];return Object.keys(it).forEach(function(xt){yt.push(it[xt])}),{clusters:yt,clusterEdges:Rt}},nb=xN,CN=function(t,e,n,i,a,s,o,A){return e===void 0&&(e=!1),n===void 0&&(n="weight"),i===void 0&&(i=1e-4),a===void 0&&(a=void 0),s===void 0&&(s=[]),o===void 0&&(o=["id"]),A===void 0&&(A=1),nb(t,e,n,i,!0,a,s,o,A)},SN=CN,MN=function(t,e){var n;e===void 0&&(e=1);for(var i=yh(t),a=i.nodes,s=a===void 0?[]:a,o=i.edges,A=o===void 0?[]:o,l=function(){var h=Xm({nodes:s,edges:A}),d=Object.keys(h);d.sort(function(v,p){var y,x;return((y=h[v])===null||y===void 0?void 0:y.degree)-((x=h[p])===null||x===void 0?void 0:x.degree)});var f=d[0];if(!s.length||((n=h[f])===null||n===void 0?void 0:n.degree)>=e)return"break";var g=s.findIndex(function(v){return v.id===f});s.splice(g,1),A=A.filter(function(v){return!(v.source===f||v.target===f)})};;){var c=l();if(c==="break")break}return{nodes:s,edges:A}},FN=MN,rb=function(t,e,n){var i=[];switch(t){case Cs.EuclideanDistance:i=e[n];break;default:i=[];break}return i},TN=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=Cs.EuclideanDistance);var o=t.nodes,A=o===void 0?[]:o,l=t.edges,c=l===void 0?[]:l,u={clusters:[{id:"0",nodes:A}],clusterEdges:[]};if(s===Cs.EuclideanDistance&&!A.every(function(Xt){return Xt.hasOwnProperty(n)}))return u;var h=[],d=[];if(s===Cs.EuclideanDistance&&(h=jf(A,n),d=Zf(h,i,a)),!d.length)return u;for(var f=ty(d.map(function(Xt){return Xt.join("")})),g=Math.min(e,A.length,f.length),v=0;vO&&!p.find(function(en){return uN(en,rb(s,d,A[le].originIndex))})&&(O=Pe,L=le)}},R=0;R=0;ft--)x[Number(A[v].clusterId)][ft].id===A[v].id&&x[Number(A[v].clusterId)].splice(ft,1);A[v].clusterId=String(q),x[q].push(A[v])}}for(var mt=!1,v=0;v=1e3)break}var xt=[],Dt={};return c.forEach(function(Xt){var ne,le,ge=Xt.source,xe=Xt.target,Qe=(ne=A.find(function(an){return an.id===ge}))===null||ne===void 0?void 0:ne.clusterId,Pe=(le=A.find(function(an){return an.id===xe}))===null||le===void 0?void 0:le.clusterId,en="".concat(Qe,"---").concat(Pe);if(Dt[en])Dt[en].count++;else{var mn={source:Qe,target:Pe,count:1};Dt[en]=mn,xt.push(mn)}}),{clusters:x,clusterEdges:xt}},ON=TN,IN=function(t,e){var n=new as(e),i=n.norm2(),a=new as(t),s=a.norm2(),o=n.dot(a),A=i*s,l=A?o/A:0;return l},ib=IN,NN=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=yh(t.filter(function(h){return h.id!==e.id})),o=t.findIndex(function(h){return h.id===e.id}),A=jf(t,n),l=Zf(A,i,a),c=l[o],u=[];return s.forEach(function(h,d){if(h.id!==e.id){var f=l[d],g=ib(f,c);u.push(g),h.cosineSimilarity=g}}),s.sort(function(h,d){return d.cosineSimilarity-h.cosineSimilarity}),{allCosineSimilarity:u,similarNodes:s}},LN=NN,kN=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}(),DN=RN,PN=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,s=t.edges,o=s===void 0?[]:s;if(a.length===0)return n;var A=a[0],l=new Set;l.add(A);var c=function(v,p){return e?v.weight-p.weight:0},u=new DN(c);for(Gf(A.id,o).forEach(function(g){u.insert(g)});!u.isEmpty();){var h=u.delMin(),d=h.source,f=h.target;l.has(d)&&l.has(f)||(n.push(h),l.has(d)||(l.add(d),Gf(d,o).forEach(function(g){u.insert(g)})),l.has(f)||(l.add(f),Gf(f,o).forEach(function(g){u.insert(g)})))}return n},ab=function(t,e){var n=[],i=t.nodes,a=i===void 0?[]:i,s=t.edges,o=s===void 0?[]:s;if(a.length===0)return n;var A=o.map(function(d){return d});e&&A.sort(function(d,f){return d.weight-f.weight});for(var l=new QN(a.map(function(d){return d.id}));A.length>0;){var c=A.shift(),u=c.source,h=c.target;l.connected(u,h)||(n.push(c),l.union(u,h))}return n},_N=function(t,e,n){var i={prim:PN,kruskal:ab};return n?i[n](t,e):ab(t,e)},HN=_N,GN=function(t,e,n){typeof e!="number"&&(e=1e-6),typeof n!="number"&&(n=.85);for(var i=1,a=0,s=1e3,o=t.nodes,A=o===void 0?[]:o,l=t.edges,c=l===void 0?[]:l,u=A.length,h,d={},f={},g=0;g0&&i>e;){a=0;for(var g=0;g0&&(h+=f[O]/L)}d[p]=n*h,a+=d[p]}}a=(1-a)/u,i=0;for(var g=0;g=0;n--){var i=this.dfsEdgeList[n],a=i.fromNode,s=i.toNode;ad||i.hasNode(s[h.to])||(e.labelx;O--){var L=F(O);if(L==="break")break}if(p){var U=t.findMinLabel(v);s.dfsEdgeList.push(new El(g,y,so,U.edgeLabel,so));var R=s.dfsEdgeList.length-1;return t.dfsCode.dfsEdgeList[R]!==s.dfsEdgeList[R]?!1:u(v[U.edgeLabel].projected)}var j={};p=!1;var q=0;h.forEach(function(Rt){var Qt=new Xf(Rt),yt=t.findForwardPureEdges(i,Qt.edges[d[0]],f,Qt);yt.length>0&&(p=!0,q=g,yt.forEach(function(xt){var Dt="".concat(xt.label,"-").concat(a[xt.to].label);j[Dt]||(j[Dt]={projected:[],edgeLabel:xt.label,nodeLabel2:a[xt.to].label}),j[Dt].projected.push({graphId:i.id,edge:xt,preNode:Rt})}))});for(var et=d.length,it=function(Qt){if(p)return"break";var yt=d[Qt];h.forEach(function(xt){var Dt=new Xf(xt),Xt=t.findForwardRmpathEdges(i,Dt.edges[yt],f,Dt);Xt.length>0&&(p=!0,q=s.dfsEdgeList[yt].fromNode,Xt.forEach(function(ne){var le="".concat(ne.label,"-").concat(a[ne.to].label);j[le]||(j[le]={projected:[],edgeLabel:ne.label,nodeLabel2:a[ne.to].label}),j[le].projected.push({graphId:i.id,edge:ne,preNode:xt})}))})},O=0;O=0;f--){var g=e.findBackwardEdge(u,d.edges[a[f]],d.edges[a[0]],d);if(g){var v="".concat(e.dfsCode.dfsEdgeList[a[f]].fromNode,"-").concat(g.label);l[v]||(l[v]={projected:[],toNodeId:e.dfsCode.dfsEdgeList[a[f]].fromNode,edgeLabel:g.label}),l[v].projected.push({graphId:c.graphId,edge:g,preNode:c})}}if(!(i>=e.maxNodeNum)){var p=e.findForwardPureEdges(u,d.edges[a[0]],o,d);p.forEach(function(x){var F="".concat(s,"-").concat(x.label,"-").concat(h[x.to].label);A[F]||(A[F]={projected:[],fromNodeId:s,edgeLabel:x.label,nodeLabel2:h[x.to].label}),A[F].projected.push({graphId:c.graphId,edge:x,preNode:c})});for(var y=function(F){var O=e.findForwardRmpathEdges(u,d.edges[a[F]],o,d);O.forEach(function(L){var U="".concat(e.dfsCode.dfsEdgeList[a[F]].fromNode,"-").concat(L.label,"-").concat(h[L.to].label);A[U]||(A[U]={projected:[],fromNodeId:e.dfsCode.dfsEdgeList[a[F]].fromNode,edgeLabel:L.label,nodeLabel2:h[L.to].label}),A[U].projected.push({graphId:c.graphId,edge:L,preNode:c})})},f=0;fx){var F=x;x=y,y=F}var O=p.label,L="".concat(l,"-").concat(y,"-").concat(O,"-").concat(x),U="".concat(y,"-").concat(O,"-").concat(x);if(!s[U]){var R=s[U]||0;R++,s[U]=R}A[L]={graphId:l,nodeLabel1:y,edgeLabel:O,nodeLabel2:x}})})}),Object.keys(a).forEach(function(l){var c=a[l];if(!(c2*e)););if(v<2*e&&(o["".concat(c,"-").concat(g)]={start:c,end:g,distance:a[c][g]},u++,A++,A>=n))return o;if(h++,h>2*e)break}if(uh&&(A=h);var d=n[u.id].inDegree;l>d&&(l=d);var f=n[u.id].outDegree;c>f&&(c=f)}),t[e]={degree:A,inDegree:l,outDegree:c}),{minPatternNodeLabelDegree:A,minPatternNodeLabelInDegree:l,minPatternNodeLabelOutDegree:c}},$N=function(t,e,n,i,a,s,o){var A;if(n===void 0&&(n=!1),s===void 0&&(s="cluster"),o===void 0&&(o="cluster"),!(!t||!t.nodes)){var l=t.nodes.length;if(l){var c=iy(t,n),u=iy(e,n),h=pb(t.nodes,c,n),d=pb(e.nodes,u,n),f=gb(t.nodes,s),g=f.nodeMap,v=f.nodeLabelMap,p=gb(e.nodes,s),y=p.nodeMap,x=p.nodeLabelMap;vb(t.edges,o,g);var F=vb(e.edges,o,y).edgeLabelMap,O=[];u==null||u.forEach(function(cn){O=O.concat(cn)}),a||(a=Math.max.apply(Math,(0,D.ev)((0,D.ev)([],O,!1),[2],!1))),i||(i=a);var L=db(t,c,s,i),U=db(e,u,s,i),R=Math.min(100,l*(l-1)/2),j=XN(i,l,R,L,c),q=Jf(j,L,t),et=10,it=1,dt=1,ft=4,mt={graphs:q,nodeLabelProp:s,edgeLabelProp:o,minSupport:it,minNodeNum:dt,maxNodeNum:ft,directed:n},Rt=YN(mt).slice(0,et),Qt=Rt.length,yt=[];Rt.forEach(function(cn,Fn){yt[Fn]={},Object.keys(q).forEach(function(hn){var Sn=q[hn],Rn=qf(Sn,cn,s,o);yt[Fn][hn]=Rn})});var xt=JN(yt,Qt,Rt),Dt=xt.structure,Xt=xt.structureCountMap,ne=e.nodes[0],le=[],ge=(A=e.nodes[0])===null||A===void 0?void 0:A[s],xe=-1/0;e.nodes.forEach(function(cn){var Fn=cn[s],hn=v[Fn];(hn==null?void 0:hn.length)>xe&&(xe=hn.length,le=hn,ge=Fn,ne=cn)});var Qe={},Pe={},en={},mn={},an={},er={};Object.keys(x).forEach(function(cn,Fn){an[cn]=[],n&&(er[cn]=[]);var hn=-1/0,Sn=x[cn],Rn={};Sn.forEach(function(qe){var Je=d["".concat(ne.id,"-").concat(qe.id)];if(Je&&an[cn].push(Je),hnan[cn][Bi]){Ko=!0;break}if(Ko)return le.splice(Je,1),"continue";var Ea={};Wi.neighbors.forEach(function(Ni){var Ka=h["".concat(mr.id,"-").concat(Ni.id)];Ea["".concat(mr.id,"-").concat(Ni.id)]={start:g[mr.id].idx,end:g[Ni.id].idx,distance:Ka}}),q=Jf(Ea,L,t,q);var Ga=[];Object.keys(Ea).forEach(function(Ni){if(Xt[Ni]){Ga.push(Xt[Ni]);return}var Ka=q[Ni];Xt[Ni]=qf(Ka,Dt,s,o),Ga.push(Xt[Ni])}),Ga=Ga.sort(function(Ni,Ka){return Ka-Ni});for(var za=!1,Bi=0;Bi=0;ur--)En(ur)});var kn=[];le==null||le.forEach(function(cn){for(var Fn=g[cn.id].idx,hn=fb(t.nodes,c[Fn],Fn,s,a),Sn=hn.neighbors,Rn=Sn.length,ke=!1,Tn=Rn-1;Tn>=0;Tn--){if(Sn.length+1Wi){Sn.splice(Tn,1);continue}if(n){var yr="".concat(En.id,"-").concat(cn.id),zo=h[yr];mr=er[ur].length-1;var Ko=er[ur][mr];if(zo>Ko){Sn.splice(Tn,1);continue}}var Bi=Xt[qe]?Xt[qe]:qN(t,cn,En,g,Je,L,Dt,s,o,Xt,q),Ea="".concat(ne.id,"-").concat(ur),Ga=mn[Ea][mn[Ea].length-1];if(Bi=0;Je--){var Ko=zo(Je);if(Ko==="break")break}if(yr)return kn.splice(Fn,1),"continue";hn.edges=Tn;var Bi=Wf(hn,hn.nodes[0].id,!1).length;if(Object.keys(Bi).reverse().forEach(function(hr){if(!(hr===hn.nodes[0].id||yr)){if(Bi[hr]===1/0){var Va=ke[hr].node[s];if(Rn[Va]--,Rn[Va]vr[uo][vr[uo].length-1]){var Va=ke[hr].node[s];if(Rn[Va]--,Rn[Va]=0;Ka--){var Vo=hn.nodes[Ka],OM=ke[Vo.id].degree,N8=ke[Vo.id].inDegree,L8=ke[Vo.id].outDegree,k8=Vo[s],cw=mb(Qe,k8,y,x),IM=cw.minPatternNodeLabelDegree,Q8=cw.minPatternNodeLabelInDegree,U8=cw.minPatternNodeLabelOutDegree,R8=n?OM=0;ov--){var Wo=Tn[ov];if(!ke[Wo.source]||!ke[Wo.target]){Tn.splice(ov,1);var Av=Wo[o];if(En[Av]--,ke[Wo.source]&&(ke[Wo.source].degree--,ke[Wo.source].outDegree--),ke[Wo.target]&&(ke[Wo.target].degree--,ke[Wo.target].inDegree--),F[Av]&&En[Av]=0;Bn--){var Us=Hn(Bn);if(Us==="break")break}for(var hi=kn.length,Vi=function(Fn){var hn=kn[Fn],Sn={};hn.edges.forEach(function(Tn){var En="".concat(Tn.source,"-").concat(Tn.target,"-").concat(Tn.label);Sn[En]?Sn[En]++:Sn[En]=1});for(var Rn=function(En){var ur=kn[En],qe={};ur.edges.forEach(function(mr){var Wi="".concat(mr.source,"-").concat(mr.target,"-").concat(mr.label);qe[Wi]?qe[Wi]++:qe[Wi]=1});var Je=!0;Object.keys(qe).length!==Object.keys(Sn).length?Je=!1:Object.keys(Sn).forEach(function(mr){qe[mr]!==Sn[mr]&&(Je=!1)}),Je&&kn.splice(En,1)},ke=hi-1;ke>Fn;ke--)Rn(ke);hi=kn.length},Bn=0;Bn<=hi-1;Bn++)Vi(Bn);return kn}}},tL=$N,eL=function(){function r(t){t===void 0&&(t=10),this.linkedList=new RB,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}(),nL=eL,rL=VB,nz={getAdjMatrix:Hf,breadthFirstSearch:UI,connectedComponent:_B,getDegree:Xm,getInDegree:DI,getOutDegree:PI,detectCycle:VB,detectDirectedCycle:rL,detectAllCycles:GI,detectAllDirectedCycle:KB,detectAllUndirectedCycle:zB,depthFirstSearch:GB,dijkstra:Wf,findAllPath:gN,findShortestPath:ry,floydWarshall:iy,labelPropagation:mN,louvain:nb,iLouvain:SN,kCore:FN,kMeans:ON,cosineSimilarity:ib,nodesCosineSimilarity:LN,minimumSpanningTree:HN,pageRank:sb,getNeighbors:is,Stack:nL,GADDI:tL};function Nt(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(ko("The datum does not have available id."))}function $f(r){return r.combo}function yb(r,t){const e={nodes:(r.nodes||[]).map(Nt),edges:(r.edges||[]).map(Nt),combos:(r.combos||[]).map(Nt)};return t?Object.values(e).flat():e}const wb=(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(Nt(a),e.direction).length;i.set(Nt(a),s)}),i}case"betweenness":return iL(r,e.directed,e.weightPropertyName);case"closeness":return aL(r,e.directed,e.weightPropertyName);case"eigenvector":return oL(r,e.directed);case"pagerank":return sL(r,e.epsilon,e.linkProb);default:return Eb(r)}},Eb=r=>{var t;const e=new Map;return(t=r.nodes)===null||t===void 0||t.forEach(n=>{e.set(Nt(n),0)}),e},iL=(r,t,e)=>{const n=Eb(r),{nodes:i=[]}=r;return i.forEach(a=>{i.forEach(s=>{if(a!==s){const{allPath:o}=ry(r,Nt(a),Nt(s),t,e),A=o.length;o.flat().forEach(l=>{l!==Nt(a)&&l!==Nt(s)&&n.set(l,n.get(l)+1/A)})}})}),n},aL=(r,t,e)=>{const n=new Map,{nodes:i=[]}=r;return i.forEach(a=>{const s=i.reduce((o,A)=>{if(a!==A){const{length:l}=ry(r,Nt(a),Nt(A),t,e);o+=l}return o},0);n.set(Nt(a),1/s)}),n},sL=(r,t,e)=>{var n;const i=new Map,a=sb(r,t,e);return(n=r.nodes)===null||n===void 0||n.forEach(s=>{i.set(Nt(s),a[Nt(s)])}),i},oL=(r,t)=>{const{nodes:e=[]}=r,n=AL(r,t),i=lL(n,e.length),a=new Map;return e.forEach((s,o)=>{a.set(Nt(s),i[o])}),a},AL=(r,t)=>{const{nodes:e=[],edges:n=[]}=r,i=Array(e.length).fill(null).map(()=>Array(e.length).fill(0));return n.forEach(({source:a,target:s})=>{const o=e.findIndex(l=>Nt(l)===a),A=e.findIndex(l=>Nt(l)===s);t?i[o][A]=1:(i[o][A]=1,i[A][o]=1)}),i},lL=(r,t,e=100,n=1e-6)=>{let i=Array(t).fill(1),a=1/0;for(let s=0;sn;s++){const o=Array(t).fill(0);for(let l=0;ll+c*c,0));for(let l=0;ll+(c-i[u])*c,0)),i=o}return i};function BA(r,t,e,n=Pr){const i=new Map(r.map(h=>[e(h),h])),a=new Map(t.map(h=>[e(h),h])),s=new Set(i.keys()),o=new Set(a.keys()),A=[],l=[],c=[],u=[];return o.forEach(h=>{s.has(h)?n(i.get(h),a.get(h))?u.push(a.get(h)):l.push(a.get(h)):A.push(a.get(h))}),s.forEach(h=>{o.has(h)||c.push(i.get(h))}),{enter:A,exit:c,keep:u,update:l}}function Bl(r,t,e){const n=i=>{e&&!e(i)||(i.style.visibility=t)};r.forEach(i=>{n(i)})}function cL(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 oy{constructor(t){this.extensions=[],this.extensionMap={},this.context=t}setExtensions(t){const e=cL(this.context.graph,this.category,t),{enter:n,update:i,exit:a,keep:s}=BA(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=Lo(e,i);if(!a)return va.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 Ay{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 Ra extends Ay{}class tg extends Ra{constructor(t,e){super(t,Object.assign({},tg.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(EA(o,this.options.padding))):a.hide.push(s)}),a},this.hideLabelIfExceedViewport=(n,i)=>{const{exit:a}=BA(n,i,s=>s.id);a==null||a.forEach(this.hideLabel)},this.nodeCentralities=new Map,this.sortNodesByCentrality=(n,i)=>{const{model:a}=this.context,s=a.getData(),o=a.getRelatedEdgesData.bind(a);return n.map(l=>(this.nodeCentralities.has(l.id)||(this.nodeCentralities=wb(s,o,i)),{node:l,centrality:this.nodeCentralities.get(l.id)})).sort((l,c)=>c.centrality-l.centrality).map(l=>l.node)},this.sortLabelElementsInView=n=>{const{sort:i,sortNode:a,sortCombo:s,sortEdge:o}=this.options,{model:A}=this.context;if(Vt(i))return n.sort((g,v)=>i(A.getElementDataById(g.id),A.getElementDataById(v.id)));const{node:l=[],edge:c=[],combo:u=[]}=Pf(n,g=>g.type),h=Vt(s)?u.sort((g,v)=>s(...A.getComboData([g.id,v.id]))):u,d=Vt(a)?l.sort((g,v)=>a(...A.getNodeData([g.id,v.id]))):this.sortNodesByCentrality(l,a),f=Vt(o)?c.sort((g,v)=>o(...A.getEdgeData([g.id,v.id]))):c;return[...h,...d,...f]},this.labelElementsInView=[],this.isFirstRender=!0,this.onToggleVisibility=n=>{var i;if(((i=n.data)===null||i===void 0?void 0:i.stage)==="zIndex")return;if(!this.validate(n)){this.hiddenElements.size>0&&(this.hiddenElements.forEach(this.showLabel),this.hiddenElements.clear());return}const a=this.isFirstRender?this.getLabelElements():this.getLabelElementsInView();this.hideLabelIfExceedViewport(this.labelElementsInView,a),this.labelElementsInView=a;const s=this.sortLabelElementsInView(this.labelElementsInView),{show:o,hide:A}=this.detectLabelCollision(s);for(let l=o.length-1;l>=0;l--)this.showLabel(o[l]);A.forEach(this.hideLabel)},this.hiddenElements=new Map,this.hideLabel=n=>{const i=n.getShape("label");i&&Bl(i,"hidden"),this.hiddenElements.set(n.id,n)},this.showLabel=n=>{const i=n.getShape("label");i&&Bl(i,"visible"),n.toFront(),this.hiddenElements.delete(n.id)},this.onTransform=kB(this.onToggleVisibility,this.options.throttle,{leading:!0}),this.enableToggle=!0,this.toggle=n=>{this.enableToggle&&this.onToggleVisibility(n)},this.onBeforeRender=()=>{this.enableToggle=!1},this.onAfterRender=n=>{this.onToggleVisibility(n),this.enableToggle=!0},this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents(),this.onToggleVisibility({})}getLabelElements(){const{elementMap:t}=this.context.element,e=[];for(const n in t){const i=t[n];i.isVisible()&&i.getShape("label")&&e.push(i)}return e}getLabelElementsInView(){const t=this.context.viewport;return this.getLabelElements().filter(e=>t.isInViewport(e.getShape("key").getRenderBounds()))}bindEvents(){const{graph:t}=this.context;t.on(Ae.BEFORE_RENDER,this.onBeforeRender),t.on(Ae.AFTER_RENDER,this.onAfterRender),t.on(Ae.AFTER_DRAW,this.toggle),t.on(Ae.AFTER_LAYOUT,this.toggle),t.on(Ae.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.BEFORE_RENDER,this.onBeforeRender),t.off(Ae.AFTER_RENDER,this.onAfterRender),t.off(Ae.AFTER_DRAW,this.toggle),t.off(Ae.AFTER_LAYOUT,this.toggle),t.off(Ae.AFTER_TRANSFORM,this.onTransform)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}tg.defaultOptions={enable:!0,throttle:100,padding:0,sortNode:{type:"degree"}};var uL=function(r){if(!zm(r)||!Md(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},_c=uL,hL=5;function dL(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 Bb(r,t,e,n){e=e||0,n=n||hL;for(var i in t)if(dL(t,i)){var a=t[i];a!==null&&_c(a)?(_c(r[i])||(r[i]={}),ee+t[n])}function tr(r,t){return r.map((e,n)=>e-t[n])}function Ss(r,t){return typeof t=="number"?r.map(e=>e*t):r.map((e,n)=>e*t[n])}function Ms(r,t){return typeof t=="number"?r.map(e=>e/t):r.map((e,n)=>e/t[n])}function gL(r,t){return r.reduce((e,n,i)=>e+n*t[i],0)}function vL(r,t){const e=wh(r),n=wh(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 bA(r,t){return r.map(e=>e*t)}function cr(r,t){return Math.sqrt(r.reduce((e,n,i)=>e+Math.pow(n-t[i]||0,2),0))}function eg(r,t){return r.reduce((e,n,i)=>e+Math.abs(n-t[i]),0)}function Qo(r){const t=r.reduce((e,n)=>e+Math.pow(n,2),0);return r.map(e=>e/Math.sqrt(t))}function ly(r,t,e=!1){const n=r[0]*t[1]-r[1]*t[0];let i=Math.acos(Ss(r,t).reduce((a,s)=>a+s,0)/(cr(r,bb)*cr(t,bb)));return e&&n<0&&(i=2*Math.PI-i),i}function rz(r,t){return r.every((e,n)=>e===t[n])}function ng(r,t=!0){return t?[-r[1],r[0]]:[r[1],-r[0]]}function cy(r,t){return r.map(e=>e%t)}function bl(r){return[r[0],r[1]]}function wh(r){return EI(r)?[r[0],r[1],0]:r}function xb(r){const[t,e]=r;return!t&&!e?0:Math.atan2(e,t)}function Cb(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 Sb(r,t){const[e,n]=r,[i,a]=t,s=tr(e,n),o=tr(i,a);return vL(s,o).every(A=>A===0)}function uy(r,t,e=!1){if(Sb(r,t))return;const[n,i]=r,[a,s]=t,o=((n[0]-a[0])*(a[1]-s[1])-(n[1]-a[1])*(a[0]-s[0]))/((n[0]-i[0])*(a[1]-s[1])-(n[1]-i[1])*(a[0]-s[0])),A=s[0]-a[0]?(n[0]-a[0]+o*(i[0]-n[0]))/(s[0]-a[0]):(n[1]-a[1]+o*(i[1]-n[1]))/(s[1]-a[1]);if(!(!e&&(!ro(o,0,1)||!ro(A,0,1))))return[n[0]+o*(i[0]-n[0]),n[1]+o*(i[1]-n[1])]}function Mb(r){if(Array.isArray(r))return ro(r[0],0,1)&&ro(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 li(r){const{x:t=0,y:e=0,z:n=0}=r.style||{};return[+t,+e,+n]}function pL(r){const{x:t,y:e,z:n}=r.style||{};return t!==void 0||e!==void 0||n!==void 0}function Fb(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 Uo(r,t="center"){const e=Mb(t);return Fb(r,e)}function iz(r,t){const e=parseAnchor(t);return Fb(r,e)}const az=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 Mi(r){var t;return[r.x,r.y,(t=r.z)!==null&&t!==void 0?t:0]}function Fs(r){var t;return{x:r[0],y:r[1],z:(t=r[2])!==null&&t!==void 0?t:0}}function sz(r){return r.sort((t,e)=>t[0]-e[0]||t[1]-e[1])}function oz(r){const t=new Set;return r.filter(e=>{const n=e.join(",");return t.has(n)?!1:(t.add(n),!0)})}function Eh(r,t=0){return r.map(e=>parseFloat(e.toFixed(t)))}function xA(r,t,e,n=!1){if(Pr(r,t))return r;const i=n?tr(r,t):tr(t,r),a=Qo(i),s=[a[0]*e,a[1]*e];return $e(bl(r),s)}function Tb(r,t){return r[1]===t[1]}function mL(r,t){return r[0]===t[0]}function yL(r,t){return Tb(r,t)||mL(r,t)}function Ob(r,t,e){return Sb([r,t],[t,e])}function Ib(r,t){return[2*t[0]-r[0],2*t[1]-r[1]]}function Nb(r,t,e,n=!0,i=!1){for(let a=0;aa!=d>a&&i<(h-c)*(a-u)/(d-u)+c&&(s=!s)}return s}function EL(r,t,e=!1){const n=Uo(t,"center"),i=[Uo(t,"left-top"),Uo(t,"right-top"),Uo(t,"right-bottom"),Uo(t,"left-bottom")];return Nb(r,n,i,!1,e).point}function rg(r,t,e=!1){const n=t.center,i=e?Ib(r,n):r,a=tr(i,t.center),s=Math.atan2(a[1],a[0]);if(isNaN(s))return n;const o=io(t)/2,A=ao(t)/2,l=n[0]+o*Math.cos(s),c=n[1]+A*Math.sin(s);return[l,c]}function BL(r,t){let e=1/0,n=[r[0],t[0]];return r.forEach(i=>{t.forEach(a=>{const s=cr(i,a);s{const a=xL(r,i);a1?c=1:c<0&&(c=0);const u=e+c*A,h=n+c*l;return[u,h]}function CL(r){const t=r.reduce((e,n)=>$e(e,n),[0,0]);return Ms(t,r.length)}function hy(r,t=!0){const e=CL(r);return r.sort(([n,i],[a,s])=>{const o=Math.atan2(i-e[1],n-e[0]),A=Math.atan2(s-e[1],a-e[0]);return t?A-o:o-A})}function kb(r,t){return[r,[r[0],t[1]],t,[t[0],r[1]]]}class _r{constructor(t,e,n){if(this.phase=e,this.pointerByTouch=[],this.initialDistance=null,this.emitter=t,_r.instance)return _r.callbacks[this.phase].push(n),_r.instance;this.onPointerDown=this.onPointerDown.bind(this),this.onPointerMove=this.onPointerMove.bind(this),this.onPointerUp=this.onPointerUp.bind(this),this.bindEvents(),_r.instance=this,_r.callbacks[this.phase].push(n)}bindEvents(){const{emitter:t}=this;t.on(Yt.POINTER_DOWN,this.onPointerDown),t.on(Yt.POINTER_MOVE,this.onPointerMove),t.on(Yt.POINTER_UP,this.onPointerUp)}updatePointerPosition(t,e,n){const i=this.pointerByTouch.findIndex(a=>a.pointerId===t);i>=0&&(this.pointerByTouch[i]={x:e,y:n,pointerId:t})}onPointerDown(t){const{x:e,y:n}=t.client||{};if(!(e===void 0||n===void 0)&&(this.pointerByTouch.push({x:e,y:n,pointerId:t.pointerId}),t.pointerType==="touch"&&this.pointerByTouch.length===2)){_r.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),_r.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;_r.callbacks.pinchmove.forEach(A=>A(t,{scale:(o-1)*5}))}onPointerUp(t){var e;_r.callbacks.pinchend.forEach(n=>n(t,{scale:0})),_r.isPinching=!1,this.initialDistance=null,this.pointerByTouch=[],(e=_r.instance)===null||e===void 0||e.tryDestroy()}destroy(){this.emitter.off(Yt.POINTER_DOWN,this.onPointerDown),this.emitter.off(Yt.POINTER_MOVE,this.onPointerMove),this.emitter.off(Yt.POINTER_UP,this.onPointerUp),_r.instance=null}off(t,e){const n=_r.callbacks[t].indexOf(e);n>-1&&_r.callbacks[t].splice(n,1),this.tryDestroy()}tryDestroy(){Object.values(_r.callbacks).every(t=>t.length===0)&&this.destroy()}}_r.isPinching=!1,_r.instance=null,_r.callbacks={pinchstart:[],pinchmove:[],pinchend:[]};const Qb=r=>r.map(t=>gn(t)?t.toLocaleLowerCase():t);class CA{constructor(t){this.map=new Map,this.boundHandlePinch=()=>{},this.recordKey=new Set,this.onKeyDown=e=>{e!=null&&e.key&&(this.recordKey.add(e.key),this.trigger(e))},this.onKeyUp=e=>{e!=null&&e.key&&this.recordKey.delete(e.key)},this.onWheel=e=>{this.triggerExtendKey(Yt.WHEEL,e)},this.onDrag=e=>{this.triggerExtendKey(Yt.DRAG,e)},this.handlePinch=(e,n)=>{this.triggerExtendKey(Yt.PINCH,Object.assign(Object.assign({},e),n))},this.onFocus=()=>{this.recordKey.clear()},this.emitter=t,this.bindEvents()}bind(t,e){t.length!==0&&(t.includes(Yt.PINCH)&&!this.pinchHandler&&(this.boundHandlePinch=this.handlePinch.bind(this),this.pinchHandler=new _r(this.emitter,"pinchmove",this.boundHandlePinch)),this.map.set(t,e))}unbind(t,e){this.map.forEach((n,i)=>{Pr(i,t)&&(!e||e===n)&&this.map.delete(i)})}unbindAll(){this.map.clear()}match(t){const e=Qb(Array.from(this.recordKey)).sort(),n=Qb(t).sort();return Pr(e,n)}bindEvents(){var t;const{emitter:e}=this;e.on(Yt.KEY_DOWN,this.onKeyDown),e.on(Yt.KEY_UP,this.onKeyUp),e.on(Yt.WHEEL,this.onWheel),e.on(Yt.DRAG,this.onDrag),(t=globalThis.addEventListener)===null||t===void 0||t.call(globalThis,"focus",this.onFocus)}trigger(t){this.map.forEach((e,n)=>{this.match(n)&&e(t)})}triggerExtendKey(t,e){this.map.forEach((n,i)=>{i.includes(t)&&Pr(Array.from(this.recordKey),i.filter(a=>a!==t))&&n(e)})}destroy(){var t,e;this.unbindAll(),this.emitter.off(Yt.KEY_DOWN,this.onKeyDown),this.emitter.off(Yt.KEY_UP,this.onKeyUp),this.emitter.off(Yt.WHEEL,this.onWheel),this.emitter.off(Yt.DRAG,this.onDrag),(t=this.pinchHandler)===null||t===void 0||t.off("pinchmove",this.boundHandlePinch),(e=globalThis.removeEventListener)===null||e===void 0||e.call(globalThis,"focus",this.onFocus)}}class Bh extends Ra{constructor(t,e){super(t,Si({},Bh.defaultOptions,e)),this.shortcut=new CA(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 Ci({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=ig(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(kb(this.startPoint,this.endPoint))}onPointerUp(t){if(this.startPoint){if(!this.endPoint){this.clearBrush();return}this.endPoint=ig(t,this.context.graph),this.updateElementsStates(kb(this.startPoint,this.endPoint)),this.clearBrush()}}clearStates(){this.endPoint||this.clearElementsStates()}clearElementsStates(){const{graph:t}=this.context,e=Object.values(t.getData()).reduce((n,i)=>Object.assign({},n,i.reduce((a,s)=>{var o;const A=(o=s.states||[])===null||o===void 0?void 0:o.filter(l=>l!==this.options.state);return a[Nt(s)]=A,a},{})),{});t.setElementState(e,this.options.animation)}updateElementsStates(t){const{graph:e}=this.context,{enableElements:n,state:i,mode:a,onSelect:s}=this.options,o=this.selector(e,t,n),A={};switch(a){case"union":o.forEach(l=>{A[l]=[...e.getElementState(l),i]});break;case"diff":o.forEach(l=>{const c=e.getElementState(l);A[l]=c.includes(i)?c.filter(u=>u!==i):[...c,i]});break;case"intersect":o.forEach(l=>{const c=e.getElementState(l);A[l]=c.includes(i)?[i]:[]});break;case"default":default:o.forEach(l=>{A[l]=[i]});break}Vt(s)&&s(A),e.setElementState(A,this.options.animation)}selector(t,e,n){if(!n||n.length===0)return[];const i=[],a=t.getData();if(n.forEach(s=>{a[`${s}s`].forEach(o=>{const A=Nt(o);t.getElementVisibility(A)!=="hidden"&&wL(t.getElementPosition(A),e)&&i.push(A)})}),n.includes("edge")){const s=a.edges;s==null||s.forEach(o=>{const{source:A,target:l}=o;i.includes(A)&&i.includes(l)&&i.push(Nt(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 Vt(e)?e(t):!!e}bindEvents(){const{graph:t}=this.context;t.on(Yt.POINTER_DOWN,this.onPointerDown),t.on(Yt.POINTER_MOVE,this.onPointerMove),t.on(Yt.POINTER_UP,this.onPointerUp),t.on(No.CLICK,this.clearStates)}unbindEvents(){const{graph:t}=this.context;t.off(Yt.POINTER_DOWN,this.onPointerDown),t.off(Yt.POINTER_MOVE,this.onPointerMove),t.off(Yt.POINTER_UP,this.onPointerUp),t.off(No.CLICK,this.clearStates)}update(t){this.unbindEvents(),this.options=Si(this.options,t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Bh.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 ig=(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]},Ro=.8,xl=["node","edge","combo"];function Cl(r,t,e,n,i=0){n==="TB"&&t(r,i);const a=e(r);if(a)for(const s of a)Cl(s,t,e,n,i+1);n==="BT"&&t(r,i)}function SL(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 Ub(r,t,e,n,i="both"){if(t==="combo"||t==="node")return dy(r,e,n,i);const a=r.getEdgeData(e);if(!a)return[];const s=dy(r,a.source,n-1,i),o=dy(r,a.target,n-1,i);return Array.from(new Set([...s,...o,e]))}function dy(r,t,e,n="both"){const i=new Set,a=new Set,s=new Set;return SL(t,(o,A)=>{A>e||(s.add(o),r.getRelatedEdgesData(o,n).forEach(l=>{const c=Nt(l);!a.has(c)&&Ar.getRelatedEdgesData(o,n).map(A=>A.source===o?A.target:A.source).filter(A=>i.has(A)?!1:(i.add(A),!0))),Array.from(s)}function fy(r){return r.states||[]}var ag=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class sg extends Ra{constructor(t,e){super(t,Object.assign({},sg.defaultOptions,e)),this.onClickSelect=n=>ag(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=>ag(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 CA(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),xl.forEach(e=>{t.on(`${e}:${Yt.CLICK}`,this.onClickSelect)}),t.on(No.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 Ub(i,n,e.id,typeof a=="function"?a(t):a).filter(s=>s!==e.id)}updateState(t){return ag(this,void 0,void 0,function*(){const{state:e,unselectedState:n,neighborState:i,animation:a}=this.options;if(!e&&!i&&!n)return;const{target:s}=t,{graph:o}=this.context,A=o.getElementData(s.id),l=fy(A).includes(e)?"unselect":"select",c={},u=this.isMultipleSelect,h=[s.id],d=this.getNeighborIds(t);if(u)if(Object.assign(c,this.getDataStates()),l==="select"){const f=(g,v)=>{g.forEach(p=>{const y=new Set(o.getElementState(p));y.add(v),y.delete(n),c[p]=Array.from(y)})};f(h,e),f(d,i),n&&Object.keys(c).forEach(g=>{const v=c[g];!v.includes(e)&&!v.includes(i)&&!v.includes(n)&&c[g].push(n)})}else{const f=c[s.id];c[s.id]=f.filter(g=>g!==e&&g!==i),f.includes(n)||c[s.id].push(n),d.forEach(g=>{c[g]=c[g].filter(v=>v!==i),c[g].includes(e)||c[g].push(n)})}else if(l==="select"){Object.assign(c,this.getClearStates(!!n));const f=(g,v)=>{g.forEach(p=>{c[p]||(c[p]=o.getElementState(p)),c[p].push(v)})};f(h,e),f(d,i),n&&Object.keys(c).forEach(g=>{!h.includes(g)&&!d.includes(g)&&c[g].push(n)})}else Object.assign(c,this.getClearStates());yield o.setElementState(c,a)})}getDataStates(){const{graph:t}=this.context,{nodes:e,edges:n,combos:i}=t.getData(),a={};return[...e,...n,...i].forEach(s=>{a[Nt(s)]=fy(s)}),a}getClearStates(t=!1){const{graph:e}=this.context,{state:n,unselectedState:i,neighborState:a}=this.options,s=new Set([n,i,a]),{nodes:o,edges:A,combos:l}=e.getData(),c={};return[...o,...A,...l].forEach(u=>{const h=fy(u),d=h.filter(f=>!s.has(f));(t||d.length!==h.length)&&(c[Nt(u)]=d)}),c}clearState(){return ag(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 Vt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;xl.forEach(e=>{t.off(`${e}:${Yt.CLICK}`,this.onClickSelect)}),t.off(No.CLICK,this.onClickCanvas)}destroy(){this.unbindEvents(),super.destroy()}}sg.defaultOptions={animation:!0,enable:!0,multiple:!1,trigger:["shift"],state:"selected",neighborState:"selected",unselectedState:void 0,degree:0};function pa(r){var t;return!!(!((t=r.style)===null||t===void 0)&&t.collapsed)}var Fi=function(r,t,e){for(var n=0,i=gn(t)?t.split("."):t;r&&n="A"&&e<="Z"}function Rb(r,t){return`${t}${Rf(r)}`}function Db(r,t,e=!0){if(!t||!xh(r,t))return r;const n=r.slice(t.length);return e?FL(n):n}function Ir(r,t){const e=Object.entries(r).reduce((n,[i,a])=>(i==="className"||i==="class"||xh(i,t)&&Object.assign(n,{[Db(i,t)]:a}),n),{});if("opacity"in r){const n=Rb("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 gy(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 Pb(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 Az(r,t,e){return Object.entries(r).reduce((n,[i,a])=>(xh(i,t)?n[Rb(Db(i,t,!1),e)]=a:n[i]=a,n),{})}function Da(r=0){if(typeof r=="number")return[r,r,r];const[t,e=t,n=t]=r;return[t,e,n]}var TL=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 mi(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 OL(r){const{x:t,y:e,z:n,class:i,className:a,transform:s,transformOrigin:o,zIndex:A,visibility:l}=r;return TL(r,["x","y","z","class","className","transform","transformOrigin","zIndex","visibility"])}function IL(r,t){const e=Da(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 Hb(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 NL(r,t){if(!t)return{};const{type:e,color:n,field:i,invert:a}=t,s=A=>{const l=typeof n=="string"?Lo("palette",n):n;if(typeof l=="function"){const c={};return A.forEach(([u,h])=>{c[u]=l(a?1-h:h)}),c}else if(Array.isArray(l)){const c=a?[...l].reverse():l,u={};return A.forEach(([h,d])=>{u[h]=c[d%l.length]}),u}return{}},o=(A,l)=>{var c;return typeof A=="string"?(c=l.data)===null||c===void 0?void 0:c[A]:A==null?void 0:A(l)};if(e==="group"){const A=Pf(r,h=>{if(!i)return"default";const d=o(i,h);return d?String(d):"default"}),l=Object.keys(A),c=s(l.map((h,d)=>[h,d])),u={};return Object.entries(A).forEach(([h,d])=>{d.forEach(f=>{u[Nt(f)]=c[h]})}),u}else if(e==="value"){const[A,l]=r.reduce(([u,h],d)=>{const f=o(i,d);if(typeof f!="number")throw new Error(ko(`Palette field ${i} is not a number`));return[Math.min(u,f),Math.max(h,f)]},[1/0,-1/0]),c=l-A;return s(r.map(u=>[u.id,(o(i,u)-A)/c]))}}function Gb(r){const t=typeof r=="string"?Lo("palette",r):r;if(typeof t!="function")return t}function zb(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 Kb(r,t,e=1,n=!1){const i=n?e:1,a=(r.max[0]-r.min[0])*i;return zb(a,t)}function LL(r,t,e=1){const n=cr(r[0],r[1])*e;return zb(n,t)}var kL={}.toString,QL=function(r){return kL.call(r).replace(/^\[object /,"").replace(/]$/,"")},UL=QL,RL=Object.prototype,DL=function(r){var t=r&&r.constructor,e=typeof t=="function"&&t.prototype||RL;return r===e},PL=DL,_L=Object.prototype.hasOwnProperty;function HL(r){if(Re(r))return!0;if(dh(r))return!r.length;var t=UL(r);if(t==="Map"||t==="Set")return!r.size;if(PL(r))return!Object.keys(r).length;for(var e in r)if(_L.call(r,e))return!1;return!0}var oo=HL;class Ch extends sh{constructor(t){Vb(t.style),super(t),this.shapeMap={},this.animateMap={},this.render(this.attributes,this),this.setVisibility(),this.bindEvents()}get parsedAttributes(){return this.attributes}upsert(t,e,n,i,a){var s,o,A,l,c,u,h,d;const f=this.shapeMap[t];if(n===!1){f&&((s=a==null?void 0:a.beforeDestroy)===null||s===void 0||s.call(a,f),i.removeChild(f),delete this.shapeMap[t],(o=a==null?void 0:a.afterDestroy)===null||o===void 0||o.call(a,f));return}const g=typeof e=="string"?Lo(fh.SHAPE,e):e;if(!g)throw new Error(ko(`Shape ${e} not found`));if(!f||f.destroyed||!(f instanceof g)){f&&((A=a==null?void 0:a.beforeDestroy)===null||A===void 0||A.call(a,f),f==null||f.destroy(),(l=a==null?void 0:a.afterDestroy)===null||l===void 0||l.call(a,f)),(c=a==null?void 0:a.beforeCreate)===null||c===void 0||c.call(a);const v=new g({className:t,style:n});return i.appendChild(v),this.shapeMap[t]=v,(u=a==null?void 0:a.afterCreate)===null||u===void 0||u.call(a,v),v}return(h=a==null?void 0:a.beforeUpdate)===null||h===void 0||h.call(a,f),Ny(f,n),(d=a==null?void 0:a.afterUpdate)===null||d===void 0||d.call(a,f),f}update(t={}){const e=Object.assign({},this.attributes,t);Vb(e),NQ(this,e),this.render(e,this),this.setVisibility()}bindEvents(){}getGraphicStyle(t){return OL(t)}get compositeShapes(){return[["badges","badge-"],["ports","port-"]]}animate(t,e){if(t.length===0)return null;const n=[];if(t[0].x!==void 0||t[0].y!==void 0||t[0].z!==void 0){const{x:a=0,y:s=0,z:o=0}=this.attributes;t.forEach(A=>{const{x:l=a,y:c=s,z:u=o}=A;Object.assign(A,{transform:u?[["translate3d",l,c,u]]:[["translate",l,c]]})})}const i=super.animate(t,e);if(i&&(vy(this,i),n.push(i)),Array.isArray(t)&&t.length>0){const a=["transform","transformOrigin","x","y","z","zIndex"];if(Object.keys(t[0]).some(s=>!a.includes(s))){Object.entries(this.shapeMap).forEach(([o,A])=>{const l=`get${Rf(o)}Style`,c=this[l];if(Vt(c)){const u=t.map(d=>c.call(this,Object.assign(Object.assign({},this.attributes),d))),h=A.animate(jm(u),e);h&&(vy(A,h),n.push(h))}});const s=(o,A)=>{if(!oo(o)){const l=`get${Rf(A)}Style`,c=this[l];if(Vt(c)){const u=t.map(h=>c.call(this,Object.assign(Object.assign({},this.attributes),h)));Object.entries(u[0]).map(([h])=>{const d=u.map(g=>g[h]),f=o[h];if(f){const g=f.animate(jm(d),e);g&&(vy(f,g),n.push(g))}})}}};this.compositeShapes.forEach(([o,A])=>{const l=gy(this.shapeMap,A);s(l,o)})}}return Wm(n)}getShape(t){return this.shapeMap[t]}setVisibility(){const{visibility:t}=this.attributes;Bl(this,t)}destroy(){this.shapeMap={},this.animateMap={},super.destroy()}}function vy(r,t){t==null||t.finished.then(()=>{const e=r.activeAnimations.findIndex(n=>n===t);e>-1&&r.activeAnimations.splice(e,1)})}function Vb(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=OB(t,e,n,i);a&&(r.transform=a)}return r}var GL=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 Wb={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 KL(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 Wb?n=a:t.unshift(a),i={type:n},Wb[n].forEach(A=>{a=t.shift(),i[A]=a}),n==="M"?n="L":n==="m"&&(n="l");const[s,...o]=Object.values(i);e.push([s,...o.map(Number)])}return e}function VL(r){const t=[];return(typeof r=="string"?KL(r):r).forEach(n=>{const i=n[0];if(i==="Z"){t.push(t[0]);return}if(i!=="A")for(let a=1;a{if(r.length<2)return[["M",0,0],["L",0,0]];const t=r[0],e=r[1],n=r[r.length-1],i=r[r.length-2];r.unshift(i,n),r.push(t,e);const a=[["M",n[0],n[1]]];for(let s=1;s{const v=f,p=c[(g+1)%c.length];return Pr(v,p)?null:[v,p]}).filter(Boolean),h=bL([o,A],u),d=Lb([o,A],h);if(d&&h&&(l.transform=[["translate",d[0]+e,d[1]+n]],s)){const f=Math.atan((h[0][1]-h[1][1])/(h[0][0]-h[1][0]));l.transform.push(["rotate",f/Math.PI*180]),l.textAlign="center",(t==="right"||t==="left")&&(f>0?l.textBaseline=t==="right"?"bottom":"top":l.textBaseline=t==="right"?"top":"bottom")}return l}var jL=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 YL(r){const t=[];let e=r.parentNode;for(;e;)t.push(e),e=e.parentNode;return t}class py extends Ah{constructor(t){super(t),this.onMounted=()=>{this.handleRadius()},this.onAttrModified=()=>{this.handleRadius()},Gc=this,this.isMutationObserved=!0,this.addEventListener(yn.MOUNTED,this.onMounted),this.addEventListener(yn.ATTR_MODIFIED,this.onAttrModified)}handleRadius(){const{radius:t,clipPath:e,width:n=0,height:i=0}=this.attributes;if(t&&n&&i){const[a,s]=this.getBounds().min,o={x:a,y:s,radius:t,width:n,height:i};if(e)Object.assign(this.parsedStyle.clipPath.style,o);else{const A=new Ci({style:o});this.style.clipPath=A}}else e&&(this.style.clipPath=null)}}const my=new WeakMap;let Gc=null;const yy=r=>{if(Gc&&YL(Gc).includes(r)){const t=my.get(r);t?t.includes(Gc)||t.push(Gc):my.set(r,[Gc])}},wy=r=>{const t=my.get(r);t&&t.forEach(e=>e.handleRadius())};class Zb extends Ch{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()?py:ml,this.getIconStyle(t),e)}}class Yb extends Ch{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 og=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{i[u]=!1}),t.badge===!1||!(!((e=t.badges)===null||e===void 0)&&e.length))return i;const{badges:a=[],badgePalette:s,opacity:o=1}=t,A=og(t,["badges","badgePalette","opacity"]),l=Gb(s),c=Ir(this.getGraphicStyle(A),"badge");return a.forEach((u,h)=>{i[h]=Object.assign(Object.assign({backgroundFill:l?l[h%(l==null?void 0:l.length)]:void 0,opacity:o},c),this.getBadgeStyle(u))}),i}getBadgeStyle(t){const e=this.getShape("key"),{placement:n="top",offsetX:i,offsetY:a}=t,s=og(t,["placement","offsetX","offsetY"]),o=Ox(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=Ir(this.getGraphicStyle(t),"port"),{ports:s=[]}=t;return s.forEach((o,A)=>{const l=o.key||A,c=Object.assign(Object.assign({},a),o);if(Mx(c))i[l]=!1;else{const[u,h]=this.getPortXY(t,o);i[l]=Object.assign({transform:[["translate",u,h]]},c)}}),i}getPortXY(t,e){const{placement:n="left"}=e,i=this.getShape("key");return Ty(XL(this.context,i),n)}getPorts(){return gy(this.shapeMap,"port-")}getCenter(){return this.getShape("key").getBounds().center}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return EL(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",Zb,n,e),yy(this)}drawBadgeShapes(t,e){const n=this.getBadgesStyle(t);Object.keys(n).forEach(i=>{const a=n[i];this.upsert(`badge-${i}`,Hc,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,eo,a,e)})}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Ao,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)&&wy(this)}onframe(){this.drawBadgeShapes(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this)}}Ts.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 XL(r,t){if(!r)return t.getLocalBounds();const e=r.canvas.getLayer(),n=t.cloneNode();Bl(n,"hidden"),e.appendChild(n);const i=n.getLocalBounds();return n.destroy(),i}class Sl extends Ts{constructor(t){super(mi({style:Sl.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",eo,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*Ro;return e?Object.assign({width:i,height:i},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return rg(t,n,e)}}Sl.defaultStyleProps={size:32};class Ag extends Ts{constructor(t){super(t)}get parsedAttributes(){return this.attributes}drawKeyShape(t,e){return this.upsert("key",pl,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 Nb(t,s,a,!0,e).point}}class JL extends Ag{constructor(t){super(t)}getPoints(t){const[e,n]=this.getSize(t);return IQ(e,n)}}var qL=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);iye(u)?{value:u}:u),a=Ir(this.getGraphicStyle(t),"donut"),s=Gb(t.donutPalette);if(!s)return;const o=i.reduce((u,h)=>{var d;return u+((d=h.value)!==null&&d!==void 0?d:0)},0),A=this.parseOuterR(),l=this.parseInnerR();let c=0;i.forEach((u,h)=>{const{value:d=0,color:f=s[h%s.length]}=u,g=qL(u,["value","color"]),v=(o===0?1/i.length:d/o)*360;this.upsert(`round${h}`,Pi,Object.assign(Object.assign(Object.assign({},a),{d:ek(A,l,c,c+v),fill:f}),g),e),c+=v})}render(t,e=this){super.render(t,e),this.drawDonutShape(t,e)}}lg.defaultStyleProps={innerR:"50%",donuts:[],donutPalette:"tableau"};const cg=(r,t,e,n)=>[r+Math.sin(n)*e,t-Math.cos(n)*e],$L=(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"]],tk=(r,t,e,n,i,a)=>{const[s,o]=[i/360*2*Math.PI,a/360*2*Math.PI],A=[cg(r,t,n,s),cg(r,t,e,s),cg(r,t,e,o),cg(r,t,n,o)],l=o-s>Math.PI?1:0;return[["M",A[0][0],A[0][1]],["L",A[1][0],A[1][1]],["A",e,e,0,l,1,A[2][0],A[2][1]],["L",A[3][0],A[3][1]],["A",n,n,0,l,0,A[0][0],A[0][1]],["Z"]]},ek=(r=0,t=0,e,n)=>{const[i,a]=[0,0];return Math.abs(e-n)%360<1e-6?$L(i,a,r,t):tk(i,a,r,t,e,n)};class ug extends Ts{constructor(t){super(mi({style:ug.defaultStyleProps},t))}drawKeyShape(t,e){return this.upsert("key",oh,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*Ro;return e?Object.assign({width:a,height:a},e):!1}getIntersectPoint(t,e=!1){const n=this.getShape("key").getBounds();return rg(t,n,e)}}ug.defaultStyleProps={size:[45,35]};class nk extends Ag{constructor(t){super(t)}getOuterR(t){return t.outerR||Math.min(...this.getSize(t))/2}getPoints(t){return LQ(this.getOuterR(t))}getIconStyle(t){const e=super.getIconStyle(t),n=this.getOuterR(t)*Ro;return e?Object.assign({width:n,height:n},e):!1}}function lo(r,t){if(!{}.hasOwnProperty.call(r,t))throw new TypeError("attempted to use private field on non-instance");return r}var rk=0;function ik(r){return"__private_"+rk+++"_"+r}var Hr=ik("renderState"),Xb=function(){function r(t){(0,P.Z)(this,r),this.renderQueue=[],Object.defineProperty(this,Hr,{writable:!0,value:{restoreStack:[],prevObject:null,currentContext:new Map}}),this.clearFullScreenLastFrame=!1,this.clearFullScreen=!1,this.vpMatrix=$t(),this.dprMatrix=$t(),this.tmpMat4=$t(),this.vec3a=Ot(),this.vec3b=Ot(),this.vec3c=Ot(),this.vec3d=Ot(),this.canvasRendererPluginOptions=t}return(0,N.Z)(r,[{key:"apply",value:function(e,n){var i=this;this.context=e;var a=this.context,s=a.config,o=a.camera,A=a.renderingService,l=a.renderingContext,c=a.pathGeneratorFactory,u=s.renderer.getConfig().enableRenderingOptimization;s.renderer.getConfig().enableDirtyCheck=!1,s.renderer.getConfig().enableDirtyRectangleRendering=!1,this.pathGeneratorFactory=c;var h=e.contextService,d=l.root.ownerDocument.defaultView;A.hooks.init.tap(r.tag,function(){var v=h.getDPR(),p=s.width,y=s.height,x=h.getContext();i.clearRect(x,0,0,p*v,y*v,s.background)}),A.hooks.destroy.tap(r.tag,function(){i.renderQueue=[],lo(i,Hr)[Hr]={restoreStack:[],prevObject:null,currentContext:null}});var f=function(){var p,y=h.getContext(),x=h.getDPR(),F=s.width,O=s.height,L=i.canvasRendererPluginOptions,U=L.dirtyObjectNumThreshold,R=L.dirtyObjectRatioThreshold,j=A.getStats(),q=j.total,et=j.rendered,it=et/q;i.clearFullScreen=i.clearFullScreenLastFrame||!((p=d.context.renderingPlugins[1])!==null&&p!==void 0&&p.isFirstTimeRenderingFinished)||A.disableDirtyRectangleRendering()||et>U&&it>R,y&&(typeof y.resetTransform=="function"?y.resetTransform():y.setTransform(1,0,0,1,0,0),i.clearFullScreen&&i.clearRect(y,0,0,F*x,O*x,s.background))},g=function(p,y){for(var x=[p];x.length>0;){var F,O=x.pop();O.isVisible()&&!O.isCulled()&&(u?i.renderDisplayObjectOptimized(O,y,i.context,lo(i,Hr)[Hr],n):i.renderDisplayObject(O,y,i.context,lo(i,Hr)[Hr],n));for(var L=((F=O.sortable)===null||F===void 0||(F=F.sorted)===null||F===void 0?void 0:F.length)>0?O.sortable.sorted:O.childNodes,U=L.length-1;U>=0;U--)x.push(L[U])}};A.hooks.endFrame.tap(r.tag,function(){if(f(),l.root.childNodes.length===0){i.clearFullScreenLastFrame=!0;return}u=s.renderer.getConfig().enableRenderingOptimization,lo(i,Hr)[Hr]={restoreStack:[],prevObject:null,currentContext:lo(i,Hr)[Hr].currentContext},lo(i,Hr)[Hr].currentContext.clear(),i.clearFullScreenLastFrame=!1;var v=h.getContext(),p=h.getDPR();if(Dn(i.dprMatrix,[p,p,1]),ue(i.vpMatrix,i.dprMatrix,o.getOrthoMatrix()),i.clearFullScreen)u?(v.save(),g(l.root,v),v.restore()):g(l.root,v);else{var y=i.safeMergeAABB(i.mergeDirtyAABBs(i.renderQueue));if(Zn.isEmpty(y)){i.renderQueue=[];return}var x=i.convertAABB2Rect(y),F=x.x,O=x.y,L=x.width,U=x.height,R=me(i.vec3a,[F,O,0],i.vpMatrix),j=me(i.vec3b,[F+L,O,0],i.vpMatrix),q=me(i.vec3c,[F,O+U,0],i.vpMatrix),et=me(i.vec3d,[F+L,O+U,0],i.vpMatrix),it=Math.min(R[0],j[0],et[0],q[0]),dt=Math.min(R[1],j[1],et[1],q[1]),ft=Math.max(R[0],j[0],et[0],q[0]),mt=Math.max(R[1],j[1],et[1],q[1]),Rt=Math.floor(it),Qt=Math.floor(dt),yt=Math.ceil(ft-it),xt=Math.ceil(mt-dt);v.save(),i.clearRect(v,Rt,Qt,yt,xt,s.background),v.beginPath(),v.rect(Rt,Qt,yt,xt),v.clip(),v.setTransform(i.vpMatrix[0],i.vpMatrix[1],i.vpMatrix[4],i.vpMatrix[5],i.vpMatrix[12],i.vpMatrix[13]);var Dt=s.renderer.getConfig(),Xt=Dt.enableDirtyRectangleRenderingDebug;Xt&&d.dispatchEvent(new Wr(La.DIRTY_RECTANGLE,{dirtyRect:{x:Rt,y:Qt,width:yt,height:xt}}));var ne=y.getMin(),le=(0,H.Z)(ne,2),ge=le[0],xe=le[1],Qe=y.getMax(),Pe=(0,H.Z)(Qe,2),en=Pe[0],mn=Pe[1],an=l.root.ownerDocument.elementsFromBBox(ge,xe,en,mn);an.sort(function(er,kn){return er.sortable.renderOrder-kn.sortable.renderOrder}).forEach(function(er){er&&er.isVisible()&&!er.isCulled()&&i.renderDisplayObject(er,v,i.context,lo(i,Hr)[Hr],n)}),v.restore(),i.renderQueue.forEach(function(er){i.saveDirtyAABB(er)}),i.renderQueue=[]}lo(i,Hr)[Hr].restoreStack.forEach(function(){v.restore()}),lo(i,Hr)[Hr].restoreStack=[]}),A.hooks.render.tap(r.tag,function(v){i.clearFullScreen||i.renderQueue.push(v)})}},{key:"clearRect",value:function(e,n,i,a,s,o){e.clearRect(n,i,a,s),o&&(e.fillStyle=o,e.fillRect(n,i,a,s))}},{key:"renderDisplayObjectOptimized",value:function(e,n,i,a,s){var o=e.nodeName,A=!1,l=!1,c=this.context.styleRendererFactory[o],u=this.pathGeneratorFactory[o],h=e.parsedStyle.clipPath;if(h){A=!a.prevObject||!Kr(h.getWorldTransform(),a.prevObject.getWorldTransform()),A&&(this.applyWorldTransform(n,h),a.prevObject=null);var d=this.pathGeneratorFactory[h.nodeName];d&&(n.save(),l=!0,n.beginPath(),d(n,h.parsedStyle),n.closePath(),n.clip())}if(c){A=!a.prevObject||!Kr(e.getWorldTransform(),a.prevObject.getWorldTransform()),A&&this.applyWorldTransform(n,e);var f=!a.prevObject;if(!f){var g=a.prevObject.nodeName;o===Kt.TEXT?f=g!==Kt.TEXT:o===Kt.IMAGE?f=g!==Kt.IMAGE:f=g===Kt.TEXT||g===Kt.IMAGE}c.applyStyleToContext(n,e,f,a),a.prevObject=e}u&&(n.beginPath(),u(n,e.parsedStyle),o!==Kt.LINE&&o!==Kt.PATH&&o!==Kt.POLYLINE&&n.closePath()),c&&c.drawToContext(n,e,lo(this,Hr)[Hr],this,s),l&&n.restore(),e.dirty(!1)}},{key:"renderDisplayObject",value:function(e,n,i,a,s){var o=e.nodeName,A=a.restoreStack[a.restoreStack.length-1];A&&!(e.compareDocumentPosition(A)&pr.DOCUMENT_POSITION_CONTAINS)&&(n.restore(),a.restoreStack.pop());var l=this.context.styleRendererFactory[o],c=this.pathGeneratorFactory[o],u=e.parsedStyle.clipPath;if(u){this.applyWorldTransform(n,u);var h=this.pathGeneratorFactory[u.nodeName];h&&(n.save(),a.restoreStack.push(e),n.beginPath(),h(n,u.parsedStyle),n.closePath(),n.clip())}l&&(this.applyWorldTransform(n,e),n.save(),this.applyAttributesToContext(n,e)),c&&(n.beginPath(),c(n,e.parsedStyle),o!==Kt.LINE&&o!==Kt.PATH&&o!==Kt.POLYLINE&&n.closePath()),l&&(l.render(n,e.parsedStyle,e,i,this,s),n.restore()),e.dirty(!1)}},{key:"applyAttributesToContext",value:function(e,n){var i=n.parsedStyle,a=i.stroke,s=i.fill,o=i.opacity,A=i.lineDash,l=i.lineDashOffset;A&&e.setLineDash(A),Re(l)||(e.lineDashOffset=l),Re(o)||(e.globalAlpha*=o),!Re(a)&&!Array.isArray(a)&&!a.isNone&&(e.strokeStyle=n.attributes.stroke),!Re(s)&&!Array.isArray(s)&&!s.isNone&&(e.fillStyle=n.attributes.fill)}},{key:"convertAABB2Rect",value:function(e){var n=e.getMin(),i=e.getMax(),a=Math.floor(n[0]),s=Math.floor(n[1]),o=Math.ceil(i[0]),A=Math.ceil(i[1]),l=o-a,c=A-s;return{x:a,y:s,width:l,height:c}}},{key:"mergeDirtyAABBs",value:function(e){var n=new Zn;return e.forEach(function(i){var a=i.getRenderBounds();n.add(a);var s=i.renderable.dirtyRenderBounds;s&&n.add(s)}),n}},{key:"saveDirtyAABB",value:function(e){var n=e.renderable;n.dirtyRenderBounds||(n.dirtyRenderBounds=new Zn);var i=e.getRenderBounds();i&&n.dirtyRenderBounds.update(i.center,i.halfExtents)}},{key:"applyWorldTransform",value:function(e,n,i){i?(He(this.tmpMat4,n.getLocalTransform()),ue(this.tmpMat4,i,this.tmpMat4),ue(this.tmpMat4,this.vpMatrix,this.tmpMat4)):(He(this.tmpMat4,n.getWorldTransform()),ue(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 Zn,n=arguments.length,i=new Array(n),a=0;a0;if(u){if(i||n.attributes.stroke!==a.prevObject.attributes.stroke){var h=!Re(o.stroke)&&!Array.isArray(o.stroke)&&!o.stroke.isNone?n.attributes.stroke:jr.strokeStyle;Sr(e,"strokeStyle",h,a.currentContext)}(i||o.lineWidth!==s.lineWidth)&&Sr(e,"lineWidth",Re(o.lineWidth)?jr.lineWidth:o.lineWidth,a.currentContext),(i||o.lineDash!==s.lineDash)&&Sr(e,"lineDash",o.lineDash||jr.lineDash,a.currentContext),(i||o.lineDashOffset!==s.lineDashOffset)&&Sr(e,"lineDashOffset",Re(o.lineDashOffset)?jr.lineDashOffset:o.lineDashOffset,a.currentContext);for(var d=0;d4&&arguments[4]!==void 0?arguments[4]:!1;if(n){Sr(e,"shadowColor",jr.shadowColor,a.currentContext);for(var o=0;o-1&&Sr(e,"filter",l.replace(/drop-shadow\([^)]*\)/,"").trim()||jr.filter,a.currentContext)}else Sr(e,"filter",jr.filter,a.currentContext)}},{key:"fillToContext",value:function(e,n,i,a,s){var o=this,A=n.parsedStyle,l=A.fill,c=A.fillRule,u=null;if(Array.isArray(l)&&l.length>0)l.forEach(function(d){var f=Sr(e,"fillStyle",dg(d,n,e,o.imagePool),i.currentContext);u=u!=null?u:f,c?e.fill(c):e.fill()});else{if(So(l)){var h=hg(l,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);h&&(e.fillStyle=h,u=!0)}c?e.fill(c):e.fill()}u!==null&&Sr(e,"fillStyle",u,i.currentContext)}},{key:"strokeToContext",value:function(e,n,i,a,s){var o=this,A=n.parsedStyle.stroke,l=null;if(Array.isArray(A)&&A.length>0)A.forEach(function(h){var d=Sr(e,"strokeStyle",dg(h,n,e,o.imagePool),i.currentContext);l=l!=null?l:d,e.stroke()});else{if(So(A)){var c=hg(A,n,e,n.ownerDocument.defaultView.context,a,s,this.imagePool);if(c){var u=Sr(e,"strokeStyle",c,i.currentContext);l=l!=null?l:u}}e.stroke()}l!==null&&Sr(e,"strokeStyle",l,i.currentContext)}},{key:"drawToContext",value:function(e,n,i,a,s){var o,A=n.nodeName,l=n.parsedStyle,c=l.opacity,u=c===void 0?jr.globalAlpha:c,h=l.fillOpacity,d=h===void 0?jr.fillOpacity:h,f=l.strokeOpacity,g=f===void 0?jr.strokeOpacity:f,v=l.lineWidth,p=v===void 0?jr.lineWidth:v,y=l.fill&&!l.fill.isNone,x=l.stroke&&!l.stroke.isNone&&p>0;if(!(!y&&!x)){var F=!Re(l.shadowColor)&&l.shadowBlur>0,O=l.shadowType==="inner",L=((o=l.fill)===null||o===void 0?void 0:o.alpha)===0,U=!!(l.filter&&l.filter.length),R=F&&x&&(A===Kt.PATH||A===Kt.LINE||A===Kt.POLYLINE||L||O),j=null;if(y){R||this.applyShadowAndFilterStyleToContext(e,n,F,i);var q=u*d;j=Sr(e,"globalAlpha",q,i.currentContext),this.fillToContext(e,n,i,a,s),R||this.clearShadowAndFilterStyleForContext(e,F,U,i)}if(x){var et=!1,it=u*g,dt=Sr(e,"globalAlpha",it,i.currentContext);if(j=y?j:dt,R&&(this.applyShadowAndFilterStyleToContext(e,n,F,i),et=!0,O)){var ft=e.globalCompositeOperation;e.globalCompositeOperation="source-atop",this.strokeToContext(e,n,i,a,s),e.globalCompositeOperation=ft,this.clearShadowAndFilterStyleForContext(e,F,U,i,!0)}this.strokeToContext(e,n,i,a,s),et&&this.clearShadowAndFilterStyleForContext(e,F,U,i)}j!==null&&Sr(e,"globalAlpha",j,i.currentContext)}}}])}(),Os=function(r){function t(){return(0,P.Z)(this,t),(0,K.Z)(this,t,arguments)}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"render",value:function(n,i,a,s,o,A){var l=i.fill,c=i.fillRule,u=i.opacity,h=u===void 0?1:u,d=i.fillOpacity,f=d===void 0?1:d,g=i.stroke,v=i.strokeOpacity,p=v===void 0?1:v,y=i.lineWidth,x=y===void 0?1:y,F=i.lineCap,O=i.lineJoin,L=i.shadowType,U=i.shadowColor,R=i.shadowBlur,j=i.filter,q=i.miterLimit,et=l&&!l.isNone,it=g&&!g.isNone&&x>0,dt=(l==null?void 0:l.alpha)===0,ft=!!(j&&j.length),mt=!Re(U)&&R>0,Rt=a.nodeName,Qt=L==="inner",yt=it&&mt&&(Rt===Kt.PATH||Rt===Kt.LINE||Rt===Kt.POLYLINE||dt||Qt);et&&(n.globalAlpha=h*f,yt||gg(a,n,mt),$b(n,a,l,c,s,o,A,this.imagePool),yt||this.clearShadowAndFilter(n,ft,mt)),it&&(n.globalAlpha=h*p,n.lineWidth=x,Re(q)||(n.miterLimit=q),Re(F)||(n.lineCap=F),Re(O)||(n.lineJoin=O),yt&&(Qt&&(n.globalCompositeOperation="source-atop"),gg(a,n,!0),Qt&&(Ey(n,a,g,s,o,A,this.imagePool),n.globalCompositeOperation=jr.globalCompositeOperation,this.clearShadowAndFilter(n,ft,!0))),Ey(n,a,g,s,o,A,this.imagePool))}},{key:"clearShadowAndFilter",value:function(n,i,a){if(a&&(n.shadowColor="transparent",n.shadowBlur=0),i){var s=n.filter;!Re(s)&&s.indexOf("drop-shadow")>-1&&(n.filter=s.replace(/drop-shadow\([^)]*\)/,"").trim()||"none")}}}])}(ak);function gg(r,t,e){var n=r.parsedStyle,i=n.filter,a=n.shadowColor,s=n.shadowBlur,o=n.shadowOffsetX,A=n.shadowOffsetY;i&&i.length&&(t.filter=r.style.filter),e&&(t.shadowColor=a.toString(),t.shadowBlur=s||0,t.shadowOffsetX=o||0,t.shadowOffsetY=A||0)}function $b(r,t,e,n,i,a,s,o){var A=arguments.length>8&&arguments[8]!==void 0?arguments[8]:!1;Array.isArray(e)?e.forEach(function(l){r.fillStyle=dg(l,t,r,o),A||(n?r.fill(n):r.fill())}):(So(e)&&(r.fillStyle=hg(e,t,r,i,a,s,o)),A||(n?r.fill(n):r.fill()))}function Ey(r,t,e,n,i,a,s){var o=arguments.length>7&&arguments[7]!==void 0?arguments[7]:!1;Array.isArray(e)?e.forEach(function(A){r.strokeStyle=dg(A,t,r,s),o||r.stroke()}):(So(e)&&(r.strokeStyle=hg(e,t,r,n,i,a,s)),o||r.stroke())}function sk(r,t){var e=(0,H.Z)(r,4),n=e[0],i=e[1],a=e[2],s=e[3],o=(0,H.Z)(t,4),A=o[0],l=o[1],c=o[2],u=o[3],h=Math.max(n,A),d=Math.max(i,l),f=Math.min(n+a,A+c),g=Math.min(i+s,l+u);return f<=h||g<=d?null:[h,d,f-h,g-d]}function ok(r,t){var e=me(Ot(),[r[0],r[1],0],t),n=me(Ot(),[r[0]+r[2],r[1],0],t),i=me(Ot(),[r[0],r[1]+r[3],0],t),a=me(Ot(),[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 tx=function(r){function t(){return(0,P.Z)(this,t),(0,K.Z)(this,t,arguments)}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"renderDownSampled",value:function(n,i,a,s){var o=s.src,A=s.imageCache;if(!A.downSampled){this.imagePool.createDownSampledImage(o,a).then(function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirty())}).catch(function(l){console.error(l)});return}n.drawImage(A.downSampled,Math.floor(s.drawRect[0]),Math.floor(s.drawRect[1]),Math.ceil(s.drawRect[2]),Math.ceil(s.drawRect[3]))}},{key:"renderTile",value:function(n,i,a,s){var o=s.src,A=s.imageCache,l=s.imageRect,c=s.drawRect,u=A.size,h=n.getTransform(),d=h.a,f=h.b,g=h.c,v=h.d,p=h.e,y=h.f;if(n.resetTransform(),!(A!=null&&A.gridSize)){this.imagePool.createImageTiles(o,[],function(){a.ownerDocument&&(a.dirty(),a.ownerDocument.defaultView.context.renderingService.dirty())},a).catch(function(mt){console.error(mt)});return}for(var x=[u[0]/l[2],u[1]/l[3]],F=[A.tileSize[0]/x[0],A.tileSize[1]/x[1]],O=[Math.floor((c[0]-l[0])/F[0]),Math.ceil((c[0]+c[2]-l[0])/F[0])],L=O[0],U=O[1],R=[Math.floor((c[1]-l[1])/F[1]),Math.ceil((c[1]+c[3]-l[1])/F[1])],j=R[0],q=R[1],et=j;et<=q;et++)for(var it=L;it<=U;it++){var dt=A.tiles[et][it];if(dt){var ft=[Math.floor(l[0]+dt.tileX*F[0]),Math.floor(l[1]+dt.tileY*F[1]),Math.ceil(F[0]),Math.ceil(F[1])];n.drawImage(dt.data,ft[0],ft[1],ft[2],ft[3])}}n.setTransform(d,f,g,v,p,y)}},{key:"render",value:function(n,i,a){var s=i.x,o=s===void 0?0:s,A=i.y,l=A===void 0?0:A,c=i.width,u=i.height,h=i.src,d=i.shadowColor,f=i.shadowBlur,g=this.imagePool.getImageSync(h,a),v=g==null?void 0:g.img,p=c,y=u;if(v){p||(p=v.width),y||(y=v.height);var x=!Re(d)&&f>0;gg(a,n,x);try{var F=a.ownerDocument.defaultView.getContextService().getDomElement(),O=F.width,L=F.height,U=n.getTransform(),R=U.a,j=U.b,q=U.c,et=U.d,it=U.e,dt=U.f,ft=je(R,q,0,0,j,et,0,0,0,0,1,0,it,dt,0,1),mt=ok([o,l,p,y],ft),Rt=sk([0,0,O,L],mt);if(!Rt)return;if(!a.ownerDocument.defaultView.getConfig().enableLargeImageOptimization){t.renderFull(n,i,a,{image:v,drawRect:[o,l,p,y]});return}var Qt=mt[2]/g.size[0];if(Qt<(g.downSamplingRate||.5)){this.renderDownSampled(n,i,a,{src:h,imageCache:g,drawRect:[o,l,p,y]});return}if(!ImagePool.isSupportTile){t.renderFull(n,i,a,{image:v,drawRect:[o,l,p,y]});return}this.renderTile(n,i,a,{src:h,imageCache:g,imageRect:mt,drawRect:Rt})}catch(yt){}}}},{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]))}}])}(Os),ex=function(r){function t(){return(0,P.Z)(this,t),(0,K.Z)(this,t,arguments)}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"render",value:function(n,i,a,s,o,A){a.getBounds();var l=i.lineWidth,c=l===void 0?1:l,u=i.textAlign,h=u===void 0?"start":u,d=i.textBaseline,f=d===void 0?"alphabetic":d,g=i.lineJoin,v=g===void 0?"miter":g,p=i.miterLimit,y=p===void 0?10:p,x=i.letterSpacing,F=x===void 0?0:x,O=i.stroke,L=i.fill,U=i.fillRule,R=i.fillOpacity,j=R===void 0?1:R,q=i.strokeOpacity,et=q===void 0?1:q,it=i.opacity,dt=it===void 0?1:it,ft=i.metrics,mt=i.x,Rt=mt===void 0?0:mt,Qt=i.y,yt=Qt===void 0?0:Qt,xt=i.dx,Dt=i.dy,Xt=i.shadowColor,ne=i.shadowBlur,le=i.textDecorationLine,ge=ft.font,xe=ft.lines,Qe=ft.height,Pe=ft.lineHeight,en=ft.lineMetrics;n.font=ge,n.lineWidth=c,n.textAlign=h==="middle"?"center":h;var mn=f;mn==="alphabetic"&&(mn="bottom"),n.lineJoin=v,Re(y)||(n.miterLimit=y);var an=yt;f==="middle"?an+=-Qe/2-Pe/2:f==="bottom"||f==="alphabetic"||f==="ideographic"?an+=-Qe:(f==="top"||f==="hanging")&&(an+=-Pe);var er=Rt+(xt||0);an+=Dt||0,xe.length===1&&(mn==="bottom"?(mn="middle",an-=.5*Qe):mn==="top"&&(mn="middle",an+=.5*Qe)),n.textBaseline=mn;var kn=!Re(Xt)&&ne>0;gg(a,n,kn);for(var Cn=0;Cn0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),e=(0,K.Z)(this,t),e.name="canvas-renderer",e.options=n,e}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"init",value:function(){var n,i=(0,z.Z)({dirtyObjectNumThreshold:500,dirtyObjectRatioThreshold:.8},this.options),a=this.context.imagePool,s=new Os(a),o=(n={},(0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)((0,we.Z)(n,Kt.CIRCLE,s),Kt.ELLIPSE,s),Kt.RECT,s),Kt.IMAGE,new tx(a)),Kt.TEXT,new ex(a)),Kt.LINE,s),Kt.POLYLINE,s),Kt.POLYGON,s),Kt.PATH,s),Kt.GROUP,void 0),(0,we.Z)((0,we.Z)((0,we.Z)(n,Kt.HTML,void 0),Kt.MESH,void 0),Kt.FRAGMENT,void 0));this.context.defaultStyleRendererFactory=o,this.context.styleRendererFactory=o,this.addRenderingPlugin(new Xb(i))}},{key:"destroy",value:function(){this.removeAllRenderingPlugins(),delete this.context.defaultStyleRendererFactory,delete this.context.styleRendererFactory}}])}(ds),lz=Object.freeze({__proto__:null,CircleRenderer:Os,DefaultRenderer:Os,EllipseRenderer:Os,ImageRenderer:tx,LineRenderer:Os,PathRenderer:Os,Plugin:nx,PolygonRenderer:Os,PolylineRenderer:Os,RectRenderer:Os,TextRenderer:ex}),Ak=Ot(),lk=Ot(),ck=Ot(),uk=$t(),rx=function(){function r(){var t=this;(0,P.Z)(this,r),this.isHit=function(e,n,i,a){var s=t.context.pointInPathPickerFactory[e.nodeName];if(s){var o=on(uk,i),A=me(lk,ve(ck,n[0],n[1],0),o);if(s(e,new ai(A[0],A[1]),a,t.isPointInPath,t.context,t.runtime))return!0}return!1},this.isPointInPath=function(e,n){var i=t.runtime.offscreenCanvasCreator.getOrCreateContext(t.context.config.offscreenCanvas),a=t.context.pathGeneratorFactory[e.nodeName];return a&&(i.beginPath(),a(i,e.parsedStyle),i.closePath()),i.isPointInPath(n.x,n.y)}}return(0,N.Z)(r,[{key:"apply",value:function(e,n){var i,a=this,s=e.renderingService,o=e.renderingContext;this.context=e,this.runtime=n;var A=(i=o.root)===null||i===void 0?void 0:i.ownerDocument;s.hooks.pick.tapPromise(r.tag,function(){var l=(0,Xa.Z)((0,ii.Z)().mark(function c(u){return(0,ii.Z)().wrap(function(h){for(;;)switch(h.prev=h.next){case 0:return h.abrupt("return",a.pick(A,u));case 1:case"end":return h.stop()}},c)}));return function(c){return l.apply(this,arguments)}}()),s.hooks.pickSync.tap(r.tag,function(l){return a.pick(A,l)})}},{key:"pick",value:function(e,n){var i=n.topmost,a=n.position,s=a.x,o=a.y,A=ve(Ak,s,o,0),l=e.elementsFromBBox(A[0],A[1],A[0],A[1]),c=[],u=(0,Ws.Z)(l),h;try{for(u.s();!(h=u.n()).done;){var d=h.value,f=d.getWorldTransform(),g=this.isHit(d,A,f,!1);if(g){var v=NE(d);if(v){var p=v.parsedStyle.clipPath,y=this.isHit(p,A,p.getWorldTransform(),!0);if(y){if(i)return n.picked=[d],n;c.push(d)}}else{if(i)return n.picked=[d],n;c.push(d)}}}}catch(x){u.e(x)}finally{u.f()}return n.picked=c,n}}])}();rx.tag="CanvasPicker";function hk(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,A=n.r,l=n.fill,c=n.stroke,u=n.lineWidth,h=u===void 0?1:u,d=n.increasedLineWidthForHitTesting,f=d===void 0?0:d,g=n.pointerEvents,v=g===void 0?"auto":g,p=(h+f)/2,y=vi(a,o,t.x,t.y),x=cl(v,l,c),F=(0,H.Z)(x,2),O=F[0],L=F[1];return O&&L||e?y<=A+p:O?y<=A:L?y>=A-p&&y<=A+p:!1}function vg(r,t,e,n){return r/(e*e)+t/(n*n)}function dk(r,t,e){var n=r.parsedStyle,i=n.cx,a=i===void 0?0:i,s=n.cy,o=s===void 0?0:s,A=n.rx,l=n.ry,c=n.fill,u=n.stroke,h=n.lineWidth,d=h===void 0?1:h,f=n.increasedLineWidthForHitTesting,g=f===void 0?0:f,v=n.pointerEvents,p=v===void 0?"auto":v,y=t.x,x=t.y,F=cl(p,c,u),O=(0,H.Z)(F,2),L=O[0],U=O[1],R=(d+g)/2,j=(y-a)*(y-a),q=(x-o)*(x-o);return L&&U||e?vg(j,q,A+R,l+R)<=1:L?vg(j,q,A,l)<=1:U?vg(j,q,A-R,l-R)>=1&&vg(j,q,A+R,l+R)<=1:!1}function Ml(r,t,e,n,i,a){return i>=r&&i<=r+e&&a>=t&&a<=t+n}function fk(r,t,e,n,i,a,s){var o=i/2;return Ml(r-o,t-o,e,i,a,s)||Ml(r+e-o,t-o,i,n,a,s)||Ml(r+o,t+n-o,e,i,a,s)||Ml(r-o,t+o,i,n,a,s)}function pg(r,t,e,n,i,a,s,o){var A=(Math.atan2(o-t,s-r)+Math.PI*2)%(Math.PI*2),l={x:r+e*Math.cos(A),y:t+e*Math.sin(A)};return vi(l.x,l.y,s,o)<=a/2}function SA(r,t,e,n,i,a,s){var o=Math.min(r,e),A=Math.max(r,e),l=Math.min(t,n),c=Math.max(t,n),u=i/2;return a>=o-u&&a<=A+u&&s>=l-u&&s<=c+u?tl(r,t,e,n,a,s)<=i/2:!1}function ix(r,t,e,n,i){var a=r.length;if(a<2)return!1;for(var s=0;s0!=By(o[1]-e)>0&&By(t-(e-s[1])*(s[0]-o[0])/(s[1]-o[1])-s[0])<0&&(n=!n)}return n}function sx(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 ox=function(r){function t(){var e;(0,P.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;ao?s:o,l=s>o?1:s/o,c=s>o?o/s:1;r.save(),r.scale(l,c),r.arc(n,a,A,0,Math.PI*2)}}function Fk(r,t){var e=t.x1,n=t.y1,i=t.x2,a=t.y2,s=t.markerStart,o=t.markerEnd,A=t.markerStartOffset,l=t.markerEndOffset,c=0,u=0,h=0,d=0,f=0,g,v;s&&Ln(s)&&A&&(g=i-e,v=a-n,f=Math.atan2(v,g),c=Math.cos(f)*(A||0),u=Math.sin(f)*(A||0)),o&&Ln(o)&&l&&(g=e-i,v=n-a,f=Math.atan2(v,g),h=Math.cos(f)*(l||0),d=Math.sin(f)*(l||0)),r.moveTo(e+c,n+u),r.lineTo(i+h,a+d)}function Tk(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.d,o=s.absolutePath,A=s.segments,l=0,c=0,u=0,h=0,d=0,f,g;if(e&&Ln(e)&&i){var v=e.parentNode.getStartTangent(),p=(0,H.Z)(v,2),y=p[0],x=p[1];f=y[0]-x[0],g=y[1]-x[1],d=Math.atan2(g,f),l=Math.cos(d)*(i||0),c=Math.sin(d)*(i||0)}if(n&&Ln(n)&&a){var F=n.parentNode.getEndTangent(),O=(0,H.Z)(F,2),L=O[0],U=O[1];f=L[0]-U[0],g=L[1]-U[1],d=Math.atan2(g,f),u=Math.cos(d)*(a||0),h=Math.sin(d)*(a||0)}for(var R=0;RQe?xe:Qe,kn=xe>Qe?1:xe/Qe,Cn=xe>Qe?Qe/xe:1;r.translate(le,ge),r.rotate(mn),r.scale(kn,Cn),r.arc(0,0,er,Pe,en,!!(1-an)),r.scale(1/kn,1/Cn),r.rotate(-mn),r.translate(-le,-ge)}dt&&r.lineTo(j[6]+u,j[7]+h);break}case"Z":r.closePath();break}}}function Ok(r,t){var e=t.markerStart,n=t.markerEnd,i=t.markerStartOffset,a=t.markerEndOffset,s=t.points.points,o=s.length,A=s[0][0],l=s[0][1],c=s[o-1][0],u=s[o-1][1],h=0,d=0,f=0,g=0,v=0,p,y;e&&Ln(e)&&i&&(p=s[1][0]-s[0][0],y=s[1][1]-s[0][1],v=Math.atan2(y,p),h=Math.cos(v)*(i||0),d=Math.sin(v)*(i||0)),n&&Ln(n)&&a&&(p=s[o-1][0]-s[0][0],y=s[o-1][1]-s[0][1],v=Math.atan2(y,p),f=Math.cos(v)*(a||0),g=Math.sin(v)*(a||0)),r.moveTo(A+(h||f),l+(d||g));for(var x=1;x0?1:-1,d=A>0?1:-1,f=h+d===0,g=s.map(function(O){return dr(O,0,Math.min(Math.abs(l)/2,Math.abs(c)/2))}),v=(0,H.Z)(g,4),p=v[0],y=v[1],x=v[2],F=v[3];r.moveTo(h*p+n,a),r.lineTo(l-h*y+n,a),y!==0&&r.arc(l-h*y+n,d*y+a,y,-d*Math.PI/2,h>0?0:Math.PI,f),r.lineTo(l+n,c-d*x+a),x!==0&&r.arc(l-h*x+n,c-d*x+a,x,h>0?0:Math.PI,d>0?Math.PI/2:1.5*Math.PI,f),r.lineTo(h*F+n,c+a),F!==0&&r.arc(h*F+n,c-d*F+a,F,d>0?Math.PI/2:-Math.PI/2,h>0?Math.PI:0,f),r.lineTo(n,d*p+a),p!==0&&r.arc(h*p+n,d*p+a,p,h>0?Math.PI:0,d>0?Math.PI*1.5:Math.PI/2,f)}}var Ax=function(r){function t(){var e;(0,P.Z)(this,t);for(var n=arguments.length,i=new Array(n),a=0;a0&&o[0]!==void 0?o[0]:{},a=i.type,s=i.encoderOptions,A.abrupt("return",this.context.canvas.toDataURL(a,s));case 1:case"end":return A.stop()}},n,this)}));function e(){return t.apply(this,arguments)}return e}()}])}(),kk=function(r){function t(){var e;(0,P.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);bh(n.context.eventService,"mappingTable.pointerupoutside",[]),n.context.eventService.mapEvent(o)})}}get eventService(){return this.context.canvas.context.eventService}get events(){return[Yt.CLICK,Yt.POINTER_DOWN,Yt.POINTER_MOVE,Yt.POINTER_UP,Yt.POINTER_OVER,Yt.POINTER_LEAVE]}getDomElement(){return this.getShape("key").getDomElement()}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.drawPortShapes(t,e)}getKeyStyle(t){const e=Fl(t,["dx","dy","innerHTML","pointerEvents","cursor"]),{dx:n=0,dy:i=0}=e,a=Rk(e,["dx","dy"]),[s,o]=this.getSize(t);return Object.assign(Object.assign({x:n,y:i},a),{width:s,height:o})}drawKeyShape(t,e){const n=this.getKeyStyle(t),{x:i,y:a,width:s=0,height:o=0}=n,A=this.upsert("key-container",Ci,{x:i,y:a,width:s,height:o,opacity:0},e);return this.upsert("key",gl,n,A)}connectedCallback(){if(!(this.context.canvas.getRenderer("main")instanceof Mh))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 Zn,{x:o=0,y:A=0,size:l}=t,[c,u]=Da(l);return s.setMinMax([o-c/2,A-u/2,0],[o+c/2,A+u/2,0]),s}const a=vh(i.map(s=>s.getBounds()));return n?EA(a,n):a}drawCollapsedMarkerShape(t,e){const n=this.getCollapsedMarkerStyle(t);this.upsert("collapsed-marker",Zb,n,e),yy(this)}getCollapsedMarkerStyle(t){if(!t.collapsed||!t.collapsedMarker)return!1;const e=Ir(this.getGraphicStyle(t),"collapsedMarker"),{type:n}=e,i=ux(e,["type"]),a=this.getShape("key"),[s,o]=Uo(a.getLocalBounds(),"center"),A=Object.assign(Object.assign({},i),{x:s,y:o});if(n){const l=this.getCollapsedMarkerText(n,t);Object.assign(A,{text:l})}return A}getCollapsedMarkerText(t,e){const{childrenData:n=[]}=e,{model:i}=this.context;return t==="descendant-count"?i.getDescendantsData(this.id).length.toString():t==="child-count"?n.length.toString():t==="node-count"?i.getDescendantsData(this.id).filter(a=>i.getElementType(Nt(a))==="node").length.toString():Vt(t)?t(n):""}getComboPosition(t){const{x:e=0,y:n=0,collapsed:i,childrenData:a=[]}=t;if(a.length===0)return[+e,+n,0];if(i){const{model:s}=this.context,o=s.getDescendantsData(this.id).filter(A=>!s.isCombo(Nt(A)));if(o.length>0&&o.some(pL)){const A=o.reduce((l,c)=>$e(l,li(c)),[0,0,0]);return Ms(A,o.length)}return[+e,+n,0]}return this.getContentBBox(t).center}getComboStyle(t){const[e,n]=this.getComboPosition(t);return{x:e,y:n,transform:[["translate",e,n]]}}updateComboPosition(t){const e=this.getComboStyle(t);Object.assign(this.style,e);const{x:n,y:i}=e;this.context.model.syncNodeLikeDatum({id:this.id,style:{x:n,y:i}}),wy(this)}render(t,e=this){super.render(t,e),this.drawCollapsedMarkerShape(t,e)}update(t={}){super.update(t),this.updateComboPosition(this.parsedAttributes)}onframe(){super.onframe(),this.attributes.collapsed||this.updateComboPosition(this.parsedAttributes),this.drawKeyShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(this.attributes.collapsed?t:t.map(i=>{var{x:a,y:s,z:o,transform:A}=i,l=ux(i,["x","y","z","transform"]);return l}),e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}zc.defaultStyleProps={childrenNode:[],droppable:!0,draggable:!0,collapsed:!1,collapsedSize:32,collapsedMarker:!0,collapsedMarkerZIndex:1,collapsedMarkerFontSize:12,collapsedMarkerTextAlign:"center",collapsedMarkerTextBaseline:"middle",collapsedMarkerType:"child-count"};class _k extends zc{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",eo,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&&Ir(n,"collapsed")),{r:i/2})}getCollapsedKeySize(t){const[e,n]=Da(t.collapsedSize),i=Math.max(e,n)/2;return[i*2,i*2,0]}getExpandedKeySize(t){const e=this.getContentBBox(t),[n,i]=yA(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 rg(t,n,e)}}class Hk extends zc{constructor(t){super(t)}drawKeyShape(t,e){return this.upsert("key",Ci,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&&Ir(e,"collapsed")),{width:n,height:i,x:-n/2,y:-i/2})}}var Gk=function(r,t){if(!dh(r))return r;for(var e=[],n=0;n-1:!1},Vk=Kk,Wk=function(r,t){return t===void 0&&(t=[]),zk(r,function(e){return!Vk(t,e)})},jk=Wk;const Zk={padding:10};function hx(r,t,e,n,i,a){const{padding:s}=Object.assign(Zk,a),o=wA(e,s),A=wA(n,s),l=[r,...i,t];let c=null;const u=[];for(let h=0,d=l.length;ha?"N":"S":n===a?e>i?"W":"E":null}function by(r,t){return t==="N"||t==="S"?ao(r):io(r)}function fx(r,t,e){const n=[r[0],t[1]],i=[t[0],r[1]],a=ra(r,n),s=ra(r,i),o=e?Yk[e]:null,A=a===e||a!==o&&s!==e?n:i;return{points:[A],direction:ra(A,t)}}function Eg(r,t,e){if(_f(r,e)){const n=Fh(r,t,e);return{points:[n],direction:ra(n,t)}}else{const n=wl(r,e),a=["left","right"].includes(ph(r,e))?[t[0],n[1]]:[n[0],t[1]];return{points:[a],direction:ra(a,t)}}}function gx(r,t,e,n){const i=_f(t,e)?t:wl(t,e),a=[[i[0],r[1]],[r[0],i[1]]],s=a.filter(A=>xI(A,e)&&!QB(A,e,!0)),o=s.filter(A=>ra(A,r)!==n);if(o.length>0){const A=o.find(l=>ra(r,l)===n)||o[0];return{points:[A],direction:ra(A,t)}}else{const A=jk(a,s)[0],l=xA(t,A,by(e,n)/2);return{points:[Fh(l,r,e),l],direction:ra(l,t)}}}function Xk(r,t,e,n){let i=Eg(r,t,e);const a=wh(i.points[0]);if(xs(a,n)){i=Eg(t,r,n);const s=wh(i.points[0]);if(xs(s,e)){const o=xA(r,a,by(e,ra(r,a))/2),A=xA(t,s,by(n,ra(t,s))/2),l=[(o[0]+A[0])/2,(o[1]+A[1])/2],c=Eg(r,l,e),u=gx(l,t,n,c.direction);i.points=[c.points[0],u.points[0]],i.direction=u.direction}}return i}function xy(r,t,e,n,i){const s=vh([e,n]),o=cr(t,s.center)>cr(r,s.center),[A,l]=o?[t,r]:[r,t],c=ao(s)+io(s);let u;if(i){const f=[A[0]+c*Math.cos(dx[i]),A[1]+c*Math.sin(dx[i])];u=xA(wl(f,s),f,.01)}else u=xA(wl(A,s),A,-.01);let h=Fh(u,l,s),d=[Eh(u,2),Eh(h,2)];if(Pr(Eh(u),Eh(h))){const f=ly(tr(u,A),[1,0,0])+Math.PI/2;h=[l[0]+c*Math.cos(f),l[1]+c*Math.sin(f),0],h=Eh(xA(wl(h,s),l,-.01),2);const g=Fh(u,h,s);d=[u,g,h]}return{points:o?d.reverse():d,direction:ra(o?u:h,t)}}function Fh(r,t,e){let n=[r[0],t[1]];return xs(n,e)&&(n=[t[0],r[1]]),n}function vx(r,t,e,n,i){let A=typeof t=="number"?t:.5;t==="start"&&(A=0),t==="end"&&(A=.99);const l=Mi(r.getPoint(A)),c=Mi(r.getPoint(A+.01));let u=t==="start"?"left":t==="end"?"right":"center";if(Tb(l,c)||!e){const[p,y]=px(r,A,n,i);return{transform:[["translate",p,y]],textAlign:u}}let h=Math.atan2(c[1]-l[1],c[0]-l[0]);c[0]{const c=s[l-1]||i,u=s[l+1]||a;if(!Ob(c,A,u)&&t){const[h,d]=eQ(c,A,u,t);o.push(["L",h[0],h[1]],["Q",A[0],A[1],d[0],d[1]],["L",d[0],d[1]])}else o.push(["L",A[0],A[1]])}),o.push(["L",a[0],a[1]]),e&&o.push(["Z"]),o}function eQ(r,t,e,n){const i=eg(r,t),a=eg(e,t),s=Math.min(n,Math.min(i,a)/2),o=[t[0]-s/i*(t[0]-r[0]),t[1]-s/i*(t[1]-r[1])],A=[t[0]-s/a*(t[0]-e[0]),t[1]-s/a*(t[1]-e[1])];return[o,A]}const nQ=r=>{const t=Math.PI/2,e=ao(r)/2,n=io(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 yx(r,t,e,n,i){const a=wA(r),s=r.getCenter();let o=n&&FA(n),A=i&&FA(i);if(!o||!A){const l=nQ(a),c=l[t][0],u=l[t][1],[h,d]=yA(a),f=Math.max(h,d),g=$e(s,[f*Math.cos(c),f*Math.sin(c),0]),v=$e(s,[f*Math.cos(u),f*Math.sin(u),0]);o=Iy(r,g),A=Iy(r,v),e||([o,A]=[A,o])}return[o,A]}function rQ(r,t,e,n,i,a){const s=r.getPorts()[i||a],o=r.getPorts()[a||i];let[A,l]=yx(r,t,e,s,o);const c=iQ(r,A,l,n);return s&&(A=Oh(s,c[0])),o&&(l=Oh(o,c.at(-1))),mx(A,l,c)}function iQ(r,t,e,n){const i=r.getCenter();if(Pr(t,e)){const a=tr(t,i),s=[n*Math.sign(a[0])||n/2,n*Math.sign(a[1])||-n/2,0];return[$e(t,s),$e(e,Ss(s,[1,-1,1]))]}return[xA(i,t,cr(i,t)+n),xA(i,e,cr(i,e)+n)]}function aQ(r,t,e,n,i,a,s){const o=Oy(r),A=o[a||s],l=o[s||a];let[c,u]=yx(r,e,n,A,l);const h=sQ(r,c,u,i);return A&&(c=Oh(A,h[0])),l&&(u=Oh(l,h.at(-1))),Sy([c,...h,u],t)}function sQ(r,t,e,n){const i=[],a=wA(r);if(Pr(t,e))switch(ph(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=ph(t,a),o=ph(e,a);if(s===o){const A=s;let l,c;switch(A){case"left":l=Math.min(t[0],e[0])-n,i.push([l,t[1]]),i.push([l,e[1]]);break;case"right":l=Math.max(t[0],e[0])+n,i.push([l,t[1]]),i.push([l,e[1]]);break;case"top":c=Math.min(t[1],e[1])-n,i.push([t[0],c]),i.push([e[0],c]);break;case"bottom":c=Math.max(t[1],e[1])+n,i.push([t[0],c]),i.push([e[0],c]);break}}else{const A=(h,d)=>({left:[d[0]-n,d[1]],right:[d[0]+n,d[1]],top:[d[0],d[1]-n],bottom:[d[0],d[1]+n]})[h],l=A(s,t),c=A(o,e),u=Fh(l,c,a);i.push(l,u,c)}}return i}function My(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 wx(r,t){const e=[];let n=r;for(;n;){e.push(n);const i=t(Nt(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(pa);return e[i]||e.at(-1)}return r}function oQ(r,t){return t||(r<4?10:r===4?12:r*2.5)}const AQ=(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"]]},Ex=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",r/2,t/2],["Z"]],lQ=(r,t)=>[["M",-r/2,0],["L",0,-t/2],["L",r/2,0],["L",0,t/2],["Z"]],cQ=(r,t)=>[["M",-r/2,0],["L",r/2,-t/2],["L",4*r/5-r/2,0],["L",r/2,t/2],["Z"]],uQ=(r,t)=>[["M",-r/2,-t/2],["L",r/2,-t/2],["L",r/2,t/2],["L",-r/2,t/2],["Z"]],hQ=(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"]]},dQ=(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 Bg=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{l in i&&(A[l]=i[l])}),A}getLoopPath(t){const{sourcePort:e,targetPort:n}=t,i=this.sourceNode,a=wA(i),s=Math.max(io(a),ao(a)),{placement:o,clockwise:A,dist:l=s}=Ir(this.getGraphicStyle(t),"loop");return rQ(i,o,A,l,e,n)}getEndpoints(t,e=!0,n=[]){const{sourcePort:i,targetPort:a}=t,{sourceNode:s,targetNode:o}=this,[A,l]=CQ(s,o,i,a);if(!e){const d=A?FA(A):s.getCenter(),f=l?FA(l):o.getCenter();return[d,f]}const c=typeof n=="function"?n():n,u=Tx(A||s,c[0]||l||o),h=Tx(l||o,c[c.length-1]||A||s);return[u,h]}getHaloStyle(t){if(t.halo===!1)return!1;const e=this.getKeyStyle(t),n=Ir(this.getGraphicStyle(t),"halo");return Object.assign(Object.assign({},e),n)}getLabelStyle(t){if(t.label===!1||!t.labelText)return!1;const e=Ir(this.getGraphicStyle(t),"label"),{placement:n,offsetX:i,offsetY:a,autoRotate:s,maxWidth:o}=e,A=Bg(e,["placement","offsetX","offsetY","autoRotate","maxWidth"]),l=vx(this.shapeMap.key,n,s,i,a),c=this.shapeMap.key.getLocalBounds(),u=LL([c.min,c.max],o);return Object.assign({wordWrapWidth:u},l,A)}getBadgeStyle(t){if(t.badge===!1||!t.badgeText)return!1;const e=Ir(t,"badge"),{offsetX:n,offsetY:i,placement:a}=e,s=Bg(e,["offsetX","offsetY","placement"]);return Object.assign(s,Jk(this.shapeMap,a,t.labelPlacement,n,i))}drawArrow(t,e){var n;const i=e==="start",s=t[e==="start"?"startArrow":"endArrow"],o=this.shapeMap.key;if(s){const A=this.getArrowStyle(t,i),[l,c,u]=i?["markerStart","markerStartOffset","startArrowOffset"]:["markerEnd","markerEndOffset","endArrowOffset"],h=o.parsedStyle[l];if(h)h.attr(A);else{const d=A.src?Ah:Pi,f=new d({style:A});o.style[l]=f}o.style[c]=t[u]||A.width/2+ +A.lineWidth}else{const A=i?"markerStart":"markerEnd";(n=o.style[A])===null||n===void 0||n.destroy(),o.style[A]=null}}getArrowStyle(t,e){const n=this.getShape("key").attributes,i=e?"startArrow":"endArrow",a=Ir(this.getGraphicStyle(t),i),{size:s,type:o}=a,A=Bg(a,["size","type"]),[l,c]=Da(oQ(n.lineWidth,s)),h=(Vt(o)?o:W[o]||Ex)(l,c);return Object.assign(Fl(n,["stroke","strokeOpacity","fillOpacity"]),{width:l,height:c},Object.assign({},h&&{d:h,fill:o==="simple"?"":n.stroke}),A)}drawLabelShape(t,e){const n=this.getLabelStyle(t);this.upsert("label",Ao,n,e)}drawHaloShape(t,e){const n=this.getHaloStyle(t);this.upsert("halo",Pi,n,e)}drawBadgeShape(t,e){const n=this.getBadgeStyle(t);this.upsert("badge",Hc,n,e)}drawSourceArrow(t){this.drawArrow(t,"start")}drawTargetArrow(t){this.drawArrow(t,"end")}drawKeyShape(t,e){const n=this.getKeyStyle(t);return this.upsert("key",Pi,n,e)}render(t=this.parsedAttributes,e=this){this.drawKeyShape(t,e),this.getShape("key")&&(this.drawSourceArrow(t),this.drawTargetArrow(t),this.drawLabelShape(t,e),this.drawHaloShape(t,e),this.drawBadgeShape(t,e))}onframe(){this.drawKeyShape(this.parsedAttributes,this),this.drawSourceArrow(this.parsedAttributes),this.drawTargetArrow(this.parsedAttributes),this.drawHaloShape(this.parsedAttributes,this),this.drawLabelShape(this.parsedAttributes,this),this.drawBadgeShape(this.parsedAttributes,this)}animate(t,e){const n=super.animate(t,e);return n&&new Proxy(n,{set:(i,a,s)=>(a==="currentTime"&&Promise.resolve().then(()=>this.onframe()),Reflect.set(i,a,s))})}}MA.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 Tl extends MA{constructor(t){super(mi({style:Tl.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t),{controlPoints:i,curvePosition:a,curveOffset:s}=t,o=this.getControlPoints(e,n,$k(a),qk(s),i);return mx(e,n,o)}getControlPoints(t,e,n,i,a){return(a==null?void 0:a.length)===2?a:[Cy(t,e,n[0],i[0]),Cy(t,e,n[1],i[1])]}}Tl.defaultStyleProps={curvePosition:.5,curveOffset:20};class bg extends Tl{constructor(t){super(mi({style:bg.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]]]}}bg.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class xg extends Tl{constructor(t){super(mi({style:xg.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=li(this.ref),n=this.sourceNode.getIntersectPoint(e,!0),i=this.targetNode.getIntersectPoint(e);return[n,i]}toRadialCoordinate(t){const e=li(this.ref),n=cr(t,e),i=xb(tr(t,e));return[n,i]}getControlPoints(t,e,n,i){const[a,s]=this.toRadialCoordinate(t),[o]=this.toRadialCoordinate(e),A=o-a;return[[t[0]+(A*n[0]+i[0])*Math.cos(s),t[1]+(A*n[0]+i[0])*Math.sin(s)],[e[0]-(A*n[1]-i[0])*Math.cos(s),e[1]-(A*n[1]-i[0])*Math.sin(s)]]}}xg.defaultStyleProps={curvePosition:.5,curveOffset:20};class Cg extends Tl{constructor(t){super(mi({style:Cg.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]]]}}Cg.defaultStyleProps={curvePosition:[.5,.5],curveOffset:[0,0]};class Sg extends MA{constructor(t){super(mi({style:Sg.defaultStyleProps},t))}getKeyPath(t){const[e,n]=this.getEndpoints(t);return[["M",e[0],e[1]],["L",n[0],n[1]]]}}Sg.defaultStyleProps={};const fQ={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:eg},Do=r=>`${Math.round(r[0])}|||${Math.round(r[1])}`;function Ol(r,t){const e=n=>Math.round(n/t);return ye(r)?e(r):r.map(e)}function gQ(r,t){const e=Math.abs(r-t);return e>Math.PI?2*Math.PI-e:e}function Bx(r,t){const e=t[0]-r[0],n=t[1]-r[1];return!e&&!n?0:Math.atan2(n,e)}function bx(r,t,e,n){const i=Bx(r,t),a=e[Do(r)],o=Bx(a||n,r);return gQ(o,i)}const vQ=(r,t)=>{const{offset:e,gridSize:n}=t,i={};return r.forEach(a=>{if(!a||a.destroyed||!a.isVisible())return;const s=EA(a.getRenderBounds(),e);for(let o=Ol(s.min[0],n);o<=Ol(s.max[0],n);o+=1)for(let A=Ol(s.min[1],n);A<=Ol(s.max[1],n);A+=1)i[`${o}|||${A}`]=!0}),i};function xx(r,t,e){return Math.min(...t.map(n=>e(r,n)))}function pQ(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=EA(t.getRenderBounds(),a),o=Object.keys(i).reduce((A,l)=>{if(e.includes(l)){const c=i[l],[u,h]=yA(s),d=[r[0]+c.stepX*u,r[1]+c.stepY*h],f=MI(s);for(let g=0;gOl(A,n.gridSize))},mQ=(r,t,e,n,i,a,s)=>{const o=[];let A=[a[0]===n[0]?n[0]:r[0]*s,a[1]===n[1]?n[1]:r[1]*s];o.unshift(A);let l=r,c=t[Do(l)];for(;c;){const d=c,f=l;bx(d,f,t,e)&&(A=[d[0]===f[0]?A[0]:d[0]*s,d[1]===f[1]?A[1]:d[1]*s],o.unshift(A)),c=t[Do(d)],l=d}const u=i.map(d=>[d[0]*s,d[1]*s]),h=pQ(u,A,eg);return o.unshift(h),o};function yQ(r,t,e,n){const i=bl(r.getCenter()),a=bl(t.getCenter()),s=Object.assign(fQ,n),{gridSize:o}=s,A=s.enableObstacleAvoidance?e:[r,t],l=vQ(A,s),c=Ol(i,o),u=Ol(a,o),h=Cx(i,r,s.startDirections,s),d=Cx(a,t,s.endDirections,s);h.forEach(R=>delete l[Do(R)]),d.forEach(R=>delete l[Do(R)]);const f={},g={},v={},p={},y={},x=new wQ;for(let R=0;RDo(R));let O=s.maximumLoops,L,U=1/0;for(const[R,j]of Object.entries(f))y[R]<=U&&(U=y[R],L=j);for(;Object.keys(f).length>0&&O>0;){const R=x.minId(!1);if(R)L=f[R];else break;const j=Do(L);if(F.includes(j))return mQ(L,v,c,a,h,u,o);delete f[j],x.remove(j),g[j]=!0;for(const q of Object.values(s.directionMap)){const et=$e(L,[q.stepX,q.stepY]),it=Do(et);if(g[it])continue;const dt=bx(L,et,v,c);if(dt>s.maxAllowedDirectionChange||l[it])continue;f[it]||(f[it]=et);const ft=s.penalties[dt],mt=s.distFunc(L,et)+(isNaN(ft)?o:ft),Rt=p[j]+mt,Qt=p[it];Qt&&Rt>=Qt||(v[it]=L,p[it]=Rt,y[it]=Rt+xx(et,d,s.distFunc),x.add({id:it,value:y[it]}))}O-=1}return[]}class wQ{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 Mg extends MA{constructor(t){super(mi({style:Mg.defaultStyleProps},t))}getControlPoints(t){const{router:e}=t,{sourceNode:n,targetNode:i}=this,[a,s]=this.getEndpoints(t,!1);let o=[];if(!e)o=t.controlPoints;else if(e.type==="shortest-path"){const A=this.context.element.getNodes();o=yQ(n,i,A,e),o.length||(o=hx(a,s,n,i,t.controlPoints,{padding:e.offset}))}else e.type==="orth"&&(o=hx(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 Sy(e,t.radius)}getLoopPath(t){const{sourcePort:e,targetPort:n,radius:i}=t,a=this.sourceNode,s=wA(a),o=Math.max(io(s),ao(s))/4,{placement:A,clockwise:l,dist:c=o}=Ir(this.getGraphicStyle(t),"loop");return aQ(a,i,A,l,c,e,n)}}Mg.defaultStyleProps={radius:0,controlPoints:[],router:!1};class Fg extends MA{constructor(t){super(mi({style:Fg.defaultStyleProps},t))}getKeyPath(t){const{curvePosition:e,curveOffset:n}=t,[i,a]=this.getEndpoints(t),s=t.controlPoint||Cy(i,a,e,n);return tQ(i,a,s)}}Fg.defaultStyleProps={curvePosition:.5,curveOffset:30};var EQ=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;Mx(n)&&(t[a=s||i]||(t[a]=Uo(r.getShape("key").getBounds(),o)))}),t}function Mx(r){const{r:t}=r;return!t||Number(t)===0}function FA(r){return Pc(r)?r:r.getPosition()}function CQ(r,t,e,n){const i=Fx(r,t,e,n),a=Fx(t,r,n,e);return[i,a]}function Fx(r,t,e,n){const i=Oy(r);if(e)return i[e];const a=Object.values(i);if(a.length===0)return;const s=a.map(l=>FA(l)),o=SQ(t,n),[A]=BL(s,o);return a.find(l=>FA(l)===A)}function SQ(r,t){const e=Oy(r);if(t)return[FA(e[t])];const n=Object.values(e);return n.length>0?n.map(i=>FA(i)):[r.getCenter()]}function Tx(r,t){return Fy(r)||Th(r)?Iy(r,t):Oh(r,t)}function Oh(r,t){if(!r||!t)return[0,0,0];if(Pc(r))return r;if(r.attributes.linkToCenter)return r.getPosition();const e=Pc(t)?t:Th(t)?t.getCenter():t.getPosition();return rg(e,r.getBounds())}function Iy(r,t){if(!r||!t)return[0,0,0];const e=Pc(t)?t:Th(t)?t.getCenter():t.getPosition();return r.getIntersectPoint(e)||r.getCenter()}function Ox(r,t="bottom",e=0,n=0,i=!1){const a=t.split("-"),[s,o]=Uo(r,t),[A,l]=i?["bottom","top"]:["top","bottom"],c=a.includes("top")?l:a.includes("bottom")?A:"middle",u=a.includes("left")?"right":a.includes("right")?"left":"center";return{transform:[["translate",s+e,o+n]],textBaseline:c,textAlign:u}}function MQ(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 FQ(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 TQ(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 OQ(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 hz(r,t){return[[r/2,-t/2],[r/2,t/2],[-r/2,t/2],[-r/2,-t/2]]}function IQ(r,t){return[[0,-t/2],[r/2,0],[0,t/2],[-r/2,0]]}function Ix(r){return Fi(r,["style","visibility"])!=="hidden"}function NQ(r,t){const{zIndex:e,transform:n,transformOrigin:i,visibility:a,cursor:s,clipPath:o,component:A}=t,l=EQ(t,["zIndex","transform","transformOrigin","visibility","cursor","clipPath","component"]);Object.assign(r.attributes,l),n&&r.setAttribute("transform",n),ye(e)&&r.setAttribute("zIndex",e),i&&r.setAttribute("transformOrigin",i),a&&r.setAttribute("visibility",a),s&&r.setAttribute("cursor",s),o&&r.setAttribute("clipPath",o),A&&r.setAttribute("component",A)}function Ny(r,t){"update"in r?r.update(t):r.attr(t)}function LQ(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 kQ(r){bh(r,"__to_be_destroyed__",!0)}function Ih(r){return Fi(r,"__to_be_destroyed__",!1)}var QQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Tg extends Ra{constructor(t,e){super(t,Object.assign({},Tg.defaultOptions,e)),this.onCollapseExpand=n=>QQ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{target:i}=n;if(!BQ(i))return;const a=i.id,{model:s,graph:o}=this.context,A=s.getElementDataById(a);if(!A)return!1;const{onCollapse:l,onExpand:c,animation:u,align:h}=this.options;pa(A)?(yield o.expandElement(a,{animation:u,align:h}),c==null||c(a)):(yield o.collapseElement(a,{animation:u,align:h}),l==null||l(a))}),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.on(`node:${e}`,this.onCollapseExpand),t.on(`combo:${e}`,this.onCollapseExpand)}unbindEvents(){const{graph:t}=this.context,{trigger:e}=this.options;t.off(`node:${e}`,this.onCollapseExpand),t.off(`combo:${e}`,this.onCollapseExpand)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Tg.defaultOptions={enable:!0,animation:!0,trigger:Yt.DBLCLICK,align:!0};var Og={},UQ=function(r){return r=r||"g",Og[r]?Og[r]+=1:Og[r]=1,r+Og[r]},Nh=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);if.length!==g.length?!1:f.every((v,p)=>v===g[p]),d=(f,g)=>{const v=Object.keys(f),p=Object.keys(g);return v.length!==p.length?!1:v.every(y=>f[y]===g[y])};return!(!d(s,u)||!h(a,c)||!h(e,o)||!d(n,A)||!d(i,l))}const Nx="__internal_override__";function Lx(r){return r[Nx]!==!1}var Ig=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};const RQ="g6-create-edge-assist-edge-id",Ng="g6-create-edge-assist-node-id";class Lg extends Ra{constructor(t,e){super(t,Object.assign({},Lg.defaultOptions,e)),this.drop=n=>Ig(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=>Ig(this,void 0,void 0,function*(){var i,a,s;if(!this.validate(n))return;const{graph:o,canvas:A,batch:l,element:c}=this.context,{style:u}=this.options;if(this.source){this.createEdge(n),yield this.cancelEdge();return}l.startBatch(),A.setCursor("crosshair"),this.source=this.getSelectedNodeIDs([n.target.id])[0];const h=o.getElementData(this.source);o.addNodeData([{id:Ng,type:"circle",[Nx]:!1,style:{size:1,visibility:"hidden",ports:[{key:"port-1",placement:[.5,.5]}],x:(i=h.style)===null||i===void 0?void 0:i.x,y:(a=h.style)===null||a===void 0?void 0:a.y}}]),o.addEdgeData([{id:RQ,source:this.source,target:Ng,style:Object.assign({pointerEvents:"none"},u)}]),yield(s=c.draw({animation:!1}))===null||s===void 0?void 0:s.finished}),this.updateAssistEdge=n=>Ig(this,void 0,void 0,function*(){var i;if(!this.source)return;const{model:a,element:s}=this.context;a.translateNodeTo(Ng,[n.client.x,n.client.y]),yield(i=s.draw({animation:!1,silence:!0}))===null||i===void 0?void 0:i.finished}),this.createEdge=n=>{var i,a;const{graph:s}=this.context,{style:o,onFinish:A,onCreate:l}=this.options;if(((i=n.target)===null||i===void 0?void 0:i.id)===void 0||this.source===void 0)return;const u=(a=this.getSelectedNodeIDs([n.target.id]))===null||a===void 0?void 0:a[0],h=`${this.source}-${u}-${UQ()}`,d=l({id:h,source:this.source,target:u,style:o});d&&(s.addEdgeData([d]),A(d))},this.cancelEdge=()=>Ig(this,void 0,void 0,function*(){var n;if(!this.source)return;const{graph:i,element:a,batch:s}=this.context;i.removeNodeData([Ng]),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(rs.CLICK,this.handleCreateEdge),t.on(yl.CLICK,this.handleCreateEdge),t.on(No.CLICK,this.cancelEdge),t.on(Df.CLICK,this.cancelEdge)):(t.on(rs.DRAG_START,this.handleCreateEdge),t.on(yl.DRAG_START,this.handleCreateEdge),t.on(Yt.POINTER_UP,this.drop)),t.on(Yt.POINTER_MOVE,this.updateAssistEdge)}getSelectedNodeIDs(t){return Array.from(new Set(this.context.graph.getElementDataByState("node",this.options.state).map(e=>e.id).concat(t)))}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;t.off(rs.CLICK,this.handleCreateEdge),t.off(yl.CLICK,this.handleCreateEdge),t.off(No.CLICK,this.cancelEdge),t.off(Df.CLICK,this.cancelEdge),t.off(rs.DRAG_START,this.handleCreateEdge),t.off(yl.DRAG_START,this.handleCreateEdge),t.off(Yt.POINTER_UP,this.drop),t.off(Yt.POINTER_MOVE,this.updateAssistEdge)}destroy(){this.unbindEvents(),super.destroy()}}Lg.defaultOptions={animation:!0,enable:!0,style:{},trigger:"drag",onCreate:r=>r,onFinish:()=>{}};function DQ(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 Lh=DQ,kx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class kg extends Ra{constructor(t,e){super(t,Object.assign({},kg.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||_r.isPinching)return;const A=(a=(i=n.movement)===null||i===void 0?void 0:i.x)!==null&&a!==void 0?a:n.dx,l=(o=(s=n.movement)===null||s===void 0?void 0:s.y)!==null&&o!==void 0?o:n.dy;A|l&&this.translate([A,l],!1)},this.onDragEnd=()=>{var n,i;this.isDragging=!1,this.context.canvas.setCursor(this.defaultCursor),(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},this.invokeOnFinish=Lh(()=>{var n,i;(i=(n=this.options).onFinish)===null||i===void 0||i.call(n)},300),this.shortcut=new CA(t.graph),this.bindEvents(),this.defaultCursor=this.context.canvas.getConfig().cursor||"default"}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(br(t)){const{up:e=[],down:n=[],left:i=[],right:a=[]}=t;this.shortcut.bind(e,s=>this.onTranslate([0,1],s)),this.shortcut.bind(n,s=>this.onTranslate([0,-1],s)),this.shortcut.bind(i,s=>this.onTranslate([1,0],s)),this.shortcut.bind(a,s=>this.onTranslate([-1,0],s))}else{const{graph:e}=this.context;e.on(Yt.DRAG_START,this.onDragStart),e.on(Yt.DRAG,this.onDrag),e.on(Yt.DRAG_END,this.onDragEnd)}}onTranslate(t,e){return kx(this,void 0,void 0,function*(){if(!this.validate(e))return;const{sensitivity:n}=this.options,i=n*-1;yield this.translate(Ss(t,i),this.options.animation),this.invokeOnFinish()})}translate(t,e){return kx(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 Cb([t,e],n)}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,A,l,c]=Ua(this.options.range),u=[s*o,a*A,s*l,a*c],h=EA(Ym(n.getCanvasCenter()),u),d=tr(n.getViewportCenter(),[t,e,0]);if(!xs(d,h)){const{min:[f,g],max:[v,p]}=h;(d[0]0||d[0]>v&&t<0)&&(t=0),(d[1]0||d[1]>p&&e<0)&&(e=0)}return[t,e]}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return typeof e=="function"?e(t):!!e}unbindEvents(){this.shortcut.unbindAll();const{graph:t}=this.context;t.off(Yt.DRAG_START,this.onDragStart),t.off(Yt.DRAG,this.onDrag),t.off(Yt.DRAG_END,this.onDragEnd)}destroy(){this.shortcut.destroy(),this.unbindEvents(),this.context.canvas.setCursor(this.defaultCursor),super.destroy()}}kg.defaultOptions={enable:r=>"targetType"in r?r.targetType==="canvas":!0,sensitivity:10,direction:"both",range:1/0};var Qx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class kh extends Ra{constructor(t,e){super(t,Object.assign({},kh.defaultOptions,e)),this.enable=!1,this.enableElements=["node","combo"],this.target=[],this.shadowOrigin=[0,0],this.hiddenEdges=[],this.isDragging=!1,this.onDrop=n=>Qx(this,void 0,void 0,function*(){var i;if(this.options.dropEffect!=="link")return;const{model:a,element:s}=this.context,o=n.target.id;this.target.forEach(A=>{const l=a.getParentData(A,nr);l&&Nt(l)===o&&a.refreshComboData(o),a.setParent(A,o,nr)}),yield(i=s==null?void 0:s.draw({animation:!0}))===null||i===void 0?void 0:i.finished}),this.setCursor=n=>{if(this.isDragging)return;const{type:i}=n,{canvas:a}=this.context,{cursor:s}=this.options;i===Yt.POINTER_ENTER?a.setCursor((s==null?void 0:s.grab)||"grab"):a.setCursor((s==null?void 0:s.default)||"default")},this.shortcut=new CA(t.graph),this.onDragStart=this.onDragStart.bind(this),this.onDrag=this.onDrag.bind(this),this.onDragEnd=this.onDragEnd.bind(this),this.onDrop=this.onDrop.bind(this),this.bindEvents()}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}bindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.addEventListener("blur",this.onDragEnd),n.addEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.on(`${i}:${Yt.DRAG_START}`,this.onDragStart),t.on(`${i}:${Yt.DRAG}`,this.onDrag),t.on(`${i}:${Yt.DRAG_END}`,this.onDragEnd),t.on(`${i}:${Yt.POINTER_ENTER}`,this.setCursor),t.on(`${i}:${Yt.POINTER_LEAVE}`,this.setCursor)}),["link"].includes(this.options.dropEffect)&&(t.on(yl.DROP,this.onDrop),t.on(No.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 Ms([t.dx,t.dy],e)}onDragStart(t){var e;if(this.enable=this.validate(t),!this.enable)return;const{batch:n,canvas:i,graph:a}=this.context;i.setCursor(((e=this.options.cursor)===null||e===void 0?void 0:e.grabbing)||"grabbing"),this.isDragging=!0,n.startBatch();const s=t.target.id;a.getElementState(s).includes(this.options.state)?this.target=this.getSelectedNodeIDs([s]):this.target=[s],this.hideEdge(),this.context.graph.frontElement(this.target),this.options.shadow&&this.createShadow(this.target)}onDrag(t){if(!this.enable)return;const e=this.getDelta(t);this.options.shadow?this.moveShadow(e):this.moveElement(this.target,e)}onDragEnd(){var t,e,n;if(!this.enable)return;if(this.enable=!1,this.options.shadow){if(!this.shadow)return;this.shadow.style.visibility="hidden";const{x:s=0,y:o=0}=this.shadow.attributes,[A,l]=tr([+s,+o],this.shadowOrigin);this.moveElement(this.target,[A,l])}this.showEdges(),(e=(t=this.options).onFinish)===null||e===void 0||e.call(t,this.target);const{batch:i,canvas:a}=this.context;i.endBatch(),a.setCursor(((n=this.options.cursor)===null||n===void 0?void 0:n.grab)||"grab"),this.isDragging=!1,this.target=[]}isKeydown(){const{trigger:t}=this.options;return t!=null&&t.length?this.shortcut.match(t):!0}validate(t){if(this.destroyed||Ih(t.target)||this.context.graph.isCollapsingExpanding||!this.isKeydown())return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}clampByRotation([t,e]){const n=this.context.graph.getRotation();return Cb([t,e],n)}moveElement(t,e){return Qx(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=Ir(this.options,"shadow"),n=vh(t.map(l=>this.context.element.getElement(l).getBounds())),[i,a]=n.min;this.shadowOrigin=[i,a];const[s,o]=yA(n),A={width:s,height:o,x:i,y:a};this.shadow?this.shadow.attr(Object.assign(Object.assign(Object.assign({},e),A),{visibility:"visible"})):(this.shadow=new Ci({style:Object.assign(Object.assign(Object.assign({$layer:"transient"},e),A),{pointerEvents:"none"})}),this.context.canvas.appendChild(this.shadow))}showEdges(){this.options.shadow||this.hiddenEdges.length===0||(this.context.graph.showElement(this.hiddenEdges),this.hiddenEdges=[])}hideEdge(){const{hideEdge:t,shadow:e}=this.options;if(t==="none"||e)return;const{graph:n}=this.context;t==="all"?this.hiddenEdges=n.getEdgeData().map(Nt):this.hiddenEdges=Array.from(new Set(this.target.map(i=>n.getRelatedEdgesData(i,t).map(Nt)).flat())),n.hideElement(this.hiddenEdges)}unbindEvents(){const{graph:t,canvas:e}=this.context,n=e.getLayer().getContextService().$canvas;n&&(n.removeEventListener("blur",this.onDragEnd),n.removeEventListener("contextmenu",this.onDragEnd)),this.enableElements.forEach(i=>{t.off(`${i}:${Yt.DRAG_START}`,this.onDragStart),t.off(`${i}:${Yt.DRAG}`,this.onDrag),t.off(`${i}:${Yt.DRAG_END}`,this.onDragEnd),t.off(`${i}:${Yt.POINTER_ENTER}`,this.setCursor),t.off(`${i}:${Yt.POINTER_LEAVE}`,this.setCursor)}),t.off(`combo:${Yt.DROP}`,this.onDrop),t.off(`canvas:${Yt.DROP}`,this.onDrop)}destroy(){var t;this.unbindEvents(),(t=this.shadow)===null||t===void 0||t.destroy(),super.destroy()}}kh.defaultOptions={animation:!0,enable:r=>["node","combo"].includes(r.targetType),trigger:[],dropEffect:"move",state:"selected",hideEdge:"none",shadow:!1,shadowZIndex:100,shadowFill:"#F3F9FF",shadowFillOpacity:.5,shadowStroke:"#1890FF",shadowStrokeOpacity:.9,shadowLineDash:[5,5],cursor:{default:"default",grab:"grab",grabbing:"grabbing"}};var PQ="*",_Q=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 Ug(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)&&Ug(a,t,e,n))return!0;return!1}const Ux=()=>!0;class HQ{constructor(t){wr(this,"graph");wr(this,"nodeFilter");wr(this,"edgeFilter");wr(this,"cacheEnabled");wr(this,"inEdgesMap",new Map);wr(this,"outEdgesMap",new Map);wr(this,"bothEdgesMap",new Map);wr(this,"allNodesMap",new Map);wr(this,"allEdgesMap",new Map);wr(this,"clearCache",()=>{this.inEdgesMap.clear(),this.outEdgesMap.clear(),this.bothEdgesMap.clear(),this.allNodesMap.clear(),this.allEdgesMap.clear()});wr(this,"refreshCache",()=>{this.clearCache(),this.updateCache(this.graph.getAllNodes().map(t=>t.id))});wr(this,"updateCache",t=>{const e=new Set;t.forEach(n=>{const i=this.bothEdgesMap.get(n);if(i&&i.forEach(a=>e.add(a.id)),!this.hasNode(n))this.inEdgesMap.delete(n),this.outEdgesMap.delete(n),this.bothEdgesMap.delete(n),this.allNodesMap.delete(n);else{const a=this.graph.getRelatedEdges(n,"in").filter(this.edgeFilter),s=this.graph.getRelatedEdges(n,"out").filter(this.edgeFilter),o=Array.from(new Set([...a,...s]));o.forEach(A=>e.add(A.id)),this.inEdgesMap.set(n,a),this.outEdgesMap.set(n,s),this.bothEdgesMap.set(n,o),this.allNodesMap.set(n,this.graph.getNode(n))}}),e.forEach(n=>{this.hasEdge(n)?this.allEdgesMap.set(n,this.graph.getEdge(n)):this.allEdgesMap.delete(n)})});wr(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||Ux,n=t.edgeFilter||Ux;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];ky([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];Ug(this.getNode(t),new Set,e,i)}}class Gr extends Qg{constructor(e){super();wr(this,"nodeMap",new Map);wr(this,"edgeMap",new Map);wr(this,"inEdgesMap",new Map);wr(this,"outEdgesMap",new Map);wr(this,"bothEdgesMap",new Map);wr(this,"treeIndices",new Map);wr(this,"changes",[]);wr(this,"batchCount",0);wr(this,"onChanged",()=>{});wr(this,"batch",e=>{this.batchCount+=1,e(),this.batchCount-=1,this.batchCount||this.commit()});e&&(e.nodes&&this.addNodes(e.nodes),e.edges&&this.addEdges(e.edges),e.tree&&this.addTree(e.tree),e.onChanged&&(this.onChanged=e.onChanged))}commit(){const e=this.changes;this.changes=[];const n={graph:this,changes:e};this.emit("changed",n),this.onChanged(n)}reduceChanges(e){let n=[];return e.forEach(i=>{switch(i.type){case"NodeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="NodeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else{if(s.type==="NodeDataUpdated")return s.id!==i.value.id;if(s.type==="TreeStructureChanged")return s.nodeId!==i.value.id}return!0}),a||n.push(i);break}case"EdgeRemoved":{let a=!1;n=n.filter(s=>{if(s.type==="EdgeAdded"){const o=s.value.id===i.value.id;return o&&(a=!0),!o}else if(s.type==="EdgeDataUpdated"||s.type==="EdgeUpdated")return s.id!==i.value.id;return!0}),a||n.push(i);break}case"NodeDataUpdated":case"EdgeDataUpdated":case"EdgeUpdated":{const a=n.findIndex(o=>o.type===i.type&&o.id===i.id&&(i.propertyName===void 0||o.propertyName===i.propertyName)),s=n[a];s?i.propertyName!==void 0?s.newValue=i.newValue:(n.splice(a,1),n.push(i)):n.push(i);break}case"TreeStructureDetached":{n=n.filter(a=>a.type==="TreeStructureAttached"||a.type==="TreeStructureChanged"?a.treeKey!==i.treeKey:!0),n.push(i);break}case"TreeStructureChanged":{const a=n.find(s=>s.type==="TreeStructureChanged"&&s.treeKey===i.treeKey&&s.nodeId===i.nodeId);a?a.newParentId=i.newParentId:n.push(i);break}default:n.push(i);break}}),n}checkNodeExistence(e){this.getNode(e)}hasNode(e){return this.nodeMap.has(e)}areNeighbors(e,n){return this.getNeighbors(n).some(i=>i.id===e)}getNode(e){const n=this.nodeMap.get(e);if(!n)throw new Error("Node not found for id: "+e);return n}getRelatedEdges(e,n){if(this.checkNodeExistence(e),n==="in"){const i=this.inEdgesMap.get(e);return Array.from(i)}else if(n==="out"){const i=this.outEdgesMap.get(e);return Array.from(i)}else{const i=this.bothEdgesMap.get(e);return Array.from(i)}}getDegree(e,n){return this.getRelatedEdges(e,n).length}getSuccessors(e){const i=this.getRelatedEdges(e,"out").map(a=>this.getNode(a.target));return Array.from(new Set(i))}getPredecessors(e){const i=this.getRelatedEdges(e,"in").map(a=>this.getNode(a.source));return Array.from(new Set(i))}getNeighbors(e){const n=this.getPredecessors(e),i=this.getSuccessors(e);return Array.from(new Set([...n,...i]))}doAddNode(e){if(this.hasNode(e.id))throw new Error("Node already exists: "+e.id);this.nodeMap.set(e.id,e),this.inEdgesMap.set(e.id,new Set),this.outEdgesMap.set(e.id,new Set),this.bothEdgesMap.set(e.id,new Set),this.treeIndices.forEach(n=>{n.childrenMap.set(e.id,new Set)}),this.changes.push({type:"NodeAdded",value:e})}addNodes(e){this.batch(()=>{for(const n of e)this.doAddNode(n)})}addNode(e){this.addNodes([e])}doRemoveNode(e){const n=this.getNode(e),i=this.bothEdgesMap.get(e);i==null||i.forEach(a=>this.doRemoveEdge(a.id)),this.nodeMap.delete(e),this.treeIndices.forEach(a=>{var o,A;(o=a.childrenMap.get(e))==null||o.forEach(l=>{a.parentMap.delete(l.id)});const s=a.parentMap.get(e);s&&((A=a.childrenMap.get(s.id))==null||A.delete(n)),a.parentMap.delete(e),a.childrenMap.delete(e)}),this.bothEdgesMap.delete(e),this.inEdgesMap.delete(e),this.outEdgesMap.delete(e),this.changes.push({type:"NodeRemoved",value:n})}removeNodes(e){this.batch(()=>{e.forEach(n=>this.doRemoveNode(n))})}removeNode(e){this.removeNodes([e])}updateNodeDataProperty(e,n,i){const a=this.getNode(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"NodeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}mergeNodeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateNodeDataProperty(e,i,a)})})}updateNodeData(...e){const n=e[0],i=this.getNode(n);if(typeof e[1]=="string"){this.updateNodeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"NodeDataUpdated",id:n,oldValue:s,newValue:o})})}checkEdgeExistence(e){if(!this.hasEdge(e))throw new Error("Edge not found for id: "+e)}hasEdge(e){return this.edgeMap.has(e)}getEdge(e){return this.checkEdgeExistence(e),this.edgeMap.get(e)}getEdgeDetail(e){const n=this.getEdge(e);return{edge:n,source:this.getNode(n.source),target:this.getNode(n.target)}}doAddEdge(e){if(this.hasEdge(e.id))throw new Error("Edge already exists: "+e.id);this.checkNodeExistence(e.source),this.checkNodeExistence(e.target),this.edgeMap.set(e.id,e);const n=this.inEdgesMap.get(e.target),i=this.outEdgesMap.get(e.source),a=this.bothEdgesMap.get(e.source),s=this.bothEdgesMap.get(e.target);n.add(e),i.add(e),a.add(e),s.add(e),this.changes.push({type:"EdgeAdded",value:e})}addEdges(e){this.batch(()=>{for(const n of e)this.doAddEdge(n)})}addEdge(e){this.addEdges([e])}doRemoveEdge(e){const n=this.getEdge(e),i=this.outEdgesMap.get(n.source),a=this.inEdgesMap.get(n.target),s=this.bothEdgesMap.get(n.source),o=this.bothEdgesMap.get(n.target);i.delete(n),a.delete(n),s.delete(n),o.delete(n),this.edgeMap.delete(e),this.changes.push({type:"EdgeRemoved",value:n})}removeEdges(e){this.batch(()=>{e.forEach(n=>this.doRemoveEdge(n))})}removeEdge(e){this.removeEdges([e])}updateEdgeSource(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.source,s=n;this.outEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.outEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.source=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"source",oldValue:a,newValue:s})})}updateEdgeTarget(e,n){const i=this.getEdge(e);this.checkNodeExistence(n);const a=i.target,s=n;this.inEdgesMap.get(a).delete(i),this.bothEdgesMap.get(a).delete(i),this.inEdgesMap.get(s).add(i),this.bothEdgesMap.get(s).add(i),i.target=n,this.batch(()=>{this.changes.push({type:"EdgeUpdated",id:e,propertyName:"target",oldValue:a,newValue:s})})}updateEdgeDataProperty(e,n,i){const a=this.getEdge(e);this.batch(()=>{const s=a.data[n],o=i;a.data[n]=o,this.changes.push({type:"EdgeDataUpdated",id:e,propertyName:n,oldValue:s,newValue:o})})}updateEdgeData(...e){const n=e[0],i=this.getEdge(n);if(typeof e[1]=="string"){this.updateEdgeDataProperty(n,e[1],e[2]);return}let a;if(typeof e[1]=="function"){const s=e[1];a=s(i.data)}else typeof e[1]=="object"&&(a=e[1]);this.batch(()=>{const s=i.data,o=a;i.data=a,this.changes.push({type:"EdgeDataUpdated",id:n,oldValue:s,newValue:o})})}mergeEdgeData(e,n){this.batch(()=>{Object.entries(n).forEach(([i,a])=>{this.updateEdgeDataProperty(e,i,a)})})}checkTreeExistence(e){if(!this.hasTreeStructure(e))throw new Error("Tree structure not found for treeKey: "+e)}hasTreeStructure(e){return this.treeIndices.has(e)}attachTreeStructure(e){this.treeIndices.has(e)||(this.treeIndices.set(e,{parentMap:new Map,childrenMap:new Map}),this.batch(()=>{this.changes.push({type:"TreeStructureAttached",treeKey:e})}))}detachTreeStructure(e){this.checkTreeExistence(e),this.treeIndices.delete(e),this.batch(()=>{this.changes.push({type:"TreeStructureDetached",treeKey:e})})}addTree(e,n){this.batch(()=>{this.attachTreeStructure(n);const i=[],a=Array.isArray(e)?e:[e];for(;a.length;){const s=a.shift();i.push(s),s.children&&a.push(...s.children)}this.addNodes(i),i.forEach(s=>{var o;(o=s.children)==null||o.forEach(A=>{this.setParent(A.id,s.id,n)})})})}getRoots(e){return this.checkTreeExistence(e),this.getAllNodes().filter(n=>!this.getParent(n.id,e))}getChildren(e,n){this.checkNodeExistence(e),this.checkTreeExistence(n);const a=this.treeIndices.get(n).childrenMap.get(e);return Array.from(a||[])}getParent(e,n){return this.checkNodeExistence(e),this.checkTreeExistence(n),this.treeIndices.get(n).parentMap.get(e)||null}getAncestors(e,n){const i=[];let a=this.getNode(e),s;for(;s=this.getParent(a.id,n);)i.push(s),a=s;return i}setParent(e,n,i){var c,u;this.checkTreeExistence(i);const a=this.treeIndices.get(i);if(!a)return;const s=this.getNode(e),o=a.parentMap.get(e);if((o==null?void 0:o.id)===n)return;if(n==null){o&&((c=a.childrenMap.get(o.id))==null||c.delete(s)),a.parentMap.delete(e);return}const A=this.getNode(n);a.parentMap.set(e,A),o&&((u=a.childrenMap.get(o.id))==null||u.delete(s));let l=a.childrenMap.get(A.id);l||(l=new Set,a.childrenMap.set(A.id,l)),l.add(s),this.batch(()=>{this.changes.push({type:"TreeStructureChanged",treeKey:i,nodeId:e,oldParentId:o==null?void 0:o.id,newParentId:A.id})})}dfsTree(e,n,i){const a=s=>this.getChildren(s,i);return Ug(this.getNode(e),new Set,n,a)}bfsTree(e,n,i){const a=s=>this.getChildren(s,i);return ky([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 ky([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 Ug(this.getNode(e),new Set,n,a)}clone(){const e=this.getAllNodes().map(a=>dw(lu({},a),{data:lu({},a.data)})),n=this.getAllEdges().map(a=>dw(lu({},a),{data:lu({},a.data)})),i=new Gr({nodes:e,edges:n});return this.treeIndices.forEach(({parentMap:a,childrenMap:s},o)=>{const A=new Map;a.forEach((c,u)=>{A.set(u,i.getNode(c.id))});const l=new Map;s.forEach((c,u)=>{l.set(u,new Set(Array.from(c).map(h=>i.getNode(h.id))))}),i.treeIndices.set(o,{parentMap:A,childrenMap:l})}),i}toJSON(){return JSON.stringify({nodes:this.getAllNodes(),edges:this.getAllEdges()})}createView(e){return new HQ(lu({graph:this},e))}}class Rg{constructor(t,e){this.context=t,this.options=e||{}}}var GQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},zQ=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const a=i.data._isCombo?n.combos:n.nodes,{x:s,y:o,z:A=0}=i.data;a==null||a.push({id:i.id,style:{x:s,y:o,z:A}})}),e.forEach(i=>{const{id:a,source:s,target:o,data:{points:A=[],controlPoints:l=A.slice(1,A.length-1)}}=i;n.edges.push({id:a,source:s,target:o,style:Object.assign({},l!=null&&l.length?{controlPoints:l.map(Mi)}:{})})}),n}function WQ(r,t){class e extends Rg{constructor(i,a){if(super(i,a),this.instance=new r({}),this.id=this.instance.id,"stop"in this.instance&&"tick"in this.instance){const s=this.instance;this.stop=s.stop.bind(s),this.tick=o=>{const A=s.tick(o);return Dg(A)}}}execute(i,a){return GQ(this,void 0,void 0,function*(){return Dg(yield this.instance.execute(this.graphData2LayoutModel(i),this.transformOptions(Si({},this.options,a))))})}transformOptions(i){if(!("onTick"in i))return i;const a=i.onTick;return i.onTick=s=>a(Dg(s)),i}graphData2LayoutModel(i){const{nodes:a=[],edges:s=[],combos:o=[]}=i,A=a.map(d=>{const f=Nt(d),{data:g,style:v,combo:p}=d,y=zQ(d,["data","style","combo"]),x={id:f,data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},g),{data:g}),p?{parentId:p}:{}),{style:v}),y)};return v!=null&&v.x&&Object.assign(x.data,{x:v.x}),v!=null&&v.y&&Object.assign(x.data,{y:v.y}),v!=null&&v.z&&Object.assign(x.data,{z:v.z}),x}),l=new Map(A.map(d=>[d.id,d])),c=s.filter(d=>{const{source:f,target:g}=d;return l.has(f)&&l.has(g)}).map(d=>{const{source:f,target:g,data:v,style:p}=d;return{id:Nt(d),source:f,target:g,data:Object.assign({},v),style:Object.assign({},p)}}),u=o.map(d=>({id:Nt(d),data:Object.assign({_isCombo:!0},d.data),style:Object.assign({},d.style)})),h=new Gr({nodes:[...A,...u],edges:c});return t.model.model.hasTreeStructure(nr)&&(h.attachTreeStructure(nr),A.forEach(d=>{const f=t.model.model.getParent(d.id,nr);f&&h.hasNode(f.id)&&h.setParent(d.id,f.id,nr)})),h}}return e}function Qy(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 Rx(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 jQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class ZQ extends kh{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):(va.warn("DragElementForce only works with d3-force or d3-force-3d layout"),!1):!1}moveElement(t,e){return jQ(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&&Qy(n,"setFixedPosition",t[a],[...$e([+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&&Rx(e,"simulation").alphaTarget(.3).restart(),this.context.graph.getNodeData(this.target).forEach(n=>{const{x:i=0,y:a=0}=n.style||{};e&&Qy(e,"setFixedPosition",Nt(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&&Rx(t,"simulation").alphaTarget(0),!this.options.fixed&&this.context.graph.getNodeData(this.target).forEach(e=>{t&&Qy(t,"setFixedPosition",Nt(e),[null,null,null])})}}var Dx=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Pg extends Ra{constructor(t,e){super(t,Object.assign({},Pg.defaultOptions,e)),this.isZoomEvent=n=>!!(n.data&&"scale"in n.data),this.relatedEdgeToUpdate=new Set,this.zoom=this.context.graph.getZoom(),this.fixElementSize=n=>Dx(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context,{state:a,nodeFilter:s,edgeFilter:o,comboFilter:A}=this.options,l=(a?i.getElementDataByState("node",a):i.getNodeData()).filter(s),c=(a?i.getElementDataByState("edge",a):i.getEdgeData()).filter(o),u=(a?i.getElementDataByState("combo",a):i.getComboData()).filter(A),h=this.isZoomEvent(n)?this.zoom=Math.max(.01,Math.min(n.data.scale,10)):this.zoom,d=[...l,...u];d.length>0&&d.forEach(f=>this.fixNodeLike(f,h)),this.updateRelatedEdges(),c.length>0&&c.forEach(f=>this.fixEdge(f,h))}),this.cachedStyles=new Map,this.getOriginalFieldValue=(n,i,a)=>{var s;const o=this.cachedStyles.get(n)||[],A=((s=o.find(l=>l.shape===i))===null||s===void 0?void 0:s.style)||{};return a in A||(A[a]=i.attributes[a],this.cachedStyles.set(n,[...o.filter(l=>l.shape!==i),{shape:i,style:A}])),A[a]},this.scaleEntireElement=(n,i,a)=>{i.setLocalScale(1/a);const s=this.cachedStyles.get(n)||[];s.push({shape:i}),this.cachedStyles.set(n,s)},this.scaleSpecificShapes=(n,i,a)=>{const s=ZL(n);(Array.isArray(a)?a:[a]).forEach(A=>{const{shape:l,fields:c}=A,u=typeof l=="function"?l(s):n.getShape(l);if(u){if(!c){this.scaleEntireElement(n.id,u,i);return}c.forEach(h=>{const d=this.getOriginalFieldValue(n.id,u,h);ye(d)&&(u.style[h]=d/i)})}})},this.skipIfExceedViewport=n=>{const{viewport:i}=this.context;return!(i!=null&&i.isInViewport(n.getRenderBounds(),!1,30))},this.fixNodeLike=(n,i)=>{const a=Nt(n),{element:s,model:o}=this.context,A=s.getElement(a);if(!A||this.skipIfExceedViewport(A))return;o.getRelatedEdgesData(a).forEach(u=>this.relatedEdgeToUpdate.add(Nt(u)));const c=this.options[A.type];if(!c){this.scaleEntireElement(a,A,i);return}this.scaleSpecificShapes(A,i,c)},this.fixEdge=(n,i)=>{const a=Nt(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=>Dx(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(oo(s))a.setLocalScale(1);else{if(this.options.state)return;Object.entries(s).forEach(([o,A])=>a.style[o]=A)}})});const{graph:t,element:e}=this.context,n=Object.keys(Object.fromEntries(this.cachedStyles)).filter(i=>i&&t.getElementType(i)==="node");if(n.length>0){const i=new Set;n.forEach(a=>{t.getRelatedEdgesData(a).forEach(s=>i.add(Nt(s)))}),i.forEach(a=>{const s=e==null?void 0:e.getElement(a);s==null||s.update({})})}}}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_DRAW,this.resetTransform),t.on(Ae.AFTER_TRANSFORM,this.fixElementSize)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.resetTransform),t.off(Ae.AFTER_TRANSFORM,this.fixElementSize)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}destroy(){this.unbindEvents(),super.destroy()}}Pg.defaultOptions={enable:r=>r.data.scale<1,nodeFilter:()=>!0,edgeFilter:()=>!0,comboFilter:()=>!0,edge:[{shape:"key",fields:["lineWidth"]},{shape:"halo",fields:["lineWidth"]},{shape:"label"}],reset:!1};var YQ=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class _g extends Ra{constructor(t,e){super(t,Object.assign({},_g.defaultOptions,e)),this.focus=n=>YQ(this,void 0,void 0,function*(){if(!this.validate(n))return;const{graph:i}=this.context;yield i.focusElement(n.target.id,this.options.animation)}),this.shortcut=new CA(t.graph),this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),xl.forEach(e=>{t.on(`${e}:${Yt.CLICK}`,this.focus)})}validate(t){if(this.destroyed||!this.isKeydown())return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}isKeydown(){const{trigger:t}=this.options;return t!=null&&t.length?this.shortcut.match(t):!0}unbindEvents(){const{graph:t}=this.context;xl.forEach(e=>{t.off(`${e}:${Yt.CLICK}`,this.focus)})}destroy(){this.unbindEvents(),this.shortcut.destroy(),super.destroy()}}_g.defaultOptions={animation:{easing:"ease-in",duration:500},enable:!0,trigger:[]};class Hg extends Ra{constructor(t,e){super(t,Object.assign({},Hg.defaultOptions,e)),this.isFrozen=!1,this.toggleFrozen=n=>{this.isFrozen=n.type==="dragstart"},this.hoverElement=n=>{if(!this.validate(n))return;const i=n.type===Yt.POINTER_ENTER;this.updateElementsState(n,i);const{onHover:a,onHoverEnd:s}=this.options;i?a==null||a(n):s==null||s(n)},this.updateElementsState=(n,i)=>{if(!this.options.state&&!this.options.inactiveState)return;const{graph:a}=this.context,{state:s,animation:o,inactiveState:A}=this.options,l=this.getActiveIds(n),c={};if(s&&Object.assign(c,this.getElementsState(l,s,i)),A){const u=yb(a.getData(),!0).filter(h=>!l.includes(h));Object.assign(c,this.getElementsState(u,A,i))}a.setElementState(c,o)},this.getElementsState=(n,i,a)=>{const{graph:s}=this.context,o={};return n.forEach(A=>{const l=s.getElementState(A);a?o[A]=l.includes(i)?l:[...l,i]:o[A]=l.filter(c=>c!==i)}),o},this.bindEvents()}bindEvents(){const{graph:t}=this.context;this.unbindEvents(),xl.forEach(n=>{t.on(`${n}:${Yt.POINTER_ENTER}`,this.hoverElement),t.on(`${n}:${Yt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.addEventListener(`${Yt.DRAG_START}`,this.toggleFrozen),e.addEventListener(`${Yt.DRAG_END}`,this.toggleFrozen)}getActiveIds(t){const{graph:e}=this.context,{degree:n,direction:i}=this.options,a=t.target.id;return n?Ub(e,t.targetType,a,typeof n=="function"?n(t):n,i):[a]}validate(t){if(this.destroyed||this.isFrozen||Ih(t.target)||this.context.graph.isCollapsingExpanding)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}unbindEvents(){const{graph:t}=this.context;xl.forEach(n=>{t.off(`${n}:${Yt.POINTER_ENTER}`,this.hoverElement),t.off(`${n}:${Yt.POINTER_LEAVE}`,this.hoverElement)});const e=this.context.canvas.document;e.removeEventListener(`${Yt.DRAG_START}`,this.toggleFrozen),e.removeEventListener(`${Yt.DRAG_END}`,this.toggleFrozen)}destroy(){this.unbindEvents(),super.destroy()}}Hg.defaultOptions={animation:!1,enable:!0,degree:0,direction:"both",state:"active",inactiveState:void 0};class XQ extends Bh{onPointerDown(t){if(!super.validate(t)||!super.isKeydown()||this.points)return;const{canvas:e,graph:n}=this.context;this.pathShape=new Pi({id:"g6-lasso-select",style:this.options.style}),e.appendChild(this.pathShape),this.points=[ig(t,n)]}onPointerMove(t){var e;if(!this.points)return;const{immediately:n,mode:i}=this.options;this.points.push(ig(t,this.context.graph)),(e=this.pathShape)===null||e===void 0||e.setAttribute("d",zL(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 Gg extends Ra{constructor(t,e){super(t,Object.assign({},Gg.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):Bl(s,i,a)})},this.filterShapes=(n,i)=>{if(Vt(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=Lh(n=>{if(!this.validate(n)||this.isVisible)return;const{element:i}=this.context;this.setElementsVisibility(i.getNodes(),"visible"),this.setElementsVisibility(i.getEdges(),"visible"),this.setElementsVisibility(i.getCombos(),"visible"),this.isVisible=!0},this.options.debounce),this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(Ae.BEFORE_TRANSFORM,this.hideShapes),t.on(Ae.AFTER_TRANSFORM,this.showShapes)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.BEFORE_TRANSFORM,this.hideShapes),t.off(Ae.AFTER_TRANSFORM,this.showShapes)}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}update(t){this.unbindEvents(),super.update(t),this.bindEvents()}destroy(){this.unbindEvents(),super.destroy()}}Gg.defaultOptions={enable:!0,debounce:200,shapes:r=>r==="node"};var Px=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class zg extends Ra{constructor(t,e){super(t,Object.assign({},zg.defaultOptions,e)),this.onWheel=n=>Px(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 CA(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){var t,e;const{trigger:n}=this.options;if(this.shortcut.unbindAll(),br(n)){(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.onWheel);const{up:i=[],down:a=[],left:s=[],right:o=[]}=n;this.shortcut.bind(i,A=>this.scroll([0,-10],A)),this.shortcut.bind(a,A=>this.scroll([0,10],A)),this.shortcut.bind(s,A=>this.scroll([-10,0],A)),this.shortcut.bind(o,A=>this.scroll([10,0],A))}else(e=this.graphDom)===null||e===void 0||e.addEventListener(Yt.WHEEL,this.onWheel,{passive:!1})}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}formatDisplacement(t){const{sensitivity:e}=this.options;return t=Ss(t,e),t=this.clampByDirection(t),t=this.clampByRange(t),t}clampByDirection([t,e]){const{direction:n}=this.options;return n==="x"?e=0:n==="y"&&(t=0),[t,e]}clampByRange([t,e]){const{viewport:n,canvas:i}=this.context,[a,s]=i.getSize(),[o,A,l,c]=Ua(this.options.range),u=[s*o,a*A,s*l,a*c],h=EA(Ym(n.getCanvasCenter()),u),d=tr(n.getViewportCenter(),[t,e,0]);if(!xs(d,h)){const{min:[f,g],max:[v,p]}=h;(d[0]0||d[0]>v&&t<0)&&(t=0),(d[1]0||d[1]>p&&e<0)&&(e=0)}return[t,e]}scroll(t,e){return Px(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 Vt(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.onWheel),super.destroy()}}zg.defaultOptions={enable:!0,sensitivity:1,preventDefault:!0,range:1/0};var _x=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class Kg extends Ra{constructor(t,e){super(t,Object.assign({},Kg.defaultOptions,e)),this.zoom=(n,i,a)=>_x(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=Mi(i.viewport));const{sensitivity:A,onFinish:l}=this.options,c=1+dr(n,-50,50)*A/100,u=s.getZoom();yield s.zoomTo(u*c,a,o),l==null||l()}),this.onReset=()=>_x(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 CA(t.graph),this.bindEvents()}update(t){super.update(t),this.bindEvents()}bindEvents(){const{trigger:t}=this.options;if(this.shortcut.unbindAll(),Array.isArray(t))if(t.includes(Yt.PINCH))this.shortcut.bind([Yt.PINCH],e=>{this.zoom(e.scale,e,!1)});else{const e=this.context.canvas.getContainer();e==null||e.addEventListener(Yt.WHEEL,this.preventDefault),this.shortcut.bind([...t,Yt.WHEEL],n=>{const{deltaX:i,deltaY:a}=n;this.zoom(-(a!=null?a:i),n,!1)})}if(typeof t=="object"){const{zoomIn:e=[],zoomOut:n=[],reset:i=[]}=t;this.shortcut.bind(e,a=>this.zoom(10,a,this.options.animation)),this.shortcut.bind(n,a=>this.zoom(-10,a,this.options.animation)),this.shortcut.bind(i,this.onReset)}}validate(t){if(this.destroyed)return!1;const{enable:e}=this.options;return Vt(e)?e(t):!!e}destroy(){var t;this.shortcut.destroy(),(t=this.context.canvas.getContainer())===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.preventDefault),super.destroy()}}Kg.defaultOptions={animation:{duration:200},enable:!0,sensitivity:1,trigger:[],preventDefault:!0};function Hx(r,t,e,n="height"){const i=r[n],a=t[n];return e==="center"?(i+a)/2:r.height}const Il=Object.assign,JQ={getId:r=>r.id||r.name,getPreH:r=>r.preH||0,getPreV:r=>r.preV||0,getHGap:r=>r.hgap||18,getVGap:r=>r.vgap||18,getChildren:r=>r.children,getHeight:r=>r.height||36,getWidth(r){const t=r.label||" ";return r.width||18*t.split("").length}};class Vg{constructor(t,e){if(this.x=0,this.y=0,this.depth=0,this.children=[],this.hgap=0,this.vgap=0,t instanceof Vg||"x"in t&&"y"in t&&"children"in t){const a=t;return this.data=a.data,this.id=a.id,this.x=a.x,this.y=a.y,this.width=a.width,this.height=a.height,this.depth=a.depth,this.children=a.children,this.parent=a.parent,this.hgap=a.hgap,this.vgap=a.vgap,this.preH=a.preH,void(this.preV=a.preV)}this.data=t;const n=e.getHGap(t),i=e.getVGap(t);this.preH=e.getPreH(t),this.preV=e.getPreV(t),this.width=e.getWidth(t),this.height=e.getHeight(t),this.width+=this.preH,this.height+=this.preV,this.id=e.getId(t),this.addGap(n,i)}isRoot(){return this.depth===0}isLeaf(){return this.children.length===0}addGap(t,e){this.hgap+=t,this.vgap+=e,this.width+=2*t,this.height+=2*e}eachNode(t){let e,n=[this];for(;e=n.shift();)t(e),n=e.children.concat(n)}DFTraverse(t){this.eachNode(t)}BFTraverse(t){let e,n=[this];for(;e=n.shift();)t(e),n=n.concat(e.children)}getBoundingBox(){const t={left:Number.MAX_VALUE,top:Number.MAX_VALUE,width:0,height:0};return this.eachNode(e=>{t.left=Math.min(t.left,e.x),t.top=Math.min(t.top,e.y),t.width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height)}),t}translate(t=0,e=0){this.eachNode(n=>{n.x+=t,n.y+=e,n.x+=n.preH,n.y+=n.preV})}right2left(){const t=this.getBoundingBox();this.eachNode(e=>{e.x=e.x-2*(e.x-t.left)-e.width}),this.translate(t.width,0)}bottom2top(){const t=this.getBoundingBox();this.eachNode(e=>{e.y=e.y-2*(e.y-t.top)-e.height}),this.translate(0,t.height)}}function Uy(r,t={},e){t=Il({},JQ,t);const n=new Vg(r,t),i=[n];let a;if(!e&&!r.collapsed){for(;a=i.shift();)if(!a.data.collapsed){const s=t.getChildren(a.data),o=s?s.length:0;if(a.children=new Array(o),s&&o)for(let A=0;A{const a=lv.fromNode(i,e);a&&n.push(a)}),e?new lv(t.height,t.width,t.x,n):new lv(t.width,t.height,t.y,n)}};function Gx(r,t,e){e?r.y+=t:r.x+=t,r.children.forEach(n=>{Gx(n,t,e)})}function zx(r,t){let e=t?r.y:r.x;return r.children.forEach(n=>{e=Math.min(zx(n,t),e)}),e}function $Q(r,t){Gx(r,-zx(r,t),t)}function Kx(r,t,e){e?t.y=r.x:t.x=r.x,r.c.forEach((n,i)=>{Kx(n,t.children[i],e)})}function Vx(r,t,e=0){t?(r.x=e,e+=r.width):(r.y=e,e+=r.height),r.children.forEach(n=>{Vx(n,t,e)})}function t3(r,t={}){const e=t.isHorizontal;function n(u){u.cs===0?(u.el=u,u.er=u,u.msel=u.mser=0):(u.el=u.c[0].el,u.msel=u.c[0].msel,u.er=u.c[u.cs-1].er,u.mser=u.c[u.cs-1].mser)}function i(u,h,d){let f=u.c[h-1],g=f.mod,v=u.c[h],p=v.mod;for(;f!==null&&v!==null;){d&&A(f)>d.low&&(d=d.nxt);const y=g+f.prelim+f.w-(p+v.prelim);y>0&&(p+=y,d&&a(u,h,d.index,y));const x=A(f),F=A(v);x<=F&&(f=o(f),f!==null&&(g+=f.mod)),x>=F&&(v=s(v),v!==null&&(p+=v.mod))}!f&&v?function(y,x,F,O){const L=y.c[0].el;L.tl=F;const U=O-F.mod-y.c[0].msel;L.mod+=U,L.prelim-=U,y.c[0].el=y.c[x].el,y.c[0].msel=y.c[x].msel}(u,h,v,p):f&&!v&&function(y,x,F,O){const L=y.c[x].er;L.tr=F;const U=O-F.mod-y.c[x].mser;L.mod+=U,L.prelim-=U,y.c[x].er=y.c[x-1].er,y.c[x].mser=y.c[x-1].mser}(u,h,f,g)}function a(u,h,d,f){u.c[h].mod+=f,u.c[h].msel+=f,u.c[h].mser+=f,function(g,v,p,y){if(p!==v-1){const x=v-p;g.c[p+1].shift+=y/x,g.c[v].shift-=y/x,g.c[v].change-=y-y/x}}(u,h,d,f)}function s(u){return u.cs===0?u.tl:u.c[0]}function o(u){return u.cs===0?u.tr:u.c[u.cs-1]}function A(u){return u.y+u.h}function l(u,h,d){for(;d!==null&&u>=d.low;)d=d.nxt;return{low:u,index:h,nxt:d}}Vx(r,e);const c=qQ.fromNode(r,e);return c&&(function u(h){if(h.cs===0)return void n(h);u(h.c[0]);let d=l(A(h.c[0].el),0,null);for(let f=1;f{o.isRoot()||(o.side="left")}),n.eachNode(o=>{o.isRoot()||(o.side="right")}),{left:e,right:n}}const OA=["LR","RL","TB","BT","H","V"],e3=["LR","RL","H"],n3=OA[0];function Ry(r,t,e){const n=t.direction||n3;if(t.isHorizontal=(a=>e3.indexOf(a)>-1)(n),n&&OA.indexOf(n)===-1)throw new TypeError(`Invalid direction: ${n}`);if(n===OA[0])e(r,t);else if(n===OA[1])e(r,t),r.right2left();else if(n===OA[2])e(r,t);else if(n===OA[3])e(r,t),r.bottom2top();else if(n===OA[4]||n===OA[5]){const{left:a,right:s}=Wx(r,t);e(a,t),e(s,t),t.isHorizontal?a.right2left():a.bottom2top(),s.translate(a.x-s.x,a.y-s.y),r.x=a.x,r.y=s.y;const o=r.getBoundingBox();t.isHorizontal?o.top<0&&r.translate(0,-o.top):o.left<0&&r.translate(-o.left,0)}let i=t.fixedRoot;return i===void 0&&(i=!0),i&&r.translate(-(r.x+r.width/2+r.hgap),-(r.y+r.height/2+r.vgap)),function(a,s){if(s.radial){const[o,A]=s.isHorizontal?["x","y"]:["y","x"],l={x:1/0,y:1/0},c={x:-1/0,y:-1/0};let u=0;a.DFTraverse(f=>{u++;const{x:g,y:v}=f;l.x=Math.min(l.x,g),l.y=Math.min(l.y,v),c.x=Math.max(c.x,g),c.y=Math.max(c.y,v)});const h=c[A]-l[A];if(h===0)return;const d=2*Math.PI/u;a.DFTraverse(f=>{const g=f[A],v=l[A],p=f[o],y=a[o],x=(g-v)/h*(2*Math.PI-d)+d,F=p-y;f.x=Math.cos(x)*F,f.y=Math.sin(x)*F})}}(r,t),r}class r3 extends Wg{execute(){return Ry(this.rootNode,this.options,t3)}}const i3={};function jx(r,t){const e=Il({},i3,t);return new r3(r,e).execute()}class a3{constructor(t=0,e=[]){this.x=0,this.y=0,this.leftChild=null,this.rightChild=null,this.isLeaf=!1,this.height=t,this.children=e}}const s3={isHorizontal:!0,nodeSep:20,nodeSize:20,rankSep:200,subTreeSep:10};function Zx(r,t,e){e?(t.x=r.x,t.y=r.y):(t.x=r.y,t.y=r.x),r.children.forEach((n,i)=>{Zx(n,t.children[i],e)})}function o3(r,t={}){const e=Il({},s3,t);let n=0,i=null;const a=function s(o){o.width=0,o.depth&&o.depth>n&&(n=o.depth);const A=o.children,l=A.length,c=new a3(0,[]);return A.forEach((u,h)=>{const d=s(u);c.children.push(d),h===0&&(c.leftChild=d),h===l-1&&(c.rightChild=d)}),c.originNode=o,c.isLeaf=o.isLeaf(),c}(r);return function s(o){if(o.isLeaf||o.children.length===0)o.drawingDepth=n;else{const A=o.children.map(c=>s(c)),l=Math.min(...A);o.drawingDepth=l-1}return o.drawingDepth}(a),function s(o){o.x=o.drawingDepth*e.rankSep,o.isLeaf?(o.y=0,i&&(o.y=i.y+i.height+e.nodeSep,o.originNode.parent!==i.originNode.parent&&(o.y+=e.subTreeSep)),i=o):(o.children.forEach(A=>{s(A)}),o.y=(o.leftChild.y+o.rightChild.y)/2)}(a),Zx(a,r,e.isHorizontal),r}class A3 extends Wg{execute(){return this.rootNode.width=0,Ry(this.rootNode,this.options,o3)}}const l3={};function Yx(r,t){const e=Il({},l3,t);return new A3(r,e).execute()}function jg(r,t,e,n){let i=null;r.eachNode(a=>{(function(s,o,A,l,c){const u=(typeof A=="function"?A(s):A)*s.depth;if(!l)try{if(s.parent&&s.id===s.parent.children[0].id)return s.x+=u,void(s.y=o?o.y:0)}catch(h){}if(s.x+=u,o){if(s.y=o.y+Hx(o,s,c),o.parent&&s.parent&&s.parent.id!==o.parent.id){const h=o.parent,d=h.y+Hx(h,s,c);s.y=d>s.y?d:s.y}}else s.y=0})(a,i,t,e,n),i=a})}const Qh=["LR","RL","H"],c3=Qh[0];class u3 extends Wg{execute(){const t=this.options,e=this.rootNode;t.isHorizontal=!0;const{indent:n=20,dropCap:i=!0,direction:a=c3,align:s}=t;if(a&&Qh.indexOf(a)===-1)throw new TypeError(`Invalid direction: ${a}`);if(a===Qh[0])jg(e,n,i,s);else if(a===Qh[1])jg(e,n,i,s),e.right2left();else if(a===Qh[2]){const{left:o,right:A}=Wx(e,t);jg(o,n,i,s),o.right2left(),jg(A,n,i,s);const l=o.getBoundingBox();A.translate(l.width,0),e.x=A.x-e.width/2}return e}}const h3={};function Xx(r,t){const e=Il({},h3,t);return new u3(r,e).execute()}function Jx(r,t){let e=0;return r.children.length?r.children.forEach(n=>{e+=Jx(n,t)}):e=r.height,r._subTreeSep=t.getSubTreeSep(r.data),r.totalHeight=Math.max(r.height,e)+2*r._subTreeSep,r.totalHeight}function qx(r){const t=r.children,e=t.length;if(e){t.forEach(o=>{qx(o)});const n=t[0],i=t[e-1],a=i.y-n.y+i.height;let s=0;if(t.forEach(o=>{s+=o.totalHeight}),a>r.height)r.y=n.y+a/2-r.height/2;else if(t.length!==1||r.height>s){const o=r.y+(r.height-a)/2-n.y;t.forEach(A=>{A.translate(0,o)})}else r.y=(n.y+n.height/2+i.y+i.height/2)/2-r.height/2}}const d3={getSubTreeSep:()=>0};function f3(r,t={}){return t=Il({},d3,t),r.parent={x:0,width:0,height:0,y:0},r.BFTraverse(e=>{e.x=e.parent.x+e.parent.width}),r.parent=void 0,Jx(r,t),r.startY=0,r.y=r.totalHeight/2-r.height/2,r.eachNode(e=>{const n=e.children,i=n.length;if(i){const a=n[0];if(a.startY=e.startY+e._subTreeSep,i===1)a.y=e.y+e.height/2-a.height/2;else{a.y=a.startY+a.totalHeight/2-a.height/2;for(let s=1;s{if(r!=="next"&&r!=="prev")return t},tC=r=>{r.prev.next=r.next,r.next.prev=r.prev,delete r.next,delete r.prev};class m3{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 tC(e),e}enqueue(t){const e=this.shortcut;t.prev&&t.next&&tC(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,p3)),n=n==null?void 0:n.prev;return`[${t.join(", ")}]`}}class y3 extends m3{}const w3=()=>1,E3=(r,t)=>{var e;if(r.getAllNodes().length<=1)return[];const n=b3(r,t||w3);return(e=B3(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()},B3=(r,t,e)=>{let n=[];const i=t[t.length-1],a=t[0];let s;for(;r.getAllNodes().length;){for(;s=a.dequeue();)Dy(r,t,e,s);for(;s=i.dequeue();)Dy(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(Dy(r,t,e,s,!0));break}}}return n},Dy=(r,t,e,n,i)=>{var a,s;const o=[];return r.hasNode(n.v)&&((a=r.getRelatedEdges(n.v,"in"))===null||a===void 0||a.forEach(A=>{const l=A.data.weight,c=r.getNode(A.source);i&&o.push({v:A.source,w:A.target,in:0,out:0}),c.data.out===void 0&&(c.data.out=0),c.data.out-=l,Py(t,e,Object.assign({v:c.id},c.data))}),(s=r.getRelatedEdges(n.v,"out"))===null||s===void 0||s.forEach(A=>{const l=A.data.weight,c=A.target,u=r.getNode(c);u.data.in===void 0&&(u.data.in=0),u.data.in-=l,Py(t,e,Object.assign({v:u.id},u.data))}),r.removeNode(n.v)),i?o:void 0},b3=(r,t)=>{const e=new Gr;let n=0,i=0;r.getAllNodes().forEach(A=>{e.addNode({id:A.id,data:{v:A.id,in:0,out:0}})}),r.getAllEdges().forEach(A=>{const l=e.getRelatedEdges(A.source,"out").find(u=>u.target===A.target),c=(t==null?void 0:t(A))||1;l?e.updateEdgeData(l==null?void 0:l.id,Object.assign(Object.assign({},l.data),{weight:l.data.weight+c})):e.addEdge({id:A.id,source:A.source,target:A.target,data:{weight:c}}),i=Math.max(i,e.getNode(A.source).data.out+=c),n=Math.max(n,e.getNode(A.target).data.in+=c)});const a=[],s=i+n+3;for(let A=0;A{Py(a,o,Object.assign({v:A.id},e.getNode(A.id).data))}),{buckets:a,zeroIdx:o,graph:e}},Py=(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)},x3=(r,t)=>{const n=t==="greedy"?E3(r,(i=>a=>a.data.weight||1)(r)):C3(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)})})},C3=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},S3=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})})}})},M3=(r,t)=>Number(r)-Number(t),Vc=(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},F3=r=>{const t=new Gr;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},eC=r=>{const t=new Gr;return r.getAllNodes().forEach(e=>{r.getChildren(e.id).length||t.addNode(Object.assign({},e))}),r.getAllEdges().forEach(e=>{t.addEdge(e)}),t},nC=(r,t)=>r==null?void 0:r.reduce((e,n,i)=>(e[n]=t[i],e),{}),mz=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},yz=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 nC(t.map(n=>n.id),e)},rC=(r,t)=>{const e=Number(r.x),n=Number(r.y),i=Number(t.x)-e,a=Number(t.y)-n;let s=Number(r.width)/2,o=Number(r.height)/2;if(!i&&!a)return{x:0,y:0};let A,l;return Math.abs(a)*s>Math.abs(i)*o?(a<0&&(o=-o),A=o*i/a,l=o):(i<0&&(s=-s),A=s,l=s*a/i),{x:e+A,y:n+l}},Uh=r=>{const t=[],e=aC(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;nM3(r.getNode(i).data.order,r.getNode(a).data.order));return t},T3=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)})},O3=(r,t=0)=>{const e=r.getAllNodes(),n=e.filter(o=>o.data.rank!==void 0).map(o=>o.data.rank),i=Math.min(...n),a=[];e.forEach(o=>{const A=(o.data.rank||0)-i;a[A]||(a[A]=[]),a[A].push(o.id)});let s=0;for(let o=0;o{const c=r.getNode(l);c&&(c.data.rank=c.data.rank||0,c.data.rank+=s)}))}},iC=(r,t,e,n)=>{const i={width:0,height:0};return ye(e)&&ye(n)&&(i.rank=e,i.order=n),Vc(r,"border",i,t)},aC=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},I3=(r,t)=>{const e={lhs:[],rhs:[]};return r==null||r.forEach(n=>{t(n)?e.lhs.push(n):e.rhs.push(n)}),e},_y=(r,t)=>r.reduce((e,n)=>{const i=t(e),a=t(n);return i>a?n:e}),sC=(r,t,e,n,i,a)=>{n.includes(t.id)||(n.push(t.id),e||a.push(t.id),i(t.id).forEach(s=>sC(r,s,e,n,i,a)),e&&a.push(t.id))},oC=(r,t,e,n)=>{const i=Array.isArray(t)?t:[t],a=A=>n?r.getSuccessors(A):r.getNeighbors(A),s=[],o=[];return i.forEach(A=>{if(r.hasNode(A.id))sC(r,A,e==="post",o,a,s);else throw new Error(`Graph does not have node: ${A}`)}),s},N3=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))},AC=(r,t,e,n,i,a)=>{const s={rank:a,borderType:t,width:0,height:0},o=i.data[t][a-1],A=Vc(r,"border",s,e);i.data[t][a]=A,r.setParent(A,n),o&&r.addEdge({id:`e${Math.random()}`,source:o,target:A,data:{weight:1}})},L3=(r,t)=>{const e=t.toLowerCase();(e==="lr"||e==="rl")&&lC(r)},k3=(r,t)=>{const e=t.toLowerCase();(e==="bt"||e==="rl")&&Q3(r),(e==="lr"||e==="rl")&&(U3(r),lC(r))},lC=r=>{r.getAllNodes().forEach(t=>{cC(t)}),r.getAllEdges().forEach(t=>{cC(t)})},cC=r=>{const t=r.data.width;r.data.width=r.data.height,r.data.height=t},Q3=r=>{r.getAllNodes().forEach(t=>{Hy(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Hy(n)),t.data.hasOwnProperty("y")&&Hy(t.data)})},Hy=r=>{r!=null&&r.y&&(r.y=-r.y)},U3=r=>{r.getAllNodes().forEach(t=>{Gy(t.data)}),r.getAllEdges().forEach(t=>{var e;(e=t.data.points)===null||e===void 0||e.forEach(n=>Gy(n)),t.data.hasOwnProperty("x")&&Gy(t.data)})},Gy=r=>{const t=r.x;r.x=r.y,r.y=t},R3=r=>{const t=Vc(r,"root",{},"_root"),e=D3(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=P3(r)+1;return r.getRoots().forEach(o=>{uC(r,t,a,s,i,e,o.id)}),{nestingRoot:t,nodeRankFactor:a}},uC=(r,t,e,n,i,a,s)=>{const o=r.getChildren(s);if(!(o!=null&&o.length)){s!==t&&r.addEdge({id:`e${Math.random()}`,source:t,target:s,data:{weight:0,minlen:e}});return}const A=iC(r,"_bt"),l=iC(r,"_bb"),c=r.getNode(s);r.setParent(A,s),c.data.borderTop=A,r.setParent(l,s),c.data.borderBottom=l,o==null||o.forEach(u=>{uC(r,t,e,n,i,a,u.id);const h=u.data.borderTop?u.data.borderTop:u.id,d=u.data.borderBottom?u.data.borderBottom:u.id,f=u.data.borderTop?n:2*n,g=h!==d?1:i-a[s]+1;r.addEdge({id:`e${Math.random()}`,source:A,target:h,data:{minlen:g,weight:f,nestingEdge:!0}}),r.addEdge({id:`e${Math.random()}`,source:d,target:l,data:{minlen:g,weight:f,nestingEdge:!0}})}),r.getParent(s)||r.addEdge({id:`e${Math.random()}`,source:t,target:A,data:{weight:0,minlen:i+a[s]}})},D3=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},P3=r=>{let t=0;return r.getAllEdges().forEach(e=>{t+=e.data.weight}),t},_3=(r,t)=>{t&&r.removeNode(t),r.getAllEdges().forEach(e=>{e.data.nestingEdge&&r.removeEdge(e.id)})},H3="edge",hC="edge-label",G3=(r,t)=>{r.getAllEdges().forEach(e=>z3(r,e,t))},z3=(r,t,e)=>{let n=t.source,i=r.getNode(n).data.rank;const a=t.target,s=r.getNode(a).data.rank,o=t.data.labelRank;if(s===i+1)return;r.removeEdge(t.id);let A,l,c;for(c=0,++i;i{t.forEach(e=>{let n=r.getNode(e);const{data:i}=n,a=i.originalEdge;let s;a&&r.addEdge(a);let o=e;for(;n.data.dummy;)s=r.getSuccessors(o)[0],r.removeNode(o),a.data.points.push({x:n.data.x,y:n.data.y}),n.data.dummy===hC&&(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)})},V3=(r,t,e)=>{const n={};let i;e==null||e.forEach(a=>{let s=r.getParent(a),o,A;for(;s;){if(o=r.getParent(s.id),o?(A=n[o.id],n[o.id]=s.id):(A=i,i=s.id),A&&A!==s.id){t.hasNode(A)||t.addNode({id:A,data:{}}),t.hasNode(s.id)||t.addNode({id:s.id,data:{}}),t.hasEdge(`e${A}-${s.id}`)||t.addEdge({id:`e${A}-${s.id}`,source:A,target:s.id,data:{}});return}s=o}})},W3=(r,t,e)=>{const n=j3(r),i=new Gr({tree:[{id:n,children:[],data:{}}]});return r.getAllNodes().forEach(a=>{const s=r.getParent(a.id);(a.data.rank===t||a.data.minRank<=t&&t<=a.data.maxRank)&&(i.hasNode(a.id)||i.addNode(Object.assign({},a)),s!=null&&s.id&&!i.hasNode(s==null?void 0:s.id)&&i.addNode(Object.assign({},s)),i.setParent(a.id,(s==null?void 0:s.id)||n),r.getRelatedEdges(a.id,e).forEach(o=>{const A=o.source===a.id?o.target:o.source;i.hasNode(A)||i.addNode(Object.assign({},r.getNode(A)));const l=i.getRelatedEdges(A,"out").find(({target:u})=>u===a.id),c=l!==void 0?l.data.weight:0;l?i.updateEdgeData(l.id,Object.assign(Object.assign({},l.data),{weight:o.data.weight+c})):i.addEdge({id:o.id,source:A,target:a.id,data:{weight:o.data.weight+c}})}),a.data.hasOwnProperty("minRank")&&i.updateNodeData(a.id,Object.assign(Object.assign({},a.data),{borderLeft:a.data.borderLeft[t],borderRight:a.data.borderRight[t]})))}),i},j3=r=>{let t;for(;r.hasNode(t=`_root${Math.random()}`););return t},Z3=(r,t,e)=>{const n=nC(e,e.map((c,u)=>u)),a=t.map(c=>{const u=r.getRelatedEdges(c,"out").map(h=>({pos:n[h.target]||0,weight:h.data.weight}));return u==null?void 0:u.sort((h,d)=>h.pos-d.pos)}).flat().filter(c=>c!==void 0);let s=1;for(;s{if(c){let u=c.pos+s;A[u]+=c.weight;let h=0;for(;u>0;)u%2&&(h+=A[u+1]),u=u-1>>1,A[u]+=c.weight;l+=c.weight*h}}),l},dC=(r,t)=>{let e=0;for(let n=1;n<(t==null?void 0:t.length);n+=1)e+=Z3(r,t[n-1],t[n]);return e},fC=r=>{const t={},e=r.getAllNodes(),n=e.map(l=>{var c;return(c=l.data.rank)!==null&&c!==void 0?c:-1/0}),i=Math.max(...n),a=[];for(let l=0;lr.getNode(l.id).data.rank-r.getNode(c.id).data.rank),A=s.filter(l=>r.getNode(l.id).data.fixorder!==void 0).sort((l,c)=>r.getNode(l.id).data.fixorder-r.getNode(c.id).data.fixorder);return A==null||A.forEach(l=>{isNaN(r.getNode(l.id).data.rank)||a[r.getNode(l.id).data.rank].push(l.id),t[l.id]=!0}),s==null||s.forEach(l=>r.dfsTree(l.id,c=>{if(t.hasOwnProperty(c.id))return!0;t[c.id]=!0,isNaN(c.data.rank)||a[c.data.rank].push(c.id)})),a},Y3=(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}}),X3=(r,t)=>{var e,n,i;const a={};r==null||r.forEach((o,A)=>{a[o.v]={i:A,indegree:0,in:[],out:[],vs:[o.v]};const l=a[o.v];o.barycenter!==void 0&&(l.barycenter=o.barycenter,l.weight=o.weight)}),(e=t.getAllEdges())===null||e===void 0||e.forEach(o=>{const A=a[o.source],l=a[o.target];A!==void 0&&l!==void 0&&(l.indegree++,A.out.push(a[o.target]))});const s=(i=(n=Object.values(a)).filter)===null||i===void 0?void 0:i.call(n,o=>!o.indegree);return J3(s)},J3=r=>{var t,e;const n=[],i=A=>l=>{l.merged||(l.barycenter===void 0||A.barycenter===void 0||l.barycenter>=A.barycenter)&&q3(A,l)},a=A=>l=>{l.in.push(A),--l.indegree===0&&r.push(l)};for(;r!=null&&r.length;){const A=r.pop();n.push(A),(t=A.in.reverse())===null||t===void 0||t.forEach(l=>i(A)(l)),(e=A.out)===null||e===void 0||e.forEach(l=>a(A)(l))}const s=n.filter(A=>!A.merged),o=["vs","i","barycenter","weight"];return s.map(A=>{const l={};return o==null||o.forEach(c=>{A[c]!==void 0&&(l[c]=A[c])}),l})},q3=(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 $3=X3;const tU=(r,t,e,n)=>{const i=I3(r,h=>{const d=h.hasOwnProperty("fixorder")&&!isNaN(h.fixorder);return n?!d&&h.hasOwnProperty("barycenter"):d||h.hasOwnProperty("barycenter")}),a=i.lhs,s=i.rhs.sort((h,d)=>-h.i- -d.i),o=[];let A=0,l=0,c=0;a==null||a.sort(eU(!!t,!!e)),c=gC(o,s,c),a==null||a.forEach(h=>{var d;c+=(d=h.vs)===null||d===void 0?void 0:d.length,o.push(h.vs),A+=h.barycenter*h.weight,l+=h.weight,c=gC(o,s,c)});const u={vs:o.flat()};return l&&(u.barycenter=A/l,u.weight=l),u},gC=(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},eU=(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},vC=(r,t,e,n,i,a)=>{var s,o,A,l;let c=r.getChildren(t).map(y=>y.id);const u=r.getNode(t),h=u?u.data.borderLeft:void 0,d=u?u.data.borderRight:void 0,f={};h&&(c=c==null?void 0:c.filter(y=>y!==h&&y!==d));const g=Y3(r,c||[]);g==null||g.forEach(y=>{var x;if(!((x=r.getChildren(y.v))===null||x===void 0)&&x.length){const F=vC(r,y.v,e,n,a);f[y.v]=F,F.hasOwnProperty("barycenter")&&rU(y,F)}});const v=$3(g,e);nU(v,f),(s=v.filter(y=>y.vs.length>0))===null||s===void 0||s.forEach(y=>{const x=r.getNode(y.vs[0]);x&&(y.fixorder=x.data.fixorder,y.order=x.data.order)});const p=tU(v,n,i,a);if(h&&(p.vs=[h,p.vs,d].flat(),!((o=r.getPredecessors(h))===null||o===void 0)&&o.length)){const y=r.getNode(((A=r.getPredecessors(h))===null||A===void 0?void 0:A[0].id)||""),x=r.getNode(((l=r.getPredecessors(d))===null||l===void 0?void 0:l[0].id)||"");p.hasOwnProperty("barycenter")||(p.barycenter=0,p.weight=0),p.barycenter=(p.barycenter*p.weight+y.data.order+x.data.order)/(p.weight+2),p.weight+=2}return p},nU=(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()})},rU=(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)},iU=(r,t)=>{const e=aC(r),n=[],i=[];for(let c=1;c-1;c--)i.push(c);const a=pC(r,n,"in"),s=pC(r,i,"out");let o=fC(r);zy(r,o);let A=Number.POSITIVE_INFINITY,l;for(let c=0,u=0;u<4;++c,++u){mC(c%2?a:s,c%4>=2,!1,t),o=Uh(r);const h=dC(r,o);h=2,!0,t),o=Uh(r);const h=dC(r,o);ht.map(n=>W3(r,n,e)),mC=(r,t,e,n)=>{const i=new Gr;r==null||r.forEach(a=>{var s;const o=a.getRoots()[0].id,A=vC(a,o,i,t,e,n);for(let l=0;l<((s=A.vs)===null||s===void 0?void 0:s.length);l++){const c=a.getNode(A.vs[l]);c&&(c.data.order=l)}V3(a,i,A.vs)})},zy=(r,t)=>{t==null||t.forEach(e=>{e==null||e.forEach((n,i)=>{r.getNode(n).data.order=i})})},aU=(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))})},sU=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},oU=(r,t,e,n)=>{var i,a;const s=[],o=[],A=Math.min(t[e].low,t[n].low),l=Math.max(t[e].lim,t[n].lim);let c,u;c=e;do c=(i=r.getParent(c))===null||i===void 0?void 0:i.id,s.push(c);while(c&&(t[c].low>A||l>t[c].lim));for(u=c,c=n;c&&c!==u;)o.push(c),c=(a=r.getParent(c))===null||a===void 0?void 0:a.id;return{lca:u,path:s.concat(o.reverse())}},AU=(r,t)=>{const e=sU(r);t.forEach(n=>{var i,a;let s=n,o=r.getNode(s);const A=o.data.originalEdge;if(!A)return;const l=oU(r,e,A.source,A.target),c=l.path,u=l.lca;let h=0,d=c[h],f=!0;for(;s!==A.target;){if(o=r.getNode(s),f){for(;d!==u&&((i=r.getNode(d))===null||i===void 0?void 0:i.data.maxRank){const e={},n=(i,a)=>{let s=0,o=0;const A=i.length,l=a==null?void 0:a[(a==null?void 0:a.length)-1];return a==null||a.forEach((c,u)=>{var h;const d=lU(r,c),f=d?r.getNode(d.id).data.order:A;(d||c===l)&&((h=a.slice(o,u+1))===null||h===void 0||h.forEach(g=>{var v;(v=r.getPredecessors(g))===null||v===void 0||v.forEach(p=>{var y;const x=r.getNode(p.id),F=x.data.order;(F{const e={};function n(o,A,l,c,u){var h,d;let f;for(let g=A;g{const p=r.getNode(v.id);p.data.dummy&&(p.data.orderu)&&EC(e,v.id,f)}))}function i(o){return JSON.stringify(o.slice(1))}function a(o,A){const l=i(o);A.get(l)||(n(...o),A.set(l,!0))}const s=(o,A)=>{let l=-1,c,u=0;const h=new Map;return A==null||A.forEach((d,f)=>{var g;if(((g=r.getNode(d))===null||g===void 0?void 0:g.data.dummy)==="border"){const v=r.getPredecessors(d)||[];v.length&&(c=r.getNode(v[0].id).data.order,a([A,u,f,l,c],h),u=f,l=c)}a([A,u,A.length,c,o.length],h)}),A};return t!=null&&t.length&&t.reduce(s),e},lU=(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)},EC=(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},cU=(r,t,e)=>{let n=t,i=e;if(n>i){const a=t;n=i,i=a}return!!r[n]},BC=(r,t,e,n)=>{const i={},a={},s={};return t==null||t.forEach(o=>{o==null||o.forEach((A,l)=>{i[A]=A,a[A]=A,s[A]=l})}),t==null||t.forEach(o=>{let A=-1;o==null||o.forEach(l=>{let c=n(l).map(u=>u.id);if(c.length){c=c.sort((h,d)=>s[h]-s[d]);const u=(c.length-1)/2;for(let h=Math.floor(u),d=Math.ceil(u);h<=d;++h){const f=c[h];a[l]===l&&A{var o;const A={},l=uU(r,t,e,i,a,s),c=s?"borderLeft":"borderRight",u=(f,g)=>{let v=l.getAllNodes(),p=v.pop();const y={};for(;p;)y[p.id]?f(p.id):(y[p.id]=!0,v.push(p),v=v.concat(g(p.id))),p=v.pop()},h=f=>{A[f]=(l.getRelatedEdges(f,"in")||[]).reduce((g,v)=>Math.max(g,(A[v.source]||0)+v.data.weight),0)},d=f=>{const g=(l.getRelatedEdges(f,"out")||[]).reduce((p,y)=>Math.min(p,(A[y.target]||0)-y.data.weight),Number.POSITIVE_INFINITY),v=r.getNode(f);g!==Number.POSITIVE_INFINITY&&v.data.borderType!==c&&(A[f]=Math.max(A[f],g))};return u(h,l.getPredecessors.bind(l)),u(d,l.getSuccessors.bind(l)),(o=Object.values(n))===null||o===void 0||o.forEach(f=>{A[f]=A[e[f]]}),A},uU=(r,t,e,n,i,a)=>{const s=new Gr,o=hU(n,i,a);return t==null||t.forEach(A=>{let l;A==null||A.forEach(c=>{const u=e[c];if(s.hasNode(u)||s.addNode({id:u,data:{}}),l){const h=e[l],d=s.getRelatedEdges(h,"out").find(f=>f.target===u);d?s.updateEdgeData(d.id,Object.assign(Object.assign({},d.data),{weight:Math.max(o(r,c,l),d.data.weight||0)})):s.addEdge({id:`e${Math.random()}`,source:h,target:u,data:{weight:Math.max(o(r,c,l),0)}})}l=c})}),s},xC=(r,t)=>_y(Object.values(t),e=>{var n;let i=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;return(n=Object.keys(e))===null||n===void 0||n.forEach(s=>{const o=e[s],A=dU(r,s)/2;i=Math.max(o+A,i),a=Math.min(o-A,a)}),i-a});function CC(r,t){const e=Object.values(t),n=Math.min(...e),i=Math.max(...e);["u","d"].forEach(a=>{["l","r"].forEach(s=>{const o=a+s,A=r[o];let l;if(A===t)return;const c=Object.values(A);l=s==="l"?n-Math.min(...c):i-Math.max(...c),l&&(r[o]={},Object.keys(A).forEach(u=>{r[o][u]=A[u]+l}))})})}const SC=(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},wz=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=buildLayerMatrix(r),s=Object.assign(yC(r,a),wC(r,a)),o={};let A;["u","d"].forEach(c=>{A=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(u=>{u==="r"&&(A=A.map(g=>Object.values(g).reverse()));const h=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),d=BC(r,A,s,h),f=bC(r,A,d.root,d.align,n,i,u==="r");u==="r"&&Object.keys(f).forEach(g=>{f[g]=-f[g]}),o[c+u]=f})});const l=xC(r,o);return CC(o,l),SC(o,e)},hU=(r,t,e)=>(n,i,a)=>{const s=n.getNode(i),o=n.getNode(a);let A=0,l=0;if(A+=s.data.width/2,s.data.hasOwnProperty("labelpos"))switch((s.data.labelpos||"").toLowerCase()){case"l":l=-s.data.width/2;break;case"r":l=s.data.width/2;break}if(l&&(A+=e?l:-l),l=0,A+=(s.data.dummy?t:r)/2,A+=(o.data.dummy?t:r)/2,A+=o.data.width/2,o.data.labelpos)switch((o.data.labelpos||"").toLowerCase()){case"l":l=o.data.width/2;break;case"r":l=-o.data.width/2;break}return l&&(A+=e?l:-l),l=0,A},dU=(r,t)=>r.getNode(t).data.width||0,fU=(r,t)=>{const{ranksep:e=0}=t||{},n=Uh(r);let i=0;n==null||n.forEach(a=>{const s=a.map(A=>r.getNode(A).data.height),o=Math.max(...s,0);a==null||a.forEach(A=>{r.getNode(A).data.y=i+o/2}),i+=o+e})},gU=(r,t)=>{const{align:e,nodesep:n=0,edgesep:i=0}=t||{},a=Uh(r),s=Object.assign(yC(r,a),wC(r,a)),o={};let A=[];["u","d"].forEach(c=>{A=c==="u"?a:Object.values(a).reverse(),["l","r"].forEach(u=>{u==="r"&&(A=A.map(g=>Object.values(g).reverse()));const h=(c==="u"?r.getPredecessors:r.getSuccessors).bind(r),d=BC(r,A,s,h),f=bC(r,A,d.root,d.align,n,i,u==="r");u==="r"&&Object.keys(f).forEach(g=>f[g]=-f[g]),o[c+u]=f})});const l=xC(r,o);return l&&CC(o,l),SC(o,e)},vU=(r,t)=>{var e;const n=eC(r);fU(n,t);const i=gU(n,t);(e=Object.keys(i))===null||e===void 0||e.forEach(a=>{n.getNode(a).data.x=i[a]})},MC=r=>{const t={},e=n=>{var i;const a=r.getNode(n);if(!a)return 0;if(t[n])return a.data.rank;t[n]=!0;let s;return(i=r.getRelatedEdges(n,"out"))===null||i===void 0||i.forEach(o=>{const A=e(o.target),l=o.data.minlen,c=A-l;c&&(s===void 0||cr.getRelatedEdges(n.id,"in").length===0).forEach(n=>e(n.id))},pU=r=>{const t={};let e;const n=s=>{var o;const A=r.getNode(s);if(!A)return 0;if(t[s])return A.data.rank;t[s]=!0;let l;return(o=r.getRelatedEdges(s,"out"))===null||o===void 0||o.forEach(c=>{const u=n(c.target),h=c.data.minlen,d=u-h;d&&(l===void 0||dr.getRelatedEdges(s.id,"in").length===0).forEach(s=>{s&&n(s.id)}),e===void 0&&(e=0);const i={},a=(s,o)=>{var A;const l=r.getNode(s),c=isNaN(l.data.layer)?o:l.data.layer;(l.data.rank===void 0||l.data.rank{a(u.target,c+u.data.minlen)}))};r.getAllNodes().forEach(s=>{const o=s.data;o&&(isNaN(o.layer)?o.rank-=e:a(s.id,o.layer))})},IA=(r,t)=>r.getNode(t.target).data.rank-r.getNode(t.source).data.rank-t.data.minlen,mU=r=>{const t=new Gr({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;yU(t,r){const e=n=>{t.getRelatedEdges(n,"both").forEach(i=>{const a=i.source,s=n===a?i.target:a;!r.hasNode(s)&&!IA(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},wU=r=>{const t=new Gr({tree:[]}),e=r.getAllNodes()[0],n=r.getAllNodes().length;t.addNode(e);let i,a;for(;EU(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||!IA(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},FC=(r,t)=>_y(t.getAllEdges(),e=>r.hasNode(e.source)!==r.hasNode(e.target)?IA(t,e):1/0),TC=(r,t,e)=>{r.getAllNodes().forEach(n=>{const i=t.getNode(n.id);i.data.rank||(i.data.rank=0),i.data.rank+=e})},BU=r=>{const t=F3(r);MC(t);const e=mU(t);IC(e),OC(e,t);let n,i;for(;n=CU(e);)i=SU(e,t,n),MU(e,t,n,i)},OC=(r,t)=>{let e=oC(r,r.getAllNodes(),"post",!1);e=e.slice(0,(e==null?void 0:e.length)-1),e.forEach(n=>{bU(r,t,n)})},bU=(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=xU(r,t,e)},xU=(r,t,e)=>{const i=r.getNode(e).data.parent;let a=!0,s=t.getRelatedEdges(e,"out").find(A=>A.target===i),o=0;return s||(a=!1,s=t.getRelatedEdges(i,"out").find(A=>A.target===e)),o=s.data.weight,t.getRelatedEdges(e,"both").forEach(A=>{const l=A.source===e,c=l?A.target:A.source;if(c!==i){const u=l===a,h=A.data.weight;if(o+=u?h:-h,TU(r,e,c)){const d=r.getRelatedEdges(e,"both").find(f=>f.source===c||f.target===c).data.cutvalue;o+=u?-d:d}}}),o},IC=(r,t=r.getAllNodes()[0].id)=>{NC(r,{},1,t)},NC=(r,t,e,n,i)=>{var a;const s=e;let o=e;const A=r.getNode(n);return t[n]=!0,(a=r.getNeighbors(n))===null||a===void 0||a.forEach(l=>{t[l.id]||(o=NC(r,t,o,l.id,n))}),A.data.low=s,A.data.lim=o++,i?A.data.parent=i:delete A.data.parent,o},CU=r=>r.getAllEdges().find(t=>t.data.cutvalue<0),SU=(r,t,e)=>{let n=e.source,i=e.target;t.getRelatedEdges(n,"out").find(c=>c.target===i)||(n=e.target,i=e.source);const a=r.getNode(n),s=r.getNode(i);let o=a,A=!1;a.data.lim>s.data.lim&&(o=s,A=!0);const l=t.getAllEdges().filter(c=>A===LC(r.getNode(c.source),o)&&A!==LC(r.getNode(c.target),o));return _y(l,c=>IA(t,c))},MU=(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:{}}),IC(r),OC(r,t),FU(r,t)},FU=(r,t)=>{const e=r.getAllNodes().find(i=>!i.data.parent);let n=oC(r,e,"pre",!1);n=n.slice(1),n.forEach(i=>{const a=r.getNode(i).data.parent;let s=t.getRelatedEdges(i,"out").find(A=>A.target===a),o=!1;!s&&t.hasNode(a)&&(s=t.getRelatedEdges(a,"out").find(A=>A.target===i),o=!0),t.getNode(i).data.rank=(t.hasNode(a)&&t.getNode(a).data.rank||0)+(o?s==null?void 0:s.data.minlen:-(s==null?void 0:s.data.minlen))})},TU=(r,t,e)=>r.getRelatedEdges(t,"both").find(n=>n.source===e||n.target===e),LC=(r,t)=>t.data.low<=r.data.lim&&r.data.lim<=t.data.lim,OU=(r,t)=>{switch(t){case"network-simplex":NU(r);break;case"tight-tree":kC(r);break;case"longest-path":IU(r);break;default:kC(r)}},IU=MC,kC=r=>{pU(r),wU(r)},NU=r=>{BU(r)},LU=(r,t)=>{const{edgeLabelSpace:e,keepNodeOrder:n,prevGraph:i,rankdir:a,ranksep:s}=t;!n&&i&&QU(r,i);const o=HU(r);e&&(t.ranksep=GU(o,{rankdir:a,ranksep:s}));let A;try{A=kU(o,t)}catch(l){if(l.message==="Not possible to find intersection inside of the rectangle"){console.error(`The following error may be caused by improper layer setting, please make sure your manual layer setting does not violate the graph's structure: `,l);return}throw l}return UU(r,o),A},kU=(r,t)=>{const{acyclicer:e,ranker:n,rankdir:i="tb",nodeOrder:a,keepNodeOrder:s,align:o,nodesep:A=50,edgesep:l=20,ranksep:c=50}=t;JU(r),x3(r,e);const{nestingRoot:u,nodeRankFactor:h}=R3(r);OU(eC(r),n),zU(r),O3(r,h),_3(r,u),T3(r),KU(r),VU(r);const d=[];G3(r,d),AU(r,d),N3(r),s&&aU(r,a),iU(r,s),qU(r),L3(r,i),vU(r,{align:o,nodesep:A,edgesep:l,ranksep:c}),$U(r),XU(r),K3(r,d),ZU(r),k3(r,i);const{width:f,height:g}=WU(r);return jU(r),YU(r),S3(r),{width:f,height:g}},QU=(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})},UU=(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)})},RU=["width","height","layer","fixorder"],DU={width:0,height:0},PU=["minlen","weight","width","height","labeloffset"],_U={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},Ky=["labelpos"],HU=r=>{const t=new Gr({tree:[]});return r.getAllNodes().forEach(e=>{const n=UC(r.getNode(e.id).data),i=Object.assign(Object.assign({},DU),n),a=QC(i,RU);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);Re(s)||(t.hasNode(s.id)||t.addNode(Object.assign({},s)),t.setParent(e.id,s.id))}),r.getAllEdges().forEach(e=>{const n=UC(r.getEdge(e.id).data),i={};Ky==null||Ky.forEach(a=>{n[a]!==void 0&&(i[a]=n[a])}),t.addEdge({id:e.id,source:e.source,target:e.target,data:Object.assign({},_U,QC(n,PU),i)})}),t},GU=(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},zU=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};Vc(r,"edge-proxy",i,"_ep")}})},KU=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},VU=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))})},WU=(r,t)=>{let e,n=0,i,a=0;const{marginx:s=0,marginy:o=0}=t||{},A=l=>{if(!l.data)return;const c=l.data.x,u=l.data.y,h=l.data.width,d=l.data.height;!isNaN(c)&&!isNaN(h)&&(e===void 0&&(e=c-h/2),e=Math.min(e,c-h/2),n=Math.max(n,c+h/2)),!isNaN(u)&&!isNaN(d)&&(i===void 0&&(i=u-d/2),i=Math.min(i,u-d/2),a=Math.max(a,u+d/2))};return r.getAllNodes().forEach(l=>{A(l)}),r.getAllEdges().forEach(l=>{l!=null&&l.data.hasOwnProperty("x")&&A(l)}),e-=s,i-=o,r.getAllNodes().forEach(l=>{l.data.x-=e,l.data.y-=i}),r.getAllEdges().forEach(l=>{var c;(c=l.data.points)===null||c===void 0||c.forEach(u=>{u.x-=e,u.y-=i}),l.data.hasOwnProperty("x")&&(l.data.x-=e),l.data.hasOwnProperty("y")&&(l.data.y-=i)}),{width:n-e+s,height:a-i+o}},jU=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(rC(e.data,i)),t.data.points.push(rC(n.data,a))})},ZU=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}})},YU=r=>{r.getAllEdges().forEach(t=>{var e;t.data.reversed&&((e=t.data.points)===null||e===void 0||e.reverse())})},XU=r=>{r.getAllNodes().forEach(t=>{var e,n,i;if(!((e=r.getChildren(t.id))===null||e===void 0)&&e.length){const a=r.getNode(t.id),s=r.getNode(a.data.borderTop),o=r.getNode(a.data.borderBottom),A=r.getNode(a.data.borderLeft[((n=a.data.borderLeft)===null||n===void 0?void 0:n.length)-1]),l=r.getNode(a.data.borderRight[((i=a.data.borderRight)===null||i===void 0?void 0:i.length)-1]);a.data.width=Math.abs((l==null?void 0:l.data.x)-(A==null?void 0:A.data.x))||10,a.data.height=Math.abs((o==null?void 0:o.data.y)-(s==null?void 0:s.data.y))||10,a.data.x=((A==null?void 0:A.data.x)||0)+a.data.width/2,a.data.y=((s==null?void 0:s.data.y)||0)+a.data.height/2}}),r.getAllNodes().forEach(t=>{t.data.dummy==="border"&&r.removeNode(t.id)})},JU=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)}})},qU=r=>{const t=Uh(r);t==null||t.forEach(e=>{let n=0;e==null||e.forEach((i,a)=>{var s;const o=r.getNode(i);o.data.order=a+n,(s=o.data.selfEdges)===null||s===void 0||s.forEach(A=>{Vc(r,"selfedge",{width:A.data.width,height:A.data.height,rank:o.data.rank,order:a+ ++n,e:A},"_se")}),delete o.data.selfEdges})})},$U=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}})},QC=(r,t)=>{const e={};return t==null||t.forEach(n=>{r[n]!==void 0&&(e[n]=+r[n])}),e},UC=(r={})=>{const t={};return Object.keys(r).forEach(e=>{t[e.toLowerCase()]=r[e]}),t};function Rh(r){if(!r)return[0,0,0];if(ye(r))return[r,r,r];if(r.length===0)return[0,0,0];const[t,e=t,n=t]=r;return[t,e,n]}function Nl(r,t){let e;return Vt(t)?e=t:ye(t)?e=()=>t:e=()=>r,e}function Vy(r,t,e=!0){return!t&&t!==0?n=>{const{size:i}=n.data||{};return i?Array.isArray(i)?e?Math.max(...i)||r:i:br(i)&&i.width&&i.height?e?Math.max(i.width,i.height)||r:[i.width,i.height]:i:r}:Vt(t)?t:ye(t)?()=>t:Array.isArray(t)?()=>e?Math.max(...t)||r:t:br(t)&&t.width&&t.height?()=>e?Math.max(t.width,t.height)||r:[t.width,t.height]:()=>r}const Wy=(r,t,e=10)=>{let n;const i=typeof t=="function"?t:()=>t||0;return r?Array.isArray(r)?n=s=>r:Vt(r)?n=r:n=s=>r:n=s=>{var o,A,l;if(!((o=s.data)===null||o===void 0)&&o.bboxSize)return(A=s.data)===null||A===void 0?void 0:A.bboxSize;if(!((l=s.data)===null||l===void 0)&&l.size){const c=s.data.size;return Array.isArray(c)?c:br(c)?[c.width,c.height]:c}return e},s=>{const o=n(s),A=i(s);return Math.max(...Rh(o))+A}},jy=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=>jy(e))}if(typeof r=="object"){const t={};return Object.keys(r).forEach(e=>{t[e]=jy(r[e])}),t}return r},Pa=(r,t)=>{const e=jy(r);return e.data=e.data||{},t&&(ye(e.data.x)||(e.data.x=Math.random()*t[0]),ye(e.data.y)||(e.data.y=Math.random()*t[1])),e},tR={rankdir:"TB",nodesep:50,ranksep:50,edgeLabelSpace:!0,ranker:"tight-tree",controlPoints:!1,radial:!1,focusNode:null};class eR{constructor(t={}){this.options=t,this.id="antv-dagre",this.options=Object.assign(Object.assign({},tR),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericDagreLayout(!0,t,e)})}genericDagreLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{nodeSize:a,align:s,rankdir:o="TB",ranksep:A,nodesep:l,ranksepFunc:c,nodesepFunc:u,edgeLabelSpace:h,ranker:d,nodeOrder:f,begin:g,controlPoints:v,radial:p,sortByCombo:y,preset:x}=i,F=new Gr({tree:[]}),O=Nl(A||50,c),L=Nl(l||50,u);let U=L,R=O;(o==="LR"||o==="RL")&&(U=O,R=L);const j=Vy(10,a,!1),q=e.getAllNodes(),et=e.getAllEdges();q.forEach(yt=>{const xt=Rh(j(yt)),Dt=R(yt),Xt=U(yt),ne=xt[0]+2*Xt,le=xt[1]+2*Dt,ge=yt.data.layer;ye(ge)?F.addNode({id:yt.id,data:{width:ne,height:le,layer:ge}}):F.addNode({id:yt.id,data:{width:ne,height:le}})}),y&&(F.attachTreeStructure("combo"),q.forEach(yt=>{const{parentId:xt}=yt.data;xt!==void 0&&F.hasNode(xt)&&F.setParent(yt.id,xt,"combo")})),et.forEach(yt=>{F.addEdge({id:yt.id,source:yt.source,target:yt.target,data:{weight:yt.data.weight||1}})});let it;x!=null&&x.length&&(it=new Gr({nodes:x})),LU(F,{prevGraph:it,edgeLabelSpace:h,keepNodeOrder:!!f,nodeOrder:f||[],acyclicer:"greedy",ranker:d,rankdir:o,nodesep:l,align:s});const dt=[0,0];if(g){let yt=1/0,xt=1/0;F.getAllNodes().forEach(Dt=>{yt>Dt.data.x&&(yt=Dt.data.x),xt>Dt.data.y&&(xt=Dt.data.y)}),F.getAllEdges().forEach(Dt=>{var Xt;(Xt=Dt.data.points)===null||Xt===void 0||Xt.forEach(ne=>{yt>ne.x&&(yt=ne.x),xt>ne.y&&(xt=ne.y)})}),dt[0]=g[0]-yt,dt[1]=g[1]-xt}const ft=o==="LR"||o==="RL";if(!p){const yt=new Set,Dt=o==="BT"||o==="RL"?(ge,xe)=>xe-ge:(ge,xe)=>ge-xe;F.getAllNodes().forEach(ge=>{ge.data.x=ge.data.x+dt[0],ge.data.y=ge.data.y+dt[1],yt.add(ft?ge.data.x:ge.data.y)});const Xt=Array.from(yt).sort(Dt),ne=ft?(ge,xe)=>ge.x!==xe.x:(ge,xe)=>ge.y!==xe.y,le=ft?(ge,xe,Qe)=>{const Pe=Math.max(xe.y,Qe.y),en=Math.min(xe.y,Qe.y);return ge.filter(mn=>mn.y<=Pe&&mn.y>=en)}:(ge,xe,Qe)=>{const Pe=Math.max(xe.x,Qe.x),en=Math.min(xe.x,Qe.x);return ge.filter(mn=>mn.x<=Pe&&mn.x>=en)};F.getAllEdges().forEach((ge,xe)=>{var Qe;h&&v&&ge.data.type!=="loop"&&(ge.data.controlPoints=nR((Qe=ge.data.points)===null||Qe===void 0?void 0:Qe.map(({x:Pe,y:en})=>({x:Pe+dt[0],y:en+dt[1]})),F.getNode(ge.source),F.getNode(ge.target),Xt,ft,ne,le))})}let mt=[];mt=F.getAllNodes().map(yt=>Pa(yt));const Rt=F.getAllEdges();return t&&(mt.forEach(yt=>{e.mergeNodeData(yt.id,{x:yt.data.x,y:yt.data.y})}),Rt.forEach(yt=>{e.mergeEdgeData(yt.id,{controlPoints:yt.data.controlPoints})})),{nodes:mt,edges:Rt}})}}const nR=(r,t,e,n,i,a,s)=>{let o=(r==null?void 0:r.slice(1,r.length-1))||[];if(t&&e){let{x:A,y:l}=t.data,{x:c,y:u}=e.data;if(i&&(A=t.data.y,l=t.data.x,c=e.data.y,u=e.data.x),u!==l&&A!==c){const h=n.indexOf(l),d=n[h+1];if(d){const v=o[0],p=i?{x:(l+d)/2,y:(v==null?void 0:v.y)||c}:{x:(v==null?void 0:v.x)||c,y:(l+d)/2};(!v||a(v,p))&&o.unshift(p)}const f=n.indexOf(u),g=Math.abs(f-h);if(g===1)o=s(o,t.data,e.data),o.length||o.push(i?{x:(l+u)/2,y:A}:{x:A,y:(l+u)/2});else if(g>1){const v=n[f-1];if(v){const p=o[o.length-1],y=i?{x:(u+v)/2,y:(p==null?void 0:p.y)||c}:{x:(p==null?void 0:p.x)||A,y:(u+v)/2};(!p||a(p,y))&&o.push(y)}}}}return o},Ll=(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}},rR={radius:null,startRadius:null,endRadius:null,startAngle:0,endAngle:2*Math.PI,clockwise:!0,divisions:1,ordering:null,angleRatio:1};class iR{constructor(t={}){this.options=t,this.id="circular",this.options=Object.assign(Object.assign({},rR),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericCircularLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericCircularLayout(!0,t,e)})}genericCircularLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,divisions:A,startAngle:l=0,endAngle:c=2*Math.PI,angleRatio:u,ordering:h,clockwise:d,nodeSpacing:f,nodeSize:g}=i,v=e.getAllNodes(),p=e.getAllEdges(),[y,x,F]=sR(a,s,o),O=v==null?void 0:v.length;if(!O||O===1)return Ll(e,t,F);const L=(c-l)/O;let{radius:U,startRadius:R,endRadius:j}=i;if(f){const ft=Nl(10,f),mt=Vy(10,g);let Rt=-1/0;v.forEach(yt=>{const xt=mt(yt);Rt{xt===0?Qt+=Rt||10:Qt+=(ft(yt)||0)+(Rt||10)}),U=Qt/(2*Math.PI)}else!U&&!R&&!j?U=Math.min(x,y)/2:!R&&j?R=j:R&&!j&&(j=R);const q=L*u;let et=[];h==="topology"?et=RC(e,v):h==="topology-directed"?et=RC(e,v,!0):h==="degree"?et=aR(e,v):et=v.map(ft=>Pa(ft));const it=Math.ceil(O/A);for(let ft=0;ft{e.mergeNodeData(ft.id,{x:ft.data.x,y:ft.data.y})}),{nodes:et,edges:p}})}}const RC=(r,t,e=!1)=>{const n=[Pa(t[0])],i={},a=t.length;i[t[0].id]=!0;let s=0;return t.forEach((o,A)=>{if(A!==0)if((A===a-1||r.getDegree(o.id,"both")!==r.getDegree(t[A+1].id,"both")||r.areNeighbors(n[s].id,o.id))&&!i[o.id])n.push(Pa(o)),i[o.id]=!0,s++;else{const l=e?r.getSuccessors(n[s].id):r.getNeighbors(n[s].id);let c=!1;for(let h=0;h{e.push(Pa(n))}),e.sort((n,i)=>r.getDegree(n.id,"both")-r.getDegree(i.id,"both")),e}const sR=(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]},Po=Array.isArray,oR={nodeSize:30,nodeSpacing:10,preventOverlap:!1,sweep:void 0,equidistant:!1,startAngle:3/2*Math.PI,clockwise:!0,maxLevelDiff:void 0,sortBy:"degree"};class Zy{constructor(t={}){this.options=t,this.id="concentric",this.options=Object.assign(Object.assign({},oR),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericConcentricLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericConcentricLayout(!0,t,e)})}genericConcentricLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o,sortBy:A,maxLevelDiff:l,sweep:c,clockwise:u,equidistant:h,preventOverlap:d,startAngle:f=3/2*Math.PI,nodeSize:g,nodeSpacing:v}=i,p=e.getAllNodes(),y=e.getAllEdges(),x=!s&&typeof window!="undefined"?window.innerWidth:s,F=!o&&typeof window!="undefined"?window.innerHeight:o,O=a||[x/2,F/2];if(!(p!=null&&p.length)||p.length===1)return Ll(e,t,O);const L=[];let U,R=0;Po(g)?U=Math.max(g[0],g[1]):Vt(g)?(U=-1/0,p.forEach(yt=>{const xt=Math.max(...Rh(g(yt)));xt>U&&(U=xt)})):U=g,Po(v)?R=Math.max(v[0],v[1]):ye(v)&&(R=v),p.forEach(yt=>{const xt=Pa(yt);L.push(xt);let Dt=U;const{data:Xt}=xt;Po(Xt.size)?Dt=Math.max(Xt.size[0],Xt.size[1]):ye(Xt.size)?Dt=Xt.size:br(Xt.size)&&(Dt=Math.max(Xt.size.width,Xt.size.height)),U=Math.max(U,Dt),Vt(v)&&(R=Math.max(v(yt),R))});const j={};L.forEach((yt,xt)=>{j[yt.id]=xt});let q=A;(!gn(q)||L[0].data[q]===void 0)&&(q="degree"),q==="degree"?L.sort((yt,xt)=>e.getDegree(xt.id,"both")-e.getDegree(yt.id,"both")):L.sort((yt,xt)=>xt.data[q]-yt.data[q]);const et=L[0],it=(l||(q==="degree"?e.getDegree(et.id,"both"):et.data[q]))/4,dt=[{nodes:[]}];let ft=dt[0];L.forEach(yt=>{if(ft.nodes.length>0){const xt=Math.abs(q==="degree"?e.getDegree(ft.nodes[0].id,"both")-e.getDegree(yt.id,"both"):ft.nodes[0].data[q]-yt.data[q]);it&&xt>=it&&(ft={nodes:[]},dt.push(ft))}ft.nodes.push(yt)});let mt=U+R;if(!d){const yt=dt.length>0&&dt[0].nodes.length>1,Dt=(Math.min(x,F)/2-mt)/(dt.length+(yt?1:0));mt=Math.min(mt,Dt)}let Rt=0;if(dt.forEach(yt=>{const xt=c===void 0?2*Math.PI-2*Math.PI/yt.nodes.length:c;if(yt.dTheta=xt/Math.max(1,yt.nodes.length-1),yt.nodes.length>1&&d){const Dt=Math.cos(yt.dTheta)-Math.cos(0),Xt=Math.sin(yt.dTheta)-Math.sin(0),ne=Math.sqrt(mt*mt/(Dt*Dt+Xt*Xt));Rt=Math.max(ne,Rt)}yt.r=Rt,Rt+=mt}),h){let yt=0,xt=0;for(let Dt=0;Dt{Xt===0&&(xt=Dt.r||0),Dt.r=xt,xt+=yt})}return dt.forEach(yt=>{const xt=yt.dTheta||0,Dt=yt.r||0;yt.nodes.forEach((Xt,ne)=>{const le=f+(u?1:-1)*xt*ne;Xt.data.x=O[0]+Dt*Math.cos(le),Xt.data.y=O[1]+Dt*Math.sin(le)})}),t&&L.forEach(yt=>e.mergeNodeData(yt.id,{x:yt.data.x,y:yt.data.y})),{nodes:L,edges:y}})}}function AR(r){const t=+this._x.call(null,r),e=+this._y.call(null,r);return DC(this.cover(t,e),t,e,r)}function DC(r,t,e,n){if(isNaN(t)||isNaN(e))return r;var i,a=r._root,s={data:n},o=r._x0,A=r._y0,l=r._x1,c=r._y1,u,h,d,f,g,v,p,y;if(!a)return r._root=s,r;for(;a.length;)if((g=t>=(u=(o+l)/2))?o=u:l=u,(v=e>=(h=(A+c)/2))?A=h:c=h,i=a,!(a=a[p=v<<1|g]))return i[p]=s,r;if(d=+r._x.call(null,a.data),f=+r._y.call(null,a.data),t===d&&e===f)return s.next=a,i?i[p]=s:r._root=s,r;do i=i?i[p]=new Array(4):r._root=new Array(4),(g=t>=(u=(o+l)/2))?o=u:l=u,(v=e>=(h=(A+c)/2))?A=h:c=h;while((p=v<<1|g)===(y=(f>=h)<<1|d>=u));return i[y]=a,i[p]=s,r}function lR(r){var t,e,n=r.length,i,a,s=new Array(n),o=new Array(n),A=1/0,l=1/0,c=-1/0,u=-1/0;for(e=0;ec&&(c=i),au&&(u=a));if(A>c||l>u)return this;for(this.cover(A,l).cover(c,u),e=0;er||r>=i||n>t||t>=a;)switch(l=(tc||(o=f.y0)>u||(A=f.x1)=p)<<1|r>=v)&&(f=h[h.length-1],h[h.length-1]=h[h.length-1-g],h[h.length-1-g]=f)}else{var y=r-+this._x.call(null,d.data),x=t-+this._y.call(null,d.data),F=y*y+x*x;if(F=(h=(s+A)/2))?s=h:A=h,(g=u>=(d=(o+l)/2))?o=d:l=d,t=e,!(e=e[v=g<<1|f]))return this;if(!e.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(n=t,p=v)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[v]=a:delete t[v],(e=t[0]||t[1]||t[2]||t[3])&&e===(t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[p]=e:this._root=e),this):(this._root=a,this)}function gR(r){for(var t=0,e=r.length;t=(f=(A+u)/2))?A=f:u=f,(O=e>=(g=(l+h)/2))?l=g:h=g,(L=n>=(v=(c+d)/2))?c=v:d=v,a=s,!(s=s[U=L<<2|O<<1|F]))return a[U]=o,r;if(p=+r._x.call(null,s.data),y=+r._y.call(null,s.data),x=+r._z.call(null,s.data),t===p&&e===y&&n===x)return o.next=s,a?a[U]=o:r._root=o,r;do a=a?a[U]=new Array(8):r._root=new Array(8),(F=t>=(f=(A+u)/2))?A=f:u=f,(O=e>=(g=(l+h)/2))?l=g:h=g,(L=n>=(v=(c+d)/2))?c=v:d=v;while((U=L<<2|O<<1|F)===(R=(x>=v)<<2|(y>=g)<<1|p>=f));return a[R]=s,a[U]=o,r}function CR(r){Array.isArray(r)||(r=Array.from(r));const t=r.length,e=new Float64Array(t),n=new Float64Array(t),i=new Float64Array(t);let a=1/0,s=1/0,o=1/0,A=-1/0,l=-1/0,c=-1/0;for(let u=0,h,d,f,g;uA&&(A=d),fl&&(l=f),gc&&(c=g));if(a>A||s>l||o>c)return this;this.cover(a,s,o).cover(A,l,c);for(let u=0;ur||r>=s||i>t||t>=o||a>e||e>=A;)switch(h=(ef||(l=x.y0)>g||(c=x.z0)>v||(u=x.x1)=U)<<2|(t>=L)<<1|r>=O)&&(x=p[p.length-1],p[p.length-1]=p[p.length-1-F],p[p.length-1-F]=x)}else{var R=r-+this._x.call(null,y.data),j=t-+this._y.call(null,y.data),q=e-+this._z.call(null,y.data),et=R*R+j*j+q*q;if(etMath.sqrt(PA(r-n,2)+PA(t-i,2)+PA(e-a,2));function IR(r,t,e,n){const i=[],a=r-n,s=t-n,o=e-n,A=r+n,l=t+n,c=e+n;return this.visit((u,h,d,f,g,v,p)=>{if(!u.length)do{const y=u.data;OR(r,t,e,this._x(y),this._y(y),this._z(y))<=n&&i.push(y)}while(u=u.next);return h>A||d>l||f>c||g=(g=(s+l)/2))?s=g:l=g,(x=d>=(v=(o+c)/2))?o=v:c=v,(F=f>=(p=(A+u)/2))?A=p:u=p,t=e,!(e=e[O=F<<2|x<<1|y]))return this;if(!e.length)break;(t[O+1&7]||t[O+2&7]||t[O+3&7]||t[O+4&7]||t[O+5&7]||t[O+6&7]||t[O+7&7])&&(n=t,L=O)}for(;e.data!==r;)if(i=e,!(e=e.next))return this;return(a=e.next)&&delete e.next,i?(a?i.next=a:delete i.next,this):t?(a?t[O]=a:delete t[O],(e=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&e===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!e.length&&(n?n[L]=e:this._root=e),this):(this._root=a,this)}function LR(r){for(var t=0,e=r.length;t{const{nodeStrength:h,x:d,y:f,z:g,size:v}=c.data;return{x:d,y:f,z:g,size:v,index:u,id:c.id,vx:0,vy:0,vz:0,weight:a*h}}),A=(i===2?Zg(o,c=>c.x,c=>c.y):HC(o,c=>c.x,c=>c.y,c=>c.z)).visitAfter(WR),l=new Map;return o.forEach(c=>{l.set(c.id,c),ZR(c,A,i)}),o.map((c,u)=>{const{id:h,data:d}=s[u],{mass:f=1}=d;n[h]={x:c.vx/f,y:c.vy/f,z:c.vz/f}}),n}function WR(r){let t=0,e=0,n=0,i=0,a=0;const s=r.length;if(s){for(let o=0;o{var o;if(((o=r.data)===null||o===void 0?void 0:o.id)===a.id)return;const A=[e,n,i][s-1],l=a.x-r.x||Jy,c=a.y-r.y||Jy,u=a.z-r.z||Jy,h=[l,c,u],d=A-t;let f=0;for(let p=0;pjR(n,i,a,s,o,r,e))}const YR={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 zC{constructor(t={}){this.options=t,this.id="force",this.timeInterval=0,this.judgingDistance=0,this.running=!1,this.options=Object.assign(Object.assign({},YR),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericForceLayout(!1,t,e)})}assign(t,e){return(0,D.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,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),a=e.getAllNodes(),s=e.getAllEdges(),o=this.formatOptions(i,e),{dimensions:A,width:l,height:c,nodeSize:u,getMass:h,nodeStrength:d,edgeStrength:f,linkDistance:g}=o,v=a.map((R,j)=>Object.assign(Object.assign({},R),{data:Object.assign(Object.assign({},R.data),{x:ye(R.data.x)?R.data.x:Math.random()*l,y:ye(R.data.y)?R.data.y:Math.random()*c,z:ye(R.data.z)?R.data.z:Math.random()*Math.sqrt(l*c),size:u(R)||30,mass:h(R),nodeStrength:d(R)})})),p=s.map(R=>Object.assign(Object.assign({},R),{data:Object.assign(Object.assign({},R.data),{edgeStrength:f(R),linkDistance:g(R,e.getNode(R.source),e.getNode(R.target))})}));if(!(a!=null&&a.length))return this.lastResult={nodes:[],edges:s},{nodes:[],edges:s};const y={};a.forEach((R,j)=>{y[R.id]={x:0,y:0,z:0}});const x=new Gr({nodes:v,edges:p});this.formatCentripetal(o,x);const{maxIteration:F,minMovement:O,onTick:L}=o;if(this.lastLayoutNodes=v,this.lastLayoutEdges=p,this.lastAssign=t,this.lastGraph=e,this.lastCalcGraph=x,this.lastOptions=o,this.lastVelMap=y,typeof window=="undefined")return;let U=0;return new Promise(R=>{this.timeInterval=window.setInterval(()=>{(!a||!this.running)&&R({nodes:qy(e,v),edges:s}),this.runOneStep(x,e,U,y,o),this.updatePosition(e,x,y,o),t&&v.forEach(j=>e.mergeNodeData(j.id,{x:j.data.x,y:j.data.y,z:A===3?j.data.z:void 0})),L==null||L({nodes:qy(e,v),edges:s}),U++,(U>=F||this.judgingDistance{let l=1;ye(A==null?void 0:A.data.mass)&&(l=A==null?void 0:A.data.mass);const c=e.getDegree(A.id,"both");return!c||c<5?l:c*5*l}),n.nodeSize=Wy(t.nodeSize,t.nodeSpacing);const o=t.linkDistance?Nl(1,t.linkDistance):A=>1+n.nodeSize(e.getNode(A.source))+n.nodeSize(e.getNode(A.target));return n.linkDistance=o,n.nodeStrength=Nl(1,t.nodeStrength),n.edgeStrength=Nl(1,t.edgeStrength),n}formatCentripetal(t,e){const{dimensions:n,centripetalOptions:i,center:a,clusterNodeStrength:s,leafCluster:o,clustering:A,nodeClusterBy:l}=t,c=e.getAllNodes(),u=i||{leaf:2,single:2,others:1,center:p=>({x:a[0],y:a[1],z:n===3?a[2]:void 0})};typeof s!="function"&&(t.clusterNodeStrength=p=>s);let h,d;if(o&&l&&(h=KC(e,l),d=Array.from(new Set(c==null?void 0:c.map(p=>p.data[l])))||[],t.centripetalOptions=Object.assign(u,{single:100,leaf:p=>{const{siblingLeaves:y,sameTypeLeaves:x}=h[p.id]||{};return(x==null?void 0:x.length)===(y==null?void 0:y.length)||(d==null?void 0:d.length)===1?1:t.clusterNodeStrength(p)},others:1,center:p=>{const y=e.getDegree(p.id,"both");if(!y)return{x:100,y:100,z:0};let x;if(y===1){const{sameTypeLeaves:F=[]}=h[p.id]||{};F.length===1?x=void 0:F.length>1&&(x=VC(F))}else x=void 0;return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})),A&&l){h||(h=KC(e,l)),d||(d=Array.from(new Set(c.map(y=>y.data[l])))),d=d.filter(y=>y!==void 0);const p={};d.forEach(y=>{const x=c.filter(F=>F.data[l]===y).map(F=>e.getNode(F.id));p[y]=VC(x)}),t.centripetalOptions=Object.assign(u,{single:y=>t.clusterNodeStrength(y),leaf:y=>t.clusterNodeStrength(y),others:y=>t.clusterNodeStrength(y),center:y=>{const x=p[y.data[l]];return{x:x==null?void 0:x.x,y:x==null?void 0:x.y,z:x==null?void 0:x.z}}})}const{leaf:f,single:g,others:v}=t.centripetalOptions||{};f&&typeof f!="function"&&(t.centripetalOptions.leaf=()=>f),g&&typeof g!="function"&&(t.centripetalOptions.single=()=>g),v&&typeof v!="function"&&(t.centripetalOptions.others=()=>v)}runOneStep(t,e,n,i,a){const s={},o=t.getAllNodes(),A=t.getAllEdges();if(!(o!=null&&o.length))return;const{monitor:l}=a;if(this.calRepulsive(t,s,a),A&&this.calAttractive(t,s,a),this.calGravity(t,e,s,a),this.updateVelocity(t,s,i,a),l){const c=this.calTotalEnergy(s,o);l({energy:c,nodes:e.getAllNodes(),edges:e.getAllEdges(),iterations:n})}}calTotalEnergy(t,e){if(!(e!=null&&e.length))return 0;let n=0;return e.forEach((i,a)=>{const s=t[i.id].x,o=t[i.id].y,A=this.options.dimensions===3?t[i.id].z:0,l=s*s+o*o+A*A,{mass:c=1}=i.data;n+=c*l*.5}),n}calRepulsive(t,e,n){const{dimensions:i,factor:a,coulombDisScale:s}=n;VR(t,a,s*s,e,i)}calAttractive(t,e,n){const{dimensions:i,nodeSize:a}=n;t.getAllEdges().forEach((s,o)=>{const{source:A,target:l}=s,c=t.getNode(A),u=t.getNode(l);if(!c||!u)return;let h=u.data.x-c.data.x,d=u.data.y-c.data.y,f=i===3?u.data.z-c.data.z:0;!h&&!d&&(h=Math.random()*.01,d=Math.random()*.01,i===3&&!f&&(f=Math.random()*.01));const g=Math.sqrt(h*h+d*d+f*f);if(g{const{id:g,data:v}=f,{mass:p,x:y,y:x,z:F}=v,O=e.getNode(g);let L=0,U=0,R=0,j=h;const q=t.getDegree(g,"in"),et=t.getDegree(g,"out"),it=t.getDegree(g,"both"),dt=a==null?void 0:a(O,it);if(dt){const[ft,mt,Rt]=dt;L=y-ft,U=x-mt,j=Rt}else L=y-u[0],U=x-u[1],R=F-u[2];if(j&&(n[g].x-=j*L/p,n[g].y-=j*U/p,n[g].z-=j*R/p),d){const{leaf:ft,single:mt,others:Rt,center:Qt}=d,{x:yt,y:xt,z:Dt,centerStrength:Xt}=(Qt==null?void 0:Qt(O,o,A,l,c))||{x:0,y:0,z:0,centerStrength:0};if(!ye(yt)||!ye(xt))return;const ne=(y-yt)/p,le=(x-xt)/p,ge=(F-Dt)/p;if(Xt&&(n[g].x-=Xt*ne,n[g].y-=Xt*le,n[g].z-=Xt*ge),it===0){const Qe=mt(O);if(!Qe)return;n[g].x-=Qe*ne,n[g].y-=Qe*le,n[g].z-=Qe*ge;return}if(q===0||et===0){const Qe=ft(O,o,A);if(!Qe)return;n[g].x-=Qe*ne,n[g].y-=Qe*le,n[g].z-=Qe*ge;return}const xe=Rt(O);if(!xe)return;n[g].x-=xe*ne,n[g].y-=xe*le,n[g].z-=xe*ge}})}updateVelocity(t,e,n,i){const{damping:a,maxSpeed:s,interval:o,dimensions:A}=i,l=t.getAllNodes();l!=null&&l.length&&l.forEach(c=>{const{id:u}=c;let h=(n[u].x+e[u].x*o)*a||.01,d=(n[u].y+e[u].y*o)*a||.01,f=A===3?(n[u].z+e[u].z*o)*a||.01:0;const g=Math.sqrt(h*h+d*d+f*f);if(g>s){const v=s/g;h=v*h,d=v*d,f=v*f}n[u]={x:h,y:d,z:f}})}updatePosition(t,e,n,i){const{distanceThresholdMode:a,interval:s,dimensions:o}=i,A=e.getAllNodes();if(!(A!=null&&A.length)){this.judgingDistance=0;return}let l=0;a==="max"?this.judgingDistance=-1/0:a==="min"&&(this.judgingDistance=1/0),A.forEach(c=>{const{id:u}=c,h=t.getNode(u);if(ye(h.data.fx)&&ye(h.data.fy)){e.mergeNodeData(u,{x:h.data.fx,y:h.data.fy,z:o===3?h.data.fz:void 0});return}const d=n[u].x*s,f=n[u].y*s,g=o===3?n[u].z*s:0;e.mergeNodeData(u,{x:c.data.x+d,y:c.data.y+f,z:c.data.z+g});const v=Math.sqrt(d*d+f*f+g*g);switch(a){case"max":this.judgingDistancev&&(this.judgingDistance=v);break;default:l=l+v;break}}),(!a||a==="mean")&&(this.judgingDistance=l/A.length)}}const KC=(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]=XR(r,"leaf",i,t))}),n},XR=(r,t,e,n)=>{const i=r.getDegree(e.id,"in"),a=r.getDegree(e.id,"out");let s=e,o=[];i===0?(s=r.getSuccessors(e.id)[0],o=r.getNeighbors(s.id)):a===0&&(s=r.getPredecessors(e.id)[0],o=r.getNeighbors(s.id)),o=o.filter(l=>r.getDegree(l.id,"in")===0||r.getDegree(l.id,"out")===0);const A=JR(r,t,n,e,o);return{coreNode:s,siblingLeaves:o,sameTypeLeaves:A}},JR=(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},VC=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}},qy=(r,t)=>t.map(e=>{const{id:n,data:i}=e,a=r.getNode(n);return Object.assign(Object.assign({},a),{data:Object.assign(Object.assign({},a.data),{x:i.x,y:i.y,z:i.z})})});var wn=T(18086);const Ez=wn.XA,Bz=wn.a_,bz=wn.yQ,xz=wn.Hs,Cz=wn.Ec,Sz=wn.dx,Mz=wn.LU,Fz=wn.Rm,NA=wn.y3,Tz=wn.qK,Oz=wn.pb,Iz=wn.j,Nz=wn.sO,Lz=wn.BZ,kz=wn.EK,Qz=wn.Db,Uz=wn.Fx,Rz=wn.tU,Dz=wn.Ym,Pz=wn.rs,_z=wn.QR,Hz=wn.TB,Gz=wn.oH,WC=wn.Sc,zz=wn.BN,Kz=wn.it,Vz=wn.$r,Wz=wn.QM,jz=wn.AV;var Zz=(wn.y3,wn.y3);const Yz=wn.GH,Xz=wn.SO,Jz=wn.uZ,qz=wn.yU,$z=wn.F1,tK=wn.re,jC=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},ZC=(r,t)=>{const{nodes:e,edges:n}=r,i=[],a={};if(!e)throw new Error("invalid nodes data!");return e&&e.forEach((s,o)=>{a[s.id]=o;const A=[];i.push(A)}),n==null||n.forEach(s=>{const{source:o,target:A}=s,l=a[o],c=a[A];l===void 0||c===void 0||(i[l][c]=1,t||(i[c][l]=1))}),i},qR=(r,t)=>{const e=[];return r.forEach(n=>{const i=[];n.forEach(a=>{i.push(a*t)}),e.push(i)}),e},$R=r=>{let t=1/0,e=1/0,n=-1/0,i=-1/0;return r.forEach(a=>{let s=a.data.size;Po(s)?s.length===1&&(s=[s[0],s[0]]):ye(s)?s=[s,s]:(s===void 0||isNaN(s))&&(s=[30,30]);const o=[s[0]/2,s[1]/2],A=a.data.x-o[0],l=a.data.x+o[0],c=a.data.y-o[1],u=a.data.y+o[1];t>A&&(t=A),e>c&&(e=c),nMath.sqrt((r.x-t.x)*(r.x-t.x)+(r.y-t.y)*(r.y-t.y)),$y=(r,t,e,n="TB",i,a={})=>{if(!(t!=null&&t.length))return;const{stopBranchFn:s,stopAllFn:o}=a;for(let A=0;A{const p=Pa(o[v]);p.data.x=g[0]+a[0],p.data.y=g[1]+a[1],d.push(p)}),t&&d.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:A}})}}const eD=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)})})},nD=r=>{const e=NA.mul(NA.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 WC(e),o=NA.sqrt(s.diagonalMatrix).diagonal();return s.leftSingularVectors.toJSON().map(A=>NA.mul([A],[o]).toJSON()[0].splice(0,2))};function t1(r){return!!r.tick&&!!r.stop}const rD={gForce:!0,force2:!0,d3force:!0,fruchterman:!0,forceAtlas2:!0,force:!0,"graphin-force":!0},iD={center:[0,0],comboPadding:10,treeKey:"combo"};class aD{constructor(t={}){this.options=t,this.id="comboCombined",this.options=Object.assign(Object.assign({},iD),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericComboCombinedLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericComboCombinedLayout(!0,t,e)})}genericComboCombinedLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=this.initVals(Object.assign(Object.assign({},this.options),n)),{center:a,treeKey:s,outerLayout:o}=i,A=e.getAllNodes().filter(R=>!R.data._isCombo),l=e.getAllNodes().filter(R=>R.data._isCombo),c=e.getAllEdges(),u=A==null?void 0:A.length;if(!u||u===1)return Ll(e,t,a);const h=[],d=new Map;A.forEach(R=>{d.set(R.id,R)});const f=new Map;l.forEach(R=>{f.set(R.id,R)});const g=new Map,v=this.getInnerGraphs(e,s,d,f,c,i,g);yield Promise.all(v);const p=new Map,y=[],x=new Map;let F=!0;e.getRoots(s).forEach(R=>{const j=g.get(R.id),q=f.get(R.id)||d.get(R.id),et={id:R.id,data:Object.assign(Object.assign({},R.data),{x:j.data.x||q.data.x,y:j.data.y||q.data.y,fx:j.data.fx||q.data.fx,fy:j.data.fy||q.data.fy,mass:j.data.mass||q.data.mass,size:j.data.size})};y.push(et),p.set(R.id,!0),!isNaN(et.data.x)&&et.data.x!==0&&!isNaN(et.data.y)&&et.data.y!==0?F=!1:(et.data.x=Math.random()*100,et.data.y=Math.random()*100),$y(e,[R],it=>{it.id!==R.id&&x.set(it.id,R.id)},"TB",s)});const O=[];c.forEach(R=>{const j=x.get(R.source)||R.source,q=x.get(R.target)||R.target;j!==q&&p.has(j)&&p.has(q)&&O.push({id:R.id,source:j,target:q,data:{}})});let L;if(y!=null&&y.length){if(y.length===1)y[0].data.x=a[0],y[0].data.y=a[1];else{const R=new Gr({nodes:y,edges:O}),j=o||new zC;F&&rD[j.id]&&(yield(y.length<100?new XC:new Zy).assign(R));const q=Object.assign({center:a,kg:5,preventOverlap:!0,animate:!1},j.id==="force"?{gravity:1,factor:4,linkDistance:(et,it,dt)=>{const ft=Math.max(...it.data.size)||32,mt=Math.max(...dt.data.size)||32;return ft/2+mt/2+200}}:{});L=yield JC(j,R,q)}g.forEach(R=>{var j;const q=L.nodes.find(dt=>dt.id===R.id);if(q){const{x:dt,y:ft}=q.data;R.data.visited=!0,R.data.x=dt,R.data.y=ft,h.push({id:R.id,data:{x:dt,y:ft}})}const{x:et,y:it}=R.data;(j=R.data.nodes)===null||j===void 0||j.forEach(dt=>{h.push({id:dt.id,data:{x:dt.data.x+et,y:dt.data.y+it}})})}),g.forEach(({data:R})=>{const{x:j,y:q,visited:et,nodes:it}=R;it==null||it.forEach(dt=>{if(!et){const ft=h.find(mt=>mt.id===dt.id);ft.data.x+=j||0,ft.data.y+=q||0}})})}return t&&h.forEach(R=>{e.mergeNodeData(R.id,{x:R.data.x,y:R.data.y})}),{nodes:h,edges:c}})}initVals(t){const e=Object.assign({},t),{nodeSize:n,spacing:i,comboPadding:a}=t;let s,o;if(ye(i)?o=()=>i:Vt(i)?o=i:o=()=>0,e.spacing=o,!n)s=l=>{const c=o(l);return l.size?Po(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+c)/2:br(l.size)?((l.size.width>l.size.height?l.size.width:l.size.height)+c)/2:(l.size+c)/2:32+c/2};else if(Vt(n))s=l=>{const c=n(l),u=o(l);return Po(l.size)?((l.size[0]>l.size[1]?l.size[0]:l.size[1])+u)/2:((c||32)+u)/2};else if(Po(n)){const c=(n[0]>n[1]?n[0]:n[1])/2;s=u=>c+o(u)/2}else{const l=n/2;s=c=>l+o(c)/2}e.nodeSize=s;let A;return ye(a)?A=()=>a:Po(a)?A=()=>Math.max.apply(null,a):Vt(a)?A=a:A=()=>0,e.comboPadding=A,e}getInnerGraphs(t,e,n,i,a,s,o){const{nodeSize:A,comboPadding:l,spacing:c,innerLayout:u}=s,h=u||new Zy({}),d={center:[0,0],preventOverlap:!0,nodeSpacing:c},f=[],g=v=>{let p=(l==null?void 0:l(v))||10;return Po(p)&&(p=Math.max(...p)),{size:p?[p*2,p*2]:[30,30],padding:p}};return t.getRoots(e).forEach(v=>{o.set(v.id,{id:v.id,data:{nodes:[],size:g(v).size}});let p=Promise.resolve();$y(t,[v],y=>{var x;if(!y.data._isCombo)return;const{size:F,padding:O}=g(y);if(!(!((x=t.getChildren(y.id,e))===null||x===void 0)&&x.length))o.set(y.id,{id:y.id,data:Object.assign(Object.assign({},y.data),{size:F})});else{const L=o.get(y.id);o.set(y.id,{id:y.id,data:Object.assign({nodes:[]},L==null?void 0:L.data)});const U=new Map,R=t.getChildren(y.id,e).map(et=>{if(et.data._isCombo)return o.has(et.id)||o.set(et.id,{id:et.id,data:Object.assign({},et.data)}),U.set(et.id,!0),o.get(et.id);const it=n.get(et.id)||i.get(et.id);return U.set(et.id,!0),{id:et.id,data:Object.assign(Object.assign({},it.data),et.data)}}),j={nodes:R,edges:a.filter(et=>U.has(et.source)&&U.has(et.target))};let q=1/0;R.forEach(et=>{var it;let{size:dt}=et.data;dt||(dt=((it=o.get(et.id))===null||it===void 0?void 0:it.data.size)||(A==null?void 0:A(et))||[30,30]),ye(dt)&&(dt=[dt,dt]);const[ft,mt]=dt;q>ft&&(q=ft),q>mt&&(q=mt),et.data.size=dt}),p=p.then(()=>(0,D.mG)(this,void 0,void 0,function*(){const et=new Gr(j);yield JC(h,et,d,!0);const{minX:it,minY:dt,maxX:ft,maxY:mt}=$R(R),Rt={x:(ft+it)/2,y:(mt+dt)/2};j.nodes.forEach(yt=>{yt.data.x-=Rt.x,yt.data.y-=Rt.y});const Qt=[Math.max(ft-it,q)+O*2,Math.max(mt-dt,q)+O*2];o.get(y.id).data.size=Qt,o.get(y.id).data.nodes=R}))}return!0},"BT",e),f.push(p)}),f}}function JC(r,t,e,n){var i;return(0,D.mG)(this,void 0,void 0,function*(){return t1(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 ci(r){return function(){return r}}function LA(r){return(r()-.5)*1e-6}function sD(r){return r.index}function qC(r,t){var e=r.get(t);if(!e)throw new Error("node not found: "+t);return e}function oD(r){var t=sD,e=u,n,i=ci(30),a,s,o,A,l,c=1;r==null&&(r=[]);function u(v){return 1/Math.min(o[v.source.index],o[v.target.index])}function h(v){for(var p=0,y=r.length;p[t(O,L,s),O])),F;for(v=0,o=new Array(p);v{}};function $C(){for(var r=0,t=arguments.length,e={},n;r=0&&(n=e.slice(i+1),e=e.slice(0,i)),e&&!t.hasOwnProperty(e))throw new Error("unknown type: "+e);return{type:e,name:n}})}Yg.prototype=$C.prototype={constructor:Yg,on:function(r,t){var e=this._,n=lD(r+"",e),i,a=-1,s=n.length;if(arguments.length<2){for(;++a0)for(var e=new Array(i),n=0,i,a;n=0&&r._call.call(void 0,t),r=r._next;--Wc}function a2(){kl=(Jg=Hh.now())+qg,Wc=Dh=0;try{dD()}finally{Wc=0,gD(),kl=0}}function fD(){var r=Hh.now(),t=r-Jg;t>e2&&(qg-=t,Jg=r)}function gD(){for(var r,t=Xg,e,n=1/0;t;)t._call?(n>t._time&&(n=t._time),r=t,t=t._next):(e=t._next,t._next=null,t=r?r._next=e:Xg=e);_h=r,n1(n)}function n1(r){if(!Wc){Dh&&(Dh=clearTimeout(Dh));var t=r-kl;t>24?(r<1/0&&(Dh=setTimeout(a2,r-Hh.now()-qg)),Ph&&(Ph=clearInterval(Ph))):(Ph||(Jg=Hh.now(),Ph=setInterval(fD,e2)),Wc=1,n2(a2))}}const vD=1664525,pD=1013904223,s2=4294967296;function mD(){let r=1;return()=>(r=(vD*r+pD)%s2)/s2}function yD(r){return r.x}function wD(r){return r.y}var ED=10,BD=Math.PI*(3-Math.sqrt(5));function bD(r){var t,e=1,n=.001,i=1-Math.pow(n,1/300),a=0,s=.6,o=new Map,A=i2(u),l=uD("tick","end"),c=mD();r==null&&(r=[]);function u(){h(),l.call("tick",t),e1?(v==null?o.delete(g):o.set(g,f(v)),t):o.get(g)},find:function(g,v,p){var y=0,x=r.length,F,O,L,U,R;for(p==null?p=1/0:p*=p,y=0;y1?(l.on(g,v),t):l.on(g)}}}function xD(){var r,t,e,n,i=ci(-30),a,s=1,o=1/0,A=.81;function l(d){var f,g=r.length,v=Zg(r,yD,wD).visitAfter(u);for(n=d,f=0;f=o)return;(d.data!==t||d.next)&&(p===0&&(p=LA(e),F+=p*p),y===0&&(y=LA(e),F+=y*y),Fh.index){var et=d-R.x-R.vx,it=f-R.y-R.vy,dt=et*et+it*it;dtd+q||Lf+q||Ul.r&&(l.r=l[c].r)}function A(){if(t){var l,c=t.length,u;for(e=new Array(c),l=0;le.id},manyBody:{},center:{x:0,y:0}},this.context={options:{},assign:!1,nodes:[],edges:[]},Si(this.options,t),this.options.forceSimulation&&(this.simulation=this.options.forceSimulation)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericLayout(!1,t,e)})}assign(t,e){return(0,D.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=Si({},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,D.mG)(this,void 0,void 0,function*(){const a=this.getOptions(n),s=e.getAllNodes().map(({id:c,data:u})=>Object.assign(Object.assign({id:c},u),Fl(u.data,this.config.inputNodeAttrs))),o=e.getAllEdges().map(c=>Object.assign({},c));Object.assign(this.context,{assign:t,nodes:s,edges:o,graph:e});const A=new Promise(c=>{this.resolver=c}),l=this.setSimulation(a);return l.nodes(s),(i=l.force("link"))===null||i===void 0||i.links(o),A})}getResult(){const{assign:t,nodes:e,edges:n,graph:i}=this.context,a=e.map(o=>({id:o.id,data:Object.assign(Object.assign({},o.data),Fl(o,this.config.outputNodeAttrs))})),s=n.map(({id:o,source:A,target:l,data:c})=>({id:o,source:typeof A=="object"?A.id:A,target:typeof l=="object"?l.id:l,data:c}));return t&&a.forEach(o=>i.mergeNodeData(o.id,o.data)),{nodes:a,edges:s}}initSimulation(){return bD()}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())})),o2(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)),o2(s,Object.entries(t[a]))}else e.force(a,null)}),e}}const o2=(r,t)=>t.reduce((e,[n,i])=>!e[n]||i===void 0?e:e[n].call(r,i),r);var A2=T(92546),LD=T.n(A2);class $g{constructor(t){this.id="dagre",this.options={},Object.assign(this.options,$g.defaultOptions,t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericDagreLayout(!1,t,Object.assign(Object.assign({},this.options),e))})}assign(t,e){return(0,D.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,D.mG)(this,void 0,void 0,function*(){const{nodeSize:i}=n,a=new A2.graphlib.Graph;a.setGraph(n),a.setDefaultEdgeLabel(()=>({}));const s=e.getAllNodes(),o=e.getAllEdges();[...s,...o].some(({id:l})=>ye(l))&&console.error("Dagre layout only support string id, it will convert number to string."),e.getAllNodes().forEach(l=>{const{id:c}=l,u=Object.assign({},l.data);if(i!==void 0){const[h,d]=Rh(Vt(i)?i(l):i);Object.assign(u,{width:h,height:d})}a.setNode(c.toString(),u)}),e.getAllEdges().forEach(({id:l,source:c,target:u})=>{a.setEdge(c.toString(),u.toString(),{id:l})}),LD().layout(a);const A={nodes:[],edges:[]};return a.nodes().forEach(l=>{const c=a.node(l);A.nodes.push({id:l,data:c}),t&&e.mergeNodeData(l,c)}),a.edges().forEach(l=>{const c=a.edge(l),{id:u}=c,h=(0,D._T)(c,["id"]),{v:d,w:f}=l;A.edges.push({id:u,source:d,target:f,data:h}),t&&e.mergeEdgeData(u,h)}),A})}}$g.defaultOptions={};class r1{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 r1(s)}}class jc{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 jc(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 jc(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 jc(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 jc(i)}}class Zc{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 Zc(this.quad.NW()),this.NE=new Zc(this.quad.NE()),this.SW=new Zc(this.quad.SW()),this.SE=new Zc(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/nPa(p,[o,A])),f=i.filter(p=>{const{source:y,target:x}=p;return y!==x}),g=new Gr({nodes:d,edges:f}),v=this.getSizes(g,u);if(this.run(g,e,c,v,t,s),l){for(let y=0;y250&&(n.barnesHut=!0),A===void 0&&e>100&&(n.prune=!0),l===0&&!A?(n.maxIteration=250,e<=200&&e>100?n.maxIteration=1e3:e>200&&(n.maxIteration=1200)):l===0&&A&&(n.maxIteration=100,e<=200&&e>100?n.maxIteration=500:e>200&&(n.maxIteration=950)),c||(n.kr=50,e>100&&e<=500?n.kr=20:e>500&&(n.kr=1)),u||(n.kg=20,e>100&&e<=500?n.kg=10:e>500&&(n.kg=1)),n}run(t,e,n,i,a,s){const{kr:o,barnesHut:A,onTick:l}=s,c=t.getAllNodes();let u=0,h=n;const d={},f={},g={};for(let v=0;v0;)u=this.oneStep(t,{iter:h,preventOverlapIters:50,krPrime:100,sg:u,forces:d,preForces:f,bodies:g,sizes:i},s),h--,l==null||l({nodes:c,edges:e.getAllEdges()});return t}oneStep(t,e,n){const{iter:i,preventOverlapIters:a,krPrime:s,sg:o,preForces:A,bodies:l,sizes:c}=e;let{forces:u}=e;const{preventOverlap:h,barnesHut:d}=n,f=t.getAllNodes();for(let g=0;ga||!h)?u=this.getOptRepGraForces(t,u,l,n):u=this.getRepGraForces(t,i,a,u,s,c,n),this.updatePos(t,u,A,o,n)}getAttrForces(t,e,n,i,a,s){const{preventOverlap:o,dissuadeHubs:A,mode:l,prune:c}=s,u=t.getAllEdges();for(let h=0;h0&&(O=F,L=F),a[d][0]+=O*x[0],a[f][0]-=L*x[0],a[d][1]+=O*x[1],a[f][1]-=L*x[1]}return a}getOptRepGraForces(t,e,n,i){const{kg:a,center:s,prune:o}=i,A=t.getAllNodes(),l=A.length;let c=9e10,u=-9e10,h=9e10,d=-9e10;for(let y=0;y=u&&(u=F.x),F.x<=c&&(c=F.x),F.y>=d&&(d=F.y),F.y<=h&&(h=F.y))}const f=Math.max(u-c,d-h),g={xmid:(u+c)/2,ymid:(d+h)/2,length:f,massCenter:s,mass:l},v=new jc(g),p=new Zc(v);for(let y=0;y0&&(q=l*(p+1)*(U+1)/j),i[v.id][0]-=q*R[0],i[L.id][0]+=q*R[0],i[v.id][1]-=q*R[1],i[L.id][1]+=q*R[1]}const y=[v.data.x-u[0],v.data.y-u[1]],x=Math.hypot(y[0],y[1]);y[0]=y[0]/x,y[1]=y[1]/x;const F=c*(p+1);i[v.id][0]-=F*y[0],i[v.id][1]-=F*y[1]}return i}updatePos(t,e,n,i,a){const{ks:s,tao:o,prune:A,ksmax:l}=a,c=t.getAllNodes(),u=c.length,h=[],d=[];let f=0,g=0,v=i;for(let y=0;y1.5*p?1.5*p:v);for(let y=0;yR?R:L;const j=L*e[x][0],q=L*e[x][1];t.mergeNodeData(x,{x:F.x+j,y:F.y+q})}return v}}const UD={maxIteration:1e3,gravity:10,speed:5,clustering:!1,clusterGravity:10,width:300,height:300,nodeClusterBy:"cluster"},RD=800;class DD{constructor(t={}){this.options=t,this.id="fruchterman",this.timeInterval=0,this.running=!1,this.options=Object.assign(Object.assign({},UD),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericFruchtermanLayout(!1,t,e)})}assign(t,e){return(0,D.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,D.mG)(this,void 0,void 0,function*(){if(this.running)return;const i=this.formatOptions(n),{dimensions:a,width:s,height:o,center:A,clustering:l,nodeClusterBy:c,maxIteration:u,onTick:h}=i,d=e.getAllNodes(),f=e.getAllEdges();if(!(d!=null&&d.length)){const x={nodes:[],edges:f};return this.lastResult=x,x}if(d.length===1){t&&e.mergeNodeData(d[0].id,{x:A[0],y:A[1],z:a===3?A[2]:void 0});const x={nodes:[Object.assign(Object.assign({},d[0]),{data:Object.assign(Object.assign({},d[0].data),{x:A[0],y:A[1],z:a===3?A[2]:void 0})})],edges:f};return this.lastResult=x,x}const g=d.map(x=>Pa(x,[s,o])),v=new Gr({nodes:g,edges:f}),p={};if(l&&g.forEach(x=>{const F=x.data[c];p[F]||(p[F]={name:F,cx:0,cy:0,count:0})}),this.lastLayoutNodes=g,this.lastLayoutEdges=f,this.lastAssign=t,this.lastGraph=v,this.lastOptions=i,this.lastClusterMap=p,typeof window=="undefined")return;let y=0;return new Promise(x=>{this.timeInterval=window.setInterval(()=>{if(!this.running){x({nodes:g,edges:f});return}this.runOneStep(v,p,i),t&&g.forEach(({id:F,data:O})=>e.mergeNodeData(F,{x:O.x,y:O.y,z:a===3?O.z:void 0})),h==null||h({nodes:g,edges:f}),y++,y>=u&&(window.clearInterval(this.timeInterval),x({nodes:g,edges:f}))},0),this.running=!0})})}formatOptions(t={}){const e=Object.assign(Object.assign({},this.options),t),{clustering:n,nodeClusterBy:i}=e,{center:a,width:s,height:o}=e;return e.width=!s&&typeof window!="undefined"?window.innerWidth:s,e.height=!o&&typeof window!="undefined"?window.innerHeight:o,e.center=a||[e.width/2,e.height/2],e.clustering=n&&!!i,e}runOneStep(t,e,n){const{dimensions:i,height:a,width:s,gravity:o,center:A,speed:l,clustering:c,nodeClusterBy:u,clusterGravity:h}=n,d=a*s,f=Math.sqrt(d)/10,g=t.getAllNodes(),v=d/(g.length+1),p=Math.sqrt(v),y={};if(this.applyCalculate(t,y,p,v),c){for(const F in e)e[F].cx=0,e[F].cy=0,e[F].count=0;g.forEach(F=>{const{data:O}=F,L=e[O[u]];ye(O.x)&&(L.cx+=O.x),ye(O.y)&&(L.cy+=O.y),L.count++});for(const F in e)e[F].cx/=e[F].count,e[F].cy/=e[F].count;const x=h||o;g.forEach((F,O)=>{const{id:L,data:U}=F;if(!ye(U.x)||!ye(U.y))return;const R=e[U[u]],j=Math.sqrt((U.x-R.cx)*(U.x-R.cx)+(U.y-R.cy)*(U.y-R.cy)),q=p*x;y[L].x-=q*(U.x-R.cx)/j,y[L].y-=q*(U.y-R.cy)/j})}g.forEach((x,F)=>{const{id:O,data:L}=x;if(!ye(L.x)||!ye(L.y))return;const U=.01*p*o;y[O].x-=U*(L.x-A[0]),y[O].y-=U*(L.y-A[1]),i===3&&(y[O].z-=U*(L.z-A[2]))}),g.forEach((x,F)=>{const{id:O,data:L}=x;if(ye(L.fx)&&ye(L.fy)){L.x=L.fx,L.y=L.fy,i===3&&(L.z=L.fz);return}if(!ye(L.x)||!ye(L.y))return;const U=Math.sqrt(y[O].x*y[O].x+y[O].y*y[O].y+(i===3?y[O].z*y[O].z:0));if(U>0){const R=Math.min(f*(l/RD),U);t.mergeNodeData(O,{x:L.x+y[O].x/U*R,y:L.y+y[O].y/U*R,z:i===3?L.z+y[O].z/U*R:void 0})}})}applyCalculate(t,e,n,i){this.calRepulsive(t,e,i),this.calAttractive(t,e,n)}calRepulsive(t,e,n){const i=t.getAllNodes();i.forEach(({data:a,id:s},o)=>{e[s]={x:0,y:0,z:0},i.forEach(({data:A,id:l},c)=>{if(o<=c||!ye(a.x)||!ye(A.x)||!ye(a.y)||!ye(A.y))return;let u=a.x-A.x,h=a.y-A.y,d=this.options.dimensions===3?a.z-A.z:0,f=u*u+h*h+d*d;f===0&&(f=1,u=.01,h=.01,d=.01);const g=n/f,v=u*g,p=h*g,y=d*g;e[s].x+=v,e[s].y+=p,e[l].x-=v,e[l].y-=p,this.options.dimensions===3&&(e[s].z+=y,e[l].z-=y)})})}calAttractive(t,e,n){t.getAllEdges().forEach(a=>{const{source:s,target:o}=a;if(!s||!o||s===o)return;const{data:A}=t.getNode(s),{data:l}=t.getNode(o);if(!ye(l.x)||!ye(A.x)||!ye(l.y)||!ye(A.y))return;const c=l.x-A.x,u=l.y-A.y,h=this.options.dimensions===3?l.z-A.z:0,d=Math.sqrt(c*c+u*u+h*h)/n,f=c*d,g=u*d,v=h*d;e[s].x+=f,e[s].y+=g,e[o].x-=f,e[o].y-=g,this.options.dimensions===3&&(e[s].z+=v,e[o].z-=v)})}}const PD={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 _D{constructor(t={}){this.options=t,this.id="grid",this.options=Object.assign(Object.assign({},PD),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericGridLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericGridLayout(!0,t,e)})}genericGridLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{begin:a=[0,0],condense:s,preventOverlapPadding:o,preventOverlap:A,rows:l,cols:c,nodeSpacing:u,nodeSize:h,width:d,height:f,position:g}=i;let{sortBy:v}=i;const p=e.getAllNodes(),y=e.getAllEdges(),x=p==null?void 0:p.length;if(!x||x===1)return Ll(e,t,a);const F=p.map(mt=>Pa(mt));v!=="id"&&(!gn(v)||F[0].data[v]===void 0)&&(v="degree"),v==="degree"?F.sort((mt,Rt)=>e.getDegree(Rt.id,"both")-e.getDegree(mt.id,"both")):v==="id"?F.sort((mt,Rt)=>ye(Rt.id)&&ye(mt.id)?Rt.id-mt.id:`${mt.id}`.localeCompare(`${Rt.id}`)):F.sort((mt,Rt)=>Rt.data[v]-mt.data[v]);const O=!d&&typeof window!="undefined"?window.innerWidth:d,L=!f&&typeof window!="undefined"?window.innerHeight:f,U=x,R={rows:l,cols:c};if(l!=null&&c!=null)R.rows=l,R.cols=c;else if(l!=null&&c==null)R.rows=l,R.cols=Math.ceil(U/R.rows);else if(l==null&&c!=null)R.cols=c,R.rows=Math.ceil(U/R.cols);else{const mt=Math.sqrt(U*L/O);R.rows=Math.round(mt),R.cols=Math.round(O/L*mt)}if(R.rows=Math.max(R.rows,1),R.cols=Math.max(R.cols,1),R.cols*R.rows>U){const mt=t0(R),Rt=e0(R);(mt-1)*Rt>=U?t0(R,mt-1):(Rt-1)*mt>=U&&e0(R,Rt-1)}else for(;R.cols*R.rows=U?e0(R,Rt+1):t0(R,mt+1)}let j=s?0:O/R.cols,q=s?0:L/R.rows;if(A||u){const mt=Nl(10,u),Rt=Vy(30,h,!1);F.forEach(Qt=>{(!Qt.data.x||!Qt.data.y)&&(Qt.data.x=0,Qt.data.y=0);const yt=e.getNode(Qt.id),[xt,Dt]=Rh(Rt(yt)||30),Xt=mt!==void 0?mt(Qt):o,ne=xt+Xt,le=Dt+Xt;j=Math.max(j,ne),q=Math.max(q,le)})}const et={},it={row:0,col:0},dt={};for(let mt=0;mt{e.mergeNodeData(mt.id,{x:mt.data.x,y:mt.data.y})}),ft})}}const t0=(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},e0=(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},i1=(r,t)=>r[`c-${t.row}-${t.col}`]||!1,l2=(r,t)=>r[`c-${t.row}-${t.col}`]=!0,c2=(r,t)=>{const e=r.cols||5;t.col++,t.col>=e&&(t.col=0,t.row++)},HD=(r,t,e,n,i,a,s,o)=>{let A,l;const c=i[r.id];if(c)A=c.col*e+e/2+t[0],l=c.row*n+n/2+t[1];else{for(;i1(o,s);)c2(a,s);A=s.col*e+e/2+t[0],l=s.row*n+n/2+t[1],l2(o,s),c2(a,s)}r.data.x=A,r.data.y=l},GD=(r,t,e)=>{try{const n=NA.mul(NA.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 WC(n),A=NA.sqrt(o.diagonalMatrix).diagonal();return o.leftSingularVectors.toJSON().map(l=>NA.mul([l],[A]).toJSON()[0].splice(0,r))}catch(n){const i=[];for(let a=0;a{const e=Object.assign(Object.assign({},KD),t),{positions:n,iterations:i,width:a,k:s,speed:o=100,strictRadial:A,focusIdx:l,radii:c=[],nodeSizeFunc:u}=e,h=r.getAllNodes(),d=[],f=a/10;for(let g=0;g{d[p]={x:0,y:0}}),WD(h,n,d,s,c,u),jD(n,d,o,A,l,f,a,c);return n},WD=(r,t,e,n,i,a)=>{t.forEach((s,o)=>{e[o]={x:0,y:0},t.forEach((A,l)=>{if(o===l||i[o]!==i[l])return;let c=s.x-A.x,u=s.y-A.y,h=Math.sqrt(c*c+u*u);if(h===0){h=1;const d=o>l?1:-1;c=.01*d,u=.01*d}if(h{const A=a||s/10;return n&&t.forEach((l,c)=>{const u=r[c].x-r[i].x,h=r[c].y-r[i].y,d=Math.sqrt(u*u+h*h);let f=h/d,g=-u/d;const v=Math.sqrt(l.x*l.x+l.y*l.y);let p=Math.acos((f*l.x+g*l.y)/v);p>Math.PI/2&&(p-=Math.PI/2,f*=-1,g*=-1);const y=Math.cos(p)*v;l.x=f*y,l.y=g*y}),r.forEach((l,c)=>{if(c===i)return;const u=Math.sqrt(t[c].x*t[c].x+t[c].y*t[c].y);if(u>0&&c!==i){const h=Math.min(A*(e/zD),u);if(l.x+=t[c].x/u*h,l.y+=t[c].y/u*h,n){let d=l.x-r[i].x,f=l.y-r[i].y;const g=Math.sqrt(d*d+f*f);d=d/g*o[c],f=f/g*o[c],l.x=r[i].x+d,l.y=r[i].y+f}}}),r},ZD={maxIteration:1e3,focusNode:null,unitRadius:null,linkDistance:50,preventOverlap:!1,strictRadial:!0,maxPreventOverlapIteration:200,sortStrength:10};class YD{constructor(t={}){this.options=t,this.id="radial",this.options=Object.assign(Object.assign({},ZD),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericRadialLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericRadialLayout(!0,t,e)})}genericRadialLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{width:a,height:s,center:o,focusNode:A,unitRadius:l,nodeSize:c,nodeSpacing:u,strictRadial:h,preventOverlap:d,maxPreventOverlapIteration:f,sortBy:g,linkDistance:v=50,sortStrength:p=10,maxIteration:y=1e3}=i,x=e.getAllNodes(),F=e.getAllEdges(),O=!a&&typeof window!="undefined"?window.innerWidth:a,L=!s&&typeof window!="undefined"?window.innerHeight:s,U=o||[O/2,L/2];if(!(x!=null&&x.length)||x.length===1)return Ll(e,t,U);let R=x[0];if(gn(A)){for(let Pe=0;PeU[0]?U[0]:O-U[0],mt=L-U[1]>U[1]?U[1]:L-U[1];ft===0&&(ft=O/2),mt===0&&(mt=L/2);const Rt=Math.min(ft,mt),Qt=Math.max(...dt),yt=[],xt=l||Rt/Qt;dt.forEach((Pe,en)=>{yt[en]=Pe*xt});const Dt=XD(x,et,v,yt,xt,g,p),Xt=JD(Dt),ne=GD(v,Dt,v);let le=ne.map(([Pe,en])=>({x:(isNaN(Pe)?Math.random()*v:Pe)-ne[j][0],y:(isNaN(en)?Math.random()*v:en)-ne[j][1]}));this.run(y,le,Xt,Dt,yt,j);let ge;if(d){ge=Wy(c,u);const Pe={nodes:x,nodeSizeFunc:ge,positions:le,radii:yt,height:L,width:O,strictRadial:!!h,focusIdx:j,iterations:f||200,k:le.length/4.5};le=VD(e,Pe)}const xe=[];return le.forEach((Pe,en)=>{const mn=Pa(x[en]);mn.data.x=Pe.x+U[0],mn.data.y=Pe.y+U[1],xe.push(mn)}),t&&xe.forEach(Pe=>e.mergeNodeData(Pe.id,{x:Pe.data.x,y:Pe.data.y})),{nodes:xe,edges:F}})}run(t,e,n,i,a,s){for(let o=0;o<=t;o++){const A=o/t;this.oneIteration(A,e,a,i,n,s)}}oneIteration(t,e,n,i,a,s){const o=1-t;e.forEach((A,l)=>{const c=YC(A,{x:0,y:0}),u=c===0?0:1/c;if(l===s)return;let h=0,d=0,f=0;e.forEach((v,p)=>{if(l===p)return;const y=YC(A,v),x=y===0?0:1/y,F=i[p][l];f+=a[l][p],h+=a[l][p]*(v.x+F*(A.x-v.x)*x),d+=a[l][p]*(v.y+F*(A.y-v.y)*x)});const g=n[l]===0?0:1/n[l];f*=o,f+=t*g*g,h*=o,h+=t*g*A.x*u,A.x=h/f,d*=o,d+=t*g*A.y*u,A.y=d/f})}}const XD=(r,t,e,n,i,a,s)=>{if(!r)return[];const o=[];if(t){const A={};t.forEach((l,c)=>{const u=[];l.forEach((h,d)=>{var f,g;if(c===d)u.push(0);else if(n[c]===n[d])if(a==="data")u.push(h*(Math.abs(c-d)*s)/(n[c]/i));else if(a){let v,p;if(A[r[c].id])v=A[r[c].id];else{const y=(a==="id"?r[c].id:(f=r[c].data)===null||f===void 0?void 0:f[a])||0;gn(y)?v=y.charCodeAt(0):v=y,A[r[c].id]=v}if(A[r[d].id])p=A[r[d].id];else{const y=(a==="id"?r[d].id:(g=r[d].data)===null||g===void 0?void 0:g[a])||0;gn(y)?p=y.charCodeAt(0):p=y,A[r[d].id]=p}u.push(h*(Math.abs(v-p)*s)/(n[c]/i))}else u.push(h*e/(n[c]/i));else{const v=(e+i)/2;u.push(h*v)}}),o.push(u)})}return o},JD=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)},$D=(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},eP={center:[0,0],width:300,height:300};class nP{constructor(t={}){this.options=t,this.id="random",this.options=Object.assign(Object.assign({},eP),t)}execute(t,e){return(0,D.mG)(this,void 0,void 0,function*(){return this.genericRandomLayout(!1,t,e)})}assign(t,e){return(0,D.mG)(this,void 0,void 0,function*(){yield this.genericRandomLayout(!0,t,e)})}genericRandomLayout(t,e,n){return(0,D.mG)(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},this.options),n),{center:a,width:s,height:o}=i,A=e.getAllNodes(),l=.9,c=!s&&typeof window!="undefined"?window.innerWidth:s,u=!o&&typeof window!="undefined"?window.innerHeight:o,h=a||[c/2,u/2],d=[];return A&&A.forEach(g=>{d.push({id:g.id,data:{x:(Math.random()-.5)*l*c+h[0],y:(Math.random()-.5)*l*u+h[1]}})}),t&&d.forEach(g=>e.mergeNodeData(g.id,{x:g.data.x,y:g.data.y})),{nodes:d,edges:e.getAllEdges()}})}}function rP(r){var t,e,n,i=r||1;function a(o,A){++t>i&&(n=e,s(1),++t),e[o]=A}function s(o){t=0,e=Object.create(null),o||(n=Object.create(null))}return s(),{clear:s,has:function(o){return e[o]!==void 0||n[o]!==void 0},get:function(o){var A=e[o];if(A!==void 0)return A;if((A=n[o])!==void 0)return a(o,A),A},set:function(o,A){e[o]!==void 0?e[o]=A:a(o,A)}}}var a1=new Map;function s1(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=>Da(e(n))}doLayout(t,e){const{hGap:n,getRibSep:i,vGap:a,nodeSize:s,height:o}=e,{model:A}=this.context,l=this.formatSize(s);let c=l(t)[0]+i(t);const u=(x,F=0)=>{var O;return F+=n*((x.children||[]).length+1),(O=x.children)===null||O===void 0||O.forEach(L=>{var U;(U=A.getNodeLikeDatum(L).children)===null||U===void 0||U.forEach(j=>{const q=A.getNodeLikeDatum(j);F=u(q,F)})}),F},h=x=>{if(x.depth===1)return c;const F=A.getParentData(x.id,"tree");if(Yc(x)){const O=A.getParentData(F.id,"tree"),L=g(x)-g(O);return h(F)+L*n/a}else{const O=(F.children||[]).indexOf(x.id),L=A.getNodeData((F.children||[]).slice(O));return d(F)-L.reduce((U,R)=>U+u(R),0)-l(F)[0]/2}},d=s1(x=>{if(o1(x))return l(x)[0]/2;const F=A.getParentData(x.id,"tree");if(Yc(x))return h(x)+u(x)+l(x)[0]/2;{const O=g(x)-g(F),L=n/a;return h(x)+O*L}},x=>x.id),f=x=>g(A.getParentData(x,"tree")),g=s1(x=>{if(o1(x))return o/2;if(Yc(x)){const F=A.getParentData(x.id,"tree"),O=F.children.indexOf(x.id);if(O===0)return f(F.id)+a;const L=A.getNodeLikeDatum(F.children[O-1]);if(oo(L.children))return g(L)+a;const U=A.getDescendantsData(L.id);return Math.max(...U.map(R=>Yc(R)?f(R.id):g(R)))+a}else{if(oo(x.children))return f(x.id)+a;const F=A.getNodeLikeDatum(x.children.slice(-1)[0]);if(oo(F.children))return g(F)+a;const O=A.getDescendantsData(x.id).slice(-1)[0];return(Yc(O)?f(O.id):g(O))+a}},x=>x.id);let v=0;const p={nodes:[],edges:[]},y=x=>{var F;(F=x.children)===null||F===void 0||F.forEach(j=>y(A.getNodeLikeDatum(j)));const O=g(x),L=d(x);if(p.nodes.push({id:x.id,x:L,y:O}),o1(x))return;const U=A.getRelatedEdgesData(x.id,"in")[0],R=[h(x),Yc(x)?O:f(x.id)];p.edges.push({id:Nt(U),controlPoints:[R],relatedNodeId:x.id}),v=Math.max(v,L+i(x)),x.depth===1&&(c=v)};return y(t),p}placeAlterative(t,e){const n=(e.children||[]).filter((o,A)=>A%2!==0);if(n.length===0)return t;const{model:i}=this.context,a=t.nodes.find(o=>o.id===e.id).y,s=o=>{const A=i.getAncestorsData(o,"tree");if(oo(A))return!1;const l=A.length===1?o:A[A.length-2].id;return n.includes(l)};t.nodes.forEach(o=>{s(o.id)&&(o.y=2*a-o.y)}),t.edges.forEach(o=>{s(o.relatedNodeId)&&(o.controlPoints=o.controlPoints.map(A=>[A[0],2*a-A[1]]))})}rightToLeft(t,e){return t.nodes.forEach(n=>n.x=e.width-n.x),t.edges.forEach(n=>{n.controlPoints=n.controlPoints.map(i=>[e.width-i[0],i[1]])}),t}execute(t,e){return iP(this,void 0,void 0,function*(){const n=Object.assign(Object.assign(Object.assign({},n0.defaultOptions),this.options),e),{direction:i,nodeSize:a}=n,s=this.getRoot();if(!s)return t;const o=this.formatSize(a);n.vGap||(n.vGap=Math.max(...(t.nodes||[]).map(h=>o(h)[1]))),n.hGap||(n.hGap=Math.max(...(t.nodes||[]).map(h=>o(h)[0])));let A=this.doLayout(s,n);this.placeAlterative(A,s),i==="RL"&&(A=this.rightToLeft(A,n));const{model:l}=this.context,c=[],u=[];return A.nodes.forEach(h=>{const{id:d,x:f,y:g}=h,v=l.getNodeLikeDatum(d);c.push(u2(v,{x:f,y:g}))}),A.edges.forEach(h=>{const{id:d,controlPoints:f}=h,g=l.getEdgeDatum(d);u.push(u2(g,{controlPoints:f}))}),{nodes:c,edges:u}})}}n0.defaultOptions={direction:"RL",getRibSep:()=>60};const u2=(r,t)=>Object.assign(Object.assign({},r),{style:Object.assign(Object.assign({},r.style||{}),t)}),o1=r=>r.depth===0,Yc=r=>(r.depth||(r.depth=0))%2===0;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(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class r0 extends Rg{constructor(){super(...arguments),this.id="snake"}formatSize(t,e){const n=typeof e=="function"?e:()=>e;return t.reduce((i,a)=>{const[s,o]=Da(n(a))||[0,0];return[Math.max(i[0],s),Math.max(i[1],o)]},[0,0])}validate(t){const{nodes:e=[],edges:n=[]}=t,i={},a={},s={};e.forEach(h=>{i[h.id]=0,a[h.id]=0,s[h.id]=[]}),n.forEach(h=>{i[h.target]++,a[h.source]++,s[h.source].push(h.target)});const o=new Set,A=h=>{o.has(h)||(o.add(h),s[h].forEach(A))};if(A(e[0].id),o.size!==e.length)return!1;const l=e.filter(h=>i[h.id]===0),c=e.filter(h=>a[h.id]===0);return!(l.length!==1||c.length!==1||e.filter(h=>i[h.id]===1&&a[h.id]===1).length!==e.length-2)}execute(t,e){return aP(this,void 0,void 0,function*(){var n;if(!this.validate(t))return t;const{nodeSize:i,padding:a,sortBy:s,cols:o,colGap:A,rowGap:l,clockwise:c,width:u,height:h}=Object.assign({},r0.defaultOptions,this.options,e),[d,f,g,v]=Ua(a),p=this.formatSize(t.nodes||[],i),y=Math.ceil((t.nodes||[]).length/o);let x=A||(u-v-f-o*p[0])/(o-1),F=l||(h-d-g-y*p[1])/(y-1);return(F===1/0||F<0)&&(F=0),(x===1/0||x<0)&&(x=0),{nodes:((s?(n=t.nodes)===null||n===void 0?void 0:n.sort(s):sP(t))||[]).map((U,R)=>{const j=Math.floor(R/o),q=R%o,et=c?j%2===0?q:o-1-q:j%2===0?o-1-q:q,it=v+et*(p[0]+x)+p[0]/2,dt=d+j*(p[1]+F)+p[1]/2;return{id:U.id,style:{x:it,y:dt}}})}})}}r0.defaultOptions={padding:0,cols:5,clockwise:!0};function sP(r){const{nodes:t=[],edges:e=[]}=r,n={},i={};t.forEach(o=>{n[o.id]=0,i[o.id]=[]}),e.forEach(o=>{n[o.target]++,i[o.source].push(o.target)});const a=[],s=[];for(t.forEach(o=>{n[o.id]===0&&a.push(o.id)});a.length>0;){const o=a.shift(),A=t.find(l=>l.id===o);s.push(A),i[o].forEach(l=>{n[l]--,n[l]===0&&a.push(l)})}return s}const oP=["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)"],AP=["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)"],lP=["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)"],cP=["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)"],uP=["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 hP=function(r,t,e){if(!Qi(r)&&!_c(r))return r;var n=e;return lx(r,function(i,a){n=t(n,i,a)}),n},dP=hP,A1=function(r,t){return dP(r,function(e,n,i){return t.includes(i)||(e[i]=n),e},{})};class yi extends Ay{}function Xc(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 l1(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 fP=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class i0 extends yi{constructor(t,e){super(t,Object.assign({},i0.defaultOptions,e)),this.$element=Xc("background"),this.context.canvas.getContainer().prepend(this.$element),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return fP(this,void 0,void 0,function*(){e.update.call(this,t),Object.assign(this.$element.style,A1(this.options,["key","type"]))})}destroy(){super.destroy(),this.$element.remove()}}i0.defaultOptions={transition:"background 0.5s",backgroundSize:"cover",zIndex:"-1"};function c1(r,t,e,n,i,a){const s=r,o=t,A=e-s,l=n-o;let c=i-s,u=a-o,h=c*A+u*l,d=0;h<=0?d=0:(c=A-c,u=l-u,h=c*A+u*l,h<=0?d=0:d=h*h/(A*A+l*l));const f=c*c+u*u-d;return f<0?0:f}function kA(r,t,e,n){return(r-e)*(r-e)+(t-n)*(t-n)}function h2(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 d2(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 wi{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 wi(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 Nr;(function(r){r[r.POINT=1]="POINT",r[r.PARALLEL=2]="PARALLEL",r[r.COINCIDENT=3]="COINCIDENT",r[r.NONE=4]="NONE"})(Nr||(Nr={}));class u1{constructor(t,e=0,n=0){this.state=t,this.x=e,this.y=n}}function a0(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 u1(Nr.POINT,r.x1+a*(r.x2-r.x1),r.y1+a*(r.y2-r.y1)):new u1(Nr.NONE)}return new u1(e===0||n===0?Nr.COINCIDENT:Nr.PARALLEL)}function f2(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 vP(r,t){function e(i,a,s,o){let A=f2(t,new wi(i,a,s,o));return A=Math.abs(A-.5),A>=0&&A<=1?1:0}let n=e(r.x,r.y,r.x2,r.y);return n+=e(r.x,r.y,r.x,r.y2),n>1||(n+=e(r.x,r.y2,r.x2,r.y2),n>1)?!0:(n+=e(r.x2,r.y,r.x2,r.y2),n>0)}var Lr;(function(r){r[r.LEFT=0]="LEFT",r[r.TOP=1]="TOP",r[r.RIGHT=2]="RIGHT",r[r.BOTTOM=3]="BOTTOM"})(Lr||(Lr={}));function s0(r,t,e){const n=new Set;return r.width<=0?(n.add(Lr.LEFT),n.add(Lr.RIGHT)):tr.x+r.width&&n.add(Lr.RIGHT),r.height<=0?(n.add(Lr.TOP),n.add(Lr.BOTTOM)):er.y+r.height&&n.add(Lr.BOTTOM),n}function g2(r,t){let e=t.x1,n=t.y1;const i=t.x2,a=t.y2,s=Array.from(s0(r,i,a));if(s.length===0)return!0;let o=s0(r,e,n);for(;o.size!==0;){for(const A of s)if(o.has(A))return!1;if(o.has(Lr.RIGHT)||o.has(Lr.LEFT)){let A=r.x;o.has(Lr.RIGHT)&&(A+=r.width),n=n+(A-e)*(a-n)/(i-e),e=A}else{let A=r.y;o.has(Lr.BOTTOM)&&(A+=r.height),e=e+(A-n)*(i-e)/(a-n),n=A}o=s0(r,e,n)}return!0}function pP(r,t){let e=Number.POSITIVE_INFINITY,n=0;function i(a,s,o,A){let l=f2(t,new wi(a,s,o,A));l=Math.abs(l-.5),l>=0&&l<=1&&(n++,l1||(i(r.x,r.y2,r.x2,r.y2),n>1)?e:(i(r.x2,r.y,r.x2,r.y2),n===0?-1:e)}function mP(r,t){let e=0;const n=a0(r,new wi(t.x,t.y,t.x2,t.y));e+=n.state===Nr.POINT?1:0;const i=a0(r,new wi(t.x,t.y,t.x,t.y2));e+=i.state===Nr.POINT?1:0;const a=a0(r,new wi(t.x,t.y2,t.x2,t.y2));e+=a.state===Nr.POINT?1:0;const s=a0(r,new wi(t.x2,t.y,t.x2,t.y2));return e+=s.state===Nr.POINT?1:0,{top:n,left:i,bottom:a,right:s,count:e}}class Hi{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 Hi(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 Hi(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 Hi(e,n,s,o)}invertScaleX(t){return Math.round(t*this.pixelGroup+this.pixelX)}invertScaleY(t){return Math.round(t*this.pixelGroup+this.pixelY)}addPadding(t,e){const n=Math.ceil(e/this.pixelGroup),i=this.boundX(t.x-n),a=this.boundY(t.y-n),s=this.boundX(t.x2+n),o=this.boundY(t.y2+n),A=s-i,l=o-a;return new Hi(i,a,A,l)}get(t,e){return t<0||e<0||t>=this.width||e>=this.height?Number.NaN:this.area[t+e*this.width]}inc(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]+=n)}set(t,e,n){t<0||e<0||t>=this.width||e>=this.height||(this.area[t+e*this.width]=n)}incArea(t,e){if(t.width<=0||t.height<=0||e===0)return;const n=this.width,i=t.width,a=Math.max(0,t.i),s=Math.max(0,t.j),o=Math.min(t.i+t.width,n),A=Math.min(t.j+t.height,this.height);if(!(A<=0||o<=0||a>=n||A>=this.height))for(let l=s;lMath.min(s,o),Number.POSITIVE_INFINITY),i=this.area.reduce((s,o)=>Math.max(s,o),Number.NEGATIVE_INFINITY),a=s=>(s-n)/(i-n);t.scale(this.pixelGroup,this.pixelGroup);for(let s=0;se?"black":"white",t.fillRect(i,a,1,1)}t.restore()}}}function v2(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 p2(r,t,e){return m2(Object.assign(d2(r),{distSquare:(n,i)=>c1(r.x1,r.y1,r.x2,r.y2,n,i)}),t,e)}function m2(r,t,e){const n=v2(r,e),i=t.scale(n),a=t.createSub(i,n);return wP(a,t,e,(s,o)=>r.distSquare(s,o)),a}function wP(r,t,e,n){const i=e*e;for(let a=0;a{const o=i.slice(0,s);return bP(t,a,o,e,n)}).flat()}function bP(r,t,e,n,i){const a=gr(t.cx,t.cy),s=SP(a,e,r);if(s==null)return[];const o=new wi(a.x,a.y,s.cx,s.cy),A=xP(o,r,n,i);return CP(A,r)}function xP(r,t,e,n){const i=[],a=[];a.push(r);let s=!0;for(let o=0;o0;){const A=a.pop(),l=y2(t,A),c=l?mP(A,l):null;if(!l||!c||c.count!==2){s||i.push(A);continue}let u=n,h=l0(l,u,c,!0),d=QA(h,a)||QA(h,i),f=A0(h,t);for(;!d&&f&&u>=1;)u/=1.5,h=l0(l,u,c,!0),d=QA(h,a)||QA(h,i),f=A0(h,t);if(h&&!d&&!f&&(a.push(new wi(A.x1,A.y1,h.x,h.y)),a.push(new wi(h.x,h.y,A.x2,A.y2)),s=!0),s)continue;u=n,h=l0(l,u,c,!1);let g=QA(h,a)||QA(h,i);for(f=A0(h,t);!g&&f&&u>=1;)u/=1.5,h=l0(l,u,c,!1),g=QA(h,a)||QA(h,i),f=A0(h,t);h&&!g&&(a.push(new wi(A.x1,A.y1,h.x,h.y)),a.push(new wi(h.x,h.y,A.x2,A.y2)),s=!0),s||i.push(A)}for(;a.length>0;)i.push(a.pop());return i}function CP(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 wi(n.x1,n.y1,i.x2,i.y2);y2(t,a)?(e.push(n),r.push(i)):r.push(a)}return e}function SP(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 wi(r.x,r.y,a.cx,a.cy),A=FP(e,o);return s*(A+1)*(A+1){t+=n.cx,e+=n.cy}),t/=r.length,e/=r.length,r.map(n=>{const i=t-n.cx,a=e-n.cy,s=i*i+a*a;return[n,s]}).sort((n,i)=>n[1]-i[1]).map(n=>n[0])}function A0(r,t){return t.some(e=>e.containsPt(r.x,r.y))}function QA(r,t){return t.some(e=>!!(h2(e.x1,e.y1,r.x,r.y,.001)||h2(e.x2,e.y2,r.x,r.y,.001)))}function y2(r,t){let e=Number.POSITIVE_INFINITY,n=null;for(const i of r){if(!g2(i,t))continue;const a=pP(i,t);a>=0&&ag2(n,t)&&vP(n,t)?e+1:e,0)}function l0(r,t,e,n){const i=e.top,a=e.left,s=e.bottom,o=e.right;if(n){if(a.state===Nr.POINT){if(i.state===Nr.POINT)return gr(r.x-t,r.y-t);if(s.state===Nr.POINT)return gr(r.x-t,r.y2+t);const h=r.width*r.height;return r.width*((a.y-r.y+(o.y-r.y))*.5)o.y?gr(r.x-t,r.y-t):gr(r.x2+t,r.y-t):a.ys.x?gr(r.x-t,r.y-t):gr(r.x-t,r.y2+t):i.xo.y?gr(r.x2+t,r.y2+t):gr(r.x-t,r.y2+t):a.ys.x?gr(r.x2+t,r.y2+t):gr(r.x2+t,r.y-t):i.xn)return!1}return!0}function OP(r=0){return t=>{if(r<0||t.length<3)return t;const e=[];let n=0;const i=r*r;for(;n{if(s.length<3)return s;const o=[],A=s.closed,l=s.length+3-1+(A?0:2);o.push(a(s,2-(A?0:2),0));for(let c=2-(A?0:2);c{let e=r,n=t.length;if(e>1)for(n=Math.floor(t.length/e);n<3&&e>1;)e-=1,n=Math.floor(t.length/e);const i=[];for(let a=0,s=0;s=n?this.closed?this.get(t-n):this.points[n-1]:this.points[e]}get length(){return this.points.length}toString(t=1/0){const e=this.points;if(e.length===0)return"";const n=typeof t=="function"?t:gP(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 LP(t)(this)}simplify(t){return OP(t)(this)}bSplines(t){return NP(t)(this)}apply(t){return t(this)}containsElements(t){const e=yP(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 wi(i.x,i.y,i.x,i.y);for(let s=1;st?c+u:c}function a(A,l){let c=Gh;return c=i(A,l,c,1),c=i(A+1,l,c,2),c=i(A,l+1,c,4),c=i(A+1,l+1,c,8),Number.isNaN(c)?-1:c}let s=c0;function o(A,l){let c=A,u=l,h=r.invertScaleX(c),d=r.invertScaleY(u);for(let f=0;fw2(n.raw,t));return e<0?!1:(this.members.splice(e,1),this.dirty.add(Is.MEMBERS),!0)}removeNonMember(t){const e=this.nonMembers.findIndex(n=>w2(n.raw,t));return e<0?!1:(this.nonMembers.splice(e,1),this.dirty.add(Is.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(Is.NON_MEMBERS),!0)}pushNonMember(...t){if(t.length!==0){this.dirty.add(Is.NON_MEMBERS);for(const e of t)this.nonMembers.push({raw:e,obj:zh(e)?o0.from(e):Hi.from(e),area:null})}}pushEdge(...t){if(t.length!==0){this.dirty.add(Is.EDGES);for(const e of t)this.edges.push({raw:e,obj:wi.from(e),area:null})}}update(){const t=this.dirty.has(Is.MEMBERS),e=this.dirty.has(Is.NON_MEMBERS);let n=this.dirty.has(Is.EDGES);this.dirty.clear();const i=this.members.map(l=>l.obj);if(this.o.virtualEdges&&(t||e)){const l=this.nonMembers.map(h=>h.obj),c=BP(i,l,this.o.maxRoutingIterations,this.o.morphBuffer),u=new Map(this.virtualEdges.map(h=>[h.obj.toString(),h.area]));this.virtualEdges=c.map(h=>{var d;return{raw:h,obj:h,area:(d=u.get(h.toString()))!==null&&d!==void 0?d:null}}),n=!0}let a=!1;if(t||n){const l=this.virtualEdges.concat(this.edges).map(d=>d.obj),c=RP(i,l),u=Math.max(this.o.edgeR1,this.o.nodeR1)+this.o.morphBuffer,h=Hi.from(v2(c,u));h.equals(this.activeRegion)||(a=!0,this.activeRegion=h)}if(a){const l=Math.ceil(this.activeRegion.width/this.o.pixelGroup),c=Math.ceil(this.activeRegion.height/this.o.pixelGroup);this.activeRegion.x!==this.potentialArea.pixelX||this.activeRegion.y!==this.potentialArea.pixelY?(this.potentialArea=Ql.fromPixelRegion(this.activeRegion,this.o.pixelGroup),this.members.forEach(u=>u.area=null),this.nonMembers.forEach(u=>u.area=null),this.edges.forEach(u=>u.area=null),this.virtualEdges.forEach(u=>u.area=null)):(l!==this.potentialArea.width||c!==this.potentialArea.height)&&(this.potentialArea=Ql.fromPixelRegion(this.activeRegion,this.o.pixelGroup))}const s=new Map,o=l=>{if(l.area){const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Hi?"R":"C"}`;s.set(c,l.area)}},A=l=>{if(l.area)return;const c=`${l.obj.width}x${l.obj.height}x${l.obj instanceof Hi?"R":"C"}`;if(s.has(c)){const h=s.get(c);l.area=this.potentialArea.copy(h,{x:l.obj.x-this.o.nodeR1,y:l.obj.y-this.o.nodeR1});return}const u=l.obj instanceof Hi?EP(l.obj,this.potentialArea,this.o.nodeR1):m2(l.obj,this.potentialArea,this.o.nodeR1);l.area=u,s.set(c,u)};this.members.forEach(o),this.nonMembers.forEach(o),this.members.forEach(A),this.nonMembers.forEach(l=>{this.activeRegion.intersects(l.obj)?A(l):l.area=null}),this.edges.forEach(l=>{l.area||(l.area=p2(l.obj,this.potentialArea,this.o.edgeR1))}),this.virtualEdges.forEach(l=>{l.area||(l.area=p2(l.obj,this.potentialArea,this.o.edgeR1))})}drawMembers(t){for(const e of this.members)e.obj.draw(t)}drawNonMembers(t){for(const e of this.nonMembers)e.obj.draw(t)}drawEdges(t){for(const e of this.edges)e.obj.draw(t)}drawPotentialArea(t,e=!0){this.potentialArea.draw(t,e)}compute(){if(this.members.length===0)return new Ul([]);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 UP(e,n,i,a,o=>o.containsElements(s),t)}}function UP(r,t,e,n,i,a={}){const s=Object.assign({},h0,a);let o=s.threshold,A=s.memberInfluenceFactor,l=s.edgeInfluenceFactor,c=s.nonMemberInfluenceFactor;const u=(s.nodeR0-s.nodeR1)*(s.nodeR0-s.nodeR1),h=(s.edgeR0-s.edgeR1)*(s.edgeR0-s.edgeR1);for(let d=0;d0)c*=.8;else break}return new Ul([])}function RP(r,t){if(r.length===0)return new Hi(0,0,0,0);const e=Hi.from(r[0]);for(const n of r)e.add(n);for(const n of t)e.add(d2(n));return e}function iK(r,t=[],e=[],n={}){if(r.length===0)return new Ul([]);const i=new d1(n);return i.pushMember(...r),i.pushNonMember(...t),i.pushEdge(...e),i.compute()}var DP=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();Pr(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 Sh({style:a}),this.context.canvas.appendChild(this.shape))},this.updateBubbleSetsPath=n=>{if(!this.shape)return;const i=Nt(n.data);[...this.options.members,...this.options.avoidMembers].includes(i)&&this.shape.update(Object.assign(Object.assign({},this.parseOptions().style),{d:this.getPath(i)}))},this.getPath=n=>{const{graph:i}=this.context,a=this.options.members,s=[...this.members.keys()],o=this.options.avoidMembers,A=[...this.avoidMembers.keys()];if(a.length===0&&o.length===0)return this.members.clear(),this.avoidMembers.clear(),this.path=[],this.path;if(!n&&this.path&&Pr(a,s)&&Pr(o,A))return this.path;const{enter:l=[],exit:c=[]}=BA(s,a,v=>v),{enter:u=[],exit:h=[]}=BA(A,o,v=>v);if(n){const v=a.includes(n),p=o.includes(n);v&&(c.push(n),l.push(n)),p&&(h.push(n),u.push(n))}const d=(v,p,y)=>{v.forEach(x=>{const F=y?this.members:this.avoidMembers,O=y?"pushMember":"pushNonMember",L=y?"removeMember":"removeNonMember";if(p){let U;i.getElementType(x)==="edge"?([U]=_P(i,x),this.bubbleSets.pushEdge(U)):([U]=PP(i,x),this.bubbleSets[O](U)),F.set(x,U)}else{const U=F.get(x);U&&(i.getElementType(x)==="edge"?this.bubbleSets.removeEdge(U):this.bubbleSets[L](U),F.delete(x))}})};d(c,!1,!0),d(l,!0,!0),d(h,!1,!1),d(u,!0,!1);const g=this.bubbleSets.compute().sample(8).simplify(0).bSplines().simplify(0);return this.path=jb(g.points.map(Mi)),this.path},this.bindEvents(),this.bubbleSets=new d1(this.options)}bindEvents(){this.context.graph.on(Ae.AFTER_RENDER,this.drawBubbleSets),this.context.graph.on(Ae.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath)}init(){this.bubbleSets=new d1(this.options),this.members.clear(),this.avoidMembers.clear(),this.path=null}parseOptions(){const t=this.options,{type:e,key:n,members:i,avoidMembers:a}=t,s=DP(t,["type","key","members","avoidMembers"]),o=Object.keys(s).reduce((A,l)=>(l in h0?A.bubbleSetOptions[l]=s[l]:A.style[l]=s[l],A),{style:{},bubbleSetOptions:{}});return Object.assign({type:e,key:n,members:i,avoidMembers:a},o)}addMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.avoidMembers.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n))),this.options.members=[...new Set([...this.options.members,...e])],this.drawBubbleSets()}removeMember(t){const e=Array.isArray(t)?t:[t];this.options.members=this.options.members.filter(n=>!e.includes(n)),this.drawBubbleSets()}updateMember(t){this.options.members=Vt(t)?t(this.options.members):t,this.drawBubbleSets()}getMember(){return this.options.members}addAvoidMember(t){const e=Array.isArray(t)?t:[t];e.some(n=>this.options.members.includes(n))&&(this.options.members=this.options.members.filter(n=>!e.includes(n))),this.options.avoidMembers=[...new Set([...this.options.avoidMembers,...e])],this.drawBubbleSets()}removeAvoidMember(t){const e=Array.isArray(t)?t:[t];this.options.avoidMembers.some(n=>e.includes(n))&&(this.options.avoidMembers=this.options.avoidMembers.filter(n=>!e.includes(n)),this.drawBubbleSets())}updateAvoidMember(t){this.options.avoidMembers=Array.isArray(t)?t:[t],this.drawBubbleSets()}getAvoidMember(){return this.options.avoidMembers}destroy(){this.context.graph.off(Ae.AFTER_RENDER,this.drawBubbleSets),this.context.graph.off(Ae.AFTER_ELEMENT_UPDATE,this.updateBubbleSetsPath),this.shape&&(this.shape.destroy(),this.shape=void 0),super.destroy()}}d0.defaultOptions=Object.assign({members:[],avoidMembers:[],fill:"lightblue",fillOpacity:.2,stroke:"blue",strokeOpacity:.2},h0);const PP=(r,t)=>(Array.isArray(t)?t:[t]).map(n=>{const i=r.getElementRenderBounds(n);return new Hi(i.min[0],i.min[1],io(i),ao(i))}),_P=(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 wi.from({x1:a[0],y1:a[1],x2:s[0],y2:s[1]})});class aK extends null{constructor(t,e){super(t,e),this.setOptions=n=>{const i={cameraType:"setType",near:"setNear",far:"setFar",fov:"setFov",aspect:"setAspect",projectionMode:"setProjectionMode",distance:"setDistance",minDistance:"setMinDistance",maxDistance:"setMaxDistance",roll:"setRoll",elevation:"setElevation",azimuth:"setAzimuth"},a=(s,o)=>{switch(s){case"projectionMode":return o==="perspective"?1:0;case"cameraType":return{orbiting:0,exploring:1,tracking:2}[o];case"aspect":return typeof o=="number"?o:this.getCanvasAspect();default:return o}};Object.entries(i).forEach(([s,o])=>{const A=n[s];if(A!==void 0){const l=a(s,A);this.context.canvas.getCamera()[o](l)}})},this.bindEvents()}update(t){this.setOptions(t),super.update(t)}bindEvents(){this.context.graph.once(GraphEvent.BEFORE_DRAW,()=>this.setOptions(this.options))}getCanvasAspect(){const[t,e]=this.context.viewport.getCanvasSize();return t/e}}function HP(r){return`
    ${r.map(t=>`
  • ${t.name}
  • `).join("")}
`}const GP=` .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 E2=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class f0 extends yi{constructor(t,e){super(t,Object.assign({},f0.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=Xc("contextmenu",!1,{zIndex:"99"});const{className:t}=this.options;t&&this.$element.classList.add(t),this.context.canvas.getContainer().appendChild(this.$element),l1("g6-contextmenu-css","style",{},GP,document.head)}show(t){return E2(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 E2(this,void 0,void 0,function*(){const{getContent:e,getItems:n}=this.options;return n?HP(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)}}f0.defaultOptions={trigger:"contextmenu",offset:[4,4],loadingContent:'
Loading...
',getContent:()=>"It is a empty context menu.",enable:()=>!0};class g0 extends yi{constructor(t,e){super(t,Object.assign({},g0.defaultOptions,e)),this.edgeBundles={},this.edgePoints={},this.onBundle=()=>{const{model:n,element:i}=this.context,a=n.getEdgeData();this.divideEdges(this.options.divisions);const{cycles:s,iterRate:o,divRate:A}=this.options;let{lambda:l,divisions:c,iterations:u}=this.options;for(let h=0;h{var v;if(g.source===g.target)return;const p=Nt(g);f[p]=this.getEdgeForces(g,c,l);for(let y=0;y{const d=Nt(h),f=i.getElement(d);f==null||f.update({d:Sy(this.edgePoints[d])})})},this.bindEvents()}get nodeMap(){const t=this.context.model.getNodeData();return Object.fromEntries(t.map(e=>[Nt(e),bl(li(e))]))}divideEdges(t){this.context.model.getEdgeData().forEach(n=>{var i;const a=Nt(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(Ms($e(s,o),2)),this.edgePoints[a].push(o);else{const l=(this.edgePoints[a].length===0?cr(s,o):jP(this.edgePoints[a]))/(t+1);let c=l;const u=[s];for(let h=1;hc;){const v=c/g,p=$e(d,Ss(tr(f,d),v));u.push(p),g-=c,c=l}c-=g}u.push(o),this.edgePoints[a]=u}})}getVectorPosition(t){const e=this.nodeMap[t.source],n=this.nodeMap[t.target],[i,a]=tr(n,e),s=cr(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=zP(n,i),s=KP(n,i),o=VP(n,i),A=WP(n,i);return a*s*o*A}getEdgeBundles(){const t={},e=this.options.bundleThreshold,n=this.context.model.getEdgeData();return n.forEach((i,a)=>{n.forEach((s,o)=>{var A,l;if(o<=a)return;this.measureEdgeCompatibility(i,s)>=e&&(t[A=Nt(i)]||(t[A]=[]),t[Nt(i)].push(s),t[l=Nt(s)]||(t[l]=[]),t[Nt(s)].push(i))})}),t}getSpringForce(t,e){const{pre:n,cur:i,next:a}=t;return Ss(tr($e(n,a),Ss(i,2)),e)}getElectrostaticForce(t,e){oo(this.edgeBundles)&&(this.edgeBundles=this.getEdgeBundles());const n=this.edgeBundles[Nt(e)];let i=[0,0];return n==null||n.forEach(a=>{const s=this.edgePoints[Nt(a)][t],o=this.edgePoints[Nt(e)][t],A=tr(s,o),l=cr(s,o);i=$e(i,Ss(A,1/l))}),i}getEdgeForces(t,e,n){const i=this.nodeMap[t.source],a=this.nodeMap[t.target],s=this.options.K/(cr(i,a)*(e+1)),o=[[0,0]],A=Nt(t);for(let l=1;lMath.abs(gL([r.vx,r.vy],[t.vx,t.vy])/(r.length*t.length)),KP=(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)},VP=(r,t)=>{const e=(r.length+t.length)/2,n=Ms($e(r.source,r.target),2),i=Ms($e(t.source,t.target),2);return e/(e+cr(n,i))},B2=(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]},b2=(r,t)=>{const e=B2(t.source,r),n=B2(t.target,r),i=Ms($e(e,n),2),a=Ms($e(r.source,r.target),2);return cr(e,n)===0?0:Math.max(0,1-2*cr(a,i)/cr(e,n))},WP=(r,t)=>Math.min(b2(r,t),b2(t,r)),jP=r=>{let t=0;for(let e=1;e{if(this.options.trigger==="drag"&&this.isLensOn)return;const i=Mi(n.canvas);this.renderLens(i),this.renderFocusElements()},this.renderLens=n=>{const i=Object.assign({},ZP,this.options.style);this.isLensOn||(this.lens=new Sl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Fs(n),{size:this.r*2}),this.lens.update(i)},this.getFilterData=()=>{const{filter:n}=this.options,{model:i}=this.context,a=i.getData();if(!n)return a;const{nodes:s,edges:o,combos:A}=a;return{nodes:s.filter(l=>n(Nt(l),"node")),edges:o.filter(l=>n(Nt(l),"edge")),combos:A.filter(l=>n(Nt(l),"combo"))}},this.getFocusElements=n=>{const{nodes:i,edges:a}=this.getFilterData(),s=i.filter(l=>cr(li(l),n)Nt(l)),A=a.filter(l=>{const{source:c,target:u}=l,h=o.includes(c),d=o.includes(u);switch(this.options.nodeType){case"both":return h&&d;case"either":return h!==d;case"source":return h&&!d;case"target":return!h&&d;default:return!1}});return{nodes:s,edges:A}},this.renderFocusElements=()=>{const{element:n,graph:i}=this.context;if(!this.isLensOn)return;const a=this.lens.getCenter(),{nodes:s,edges:o}=this.getFocusElements(a),A=new Set,l=c=>{const u=Nt(c);A.add(u);const h=n.getElement(u);if(!h)return;const d=this.shapes.get(u)||h.cloneNode();d.setPosition(h.getPosition()),d.id=h.id,this.shapes.has(u)?Object.entries(h.attributes).forEach(([v,p])=>{d.style[v]!==p&&(d.style[v]=p)}):(this.canvas.appendChild(d),this.shapes.set(u,d));const f=i.getElementType(u),g=this.getElementStyle(f,c);d.update(g)};s.forEach(l),o.forEach(l),this.shapes.forEach((c,u)=>{A.has(u)||(c.destroy(),this.shapes.delete(u))})},this.scaleRByWheel=n=>{var i;this.options.preventDefault&&n.preventDefault();const{clientX:a,clientY:s,deltaX:o,deltaY:A}=n,{graph:l,canvas:c}=this.context,u=l.getCanvasByClient([a,s]),h=(i=this.lens)===null||i===void 0?void 0:i.getCenter();if(!this.isLensOn||cr(u,h)>this.r)return;const{maxR:d,minR:f}=this.options,g=o+A>0?1/(1-x2):1-x2,v=Math.min(...c.getSize())/2;this.r=Math.max(f||0,Math.min(d||v,this.r*g)),this.renderLens(h),this.renderFocusElements()},this.isLensDragging=!1,this.onDragStart=n=>{var i;const a=Mi(n.canvas),s=(i=this.lens)===null||i===void 0?void 0:i.getCenter();!this.isLensOn||cr(a,s)>this.r||(this.isLensDragging=!0)},this.onDrag=n=>{if(!this.isLensDragging)return;const i=Mi(n.canvas);this.renderLens(i),this.renderFocusElements()},this.onDragEnd=()=>{this.isLensDragging=!1},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}getElementStyle(t,e){const n=t==="node"?this.options.nodeStyle:this.options.edgeStyle;return typeof n=="function"?n(e):n}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.addEventListener(Yt.CLICK,this.onEdgeFilter),n==="pointermove"?a.addEventListener(Yt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.addEventListener(Yt.DRAG_START,this.onDragStart),a.addEventListener(Yt.DRAG,this.onDrag),a.addEventListener(Yt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.addEventListener(Yt.WHEEL,this.scaleRByWheel,{passive:!1}))}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i}=this.options,a=e.getCanvas().getLayer();["click","drag"].includes(n)&&a.removeEventListener(Yt.CLICK,this.onEdgeFilter),n==="pointermove"?a.removeEventListener(Yt.POINTER_MOVE,this.onEdgeFilter):n==="drag"&&(a.removeEventListener(Yt.DRAG_START,this.onDragStart),a.removeEventListener(Yt.DRAG,this.onDrag),a.removeEventListener(Yt.DRAG_END,this.onDragEnd)),i==="wheel"&&((t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,this.scaleRByWheel))}update(t){var e;this.unbindEvents(),super.update(t),this.r=(e=t.r)!==null&&e!==void 0?e:this.r,this.bindEvents()}destroy(){this.unbindEvents(),this.isLensOn&&this.lens.destroy(),this.shapes.forEach((t,e)=>{t.destroy(),this.shapes.delete(e)}),super.destroy()}}v0.defaultOptions={trigger:"pointermove",r:60,nodeType:"both",filter:()=>!0,style:{lineWidth:2},nodeStyle:{label:!1},edgeStyle:{label:!0},scaleRBy:"wheel",preventDefault:!0};const YP={fill:"#ccc",fillOpacity:.1,lineWidth:2,stroke:"#000",strokeOpacity:.8,labelFontSize:12},C2=.05,S2=.1;class p0 extends yi{constructor(t,e){super(t,Object.assign({},p0.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=Mi(n.canvas);this.onMagnify(i)},this.onMagnify=n=>{n.some(isNaN)||(this.renderLens(n),this.renderFocusElements())},this.renderLens=n=>{const i=Object.assign({},YP,this.options.style);this.isLensOn||(this.lens=new Sl({style:i}),this.canvas.appendChild(this.lens)),Object.assign(i,Fs(n),{size:this.r*2,label:this.options.showDPercent,labelText:this.getDPercent()}),this.lens.update(i)},this.getDPercent=()=>{const{minD:n,maxD:i}=this.options;return`${Math.round((this.d-n)/(i-n)*100)}%`},this.prevMagnifiedStyleMap=new Map,this.prevOriginStyleMap=new Map,this.renderFocusElements=()=>{if(!this.isLensOn)return;const{graph:n}=this.context,i=this.lens.getCenter(),a=(this.d+1)*this.r,s=new Map,o=new Map;n.getNodeData().forEach(l=>{const c=li(l),u=cr(c,i);if(u>this.r)return;const h=a*u/(this.d*u+this.r),[d,f]=c,[g,v]=i,p=(d-g)/u,y=(f-v)/u,x=[g+h*p,v+h*y],F=Nt(l),O=this.getNodeStyle(l),L=Fl(n.getElementRenderStyle(F),Object.keys(O));s.set(F,Object.assign(Object.assign({},Fs(x)),O)),o.set(F,Object.assign(Object.assign({},Fs(c)),L))}),this.updateStyle(s,o)},this.getNodeStyle=n=>{const{nodeStyle:i}=this.options;return typeof i=="function"?i(n):i},this.updateStyle=(n,i)=>{const{graph:a,element:s}=this.context,{enter:o,exit:A,keep:l}=BA(Array.from(this.prevMagnifiedStyleMap.keys()),Array.from(n.keys()),h=>h),c=new Set,u=(h,d)=>{const f=s.getElement(h);f==null||f.update(d),a.getRelatedEdgesData(h).forEach(g=>{c.add(Nt(g))})};[...o,...l].forEach(h=>{u(h,n.get(h))}),A.forEach(h=>{u(h,this.prevOriginStyleMap.get(h)),this.prevOriginStyleMap.delete(h)}),c.forEach(h=>{const d=s.getElement(h);d==null||d.update({})}),this.prevMagnifiedStyleMap=n,i.forEach((h,d)=>{this.prevOriginStyleMap.has(d)||this.prevOriginStyleMap.set(d,h)})},this.isWheelValid=n=>{if(this.options.preventDefault&&n.preventDefault(),!this.isLensOn)return!1;const{clientX:i,clientY:a}=n,s=this.context.graph.getCanvasByClient([i,a]),o=this.lens.getCenter();return!(cr(s,o)>this.r)},this.scaleR=n=>{const{maxR:i,minR:a}=this.options,s=n?1/(1-C2):1-C2,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+S2:this.d-S2;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=Mi(n.canvas),a=this.lens.getCenter();return!(cr(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=Mi(n.canvas);this.onMagnify(i)},this.onDragEnd=()=>{this.isLensDragging=!1},this.scaleRByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleR(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.scaleDByDrag=n=>{if(!this.isLensDragging)return;const{dx:i,dy:a}=n;this.scaleD(i-a>0);const s=this.lens.getCenter();this.onMagnify(s)},this.bindEvents()}get canvas(){return this.context.canvas.getLayer("transient")}get isLensOn(){return this.lens&&!this.lens.destroyed}get graphDom(){return this.context.graph.getCanvas().getContextService().getDomElement()}bindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.addEventListener(Yt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.addEventListener(Yt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.addEventListener(Yt.DRAG_START,this.onDragStart),s.addEventListener(Yt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.addEventListener(Yt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.addEventListener(Yt.WHEEL,o,{passive:!1})}}unbindEvents(){var t;const{graph:e}=this.context,{trigger:n,scaleRBy:i,scaleDBy:a}=this.options,s=e.getCanvas().getLayer();if(["click","drag"].includes(n)&&s.removeEventListener(Yt.CLICK,this.onCreateFisheye),n==="pointermove"&&s.removeEventListener(Yt.POINTER_MOVE,this.onCreateFisheye),n==="drag"||i==="drag"||a==="drag"){s.removeEventListener(Yt.DRAG_START,this.onDragStart),s.removeEventListener(Yt.DRAG_END,this.onDragEnd);const o=n==="drag"?this.onDrag:i==="drag"?this.scaleRByDrag:this.scaleDByDrag;s.removeEventListener(Yt.DRAG,o)}if(i==="wheel"||a==="wheel"){const o=i==="wheel"?this.scaleRByWheel:this.scaleDByWheel;(t=this.graphDom)===null||t===void 0||t.removeEventListener(Yt.WHEEL,o)}}update(t){var e,n;this.unbindEvents(),super.update(t),this.r=(e=t.r)!==null&&e!==void 0?e:this.r,this.d=(n=t.d)!==null&&n!==void 0?n:this.d,this.bindEvents()}destroy(){var t;this.unbindEvents(),this.isLensOn&&((t=this.lens)===null||t===void 0||t.destroy()),this.prevMagnifiedStyleMap.clear(),this.prevOriginStyleMap.clear(),super.destroy()}}p0.defaultOptions={trigger:"pointermove",r:120,d:1.5,maxD:5,minD:0,showDPercent:!0,style:{},nodeStyle:{label:!0},preventDefault:!0};class m0 extends yi{constructor(t,e){super(t,Object.assign({},m0.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 CA(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||!XP()||this.$el.requestFullscreen().catch(t=>{va.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()}}m0.defaultOptions={trigger:{},autoFit:!0};function XP(){return document.fullscreenEnabled||Reflect.get(document,"webkitFullscreenEnabled")||Reflect.get(document,"mozFullscreenEnabled")||Reflect.get(document,"msFullscreenEnabled")}class y0 extends yi{constructor(t,e){super(t,Object.assign({},y0.defaultOptions,e)),this.$element=Xc("grid-line",!0),this.offset=[0,0],this.currentScale=1,this.followZoom=i=>{const{data:{scale:a,origin:s}}=i;if(!a||s===void 0&&this.context.viewport===void 0)return;const o=this.currentScale;this.currentScale=a;const A=a/o,l=Ss(s||this.context.graph.getCanvasCenter(),1-A),c=this.baseSize*a,u=Ss(this.offset,A),h=cy(u,c),d=$e(h,l);this.$element.style.backgroundSize=`${c}px ${c}px`,this.$element.style.backgroundPosition=`${d[0]}px ${d[1]}px`,this.offset=cy(d,c)},this.followTranslate=i=>{if(!this.options.follow)return;const{data:{translate:a}}=i;a&&this.updateOffset(a)},this.onTransform=i=>{const a=this.parseFollow(this.options.follow);a.zoom&&this.followZoom(i),a.translate&&this.followTranslate(i)},this.context.canvas.getContainer().prepend(this.$element),this.baseSize=this.options.size,this.updateStyle(),this.bindEvents()}update(t){super.update(t),t.size!==void 0&&(this.baseSize=t.size),this.updateStyle()}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_TRANSFORM,this.onTransform)}updateStyle(){const{stroke:t,lineWidth:e,border:n,borderLineWidth:i,borderStroke:a,borderStyle:s}=this.options,o=this.baseSize*this.currentScale;Object.assign(this.$element.style,{border:n?`${i}px ${s} ${a}`:"none",backgroundImage:`linear-gradient(${t} ${e}px, transparent ${e}px), linear-gradient(90deg, ${t} ${e}px, transparent ${e}px)`,backgroundSize:`${o}px ${o}px`,backgroundRepeat:"repeat"})}updateOffset(t){const e=this.baseSize*this.currentScale;this.offset=cy($e(this.offset,t),e),this.$element.style.backgroundPosition=`${this.offset[0]}px ${this.offset[1]}px`}parseFollow(t){var e,n;return eA(t)?{translate:t,zoom:t}:{translate:(e=t==null?void 0:t.translate)!==null&&e!==void 0?e:!1,zoom:(n=t==null?void 0:t.zoom)!==null&&n!==void 0?n:!1}}destroy(){this.context.graph.off(Ae.AFTER_TRANSFORM,this.onTransform),this.$element.remove(),super.destroy()}}y0.defaultOptions={border:!0,borderLineWidth:1,borderStroke:"#eee",borderStyle:"solid",lineWidth:1,size:20,stroke:"#eee"};function f1(r){const t={Added:new Map,Updated:new Map,Removed:new Map};return r.forEach(e=>{const{type:n,value:i}=e,a=Nt(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 M2(r){const{NodeAdded:t=[],NodeUpdated:e=[],NodeRemoved:n=[],EdgeAdded:i=[],EdgeUpdated:a=[],EdgeRemoved:s=[],ComboAdded:o=[],ComboUpdated:A=[],ComboRemoved:l=[]}=Pf(r,c=>c.type);return{add:{nodes:t,edges:i,combos:o},update:{nodes:e,edges:a,combos:A},remove:{nodes:n,edges:s,combos:l}}}function F2(r,t){for(const e in r)br(r[e])&&!Array.isArray(r[e])&&r[e]!==null?(t[e]||(t[e]={}),F2(r[e],t[e])):t[e]===void 0&&(t[e]=gh(e))}function JP(r,t=!1,e){const n={animation:t,current:{add:{},update:{},remove:{}},original:{add:{},update:{},remove:{}}},{add:i,update:a,remove:s}=M2(f1(r));return["nodes","edges","combos"].forEach(o=>{a[o]&&a[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);let h=Object.assign({},A.original);if(e){const d=e.graph.getElementType(Nt(A.original)),f=d==="edge"?"stroke":"fill",g=e.element.getElementComputedStyle(d,A.original);h=Object.assign(Object.assign({},A.original),{style:Object.assign({[f]:g[f]},A.original.style)})}F2(u,h),(l=n.current.update)[o]||(l[o]=[]),n.current.update[o].push(u),(c=n.original.update)[o]||(c[o]=[]),n.original.update[o].push(h)}),i[o]&&i[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);(l=n.current.add)[o]||(l[o]=[]),n.current.add[o].push(u),(c=n.original.remove)[o]||(c[o]=[]),n.original.remove[o].push(u)}),s[o]&&s[o].forEach(A=>{var l,c;const u=Object.assign({},A.value);(l=n.current.remove)[o]||(l[o]=[]),n.current.remove[o].push(u),(c=n.original.add)[o]||(c[o]=[]),n.original.add[o].push(u)})}),n}class w0 extends yi{constructor(t,e){super(t,Object.assign({},w0.defaultOptions,e)),this.batchChanges=null,this.batchAnimation=!1,this.undoStack=[],this.redoStack=[],this.freezed=!1,this.executeCommand=(i,a=!0)=>{var s,o,A;this.freezed=!0,(o=(s=this.options).executeCommand)===null||o===void 0||o.call(s,i);const l=a?i.original:i.current;this.context.graph.addData(l.add),this.context.graph.updateData(l.update),this.context.graph.removeData(yb(l.remove,!1)),(A=this.context.element)===null||A===void 0||A.draw({silence:!0,animation:i.animation}),this.freezed=!1},this.addCommand=i=>{var a;if(!this.freezed){if(i.type===Ae.AFTER_DRAW){const{dataChanges:s=[],animation:o=!0}=i.data;if(!((a=this.context.batch)===null||a===void 0)&&a.isBatching){if(!this.batchChanges)return;this.batchChanges.push(s),this.batchAnimation&&(this.batchAnimation=o);return}this.batchChanges=[s],this.batchAnimation=o}this.undoStackPush(JP(this.batchChanges.flat(),this.batchAnimation,this.context)),this.notify(mA.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 Qg;const{graph:n}=this.context;n.on(Ae.AFTER_DRAW,this.addCommand),n.on(Ae.BATCH_START,this.initBatchCommand),n.on(Ae.BATCH_END,this.addCommand)}canUndo(){return this.undoStack.length>0}canRedo(){return this.redoStack.length>0}undo(){var t,e,n,i;const a=this.undoStack.pop();if(a){if(this.executeCommand(a),((e=(t=this.options).beforeAddCommand)===null||e===void 0?void 0:e.call(t,a,!1))===!1)return;this.redoStack.push(a),(i=(n=this.options).afterAddCommand)===null||i===void 0||i.call(n,a,!1),this.notify(mA.UNDO,a)}return this}redo(){const t=this.redoStack.pop();return t&&(this.executeCommand(t,!1),this.undoStackPush(t),this.notify(mA.REDO,t)),this}undoAndCancel(){const t=this.undoStack.pop();return t&&(this.executeCommand(t,!1),this.redoStack=[],this.notify(mA.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(mA.CLEAR,null)}notify(t,e){this.emitter.emit(t,{cmd:e}),this.emitter.emit(mA.CHANGE,{cmd:e})}on(t,e){this.emitter.on(t,e)}destroy(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.addCommand),t.off(Ae.BATCH_START,this.initBatchCommand),t.off(Ae.BATCH_END,this.addCommand),this.emitter.off(),super.destroy(),this.undoStack=[],this.redoStack=[]}}w0.defaultOptions={stackSize:0};const g1={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 qP{constructor(t,e){this._cells=[],this._cellSize=e,this._reverseCellSize=1/e;for(const n of t){const i=this.coordToCellNum(n[0]),a=this.coordToCellNum(n[1]);this._cells[i]||(this._cells[i]=[]),this._cells[i][a]||(this._cells[i][a]=[]),this._cells[i][a].push(n)}}cellPoints(t,e){var n;return((n=this._cells[t])===null||n===void 0?void 0:n[e])||[]}rangePoints(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),i=this.coordToCellNum(t[2]),a=this.coordToCellNum(t[3]),s=[];for(let o=e;o<=i;o++)for(let A=n;A<=a;A++){const l=this.cellPoints(o,A);for(const c of l)s.push(c)}return s}removePoint(t){const e=this.coordToCellNum(t[0]),n=this.coordToCellNum(t[1]),i=this._cells[e][n],a=i.findIndex(([s,o])=>s===t[0]&&o===t[1]);return a>-1&&i.splice(a,1),i}trunc(t){return Math.trunc(t)}coordToCellNum(t){return this.trunc(t*this._reverseCellSize)}extendBbox(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}}function $P(r,t){return new qP(r,t)}const T2=+(Math.pow(2,27)+1);function E0(r,t,e){const n=r*t,i=T2*r,a=i-r,s=i-a,o=r-s,A=T2*t,l=A-t,c=A-l,u=t-c,f=n-s*c-o*c-s*u,g=o*u-f;return e?(e[0]=g,e[1]=n,e):[g,n]}function t4(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 e4(r,t){const e=r.length;if(e===1){const o=E0(r[0],t);return o[0]?o:[o[1]]}const n=new Array(2*e),i=[.1,.1],a=[.1,.1];let s=0;E0(r[0],t,i),i[0]&&(n[s++]=i[0]);for(let o=1;o=n?(f=c,o+=1,o=n?(f=c,o+=1,o0){if(a<=0)return s;o=i+a}else if(i<0){if(a>=0)return s;o=-(i+a)}else return s;const A=s4*o;return s>=A||s<=-A?s:u4(t,e,n)},function(t,e,n,i){const a=t[0]-i[0],s=e[0]-i[0],o=n[0]-i[0],A=t[1]-i[1],l=e[1]-i[1],c=n[1]-i[1],u=t[2]-i[2],h=e[2]-i[2],d=n[2]-i[2],f=s*c,g=o*l,v=o*A,p=a*c,y=a*l,x=s*A,F=u*(f-g)+h*(v-p)+d*(y-x),O=(Math.abs(f)+Math.abs(g))*Math.abs(u)+(Math.abs(v)+Math.abs(p))*Math.abs(h)+(Math.abs(y)+Math.abs(x))*Math.abs(d),L=o4*O;return F>L||-F>L?F:h4(t,e,n,i)}];function d4(r){let t=Rl[r.length];return t||(t=Rl[r.length]=b0(r.length)),t.apply(void 0,...r)}function f4(r,t,e,n,i,a,s){return function(...A){switch(A.length){case 0:case 1:return 0;case 2:return n(A[0],A[1]);case 3:return i(A[0],A[1],A[2]);case 4:return a(A[0],A[1],A[2],A[3]);case 5:return s(A[0],A[1],A[2],A[3],A[4])}return r(A)}}function g4(){for(;Rl.length<=O2;)Rl.push(b0(Rl.length));const r=f4(void 0,d4,...Rl);for(let t=0;t<=O2;++t)r[t]=Rl[t];return r}var Kh=g4();const I2=Kh[3];function v4(r){const t=r.length;if(t<3){const o=new Array(t);for(let A=0;A{const l=r[o][0]-r[A][0];return l||r[o][1]-r[A][1]});const n=[e[0],e[1]],i=[e[0],e[1]];for(let o=2;o1&&I2(r[n[c-2]],r[n[c-1]],l)<=0;)c-=1,n.pop();for(n.push(A),c=i.length;c>1&&I2(r[i[c-2]],r[i[c-1]],l)>=0;)c-=1,i.pop();i.push(A)}const a=new Array(i.length+n.length-2);let s=0;for(let o=0,A=n.length;o0;--o)a[s++]=i[o];return a}function p4(r,t,e,n){for(let i=0;i<2;++i){const a=r[i],s=t[i],[o,A]=[Math.min(a,s),Math.max(a,s)],l=e[i],c=n[i],[u,h]=[Math.min(l,c),Math.max(l,c)];if(h0&&a>0||i<0&&a<0)return!1;const s=Kh(e,r,t),o=Kh(n,r,t);return s>0&&o>0||s<0&&o<0?!1:i===0&&a===0&&s===0&&o===0?p4(r,t,e,n):!0}function y4(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 B4(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 b4(r,t,e){let n=null,i=Q2,a=Q2,s,o;for(let A=0;Ai&&o>a&&!L2([r[0],t[A]],e)&&!L2([r[1],t[A]],e)&&(i=s,a=o,n=t[A]);return n}function k2(r,t,e,n,i){let a=!1;for(let s=0;su||e[1]>h));u>=e[0]&&h>=e[1]&&i.add(A),d!==null&&(r.splice(s+1,0,d),n.removePoint(d),a=!0)}return a?k2(r,t,e,n,i):r}function x4(r,t,e){const n=t||20,i=y4(w4(g1.toXy(r,e)));if(i.length<4){const u=i.concat([i[0]]);return e?g1.fromXy(u,e):u}const a=E4(i),s=[a[0]*U2,a[1]*U2],o=v4(i).reverse().map(u=>i[u]);o.push(o[0]);const A=i.filter(function(u){return o.indexOf(u)<0}),l=Math.ceil(1/(i.length/(a[0]*a[1]))),c=k2(o,Math.pow(n,2),s,$P(A,l),new Set);return e?g1.fromXy(c,e):c}const Q2=Math.cos(90/(180/Math.PI)),U2=.6;function C4(r,t,e){if(r.length===1)return S4(r[0],t,e);if(r.length===2)return R2(r,t,e);if(r.length===3){const[n,i,a]=hy(r);if(Ob(n,i,a))return R2([n,a],t,e)}switch(e){case"smooth":return F4(r,t);case"sharp":return T4(r,t);case"rounded":default:return M4(r,t)}}const S4=(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]]},R2=(r,t,e)=>{const n=[t,t,0,0,0],i=e==="sharp"?$e(r[0],bA(Qo(tr(r[0],r[1])),t)):r[0],a=e==="sharp"?$e(r[1],bA(Qo(tr(r[1],r[0])),t)):r[1],s=bA(Qo(ng(tr(i,a),!1)),t),o=bA(s,-1),A=$e(i,s),l=$e(a,s),c=$e(a,o),u=$e(i,o);return e==="sharp"?[["M",A[0],A[1]],["L",l[0],l[1]],["L",c[0],c[1]],["L",u[0],u[1]],["Z"]]:[["M",A[0],A[1]],["L",l[0],l[1]],["A",...n,c[0],c[1]],["L",u[0],u[1]],["A",...n,A[0],A[1]]]},M4=(r,t)=>{const e=hy(r).map((o,A)=>{const l=(A-2+r.length)%r.length,c=(A-1+r.length)%r.length,u=(A+1)%r.length,h=r[l],d=r[c],f=r[u],g=tr(h,d),v=tr(d,o),p=tr(o,f),y=(U,R)=>ly(U,R,!0)bA(Qo(ng(U,!1)),t),L=O(v);return[{p:bl(x?$e(d,O(g)):$e(d,L)),concave:x&&d},{p:bl(F?$e(o,O(p)):$e(o,L)),concave:F&&o}]}),n=[t,t,0,0,0],i=e.findIndex((o,A)=>!e[(A-1+e.length)%e.length][0].concave&&!e[(A-1+e.length)%e.length][1].concave&&!o[0].concave&&!o[0].concave&&!o[1].concave),a=e.slice(i).concat(e.slice(0,i));let s=[];return a.flatMap((o,A)=>{const l=[],c=a[e.length-1];return A===0&&l.push(["M",...c[1].p]),o[0].concave?s.push(o[0].p,o[1].p):l.push(["A",...n,...o[0].p]),o[1].concave?s.unshift(o[1].p):l.push(["L",...o[1].p]),s.length===3&&(l.pop(),l.push(["C",...s.flat()]),s=[]),l})},F4=(r,t)=>{const e=hy(r).map((n,i)=>{const a=r[(i+1)%r.length];return{p:n,v:Qo(tr(a,n))}});return e.forEach((n,i)=>{const a=i>0?i-1:r.length-1,s=e[a].v,o=Qo($e(s,bA(n.v,ly(s,n.v,!0)n.p))},T4=(r,t)=>{const n=r.map((a,s)=>{const o=r[s===0?r.length-1:s-1],A=wh(bA(Qo(ng(tr(o,a),!1)),t));return[$e(o,A),$e(a,A)]}).flat();return n.map((a,s)=>{if(s%2===0)return null;const o=[n[(s-1)%n.length],n[s%n.length]],A=[n[(s+1)%n.length],n[(s+2)%n.length]];return uy(o,A,!0)}).filter(Boolean).map((a,s)=>[s===0?"M":"L",a[0],a[1]]).concat([["Z"]])};var O4=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 Sh({style:this.getHullStyle()}),this.context.canvas.appendChild(this.shape);else{const n=!Pr(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(Nt(n.data))&&this.shape.update({d:this.getHullPath(!0)})},this.getHullPath=(n=!1)=>{const{graph:i}=this.context,a=this.getMember();if(a.length===0)return"";const s=a.map(l=>i.getNodeData(l)),o=x4(s.map(li),this.options.concavity).slice(1).reverse(),A=o.flatMap(l=>s.filter(c=>Pr(li(c),l)).map(Nt));return Pr(A,this.hullMemberIds)&&!n?this.path:(this.hullMemberIds=A,this.path=C4(o,this.getPadding(),this.options.corner),this.path)},this.bindEvents()}bindEvents(){this.context.graph.on(Ae.AFTER_RENDER,this.drawHull),this.context.graph.on(Ae.AFTER_ELEMENT_UPDATE,this.updateHullPath)}unbindEvents(){this.context.graph.off(Ae.AFTER_RENDER,this.drawHull),this.context.graph.off(Ae.AFTER_ELEMENT_UPDATE,this.updateHullPath)}getHullStyle(t){const e=this.options,{members:n,padding:i,corner:a}=e,s=O4(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=Vt(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()}}x0.defaultOptions={members:[],padding:10,corner:"rounded",concavity:1/0,fill:"lightblue",fillOpacity:.2,labelOpacity:1,stroke:"blue",strokeOpacity:.2};function D2(r,t){t(r),r.children&&r.children.forEach(function(e){e&&D2(e,t)})}function Vh(r){C0(r,!0)}function Ns(r){C0(r,!1)}function C0(r,t){var e=t?"visible":"hidden";D2(r,function(n){n.attr("visibility",e)})}var I4=5,P2=function(r,t,e,n){e===void 0&&(e=0),n===void 0&&(n=I4),Object.entries(t).forEach(function(i){var a=(0,D.CR)(i,2),s=a[0],o=a[1],A=r;Object.prototype.hasOwnProperty.call(t,s)&&(o?_c(o)?(_c(r[s])||(A[s]={}),e="A"&&e<="Z"};function tn(r,t,e){e===void 0&&(e=!1);var n={};return Object.entries(r).forEach(function(i){var a=(0,D.CR)(i,2),s=a[0],o=a[1];if(!(s==="className"||s==="class")){if(S0(s,"show")&&S0(H2(s,"show"),t)!==e)s===U4(t,"show")?n[s]=o:n[s.replace(new RegExp(p1(t)),"")]=o;else if(!S0(s,"show")&&S0(s,t)!==e){var A=H2(s,t);A==="filter"&&typeof o=="function"||(n[A]=o)}}}),n}function Jc(r,t){return Object.entries(r).reduce(function(e,n){var i=(0,D.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(p1(a))]=s,e},{})}function _o(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,D.CR)(a,2),o=s[0],A=s[1];t.includes(o)||(e.indexOf(o)!==-1?i[o]=A:n[o]=A)}),[n,i]}var D4=function(r){if(!Qi(r))return[];for(var t=[],e=0;e=this.left&&t<=this.right&&e>=this.top&&e<=this.bottom},r}();function sK(r){var t=r.getRenderBounds(),e=__read(t.min,2),n=e[0],i=e[1],a=__read(t.max,2),s=a[0],o=a[1],A=s-n,l=o-i;return new Gi(n,i,A,l)}var Ls=function(r,t){var e=function(i){return"".concat(t,"-").concat(i)},n=Object.fromEntries(Object.entries(r).map(function(i){var a=(0,D.CR)(i,2),s=a[0],o=a[1],A=e(o);return[s,{name:A,class:".".concat(A),id:"#".concat(A),toString:function(){return A}}]}));return Object.assign(n,{prefix:e}),n};function M0(r){return/\S+-\S+/g.test(r)?r.split("-").map(function(t){return t[0]}):r.length>2?[r[0]]:r.split("")}function Oi(r){if(ye(r))return[r,r,r,r];if(Qi(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 ma(r,t,e,n,i){return n===void 0&&(n=!0),i===void 0&&(i=function(a){a.node().removeChildren()}),r?e(t):(n&&i(t),null)}function zi(r,t,e){return e?"".concat(r," ").concat(e,"legend-").concat(t):r}function oK(r,t,e){var n=r.classNamePrefix,i=n===void 0?"":n;return zi(t.name,e,i)}var sa={title:"title",item:"item",marker:"marker",label:"label",value:"value",focusIcon:"focus-icon",background:"background",ribbon:"ribbon",track:"track",selection:"selection",handle:"handle",handleMarker:"handle-marker",handleLabel:"handle-label",indicator:"indicator",prevBtn:"prev-btn",nextBtn:"next-btn",pageInfo:"page-info"},y1=Ls({text:"text"},"title");function K4(r,t){var e=r.attributes,n=e.position,i=e.spacing,a=e.inset,s=e.text,o=r.getBBox(),A=t.getBBox(),l=M0(n),c=(0,D.CR)(Oi(s?i:0),4),u=c[0],h=c[1],d=c[2],f=c[3],g=(0,D.CR)(Oi(a),4),v=g[0],p=g[1],y=g[2],x=g[3],F=(0,D.CR)([f+h,u+d],2),O=F[0],L=F[1],U=(0,D.CR)([x+p,v+y],2),R=U[0],j=U[1];if(l[0]==="l")return new Gi(o.x,o.y,A.width+o.width+O+R,Math.max(A.height+j,o.height));if(l[0]==="t")return new Gi(o.x,o.y,Math.max(A.width+R,o.width),A.height+o.height+L+j);var q=(0,D.CR)([t.attributes.width||A.width,t.attributes.height||A.height],2),et=q[0],it=q[1];return new Gi(A.x,A.y,et+o.width+O+R,it+o.height+L+j)}function V4(r,t){var e=Object.entries(t).reduce(function(n,i){var a=(0,D.CR)(i,2),s=a[0],o=a[1],A=r.node().attr(s);return A||(n[s]=o),n},{});r.styles(e)}function W4(r){var t,e,n,i,a=r,s=a.width,o=a.height,A=a.position,l=(0,D.CR)([+s/2,+o/2],2),c=l[0],u=l[1],h=(0,D.CR)([+c,+u,"center","middle"],4),d=h[0],f=h[1],g=h[2],v=h[3],p=M0(A);return p.includes("l")&&(t=(0,D.CR)([0,"start"],2),d=t[0],g=t[1]),p.includes("r")&&(e=(0,D.CR)([+s,"end"],2),d=e[0],g=e[1]),p.includes("t")&&(n=(0,D.CR)([0,"top"],2),f=n[0],v=n[1]),p.includes("b")&&(i=(0,D.CR)([+o,"bottom"],2),f=i[0],v=i[1]),{x:d,y:f,textAlign:g,textBaseline:v}}var j4=function(r){(0,D.ZT)(t,r);function t(e){return r.call(this,e,{text:"",width:0,height:0,fill:"#4a505a",fontWeight:"bold",fontSize:12,fontFamily:"sans-serif",inset:0,spacing:0,position:"top-left"})||this}return t.prototype.getAvailableSpace=function(){var e=this,n=this.attributes,i=n.width,a=n.height,s=n.position,o=n.spacing,A=n.inset,l=e.querySelector(y1.text.class);if(!l)return new Gi(0,0,+i,+a);var c=l.getBBox(),u=c.width,h=c.height,d=(0,D.CR)(Oi(o),4),f=d[0],g=d[1],v=d[2],p=d[3],y=(0,D.CR)([0,0,+i,+a],4),x=y[0],F=y[1],O=y[2],L=y[3],U=M0(s);if(U.includes("i"))return new Gi(x,F,O,L);U.forEach(function(Rt,Qt){var yt,xt,Dt,Xt;Rt==="t"&&(yt=(0,D.CR)(Qt===0?[h+v,+a-h-v]:[0,+a],2),F=yt[0],L=yt[1]),Rt==="r"&&(xt=(0,D.CR)([+i-u-p],1),O=xt[0]),Rt==="b"&&(Dt=(0,D.CR)([+a-h-f],1),L=Dt[0]),Rt==="l"&&(Xt=(0,D.CR)(Qt===0?[u+g,+i-u-g]:[0,+i],2),x=Xt[0],O=Xt[1])});var R=(0,D.CR)(Oi(A),4),j=R[0],q=R[1],et=R[2],it=R[3],dt=(0,D.CR)([it+q,j+et],2),ft=dt[0],mt=dt[1];return new Gi(x+it,F+j,O-ft,L-mt)},t.prototype.getBBox=function(){return this.title?this.title.getBBox():new Gi(0,0,0,0)},t.prototype.render=function(e,n){var i=this,a=e.width,s=e.height,o=e.position,A=e.spacing,l=e.classNamePrefix,c=(0,D._T)(e,["width","height","position","spacing","classNamePrefix"]),u=(0,D.CR)(_o(c),1),h=u[0],d=W4(e),f=d.x,g=d.y,v=d.textAlign,p=d.textBaseline;ma(!!c.text,Ne(n),function(y){var x=zi(y1.text.name,sa.title,l);i.title=y.maybeAppendByClassName(y1.text,"text").attr("className",x).styles(h).call(V4,{x:f,y:g,textAlign:v,textBaseline:p}).node()})},t}(Mr),w1=function(){};function ya(r,t){return Vt(r)?r.apply(void 0,(0,D.ev)([],(0,D.CR)(t),!1)):r}function Z4(r,t){return r.reduce(function(e,n){return(e[n[t]]=e[n[t]]||[]).push(n),e},{})}function Y4(r){return typeof r=="boolean"?!1:"enter"in r&&"update"in r&&"exit"in r}function G2(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,D.CR)(n,1),a=i[0];return!t.includes(a)}));return Object.fromEntries(t.map(function(n){return Y4(r)?r[n]===!1?[n,!1]:[n,(0,D.pi)((0,D.pi)({},r[n]),e)]:[n,e]}))}function qc(r,t){r?r.finished.then(t):t()}function X4(r,t){r.length===0?t():Promise.all(r.map(function(e){return e==null?void 0:e.finished})).then(t)}function z2(r,t){"update"in r?r.update(t):r.attr(t)}function K2(r,t,e){if(t.length===0)return null;if(!e){var n=t.slice(-1)[0];return z2(r,{style:n}),null}return r.animate(t,e)}function J4(r,t){return!(r.nodeName!=="text"||t.nodeName!=="text"||r.attributes.text!==t.attributes.text)}function q4(r,t,e,n){if(n===void 0&&(n="destroy"),J4(r,t))return r.remove(),[null];var i=function(){n==="destroy"?r.destroy():n==="hide"&&Ns(r),t.isVisible()&&Vh(t)};if(!e)return i(),[null];var a=e.duration,s=a===void 0?0:a,o=e.delay,A=o===void 0?0:o,l=Math.ceil(+s/2),c=+s/4,u=(0,D.CR)(r.getGeometryBounds().center,2),h=u[0],d=u[1],f=(0,D.CR)(t.getGeometryBounds().center,2),g=f[0],v=f[1],p=(0,D.CR)([(h+g)/2-h,(d+v)/2-d],2),y=p[0],x=p[1],F=r.style.opacity,O=F===void 0?1:F,L=t.style.opacity,U=L===void 0?1:L,R=r.style.transform||"",j=t.style.transform||"",q=r.animate([{opacity:O,transform:"translate(0, 0) ".concat(R)},{opacity:0,transform:"translate(".concat(y,", ").concat(x,") ").concat(R)}],(0,D.pi)((0,D.pi)({fill:"both"},e),{duration:A+l+c})),et=t.animate([{opacity:0,transform:"translate(".concat(-y,", ").concat(-x,") ").concat(j),offset:.01},{opacity:U,transform:"translate(0, 0) ".concat(j)}],(0,D.pi)((0,D.pi)({fill:"both"},e),{duration:l+c,delay:A+l-c}));return qc(et,i),[q,et]}function ks(r,t,e){var n={},i={};return Object.entries(t).forEach(function(a){var s=(0,D.CR)(a,2),o=s[0],A=s[1];if(!Re(A)){var l=r.style[o]||r.parsedStyle[o]||0;l!==A&&(n[o]=l,i[o]=A)}}),e?K2(r,[n,i],(0,D.pi)({fill:"both"},e)):(z2(r,i),null)}function $4(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 E1(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 V2=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"]]},t_=V2,e_=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"]]},n_=function(r,t,e){return[["M",r-e,t],["L",r,t-e],["L",r+e,t],["L",r,t+e],["Z"]]},r_=function(r,t,e){var n=e*Math.sin(.3333333333333333*Math.PI);return[["M",r-e,t+n],["L",r,t-n],["L",r+e,t+n],["Z"]]},i_=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"]]},a_=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"]]},s_=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"]]},W2=function(r,t,e){return[["M",r,t+e],["L",r,t-e]]},o_=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]]},A_=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]]},l_=function(r,t,e){return[["M",r-e,t],["L",r+e,t],["M",r,t-e],["L",r,t+e]]},c_=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},j2=function(r,t,e){return[["M",r-e,t],["L",r+e,t]]},u_=j2,h_=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]]},d_=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]]},f_=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]]},g_=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 v_(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 p_=function(r,t,e){return[["M",r-e,t-e],["L",r+e,t],["L",r-e,t+e],["Z"]]},m_=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]]},oa=Ls({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"),y_=function(r){(0,D.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:p_(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 Ai({class:oa.contentGroup.name})),n.playWindow=n.contentGroup.appendChild(new Ai({class:oa.playWindow.name})),n.innerCurrPage=n.defaultPage,n}return Object.defineProperty(t.prototype,"defaultPage",{get:function(){var e=this.attributes.defaultPage;return dr(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,D.CR)($4(e.map(function(u){var h=u.getBBox(),d=h.width,f=h.height;return[d,f]})).map(function(u){return Math.max.apply(Math,(0,D.ev)([],(0,D.CR)(u),!1))}),2),i=n[0],a=n[1],s=this.attributes,o=s.pageWidth,A=o===void 0?i:o,l=s.pageHeight,c=l===void 0?a:l;return{pageWidth:A,pageHeight:c}},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.playWindow},Object.defineProperty(t.prototype,"totalPages",{get:function(){return this.pageViews.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"currPage",{get:function(){return this.innerCurrPage},enumerable:!1,configurable:!0}),t.prototype.getBBox=function(){var e=r.prototype.getBBox.call(this),n=e.x,i=e.y,a=this.controllerShape,s=this.pageShape,o=s.pageWidth,A=s.pageHeight;return new Gi(n,i,o+a.width,A)},t.prototype.goTo=function(e){var n=this,i=this.attributes.animate,a=this,s=a.currPage,o=a.playState,A=a.playWindow,l=a.pageViews;if(o!=="idle"||e<0||l.length<=0||e>=l.length)return null;l[s].setLocalPosition(0,0),this.prepareFollowingPage(e);var c=(0,D.CR)(this.getFollowingPageDiff(e),2),u=c[0],h=c[1];this.playState="running";var d=K2(A,[{transform:"translate(0, 0)"},{transform:"translate(".concat(-u,", ").concat(-h,")")}],i);return qc(d,function(){n.innerCurrPage=e,n.playState="idle",n.setVisiblePages([e]),n.updatePageInfo()}),d},t.prototype.prev=function(){var e=this.attributes.loop,n=this.pageViews.length,i=this.currPage;if(!e&&i<=0)return null;var a=e?(i-1+n)%n:dr(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:dr(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(oa.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)?Vh(n):Ns(n)})},t.prototype.adjustControllerLayout=function(){var e=this,n=e.prevBtnGroup,i=e.nextBtnGroup,a=e.pageInfoGroup,s=this.attributes,o=s.orientation,A=s.controllerPadding,l=a.getBBox(),c=l.width,u=l.height,h=(0,D.CR)(o==="horizontal"?[-180,0]:[-90,90],2),d=h[0],f=h[1];n.setLocalEulerAngles(d),i.setLocalEulerAngles(f);var g=n.getBBox(),v=g.width,p=g.height,y=i.getBBox(),x=y.width,F=y.height,O=Math.max(v,c,x),L=o==="horizontal"?{offset:[[0,0],[v/2+A,0],[v+c+A*2,0]],textAlign:"start"}:{offset:[[O/2,-p-A],[O/2,0],[O/2,F+A]],textAlign:"center"},U=(0,D.CR)(L.offset,3),R=(0,D.CR)(U[0],2),j=R[0],q=R[1],et=(0,D.CR)(U[1],2),it=et[0],dt=et[1],ft=(0,D.CR)(U[2],2),mt=ft[0],Rt=ft[1],Qt=L.textAlign,yt=a.querySelector("text");yt&&(yt.style.textAlign=Qt),n.setLocalPosition(j,q),a.setLocalPosition(it,dt),i.setLocalPosition(mt,Rt)},t.prototype.updatePageInfo=function(){var e,n=this,i=n.currPage,a=n.pageViews,s=n.attributes.formatter;a.length<2||((e=this.pageInfoGroup.querySelector(oa.pageInfo.class))===null||e===void 0||e.attr("text",s(i+1,a.length)),this.adjustControllerLayout())},t.prototype.getFollowingPageDiff=function(e){var n=this.currPage;if(n===e)return[0,0];var i=this.attributes.orientation,a=this.pageShape,s=a.pageWidth,o=a.pageHeight,A=e=2,h=e.maybeAppendByClassName(oa.controller,"g");if(C0(h.node(),u),!!u){var d=tn(this.attributes,"button"),f=tn(this.attributes,"pageNum"),g=(0,D.CR)(_o(d),2),v=g[0],p=g[1],y=v.size,x=(0,D._T)(v,["size"]),F=!h.select(oa.prevBtnGroup.class).node(),O=h.maybeAppendByClassName(oa.prevBtnGroup,"g").styles(p);this.prevBtnGroup=O.node();var L=O.maybeAppendByClassName(oa.prevBtn,"path");if(o){var U=zi(oa.prevBtn.name,sa.prevBtn,o);L.node().setAttribute("class",U)}var R=h.maybeAppendByClassName(oa.nextBtnGroup,"g").styles(p);this.nextBtnGroup=R.node();var j=R.maybeAppendByClassName(oa.nextBtn,"path");if(o){var q=zi(oa.nextBtn.name,sa.nextBtn,o);j.node().setAttribute("class",q)}[L,j].forEach(function(ft){ft.styles((0,D.pi)((0,D.pi)({},x),{transformOrigin:"center"})),E1(ft.node(),y,!0)});var et=h.maybeAppendByClassName(oa.pageInfoGroup,"g");this.pageInfoGroup=et.node();var it=et.maybeAppendByClassName(oa.pageInfo,"text");if(it.styles(f),o){var dt=zi(oa.pageInfo.name,sa.pageInfo,o);it.node().setAttribute("class",dt)}this.updatePageInfo(),h.node().setLocalPosition(l+a,c/2),F&&(this.prevBtnGroup.addEventListener("click",function(){n.prev()}),this.nextBtnGroup.addEventListener("click",function(){n.next()}))}},t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s;this.attr("transform","translate(".concat(a,", ").concat(o,")"));var A=Ne(n);this.renderClipPath(A),this.renderController(A),this.setVisiblePages([this.defaultPage]),this.goTo(this.defaultPage)},t.prototype.bindEvents=function(){var e=this,n=Lh(function(){return e.render(e.attributes,e)},50);this.playWindow.addEventListener(yn.INSERTED,n),this.playWindow.addEventListener(yn.REMOVED,n)},t}(Mr);function w_(r){var t="default";if(br(r)&&r instanceof Image)t="image";else if(Vt(r))t="symbol";else if(gn(r)){var e=new RegExp("data:(image|text)");r.match(e)?t="base64":/^(https?:\/\/(([a-zA-Z0-9]+-?)+[a-zA-Z0-9]+\.)+[a-zA-Z]+)(:\d+)?(\/.*)?(\?.*)?(#.*)?$/.test(r)?t="url":t="symbol"}return t}function E_(r){var t=w_(r);return["base64","url","image"].includes(t)?"image":r&&t==="symbol"?"path":null}var Kn=function(r){(0,D.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=i===void 0?0:i,s=e.y,o=s===void 0?0:s,A=this.getSubShapeStyle(e),l=A.symbol,c=A.size,u=c===void 0?16:c,h=(0,D._T)(A,["symbol","size"]),d=E_(l);ma(!!d,Ne(n),function(f){f.maybeAppendByClassName("marker",d).attr("className","marker ".concat(d,"-marker")).call(function(g){if(d==="image"){var v=u*2;g.styles({img:l,width:v,height:v,x:a-u,y:o-u})}else{var v=u/2,p=Vt(l)?l:t.getSymbol(l);g.styles((0,D.pi)({d:p==null?void 0:p(a,o,v)},h))}})})},t.MARKER_SYMBOL_MAP=new Map,t.registerSymbol=function(e,n){t.MARKER_SYMBOL_MAP.set(e,n)},t.getSymbol=function(e){return t.MARKER_SYMBOL_MAP.get(e)},t.getSymbols=function(){return Array.from(t.MARKER_SYMBOL_MAP.keys())},t}(Mr);Kn.registerSymbol("cross",o_),Kn.registerSymbol("hyphen",c_),Kn.registerSymbol("line",W2),Kn.registerSymbol("plus",l_),Kn.registerSymbol("tick",A_),Kn.registerSymbol("circle",V2),Kn.registerSymbol("point",t_),Kn.registerSymbol("bowtie",s_),Kn.registerSymbol("hexagon",a_),Kn.registerSymbol("square",e_),Kn.registerSymbol("diamond",n_),Kn.registerSymbol("triangle",r_),Kn.registerSymbol("triangle-down",i_),Kn.registerSymbol("line",W2),Kn.registerSymbol("dot",j2),Kn.registerSymbol("dash",u_),Kn.registerSymbol("smooth",h_),Kn.registerSymbol("hv",d_),Kn.registerSymbol("vh",f_),Kn.registerSymbol("hvh",g_),Kn.registerSymbol("vhv",v_),Kn.registerSymbol("focus",m_);function AK(r,t,e){var n=Math.round((r-e)/t);return e+n*t}function B_(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 Z2=1.4,Y2=.4;function b_(r,t,e){var n=e,i=n*Z2,a=n/2,s=n/6,o=r+i*Y2;return[["M",r,t],["L",o,t+a],["L",r+i,t+a],["L",r+i,t-a],["L",o,t-a],["Z"],["M",o,t+s],["L",r+i-2,t+s],["M",o,t-s],["L",r+i-2,t-s]]}function x_(r,t,e){var n=e,i=n*Z2,a=n/2,s=n/6,o=t+i*Y2;return[["M",r,t],["L",r-a,o],["L",r-a,t+i],["L",r+a,t+i],["L",r+a,o],["Z"],["M",r-s,o],["L",r-s,t+i-2],["M",r+s,o],["L",r+s,t+i-2]]}Kn.registerSymbol("hiddenHandle",B_),Kn.registerSymbol("verticalHandle",b_),Kn.registerSymbol("horizontalHandle",x_);var lK=function(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e};function cK(r,t,e,n){var i;n===void 0&&(n=4);var a=__read(r,2),s=a[0],o=a[1],A=__read(t,2),l=A[0],c=A[1],u=__read(e,2),h=u[0],d=u[1],f=__read([l,c],2),g=f[0],v=f[1],p=v-g;return g>v&&(i=__read([v,g],2),g=i[0],v=i[1]),p>o-s?[s,o]:go?d===o&&h===g?[g,o]:[o-p,o]:[g,v]}function B1(r,t,e){return r===void 0&&(r="horizontal"),r==="horizontal"?t:e}function uK(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 X2(r){var t=r.getLocalBounds(),e=t.min,n=t.max,i=(0,D.CR)([e,n],2),a=(0,D.CR)(i[0],2),s=a[0],o=a[1],A=(0,D.CR)(i[1],2),l=A[0],c=A[1];return{x:s,y:o,width:l-s,height:c-o,left:s,bottom:c,top:o,right:l}}function hK(r,t){var e=select(r).append("text").node();return e.attr(__assign(__assign({},t),{visibility:"hidden"})),e}function C_(r,t){var e=(0,D.CR)(r,2),n=e[0],i=e[1],a=(0,D.CR)(t,2),s=a[0],o=a[1];return n!==s&&i===o}function dK(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 S_(r,t){var e,n,i=t.attributes;try{for(var a=(0,D.XA)(Object.entries(i)),s=a.next();!s.done;s=a.next()){var o=(0,D.CR)(s.value,2),A=o[0],l=o[1];A!=="id"&&A!=="className"&&r.attr(A,l)}}catch(c){e={error:c}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(e)throw e.error}}}function Ho(r){return typeof r=="function"?r():gn(r)||ye(r)?new m1({style:{text:String(r)}}):r}function M_(r,t){return typeof r=="function"?r():gn(r)||ye(r)?new gl({style:(0,D.pi)((0,D.pi)({pointerEvents:"auto"},t),{innerHTML:r})}):r}var F0,b1;function fK(r){b1=r}var F_=s1(function(r,t){var e=t.fontSize,n=t.fontFamily,i=t.fontWeight,a=t.fontStyle,s=t.fontVariant;return b1?b1(r,e):(F0||(F0=re.offscreenCanvasCreator.getOrCreateContext(void 0)),F0.font=[a,s,i,"".concat(e,"px"),n].join(" "),F0.measureText(r).width)},function(r,t){return[r,Object.values(t||J2(r)).join()].join("")},4096),J2=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 q2(r){return r.nodeName==="text"?r:r.nodeName==="g"&&r.children.length===1&&r.children[0].nodeName==="text"?r.children[0]:null}function $2(r,t){var e=q2(r);e&&e.attr(t)}function x1(r,t,e){e===void 0&&(e="..."),$2(r,{wordWrap:!0,wordWrapWidth:t,maxLines:1,textOverflow:e})}function C1(r,t){for(var e in t)t.hasOwnProperty(e)&&e!=="constructor"&&t[e]!==void 0&&(r[e]=t[e])}function T_(r,t,e,n){return t&&C1(r,t),e&&C1(r,e),n&&C1(r,n),r}function O_(r){return r instanceof Element||r instanceof Document}var vn,I_="component-poptip",ln={CONTAINER:"component-poptip",ARROW:"component-poptip-arrow",TEXT:"component-poptip-text"},tS=(vn={},vn[".".concat(ln.CONTAINER)]={visibility:"visible",position:"absolute","background-color":"rgba(0, 0, 0)","box-shadow":"0px 0px 10px #aeaeae","border-radius":"3px",color:"#fff",opacity:.8,"font-size":"12px",padding:"4px 6px",display:"flex","justify-content":"center","align-items":"center","z-index":8,transition:"visibility 50ms"},vn[".".concat(ln.TEXT)]={"text-align":"center"},vn[".".concat(ln.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='left']")]={transform:"translate(-100%, -50%)"},vn[".".concat(ln.CONTAINER,"[data-position='right']")]={transform:"translate(0, -50%)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='top-left']")]={transform:"translate(0,-100%)"},vn[".".concat(ln.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%,-100%)"},vn[".".concat(ln.CONTAINER,"[data-position='left-top']")]={transform:"translate(-100%, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(-100%, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='right-top']")]={transform:"translate(0, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(0, -100%)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 0)"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 0)"},vn[".".concat(ln.ARROW)]={width:"4px",height:"4px",transform:"rotate(45deg)","background-color":"rgba(0, 0, 0)",position:"absolute","z-index":-1},vn[".".concat(ln.CONTAINER,"[data-position='top']")]={transform:"translate(-50%, calc(-100% - 5px))"},vn["[data-position='top'] .".concat(ln.ARROW)]={bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='left']")]={transform:"translate(calc(-100% - 5px), -50%)"},vn["[data-position='left'] .".concat(ln.ARROW)]={right:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='right']")]={transform:"translate(5px, -50%)"},vn["[data-position='right'] .".concat(ln.ARROW)]={left:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom']")]={transform:"translate(-50%, 5px)"},vn["[data-position='bottom'] .".concat(ln.ARROW)]={top:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='top-left']")]={transform:"translate(0, calc(-100% - 5px))"},vn["[data-position='top-left'] .".concat(ln.ARROW)]={left:"10px",bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='top-right']")]={transform:"translate(-100%, calc(-100% - 5px))"},vn["[data-position='top-right'] .".concat(ln.ARROW)]={right:"10px",bottom:"-2px"},vn[".".concat(ln.CONTAINER,"[data-position='left-top']")]={transform:"translate(calc(-100% - 5px), 0)"},vn["[data-position='left-top'] .".concat(ln.ARROW)]={right:"-2px",top:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='left-bottom']")]={transform:"translate(calc(-100% - 5px), -100%)"},vn["[data-position='left-bottom'] .".concat(ln.ARROW)]={right:"-2px",bottom:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='right-top']")]={transform:"translate(5px, 0)"},vn["[data-position='right-top'] .".concat(ln.ARROW)]={left:"-2px",top:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='right-bottom']")]={transform:"translate(5px, -100%)"},vn["[data-position='right-bottom'] .".concat(ln.ARROW)]={left:"-2px",bottom:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-left']")]={transform:"translate(0, 5px)"},vn["[data-position='bottom-left'] .".concat(ln.ARROW)]={top:"-2px",left:"8px"},vn[".".concat(ln.CONTAINER,"[data-position='bottom-right']")]={transform:"translate(-100%, 5px)"},vn["[data-position='bottom-right'] .".concat(ln.ARROW)]={top:"-2px",right:"8px"},vn),N_=void 0;function L_(r,t,e,n,i,a){if(i===void 0&&(i=!1),a===void 0&&(a=!1),a)return[r,t];var s=e.getBoundingClientRect(),o=s.x,A=s.y,l=s.width,c=s.height;switch(n){case"top":return i?[o+l/2,A]:[r,A];case"left":return i?[o,A+c/2]:[o,t];case"bottom":return i?[o+l/2,A+c]:[r,A+c];case"right":return i?[o+l,A+c/2]:[o+l,t];case"top-right":case"right-top":return[o+l,A];case"left-bottom":case"bottom-left":return[o,A+c];case"right-bottom":case"bottom-right":return[o+l,A+c];case"top-left":case"left-top":default:return[o,A]}}var k_=function(r){var t;return function(){for(var e=[],n=0;n');e.innerHTML=o,gn(a)?e.innerHTML+=a:a&&O_(a)&&e.appendChild(a),s&&(e.getElementsByClassName(ln.TEXT)[0].textContent=s),this.applyStyles(),this.container.style.visibility=this.visibility},t.prototype.applyStyles=function(){var e=Zr({},tS,this.style.domStyles),n=Object.entries(e).reduce(function(a,s){var o=(0,D.CR)(s,2),A=o[0],l=o[1],c=Object.entries(l).reduce(function(u,h){var d=(0,D.CR)(h,2),f=d[0],g=d[1];return"".concat(u).concat(f,": ").concat(g,";")},"");return"".concat(a).concat(A,"{").concat(c,"}")},"");if(this.domStyles!==n){this.domStyles=n;var i=this.container.querySelector("style");i&&this.container.removeChild(i),i=document.createElement("style"),i.innerHTML=n,this.container.appendChild(i)}},t.prototype.setOffsetPosition=function(e,n,i){i===void 0&&(i=this.style.offset);var a=(0,D.CR)(i,2),s=a[0],o=s===void 0?0:s,A=a[1],l=A===void 0?0:A;this.container.style.left="".concat(e+o,"px"),this.container.style.top="".concat(n+l,"px")},t.tag="poptip",t.defaultOptions={style:{x:0,y:0,width:0,height:0,target:null,visibility:"hidden",text:"",position:"top",follow:!1,offset:[0,0],domStyles:tS,template:'
')}},t}(Mr),Yr=Ls({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"),D_={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 P_(r){var t=r.querySelector(Yr.marker.class);return t?t.style:{}}var __=function(r){(0,D.ZT)(t,r);function t(e,n){var i=r.call(this,e,{span:[1,1],marker:function(){return new eo({style:{r:6}})},markerSize:10,labelFill:"#646464",valueFill:"#646464",labelFontSize:12,valueFontSize:12,labelTextBaseline:"middle",valueTextBaseline:"middle"})||this;return i.keyFields={},i.keyFields=n||{},i}return Object.defineProperty(t.prototype,"showValue",{get:function(){var e=this.attributes.valueText;return e?typeof e=="string"||typeof e=="number"?e!=="":typeof e=="function"?!0:e.attr("text")!=="":!1},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"actualSpace",{get:function(){var e=this.labelGroup,n=this.valueGroup,i=this.attributes,a=i.markerSize,s=i.focus,o=i.focusMarkerSize,A=e.node().getBBox(),l=A.width,c=A.height,u=n.node().getBBox(),h=u.width,d=u.height,f=s?o!=null?o:12:0;return{markerWidth:a,labelWidth:l,valueWidth:h,focusWidth:f,height:Math.max(a,c,d)}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"span",{get:function(){var e=this.attributes.span;if(!e)return[1,1];var n=(0,D.CR)(Oi(e),2),i=n[0],a=n[1],s=this.showValue?a:0,o=i+s;return[i/o,s/o]},enumerable:!1,configurable:!0}),t.prototype.setAttribute=function(e,n){r.prototype.setAttribute.call(this,e,n)},Object.defineProperty(t.prototype,"shape",{get:function(){var e,n=this.attributes,i=n.markerSize,a=n.width,s=this.actualSpace,o=s.markerWidth,A=s.focusWidth,l=s.height,c=this.actualSpace,u=c.labelWidth,h=c.valueWidth,d=(0,D.CR)(this.spacing,3),f=d[0],g=d[1],v=d[2];if(a){var p=a-i-f-g-A-v,y=(0,D.CR)(this.span,2),x=y[0],F=y[1];e=(0,D.CR)([x*p,F*p],2),u=e[0],h=e[1]}var O=o+u+h+f+g+A+v;return{width:O,height:l,markerWidth:o,labelWidth:u,valueWidth:h,focusWidth:A}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"spacing",{get:function(){var e=this.attributes,n=e.spacing,i=e.focus;if(!n)return[0,0,0];var a=(0,D.CR)(Oi(n),3),s=a[0],o=a[1],A=a[2];return[s,this.showValue?o:0,i?A:0]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"layout",{get:function(){var e=this.shape,n=e.markerWidth,i=e.labelWidth,a=e.valueWidth,s=e.focusWidth,o=e.width,A=e.height,l=(0,D.CR)(this.spacing,3),c=l[0],u=l[1],h=l[2];return{height:A,width:o,markerWidth:n,labelWidth:i,valueWidth:a,focusWidth:s,position:[n/2,n+c,n+i+c+u,n+i+a+c+u+h+s/2]}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"scaleSize",{get:function(){var e=P_(this.markerGroup.node()),n=this.attributes,i=n.markerSize,a=n.markerStrokeWidth,s=a===void 0?e.strokeWidth:a,o=n.markerLineWidth,A=o===void 0?e.lineWidth:o,l=n.markerStroke,c=l===void 0?e.stroke:l,u=+(s||A||(c?1:0))*Math.sqrt(2),h=this.markerGroup.node().getBBox(),d=h.width,f=h.height;return(1-u/Math.max(d,f))*i},enumerable:!1,configurable:!0}),t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.marker,s=i.classNamePrefix,o=tn(this.attributes,"marker");this.markerGroup=e.maybeAppendByClassName(Yr.markerGroup,"g").style("zIndex",0),ma(!!a,this.markerGroup,function(){var A,l=n.markerGroup.node(),c=(A=l.childNodes)===null||A===void 0?void 0:A[0],u=zi(Yr.marker.name,sa.marker,s),h=typeof a=="string"?new Kn({style:{symbol:a},className:u}):a();if(c)if(h.nodeName===c.nodeName)c instanceof Kn?c.update((0,D.pi)((0,D.pi)({},o),{symbol:a})):(S_(c,h),Ne(c).styles(o));else{if(c.remove(),!(h instanceof Kn)){var f=zi(Yr.marker.name,sa.marker,s);h.className=f}Ne(h).styles(o),l.appendChild(h)}else{if(!(h instanceof Kn)){var d=zi(Yr.marker.name,sa.marker,s);h.className=d,Ne(h).styles(o)}l.appendChild(h)}n.markerGroup.node().scale(1/n.markerGroup.node().getScale()[0]);var g=E1(n.markerGroup.node(),n.scaleSize,!0);n.markerGroup.node().style._transform="scale(".concat(g,")")})},t.prototype.renderLabel=function(e){var n=tn(this.attributes,"label"),i=n.text,a=(0,D._T)(n,["text"]),s=this.attributes.classNamePrefix;this.labelGroup=e.maybeAppendByClassName(Yr.labelGroup,"g").style("zIndex",0);var o=zi(Yr.label.name,sa.label,s),A=this.labelGroup.maybeAppendByClassName(Yr.label,function(){return Ho(i)});A.node().setAttribute("class",o),A.styles(a)},t.prototype.renderValue=function(e){var n=this,i=tn(this.attributes,"value"),a=i.text,s=(0,D._T)(i,["text"]),o=this.attributes.classNamePrefix;this.valueGroup=e.maybeAppendByClassName(Yr.valueGroup,"g").style("zIndex",0),ma(this.showValue,this.valueGroup,function(){var A=zi(Yr.value.name,sa.value,o),l=n.valueGroup.maybeAppendByClassName(Yr.value,function(){return Ho(a)});l.node().setAttribute("class",A),l.styles(s)})},t.prototype.createPoptip=function(){var e=this.attributes.poptip,n=e||{},i=n.render,a=(0,D._T)(n,["render"]),s=new R_({style:Zr(D_,a)});return this.poptipGroup=s,s},t.prototype.bindPoptip=function(e){var n=this,i=this.attributes.poptip;if(i){var a=this.poptipGroup||this.createPoptip();a.bind(e,function(){var s=n.attributes,o=s.labelText,A=s.valueText,l=s.markerFill,c=typeof o=="string"?o:o==null?void 0:o.attr("text"),u=typeof A=="string"?A:A==null?void 0:A.attr("text");if(typeof i.render=="function")return{html:i.render((0,D.pi)((0,D.pi)({},n.keyFields),{label:c,value:u,color:l}))};var h="";return(typeof c=="string"||typeof c=="number")&&(h+='
'.concat(c,"
")),(typeof u=="string"||typeof u=="number")&&(h+='
'.concat(u,"
")),{html:h}})}},t.prototype.renderFocus=function(e){var n=this,i=this.attributes,a=i.focus,s=i.focusMarkerSize,o=i.classNamePrefix,A={x:0,y:0,size:s,opacity:.6,symbol:"focus",stroke:"#aaaaaa",lineWidth:1};Ze(a)||(this.focusGroup=e.maybeAppendByClassName(Yr.focusGroup,"g").style("zIndex",0),ma(a,this.focusGroup,function(){var l=zi(Yr.focus.name,sa.focusIcon,o),c=new Kn({style:(0,D.pi)((0,D.pi)({},A),{symbol:"focus"}),className:l}),u=new eo({style:{r:A.size/2,fill:"transparent"}}),h=n.focusGroup.node();h.appendChild(u),h.appendChild(c),c.update({opacity:0}),e.node().addEventListener("pointerenter",function(){c.update({opacity:1})}),e.node().addEventListener("pointerleave",function(){c.update({opacity:0})})}))},t.prototype.renderPoptip=function(e){var n=this,i=this.attributes.poptip;if(i){var a=e.maybeAppendByClassName(Yr.value,"g").node(),s=e.maybeAppendByClassName(Yr.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=tn(this.attributes,"background");this.background=e.maybeAppendByClassName(Yr.backgroundGroup,"g").style("zIndex",-1);var o=this.background.maybeAppendByClassName(Yr.background,"rect");o.styles((0,D.pi)({width:i,height:a},s));var A=this.attributes.classNamePrefix,l=A===void 0?"":A;if(l){var c=zi(Yr.background.name,sa.background,l);o.node().setAttribute("class",c)}},t.prototype.adjustLayout=function(){var e=this.layout,n=e.labelWidth,i=e.valueWidth,a=e.height,s=(0,D.CR)(e.position,4),o=s[0],A=s[1],l=s[2],c=s[3],u=a/2;this.markerGroup.styles({transform:"translate(".concat(o,", ").concat(u,")").concat(this.markerGroup.node().style._transform)}),this.labelGroup.styles({transform:"translate(".concat(A,", ").concat(u,")")}),this.focusGroup&&this.focusGroup.styles({transform:"translate(".concat(c,", ").concat(u,")")}),x1(this.labelGroup.select(Yr.label.class).node(),Math.ceil(n)),this.showValue&&(this.valueGroup.styles({transform:"translate(".concat(l,", ").concat(u,")")}),x1(this.valueGroup.select(Yr.value.class).node(),Math.ceil(i)))},t.prototype.render=function(e,n){var i=Ne(n),a=e.x,s=a===void 0?0:a,o=e.y,A=o===void 0?0:o;i.styles({transform:"translate(".concat(s,", ").concat(A,")")}),this.renderMarker(i),this.renderLabel(i),this.renderValue(i),this.renderBackground(i),this.renderPoptip(i),this.renderFocus(i),this.adjustLayout()},t}(Mr),Dl=Ls({page:"item-page",navigator:"navigator",item:"item"},"items"),eS=function(r,t,e){return e===void 0&&(e=!0),r?t(r):e},H_=function(r){(0,D.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:w1,mouseenter:w1,mouseleave:w1})||this;return n.navigatorShape=[0,0],n}return Object.defineProperty(t.prototype,"pageViews",{get:function(){return this.navigator.getContainer()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"grid",{get:function(){var e=this.attributes,n=e.gridRow,i=e.gridCol,a=e.data;if(!n&&!i)throw new Error("gridRow and gridCol can not be set null at the same time");return n&&i?[n,i]:n?[n,a.length]:[a.length,i]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"renderData",{get:function(){var e=this.attributes,n=e.data,i=e.layout,a=e.poptip,s=e.focus,o=e.focusMarkerSize,A=e.classNamePrefix,l=tn(this.attributes,"item"),c=n.map(function(u,h){var d=u.id,f=d===void 0?h:d,g=u.label,v=u.value;return{id:"".concat(f),index:h,style:(0,D.pi)({layout:i,labelText:g,valueText:v,poptip:a,focus:s,focusMarkerSize:o,classNamePrefix:A},Object.fromEntries(Object.entries(l).map(function(p){var y=(0,D.CR)(p,2),x=y[0],F=y[1];return[x,ya(F,[u,h,n])]})))}});return c},enumerable:!1,configurable:!0}),t.prototype.getGridLayout=function(){var e=this,n=this.attributes,i=n.orientation,a=n.width,s=n.rowPadding,o=n.colPadding,A=(0,D.CR)(this.navigatorShape,1),l=A[0],c=(0,D.CR)(this.grid,2),u=c[0],h=c[1],d=h*u,f=0;return this.pageViews.children.map(function(g,v){var p,y,x=Math.floor(v/d),F=v%d,O=e.ifHorizontal(h,u),L=[Math.floor(F/O),F%O];i==="vertical"&&L.reverse();var U=(0,D.CR)(L,2),R=U[0],j=U[1],q=(a-l-(h-1)*o)/h,et=g.getBBox().height,it=(0,D.CR)([0,0],2),dt=it[0],ft=it[1];return i==="horizontal"?(p=(0,D.CR)([f,R*(et+s)],2),dt=p[0],ft=p[1],f=j===h-1?0:f+q+o):(y=(0,D.CR)([j*(q+o),f],2),dt=y[0],ft=y[1],f=R===u-1?0:f+et+s),{page:x,index:v,row:R,col:j,pageIndex:F,width:q,height:et,x:dt,y:ft}})},t.prototype.getFlexLayout=function(){var e=this.attributes,n=e.width,i=e.height,a=e.rowPadding,s=e.colPadding,o=(0,D.CR)(this.navigatorShape,1),A=o[0],l=(0,D.CR)(this.grid,2),c=l[0],u=l[1],h=(0,D.CR)([n-A,i],2),d=h[0],f=h[1],g=(0,D.CR)([0,0,0,0,0,0,0,0],8),v=g[0],p=g[1],y=g[2],x=g[3],F=g[4],O=g[5],L=g[6],U=g[7];return this.pageViews.children.map(function(R,j){var q,et,it,dt,ft=R.getBBox(),mt=ft.width,Rt=ft.height,Qt=L===0?0:s,yt=L+Qt+mt;if(yt<=d&&eS(F,function(Dt){return Dt0?(this.navigatorShape=[55,0],e.call(this)):n},enumerable:!1,configurable:!0}),t.prototype.ifHorizontal=function(e,n){var i=this.attributes.orientation;return B1(i,e,n)},t.prototype.flattenPage=function(e){e.querySelectorAll(Dl.item.class).forEach(function(n){e.appendChild(n)}),e.querySelectorAll(Dl.page.class).forEach(function(n){var i=e.removeChild(n);i.destroy()})},t.prototype.renderItems=function(e){var n=this.attributes,i=n.click,a=n.mouseenter,s=n.mouseleave,o=n.classNamePrefix;this.flattenPage(e);var A=this.dispatchCustomEvent.bind(this),l=zi(Dl.item.name,sa.item,o);Ne(e).selectAll(Dl.item.class).data(this.renderData,function(c){return c.id}).join(function(c){return c.append(function(u){var h=u.style,d=(0,D._T)(u,["style"]);return new __({style:h},d)}).attr("className",l).on("click",function(){i==null||i(this),A("itemClick",{item:this})}).on("pointerenter",function(){a==null||a(this),A("itemMouseenter",{item:this})}).on("pointerleave",function(){s==null||s(this),A("itemMouseleave",{item:this})})},function(c){return c.each(function(u){var h=u.style;this.update(h)})},function(c){return c.remove()})},t.prototype.relayoutNavigator=function(){var e,n=this.attributes,i=n.layout,a=n.width,s=((e=this.pageViews.children[0])===null||e===void 0?void 0:e.getBBox().height)||0,o=(0,D.CR)(this.navigatorShape,2),A=o[0],l=o[1];this.navigator.update(i==="grid"?{pageWidth:a-A,pageHeight:s-l}:{})},t.prototype.adjustLayout=function(){var e=this,n=Object.entries(Z4(this.itemsLayout,"page")).map(function(a){var s=(0,D.CR)(a,2),o=s[0],A=s[1];return{page:o,layouts:A}}),i=(0,D.ev)([],(0,D.CR)(this.navigator.getContainer().children),!1);n.forEach(function(a){var s=a.layouts,o=e.pageViews.appendChild(new Ai({className:Dl.page.name}));s.forEach(function(A){var l=A.x,c=A.y,u=A.index,h=A.width,d=A.height,f=i[u];o.appendChild(f),bh(f,"__layout__",A),f.update({x:l,y:c,width:h,height:d})})}),this.relayoutNavigator()},t.prototype.renderNavigator=function(e){var n=this.attributes,i=n.orientation,a=n.classNamePrefix,s=tn(this.attributes,"nav"),o=Zr({orientation:i,classNamePrefix:a},s),A=this;return e.selectAll(Dl.navigator.class).data(["nav"]).join(function(l){return l.append(function(){return new y_({style:o})}).attr("className",Dl.navigator.name).each(function(){A.navigator=this})},function(l){return l.each(function(){this.update(o)})},function(l){return l.remove()}),this.navigator},t.prototype.getBBox=function(){return this.navigator.getBBox()},t.prototype.render=function(e,n){var i=this.attributes.data;if(!(!i||i.length===0)){var a=this.renderNavigator(Ne(n));this.renderItems(a.getContainer()),this.adjustLayout()}},t.prototype.dispatchCustomEvent=function(e,n){var i=new Wr(e,{detail:n});this.dispatchEvent(i)},t}(Mr),Pl=Ls({markerGroup:"marker-group",marker:"marker",labelGroup:"label-group",label:"label"},"handle"),nS={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},gK=function(r){(0,D.ZT)(t,r);function t(e){return r.call(this,e,nS)||this}return t.prototype.render=function(e,n){var i=Ne(n).maybeAppendByClassName(Pl.markerGroup,"g");this.renderMarker(i);var a=Ne(n).maybeAppendByClassName(Pl.labelGroup,"g");this.renderLabel(a)},t.prototype.renderMarker=function(e){var n=this,i=this.attributes,a=i.orientation,s=i.classNamePrefix,o=i.markerSymbol,A=o===void 0?B1(a,"horizontalHandle","verticalHandle"):o;ma(!!A,e,function(l){var c=tn(n.attributes,"marker"),u=(0,D.pi)({symbol:A},c),h=zi(Pl.marker.name,sa.handleMarker,s);if(n.marker=l.maybeAppendByClassName(Pl.marker,function(){return new Kn({style:u,className:h})}).update(u),s){var d=n.marker.node().querySelector(".marker");if(d){var f=d.getAttribute("class")||"",g=f.split(" ")[0],v=zi(g,sa.handleMarker,s);d.setAttribute("class",v)}}})},t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.showLabel,s=i.orientation,o=i.spacing,A=o===void 0?0:o,l=i.formatter,c=i.classNamePrefix;ma(a,e,function(u){var h,d=tn(n.attributes,"label"),f=d.text,g=(0,D._T)(d,["text"]),v=((h=u.select(Pl.marker.class))===null||h===void 0?void 0:h.node().getBBox())||{},p=v.width,y=p===void 0?0:p,x=v.height,F=x===void 0?0:x,O=(0,D.CR)(B1(s,[0,F+A,"center","top"],[y+A,0,"start","middle"]),4),L=O[0],U=O[1],R=O[2],j=O[3],q=zi(Pl.label.name,sa.handleLabel,c);u.maybeAppendByClassName(Pl.label,"text").attr("className",q).styles((0,D.pi)((0,D.pi)({},g),{x:L,y:U,text:l(f).toString(),textAlign:R,textBaseline:j}))})},t}(Mr),rS={showTitle:!0,padding:0,orientation:"horizontal",backgroundFill:"transparent",titleText:"",titleSpacing:4,titlePosition:"top-left",titleFill:"#2C3542",titleFontWeight:"bold",titleFontFamily:"sans-serif",titleFontSize:12},G_=Zr({},rS,{}),vK=Zr({},rS,Jc(nS,"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"}),pK=.01,mK=.5,_l=Ls({title:"title",html:"html",titleGroup:"title-group",items:"items",itemsGroup:"items-group",contentGroup:"content-group",ribbonGroup:"ribbon-group",ribbon:"ribbon",handlesGroup:"handles-group",handle:"handle",startHandle:"start-handle",endHandle:"end-handle",labelGroup:"label-group",label:"label",indicator:"indicator"},"legend"),z_=function(r){(0,D.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.update=function(e){this.attr(e)},t}(gl),K_=function(r){(0,D.ZT)(t,r);function t(e){return r.call(this,e,G_)||this}return t.prototype.renderTitle=function(e,n,i){var a=this.attributes,s=a.showTitle,o=a.titleText,A=a.classNamePrefix,l=tn(this.attributes,"title"),c=(0,D.CR)(_o(l),2),u=c[0],h=c[1];this.titleGroup=e.maybeAppendByClassName(_l.titleGroup,"g").styles(h);var d=(0,D.pi)((0,D.pi)({width:n,height:i},u),{text:s?o:"",classNamePrefix:A});this.title=this.titleGroup.maybeAppendByClassName(_l.title,function(){return new j4({style:d})}).update(d)},t.prototype.renderCustom=function(e){var n=this.attributes.data,i={innerHTML:this.attributes.render(n),pointerEvents:"auto"};e.maybeAppendByClassName(_l.html,function(){return new z_({className:_l.html.name,style:i})}).update(i)},t.prototype.renderItems=function(e,n){var i=n.x,a=n.y,s=n.width,o=n.height,A=tn(this.attributes,"title",!0),l=(0,D.CR)(_o(A),2),c=l[0],u=l[1],h=(0,D.pi)((0,D.pi)({},c),{width:s,height:o,x:0,y:0});this.itemsGroup=e.maybeAppendByClassName(_l.itemsGroup,"g").styles((0,D.pi)((0,D.pi)({},u),{transform:"translate(".concat(i,", ").concat(a,")")}));var d=this;this.itemsGroup.selectAll(_l.items.class).data(["items"]).join(function(f){return f.append(function(){return new H_({style:h})}).attr("className",_l.items.name).each(function(){d.items=Ne(this)})},function(f){return f.update(h)},function(f){return f.remove()})},t.prototype.adjustLayout=function(){var e=this.attributes.showTitle;if(e){var n=this.title.node().getAvailableSpace(),i=n.x,a=n.y;this.itemsGroup.node().style.transform="translate(".concat(i,", ").concat(a,")")}},Object.defineProperty(t.prototype,"availableSpace",{get:function(){var e=this.attributes,n=e.showTitle,i=e.width,a=e.height;return n?this.title.node().getAvailableSpace():new Gi(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):K4(i,a)},t.prototype.render=function(e,n){var i=this.attributes,a=i.width,s=i.height,o=i.x,A=o===void 0?0:o,l=i.y,c=l===void 0?0:l,u=i.classNamePrefix,h=i.render,d=Ne(n),f=n.className||"legend-category";u?n.attr("className","".concat(f," ").concat(u,"legend")):n.className||n.attr("className","legend-category"),n.style.transform="translate(".concat(A,", ").concat(c,")"),h?this.renderCustom(d):(this.renderTitle(d,a,s),this.renderItems(d,this.availableSpace),this.adjustLayout())},t}(Mr);function T0(r){const{width:t,height:e,renderer:n}=r,i=V_(r),a=new Fm({width:t,height:e,container:i,renderer:n||new Mh});return[i,a]}function V_(r){var t;const{container:e,className:n,graphCanvas:i}=r;if(e)return typeof e=="string"?document.getElementById(e):e;const a=Xc(n,!1),{width:s,height:o,containerStyle:A}=r,[l,c]=W_(r);return Object.assign(a.style,Object.assign({position:"absolute",left:l+"px",top:c+"px",width:s+"px",height:o+"px"},A)),(t=i.getContainer())===null||t===void 0||t.appendChild(a),a}function W_(r){const{width:t,height:e,placement:n,graphCanvas:i}=r,[a,s]=i.getSize(),[o,A]=Mb(n);return[o*(a-t),A*(s-e)]}var j_=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const{graph:n}=this.context;n.on(Ae.AFTER_DRAW,this.createElement)},this.changeState=(n,i)=>{const{graph:a}=this.context,{typePrefix:s}=this,o=Fi(n,[s,"id"]),A=Fi(n,[s,"style","labelText"]),[l]=o.split("__"),c=this.fieldMap[l].get(A)||[];a.setElementState(Object.fromEntries(c==null?void 0:c.map(u=>[u,i])))},this.click=n=>{if(this.options.trigger==="hover")return;const i=Fi(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=Fi(n,[this.typePrefix,"id"]);this.selectedItems.includes(i)?this.selectedItems=this.selectedItems.filter(a=>a!==i):(this.selectedItems.push(i),this.changeState(n,"active"))},this.setFieldMap=(n,i,a)=>{if(!n)return;const s=this.fieldMap[a];if(s)if(!s.has(n))s.set(n,[i]);else{const o=s.get(n);o&&(o.push(i),s.set(n,o))}},this.getEvents=()=>({mouseenter:this.mouseenter,mouseleave:this.mouseleave,click:this.click}),this.getMarkerData=(n,i)=>{if(!n)return[];const{model:a,element:s}=this.context,{nodes:o,edges:A,combos:l}=a.getData(),c={},u=v=>Vt(n)?n(v):n,h={node:"circle",edge:"line",combo:"rect"},d={circle:"circle",ellipse:"circle",image:"bowtie",rect:"square",star:"cross",triangle:"triangle",diamond:"diamond",cubic:"dot",line:"hyphen",polyline:"hyphen",quadratic:"hv","cubic-horizontal":"hyphen","cubic-vertical":"line"},f=(v,p)=>s==null?void 0:s.getElementComputedStyle(v,p),g=(v,p)=>{v.forEach(y=>{const{id:x}=y,F=Fi(y,["data",u(y)]),O=(s==null?void 0:s.getElementType(p,y))||"circle",L=f(p,y),U=(p==="edge"?L==null?void 0:L.stroke:L==null?void 0:L.fill)||"#1783ff";x&&F&&F.replace(/\s+/g,"")&&(this.setFieldMap(F,x,p),c[F]||(c[F]={id:`${p}__${x}`,label:F,marker:d[O]||h[p],elementType:p,lineWidth:1,stroke:U,fill:U}))})};switch(i){case"node":g(o,"node");break;case"edge":g(A,"edge");break;case"combo":g(l,"combo");break;default:return[]}return Object.values(c)},this.createElement=()=>{if(this.draw){this.updateElement();return}const n=this.options,{width:i,height:a,nodeField:s,edgeField:o,comboField:A,trigger:l,position:c,container:u,containerStyle:h,className:d}=n,f=j_(n,["width","height","nodeField","edgeField","comboField","trigger","position","container","containerStyle","className"]),g=this.getMarkerData(s,"node"),v=this.getMarkerData(o,"edge"),p=this.getMarkerData(A,"combo"),y=[...g,...p,...v],x=Object.assign({width:i,height:a,data:y,itemMarkerLineWidth:({lineWidth:L})=>L,itemMarker:({marker:L})=>L,itemMarkerStroke:({stroke:L})=>L,itemMarkerFill:({fill:L})=>L,gridCol:g.length},f,this.getEvents()),F=new K_({className:"legend",style:x});this.category=F,this.upsertCanvas().appendChild(F),this.draw=!0},this.bindEvents()}update(t){super.update(t),this.clear(),this.createElement()}clear(){var t,e;(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),this.canvas=void 0,this.container=void 0,this.draw=!1}updateElement(){this.category&&this.category.update({itemMarkerOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5,itemLabelOpacity:({id:t})=>!this.selectedItems.length||this.selectedItems.includes(t)?1:.5})}upsertCanvas(){if(this.canvas)return this.canvas;const t=this.context.canvas,[e,n]=t.getSize(),{width:i=e,height:a=n,position:s,container:o,containerStyle:A,className:l}=this.options,[c,u]=T0({width:i,height:a,graphCanvas:t,container:o,containerStyle:A,placement:s,className:"legend"});return this.container=c,l&&c.classList.add(l),this.canvas=u,this.canvas}destroy(){this.clear(),this.context.graph.off(Ae.AFTER_DRAW,this.createElement),super.destroy()}}O0.defaultOptions={position:"bottom",trigger:"hover",orientation:"horizontal",layout:"flex",itemSpacing:4,rowPadding:10,colPadding:10,itemMarkerSize:16,itemLabelFontSize:16,width:240,height:160};class I0 extends yi{constructor(t,e){super(t,Object.assign({},I0.defaultOptions,e)),this.onDraw=n=>{var i;!((i=n==null?void 0:n.data)===null||i===void 0)&&i.render||this.onRender()},this.landmarkMap=new Map,this.mask=null,this.isMaskDragging=!1,this.onMaskDragStart=n=>{this.mask&&(this.isMaskDragging=!0,this.mask.setPointerCapture(n.pointerId),this.mask.addEventListener("pointermove",this.onMaskDrag),this.mask.addEventListener("pointerup",this.onMaskDragEnd),this.mask.addEventListener("pointercancel",this.onMaskDragEnd))},this.onMaskDrag=n=>{if(!this.mask||!this.isMaskDragging)return;const{size:[i,a]}=this.options,{movementX:s,movementY:o}=n,{left:A,top:l,width:c,height:u}=this.mask.style,[,,h,d]=this.maskBBox;let f=parseInt(A)+s,g=parseInt(l)+o,v=parseInt(c),p=parseInt(u);f<0&&(f=0),g<0&&(g=0),f+v>i&&(f=RA(i-v,0)),g+p>a&&(g=RA(a-p,0)),v0?(f=RA(f-s,0),v=UA(v+s,i)):s<0&&(v=UA(v-s,i))),p0?(g=RA(g-o,0),p=UA(p+o,a)):o<0&&(p=UA(p-o,a))),Object.assign(this.mask.style,{left:f+"px",top:g+"px",width:v+"px",height:p+"px"});const y=parseInt(A)-f,x=parseInt(l)-g;if(y===0&&x===0)return;const F=this.context.canvas.getCamera().getZoom(),O=this.canvas.getCamera().getZoom(),L=F/O;this.context.graph.translateBy([y*L,x*L],!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=kB(()=>{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=Lh(()=>{this.renderMinimap(),this.renderMask()},this.options.delay)}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_DRAW,this.onDraw),t.on(Ae.AFTER_RENDER,this.onRender),t.on(Ae.AFTER_ANIMATE,this.onRender),t.on(Ae.AFTER_TRANSFORM,this.onTransform)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_DRAW,this.onDraw),t.off(Ae.AFTER_RENDER,this.onRender),t.off(Ae.AFTER_ANIMATE,this.onRender),t.off(Ae.AFTER_TRANSFORM,this.onTransform)}renderMinimap(){const t=this.getElements(),e=this.initCanvas();this.setShapes(e,t)}getElements(){const{filter:t}=this.options,{model:e,element:n}=this.context,i=e.getData(),a={nodes:i.nodes.filter(l=>n==null?void 0:n.getElement(Nt(l))),edges:i.edges.filter(l=>{const c=n==null?void 0:n.getElement(Nt(l));return c&&Ix(c)}),combos:i.combos.filter(l=>n==null?void 0:n.getElement(Nt(l)))};if(!t)return a;const{nodes:s,edges:o,combos:A}=a;return{nodes:s.filter(l=>t(Nt(l),"node")),edges:o.filter(l=>t(Nt(l),"edge")),combos:A.filter(l=>t(Nt(l),"combo"))}}setShapes(t,e){const{nodes:n,edges:i,combos:a}=e,{shape:s}=this.options,{element:o}=this.context,A=(l,c)=>{const u=Nt(l),h=o==null?void 0:o.getElement(u);if(!h)return;const d=h.getShape("key");let f;if(typeof s=="string"){const g=s;f=h.getShape(g).cloneNode()}else{const g=s(u,c,h);g===h?f=g.cloneNode(!0):f=g}f.setPosition(d.getPosition()),h.style.zIndex&&(f.style.zIndex=h.style.zIndex),f.id=h.id,t.appendChild(f)};t.removeChildren(),i.forEach(l=>A(l,"edge")),a.forEach(l=>A(l,"combo")),n.forEach(l=>A(l,"node"))}initCanvas(){const{renderer:t,size:[e,n]}=this.options;if(this.canvas){const{width:i,height:a}=this.canvas.getConfig();(e!==i||n!==a)&&this.canvas.resize(e,n),t&&this.canvas.setRenderer(t)}else{const{className:i,position:a,container:s,containerStyle:o}=this.options,[A,l]=T0({renderer:t,width:e,height:n,placement:a,className:"minimap",container:s,containerStyle:o,graphCanvas:this.context.canvas});i&&A.classList.add(i),this.container=A,this.canvas=l}return this.setCamera(),this.canvas}createLandmark(t,e,n){const i=`${t.join(",")}-${e.join(",")}-${n}`;if(this.landmarkMap.has(i))return this.landmarkMap.get(i);const s=this.canvas.getCamera().createLandmark(i,{position:t,focalPoint:e,zoom:n});return this.landmarkMap.set(i,s),s}setCamera(){var t;const{canvas:e}=this.context,n=(t=this.canvas)===null||t===void 0?void 0:t.getCamera();if(!n)return;const{size:[i,a],padding:s}=this.options,[o,A,l,c]=Ua(s),{min:u,max:h,center:d}=e.getBounds("elements"),f=h[0]-u[0],g=h[1]-u[1],v=i-c-A,p=a-o-l,y=v/f,x=p/g,F=Math.min(y,x),O=this.createLandmark(d,d,F);n.gotoLandmark(O,0)}get maskBBox(){const{canvas:t}=this.context,e=t.getSize(),n=t.getCanvasByViewport([0,0]),i=t.getCanvasByViewport(e),a=this.canvas.canvas2Viewport(Fs(n)),s=this.canvas.canvas2Viewport(Fs(i)),o=s.x-a.x,A=s.y-a.y;return[a.x,a.y,o,A]}calculateMaskBBox(){const{size:[t,e]}=this.options;let[n,i,a,s]=this.maskBBox;return n<0&&(a=UA(a+n,t),n=0),i<0&&(s=UA(s+i,e),i=0),n+a>t&&(a=RA(t-n,0)),i+s>e&&(s=RA(e-i,0)),[UA(n,t),UA(i,e),RA(a,0),RA(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()}}I0.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 UA=(r,t)=>Math.min(r,t),RA=(r,t)=>Math.max(r,t);var S1=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};const M1={x1:0,y1:0,x2:0,y2:0,visibility:"hidden"};class N0 extends yi{constructor(t,e){super(t,Object.assign({},N0.defaultOptions,e)),this.initSnapline=()=>{const n=this.context.canvas.getLayer("transient");this.horizontalLine||(this.horizontalLine=n.appendChild(new vl({style:Object.assign(Object.assign({},M1),this.options.horizontalLineStyle)}))),this.verticalLine||(this.verticalLine=n.appendChild(new vl({style:Object.assign(Object.assign({},M1),this.options.verticalLineStyle)})))},this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!0,this.autoSnapToLine=(n,i,a)=>S1(this,void 0,void 0,function*(){const{verticalX:s,horizontalY:o}=a,{tolerance:A}=this.options,{min:[l,c],max:[u,h],center:[d,f]}=i;let g=0,v=0;s!==null&&(Ki(u,s){const{target:i}=n,a=.5;if(this.isHorizontalSticking||this.isVerticalSticking){const[s,o]=this.getDelta(n);if(this.isHorizontalSticking&&this.isVerticalSticking&&Math.abs(s)<=a&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,-o]},!1),!1;if(this.isHorizontalSticking&&Math.abs(o)<=a)return this.context.graph.translateElementBy({[i.id]:[0,-o]},!1),!1;if(this.isVerticalSticking&&Math.abs(s)<=a)return this.context.graph.translateElementBy({[i.id]:[-s,0]},!1),!1;this.isHorizontalSticking=!1,this.isVerticalSticking=!1,this.enableStick=!1,setTimeout(()=>{this.enableStick=!0},200)}return this.enableStick},this.calcSnaplineMetadata=(n,i)=>{const{tolerance:a,shape:s}=this.options,{min:[o,A],max:[l,c],center:[u,h]}=i;let d=null,f=null,g=null,v=null,p=null,y=null;return this.getNodes().some(x=>{if(Pr(n.id,x.id))return!1;const F=iS(x,s).getRenderBounds(),{min:[O,L],max:[U,R],center:[j,q]}=F;return d===null&&(Ki(j,u){this.initSnapline()},this.onDrag=n=>S1(this,void 0,void 0,function*(){const{target:i}=n;if(this.options.autoSnap&&!this.enableSnap(n))return;const a=iS(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 Ix(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||M1.lineWidth||1)/this.context.graph.getZoom()}updateSnapline(t){const{verticalX:e,verticalMinY:n,verticalMaxY:i,horizontalY:a,horizontalMinX:s,horizontalMaxX:o}=t,[A,l]=this.context.canvas.getSize(),{offset:c}=this.options;a!==null?Object.assign(this.horizontalLine.style,{x1:c===1/0?0:s-c,y1:a,x2:c===1/0?A:o+c,y2:a,visibility:"visible",lineWidth:this.getLineWidth("horizontal")}):this.horizontalLine.style.visibility="hidden",e!==null?Object.assign(this.verticalLine.style,{x1:e,y1:c===1/0?0:n-c,x2:e,y2:c===1/0?l:i+c,visibility:"visible",lineWidth:this.getLineWidth("vertical")}):this.verticalLine.style.visibility="hidden"}getDelta(t){const e=this.context.graph.getZoom();return Ms([t.dx,t.dy],e)}bindEvents(){return S1(this,void 0,void 0,function*(){const{graph:t}=this.context;t.on(rs.DRAG_START,this.onDragStart),t.on(rs.DRAG,this.onDrag),t.on(rs.DRAG_END,this.onDragEnd)})}unbindEvents(){const{graph:t}=this.context;t.off(rs.DRAG_START,this.onDragStart),t.off(rs.DRAG,this.onDrag),t.off(rs.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()}}N0.defaultOptions={tolerance:5,offset:20,autoSnap:!0,shape:"key",verticalLineStyle:{stroke:"#1783FF"},horizontalLineStyle:{stroke:"#1783FF"},filter:()=>!0};const Ki=(r,t)=>Math.abs(r-t),iS=(r,t)=>typeof t=="function"?t(r):r.getShape(t);var aS=null,Z_=null;function L0(r){return r instanceof Date?r:new Date(r)}function Y_(r){for(var t=__read(r,2),e=t[0],n=t[1],i=aS.indexOf(e),a=aS.indexOf(n),s="",o=i;o<=a;o+=1)if(s+=Z_[o],o2&&(A=":"),s+=A}return s}function Aa(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 yK(r,t){return L0(r).getTime()-L0(t).getTime()}function wK(r,t){var e=__read([L0(r),L0(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 EK(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),Aa(e,Y_(["year",t]))}function X_(r,t){if(r.length<=t)return r;for(var e=Math.floor(r.length/t),n=[],i=0;i180?1:0,R=r>t?0:1,j=!1;return j?"M".concat(e,",").concat(n,",L").concat(f,",").concat(g,",A").concat(o,",").concat(A,",0,").concat(U,",").concat(R,",").concat(p,",").concat(y,",L").concat(e,",").concat(n):"M".concat(f,",").concat(g,",A").concat(o,",").concat(A,",0,").concat(U,",").concat(R,",").concat(p,",").concat(y)}function hH(r){var t=r.attributes,e=t.startAngle,n=t.endAngle,i=t.center,a=t.radius;return(0,D.ev)((0,D.ev)([e,n],(0,D.CR)(i),!1),[a],!1)}function dH(r,t,e,n){var i=t.startAngle,a=t.endAngle,s=t.center,o=t.radius,A=t.classNamePrefix;return r.selectAll(Xe.line.class).data([{d:fS.apply(void 0,(0,D.ev)((0,D.ev)([i,a],(0,D.CR)(s),!1),[o],!1))}],function(l,c){return c}).join(function(l){var c=l.append("path").attr("className",Xe.line.name).styles(t).styles({d:function(u){return u.d}});return _a(c,Xe.line,Vn.line,A),c},function(l){return l.transition(function(){var c=this,u=lH(this,hH(this),(0,D.ev)((0,D.ev)([i,a],(0,D.CR)(s),!1),[o],!1),n.update);if(u){var h=function(){var d=Fi(c.attributes,"__keyframe_data__");c.style.d=fS.apply(void 0,(0,D.ev)([],(0,D.CR)(d),!1))};u.onframe=h,u.onfinish=h}return u}).styles(t)},function(l){return l.remove()}).styles(e).transitions()}function fH(r,t){var e=t.truncRange,n=t.truncShape,i=t.lineExtension}function gH(r,t,e){e===void 0&&(e=[0,0]);var n=(0,D.CR)([r,t,e],3),i=(0,D.CR)(n[0],2),a=i[0],s=i[1],o=(0,D.CR)(n[1],2),A=o[0],l=o[1],c=(0,D.CR)(n[2],2),u=c[0],h=c[1],d=(0,D.CR)([A-a,l-s],2),f=d[0],g=d[1],v=Math.sqrt(Math.pow(f,2)+Math.pow(g,2)),p=(0,D.CR)([-u/v,h/v],2),y=p[0],x=p[1];return[y*f,y*g,x*f,x*g]}function gS(r){var t=(0,D.CR)(r,2),e=(0,D.CR)(t[0],2),n=e[0],i=e[1],a=(0,D.CR)(t[1],2),s=a[0],o=a[1];return{x1:n,y1:i,x2:s,y2:o}}function vH(r,t,e,n){var i=t.showTrunc,a=t.startPos,s=t.endPos,o=t.truncRange,A=t.lineExtension,l=t.classNamePrefix,c=(0,D.CR)([a,s],2),u=(0,D.CR)(c[0],2),h=u[0],d=u[1],f=(0,D.CR)(c[1],2),g=f[0],v=f[1],p=(0,D.CR)(A?gH(a,s,A):new Array(4).fill(0),4),y=p[0],x=p[1],F=p[2],O=p[3],L=function(xt){return r.selectAll(Xe.line.class).data(xt,function(Dt,Xt){return Xt}).join(function(Dt){var Xt=Dt.append("line").styles(e).transition(function(ne){return ks(this,gS(ne.line),!1)});return Xt.attr("className",function(ne){if(!l)return"".concat(Xe.line.name," ").concat(ne.className);var le=Zh(Xe.line.name,Vn.line,l);if(ne.className===Xe.lineFirst.name){var ge=Zh(Xe.lineFirst.name,Vn.lineFirst,l);return"".concat(le," ").concat(ge)}if(ne.className===Xe.lineSecond.name){var ge=Zh(Xe.lineSecond.name,Vn.lineSecond,l);return"".concat(le," ").concat(ge)}return le}),Xt},function(Dt){return Dt.styles(e).transition(function(Xt){var ne=Xt.line;return ks(this,gS(ne),n.update)})},function(Dt){return Dt.remove()}).transitions()};if(!i||!o)return L([{line:[[h+y,d+x],[g+F,v+O]],className:Xe.line.name}]);var U=(0,D.CR)(o,2),R=U[0],j=U[1],q=g-h,et=v-d,it=(0,D.CR)([h+q*R,d+et*R],2),dt=it[0],ft=it[1],mt=(0,D.CR)([h+q*j,d+et*j],2),Rt=mt[0],Qt=mt[1],yt=L([{line:[[h+y,d+x],[dt,ft]],className:Xe.lineFirst.name},{line:[[Rt,Qt],[g+F,v+O]],className:Xe.lineSecond.name}]);return fH(r,t),yt}function pH(r,t,e,n){var i=e.showArrow,a=e.showTrunc,s=e.lineArrow,o=e.lineArrowOffset,A=e.lineArrowSize,l;if(t==="arc"?l=r.select(Xe.line.class):a?l=r.select(Xe.lineSecond.class):l=r.select(Xe.line.class),!i||!s||e.type==="arc"&&dS(e.startAngle,e.endAngle)){var c=l.node();c&&(c.style.markerEnd=void 0);return}var u=Ho(s);u.attr(n),E1(u,A,!0),l.style("markerEnd",u).style("markerEndOffset",-o)}function mH(r,t,e){var n=t.type,i,a=tn(t,"line");return n==="linear"?i=vH(r,t,N1(a,"arrow"),e):i=dH(r,t,N1(a,"arrow"),e),pH(r,n,t,a),i}function yH(r,t){return k1(r,t.gridDirection,t)}function vS(r){var t=r.type,e=r.gridCenter;return t==="linear"?e:e||r.center}function wH(r,t){var e=t.gridLength;return r.map(function(n,i){var a=n.value,s=(0,D.CR)(U0(a,t),2),o=s[0],A=s[1],l=(0,D.CR)(Go(yH(a,t),e),2),c=l[0],u=l[1];return{id:i,points:[[o,A],[o+c,A+u]]}})}function EH(r,t){var e=t.gridControlAngles,n=vS(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,D.CR)(n,2),a=i[0],s=i[1];return r.map(function(o,A){var l=o.value,c=(0,D.CR)(U0(l,t),2),u=c[0],h=c[1],d=(0,D.CR)([u-a,h-s],2),f=d[0],g=d[1],v=[];return e.forEach(function(p){var y=$c(p),x=(0,D.CR)([Math.cos(y),Math.sin(y)],2),F=x[0],O=x[1],L=f*F-g*O+a,U=f*O+g*F+s;v.push([L,U])}),{points:v,id:A}})}function BH(r,t,e,n){var i=e.classNamePrefix,a=tn(e,"grid"),s=a.type,o=a.areaFill,A=vS(e),l=L1(t,e.gridFilter),c=s==="segment"?wH(l,e):EH(l,e),u=(0,D.pi)((0,D.pi)({},a),{center:A,areaFill:Vt(o)?l.map(function(h,d){return ya(o,[h,d,l])}):o,animate:n,data:c});return r.selectAll(Xe.grid.class).data([1]).join(function(h){var d=h.append(function(){return new aH({style:u})}).attr("className",Xe.grid.name);return _a(d,Xe.grid,Vn.grid,i),d},function(h){return h.transition(function(){return this.update(u)})},function(h){return h.remove()}).transitions()}function Ii(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,y=n-A,x=i-l,F=h*x-d*y;if(F<0===p)return!1;var O=f*x-g*y;return!(O<0===p||F>v===p||O>v===p)}function yS(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 mS(t,n)})}var MK={lineToLine:mS,intersectBoxLine:yS,getBounds:R0};function OH(r,t,e){var n,i,a=R0(r,e).flat(1),s=R0(t,e).flat(1),o=[[a[0],a[1],a[2],a[3]],[a[0],a[1],a[4],a[5]],[a[4],a[5],a[6],a[7]],[a[2],a[3],a[6],a[7]]];try{for(var A=(0,D.XA)(o),l=A.next();!l.done;l=A.next()){var c=l.value;if(yS(s,c))return!0}}catch(u){n={error:u}}finally{try{l&&!l.done&&(i=A.return)&&i.call(A)}finally{if(n)throw n.error}}return!1}function IH(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,D.CR)(a,2),A=o[0],l=o[1],c=n==="negative"?0:i,u=-s-c,h=s+c,d=(0,D.CR)(Oi(t),4),f=d[0],g=d[1],v=d[2],p=d[3];return new U1(A+u-p,l+u-f,A+h+g,l+h+v)}var y=(0,D.CR)(r.startPos,2),x=y[0],F=y[1],O=(0,D.CR)(r.endPos,2),L=O[0],U=O[1],R=(0,D.CR)(hS(r)?[-t,0,t,0]:[0,t,0,-t],4),j=R[0],q=R[1],et=R[2],it=R[3],dt=eu(0,r),ft=Go(dt,i),mt=new U1(x,F,L,U);return mt.x1+=it,mt.y1+=j,mt.x2+=q+ft[0],mt.y2+=et+ft[1],mt}function D0(r,t,e){var n,i,a=t.crossPadding,s=new Set,o=null,A=IH(t,a),l=function(f){return A?TH(A,f):!0},c=function(f,g){return!f||!f.firstChild?!0:!OH(f.firstChild,g.firstChild,Oi(e))};try{for(var u=(0,D.XA)(r),h=u.next();!h.done;h=u.next()){var d=h.value;l(d)?!o||c(o,d)?o=d:(s.add(o),s.add(d)):s.add(d)}}catch(f){n={error:f}}finally{try{h&&!h.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}return Array.from(s)}function R1(r,t){return t===void 0&&(t={}),Re(r)?0:typeof r=="number"?r:Math.floor(F_(r,t))}function NH(r,t,e,n){if(!(r.length<=0)){var i=t.suffix,a=i===void 0?"...":i,s=t.minLength,o=t.maxLength,A=o===void 0?1/0:o,l=t.step,c=l===void 0?" ":l,u=t.margin,h=u===void 0?[0,0,0,0]:u,d=J2(n.getTextShape(r[0])),f=R1(c,d),g=s?R1(s,d):f,v=R1(A,d);(Re(v)||v===1/0)&&(v=Math.max.apply(null,r.map(function(ft){return ft.getBBox().width})));for(var p=r.slice(),y=(0,D.CR)(h,4),x=y[0],F=x===void 0?0:x,O=y[1],L=O===void 0?0:O,U=y[2],R=U===void 0?F:U,j=y[3],q=j===void 0?L:j,et=function(ft){if(p.forEach(function(mt){n.ellipsis(n.getTextShape(mt),ft,a)}),p=D0(r,e,h),p.length<1)return{value:void 0}},it=v;it>g+f;it-=f){var dt=et(it);if(typeof dt=="object")return dt.value}}}var LH=function(r){return r!==void 0&&r!=null&&!Number.isNaN(r)},kH={parity:function(r,t){var e=t.seq,n=e===void 0?2:e;return r.filter(function(i,a){return a%n?(Ns(i),!1):!0})}},QH=function(r){return r.filter(LH)};function UH(r,t,e,n){var i=r.length,a=t.keepHeader,s=t.keepTail;if(!(i<=1||i===2&&a&&s)){var o=kH.parity,A=function(x){return x.forEach(n.show),x},l=2,c=r.slice(),u=r.slice(),h=Math.min.apply(Math,(0,D.ev)([1],(0,D.CR)(r.map(function(x){return x.getBBox().width})),!1));if(e.type==="linear"&&(Q1(e)||hS(e))){var d=X2(r[0]).left,f=X2(r[i-1]).right,g=Math.abs(f-d)||1;l=Math.max(Math.floor(i*h/g),l)}var v,p;for(a&&(v=c.splice(0,1)[0]),s&&(p=c.splice(-1,1)[0],c.reverse()),A(c);lo)){if(e.type==="linear"&&Q1(e)){if(p(o),g())return}else for(var y=f;y<=o;y++)if(p(y),g())return;l&&p(d)}}var _H=new Map([["hide",UH],["rotate",RH],["ellipsis",NH],["wrap",PH]]);function HH(r,t,e){return t.labelOverlap.length<1?!1:e==="hide"?!L4(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 GH(r,t,e,n){var i=t.labelOverlap,a=i===void 0?[]:i;a.length&&a.forEach(function(s){var o=s.type,A=_H.get(o);HH(r,t,o)&&(A==null||A(r,s,t,n,e))})}function zH(){for(var r=[],t=0;th[0]&&R0&&Number.isFinite(r)?t:e},kK=function(r,t){return r*t},QK=function(r,t){return r/2+(t||0)/2},_1=function(r){return r};class OS{constructor(t){this.options=Si({},this.getDefaultOptions()),this.update(t)}getOptions(){return this.options}update(t={}){this.options=Si({},this.options,t),this.rescale(t)}rescale(t){}}function H1(r,t){return t-r?e=>(e-r)/(t-r):e=>.5}function P0(r,...t){return t.reduce((e,n)=>i=>e(n(i)),r)}function o6(r,t,e,n,i){let a=e||0,s=n||r.length;const o=i||(A=>A);for(;at?s=A:a=A+1}return a}var A6=T(75196),l6=T.n(A6);function G1(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 c6(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=G1(s,a,t+1/3),A=G1(s,a,t),l=G1(s,a,t-1/3);return[o*255,A*255,l*255,i]}function IS(r){const t=l6().get(r);if(!t)return null;const{model:e,value:n}=t;return e==="rgb"?n:e==="hsl"?c6(n):null}const _0=(r,t)=>e=>r*(1-e)+t*e,u6=(r,t)=>{const e=IS(r),n=IS(t);return e===null||n===null?e?()=>r:()=>t:i=>{const a=new Array(4);for(let c=0;c<4;c+=1){const u=e[c],h=n[c];a[c]=u*(1-i)+h*i}const[s,o,A,l]=a;return`rgba(${Math.round(s)}, ${Math.round(o)}, ${Math.round(A)}, ${l})`}},h6=(r,t)=>typeof r=="number"&&typeof t=="number"?_0(r,t):typeof r=="string"&&typeof t=="string"?u6(r,t):()=>r,d6=(r,t)=>{const e=_0(r,t);return n=>Math.round(e(n))};function f6(r){return r===null}function NS(r){return!Ze(r)&&!f6(r)&&!Number.isNaN(r)}const z1=Math.sqrt(50),K1=Math.sqrt(10),V1=Math.sqrt(2);function H0(r,t,e){const n=(t-r)/Math.max(0,e),i=Math.floor(Math.log(n)/Math.LN10),a=n/PA(10,i);return i>=0?(a>=z1?10:a>=K1?5:a>=V1?2:1)*PA(10,i):-PA(10,-i)/(a>=z1?10:a>=K1?5:a>=V1?2:1)}function UK(r,t,e){const n=Math.abs(t-r)/Math.max(0,e);let i=PA(10,Math.floor(Math.log(n)/Math.LN10));const a=n/i;return a>=z1?i*=10:a>=K1?i*=5:a>=V1&&(i*=2),t{const n=[r,t];let i=0,a=n.length-1,s=n[i],o=n[a],A;return o0?(s=Math.floor(s/A)*A,o=Math.ceil(o/A)*A,A=H0(s,o,e)):A<0&&(s=Math.ceil(s*A)/A,o=Math.floor(o*A)/A,A=H0(s,o,e)),A>0?(n[i]=Math.floor(s/A)*A,n[a]=Math.ceil(o/A)*A):A<0&&(n[i]=Math.ceil(s*A)/A,n[a]=Math.floor(o*A)/A),n};function v6(r,t){const e=tt?r:t;return i=>Math.min(Math.max(e,i),n)}const p6=(r,t,e)=>{const[n,i]=r,[a,s]=t;let o,A;return n{const n=Math.min(r.length,t.length)-1,i=new Array(n),a=new Array(n),s=r[0]>r[n],o=s?[...r].reverse():r,A=s?[...t].reverse():t;for(let l=0;l{const c=o6(r,l,1,n)-1,u=i[c],h=a[c];return P0(h,u)(l)}},LS=(r,t,e,n)=>(Math.min(r.length,t.length)>2?m6:p6)(r,t,n?d6:e);class y6 extends OS{getDefaultOptions(){return{domain:[0,1],range:[0,1],nice:!1,clamp:!1,round:!1,interpolate:_0,tickCount:5}}map(t){return NS(t)?this.output(t):this.options.unknown}invert(t){return NS(t)?this.input(t):this.options.unknown}nice(){if(!this.options.nice)return;const[t,e,n,...i]=this.getTickMethodOptions();this.options.domain=this.chooseNice()(t,e,n,...i)}getTicks(){const{tickMethod:t}=this.options,[e,n,i,...a]=this.getTickMethodOptions();return t(e,n,i,...a)}getTickMethodOptions(){const{domain:t,tickCount:e}=this.options,n=t[0],i=t[t.length-1];return[n,i,e]}chooseNice(){return g6}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?v6(i[0],i[a-1]):_1}composeOutput(t,e){const{domain:n,range:i,round:a,interpolate:s}=this.options,o=LS(n.map(t),i,s,a);this.output=P0(o,e,t)}composeInput(t,e,n){const{domain:i,range:a}=this.options,s=LS(a,i.map(t),_0);this.input=P0(e,n,s)}}const w6=(r,t,e)=>{let n,i,a=r,s=t;if(a===s&&e>0)return[a];let o=H0(a,s,e);if(o===0||!Number.isFinite(o))return[];if(o>0){a=Math.ceil(a/o),s=Math.floor(s/o),i=new Array(n=Math.ceil(s-a+1));for(let A=0;A`${t}`:typeof r=="object"?t=>JSON.stringify(t):t=>t}class j1 extends OS{getDefaultOptions(){return{domain:[],range:[],unknown:W1}}constructor(t){super(t)}map(t){return this.domainIndexMap.size===0&&US(this.domainIndexMap,this.getDomain(),this.domainKey),RS({value:this.domainKey(t),mapper:this.domainIndexMap,from:this.getDomain(),to:this.getRange(),notFoundReturn:this.options.unknown})}invert(t){return this.rangeIndexMap.size===0&&US(this.rangeIndexMap,this.getRange(),this.rangeKey),RS({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=DS(e),this.rangeKey=DS(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 j1(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 x6(r){const t=Math.min(...r);return r.map(e=>e/t)}function C6(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 S6(r){return Math.round(r*1e12)/1e12}function M6(r){const{domain:t,range:e,paddingOuter:n,paddingInner:i,flex:a,round:s,align:o}=r,A=t.length,l=C6(a,A),[c,u]=e,h=u-c,d=2/A*n+1-1/A*i,f=h/d,g=f*i/A,v=f-A*g,p=x6(l),y=p.reduce((it,dt)=>it+dt),x=v/y,F=new QS(t.map((it,dt)=>{const ft=p[dt]*x;return[it,s?Math.floor(ft):ft]})),O=new QS(t.map((it,dt)=>{const mt=p[dt]*x+g;return[it,s?Math.floor(mt):mt]})),L=Array.from(O.values()).reduce((it,dt)=>it+dt),R=(h-(L-L/A*i))*o,j=c+R;let q=s?Math.round(j):j;const et=new Array(A);for(let it=0;ith+x*c);return{valueStep:c,valueBandWidth:u,adjustedRange:p}}class Z1 extends j1{getDefaultOptions(){return{domain:[],range:[0,1],align:.5,round:!1,paddingInner:0,paddingOuter:0,padding:0,unknown:W1,flex:[]}}constructor(t){super(t)}clone(){return new Z1(this.options)}getStep(t){return this.valueStep===void 0?1:typeof this.valueStep=="number"?this.valueStep:t===void 0?Array.from(this.valueStep.values())[0]:this.valueStep.get(t)}getBandWidth(t){return this.valueBandWidth===void 0?1:typeof this.valueBandWidth=="number"?this.valueBandWidth:t===void 0?Array.from(this.valueBandWidth.values())[0]:this.valueBandWidth.get(t)}getRange(){return this.adjustedRange}getPaddingInner(){const{padding:t,paddingInner:e}=this.options;return t>0?t:e}getPaddingOuter(){const{padding:t,paddingOuter:e}=this.options;return t>0?t:e}rescale(){super.rescale();const{align:t,domain:e,range:n,round:i,flex:a}=this.options,{adjustedRange:s,valueBandWidth:o,valueStep:A}=F6({align:t,range:n,round:i,flex:a,paddingInner:this.getPaddingInner(),paddingOuter:this.getPaddingOuter(),domain:e});this.valueStep=A,this.valueBandWidth=o,this.adjustedRange=s}}var T6=function(r){(0,D.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,D._T)(e,["style"]);return n=r.call(this,Si({},{type:"column"},(0,D.pi)({style:i},a)))||this,n.columnsGroup=new Ai({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,")"),Ne(this.columnsGroup).selectAll(".column").data(n.flat()).join(function(s){return s.append("rect").attr("className","column").each(function(o){this.attr(o)})},function(s){return s.each(function(o){this.attr(o)})},function(s){return s.remove()})},t.prototype.update=function(e){this.attr(Zr({},this.attributes,e)),this.render()},t.prototype.clear=function(){this.removeChildren()},t}(ir),O6=function(r){(0,D.ZT)(t,r);function t(e){var n=this,i=e.style,a=(0,D._T)(e,["style"]);return n=r.call(this,Si({},{type:"lines"},(0,D.pi)({style:i},a)))||this,n.linesGroup=n.appendChild(new Ai),n.areasGroup=n.appendChild(new Ai),n.render(),n}return t.prototype.render=function(){var e=this.attributes,n=e.lines,i=e.areas,a=e.x,s=e.y;this.style.transform="translate(".concat(a,", ").concat(s,")"),n&&this.renderLines(n),i&&this.renderAreas(i)},t.prototype.clear=function(){this.linesGroup.removeChildren(),this.areasGroup.removeChildren()},t.prototype.update=function(e){this.attr(Zr({},this.attributes,e)),this.render()},t.prototype.renderLines=function(e){Ne(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){Ne(this.linesGroup).selectAll(".area").data(e).join(function(n){return n.append("path").attr("className","area").each(function(i){this.attr(i)})},function(n){return n.each(function(i){this.style(i)})},function(n){return n.remove()})},t}(ir);function I6(r,t,e,n){var i,a=[],s=!!n,o,A,l=[1/0,1/0],c=[-1/0,-1/0],u,h,d;if(s){i=(0,D.CR)(n,2),l=i[0],c=i[1];for(var f=0,g=r.length;fs&&(e=(0,D.CR)([s,o],2),o=e[0],s=e[1]),r.map(function(A){var l=A.map(function(c,u){return[n.map(u),dr(i.map(c),o,s)]});return l})}function qh(r,t){t===void 0&&(t=!1);var e=t?r.length-1:0,n=r.map(function(i,a){return(0,D.ev)([a===e?"M":"L"],(0,D.CR)(i),!1)});return t?n.reverse():n}function G0(r,t){if(t===void 0&&(t=!1),r.length<=2)return qh(r);for(var e=[],n=r.length,i=0;i=0;i-=1){var a=r[i],s=qh(a),o=void 0;if(i===0)o=Y1(s,t,e);else{var A=r[i-1],l=qh(A,!0);l[0][0]="L",o=(0,D.ev)((0,D.ev)((0,D.ev)([],(0,D.CR)(s),!1),(0,D.CR)(l),!1),[["Z"]],!1)}n.push(o)}return n}function U6(r,t,e){for(var n=[],i=r.length-1;i>=0;i-=1){var a=r[i],s=G0(a),o=void 0;if(i===0)o=Y1(s,t,e);else{var A=r[i-1],l=G0(A,!0),c=a[0];l[0][0]="L",o=(0,D.ev)((0,D.ev)((0,D.ev)([],(0,D.CR)(s),!1),(0,D.CR)(l),!1),[(0,D.ev)(["M"],(0,D.CR)(c),!1),["Z"]],!1)}n.push(o)}return n}var R6=function(r,t){if(Qi(r)){for(var e,n=1/0,i=0;in&&(e=a,n=s)}return e}};function PS(r){return r.length===0?[0,0]:[ic(R6(r,function(t){return ic(t)||0})),ac(D6(r,function(t){return ac(t)||0}))]}function _S(r){for(var t=Dc(r),e=t[0].length,n=(0,D.CR)([Array(e).fill(0),Array(e).fill(0)],2),i=n[0],a=n[1],s=0;s=0?(o[A]+=i[A],i[A]=o[A]):(o[A]+=a[A],a[A]=o[A]);return t}var P6=function(r){(0,D.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=Dc(e);return ye(n[0])?[n]:n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"data",{get:function(){return this.attributes.isStack?_S(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,D.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=tn(this.attributes,"area"),A=tn(this.attributes,"line"),l=this.containerShape.width,c=this.data;if(c[0].length===0)return{lines:[],areas:[]};var u=this.scales,h=u.x,d=u.y,f=L6(c,{type:"line",x:h,y:d}),g=[];if(o){var v=this.baseline;a?g=s?U6(f,l,v):Q6(f,l,v):g=k6(f,s,l,v)}return{lines:f.map(function(p,y){return(0,D.pi)({stroke:e.getColor(y),d:s?G0(p):qh(p)},A)}),areas:g.map(function(p,y){return(0,D.pi)({d:p,fill:e.getColor(y)},o)})}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"columnsStyle",{get:function(){var e=this,n=tn(this.attributes,"column"),i=this.attributes,a=i.isStack,s=i.type,o=i.scale;if(s!=="column")throw new Error("columnsStyle can only be used in column type");var A=this.containerShape.height,l=this.rawData;if(!l)return{columns:[]};a&&(l=_S(l));var c=this.createScales(l),u=c.x,h=c.y,d=(0,D.CR)(PS(l),2),f=d[0],g=d[1],v=new Jh({domain:[0,g-(f>0?0:f)],range:[0,A*o]}),p=u.getBandWidth(),y=this.rawData;return{columns:l.map(function(x,F){return x.map(function(O,L){var U=p/l.length,R=function(){return{x:u.map(L)+U*F,y:O>=0?h.map(O):h.map(0),width:U,height:v.map(Math.abs(O))}},j=function(){return{x:u.map(L),y:h.map(O),width:p,height:v.map(y[F][L])}};return(0,D.pi)((0,D.pi)({fill:e.getColor(F)},n),a?j():R())})})}},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){z4(n,".container","rect").attr("className","container").node();var i=e.type,a=e.x,s=e.y,o="spark".concat(i),A=(0,D.pi)({x:a,y:s},i==="line"?this.linesStyle:this.columnsStyle);Ne(n).selectAll(".spark").data([i]).join(function(l){return l.append(function(c){return c==="line"?new O6({className:o,style:A}):new T6({className:o,style:A})}).attr("className","spark ".concat(o))},function(l){return l.update(A)},function(l){return l.remove()})},t.prototype.getColor=function(e){var n=this.attributes.color;return Qi(n)?n[e%n.length]:Vt(n)?n.call(null,e):n},t.prototype.createScales=function(e){var n,i,a=this.attributes,s=a.type,o=a.scale,A=a.range,l=A===void 0?[]:A,c=a.spacing,u=this.containerShape,h=u.width,d=u.height,f=(0,D.CR)(PS(e),2),g=f[0],v=f[1],p=new Jh({domain:[(n=l[0])!==null&&n!==void 0?n:g,(i=l[1])!==null&&i!==void 0?i:v],range:[d,d*(1-o)]});return s==="line"?{type:s,x:new Jh({domain:[0,e[0].length-1],range:[0,h]}),y:p}:{type:s,x:new Z1({domain:e[0].map(function(y,x){return x}),range:[0,h],paddingInner:c,paddingOuter:c/2,align:.5}),y:p}},t.tag="sparkline",t}(Mr),HS={fill:"#fff",lineWidth:1,radius:2,size:10,stroke:"#bfbfbf",strokeOpacity:1,zIndex:0},GS={fill:"#000",fillOpacity:.45,fontSize:12,textAlign:"center",textBaseline:"middle",zIndex:1},zS={x:0,y:0,orientation:"horizontal",showLabel:!0,type:"start"},co=Ls({foreground:"foreground",handle:"handle",selection:"selection",sparkline:"sparkline",sparklineGroup:"sparkline-group",track:"track",brushArea:"brush-area"},"slider"),ss=Ls({labelGroup:"label-group",label:"label",iconGroup:"icon-group",icon:"icon",iconRect:"icon-rect",iconLine:"icon-line"},"handle"),_6=function(r){(0,D.ZT)(t,r);function t(){return r!==null&&r.apply(this,arguments)||this}return t.prototype.render=function(e,n){var i=e.x,a=e.y,s=e.size,o=s===void 0?10:s,A=e.radius,l=A===void 0?o/4:A,c=e.orientation,u=e.classNamePrefix,h=(0,D._T)(e,["x","y","size","radius","orientation","classNamePrefix"]),d=o,f=d*2.4,g=u?"".concat(ss.iconRect.name," ").concat(u,"handle-icon-rect"):ss.iconRect.name,v=function(L){return u?"".concat(ss.iconLine,"-").concat(L," ").concat(u,"handle-icon-line"):"".concat(ss.iconLine,"-").concat(L)},p=Ne(n).maybeAppendByClassName(ss.iconRect,"rect").attr("className",g).styles((0,D.pi)((0,D.pi)({},h),{width:d,height:f,radius:l,x:i-d/2,y:a-f/2,transformOrigin:"center"})),y=i+1/3*d-d/2,x=i+2/3*d-d/2,F=a+1/4*f-f/2,O=a+3/4*f-f/2;p.maybeAppendByClassName("".concat(ss.iconLine,"-1"),"line").attr("className",v(1)).styles((0,D.pi)({x1:y,x2:y,y1:F,y2:O},h)),p.maybeAppendByClassName("".concat(ss.iconLine,"-2"),"line").attr("className",v(2)).styles((0,D.pi)({x1:x,x2:x,y1:F,y2:O},h)),c==="vertical"&&(p.node().style.transform="rotate(90)")},t}(Mr),H6=function(r){(0,D.ZT)(t,r);function t(e){return r.call(this,e,zS)||this}return t.prototype.renderLabel=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.showLabel,A=tn(this.attributes,"label"),l=A.x,c=l===void 0?0:l,u=A.y,h=u===void 0?0:u,d=A.transform,f=A.transformOrigin,g=(0,D._T)(A,["x","y","transform","transformOrigin"]),v=(0,D.CR)(_o(g,[]),2),p=v[0],y=v[1],x=Ne(e).maybeAppendByClassName(ss.labelGroup,"g").styles(y),F=(0,D.pi)((0,D.pi)({},GS),p),O=F.text,L=(0,D._T)(F,["text"]);ma(!!o,x,function(U){n.label=U.maybeAppendByClassName(ss.label,"text").styles((0,D.pi)((0,D.pi)({},L),{x:a+c,y:s+h,transform:d,transformOrigin:f,text:"".concat(O)})),n.label.on("mousedown",function(R){R.stopPropagation()}),n.label.on("touchstart",function(R){R.stopPropagation()})})},t.prototype.renderIcon=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.orientation,o=n.type,A=n.classNamePrefix,l=(0,D.pi)((0,D.pi)({x:i,y:a,orientation:s,classNamePrefix:A},HS),tn(this.attributes,"icon")),c=this.attributes.iconShape,u=c===void 0?function(){return new _6({style:l})}:c,h=Ne(e).maybeAppendByClassName(ss.iconGroup,"g");h.selectAll(ss.icon.class).data([u]).join(function(d){return d.append(typeof u=="string"?u:function(){return u(o)}).attr("className",ss.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}(Mr),G6=function(r){(0,D.ZT)(t,r);function t(e){var n=r.call(this,e,(0,D.pi)((0,D.pi)((0,D.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},Jc(zS,"handle")),Jc(HS,"handleIcon")),Jc(GS,"handleLabel")))||this;return n.range=[0,1],n.onDragStart=function(i){return function(a){a.stopPropagation(),n.target=i,n.prevPos=n.getOrientVal(TS(a));var s=n.availableSpace,o=s.x,A=s.y,l=n.getBBox(),c=l.x,u=l.y;n.selectionStartPos=n.getRatio(n.prevPos-n.getOrientVal([o,A])-n.getOrientVal([+c,+u])),n.selectionWidth=0,document.addEventListener("pointermove",n.onDragging),document.addEventListener("pointerup",n.onDragEnd)}},n.onDragging=function(i){var a=n.attributes,s=a.slidable,o=a.brushable,A=a.type;i.stopPropagation();var l=n.getOrientVal(TS(i)),c=l-n.prevPos;if(c){var u=n.getRatio(c);switch(n.target){case"start":s&&n.setValuesOffset(u);break;case"end":s&&n.setValuesOffset(0,u);break;case"selection":s&&n.setValuesOffset(u,u);break;case"track":if(!o)return;n.selectionWidth+=u,A==="range"?n.innerSetValues([n.selectionStartPos,n.selectionStartPos+n.selectionWidth].sort(),!0):n.innerSetValues([0,n.selectionStartPos+n.selectionWidth],!0);break;default:break}n.prevPos=l}},n.onDragEnd=function(){document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointermove",n.onDragging),document.removeEventListener("pointerup",n.onDragEnd),n.target="",n.updateHandlesPosition(!1)},n.onValueChange=function(i){var a=n.attributes,s=a.onChange,o=a.type,A=o==="range"?i:i[1],l=o==="range"?n.getValues():n.getValues()[1],c=new Wr("valuechange",{detail:{oldValue:A,value:l}});n.dispatchEvent(c),s==null||s(l)},n.selectionStartPos=0,n.selectionWidth=0,n.prevPos=0,n.target="",n}return Object.defineProperty(t.prototype,"values",{get:function(){return this.attributes.values},set:function(e){this.attributes.values=this.clampValues(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sparklineStyle",{get:function(){var e=this.attributes.orientation;if(e!=="horizontal")return null;var n=tn(this.attributes,"sparkline");return(0,D.pi)((0,D.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,D.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,D.CR)(Oi(a),4),o=s[0],A=s[1],l=s[2],c=s[3],u=this.shape,h=u.width,d=u.height;return{x:c,y:o,width:h-(c+A),height:d-(o+l)}},enumerable:!1,configurable:!0}),t.prototype.getValues=function(){return this.values},t.prototype.setValues=function(e,n){e===void 0&&(e=[0,0]),n===void 0&&(n=!1),this.attributes.values=e;var i=n===!1?!1:this.attributes.animate;this.updateSelectionArea(i),this.updateHandlesPosition(i)},t.prototype.updateSelectionArea=function(e){var n=this.calcSelectionArea();this.foregroundGroup.selectAll(co.selection.class).each(function(i,a){ks(this,n[a],e)})},t.prototype.updateHandlesPosition=function(e){this.attributes.showHandle&&(this.startHandle&&ks(this.startHandle,this.getHandleStyle("start"),e),this.endHandle&&ks(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=tn(this.attributes,"track");this.trackShape=Ne(e).maybeAppendByClassName(co.track,"rect").styles((0,D.pi)((0,D.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=Ne(e).maybeAppendByClassName(co.brushArea,"rect").styles((0,D.pi)({x:i,y:a,fill:"transparent",cursor:s?"crosshair":"default"},this.shape))},t.prototype.renderSparkline=function(e){var n=this,i=this.attributes,a=i.x,s=i.y,o=i.orientation,A=Ne(e).maybeAppendByClassName(co.sparklineGroup,"g");ma(o==="horizontal",A,function(l){var c=(0,D.pi)((0,D.pi)({},n.sparklineStyle),{x:a,y:s});l.maybeAppendByClassName(co.sparkline,function(){return new P6({style:c})}).update(c)})},t.prototype.renderHandles=function(){var e=this,n,i=this.attributes,a=i.showHandle,s=i.type,o=s==="range"?["start","end"]:["end"],A=a?o:[],l=this;(n=this.foregroundGroup)===null||n===void 0||n.selectAll(co.handle.class).data(A.map(function(c){return{type:c}}),function(c){return c.type}).join(function(c){return c.append(function(u){var h=u.type;return new H6({style:e.getHandleStyle(h)})}).each(function(u){var h=u.type;this.attr("class","".concat(co.handle.name," ").concat(h,"-handle"));var d="".concat(h,"Handle");l[d]=this,this.addEventListener("pointerdown",l.onDragStart(h))})},function(c){return c.each(function(u){var h=u.type;this.update(l.getHandleStyle(h))})},function(c){return c.each(function(u){var h=u.type,d="".concat(h,"Handle");l[d]=void 0}).remove()})},t.prototype.renderSelection=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.type,o=n.selectionType;this.foregroundGroup=Ne(e).maybeAppendByClassName(co.foreground,"g");var A=tn(this.attributes,"selection"),l=function(u){return u.style("visibility",function(h){return h.show?"visible":"hidden"}).style("cursor",function(h){return o==="select"?"grab":o==="invert"?"crosshair":"default"}).styles((0,D.pi)((0,D.pi)({},A),{transform:"translate(".concat(i,", ").concat(a,")")}))},c=this;this.foregroundGroup.selectAll(co.selection.class).data(s==="value"?[]:this.calcSelectionArea().map(function(u,h){return{style:(0,D.pi)({},u),index:h,show:o==="select"?h===1:h!==1}}),function(u){return u.index}).join(function(u){return u.append("rect").attr("className",co.selection.name).call(l).each(function(h,d){var f=this;d===1?(c.selectionShape=Ne(this),this.on("pointerdown",function(g){f.attr("cursor","grabbing"),c.onDragStart("selection")(g)}),c.dispatchCustomEvent(this,"pointerenter","selectionMouseenter"),c.dispatchCustomEvent(this,"pointerleave","selectionMouseleave"),c.dispatchCustomEvent(this,"click","selectionClick"),this.addEventListener("pointerdown",function(){f.attr("cursor","grabbing")}),this.addEventListener("pointerup",function(){f.attr("cursor","pointer")}),this.addEventListener("pointerover",function(){f.attr("cursor","pointer")})):this.on("pointerdown",c.onDragStart("track"))})},function(u){return u.call(l)},function(u){return u.remove()}),this.updateSelectionArea(!1),this.renderHandles()},t.prototype.render=function(e,n){this.renderTrack(n),this.renderSparkline(n),this.renderBrushArea(n),this.renderSelection(n)},t.prototype.clampValues=function(e,n){var i;n===void 0&&(n=4);var a=(0,D.CR)(this.range,2),s=a[0],o=a[1],A=(0,D.CR)(this.getValues().map(function(v){return P1(v,n)}),2),l=A[0],c=A[1],u=Array.isArray(e)?e:[l,e!=null?e:c],h=(0,D.CR)((u||[l,c]).map(function(v){return P1(v,n)}),2),d=h[0],f=h[1];if(this.attributes.type==="value")return[0,dr(f,s,o)];d>f&&(i=(0,D.CR)([f,d],2),d=i[0],f=i[1]);var g=f-d;return g>o-s?[s,o]:do?c===o&&l===d?[d,o]:[o-g,o]:[d,f]},t.prototype.calcSelectionArea=function(e){var n=(0,D.CR)(this.clampValues(e),2),i=n[0],a=n[1],s=this.availableSpace,o=s.x,A=s.y,l=s.width,c=s.height;return this.getOrientVal([[{y:A,height:c,x:o,width:i*l},{y:A,height:c,x:i*l+o,width:(a-i)*l},{y:A,height:c,x:a*l,width:(1-a)*l}],[{x:o,width:l,y:A,height:i*c},{x:o,width:l,y:i*c+A,height:(a-i)*c},{x:o,width:l,y:a*c,height:(1-a)*c}]])},t.prototype.calcHandlePosition=function(e){var n=this.attributes.handleIconOffset,i=this.availableSpace,a=i.x,s=i.y,o=i.width,A=i.height,l=(0,D.CR)(this.clampValues(),2),c=l[0],u=l[1],h=e==="start"?-n:n,d=(e==="start"?c:u)*this.getOrientVal([o,A])+h;return{x:a+this.getOrientVal([d,o/2]),y:s+this.getOrientVal([A/2,d])}},t.prototype.inferTextStyle=function(e){var n=this.attributes.orientation;return n==="horizontal"?{}:e==="start"?{transformOrigin:"left center",transform:"rotate(90)",textAlign:"start"}:e==="end"?{transformOrigin:"right center",transform:"rotate(90)",textAlign:"end"}:{}},t.prototype.calcHandleText=function(e){var n,i=this.attributes,a=i.type,s=i.orientation,o=i.formatter,A=i.autoFitLabel,l=tn(this.attributes,"handle"),c=tn(l,"label"),u=l.spacing,h=this.getHandleSize(),d=this.clampValues(),f=e==="start"?d[0]:d[1],g=o(f),v=new m1({style:(0,D.pi)((0,D.pi)((0,D.pi)({},c),this.inferTextStyle(e)),{text:g})}),p=v.getBBox(),y=p.width,x=p.height;if(v.destroy(),!A){if(a==="value")return{text:g,x:0,y:-x-u};var F=u+h+(s==="horizontal"?y/2:0);return n={text:g},n[s==="horizontal"?"x":"y"]=e==="start"?-F:F,n}var O=0,L=0,U=this.availableSpace,R=U.width,j=U.height,q=this.calcSelectionArea()[1],et=q.x,it=q.y,dt=q.width,ft=q.height,mt=u+h;if(s==="horizontal"){var Rt=mt+y/2;if(e==="start"){var Qt=et-mt-y;O=Qt>0?-Rt:Rt}else{var yt=R-et-dt-mt>y;O=yt?Rt:-Rt}}else{var xt=mt,Dt=x+mt;e==="start"?L=it-h>x?-Dt:xt:L=j-(it+ft)-h>x?Dt:-xt}return{x:O,y:L,text:g}},t.prototype.getHandleLabelStyle=function(e){var n=tn(this.attributes,"handleLabel");return(0,D.pi)((0,D.pi)((0,D.pi)({},n),this.calcHandleText(e)),this.inferTextStyle(e))},t.prototype.getHandleIconStyle=function(){var e=this.attributes.handleIconShape,n=tn(this.attributes,"handleIcon"),i=this.getOrientVal(["ew-resize","ns-resize"]),a=this.getHandleSize();return(0,D.pi)({cursor:i,shape:e,size:a},n)},t.prototype.getHandleStyle=function(e){var n=this.attributes,i=n.x,a=n.y,s=n.showLabel,o=n.showLabelOnInteraction,A=n.orientation,l=this.calcHandlePosition(e),c=l.x,u=l.y,h=this.calcHandleText(e),d=s;return!s&&o&&(this.target?d=!0:d=!1),(0,D.pi)((0,D.pi)((0,D.pi)({},Jc(this.getHandleIconStyle(),"icon")),Jc((0,D.pi)((0,D.pi)({},this.getHandleLabelStyle(e)),h),"label")),{transform:"translate(".concat(c+i,", ").concat(u+a,")"),orientation:A,showLabel:d,type:e,zIndex:3})},t.prototype.getHandleSize=function(){var e=this.attributes,n=e.handleIconSize,i=e.width,a=e.height;return n||Math.floor((this.getOrientVal([+a,+i])+4)/2.4)},t.prototype.getOrientVal=function(e){var n=(0,D.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,D.CR)(this.getValues(),2),s=a[0],o=a[1],A=i==="range"?e:0,l=[s+A,o+n].sort();this.innerSetValues(l,!0)},t.prototype.getRatio=function(e){var n=this.availableSpace,i=n.width,a=n.height;return e/this.getOrientVal([i,a])},t.prototype.dispatchCustomEvent=function(e,n,i){var a=this;e.on(n,function(s){s.stopPropagation(),a.dispatchEvent(new Wr(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}(Mr),z6={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},X1=Ls({background:"background",labelGroup:"label-group",label:"label"},"indicator"),K6=function(r){(0,D.ZT)(t,r);function t(e){var n=r.call(this,e,z6)||this;return n.point=[0,0],n.group=n.appendChild(new Ai({})),n.isMutationObserved=!0,n}return t.prototype.renderBackground=function(){if(this.label){var e=this.attributes,n=e.position,i=e.padding,a=(0,D.CR)(Oi(i),4),s=a[0],o=a[1],A=a[2],l=a[3],c=this.label.node().getLocalBounds(),u=c.min,h=c.max,d=new Gi(u[0]-l,u[1]-s,h[0]+o-u[0]+l,h[1]+A-u[1]+s),f=this.getPath(n,d),g=tn(this.attributes,"background");this.background=Ne(this.group).maybeAppendByClassName(X1.background,"path").styles((0,D.pi)((0,D.pi)({},g),{d:f})),this.group.appendChild(this.label.node())}},t.prototype.renderLabel=function(){var e=this.attributes,n=e.formatter,i=e.labelText,a=tn(this.attributes,"label"),s=(0,D.CR)(_o(a),2),o=s[0],A=s[1],l=o.text,c=(0,D._T)(o,["text"]);if(this.label=Ne(this.group).maybeAppendByClassName(X1.labelGroup,"g").styles(A),!!i){var u=this.label.maybeAppendByClassName(X1.label,function(){return Ho(n(i))}).style("text",n(i).toString());u.selectAll("text").styles(c)}},t.prototype.adjustLayout=function(){var e=(0,D.CR)(this.point,2),n=e[0],i=e[1],a=this.attributes,s=a.x,o=a.y;this.group.attr("transform","translate(".concat(s-n,", ").concat(o-i,")"))},t.prototype.getPath=function(e,n){var i=this.attributes.radius,a=n.x,s=n.y,o=n.width,A=n.height,l=[["M",a+i,s],["L",a+o-i,s],["A",i,i,0,0,1,a+o,s+i],["L",a+o,s+A-i],["A",i,i,0,0,1,a+o-i,s+A],["L",a+i,s+A],["A",i,i,0,0,1,a,s+A-i],["L",a,s+i],["A",i,i,0,0,1,a+i,s],["Z"]],c={top:4,right:6,bottom:0,left:2},u=c[e],h=this.createCorner([l[u].slice(-2),l[u+1].slice(-2)]);return l.splice.apply(l,(0,D.ev)([u+1,1],(0,D.CR)(h),!1)),l[0][0]="M",l},t.prototype.createCorner=function(e,n){n===void 0&&(n=10);var i=.8,a=C_.apply(void 0,(0,D.ev)([],(0,D.CR)(e),!1)),s=(0,D.CR)(e,2),o=(0,D.CR)(s[0],2),A=o[0],l=o[1],c=(0,D.CR)(s[1],2),u=c[0],h=c[1],d=(0,D.CR)(a?[u-A,[A,u]]:[h-l,[l,h]],2),f=d[0],g=(0,D.CR)(d[1],2),v=g[0],p=g[1],y=f/2,x=f/Math.abs(f),F=n*x,O=F/2,L=F*Math.sqrt(3)/2*i,U=(0,D.CR)([v,v+y-O,v+y,v+y+O,p],5),R=U[0],j=U[1],q=U[2],et=U[3],it=U[4];return a?(this.point=[q,l-L],[["L",R,l],["L",j,l],["L",q,l-L],["L",et,l],["L",it,l]]):(this.point=[A+L,q],[["L",A,R],["L",A,j],["L",A+L,q],["L",A,et],["L",A,it]])},t.prototype.applyVisibility=function(){var e=this.attributes.visibility;e==="hidden"?Ns(this):Vh(this)},t.prototype.bindEvents=function(){this.label.on(yn.BOUNDS_CHANGED,this.renderBackground)},t.prototype.render=function(){this.renderLabel(),this.renderBackground(),this.adjustLayout(),this.applyVisibility()},t}(Mr),V6=function(r){(0,D.ZT)(t,r);function t(e){var n=r.call(this,Zr({},t.defaultOptions,e))||this;return n.hoverColor="#f5f5f5",n.selectedColor="#e6f7ff",n.background=n.appendChild(new Ci({})),n.label=n.background.appendChild(new Ai({})),n}return Object.defineProperty(t.prototype,"padding",{get:function(){return Oi(this.style.padding)},enumerable:!1,configurable:!0}),t.prototype.renderLabel=function(){var e=this.style,n=e.label,i=e.value,a=tn(this.attributes,"label");Ne(this.label).maybeAppend(".label",function(){return Ho(n)}).attr("className","label").styles(a),this.label.attr("__data__",i)},t.prototype.renderBackground=function(){var e=this.label.getBBox(),n=(0,D.CR)(this.padding,4),i=n[0],a=n[1],s=n[2],o=n[3],A=e.width,l=e.height,c=A+o+a,u=l+i+s,h=tn(this.attributes,"background"),d=this.style,f=d.width,g=f===void 0?0:f,v=d.height,p=v===void 0?0:v,y=d.selected;this.background.attr((0,D.pi)((0,D.pi)({},h),{width:Math.max(c,g),height:Math.max(u,p),fill:y?this.selectedColor:"#fff"})),this.label.attr({transform:"translate(".concat(o,", ").concat((u-l)/2,")")})},t.prototype.render=function(){this.renderLabel(),this.renderBackground()},t.prototype.bindEvents=function(){var e=this;this.addEventListener("pointerenter",function(){e.style.selected||e.background.attr("fill",e.hoverColor)}),this.addEventListener("pointerleave",function(){e.style.selected||e.background.attr("fill",e.style.backgroundFill)});var n=this;this.addEventListener("click",function(){var i=e.style,a=i.label,s=i.value,o=i.onClick;o==null||o(s,{label:a,value:s},n)})},t.defaultOptions={style:{value:"",label:"",cursor:"pointer"}},t}(Mr),W6=function(r){(0,D.ZT)(t,r);function t(e){var n,i,a=r.call(this,Zr({},t.defaultOptions,e))||this;a.currentValue=(n=t.defaultOptions.style)===null||n===void 0?void 0:n.defaultValue,a.isPointerInSelect=!1,a.select=a.appendChild(new Ci({className:"select",style:{cursor:"pointer",width:0,height:0}})),a.dropdown=a.appendChild(new Ci({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 Oi(this.style.dropdownPadding)},enumerable:!1,configurable:!0}),t.prototype.renderSelect=function(){var e=this,n,i=this.style,a=i.x,s=i.y,o=i.width,A=i.height,l=i.bordered,c=i.showDropdownIcon,u=tn(this.attributes,"select"),h=tn(this.attributes,"placeholder");this.select.attr((0,D.pi)((0,D.pi)({x:a,y:s,width:o,height:A},u),{fill:"#fff",strokeWidth:l?1:0}));var d=this.dropdownPadding,f=10;c&&Ne(this.select).maybeAppend(".dropdown-icon","path").style("d","M-5,-3.5 L0,3.5 L5,-3.5").style("transform","translate(".concat(a+o-f-d[1]-d[3],", ").concat(s+A/2,")")).style("lineWidth",1).style("stroke",this.select.style.stroke);var g=(n=this.style.options)===null||n===void 0?void 0:n.find(function(x){return x.value===e.currentValue}),v=(0,D.pi)({x:a+d[3]},h);Ne(this.select).selectAll(".placeholder").data(g?[]:[1]).join(function(x){return x.append("text").attr("className","placeholder").styles(v).style("y",function(){var F=this.getBBox();return s+(A-F.height)/2})},function(x){return x.styles(v)},function(x){return x.remove()});var p=tn(this.attributes,"optionLabel"),y=(0,D.pi)({x:a+d[3]},p);Ne(this.select).selectAll(".value").data(g?[g]:[]).join(function(x){return x.append(function(F){return Ho(F.label)}).attr("className","value").styles(y).style("y",function(){var F=this.getBBox();return s+(A-F.height)/2})},function(x){return x.styles(y)},function(x){return x.remove()})},t.prototype.renderDropdown=function(){var e=this,n,i,a=this.style,s=a.x,o=a.y,A=a.width,l=a.height,c=a.options,u=a.onSelect,h=a.open,d=tn(this.attributes,"dropdown"),f=tn(this.attributes,"option"),g=this.dropdownPadding;Ne(this.dropdown).maybeAppend(".dropdown-container","g").attr("className","dropdown-container").selectAll(".dropdown-item").data(c,function(y){return y.value}).join(function(y){return y.append(function(x){return new V6({className:"dropdown-item",style:(0,D.pi)((0,D.pi)((0,D.pi)({},x),f),{width:A-g[1]-g[3],selected:x.value===e.currentValue,onClick:function(F,O,L){e.setValue(F),u==null||u(F,O,L),e.dispatchEvent(new Wr("change",{detail:{value:F,option:O,item:L}})),Ns(e.dropdown)}})})}).each(function(x,F){var O,L=(O=this.parentNode)===null||O===void 0?void 0:O.children,U=L.reduce(function(R,j,q){return qa.time?1:0};return e.sort(n)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"space",{get:function(){var e=this.attributes,n=e.x,i=e.y,a=e.width,s=e.height,o=e.type,A=e.controllerHeight,l=dr(+s-A,0,+s),c=new Gi(n,i+ +s-A,+a,A),u,h=0;o==="chart"?(h=35,u=new Gi(n,i+l-h,+a,h)):u=new Gi;var d=o==="time"?10:l,f=new Gi(n,i+(o==="time"?l:l-d),+a,d-h);return{axisBBox:u,controllerBBox:c,timelineBBox:f}},enumerable:!1,configurable:!0}),t.prototype.setBySliderValues=function(e){var n,i,a=this.data,s=(0,D.CR)(Array.isArray(e)?e:[0,e],2),o=s[0],A=s[1],l=a.length,c=a[Math.floor(o*l)],u=a[Math.ceil(A*l)-(Array.isArray(e)?0:1)];this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:a[0].time,(i=u==null?void 0:u.time)!==null&&i!==void 0?i:1/0]},t.prototype.setByTimebarValues=function(e){var n,i,a,s=this.data,o=(0,D.CR)(Array.isArray(e)?e:[void 0,e],2),A=o[0],l=o[1],c=s.find(function(h){var d=h.time;return d===A}),u=s.find(function(h){var d=h.time;return d===l});this.states.values=[(n=c==null?void 0:c.time)!==null&&n!==void 0?n:(i=s[0])===null||i===void 0?void 0:i.time,(a=u==null?void 0:u.time)!==null&&a!==void 0?a:1/0]},t.prototype.setByIndex=function(e){var n,i,a,s,o=this.data,A=(0,D.CR)(e,2),l=A[0],c=A[1];this.states.values=[(i=(n=o[l])===null||n===void 0?void 0:n.time)!==null&&i!==void 0?i:o[0].time,(s=(a=this.data[c])===null||a===void 0?void 0:a.time)!==null&&s!==void 0?s:1/0]},Object.defineProperty(t.prototype,"sliderValues",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=(0,D.CR)(Array.isArray(n)?n:[void 0,n],2),s=a[0],o=a[1],A=this.data,l=A.length,c=i==="value",u=function(){var d=A.findIndex(function(f){var g=f.time;return g===s});return c?0:d>-1?d/l:0},h=function(){if(o===1/0)return 1;var d=A.findIndex(function(f){var g=f.time;return g===o});return d>-1?d/l:c?.5:1};return[u(),h()]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"values",{get:function(){var e=this.states,n=e.values,i=e.selectionType,a=(0,D.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 s5({style:{type:i,height:n,iconSize:n/6}})}:function(){return new vl({style:{x1:0,y1:-n/2,x2:0,y2:n/2,lineWidth:2,stroke:"#c8c8c8"}})}},enumerable:!1,configurable:!0}),t.prototype.getChartStyle=function(e){var n=this,i=e.x,a=e.y,s=e.width,o=e.height,A=this.states,l=A.selectionType,c=A.chartType,u=this.data,h=this.attributes,d=h.type,f=h.labelFormatter,g=tn(this.attributes,"chart"),v=g.type,p=(0,D._T)(g,["type"]),y=l==="range";if(d==="time")return(0,D.pi)({handleIconShape:function(){return new a5({})},selectionFill:"#2e7ff8",selectionFillOpacity:1,showLabelOnInteraction:!0,handleLabelDy:y?-15:0,autoFitLabel:y,handleSpacing:y?-15:0,trackFill:"#edeeef",trackLength:s,trackOpacity:.5,trackRadius:o/2,trackSize:o/2,type:l,values:this.sliderValues,formatter:function(O){if(f)return f(O);var L=n.getDatumByRatio(O).time;return typeof L=="number"?VS(L):Aa(L,"YYYY-MM-DD HH:mm:ss")},transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p);var x=l==="range"?5:0,F=u.map(function(O){var L=O.value;return L});return(0,D.pi)({handleIconOffset:x,handleIconShape:this.chartHandleIconShape,selectionFill:"#fff",selectionFillOpacity:.5,selectionType:"invert",sparklineSpacing:.1,sparklineColumnLineWidth:0,sparklineColor:"#d4e5fd",sparklineAreaOpacity:1,sparklineAreaLineWidth:0,sparklineData:F,sparklineType:c,sparklineScale:.8,trackLength:s,trackSize:o,type:l,values:this.sliderValues,transform:"translate(".concat(i,", ").concat(a,")"),zIndex:1},p)},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=tn(this.attributes,"axis"),A=e.x,l=e.y,c=e.width,u=(0,D.ev)((0,D.ev)([],(0,D.CR)(n),!1),[{time:0}],!1).map(function(d,f,g){var v=d.time;return{label:"".concat(v),value:f/(g.length-1),time:v}}),h=(0,D.pi)({startPos:[A,l],endPos:[A+c,l],data:u,labelFilter:function(d,f){return fa?A==="value"?[0,0]:l==="acc"?[U(O),U(O)]:[0,U(L-O)]:O<0?l==="acc"?[0,U(L)]:[U(O+a-L),a]:[U(O),U(L)]},y=p(v);return this.setByIndex(y),this.updateSelection(),y},t.prototype.internalBackward=function(e){var n,i,a=this.moveSelection("backward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onBackward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.backward=function(){this.internalBackward()},t.prototype.internalPlay=function(e){var n=this,i,a,s=this.data,o=this.attributes.loop,A=this.states.speed,l=A===void 0?1:A;this.playInterval=window.setInterval(function(){var c=n.internalForward();c[1]===s.length&&!o&&(n.internalPause(),n.renderController())},1e3/l),this.states.state="play",!e&&((a=(i=this.attributes)===null||i===void 0?void 0:i.onPlay)===null||a===void 0||a.call(i))},t.prototype.play=function(){this.internalPlay()},t.prototype.internalPause=function(e){var n,i;clearInterval(this.playInterval),this.states.state="pause",!e&&((i=(n=this.attributes)===null||n===void 0?void 0:n.onPause)===null||i===void 0||i.call(n))},t.prototype.pause=function(){this.internalPause()},t.prototype.internalForward=function(e){var n,i,a=this.moveSelection("forward",e);return e||((i=(n=this.attributes)===null||n===void 0?void 0:n.onForward)===null||i===void 0||i.call(n),this.dispatchOnChange()),a},t.prototype.forward=function(){this.internalForward()},t.prototype.handleSpeedChange=function(e){var n,i;this.states.speed=e;var a=this.states.state;a==="play"&&(this.internalPause(!0),this.internalPlay(!0)),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSpeedChange)===null||i===void 0||i.call(n,e)},t.prototype.handleSelectionTypeChange=function(e){var n,i;this.states.selectionType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onSelectionTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.handleChartTypeChange=function(e){var n,i;this.states.chartType=e,this.renderChart(),(i=(n=this.attributes)===null||n===void 0?void 0:n.onChartTypeChange)===null||i===void 0||i.call(n,e)},t.prototype.render=function(){var e=this.space,n=e.axisBBox,i=e.controllerBBox,a=e.timelineBBox;this.renderController(i),this.renderAxis(n),this.renderChart(a),this.states.state==="play"&&this.internalPlay()},t.prototype.destroy=function(){r.prototype.destroy.call(this),this.internalPause(!0)},t.defaultOptions={style:{x:0,y:0,axisLabelFill:"#6e6e6e",axisLabelTextAlign:"left",axisLabelTextBaseline:"top",axisLabelTransform:"translate(5, -12)",axisLineLineWidth:1,axisLineStroke:"#cacdd1",axisTickLength:15,axisTickLineWidth:1,axisTickStroke:"#cacdd1",chartShowLabel:!1,chartType:"line",controllerAlign:"center",controllerHeight:40,data:[],interval:"day",loop:!1,playMode:"acc",selectionType:"range",type:"time"}},t}(Mr);function c5(r){return r instanceof Date}var u5=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},h5=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{var f;const g=Object.assign(Object.assign({x:h[0]/2-A/2,y:d,onChange:v=>{const p=(Qi(v)?v:[v,v]).map(y=>c5(y)?y.getTime():y);this.options.mode==="modify"?this.filterElements(p):this.hiddenElements(p),n==null||n(p)}},u),{data:a.map(v=>ye(v)?{time:v,value:0}:v),width:A,height:l,type:i});this.timebar?this.timebar.update(g):(this.timebar=new l5({style:g}),(f=this.canvas)===null||f===void 0||f.appendChild(this.timebar))})}upsertCanvas(){if(this.canvas)return this.canvas;const{className:t,height:e,position:n}=this.options,i=this.context.canvas,[a]=i.getSize(),[s,,o]=this.padding,[A,l]=T0({width:a,height:e+s+o,graphCanvas:i,className:"timebar",placement:n});return this.container=A,t&&A.classList.add(t),this.canvas=l,this.canvas}filterElements(t){return u5(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=WS(this.originalData);n.forEach(l=>{const c=`${l}s`;o[c]=(this.originalData[c]||[]).filter(u=>{const h=i(u);return!!jS(h,t)})});const A=[...o.nodes,...o.combos].map(l=>Nt(l));o.edges=o.edges.filter(l=>{const c=l.source,u=l.target;return A.includes(c)&&A.includes(u)}),a.setData(o),yield(e=s.draw({animation:!1,silence:!0}))===null||e===void 0?void 0:e.finished})}hiddenElements(t){const{graph:e}=this.context,{elementTypes:n,getTime:i}=this.options,a=[],s=[];n.forEach(o=>{var A;const l=`${o}s`;(((A=this.originalData)===null||A===void 0?void 0:A[l])||[]).forEach(u=>{const h=Nt(u),d=i(u);jS(d,t)?s.push(h):a.push(h)})}),e.hideElement(a,!1),e.showElement(s,!1)}destroy(){var t,e,n;const{graph:i}=this.context;this.originalData&&i.setData(Object.assign({},this.originalData)),(t=this.timebar)===null||t===void 0||t.destroy(),(e=this.canvas)===null||e===void 0||e.destroy(),(n=this.container)===null||n===void 0||n.remove(),this.originalData=void 0,this.container=void 0,this.timebar=void 0,this.canvas=void 0,super.destroy()}}z0.defaultOptions={position:"bottom",enable:!0,timebarType:"time",className:"g6-timebar",width:450,height:60,zIndex:3,elementTypes:["node"],padding:10,mode:"modify",getTime:r=>f5(r,d5,void 0),loop:!1};const WS=r=>{const{nodes:t=[],edges:e=[],combos:n=[]}=r;return{nodes:[...t],edges:[...e],combos:[...n]}},jS=(r,t)=>{if(ye(t))return r===t;const[e,n]=t;return r>=e&&r<=n},f5=(r,t,e)=>{var n;for(let i=0;i{const i=this.updateCanvas();this.renderTitle(i)},this.bindEvents()}bindEvents(){const{graph:t}=this.context;t.on(Ae.AFTER_RENDER,this.onRender),t.on(Ae.AFTER_ANIMATE,this.onRender)}unbindEvents(){const{graph:t}=this.context;t.off(Ae.AFTER_RENDER,this.onRender),t.off(Ae.AFTER_ANIMATE,this.onRender)}destroy(){var t,e;this.unbindEvents(),(t=this.canvas)===null||t===void 0||t.destroy(),(e=this.container)===null||e===void 0||e.remove(),super.destroy()}updateCanvas(){const{size:t,className:e,align:n}=this.options,[i]=this.context.canvas.getSize(),[a=0,,s=0]=this.padding,o=t+a+s;if(this.canvas){const{width:A,height:l}=this.canvas.getConfig();(i!==A||o!==l)&&this.canvas.resize(i,o)}else{const A={left:"left-top",center:"top",right:"right-top"},[l,c]=T0({width:i,height:o,placement:A[n]||A.left,className:"title-canvas",graphCanvas:this.context.canvas});e&&l.classList.add(e),this.container=l,this.canvas=c}return this.canvas}renderTitle(t){const e=new w5({options:this.options,ctx:this.context});t.removeChildren(),e.getTitle().forEach(n=>{n&&t.appendChild(n)})}}class w5{get padding(){return Ua(this.options.padding)}constructor(t){const{options:e,ctx:n}=t;this.options=e,this.context=n}getTitle(){const t=this.options,e=nw,n=t[e],i=YS,a=t[i],{spacing:s=44,padding:o,align:A}=t,l=g5(t,[typeof e=="symbol"?e:e+"",typeof i=="symbol"?i:i+"","spacing","padding","align"]),c=n,u=a,h=Ir(l,nw),d=Ir(l,YS),[f]=this.context.graph.getSize(),[g=0,v=0,,p=0]=this.padding,y=f,x=y-p-v;let F=null,O=p,L="left";switch(A){case"left":O=p,L="left";break;case"center":O=y/2,L="center";break;case"right":O=y-v,L="right";break;default:O=p,L="left"}const U=new Ao({className:nw,style:Object.assign(Object.assign(Object.assign(Object.assign({},v5),{wordWrapWidth:x-5,x:O,y:g,textAlign:L}),h),{text:c})}),R=U.getBBox();return u&&(F=new Ao({className:"subTitle",style:Object.assign(Object.assign(Object.assign(Object.assign({},p5),{wordWrapWidth:x-5,x:O,y:R.height+s+g,textAlign:L}),d),{text:u})})),[U,F]}}function E5(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 B5=` .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; } `,b5=` `;var XS=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class K0 extends yi{constructor(t,e){super(t,Object.assign({},K0.defaultOptions,e)),this.$element=Xc("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),l1("g6-toolbar-css","style",{},B5,document.head),l1("g6-toolbar-svgicon","div",{display:"none"},b5),this.$element.addEventListener("click",this.onToolbarItemClick),this.update(e)}update(t){const e=Object.create(null,{update:{get:()=>super.update}});return XS(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,E5(i)),this.$element.innerHTML=yield this.getDOMContent()})}destroy(){this.$element.removeEventListener("click",this.onToolbarItemClick),this.$element.remove(),super.destroy()}getDOMContent(){return XS(this,void 0,void 0,function*(){return(yield this.options.getItems()).map(e=>{var n;return`
`}).join("")})}}K0.defaultOptions={position:"top-left"};function rw(r){var t=document.createElement("div");t.innerHTML=r;var e=t.childNodes[0];return e&&t.contains(e)&&t.removeChild(e),e}function x5(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 C5=x5,JS=function(r,t){if(t==null){r.innerHTML="";return}r.replaceChildren?Array.isArray(t)?r.replaceChildren.apply(r,(0,D.ev)([],(0,D.CR)(t),!1)):r.replaceChildren(t):(r.innerHTML="",Array.isArray(t)?t.forEach(function(e){return r.appendChild(e)}):r.appendChild(t))};function iw(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 qS={overflow:"hidden","white-space":"nowrap","text-overflow":"ellipsis"};function S5(r){var t;r===void 0&&(r="");var e=iw(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,D.pi)({flex:1},qS),t[".".concat(e.VALUE)]=(0,D.pi)({display:"inline-block",float:"right",flex:1,"text-align":"right","min-width":"28px","margin-left":"30px",color:"rgba(0, 0, 0, 0.85)"},qS),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 M5=function(r){(0,D.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=iw(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:S5(s)})||this,n.timestamp=-1,n.prevCustomContentKey=n.attributes.contentKey,n.initShape(),n.render(n.attributes,n),n}return Object.defineProperty(t.prototype,"HTMLTooltipElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),t.prototype.getContainer=function(){return this.element},Object.defineProperty(t.prototype,"elementSize",{get:function(){var e=this.element.offsetWidth,n=this.element.offsetHeight;return{width:e,height:n}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"HTMLTooltipItemsElements",{get:function(){var e=this.attributes,n=e.data,i=e.template;return n.map(function(a,s){var o=a.name,A=o===void 0?"":o,l=a.color,c=l===void 0?"black":l,u=a.index,h=(0,D._T)(a,["name","color","index"]),d=(0,D.pi)({name:A,color:c,index:u!=null?u:s},h);return rw(C5(i.item,d))})},enumerable:!1,configurable:!0}),t.prototype.render=function(e,n){this.renderHTMLTooltipElement(),this.updatePosition()},t.prototype.destroy=function(){var e;(e=this.element)===null||e===void 0||e.remove(),r.prototype.destroy.call(this)},t.prototype.show=function(e,n){var i=this;if(e!==void 0&&n!==void 0){var a=this.element.style.visibility==="hidden",s=function(){i.attributes.x=e!=null?e:i.attributes.x,i.attributes.y=n!=null?n:i.attributes.y,i.updatePosition()};a?this.closeTransition(s):s()}this.element.style.visibility="visible"},t.prototype.hide=function(e,n){e===void 0&&(e=0),n===void 0&&(n=0);var i=this.attributes.enterable;i&&this.isCursorEntered(e,n)||(this.element.style.visibility="hidden")},t.prototype.initShape=function(){var e=this.attributes.template;this.element=rw(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:JS(this.element,e))}},t.prototype.renderHTMLTooltipElement=function(){var e,n,i=this.attributes,a=i.template,s=i.title,o=i.enterable,A=i.style,l=i.content,c=iw(a.prefixCls),u=this.element;if(this.element.style.pointerEvents=o?"auto":"none",l)this.renderCustomContent();else{s?(u.innerHTML=a.title,u.getElementsByClassName(c.TITLE)[0].innerHTML=s):(n=(e=u.getElementsByClassName(c.TITLE))===null||e===void 0?void 0:e[0])===null||n===void 0||n.remove();var h=this.HTMLTooltipItemsElements,d=document.createElement("ul");d.className=c.LIST,JS(d,h);var f=this.element.querySelector(".".concat(c.LIST));f?f.replaceWith(d):u.appendChild(d)}R4(u,A)},t.prototype.getRelativeOffsetFromCursor=function(e){var n=this.attributes,i=n.position,a=n.offset,s=e||i,o=s.split("-"),A={left:[-1,0],right:[1,0],top:[0,-1],bottom:[0,1]},l=this.elementSize,c=l.width,u=l.height,h=[-c/2,-u/2];return o.forEach(function(d){var f=(0,D.CR)(h,2),g=f[0],v=f[1],p=(0,D.CR)(A[d],2),y=p[0],x=p[1];h=[g+(c/2+a[0])*y,v+(u/2+a[1])*x]}),h},t.prototype.setOffsetPosition=function(e){var n=(0,D.CR)(e,2),i=n[0],a=n[1],s=this.attributes,o=s.x,A=o===void 0?0:o,l=s.y,c=l===void 0?0:l,u=s.container,h=u.x,d=u.y;this.element.style.left="".concat(+A+h+i,"px"),this.element.style.top="".concat(+c+d+a,"px")},t.prototype.updatePosition=function(){var e=this.attributes.showDelay,n=e===void 0?60:e,i=Date.now();this.timestamp>0&&i-this.timestampy+F,top:vx+O},U=[];c.split("-").forEach(function(j){L[j]?U.push(p[j]):U.push(j)});var R=U.join("-");return this.getRelativeOffsetFromCursor(R)},t.prototype.isCursorEntered=function(e,n){if(this.element){var i=this.element.getBoundingClientRect(),a=i.x,s=i.y,o=i.width,A=i.height;return new Gi(a,s,o,A).isPointIn(e,n)}return!1},t.prototype.closeTransition=function(e){var n=this,i=this.element.style.transition;this.element.style.transition="none",e(),setTimeout(function(){n.element.style.transition=i},10)},t.tag="tooltip",t}(Mr),$S=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class V0 extends yi{constructor(t,e){super(t,Object.assign({},V0.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=>$S(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=>$S(this,void 0,void 0,function*(){var i,a;const{client:s,target:{id:o}}=n;if(Ih(n.target))return;const A=this.context.graph.getElementType(o),{getContent:l,title:c}=this.options,u=this.getElementData(o,A);if(!this.tooltipElement)return;if(!this.isEnable(n,u)){this.hide(n);return}let h={};if(l){if(h.content=yield l(n,u),!h.content)return}else{const g=this.context.graph.getElementRenderStyle(o),v=A==="node"?g.fill:g.stroke;h={title:c||A,data:u.map(p=>({name:"ID",value:p.id||`${p.source} -> ${p.target}`,color:v}))}}this.currentTarget=o;let d,f;if(s)d=s.x,f=s.y;else{const g=Fi(u,"0.style",{x:0,y:0});d=g.x,f=g.y}(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!0),this.tooltipElement.update(Object.assign(Object.assign(Object.assign({},this.tooltipStyleProps),{x:d,y:f,style:{".tooltip":{visibility:"visible"}}}),h))}),this.hide=n=>{var i,a,s,o,A;if(!n){(a=(i=this.options).onOpenChange)===null||a===void 0||a.call(i,!1),(s=this.tooltipElement)===null||s===void 0||s.hide(),this.currentTarget=null;return}if(!this.tooltipElement||!this.currentTarget)return;const{client:{x:l,y:c}}=n;(A=(o=this.options).onOpenChange)===null||A===void 0||A.call(o,!1),this.tooltipElement.hide(l,c),this.currentTarget=null},this.initTooltip=()=>{var n;const i=new M5({className:"tooltip",style:this.tooltipStyleProps});return(n=this.container)===null||n===void 0||n.appendChild(i.HTMLTooltipElement),i},this.render(),this.bindEvents()}getEvents(){return this.options.trigger==="click"?{"node:click":this.onClick,"edge:click":this.onClick,"combo:click":this.onClick,"canvas:click":this.onPointerLeave,contextmenu:this.onPointerLeave,drag:this.onPointerLeave}:{"node:pointerover":this.onPointerOver,"node:pointermove":this.onPointerMove,"canvas:pointermove":this.onCanvasMove,"edge:pointerover":this.onPointerOver,"edge:pointermove":this.onPointerMove,"combo:pointerover":this.onPointerOver,"combo:pointermove":this.onPointerMove,contextmenu:this.onPointerLeave,"node:drag":this.onPointerLeave}}update(t){var e;this.unbindEvents(),super.update(t),this.tooltipElement&&((e=this.container)===null||e===void 0||e.removeChild(this.tooltipElement.HTMLTooltipElement)),this.tooltipElement=this.initTooltip(),this.bindEvents()}render(){const{canvas:t}=this.context,e=t.getContainer();e&&(this.container=e,this.tooltipElement=this.initTooltip())}unbindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.off(n,e[n])})}bindEvents(){const{graph:t}=this.context,e=this.getEvents();Object.keys(e).forEach(n=>{t.on(n,e[n])})}get tooltipStyleProps(){const{canvas:t}=this.context,{center:e}=t.getBounds(),n=t.getContainer(),{top:i,left:a}=n.getBoundingClientRect(),{style:s,position:o,enterable:A,container:l={x:-a,y:-i},title:c,offset:u}=this.options,[h,d]=e,[f,g]=t.getSize();return{x:h,y:d,container:l,title:c,bounding:{x:0,y:0,width:f,height:g},position:o,enterable:A,offset:u,style:s}}destroy(){var t;this.unbindEvents(),this.tooltipElement&&((t=this.container)===null||t===void 0||t.removeChild(this.tooltipElement.HTMLTooltipElement)),super.destroy()}}V0.defaultOptions={trigger:"hover",position:"top-right",enterable:!1,enable:!0,offset:[10,10],style:{".tooltip":{visibility:"hidden"}}};var tM=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};let nu;function eM(r,t){return nu||(nu=document.createElement("canvas")),nu.width=r,nu.height=t,nu.getContext("2d").clearRect(0,0,r,t),nu}function F5(r,t,e,n){return tM(this,void 0,void 0,function*(){const i=eM(r,t),a=i.getContext("2d"),{rotate:s,opacity:o,textFill:A,textFontSize:l,textFontFamily:c,textFontVariant:u,textFontWeight:h,textAlign:d,textBaseline:f}=n;return a.textAlign=d,a.textBaseline=f,a.translate(r/2,t/2),a.font=`${l}px ${c} ${u} ${h}`,s&&a.rotate(s),o&&(a.globalAlpha=o),A&&(a.fillStyle=A,a.fillText(`${e}`,0,0)),i.toDataURL()})}function T5(r,t,e,n){return tM(this,void 0,void 0,function*(){const i=eM(r,t),a=i.getContext("2d"),{rotate:s,opacity:o}=n;s&&a.rotate(s),o&&(a.globalAlpha=o);const A=new Image;return A.crossOrigin="anonymous",A.src=e,new Promise(l=>{A.onload=function(){const c=r>A.width?(r-A.width)/2:0,u=t>A.height?(t-A.height)/2:0;a.drawImage(A,0,0,A.width,A.height,c,u,r-c*2,t-u*2),l(i.toDataURL())}})})}var O5=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},I5=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 O5(this,void 0,void 0,function*(){e.update.call(this,t);const n=this.options,{width:i,height:a,text:s,imageURL:o}=n,A=I5(n,["width","height","text","imageURL"]);Object.keys(A).forEach(c=>{c.startsWith("background")&&(this.$element.style[c]=t[c])});const l=o?yield T5(i,a,o,A):yield F5(i,a,s,A);this.$element.style.backgroundImage=`url(${l})`})}destroy(){super.destroy(),this.$element.remove()}}W0.defaultOptions={width:200,height:100,opacity:.2,rotate:Math.PI/12,text:"",textFill:"#000",textFontSize:16,textAlign:"center",textBaseline:"middle",backgroundRepeat:"repeat"};const N5=["#7E92B5","#F4664A","#FFBE3A"],L5={type:"group",color:["#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]},k5={type:"group",color:["#99ADD1","#1783FF","#00C9C9","#F08F56","#D580FF","#7863FF","#DB9D0D","#60C42D","#FF80CA","#2491B3","#17C76F"]};function nM(r){const{bgColor:t,textColor:e,nodeColor:n,nodeColorDisabled:i,nodeStroke:a,nodeHaloStrokeOpacityActive:s=.15,nodeHaloStrokeOpacitySelected:o=.25,nodeOpacityDisabled:A=.06,nodeIconOpacityInactive:l=.85,nodeOpacityInactive:c=.25,nodeBadgePalette:u=N5,nodePaletteOptions:h=L5,edgeColor:d,edgeColorDisabled:f,edgePaletteOptions:g=k5,comboColor:v,comboColorDisabled:p,comboStroke:y,comboStrokeDisabled:x,edgeColorInactive:F}=r;return{background:t,node:{palette:h,style:{donutOpacity:1,badgeBackgroundOpacity:1,badgeFill:"#fff",badgeFontSize:8,badgePadding:[0,4],badgePalette:u,fill:n,fillOpacity:1,halo:!1,iconFill:"#fff",iconOpacity:1,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelFill:e,labelFillOpacity:.85,labelLineHeight:16,labelPadding:[0,2],labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelOffsetY:2,lineWidth:0,portFill:n,portLineWidth:1,portStroke:a,portStrokeOpacity:.65,size:32,stroke:a,strokeOpacity:1,zIndex:2},state:{selected:{halo:!0,haloLineWidth:24,haloStrokeOpacity:o,labelFontSize:12,labelFontWeight:"bold",lineWidth:4,stroke:a},active:{halo:!0,haloLineWidth:12,haloStrokeOpacity:s},highlight:{labelFontWeight:"bold",lineWidth:4,stroke:a,strokeOpacity:.85},inactive:{badgeBackgroundOpacity:c,donutOpacity:c,fillOpacity:c,iconOpacity:l,labelFill:e,labelFillOpacity:c,strokeOpacity:c},disabled:{badgeBackgroundOpacity:.25,donutOpacity:A,fill:i,fillOpacity:A,iconFill:i,iconOpacity:.25,labelFill:e,labelFillOpacity:.25,strokeOpacity:A}},animation:{enter:"fade",exit:"fade",show:"fade",hide:"fade",expand:"node-expand",collapse:"node-collapse",update:[{fields:["x","y","fill","stroke"]}],translate:[{fields:["x","y"]}]}},edge:{palette:g,style:{badgeBackgroundFill:d,badgeFill:"#fff",badgeFontSize:8,badgeOffsetX:10,badgeBackgroundOpacity:1,fillOpacity:1,halo:!1,haloLineWidth:12,haloStrokeOpacity:1,increasedLineWidthForHitTesting:2,labelBackground:!1,labelBackgroundFill:t,labelBackgroundLineWidth:0,labelBackgroundOpacity:.75,labelBackgroundPadding:[4,4,4,4],labelFill:e,labelFontSize:12,labelFontWeight:400,labelOpacity:1,labelPlacement:"center",labelTextBaseline:"middle",lineWidth:1,stroke:d,strokeOpacity:1,zIndex:1},state:{selected:{halo:!0,haloStrokeOpacity:.25,labelFontSize:14,labelFontWeight:"bold",lineWidth:3},active:{halo:!0,haloStrokeOpacity:.15},highlight:{labelFontWeight:"bold",lineWidth:3},inactive:{stroke:F,fillOpacity:.08,labelOpacity:.25,strokeOpacity:.08,badgeBackgroundOpacity:.25},disabled:{stroke:f,fillOpacity:.45,strokeOpacity:.45,labelOpacity:.25,badgeBackgroundOpacity:.45}},animation:{enter:"fade",exit:"fade",expand:"path-in",collapse:"path-out",show:"fade",hide:"fade",update:[{fields:["sourceNode","targetNode"]},{fields:["stroke"],shape:"key"}],translate:[{fields:["sourceNode","targetNode"]}]}},combo:{style:{collapsedMarkerFill:t,collapsedMarkerFontSize:12,collapsedMarkerFillOpacity:1,collapsedSize:32,collapsedFillOpacity:1,fill:v,halo:!1,haloLineWidth:12,haloStroke:y,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:y},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:p,fillOpacity:.25,labelOpacity:.25,stroke:x,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 Q5=nM({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"}),U5=nM({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 DA extends Ay{beforeDraw(t,e){return t}afterLayout(t,e){}}class R5 extends DA{beforeDraw(t){const{model:e}=this.context,n=t.add.combos,i=a=>{const s=[];return a.forEach((o,A)=>{const c=e.getAncestorsData(A,"combo").map(u=>Nt(u)).reverse();s.push([A,o,c.length])}),new Map(s.sort(([,,o],[,,A])=>A-o).map(([o,A])=>[o,A]))};return t.add.combos=i(n),t.update.combos=i(t.update.combos),t}}function Ha(r,t,e,n,i){const a=Nt(n),s=`${e}s`,o=i?n:r.add[s].get(a)||r.update[s].get(a)||r.remove[s].get(a)||n;Object.entries(r).forEach(([A,l])=>{t===A?l[s].set(a,o):l[s].delete(a)})}function j0(r,t){return Object.keys(r).every(e=>r[e]===t[e])}class D5 extends DA{beforeDraw(t,e){if(e.stage==="visibility"||!this.context.model.model.hasTreeStructure(nr))return t;const{model:n}=this.context,{add:i,update:a}=t,s=[...t.update.combos.entries(),...t.add.combos.entries()];for(;s.length;){const[o,A]=s.pop();if(pa(A)){const l=n.getDescendantsData(o),c=l.map(Nt),{internal:u,external:h}=My(c,d=>n.getRelatedEdgesData(d));l.forEach(d=>{const f=Nt(d),g=s.findIndex(([p])=>p===f);g!==-1&&s.splice(g,1);const v=n.getElementType(f);Ha(t,"remove",v,d)}),u.forEach(d=>Ha(t,"remove","edge",d)),h.forEach(d=>{var f;const g=Nt(d);((f=this.context.element)===null||f===void 0?void 0:f.getElement(g))?a.edges.set(g,d):i.edges.set(g,d)})}else{const l=n.getChildrenData(o),c=l.map(Nt),{edges:u}=My(c,h=>n.getRelatedEdgesData(h));[...l,...u].forEach(h=>{var d;const f=Nt(h),g=n.getElementType(f);((d=this.context.element)===null||d===void 0?void 0:d.getElement(f))?Ha(t,"update",g,h):Ha(t,"add",g,h),g==="combo"&&s.push([f,h])})}}return t}}const rM=(r,t,e,n)=>{const i=`${e}s`,a=Nt(n);!r.add[i].has(a)&&!r.update[i].has(a)&&r[t][i].set(Nt(n),n)};class P5 extends DA{getElement(t){return this.context.element.getElement(t)}handleExpand(t,e){if(rM(e,"add","node",t),pa(t))return;const n=Nt(t);rM(e,"add","node",t),this.context.model.getRelatedEdgesData(n).forEach(s=>{Ha(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(Qa))return t;const{add:{nodes:i,edges:a},update:{nodes:s}}=t,o=new Map,A=new Map;i.forEach((c,u)=>{pa(c)&&o.set(u,c)}),a.forEach(c=>{if(e.getElementType(c.source)!=="node")return;const u=e.getNodeData(c.source);pa(u)&&o.set(c.source,u)}),s.forEach((c,u)=>{const h=this.getElement(u);if(!h)return;const d=h.attributes.collapsed;pa(c)?d||o.set(u,c):d&&A.set(u,c)});const l=new Set;return o.forEach((c,u)=>{n.getDescendantsData(u).forEach(d=>{const f=Nt(d);if(l.has(f))return;Ha(t,"remove","node",d),n.getRelatedEdgesData(f).forEach(v=>{Ha(t,"remove","edge",v)}),l.add(f)})}),A.forEach((c,u)=>{if(n.getAncestorsData(u,Qa).some(pa)){Ha(t,"remove","node",c);return}this.handleExpand(c,t)}),t}}const aw=new WeakMap;function _K(r,t,e){aw.has(r)||aw.set(r,{});const n=aw.get(r);if(!n[t])return n[t]=e,!0;const i=n[t];return iM(i,e)?!1:(n[t]=e,!0)}const iM=(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(!iM(s,o,e-1))return!1}else if(s!==o)return!1}return!0};function _5(r,t,e){Vm[r][t]&&va.warn(`The extension ${t} of ${r} has been registered before, and will be overridden.`),Object.assign(Vm[r],{[t]:e})}var aM=function(){function r(t){(0,P.Z)(this,r),this.dragndropPluginOptions=t}return(0,N.Z)(r,[{key:"apply",value:function(e){var n=this,i=e.renderingService,a=e.renderingContext,s=a.root.ownerDocument,o=s.defaultView,A=function(c){var u=c.target,h=u===s,d=h&&n.dragndropPluginOptions.isDocumentDraggable?s:u.closest&&u.closest("[draggable=true]");if(d){var f=!1,g=c.timeStamp,v=[c.clientX,c.clientY],p=null,y=[c.clientX,c.clientY],x=function(){var O=(0,Xa.Z)((0,ii.Z)().mark(function L(U){var R,j,q,et,it,dt;return(0,ii.Z)().wrap(function(ft){for(;;)switch(ft.prev=ft.next){case 0:if(f){ft.next=2;break}if(R=U.timeStamp-g,j=ki([U.clientX,U.clientY],v),!(R<=n.dragndropPluginOptions.dragstartTimeThreshold||j<=n.dragndropPluginOptions.dragstartDistanceThreshold)){ft.next=1;break}return ft.abrupt("return");case 1:U.type="dragstart",d.dispatchEvent(U),f=!0;case 2:if(U.type="drag",U.dx=U.clientX-y[0],U.dy=U.clientY-y[1],d.dispatchEvent(U),y=[U.clientX,U.clientY],h){ft.next=4;break}return q=n.dragndropPluginOptions.overlap==="pointer"?[U.canvasX,U.canvasY]:u.getBounds().center,ft.next=3,s.elementsFromPoint(q[0],q[1]);case 3:et=ft.sent,it=et[et.indexOf(u)+1],dt=(it==null?void 0:it.closest("[droppable=true]"))||(n.dragndropPluginOptions.isDocumentDroppable?s:null),p!==dt&&(p&&(U.type="dragleave",U.target=p,p.dispatchEvent(U)),dt&&(U.type="dragenter",U.target=dt,dt.dispatchEvent(U)),p=dt,p&&(U.type="dragover",U.target=p,p.dispatchEvent(U)));case 4:case"end":return ft.stop()}},L)}));return function(U){return O.apply(this,arguments)}}();o.addEventListener("pointermove",x);var F=function(L){if(f){L.detail={preventClick:!0};var U=L.clone();p&&(U.type="drop",U.target=p,p.dispatchEvent(U)),U.type="dragend",d.dispatchEvent(U),f=!1}o.removeEventListener("pointermove",x)};u.addEventListener("pointerup",F,{once:!0}),u.addEventListener("pointerupoutside",F,{once:!0})}};i.hooks.init.tap(r.tag,function(){o.addEventListener("pointerdown",A)}),i.hooks.destroy.tap(r.tag,function(){o.removeEventListener("pointerdown",A)})}}])}();aM.tag="Dragndrop";var H5=function(r){function t(){var e,n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return(0,P.Z)(this,t),e=(0,K.Z)(this,t),e.name="dragndrop",e.options=n,e}return(0,_.Z)(t,r),(0,N.Z)(t,[{key:"init",value:function(){this.addRenderingPlugin(new aM((0,z.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)}}])}(ds),sM=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},oM=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const h=new Fm(Object.assign(Object.assign({},o),{supportsMutipleCanvasesInOneContainer:s,renderer:l[u],background:s?u==="background"?i:void 0:i}));return[u,h]}));hM(c),this.extends={config:this.config,renderer:n,renderers:l,layers:c}}get ready(){return Promise.all(Object.entries(this.getLayers()).map(([,t])=>t.ready))}resize(t,e){Object.assign(this.extends.config,{width:t,height:e}),Object.values(this.getLayers()).forEach(n=>{const i=n.getCamera(),a=i.getPosition(),s=i.getFocalPoint();n.resize(t,e),i.setPosition(a),i.setFocalPoint(s)})}getBounds(t){return vh(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=uM(t,this.config.enableMultiLayer?lM:AM);this.extends.renderers=e,Object.entries(e).forEach(([n,i])=>this.getLayer(n).setRenderer(i)),hM(this.getLayers())}getCanvasByViewport(t){return Mi(this.getLayer().viewport2Canvas(Fs(t)))}getViewportByCanvas(t){return Mi(this.getLayer().canvas2Viewport(Fs(t)))}getViewportByClient(t){return Mi(this.getLayer().client2Viewport(Fs(t)))}getClientByViewport(t){return Mi(this.getLayer().viewport2Client(Fs(t)))}getClientByCanvas(t){return this.getClientByViewport(this.getViewportByCanvas(t))}getCanvasByClient(t){const e=this.getLayer(),n=e.client2Viewport(Fs(t));return Mi(e.viewport2Canvas(n))}toDataURL(){return sM(this,arguments,void 0,function*(t={}){const e=globalThis.devicePixelRatio||1,{mode:n="viewport"}=t,i=oM(t,["mode"]);let[a,s,o,A]=[0,0,0,0];if(n==="viewport")[o,A]=this.getSize();else if(n==="overall"){const p=this.getBounds(),y=yA(p);[a,s]=p.min,[o,A]=y}const l=rw('
    '),c=new Fm({width:o,height:A,renderer:new Mh,devicePixelRatio:e,container:l,background:this.extends.config.background});yield c.ready,c.appendChild(this.getLayer("background").getRoot().cloneNode(!0)),c.appendChild(this.getRoot().cloneNode(!0));const u=this.getLayer("label").getRoot().cloneNode(!0),h=c.viewport2Canvas({x:0,y:0}),d=this.getCanvasByViewport([0,0]);u.translate([d[0]-h.x,d[1]-h.y]),u.scale(1/this.getCamera().getZoom()),c.appendChild(u),c.appendChild(this.getLayer("transient").getRoot().cloneNode(!0));const f=this.getCamera(),g=c.getCamera();if(n==="viewport")g.setZoom(f.getZoom()),g.setPosition(f.getPosition()),g.setFocalPoint(f.getFocalPoint());else if(n==="overall"){const[p,y,x]=g.getPosition(),[F,O,L]=g.getFocalPoint();g.setPosition([p+a,y+s,x]),g.setFocalPoint([F+a,O+s,L])}const v=c.getContextService();return new Promise(p=>{c.addEventListener(La.RERENDER,()=>sM(this,void 0,void 0,function*(){yield new Promise(x=>setTimeout(x,300));const y=yield v.toDataURL(i);p(y)}))})})}destroy(){Object.values(this.getLayers()).forEach(t=>{t.getCamera().cancelLandmarkAnimation(),t.destroy()})}}function uM(r,t){return Object.fromEntries(t.map(e=>{const n=(r==null?void 0:r(e))||new Mh;return n instanceof Mh&&n.setConfig({enableDirtyRectangleRendering:!1}),e==="main"?n.registerPlugin(new H5({isDocumentDraggable:!0,isDocumentDroppable:!0,dragstartDistanceThreshold:10,dragstartTimeThreshold:100})):n.unregisterPlugin(n.getPlugin("dom-interaction")),[e,n]}))}function hM(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 ru=r=>r?parseInt(r):0;function z5(r){const t=getComputedStyle(r),e=r.clientWidth||ru(t.width),n=r.clientHeight||ru(t.height),i=ru(t.paddingLeft)+ru(t.paddingRight),a=ru(t.paddingTop)+ru(t.paddingBottom);return[e-i,n-a]}function dM(r){if(!r)return[0,0];let t=640,e=480;const[n,i]=z5(r);t=n||t,e=i||e;const a=1,s=1;return[Math.max(ye(t)?t:a,a),Math.max(ye(e)?e:s,s)]}class Z0{constructor(t){this.type=t}}class Xr extends Z0{constructor(t,e){super(t),this.data=e}}class os extends Z0{constructor(t,e,n,i){super(t),this.animationType=e,this.animation=n,this.data=i}}class iu extends Z0{constructor(t,e,n){super(t),this.elementType=e,this.data=n}}class Y0 extends Z0{constructor(t,e){super(t),this.data=e}}function ui(r,t){r.emit(t.type,t)}function K5(r){if(!r)return null;if(r instanceof JE)return{type:"canvas",element:r};let t=r;for(;t;){if(Th(t))return{type:"node",element:t};if(Sx(t))return{type:"edge",element:t};if(Fy(t))return{type:"combo",element:t};t=t.parentElement}return null}function fM(r){var t;return((t=r==null?void 0:r.style)===null||t===void 0?void 0:t.zIndex)||0}const au="cachedStyle",X0=r=>`__${r}__`;function V5(r,t){const e=Array.isArray(t)?t:[t];Fi(r,au)||bh(r,au,{}),e.forEach(n=>{bh(Fi(r,au),X0(n),r.attributes[n])})}function gM(r,t){return Fi(r,[au,X0(t)])}function W5(r,t){return X0(t)in(Fi(r,au)||{})}function HK(r,t,e){set(r,[au,X0(t)],e)}class j5{constructor(t){this.tasks=[],this.animations=new Set,this.context=t}getTasks(){const t=[...this.tasks];return this.tasks=[],t}add(t,e){this.tasks.push([t,e])}animate(t,e,n){var i,a,s;(i=e==null?void 0:e.before)===null||i===void 0||i.call(e);const o=this.getTasks().map(([l,c])=>{var u,h,d;const{element:f,elementType:g,stage:v}=l,p=cI(this.context.options,g,v,t);(u=c==null?void 0:c.before)===null||u===void 0||u.call(c);const y=p.length?hI(f,this.inferStyle(l,n),p):null;return y?((h=c==null?void 0:c.beforeAnimate)===null||h===void 0||h.call(c,y),y.finished.then(()=>{var x,F;(x=c==null?void 0:c.afterAnimate)===null||x===void 0||x.call(c,y),(F=c==null?void 0:c.after)===null||F===void 0||F.call(c),this.animations.delete(y)})):(d=c==null?void 0:c.after)===null||d===void 0||d.call(c),y}).filter(Boolean);o.forEach(l=>this.animations.add(l));const A=Wm(o);return A?((a=e==null?void 0:e.beforeAnimate)===null||a===void 0||a.call(e,A),A.finished.then(()=>{var l,c;(l=e==null?void 0:e.afterAnimate)===null||l===void 0||l.call(e,A),(c=e==null?void 0:e.after)===null||c===void 0||c.call(e),this.release()})):(s=e==null?void 0:e.after)===null||s===void 0||s.call(e),A}inferStyle(t,e){var n,i;const{element:a,elementType:s,stage:o,originalStyle:A,updatedStyle:l={}}=t;t.modifiedStyle||(t.modifiedStyle=Object.assign(Object.assign({},A),l));const{modifiedStyle:c}=t,u={},h={};if(o==="enter")Object.assign(u,{opacity:0});else if(o==="exit")Object.assign(h,{opacity:0});else if(o==="show")Object.assign(u,{opacity:0}),Object.assign(h,{opacity:(n=gM(a,"opacity"))!==null&&n!==void 0?n:gh("opacity")});else if(o==="hide")Object.assign(u,{opacity:(i=gM(a,"opacity"))!==null&&i!==void 0?i:gh("opacity")}),Object.assign(h,{opacity:0});else if(o==="collapse"){const{collapse:d}=e||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(g.includes(a.id)){const[p,y,x]=v;Object.assign(h,{x:p,y,z:x})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[p,y]=v;Object.assign(h,{x:p,y,childrenNode:A.childrenNode})}}else s==="edge"&&Object.assign(h,{sourceNode:c.sourceNode,targetNode:c.targetNode})}else if(o==="expand"){const{expand:d}=e||{},{target:f,descendants:g,position:v}=d;if(s==="node"){if(a.id===f||g.includes(a.id)){const[p,y,x]=v;Object.assign(u,{x:p,y,z:x})}}else if(s==="combo"){if(a.id===f||g.includes(a.id)){const[p,y,x]=v;Object.assign(u,{x:p,y,z:x,childrenNode:c.childrenNode})}}else s==="edge"&&Object.assign(u,{sourceNode:c.sourceNode,targetNode:c.targetNode})}return[Object.keys(u).length>0?Object.assign({},A,u):A,Object.keys(h).length>0?Object.assign({},c,h):c]}stop(){this.animations.forEach(t=>t.cancel())}clear(){this.tasks=[]}release(){var t,e;const{canvas:n}=this.context,i=(e=(t=n.document)===null||t===void 0?void 0:t.timeline)===null||e===void 0?void 0:e.animationsWithPromises;i&&(n.document.timeline.animationsWithPromises=i.filter(a=>a.playState!=="finished"))}destroy(){this.stop(),this.animations.clear(),this.tasks=[]}}class Z5{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 Xr(Ae.BATCH_START,{initiate:t}))}endBatch(){this.batchCount--,this.batchCount===0&&this.emit(new Xr(Ae.BATCH_END))}get isBatching(){return this.batchCount>0}destroy(){this.context=null}}class Y5 extends oy{constructor(t){super(t),this.currentTarget=null,this.currentTargetType=null,this.category="behavior",this.forwardCanvasEvents=e=>{const{target:n}=e,i=K5(n);if(!i)return;const{graph:a,canvas:s}=this.context,{type:o,element:A}=i;if("destroyed"in A&&(Ih(A)||A.destroyed))return;const{type:l,detail:c,button:u}=e,h=Object.assign(Object.assign({},e),{target:A,targetType:o,originalTarget:n});l===Yt.POINTER_MOVE&&(this.currentTarget!==A&&(this.currentTarget&&a.emit(`${this.currentTargetType}:${Yt.POINTER_LEAVE}`,Object.assign(Object.assign({},h),{type:Yt.POINTER_LEAVE,target:this.currentTarget,targetType:this.currentTargetType})),A&&(Object.assign(h,{type:Yt.POINTER_ENTER}),a.emit(`${o}:${Yt.POINTER_ENTER}`,h))),this.currentTarget=A,this.currentTargetType=o),l===Yt.CLICK&&u===2||(a.emit(`${o}:${l}`,h),a.emit(l,h)),l===Yt.CLICK&&c===2&&(Object.assign(h,{type:Yt.DBLCLICK}),a.emit(`${o}:${Yt.DBLCLICK}`,h),a.emit(Yt.DBLCLICK,h)),l===Yt.POINTER_DOWN&&u===2&&(Object.assign(h,{type:Yt.CONTEXT_MENU,preventDefault:()=>{var d;(d=s.getContainer())===null||d===void 0||d.addEventListener(Yt.CONTEXT_MENU,f=>f.preventDefault(),{once:!0})}}),a.emit(`${o}:${Yt.CONTEXT_MENU}`,h),a.emit(Yt.CONTEXT_MENU,h))},this.forwardContainerEvents=e=>{this.context.graph.emit(e.type,e)},this.forwardEvents(),this.setBehaviors(this.context.options.behaviors||[])}setBehaviors(t){this.setExtensions(t)}forwardEvents(){const t=this.context.canvas.getContainer();t&&[Rc.KEY_DOWN,Rc.KEY_UP].forEach(n=>{t.addEventListener(n,this.forwardContainerEvents)});const e=this.context.canvas.document;e&&[Yt.CLICK,Yt.DBLCLICK,Yt.POINTER_OVER,Yt.POINTER_LEAVE,Yt.POINTER_ENTER,Yt.POINTER_MOVE,Yt.POINTER_OUT,Yt.POINTER_DOWN,Yt.POINTER_UP,Yt.CONTEXT_MENU,Yt.DRAG_START,Yt.DRAG,Yt.DRAG_END,Yt.DRAG_ENTER,Yt.DRAG_OVER,Yt.DRAG_LEAVE,Yt.DROP,Yt.WHEEL].forEach(n=>{e.addEventListener(n,this.forwardCanvasEvents)})}destroy(){const t=this.context.canvas.getContainer();t&&[Rc.KEY_DOWN,Rc.KEY_UP].forEach(e=>{t.removeEventListener(e,this.forwardContainerEvents)}),this.context.canvas.document.removeAllEventListeners(),super.destroy()}}function X5(r,t){t===void 0&&(t=new Map);var e=[];if(Array.isArray(r))for(var n=0,i=r.length;n0}silence(t){this.isTraceless=!0,t(),this.isTraceless=!1}isCombo(t){return this.comboIds.has(t)||this.latestRemovedComboIds.has(t)}getData(){return{nodes:this.getNodeData(),edges:this.getEdgeData(),combos:this.getComboData()}}getNodeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=Ei(n);return this.isCombo(Nt(i))||(t===void 0||t.includes(Nt(i)))&&e.push(i),e},[])}getEdgeDatum(t){return Ei(this.model.getEdge(t))}getEdgeData(t){return this.model.getAllEdges().reduce((e,n)=>{const i=Ei(n);return(t===void 0||t.includes(Nt(i)))&&e.push(i),e},[])}getComboData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=Ei(n);return this.isCombo(Nt(i))&&(t===void 0||t.includes(Nt(i)))&&e.push(i),e},[])}getRootsData(t=Qa){return this.model.getRoots(t).map(Ei)}getAncestorsData(t,e){const{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getAncestors(t,e).map(Ei)}getDescendantsData(t){const e=this.getElementDataById(t),n=[];return Cl(e,i=>{i!==e&&n.push(i)},i=>this.getChildrenData(Nt(i)),"TB"),n}getParentData(t,e){const{model:n}=this;if(!e){va.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?Ei(i):void 0}getChildrenData(t){const e=this.getElementType(t)==="node"?Qa:nr,{model:n}=this;return!n.hasNode(t)||!n.hasTreeStructure(e)?[]:n.getChildren(t,e).map(Ei)}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 Ei(e)}getNodeLikeData(t){return this.model.getAllNodes().reduce((e,n)=>{const i=Ei(n);return t?t.includes(Nt(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(Ei)}getNeighborNodesData(t){return this.model.getNeighbors(t).map(Ei)}setData(t){const{nodes:e=[],edges:n=[],combos:i=[]}=t,{nodes:a,edges:s,combos:o}=this.getData(),A=BA(a,e,u=>Nt(u),Kc),l=BA(s,n,u=>Nt(u),Kc),c=BA(o,i,u=>Nt(u),Kc);this.batch(()=>{const u={nodes:A.enter,edges:l.enter,combos:c.enter};this.addData(u),this.computeZIndex(u,"add",!0);const h={nodes:A.update,edges:l.update,combos:c.update};this.updateData(h),this.computeZIndex(h,"update",!0);const d={nodes:A.exit.map(Nt),edges:l.exit.map(Nt),combos:c.exit.map(Nt)};this.removeData(d)})}addData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.addComboData(i),this.addNodeData(e),this.addEdgeData(n)}),this.computeZIndex(t,"add")}addNodeData(t=[]){t.length&&(this.model.addNodes(t.map(e=>(this.pushChange({value:e,type:fr.NodeAdded}),sw(e)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({nodes:t},"add"))}addEdgeData(t=[]){t.length&&(this.model.addEdges(t.map(e=>(this.pushChange({value:e,type:fr.EdgeAdded}),sw(e)))),this.computeZIndex({edges:t},"add"))}addComboData(t=[]){if(!t.length)return;const{model:e}=this;e.hasTreeStructure(nr)||e.attachTreeStructure(nr),e.addNodes(t.map(n=>(this.comboIds.add(Nt(n)),this.pushChange({value:n,type:fr.ComboAdded}),sw(n)))),this.updateNodeLikeHierarchy(t),this.computeZIndex({combos:t},"add")}addChildrenData(t,e){const n=this.getNodeLikeDatum(t),i=e.map(Nt);this.addNodeData(e),this.updateNodeData([{id:t,children:[...n.children||[],...i]}]),this.addEdgeData(i.map(a=>({source:t,target:a})))}computeZIndex(t,e,n=!1){!n&&this.isBatching()||this.batch(()=>{const{nodes:i=[],edges:a=[],combos:s=[]}=t;s.forEach(o=>{var A,l,c;const u=Nt(o);if(e==="add"&&ye((A=o.style)===null||A===void 0?void 0:A.zIndex)||e==="update"&&!("combo"in o))return;const h=this.getParentData(u,nr),d=h?((c=(l=h.style)===null||l===void 0?void 0:l.zIndex)!==null&&c!==void 0?c:0)+1:0;this.preventUpdateNodeLikeHierarchy(()=>{this.updateComboData([{id:u,style:{zIndex:d}}])})}),i.forEach(o=>{var A,l,c;const u=Nt(o);if(e==="add"&&ye((A=o.style)===null||A===void 0?void 0:A.zIndex)||e==="update"&&!("combo"in o)&&!("children"in o))return;let h=0;const d=this.getParentData(u,nr);if(d)h=(((l=d.style)===null||l===void 0?void 0:l.zIndex)||0)+1;else{const f=this.getParentData(u,Qa);f&&(h=((c=f==null?void 0:f.style)===null||c===void 0?void 0:c.zIndex)||0)}this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:u,style:{zIndex:h}}])})}),a.forEach(o=>{var A,l,c,u,h;if(ye((A=o.style)===null||A===void 0?void 0:A.zIndex))return;let{id:d,source:f,target:g}=o;if(!d)d=Nt(o);else{const y=this.getEdgeDatum(d);f=y.source,g=y.target}if(!f||!g)return;const v=((c=(l=this.getNodeLikeDatum(f))===null||l===void 0?void 0:l.style)===null||c===void 0?void 0:c.zIndex)||0,p=((h=(u=this.getNodeLikeDatum(g))===null||u===void 0?void 0:u.style)===null||h===void 0?void 0:h.zIndex)||0;this.updateEdgeData([{id:Nt(o),style:{zIndex:Math.max(v,p)-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=>Nt(s)!==t)}),n==="combo"&&!pa(i)){const s=new Set(this.getAncestorsData(t,nr).map(Nt));a.nodes=a.nodes.filter(o=>!s.has(Nt(o))),a.combos=a.combos.filter(o=>!s.has(Nt(o))),a.edges=a.edges.filter(({source:o,target:A})=>!s.has(o)&&!s.has(A))}return Math.max(((e=i.style)===null||e===void 0?void 0:e.zIndex)||0,0,...Object.values(a).flat().map(s=>{var o;return(((o=s==null?void 0:s.style)===null||o===void 0?void 0:o.zIndex)||0)+1}))}updateNodeLikeHierarchy(t){if(!this.enableUpdateNodeLikeHierarchy)return;const{model:e}=this;t.forEach(n=>{const i=Nt(n),a=$f(n);a!==void 0&&(e.hasTreeStructure(nr)||e.attachTreeStructure(nr),a===null&&this.refreshComboData(i),this.setParent(i,$f(n),nr));const s=n.children||[];if(s.length){e.hasTreeStructure(Qa)||e.attachTreeStructure(Qa);const o=s.filter(A=>e.hasNode(A));o.forEach(A=>this.setParent(A,i,Qa)),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=Nt(i),s=Ei(e.getNode(a));if(Kc(s,i))return;const o=TA(s,i);this.pushChange({value:o,original:s,type:fr.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:fr.NodeUpdated})}),e.forEach(i=>{this.pushChange({value:i,original:i,type:fr.EdgeUpdated})}),n.forEach(i=>{this.pushChange({value:i,original:i,type:fr.ComboUpdated})})}syncNodeLikeDatum(t){const{model:e}=this,n=Nt(t);if(!e.hasNode(n))return;const i=Ei(e.getNode(n)),a=TA(i,t);e.mergeNodeData(n,a)}syncEdgeDatum(t){const{model:e}=this,n=Nt(t);if(!e.hasEdge(n))return;const i=Ei(e.getEdge(n)),a=TA(i,t);e.mergeEdgeData(n,a)}updateEdgeData(t=[]){if(!t.length)return;const{model:e}=this;this.batch(()=>{t.forEach(n=>{const i=Nt(n),a=Ei(e.getEdge(i));if(Kc(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=TA(a,n);this.pushChange({value:s,original:a,type:fr.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=Nt(i),s=Ei(e.getNode(a));if(Kc(s,i))return;const o=TA(s,i);this.pushChange({value:o,original:s,type:fr.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=$f(a);if(s!==e&&n===nr){const o={id:t,combo:e};this.isCombo(t)?this.syncNodeLikeDatum(o):this.syncNodeLikeDatum(o)}this.model.setParent(t,e,n),i&&n===nr&&X5([s,e]).forEach(o=>{o!==void 0&&this.refreshComboData(o)})}refreshComboData(t){const e=this.getComboData([t])[0],n=this.getAncestorsData(t,nr);e&&this.pushChange({value:e,original:e,type:fr.ComboUpdated}),n.forEach(i=>{this.pushChange({value:i,original:i,type:fr.ComboUpdated})})}getElementPosition(t){const e=this.getElementDataById(t);return li(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=$e(n,[...e,0].slice(0,3));this.translateNodeTo(t,i)}translateNodeTo(t,e){const[n=0,i=0,a=0]=e;this.preventUpdateNodeLikeHierarchy(()=>{this.updateNodeData([{id:t,style:{x:n,y:i,z:a}}])})}translateComboBy(t,e){const[n=0,i=0,a=0]=e;if([n,i,a].some(isNaN)||[n,i,a].every(A=>A===0))return;const s=this.getComboData([t])[0];if(!s)return;const o=new Set;Cl(s,A=>{const l=Nt(A);if(o.has(l))return;o.add(l);const[c,u,h]=li(A),d=TA(A,{style:{x:c+n,y:u+i,z:h+a}});this.pushChange({value:d,original:A,type:this.isCombo(l)?fr.ComboUpdated:fr.NodeUpdated}),this.model.mergeNodeData(l,d)},A=>this.getChildrenData(Nt(A)),"BT")}translateComboTo(t,e){var n;if(e.some(isNaN))return;const[i=0,a=0,s=0]=e,o=(n=this.getComboData([t]))===null||n===void 0?void 0:n[0];if(!o)return;const[A,l,c]=li(o),u=i-A,h=a-l,d=s-c;Cl(o,f=>{const g=Nt(f),[v,p,y]=li(f),x=TA(f,{style:{x:v+u,y:p+h,z:y+d}});this.pushChange({value:x,original:f,type:this.isCombo(g)?fr.ComboUpdated:fr.NodeUpdated}),this.model.mergeNodeData(g,x)},f=>this.getChildrenData(Nt(f)),"BT")}removeData(t){const{nodes:e,edges:n,combos:i}=t;this.batch(()=>{this.removeEdgeData(n),this.removeNodeData(e),this.removeComboData(i),this.latestRemovedComboIds=new Set(i)})}removeNodeData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.removeEdgeData(this.getRelatedEdgesData(e).map(Nt)),this.pushChange({value:this.getNodeData([e])[0],type:fr.NodeRemoved}),this.removeNodeLikeHierarchy(e)}),this.model.removeNodes(t)})}removeEdgeData(t=[]){t.length&&(t.forEach(e=>this.pushChange({value:this.getEdgeData([e])[0],type:fr.EdgeRemoved})),this.model.removeEdges(t))}removeComboData(t=[]){t.length&&this.batch(()=>{t.forEach(e=>{this.pushChange({value:this.getComboData([e])[0],type:fr.ComboRemoved}),this.removeNodeLikeHierarchy(e),this.comboIds.delete(e)}),this.model.removeNodes(t)})}removeNodeLikeHierarchy(t){if(this.model.hasTreeStructure(nr)){const e=$f(this.getNodeLikeDatum(t));this.setParent(t,void 0,nr,!1),this.model.getChildren(t,nr).forEach(n=>{const i=Ei(n),a=Nt(i);this.setParent(Nt(i),e,nr,!1);const s=TA(i,{id:Nt(i),combo:e});this.pushChange({value:s,original:i,type:this.isCombo(a)?fr.ComboUpdated:fr.NodeUpdated}),this.model.mergeNodeData(Nt(i),s)}),Re(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(ko(`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 su=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class t8{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 Ai({className:"elements"}))}}emit(t,e){e.silence||ui(this.context.graph,t)}forEachElementData(t){xl.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=Lx(e)&&((n=i[t])===null||n===void 0?void 0:n.type)||e.type;return s?typeof s=="string"?s:s.call(a,e):t==="edge"?"line":"circle"}getTheme(t){return FB(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({},Hb((i=this.getTheme(e))===null||i===void 0?void 0:i.palette),Hb((a=t[e])===null||a===void 0?void 0:a.palette));s!=null&&s.field&&Object.assign(this.paletteStyle,NL(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[Nt(e.datum)]=_b(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[Nt(t)])}getCombos(){return this.context.model.getComboData().map(({id:t})=>this.elementMap[t])}getElementComputedStyle(t,e){const n=Nt(e),i=this.getThemeStyle(t),a=this.getPaletteStyle(t,n),s=e.style||{},o=this.getDefaultStyle(n),A=this.getThemeStateStyle(t,this.getElementState(n)),l=this.getStateStyle(n),c=Lx(e)?Object.assign({},i,a,s,o,A,l):Object.assign({},s);if(t==="combo"){const u=this.context.model.getChildrenData(n),d=!!c.collapsed?[]:u.map(Nt).filter(f=>this.getElement(f));Object.assign(c,{childrenNode:d,childrenData:u})}return c}getDrawData(t){this.init();const e=this.computeChangesAndDrawData(t);if(!e)return null;const{type:n="draw",stage:i=n}=t;return this.markDestroyElement(e.drawData),this.computeStyle(i),{type:n,stage:i,data:e}}draw(t={animation:!0}){const e=this.getDrawData(t);if(!e)return;const{data:{drawData:{add:n,update:i,remove:a}}}=e;return this.destroyElements(a,t),this.createElements(n,t),this.updateElements(i,t),this.setAnimationTask(t,e)}preLayoutDraw(){return su(this,arguments,void 0,function*(t={animation:!0}){var e,n;const i=this.getDrawData(t);if(!i)return;const{data:{drawData:a}}=i;yield(n=(e=this.context.layout)===null||e===void 0?void 0:e.preLayout)===null||n===void 0?void 0:n.call(e,a);const{add:s,update:o,remove:A}=a;return this.destroyElements(A,t),this.createElements(s,t),this.updateElements(o,t),this.setAnimationTask(t,i)})}setAnimationTask(t,e){const{animation:n,silence:i}=t,{data:{dataChanges:a,drawData:s},stage:o,type:A}=e;return this.context.animation.animate(n,i?{}:{before:()=>this.emit(new Xr(Ae.BEFORE_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render"}),t),beforeAnimate:l=>this.emit(new os(Ae.BEFORE_ANIMATE,ga.DRAW,l,s),t),afterAnimate:l=>this.emit(new os(Ae.AFTER_ANIMATE,ga.DRAW,l,s),t),after:()=>this.emit(new Xr(Ae.AFTER_DRAW,{dataChanges:a,animation:n,stage:o,render:A==="render",firstRender:this.context.graph.rendered===!1}),t)})}computeChangesAndDrawData(t){const{model:e}=this.context,n=e.getChanges(),i=f1(n);if(i.length===0)return null;const{NodeAdded:a=[],NodeUpdated:s=[],NodeRemoved:o=[],EdgeAdded:A=[],EdgeUpdated:l=[],EdgeRemoved:c=[],ComboAdded:u=[],ComboUpdated:h=[],ComboRemoved:d=[]}=Pf(i,O=>O.type),f=(O,L)=>{const U=[];return O.forEach(R=>{const j=Nt(R.value);this.getElement(j)?U.push(R):L.push(R)}),U},g=f(s,a),v=f(l,A),p=f(h,u),y=O=>new Map(O.map(L=>{const U=L.value;return[Nt(U),U]})),x={add:{nodes:y(a),edges:y(A),combos:y(u)},update:{nodes:y(g),edges:y(v),combos:y(p)},remove:{nodes:y(o),edges:y(c),combos:y(d)}},F=this.transformData(x,t);return e.clearChanges(),{dataChanges:n,drawData:F}}transformData(t,e){const n=this.context.transform.getTransformInstance();return Object.values(n).reduce((i,a)=>a.beforeDraw(i,e),t)}createElement(t,e,n){var i;const a=Nt(e);if(this.getElement(a))return;const o=this.getElementType(t,e),A=this.getElementComputedStyle(t,e),l=Lo(t,o);if(!l)return va.warn(`The element ${o} of ${t} is not registered.`);this.emit(new iu(Ae.BEFORE_ELEMENT_CREATE,t,e),n);const c=this.container.appendChild(new l({id:a,context:this.context,style:A}));this.shapeTypeMap[a]=o,this.elementMap[a]=c;const{stage:u="enter"}=n;(i=this.context.animation)===null||i===void 0||i.add({element:c,elementType:t,stage:u,originalStyle:Object.assign({},c.attributes),updatedStyle:A},{after:()=>{var h;this.emit(new iu(Ae.AFTER_ELEMENT_CREATE,t,e),n),(h=c.onCreate)===null||h===void 0||h.call(c)}})}createElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.createElement(o,l,e))})}getUpdateStageStyle(t,e,n){const{stage:i="update"}=n;if(i==="translate")if(t==="node"||t==="combo"){const{style:{x:a=0,y:s=0,z:o=0}={}}=e;return{x:a,y:s,z:o}}else return{};return this.getElementComputedStyle(t,e)}updateElement(t,e,n){var i;const a=Nt(e),{stage:s="update"}=n,o=this.getElement(a);if(!o)return()=>null;this.emit(new iu(Ae.BEFORE_ELEMENT_UPDATE,t,e),n);const A=this.getElementType(t,e),l=this.getUpdateStageStyle(t,e,n);this.shapeTypeMap[a]!==A&&(o.destroy(),delete this.shapeTypeMap[a],delete this.elementMap[a],this.createElement(t,e,{animation:!1,silence:!0}));const c=s!=="visibility"?s:l.visibility==="hidden"?"hide":"show";c==="hide"&&delete l.visibility,(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:c,originalStyle:Object.assign({},o.attributes),updatedStyle:l},{before:()=>{const u=this.elementMap[a];s!=="collapse"&&Ny(u,l),s==="visibility"&&(W5(u,"opacity")||V5(u,"opacity"),this.visibilityCache.set(u,c==="show"?"visible":"hidden"),c==="show"&&Bl(u,"visible"))},after:()=>{var u;const h=this.elementMap[a];s==="collapse"&&Ny(h,l),c==="hide"&&Bl(h,this.visibilityCache.get(h)),this.emit(new iu(Ae.AFTER_ELEMENT_UPDATE,t,e),n),(u=h.onUpdate)===null||u===void 0||u.call(h)}})}updateElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["node",n],["combo",a],["edge",i]].forEach(([o,A])=>{A.forEach(l=>this.updateElement(o,l,e))})}markDestroyElement(t){Object.values(t.remove).forEach(e=>{e.forEach(n=>{const i=Nt(n),a=this.getElement(i);a&&kQ(a)})})}destroyElement(t,e,n){var i;const{stage:a="exit"}=n,s=Nt(e),o=this.elementMap[s];if(!o)return()=>null;this.emit(new iu(Ae.BEFORE_ELEMENT_DESTROY,t,e),n),(i=this.context.animation)===null||i===void 0||i.add({element:o,elementType:t,stage:a,originalStyle:Object.assign({},o.attributes),updatedStyle:{}},{after:()=>{var A;this.clearElement(s),o.destroy(),(A=o.onDestroy)===null||A===void 0||A.call(o),this.emit(new iu(Ae.AFTER_ELEMENT_DESTROY,t,e),n)}})}destroyElements(t,e){const{nodes:n,edges:i,combos:a}=t;[["combo",a],["edge",i],["node",n]].forEach(([o,A])=>{A.forEach(l=>this.destroyElement(o,l,e))})}clearElement(t){delete this.paletteStyle[t],delete this.defaultStyle[t],delete this.stateStyle[t],delete this.elementMap[t],delete this.shapeTypeMap[t]}alignLayoutResultToElement(t,e){var n,i;const a=(n=t.nodes)===null||n===void 0?void 0:n.find(s=>Nt(s)===e);if(a){const s=li(this.context.model.getNodeLikeDatum(e)),o=li(a),A=tr(s,o);(i=t.nodes)===null||i===void 0||i.forEach(l=>{var c,u,h;!((c=l.style)===null||c===void 0)&&c.x&&(l.style.x+=A[0]),!((u=l.style)===null||u===void 0)&&u.y&&(l.style.y+=A[1]),!((h=l.style)===null||h===void 0)&&h.z&&(l.style.z+=A[2]||0)})}}syncLayoutResult(t,e){return su(this,void 0,void 0,function*(){const{layout:n,model:i}=this.context;if(!n)return;const a=this.context.options.layout,s=A=>Array.isArray(A)?A.map(l=>Object.assign(Object.assign({},l),{preLayout:!0})):Object.assign(Object.assign({},A),{preLayout:!0}),o=yield n.simulate(a?s(a):void 0);e&&this.alignLayoutResultToElement(o,t),i.updateData(o)})}collapseNode(t,e){return su(this,void 0,void 0,function*(){var n;const{animation:i,align:a}=e;yield this.syncLayoutResult(t,a);const s=this.computeChangesAndDrawData({stage:"collapse",animation:i});if(!s)return;const{drawData:o}=s,{add:A,remove:l,update:c}=o;this.markDestroyElement(o);const u={animation:i,stage:"collapse",data:o};this.destroyElements(l,u),this.createElements(A,u),this.updateElements(c,u),yield(n=this.context.animation.animate(i,{beforeAnimate:h=>this.emit(new os(Ae.BEFORE_ANIMATE,ga.COLLAPSE,h,o),u),afterAnimate:h=>this.emit(new os(Ae.AFTER_ANIMATE,ga.COLLAPSE,h,o),u)},{collapse:{target:t,descendants:Array.from(l.nodes).map(([,h])=>Nt(h)),position:li(c.nodes.get(t))}}))===null||n===void 0?void 0:n.finished})}expandNode(t,e){return su(this,void 0,void 0,function*(){var n;const{model:i}=this.context,{animation:a,align:s}=e,o=li(i.getNodeData([t])[0]);yield this.syncLayoutResult(t,s);const A=this.computeChangesAndDrawData({stage:"expand",animation:a});if(this.createElements(A.drawData.add,{animation:!1,stage:"expand",target:t}),this.context.animation.clear(),this.computeStyle("expand"),!A)return;const{drawData:l}=A,{update:c,add:u}=l,h={animation:a,stage:"expand",data:l};u.edges.forEach(d=>c.edges.set(Nt(d),d)),u.nodes.forEach(d=>c.nodes.set(Nt(d),d)),this.updateElements(c,h),yield(n=this.context.animation.animate(a,{beforeAnimate:d=>this.emit(new os(Ae.BEFORE_ANIMATE,ga.EXPAND,d,l),h),afterAnimate:d=>this.emit(new os(Ae.AFTER_ANIMATE,ga.EXPAND,d,l),h)},{expand:{target:t,descendants:Array.from(u.nodes).map(([,d])=>Nt(d)),position:o}}))===null||n===void 0?void 0:n.finished})}collapseCombo(t,e){return su(this,void 0,void 0,function*(){var n;const{model:i,element:a}=this.context;if(i.getAncestorsData(t,nr).some(g=>pa(g)))return;const s=a.getElement(t),o=s.getComboPosition(Object.assign(Object.assign({},s.attributes),{collapsed:!0})),A=this.computeChangesAndDrawData({stage:"collapse",animation:e});if(!A)return;const{dataChanges:l,drawData:c}=A;this.markDestroyElement(c);const{update:u,remove:h}=c,d={animation:e,stage:"collapse",data:c};this.destroyElements(h,d),this.updateElements(u,d);const f=g=>Array.from(g).map(([,v])=>Nt(v));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Xr(Ae.BEFORE_DRAW,{dataChanges:l,animation:e}),d),beforeAnimate:g=>this.emit(new os(Ae.BEFORE_ANIMATE,ga.COLLAPSE,g,c),d),afterAnimate:g=>this.emit(new os(Ae.AFTER_ANIMATE,ga.COLLAPSE,g,c),d),after:()=>this.emit(new Xr(Ae.AFTER_DRAW,{dataChanges:l,animation:e}),d)},{collapse:{target:t,descendants:[...f(h.nodes),...f(h.combos)],position:o}}))===null||n===void 0?void 0:n.finished})}expandCombo(t,e){return su(this,void 0,void 0,function*(){var n;const{model:i}=this.context,a=li(i.getComboData([t])[0]);this.computeStyle("expand");const s=this.computeChangesAndDrawData({stage:"expand",animation:e});if(!s)return;const{dataChanges:o,drawData:A}=s,{add:l,update:c}=A,u={animation:e,stage:"expand",data:A,target:t};this.createElements(l,u),this.updateElements(c,u);const h=d=>Array.from(d).map(([,f])=>Nt(f));yield(n=this.context.animation.animate(e,{before:()=>this.emit(new Xr(Ae.BEFORE_DRAW,{dataChanges:o,animation:e}),u),beforeAnimate:d=>this.emit(new os(Ae.BEFORE_ANIMATE,ga.EXPAND,d,A),u),afterAnimate:d=>this.emit(new os(Ae.AFTER_ANIMATE,ga.EXPAND,d,A),u),after:()=>this.emit(new Xr(Ae.AFTER_DRAW,{dataChanges:o,animation:e}),u)},{expand:{target:t,descendants:[...h(l.nodes),...h(l.combos)],position:a}}))===null||n===void 0?void 0:n.finished})}clear(){this.container.destroy(),this.initContainer(),this.elementMap={},this.shapeTypeMap={},this.defaultStyle={},this.stateStyle={},this.paletteStyle={}}destroy(){this.clear(),this.container.destroy(),this.context={}}}const vM=Symbol("Comlink.proxy"),e8=Symbol("Comlink.endpoint"),pM=Symbol("Comlink.releaseProxy"),ow=Symbol("Comlink.finalizer"),J0=Symbol("Comlink.thrown"),mM=r=>typeof r=="object"&&r!==null||typeof r=="function",n8={canHandle:r=>mM(r)&&r[vM],serialize(r){const{port1:t,port2:e}=new MessageChannel;return wM(r,t),[e,[e]]},deserialize(r){return r.start(),BM(r)}},r8={canHandle:r=>mM(r)&&J0 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}},yM=new Map([["proxy",n8],["throw",r8]]);function i8(r,t){for(const e of r)if(t===e||e==="*"||e instanceof RegExp&&e.test(t))return!0;return!1}function wM(r,t=globalThis,e=["*"]){t.addEventListener("message",function n(i){if(!i||!i.data)return;if(!i8(e,i.origin)){console.warn(`Invalid origin '${i.origin}' for comlink proxy`);return}const{id:a,type:s,path:o}=Object.assign({path:[]},i.data),A=(i.data.argumentList||[]).map(zl);let l;try{const c=o.slice(0,-1).reduce((h,d)=>h[d],r),u=o.reduce((h,d)=>h[d],r);switch(s){case"GET":l=u;break;case"SET":c[o.slice(-1)[0]]=zl(i.data.value),l=!0;break;case"APPLY":l=u.apply(c,A);break;case"CONSTRUCT":{const h=new u(...A);l=c8(h)}break;case"ENDPOINT":{const{port1:h,port2:d}=new MessageChannel;wM(r,d),l=l8(h,[h])}break;case"RELEASE":l=void 0;break;default:return}}catch(c){l={value:c,[J0]:0}}Promise.resolve(l).catch(c=>({value:c,[J0]:0})).then(c=>{const[u,h]=ev(c);t.postMessage(Object.assign(Object.assign({},u),{id:a}),h),s==="RELEASE"&&(t.removeEventListener("message",n),EM(t),ow in r&&typeof r[ow]=="function"&&r[ow]())}).catch(c=>{const[u,h]=ev({value:new TypeError("Unserializable return value"),[J0]:0});t.postMessage(Object.assign(Object.assign({},u),{id:a}),h)})}),t.start&&t.start()}function a8(r){return r.constructor.name==="MessagePort"}function EM(r){a8(r)&&r.close()}function BM(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)}}),Aw(r,e,[],t)}function q0(r){if(r)throw new Error("Proxy has been released and is not useable")}function bM(r){return ou(r,new Map,{type:"RELEASE"}).then(()=>{EM(r)})}const $0=new WeakMap,tv="FinalizationRegistry"in globalThis&&new FinalizationRegistry(r=>{const t=($0.get(r)||0)-1;$0.set(r,t),t===0&&bM(r)});function s8(r,t){const e=($0.get(t)||0)+1;$0.set(t,e),tv&&tv.register(r,t,r)}function o8(r){tv&&tv.unregister(r)}function Aw(r,t,e=[],n=function(){}){let i=!1;const a=new Proxy(n,{get(s,o){if(q0(i),o===pM)return()=>{o8(a),bM(r),t.clear(),i=!0};if(o==="then"){if(e.length===0)return{then:()=>a};const A=ou(r,t,{type:"GET",path:e.map(l=>l.toString())}).then(zl);return A.then.bind(A)}return Aw(r,t,[...e,o])},set(s,o,A){q0(i);const[l,c]=ev(A);return ou(r,t,{type:"SET",path:[...e,o].map(u=>u.toString()),value:l},c).then(zl)},apply(s,o,A){q0(i);const l=e[e.length-1];if(l===e8)return ou(r,t,{type:"ENDPOINT"}).then(zl);if(l==="bind")return Aw(r,t,e.slice(0,-1));const[c,u]=xM(A);return ou(r,t,{type:"APPLY",path:e.map(h=>h.toString()),argumentList:c},u).then(zl)},construct(s,o){q0(i);const[A,l]=xM(o);return ou(r,t,{type:"CONSTRUCT",path:e.map(c=>c.toString()),argumentList:A},l).then(zl)}});return s8(a,r),a}function A8(r){return Array.prototype.concat.apply([],r)}function xM(r){const t=r.map(ev);return[t.map(e=>e[0]),A8(t.map(e=>e[1]))]}const CM=new WeakMap;function l8(r,t){return CM.set(r,t),r}function c8(r){return Object.assign(r,{[vM]:!0})}function GK(r,t=globalThis,e="*"){return{postMessage:(n,i)=>r.postMessage(n,e,i),addEventListener:t.addEventListener.bind(t),removeEventListener:t.removeEventListener.bind(t)}}function ev(r){for(const[t,e]of yM)if(e.canHandle(r)){const[n,i]=e.serialize(r);return[{type:"HANDLER",name:t,value:n},i]}return[{type:"RAW",value:r},CM.get(r)||[]]}function zl(r){switch(r.type){case"HANDLER":return yM.get(r.name).deserialize(r.value);case"RAW":return r.value}}function ou(r,t,e,n){return new Promise(i=>{const a=u8();t.set(a,i),r.start&&r.start(),r.postMessage(Object.assign({id:a},e),n)})}function u8(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}class h8 extends Qg{constructor(t,e,n){super(),this.graph=t,this.layout=e,this.options=n,this.spawnWorker()}spawnWorker(){this.proxy=BM(new Worker(new URL(T.p+T.u(1009),T.b),{type:void 0})),this.running&&(this.running=!1,this.execute())}execute(){var t;return(0,D.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,D._T)(e,["onTick"]),a={};Object.keys(i).forEach(l=>{Vt(i[l])||(a[l]=i[l])});const s={layout:{id:this.layout.id,options:a,iterations:(t=this.options)===null||t===void 0?void 0:t.iterations},nodes:this.graph.getAllNodes(),edges:this.graph.getAllEdges()},o=new Float32Array([0]),[A]=yield this.proxy.calculateLayout(s,[o]);return A})}stop(){return this.running=!1,this.proxy.stopLayout(),this}kill(){this.proxy[pM]()}isRunning(){return this.running}}var Au=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})},d8=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{const u=Nt(c),h=A.nodes.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),(i=l==null?void 0:l.edges)===null||i===void 0||i.forEach(c=>{const u=Nt(c),h=A.edges.get(u);o.syncEdgeDatum(c),h&&Object.assign(h.style,c.style)}),(a=l==null?void 0:l.combos)===null||a===void 0||a.forEach(c=>{const u=Nt(c),h=A.combos.get(u);o.syncNodeLikeDatum(c),h&&Object.assign(h.style,c.style)}),ui(s,new Xr(Ae.AFTER_LAYOUT,{type:"pre"})),this.transformDataAfterLayout("pre",t)})}postLayout(){return Au(this,arguments,void 0,function*(t=this.options){if(!t)return;const e=Array.isArray(t)?t:[t],{graph:n}=this.context;ui(n,new Xr(Ae.BEFORE_LAYOUT,{type:"post"}));for(let i=0;ii.afterLayout(t,e))}simulate(){return Au(this,arguments,void 0,function*(t=this.options){if(!t)return{};const e=Array.isArray(t)?t:[t];let n={};for(let i=0;i{this.updateElementPosition(l,!1)}}):(o.execute(t),o.stop(),o.tick(s));const A=yield o.execute(t);if(i){const l=this.updateElementPosition(A,i);yield l==null?void 0:l.finished}return A})}treeLayout(t,e,n){return Au(this,void 0,void 0,function*(){const{type:i,animation:a}=e,s=Lo("layout",i);if(!s)return{};const{nodes:o=[],edges:A=[]}=t,l=new Gr({nodes:o.map(f=>({id:Nt(f),data:f.data||{}})),edges:A.map(f=>({id:Nt(f),source:f.source,target:f.target,data:f.data||{}}))});q5(l);const c={nodes:[],edges:[]},u={nodes:[],edges:[]};l.getRoots(Qa).forEach(f=>{Cl(f,x=>{x.children=l.getSuccessors(x.id)},x=>l.getSuccessors(x.id),"TB");const g=s(f,e),{x:v,y:p,z:y=0}=g;Cl(g,x=>{const{id:F,x:O,y:L,z:U=0}=x;c.nodes.push({id:F,style:{x:v,y:p,z:y}}),u.nodes.push({id:F,style:{x:O,y:L,z:U}})},x=>x.children,"TB")});const d=this.inferTreeLayoutOffset(u);if(SM(u,d),a){SM(c,d),this.updateElementPosition(c,!1);const f=this.updateElementPosition(u,a);yield f==null?void 0:f.finished}return u})}inferTreeLayoutOffset(t){var e;let[n,i]=[1/0,-1/0],[a,s]=[1/0,-1/0];(e=t.nodes)===null||e===void 0||e.forEach(g=>{const{x:v=0,y:p=0}=g.style||{};n=Math.min(n,v),i=Math.max(i,v),a=Math.min(a,p),s=Math.max(s,p)});const{canvas:o}=this.context,A=o.getSize(),[l,c]=o.getCanvasByViewport([0,0]),[u,h]=o.getCanvasByViewport(A);if(n>=l&&i<=u&&a>=c&&s<=h)return[0,0];const d=(l+u)/2,f=(c+h)/2;return[d-(n+i)/2,f-(a+s)/2]}stopLayout(){this.instance&&t1(this.instance)&&(this.instance.stop(),this.instance=void 0),this.supervisor&&(this.supervisor.stop(),this.supervisor=void 0),this.animationResult&&(this.animationResult.finish(),this.animationResult=void 0)}getLayoutData(t){const{nodeFilter:e=()=>!0,comboFilter:n=()=>!0,preLayout:i=!1,isLayoutInvisibleNodes:a=!1}=t,{nodes:s,edges:o,combos:A}=this.context.model.getData(),{element:l,model:c}=this.context,u=p=>l.getElement(p),h=i?p=>{var y;return!a&&(((y=p.style)===null||y===void 0?void 0:y.visibility)==="hidden"||c.getAncestorsData(p.id,Qa).some(pa)||c.getAncestorsData(p.id,nr).some(pa))?!1:e(p)}:p=>{const y=Nt(p),x=u(y);return!x||Ih(x)?!1:e(p)},d=s.filter(h),f=A.filter(n),g=new Map(d.map(p=>[Nt(p),p]));f.forEach(p=>g.set(Nt(p),p));const v=o.filter(({source:p,target:y})=>g.has(p)&&g.has(y));return{nodes:d,edges:v,combos:f}}initGraphLayout(t){var e;const{element:n,viewport:i}=this.context,{type:a,enableWorker:s,animation:o,iterations:A}=t,l=d8(t,["type","enableWorker","animation","iterations"]),[c,u]=i.getCanvasSize(),h=[c/2,u/2],d=(e=t==null?void 0:t.nodeSize)!==null&&e!==void 0?e:y=>{const x=n==null?void 0:n.getElement(y.id);return x?x.attributes.size:n==null?void 0:n.getElementComputedStyle("node",y).size},f=Lo("layout",a);if(!f)return va.warn(`The layout of ${a} is not registered.`);const g=Object.getPrototypeOf(f.prototype)===Rg.prototype?f:WQ(f,this.context),v=new g(this.context),p={nodeSize:d,width:c,height:u,center:h};switch(v.id){case"d3-force":case"d3-force-3d":Object.assign(p,{center:{x:c/2,y:u/2,z:0}});break;default:break}return Si(v.options,p,l),v}updateElementPosition(t,e){const{model:n,element:i}=this.context;return i?(n.updateData(t),i.draw({animation:e,silence:!0})):null}destroy(){var t;this.stopLayout(),this.context={},(t=this.supervisor)===null||t===void 0||t.kill(),this.supervisor=void 0,this.instance=void 0,this.instances=[],this.animationResult=void 0}}const SM=(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 g8(r){return[v8].reduce((e,n)=>n(e),r)}function v8(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 p8 extends oy{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;va.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 nv=["update-related-edges","collapse-expand-node","collapse-expand-combo","get-edge-actual-ends","arrange-draw-order"];class m8 extends oy{constructor(t){super(t),this.category="transform",this.setTransforms(this.context.options.transforms||[])}getTransforms(){}setTransforms(t){this.setExtensions([...nv.slice(0,nv.length-1),...t,nv[nv.length-1]])}getTransformInstance(t){return t?this.extensionMap[t]:this.extensionMap}}var td=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class y8{get padding(){return Ua(this.context.options.padding)}get paddingOffset(){const[t,e,n,i]=this.padding,[a,s,o]=[(i-e)/2,(t-n)/2,0];return[a,s,o]}constructor(t){this.landmarkCounter=0,this.context=t;const[e,n]=this.paddingOffset,{zoom:i,rotation:a,x:s=e,y:o=n}=t.options;this.transform({mode:"absolute",scale:i,translate:[s,o],rotate:a},!1)}get camera(){const{canvas:t}=this.context;return new Proxy(t.getCamera(),{get:(e,n)=>{const a=Object.entries(t.getLayers()).filter(([o])=>!["main"].includes(o)).map(([,o])=>o.getCamera()),s=e[n];if(typeof s=="function")return(...o)=>{const A=s.apply(e,o);return a.forEach(l=>{l[n].apply(l,o)}),A}}})}createLandmark(t){return this.camera.createLandmark(`landmark-${this.landmarkCounter++}`,t)}getAnimation(t){const e=TB(this.context.options,t);return e?Fl(Object.assign({},e),["easing","duration"]):!1}getCanvasSize(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e,n]}getCanvasCenter(){const{canvas:t}=this.context,{width:e=0,height:n=0}=t.getConfig();return[e/2,n/2,0]}getViewportCenter(){const[t,e]=this.camera.getPosition();return[t,e,0]}getGraphCenter(){return this.context.graph.getViewportByCanvas(this.getCanvasCenter())}getZoom(){return this.camera.getZoom()}getRotation(){return this.camera.getRoll()}getTranslateOptions(t){const{camera:e}=this,{mode:n,translate:i=[]}=t,a=this.getZoom(),s=e.getPosition(),o=e.getFocalPoint(),[A,l]=this.getCanvasCenter(),[c=0,u=0,h=0]=i,d=Ms([-c,-u,-h],a);return n==="relative"?{position:$e(s,d),focalPoint:$e(o,d)}:{position:$e([A,l,s[2]],d),focalPoint:$e([A,l,o[2]],d)}}getRotateOptions(t){const{mode:e,rotate:n=0}=t;return{roll:e==="relative"?this.camera.getRoll()+n:n}}getZoomOptions(t){const{zoomRange:e}=this.context.options,n=this.camera.getZoom(),{mode:i,scale:a=1}=t;return dr(i==="relative"?n*a:a,...e)}transform(t,e){return td(this,void 0,void 0,function*(){const{graph:n}=this.context,{translate:i,rotate:a,scale:s,origin:o}=t;this.cancelAnimation();const A=this.getAnimation(e);if(ui(n,new Y0(Ae.BEFORE_TRANSFORM,t)),!a&&s&&!i&&o&&!A){this.camera.setZoomByViewportPoint(this.getZoomOptions(t),o),ui(n,new Y0(Ae.AFTER_TRANSFORM,t));return}const l={};if(i&&Object.assign(l,this.getTranslateOptions(t)),ye(a)&&Object.assign(l,this.getRotateOptions(t)),ye(s)&&Object.assign(l,{zoom:this.getZoomOptions(t)}),A)return ui(n,new os(Ae.BEFORE_ANIMATE,ga.TRANSFORM,null,t)),new Promise(c=>{this.transformResolver=c,this.camera.gotoLandmark(this.createLandmark(l),Object.assign(Object.assign({},A),{onfinish:()=>{ui(n,new os(Ae.AFTER_ANIMATE,ga.TRANSFORM,null,t)),ui(n,new Y0(Ae.AFTER_TRANSFORM,t)),this.transformResolver=void 0,c()}}))});this.camera.gotoLandmark(this.createLandmark(l),{duration:0}),ui(n,new Y0(Ae.AFTER_TRANSFORM,t))})}fitView(t,e){return td(this,void 0,void 0,function*(){const[n,i,a,s]=this.padding,{when:o="always",direction:A="both"}=t||{},[l,c]=this.context.canvas.getSize(),u=l-s-i,h=c-n-a,d=this.context.canvas.getBounds(),f=this.getBBoxInViewport(d),[g,v]=yA(f),p=A==="x"&&g>=u||A==="y"&&v>=h||A==="both"&&g>=u&&v>=h;if(o==="overflow"&&!p)return yield this.fitCenter({animation:e});const y=u/g,x=h/v,F=A==="x"?y:A==="y"?x:Math.min(y,x),O=this.getAnimation(e);Number.isFinite(F)&&(yield this.transform({mode:"relative",scale:F,translate:$e(tr(this.getCanvasCenter(),this.getBBoxInViewport(d).center),Ms(this.paddingOffset,F))},O))})}fitCenter(t){return td(this,void 0,void 0,function*(){const e=this.context.canvas.getBounds();yield this.focus(e,t)})}focusElements(t){return td(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=vh(e.map(o=>a(i.getElement(o))));yield this.focus(s,n)})}focus(t,e){return td(this,void 0,void 0,function*(){const n=this.context.graph.getViewportByCanvas(t.center),i=e.position||this.getCanvasCenter(),a=tr(i,n);yield this.transform({mode:"relative",translate:$e(a,this.paddingOffset)},e.animation)})}getBBoxInViewport(t){const{min:e,max:n}=t,{graph:i}=this.context,[a,s]=i.getViewportByCanvas(e),[o,A]=i.getViewportByCanvas(n),l=new Zn;return l.setMinMax([a,s,0],[o,A,0]),l}isInViewport(t,e=!1,n=0){const{graph:i}=this.context,a=this.getCanvasSize(),[s,o]=i.getCanvasByViewport([0,0]),[A,l]=i.getCanvasByViewport(a);let c=new Zn;return c.setMinMax([s,o,0],[A,l,0]),n&&(c=EA(c,n)),Pc(t)?xs(t,c):e?bI(t,c):c.intersects(t)}cancelAnimation(){var t,e;!((t=this.camera.landmarks)===null||t===void 0)&&t.length&&this.camera.cancelLandmarkAnimation(),(e=this.transformResolver)===null||e===void 0||e.call(this)}}var sr=function(r,t,e,n){function i(a){return a instanceof e?a:new e(function(s){s(a)})}return new(e||(e=Promise))(function(a,s){function o(c){try{l(n.next(c))}catch(u){s(u)}}function A(c){try{l(n.throw(c))}catch(u){s(u)}}function l(c){c.done?a(c.value):i(c.value).then(o,A)}l((n=n.apply(r,t||[])).next())})};class rv extends Qg{constructor(t){var e;super(),this.options={},this.rendered=!1,this.destroyed=!1,this.context={model:new $5},this.isCollapsingExpanding=!1,this.onResize=Lh(()=>{this.resize()},300),this._setOptions(Object.assign({},rv.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,g8(t)),e){const{data:h}=t;h&&this.addData(h);return}const{behaviors:n,combo:i,data:a,edge:s,layout:o,node:A,plugins:l,theme:c,transforms:u}=t;n&&this.setBehaviors(n),a&&this.setData(a),A&&this.setNode(A),s&&this.setEdge(s),i&&this.setCombo(i),o&&this.setLayout(o),c&&this.setTheme(c),l&&this.setPlugins(l),u&&this.setTransforms(u)}getSize(){return this.context.canvas?this.context.canvas.getSize():[this.options.width||0,this.options.height||0]}setSize(t,e){t&&(this.options.width=t),e&&(this.options.height=e),this.resize(t,e)}setZoomRange(t){this.options.zoomRange=t}getZoomRange(){return this.options.zoomRange}setNode(t){this.options.node=t,this.context.model.refreshData()}setEdge(t){this.options.edge=t,this.context.model.refreshData()}setCombo(t){this.options.combo=t,this.context.model.refreshData()}getTheme(){return this.options.theme}setTheme(t){this.options.theme=Vt(t)?t(this.getTheme()):t}setLayout(t){this.options.layout=Vt(t)?t(this.getLayout()):t}getLayout(){return this.options.layout}setBehaviors(t){var e;this.options.behaviors=Vt(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=Vt(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=Vt(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(Vt(t)?t(this.getData()):t)}addData(t){this.context.model.addData(Vt(t)?t(this.getData()):t)}addNodeData(t){this.context.model.addNodeData(Vt(t)?t(this.getNodeData()):t)}addEdgeData(t){this.context.model.addEdgeData(Vt(t)?t(this.getEdgeData()):t)}addComboData(t){this.context.model.addComboData(Vt(t)?t(this.getComboData()):t)}addChildrenData(t,e){this.context.model.addChildrenData(t,e)}updateData(t){this.context.model.updateData(Vt(t)?t(this.getData()):t)}updateNodeData(t){this.context.model.updateNodeData(Vt(t)?t(this.getNodeData()):t)}updateEdgeData(t){this.context.model.updateEdgeData(Vt(t)?t(this.getEdgeData()):t)}updateComboData(t){this.context.model.updateComboData(Vt(t)?t(this.getComboData()):t)}removeData(t){this.context.model.removeData(Vt(t)?t(this.getData()):t)}removeNodeData(t){this.context.model.removeNodeData(Vt(t)?t(this.getNodeData()):t)}removeEdgeData(t){this.context.model.removeEdgeData(Vt(t)?t(this.getEdgeData()):t)}removeComboData(t){this.context.model.removeComboData(Vt(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 sr(this,void 0,void 0,function*(){var t;if(this.context.canvas)return yield this.context.canvas.ready;const{container:e="container",width:n,height:i,renderer:a,cursor:s,background:o,canvas:A,devicePixelRatio:l=(t=globalThis.devicePixelRatio)!==null&&t!==void 0?t:1}=this.options;if(e instanceof cM)this.context.canvas=e,s&&e.setCursor(s),a&&e.setRenderer(a),yield e.ready;else{const c=gn(e)?document.getElementById(e):e,u=dM(c);this.emit(Ae.BEFORE_CANVAS_INIT,{container:c,width:n,height:i});const h=Object.assign(Object.assign({},A),{container:c,width:n||u[0],height:i||u[1],background:o,renderer:a,cursor:s,devicePixelRatio:l}),d=new cM(h);this.context.canvas=d,yield d.ready,this.emit(Ae.AFTER_CANVAS_INIT,{canvas:d})}})}updateCanvas(t){var e,n;const{renderer:i,cursor:a,height:s,width:o}=t,A=this.context.canvas;A&&(i&&(this.emit(Ae.BEFORE_RENDERER_CHANGE,{renderer:this.options.renderer}),A.setRenderer(i),this.emit(Ae.AFTER_RENDERER_CHANGE,{renderer:i})),a&&A.setCursor(a),(ye(o)||ye(s))&&this.setSize((e=o!=null?o:this.options.width)!==null&&e!==void 0?e:0,(n=s!=null?s:this.options.height)!==null&&n!==void 0?n:0))}initRuntime(){this.context.options=this.options,this.context.batch||(this.context.batch=new Z5(this.context)),this.context.plugin||(this.context.plugin=new p8(this.context)),this.context.viewport||(this.context.viewport=new y8(this.context)),this.context.transform||(this.context.transform=new m8(this.context)),this.context.element||(this.context.element=new t8(this.context)),this.context.animation||(this.context.animation=new j5(this.context)),this.context.layout||(this.context.layout=new f8(this.context)),this.context.behavior||(this.context.behavior=new Y5(this.context))}prepare(){return sr(this,void 0,void 0,function*(){if(yield Promise.resolve(),this.destroyed){console.error(ko("The graph instance has been destroyed"));return}yield this.initCanvas(),this.initRuntime()})}render(){return sr(this,void 0,void 0,function*(){if(yield this.prepare(),ui(this,new Xr(Ae.BEFORE_RENDER)),this.options.layout)if(!this.rendered&&VQ(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,ui(this,new Xr(Ae.AFTER_RENDER))})}draw(){return sr(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 sr(this,void 0,void 0,function*(){yield this.context.layout.postLayout(t)})}stopLayout(){this.context.layout.stopLayout()}clear(){return sr(this,void 0,void 0,function*(){const{model:t,element:e}=this.context;t.setData({}),t.clearChanges(),e==null||e.clear()})}destroy(){var t;ui(this,new Xr(Ae.BEFORE_DESTROY));const{layout:e,animation:n,element:i,model:a,canvas:s,behavior:o,plugin:A}=this.context;A==null||A.destroy(),o==null||o.destroy(),e==null||e.destroy(),n==null||n.destroy(),i==null||i.destroy(),a.destroy(),s==null||s.destroy(),this.options={},this.context={},this.off(),(t=globalThis.removeEventListener)===null||t===void 0||t.call(globalThis,"resize",this.onResize),this.destroyed=!0,ui(this,new Xr(Ae.AFTER_DESTROY))}getCanvas(){return this.context.canvas}resize(t,e){var n;const i=dM((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();Pr(a,s)||(ui(this,new Xr(Ae.BEFORE_SIZE_CHANGE,{size:a})),this.context.canvas.resize(...a),ui(this,new Xr(Ae.AFTER_SIZE_CHANGE,{size:a})))}fitView(t,e){return sr(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 sr(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 sr(this,void 0,void 0,function*(){const{autoFit:t}=this.context.options;if(t)if(gn(t))t==="view"?yield this.fitView():t==="center"&&(yield this.fitCenter());else{const{type:e,animation:n}=t;e==="view"?yield this.fitView(t.options,n):e==="center"&&(yield this.fitCenter(n))}})}focusElement(t,e){return sr(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 sr(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",scale:t,origin:n},e)})}zoomTo(t,e,n){return sr(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 sr(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",rotate:t,origin:n},e)})}rotateTo(t,e,n){return sr(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 sr(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"relative",translate:t},e)})}translateTo(t,e){return sr(this,void 0,void 0,function*(){yield this.context.viewport.transform({mode:"absolute",translate:t},e)})}getPosition(){return tr([0,0],this.getCanvasByViewport([0,0]))}translateElementBy(t,e){return sr(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeBy(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}translateElementTo(t,e){return sr(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a];Object.entries(A).forEach(([c,u])=>this.context.model.translateNodeLikeTo(c,u)),yield(o=this.context.element.draw({animation:l,stage:"translate"}))===null||o===void 0?void 0:o.finished})}getElementPosition(t){return this.context.model.getElementPosition(t)}getElementRenderStyle(t){return A1(this.context.element.getElement(t).attributes,["context"])}setElementVisibility(t,e){return sr(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([d,f])=>{const g=this.getElementType(d);c[`${g}s`].push({id:d,style:{visibility:f}})});const{model:u,element:h}=this.context;u.preventUpdateNodeLikeHierarchy(()=>{u.updateData(c)}),yield(o=h.draw({animation:l,stage:"visibility"}))===null||o===void 0?void 0:o.finished})}showElement(t,e){return sr(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 sr(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 sr(this,void 0,void 0,function*(){var n;const i={nodes:[],edges:[],combos:[]},a=br(t)?t:{[t]:e};Object.entries(a).forEach(([A,l])=>{const c=this.getElementType(A);i[`${c}s`].push({id:A,style:{zIndex:l}})});const{model:s,element:o}=this.context;s.preventUpdateNodeLikeHierarchy(()=>s.updateData(i)),yield(n=o.draw({animation:!1,stage:"zIndex"}))===null||n===void 0?void 0:n.finished})}frontElement(t){return sr(this,void 0,void 0,function*(){const e=Array.isArray(t)?t:[t],{model:n}=this.context,i={};e.map(a=>{const s=n.getFrontZIndex(a);if(n.getElementType(a)==="combo"){const A=n.getAncestorsData(a,nr).at(-1)||this.getComboData(a),l=[A,...n.getDescendantsData(Nt(A))],c=s-fM(A);l.forEach(h=>{i[Nt(h)]=this.getElementZIndex(Nt(h))+c});const{internal:u}=My(l.map(Nt),h=>n.getRelatedEdgesData(h));u.forEach(h=>{const d=Nt(h);i[d]=this.getElementZIndex(d)+c})}else i[a]=s}),yield this.setElementZIndex(i)})}getElementZIndex(t){return fM(this.context.model.getElementDataById(t))}setElementState(t,e){return sr(this,arguments,void 0,function*(n,i,a=!0){var s,o;const[A,l]=br(n)?[n,(s=i)!==null&&s!==void 0?s:!0]:[{[n]:i},a],c=h=>h?Array.isArray(h)?h:[h]:[],u={nodes:[],edges:[],combos:[]};Object.entries(A).forEach(([h,d])=>{const f=this.getElementType(h);u[`${f}s`].push({id:h,states:c(d)})}),this.updateData(u),yield(o=this.context.element.draw({animation:l,stage:"state"}))===null||o===void 0?void 0:o.finished})}getElementState(t){return this.context.model.getElementState(t)}getElementRenderBounds(t){return this.context.element.getElement(t).getRenderBounds()}collapseElement(t){return sr(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(pa(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(e);yield this.frontElement(e),this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:e,style:{collapsed:!0}}]}:{combos:[{id:e,style:{collapsed:!0}}]}),s==="node"?yield a.collapseNode(e,n):s==="combo"&&(yield a.collapseCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}expandElement(t){return sr(this,arguments,void 0,function*(e,n=!0){const{model:i,element:a}=this.context;if(!pa(i.getNodeLikeData([e])[0])||this.isCollapsingExpanding)return;typeof n=="boolean"&&(n={animation:n,align:!1});const s=i.getElementType(e);this.isCollapsingExpanding=!0,i.updateData(s==="node"?{nodes:[{id:e,style:{collapsed:!1}}]}:{combos:[{id:e,style:{collapsed:!1}}]}),s==="node"?yield a.expandNode(e,n):s==="combo"&&(yield a.expandCombo(e,!!n.animation)),this.isCollapsingExpanding=!1})}setElementCollapsibility(t,e){const n=this.getElementType(t);n==="node"?this.updateNodeData([{id:t,style:{collapsed:e}}]):n==="combo"&&this.updateComboData([{id:t,style:{collapsed:e}}])}toDataURL(){return sr(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)}}rv.defaultOptions={autoResize:!1,theme:"light",rotation:0,zoom:1,zoomRange:[.01,10]};var w8=function(r,t){var e={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&t.indexOf(n)<0&&(e[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i{if(o.depth=A,!o.children)return o;const{children:l}=o,c=w8(o,["children"]);return Object.assign(Object.assign({},c),{children:l.map(u=>u.id)})},getEdgeData:n=(o,A)=>({source:o.id,target:A.id}),getChildren:i=o=>o.children||[]}=t||{},a=[],s=[];return Cl(r,(o,A)=>{a.push(e(o,A));const l=i(o);for(const c of l)s.push(n(o,c))},o=>i(o),"TB"),{nodes:a,edges:s}}class B8 extends DA{beforeDraw(t){const{add:e,update:n}=t,{model:i}=this.context;return[...e.edges.entries(),...n.edges.entries()].forEach(([,a])=>{MM(i,a)}),t}}const MM=(r,t)=>{const{source:e,target:n}=t,i=r.getElementDataById(e),a=r.getElementDataById(n),s=wx(i,u=>r.getParentData(u,nr)),o=wx(a,u=>r.getParentData(u,nr)),A=Nt(s),l=Nt(o),c={sourceNode:A,targetNode:l};return t.style?Object.assign(t.style,c):t.style=c,t},b8=(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)},x8=(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)},C8=(r,t,e,n=2)=>{const[i,a]=t,[s,o]=e,A=Math.pow((r-i)/(a-i),n);return s+A*(o-s)},S8=(r,t,e)=>{const[n,i]=t,[a,s]=e,o=Math.sqrt((r-n)/(i-n));return a+o*(s-a)};class iv extends DA{constructor(t,e){super(t,Si({},iv.defaultOptions,e)),this.assignSizeByCentrality=(n,i,a,s,o,A)=>{const l=[i,a],c=[s[0],o[0]],u=[s[1],o[1]],h=[s[2],o[2]],d=(f,g)=>{if(typeof A=="function")return A(f,l,g);switch(A){case"linear":return b8(f,l,g);case"log":return x8(f,l,g);case"pow":return C8(f,l,g,2);case"sqrt":return S8(f,l,g);default:return g[0]}};return[d(n,c),d(n,u),d(n,h)]}}beforeDraw(t){const{model:e}=this.context,n=e.getNodeData(),i=Da(this.options.maxSize),a=Da(this.options.minSize),s=this.getCentralities(this.options.centrality),o=s.size>0?Math.max(...s.values()):0,A=s.size>0?Math.min(...s.values()):0;return n.forEach(l=>{var c;const u=this.assignSizeByCentrality(s.get(Nt(l))||0,A,o,a,i,this.options.scale),h=(c=this.context.element)===null||c===void 0?void 0:c.getElement(Nt(l)),d={size:u};this.assignLabelStyle(d,u,l,h),(!h||!j0(d,h.attributes))&&Ha(t,h?"update":"add","node",Si(l,{style:d}),!0)}),t}assignLabelStyle(t,e,n,i){var a;const s=i?i.config.style:(a=this.context.element)===null||a===void 0?void 0:a.getElementComputedStyle("node",n);if(Object.assign(t,Fl(s,["labelFontSize","labelLineHeight"])),this.options.mapLabelSize){const o=this.getLabelSizeByNodeSize(e,1/0,Number(t.labelFontSize));Object.assign(t,{labelFontSize:o,labelLineHeight:o+BI(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 wb(n,i,t)}}iv.defaultOptions={centrality:{type:"degree"},maxSize:80,minSize:20,scale:"linear",mapLabelSize:!1};class av extends DA{constructor(t,e){super(t,Object.assign({},av.defaultOptions,e))}get ref(){return this.context.model.getRootsData()[0]}afterLayout(){var t;const e=li(this.ref),{graph:n,model:i}=this.context;(t=i.getData().nodes)===null||t===void 0||t.forEach(s=>{var o;if(Nt(s)===Nt(this.ref))return;const A=xb(tr(li(s),e)),l=Math.abs(A)>Math.PI/2,c=!s.children||s.children.length===0,u=Nt(s),h=(o=this.context.element)===null||o===void 0?void 0:o.getElement(u);if(!h||!h.isVisible())return;const d=Da(n.getElementRenderStyle(u).size)[0]/2,f=(c?1:-1)*(d+this.options.offset),g=[["translate",f*Math.cos(A),f*Math.sin(A)],["rotate",l?bi(A)+180:bi(A)]];i.updateNodeData([{id:Nt(s),style:{labelTextAlign:l===c?"right":"left",labelTextBaseline:"middle",labelTransform:g}}])}),n.draw()}}av.defaultOptions={offset:5};const M8="quadratic",FM=["top","top-right","right","right-bottom","bottom","bottom-left","left","left-top"];class sv extends DA{constructor(t,e){super(t,Object.assign({},sv.defaultOptions,e)),this.cacheMergeStyle=new Map,this.getAffectedParallelEdges=n=>{const{add:{edges:i},update:{nodes:a,edges:s,combos:o},remove:{edges:A}}=n,{model:l}=this.context,c=new Map,u=(f,g)=>{l.getRelatedEdgesData(g).forEach(p=>!c.has(Nt(p))&&c.set(Nt(p),p))};a.forEach(u),o.forEach(u);const h=f=>{const g=new Set(n.remove.edges.keys()),v=l.getEdgeData().filter(p=>!g.has(Nt(p))).map(p=>MM(l,p));F8(f,v,!0).forEach(p=>{const y=Nt(p);c.has(y)||c.set(y,p)})};if(A.size&&A.forEach(h),i.size&&i.forEach(h),s.size){const f=M2(f1(l.getChanges())).update.edges;s.forEach(g=>{var v;h(g);const p=(v=f.find(y=>Nt(y.value)===Nt(g)))===null||v===void 0?void 0:v.original;p&&!lw(g,p)&&h(p)})}oo(this.options.edges)||c.forEach((f,g)=>!this.options.edges.includes(g)&&c.delete(g));const d=l.getEdgeData().map(Nt);return new Map([...c].sort((f,g)=>d.indexOf(f[0])-d.indexOf(g[0])))},this.applyBundlingStyle=(n,i,a)=>{const{edgeMap:s,reverses:o}=TM(i);s.forEach(A=>{A.forEach((l,c,u)=>{var h;const d=u.length,f=l.style||{};if(l.source===l.target){const p=FM.length;f.loopPlacement=FM[c%p],f.loopDist=Math.floor(c/p)*a+50}else if(d===1)f.curveOffset=0;else{const p=(c%2===0?1:-1)*(o[`${l.source}|${l.target}|${c}`]?-1:1);f.curveOffset=d%2===1?p*Math.ceil(c/2)*a*2:p*(Math.floor(c/2)*a*2+a)}const g=Object.assign(l,{type:M8,style:f}),v=(h=this.context.element)===null||h===void 0?void 0:h.getElement(Nt(l));(!v||!j0(g.style,v.attributes))&&Ha(n,v?"update":"add","edge",g,!0)})})},this.resetEdgeStyle=n=>{const i=n.style||{},a=this.cacheMergeStyle.get(Nt(n))||{};return Object.keys(a).forEach(s=>{Pr(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}=TM(i);a.forEach(o=>{var A;if(o.length===1){const c=o[0],u=(A=this.context.element)===null||A===void 0?void 0:A.getElement(Nt(c)),h=this.resetEdgeStyle(c);(!u||!j0(h,u.attributes))&&Ha(n,u?"update":"add","edge",h);return}const l=o.map(({source:c,target:u,style:h={}},d)=>{const{startArrow:f,endArrow:g}=h,v={},[p,y]=s[`${c}|${u}|${d}`]?["endArrow","startArrow"]:["startArrow","endArrow"];return eA(f)&&(v[p]=f),eA(g)&&(v[y]=g),v}).reduce((c,u)=>Object.assign(Object.assign({},c),u),{});o.forEach((c,u,h)=>{var d;if(u!==0){Ha(n,"remove","edge",c);return}const f=Object.assign({},Vt(this.options.style)?this.options.style(h):this.options.style,{childrenData:h});this.cacheMergeStyle.set(Nt(c),f);const g=Object.assign(Object.assign({},c),{type:"line",style:Object.assign(Object.assign(Object.assign({},c.style),l),f)}),v=(d=this.context.element)===null||d===void 0?void 0:d.getElement(Nt(c));(!v||!j0(g.style,v.attributes))&&Ha(n,v?"update":"add","edge",g,!0)})})}}beforeDraw(t){const e=this.getAffectedParallelEdges(t);return e.size===0||(this.options.mode==="bundle"?this.applyBundlingStyle(t,e,this.options.distance):this.applyMergingStyle(t,e)),t}}sv.defaultOptions={mode:"bundle",distance:15};const TM=r=>{const t=new Map,e=new Set,n={},i=new Map;for(const[a,s]of r){if(e.has(a))continue;const{source:o,target:A}=s,l=`${o}-${A}`;t.has(l)||(t.set(l,[]),i.set(l,new Set));const c=t.get(l),u=i.get(l);c&&u&&!u.has(a)&&(c.push(s),u.add(a),e.add(a));for(const[h,d]of r)if(!(e.has(h)||h===a)&&lw(s,d)){const f=t.get(l),g=i.get(l);f&&g&&!g.has(h)&&(f.push(d),g.add(h),o===d.target&&A===d.source&&(n[`${d.source}|${d.target}|${f.length-1}`]=!0),e.add(h))}}return{edgeMap:t,reverses:n}},F8=(r,t,e)=>t.filter(n=>(e||Nt(n)!==Nt(r))&&lw(n,r)),lw=(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 T8 extends DA{beforeDraw(t,e){const{stage:n}=e;if(n==="visibility")return t;const{model:i}=this.context,{update:{nodes:a,edges:s,combos:o}}=t,A=(l,c)=>{i.getRelatedEdgesData(c).forEach(h=>!s.has(Nt(h))&&s.set(Nt(h),h))};return a.forEach(A),o.forEach(A),t}}const O8={animation:{"combo-collapse":LB,"combo-expand":pI,"node-collapse":IB,"node-expand":gI,"path-in":NB,"path-out":vI,fade:dI,translate:fI},behavior:{"brush-select":Bh,"click-select":sg,"collapse-expand":Tg,"create-edge":Lg,"drag-canvas":kg,"drag-element-force":ZQ,"drag-element":kh,"fix-element-size":Pg,"focus-element":_g,"hover-activate":Hg,"lasso-select":XQ,"auto-adapt-label":tg,"optimize-viewport-transform":Gg,"scroll-canvas":zg,"zoom-canvas":Kg},combo:{circle:_k,rect:Hk},edge:{cubic:Tl,line:Sg,polyline:Mg,quadratic:Fg,"cubic-horizontal":bg,"cubic-radial":xg,"cubic-vertical":Cg},layout:{"antv-dagre":eR,"combo-combined":aD,"compact-box":jx,"d3-force":ND,"force-atlas2":QD,circular:iR,concentric:Zy,dagre:$g,dendrogram:Yx,fishbone:n0,force:zC,fruchterman:DD,grid:_D,indented:Xx,mds:XC,mindmap:$x,radial:YD,random:nP,snake:r0},node:{circle:Sl,diamond:JL,ellipse:ug,hexagon:nk,html:mg,image:yg,rect:Dk,star:Pk,donut:lg,triangle:wg},palette:{spectral:oP,tableau:AP,oranges:lP,greens:cP,blues:uP},theme:{dark:Q5,light:U5},plugin:{"bubble-sets":d0,"edge-bundling":g0,"edge-filter-lens":v0,"grid-line":y0,background:i0,contextmenu:f0,fisheye:p0,fullscreen:m0,history:w0,hull:x0,legend:O0,minimap:I0,snapline:N0,timebar:z0,title:y5,toolbar:K0,tooltip:V0,watermark:W0},transform:{"arrange-draw-order":R5,"collapse-expand-combo":D5,"collapse-expand-node":P5,"get-edge-actual-ends":B8,"map-node-size":iv,"place-radial-labels":av,"process-parallel-edges":sv,"update-related-edges":T8},shape:{circle:eo,ellipse:oh,group:Ai,html:gl,image:py,line:vl,path:Pi,polygon:pl,polyline:gf,rect:Ci,text:ml,label:Ao,badge:Hc}};function I8(){Object.entries(O8).forEach(([r,t])=>{Object.entries(t).forEach(([e,n])=>{_5(r,e,n)})})}I8();const zK={css:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.css",js:"//at.alicdn.com/t/a/font_470089_8hnbbf8n4u8.js"}},32446:function(X,st,T){"use strict";var I=T(59301),W=T(42441),z=T(48961),P=T.n(z),N=Object.defineProperty,G=Object.defineProperties,K=Object.getOwnPropertyDescriptors,_=Object.getOwnPropertySymbols,H=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,Z=(ut,Bt,wt)=>Bt in ut?N(ut,Bt,{enumerable:!0,configurable:!0,writable:!0,value:wt}):ut[Bt]=wt,$=(ut,Bt)=>{for(var wt in Bt||(Bt={}))H.call(Bt,wt)&&Z(ut,wt,Bt[wt]);if(_)for(var wt of _(Bt))J.call(Bt,wt)&&Z(ut,wt,Bt[wt]);return ut},ct=(ut,Bt)=>G(ut,K(Bt));function ht(ut,Bt,wt=1/3,Tt){let kt=ut*Math.PI*2,_t=Bt*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(Ot,Gt){return Ot_t?Math.cos(_t)*(1+Math.cos(Gt)*wt):Math.cos(Ot)*(1+Math.cos(Gt)*wt)},y:function(Ot,Gt){return Ot_t?Math.sin(_t)*(1+Math.cos(Gt)*wt):Math.sin(Ot)*(1+Math.cos(Gt)*wt)},z:function(Ot,Gt){return Ot<-Math.PI*.5?Math.sin(Ot):Ot>Math.PI*2.5?Math.sin(Ot)*Tt*.1:Math.sin(Gt)>0?1*Tt*.1:-1}}}function Ct({pieData:ut=[],internalDiameterRatio:Bt=1/3}){var wt,Tt,kt,_t;const Ot=[],Gt=ut==null?void 0:ut.reduce((de,Oe)=>(de||0)+((Oe==null?void 0:Oe.value)||0),0);let ae=0,Wt=0;const ie=[];for(let de=0;de<(ut==null?void 0:ut.length);de++){Wt=ae+(Gt==0?1:((wt=ut==null?void 0:ut[de])==null?void 0:wt.value)||0);const Oe={itemStyle:((Tt=ut==null?void 0:ut[de])==null?void 0:Tt.itemStyle)||{},name:((kt=ut==null?void 0:ut[de])==null?void 0:kt.name)||`name${de}`,type:"surface",parametric:!0,parametricEquation:ht(ae/(Gt||(ut==null?void 0:ut.length)),Wt/(Gt||(ut==null?void 0:ut.length)),Bt,((_t=ut==null?void 0:ut[de])==null?void 0:_t.value)||(Gt==0?25:0)),wireframe:{show:!1},pieData:ut==null?void 0:ut[de]};ie.push(Oe.name),Ot.push(Oe),ae=Wt}return Ot.push({name:"pie2d",type:"pie",showEmptyCircle:!0,label:{show:!0,formatter:de=>`${de.value} ${de.name}`},startAngle:-35,radius:["49%","50%"],center:["50%","40%"],data:[...ut||[]].reverse(),itemStyle:{opacity:0}}),{legend:{left:"50%",top:"center",textStyle:{fontSize:12},data:ie},xAxis3D:{},yAxis3D:{},zAxis3D:{},grid3D:{viewControl:{alpha:45,rotateSensitivity:0,zoomSensitivity:0,panSensitivity:0,autoRotate:!1},left:"center",top:"-10%",show:!1,boxHeight:25},series:Ot}}const pt=({dataSource:ut=[{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:Bt="",style:wt={},legend:Tt={},internalDiameterRatio:kt=1/3})=>{const[_t,Ot]=(0,I.useState)([]),Gt=(0,I.useCallback)(ie=>{const ve=ie.selected||{},de=ut.map(Oe=>Oe.name).filter(Oe=>ve[Oe]===!1);Ot(de)},[ut]),ae=(0,I.useMemo)(()=>ut.filter(ie=>!_t.includes(ie.name)),[ut,_t]),Wt=(0,I.useMemo)(()=>{const ie=Ct({pieData:ae,internalDiameterRatio:kt}),ve=ut.map(Oe=>Oe.name),de=ut.reduce((Oe,sn)=>(Oe[sn.name]=!_t.includes(sn.name),Oe),{});return ie.legend=ct($($({},ie.legend),Tt),{data:ve,selected:de}),ie},[ae,Tt,kt,ut,_t]);return I.createElement(W.Z,{onEvents:{legendselectchanged:Gt},className:`w-full h-full ${Bt}`,option:Wt,style:$({height:"100%"},wt)})};st.Z=pt},18086:function(X,st,T){"use strict";var I,W=Object.defineProperty,z=Y=>{throw TypeError(Y)},P=Math.pow,N=(Y,C,S)=>C in Y?W(Y,C,{enumerable:!0,configurable:!0,writable:!0,value:S}):Y[C]=S,G=(Y,C,S)=>N(Y,typeof C!="symbol"?C+"":C,S),K=(Y,C,S)=>C.has(Y)||z("Cannot "+S),_=(Y,C,S)=>(K(Y,C,"read from private field"),S?S.call(Y):C.get(Y)),H=(Y,C,S)=>C.has(Y)?z("Cannot add the same private member more than once"):C instanceof WeakSet?C.add(Y):C.set(Y,S),J=(Y,C,S,w)=>(K(Y,C,"write to private field"),w?w.call(Y,S):C.set(Y,S),S),Z=(Y,C,S)=>(K(Y,C,"access private method"),S),$,ct,ht;I={value:!0};var Ct=T(34634),pt=T(34402);const ut=" ".repeat(2),Bt=" ".repeat(4);function wt(){return Tt(this)}function Tt(Y,C={}){const{maxRows:S=15,maxColumns:w=10,maxNumSize:M=8,padMinus:k="auto"}=C;return`${Y.constructor.name} { ${ut}[ ${Bt}${kt(Y,S,w,M,k)} ${ut}] ${ut}rows: ${Y.rows} ${ut}columns: ${Y.columns} }`}function kt(Y,C,S,w,M){const{rows:k,columns:nt}=Y,rt=Math.min(k,C),ot=Math.min(nt,S),At=[];if(M==="auto"){M=!1;t:for(let It=0;It=0&&S?` ${Ot(Y,C-1)}`:Ot(Y,C)).padEnd(C)}function Ot(Y,C){let S=Y.toString();if(S.length<=C)return S;let w=Y.toFixed(C);if(w.length>C&&(w=Y.toFixed(Math.max(0,C-(w.length-C)))),w.length<=C&&!w.startsWith("0.000")&&!w.startsWith("-0.000"))return w;let M=Y.toExponential(C);return M.length>C&&(M=Y.toExponential(Math.max(0,C-(M.length-C)))),M.slice(0)}function Gt(Y,C){Y.prototype.add=function(w){return typeof w=="number"?this.addS(w):this.addM(w)},Y.prototype.addS=function(w){for(let M=0;M>w);return this},Y.prototype.signPropagatingRightShiftM=function(w){if(w=C.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let M=0;M>w.get(M,k));return this},Y.signPropagatingRightShift=function(w,M){return new C(w).signPropagatingRightShift(M)},Y.prototype.rightShift=function(w){return typeof w=="number"?this.rightShiftS(w):this.rightShiftM(w)},Y.prototype.rightShiftS=function(w){for(let M=0;M>>w);return this},Y.prototype.rightShiftM=function(w){if(w=C.checkMatrix(w),this.rows!==w.rows||this.columns!==w.columns)throw new RangeError("Matrices dimensions must be equal");for(let M=0;M>>w.get(M,k));return this},Y.rightShift=function(w,M){return new C(w).rightShift(M)},Y.prototype.zeroFillRightShift=Y.prototype.rightShift,Y.prototype.zeroFillRightShiftS=Y.prototype.rightShiftS,Y.prototype.zeroFillRightShiftM=Y.prototype.rightShiftM,Y.zeroFillRightShift=Y.rightShift,Y.prototype.not=function(){for(let w=0;ww)throw new RangeError("Row index out of range")}function Wt(Y,C,S){let w=S?Y.columns:Y.columns-1;if(C<0||C>w)throw new RangeError("Column index out of range")}function ie(Y,C){if(C.to1DArray&&(C=C.to1DArray()),C.length!==Y.columns)throw new RangeError("vector size must be the same as the number of columns");return C}function ve(Y,C){if(C.to1DArray&&(C=C.to1DArray()),C.length!==Y.rows)throw new RangeError("vector size must be the same as the number of rows");return C}function de(Y,C){if(!Ct.isAnyArray(C))throw new TypeError("row indices must be an array");for(let S=0;S=Y.rows)throw new RangeError("row indices are out of range")}function Oe(Y,C){if(!Ct.isAnyArray(C))throw new TypeError("column indices must be an array");for(let S=0;S=Y.columns)throw new RangeError("column indices are out of range")}function sn(Y,C,S,w,M){if(arguments.length!==5)throw new RangeError("expected 4 arguments");if(Xn("startRow",C),Xn("endRow",S),Xn("startColumn",w),Xn("endColumn",M),C>S||w>M||C<0||C>=Y.rows||S<0||S>=Y.rows||w<0||w>=Y.columns||M<0||M>=Y.columns)throw new RangeError("Submatrix indices are out of range")}function dn(Y,C=0){let S=[];for(let w=0;w=k)throw new RangeError("min must be smaller than max");let rt=k-M,ot=new pe(C,S);for(let At=0;Atw?(k=!0,w=S):(M=!1,k=!0);C++}return M}isReducedEchelonForm(){let C=0,S=0,w=-1,M=!0,k=!1;for(;Cw?(k=!0,w=S):(M=!1,k=!0);for(let nt=S+1;ntC.get(M,w)&&(M=k);if(C.get(M,w)===0)w++;else{C.swapRows(S,M);let k=C.get(S,w);for(let nt=w;nt=0;)if(C.maxRow(M)===0)M--;else{let k=0,nt=!1;for(;kS[w]&&(S[w]=this.get(w,M));return S}case"column":{const S=new Array(this.columns).fill(Number.NEGATIVE_INFINITY);for(let w=0;wS[M]&&(S[M]=this.get(w,M));return S}case void 0:{let S=this.get(0,0);for(let w=0;wS&&(S=this.get(w,M));return S}default:throw new Error(`invalid option: ${C}`)}}maxIndex(){Jr(this);let C=this.get(0,0),S=[0,0];for(let w=0;wC&&(C=this.get(w,M),S[0]=w,S[1]=M);return S}min(C){if(this.isEmpty())return NaN;switch(C){case"row":{const S=new Array(this.rows).fill(Number.POSITIVE_INFINITY);for(let w=0;wS&&(S=this.get(C,w));return S}maxRowIndex(C){ae(this,C),Jr(this);let S=this.get(C,0),w=[C,0];for(let M=1;MS&&(S=this.get(C,M),w[1]=M);return w}minRow(C){if(ae(this,C),this.isEmpty())return NaN;let S=this.get(C,0);for(let w=1;wS&&(S=this.get(w,C));return S}maxColumnIndex(C){Wt(this,C),Jr(this);let S=this.get(0,C),w=[0,C];for(let M=1;MS&&(S=this.get(M,C),w[0]=M);return w}minColumn(C){if(Wt(this,C),this.isEmpty())return NaN;let S=this.get(0,C);for(let w=1;w=1;M/=2)M&1&&(S=S.mmul(w)),w=w.mmul(w);return S}strassen2x2(C){C=pe.checkMatrix(C);let S=new pe(2,2);const w=this.get(0,0),M=C.get(0,0),k=this.get(0,1),nt=C.get(0,1),rt=this.get(1,0),ot=C.get(1,0),At=this.get(1,1),It=C.get(1,1),vt=(w+At)*(M+It),Zt=(rt+At)*M,ce=w*(nt-It),Ht=At*(ot-M),qt=(w+k)*It,Ce=(rt-w)*(M+nt),Et=(k-At)*(ot+It),$t=vt+Ht-qt+Et,Ee=ce+qt,He=Zt+Ht,je=vt-Zt+ce+Ce;return S.set(0,0,$t),S.set(0,1,Ee),S.set(1,0,He),S.set(1,1,je),S}strassen3x3(C){C=pe.checkMatrix(C);let S=new pe(3,3);const w=this.get(0,0),M=this.get(0,1),k=this.get(0,2),nt=this.get(1,0),rt=this.get(1,1),ot=this.get(1,2),At=this.get(2,0),It=this.get(2,1),vt=this.get(2,2),Zt=C.get(0,0),ce=C.get(0,1),Ht=C.get(0,2),qt=C.get(1,0),Ce=C.get(1,1),Et=C.get(1,2),$t=C.get(2,0),Ee=C.get(2,1),He=C.get(2,2),je=(w+M+k-nt-rt-It-vt)*Ce,Wn=(w-nt)*(-ce+Ce),Ie=rt*(-Zt+ce+qt-Ce-Et-$t+He),De=(-w+nt+rt)*(Zt-ce+Ce),on=(nt+rt)*(-Zt+ce),Ft=w*Zt,te=(-w+At+It)*(Zt-Ht+Et),ue=(-w+At)*(Ht-Et),se=(At+It)*(-Zt+Ht),Jn=(w+M+k-rt-ot-At-It)*Et,Qn=It*(-Zt+Ht+qt-Ce-Et-$t+Ee),jn=(-k+It+vt)*(Ce+$t-Ee),qn=(k-vt)*(Ce-Ee),Qr=k*$t,Tr=(It+vt)*(-$t+Ee),Dn=(-k+rt+ot)*(Et+$t-He),qi=(k-ot)*(Et-He),$i=(rt+ot)*(-$t+He),fn=M*qt,Er=ot*Ee,ti=nt*Ht,ei=At*ce,Pn=vt*He,Ds=Ft+Qr+fn,Xo=je+De+on+Ft+jn+Qr+Tr,uu=Ft+te+se+Jn+Qr+Dn+$i,go=Wn+Ie+De+Ft+Qr+Dn+qi,vo=Wn+De+on+Ft+Er,KA=Qr+Dn+qi+$i+ti,hu=Ft+te+ue+Qn+jn+qn+Qr,Xl=jn+qn+Qr+Tr+ei,du=Ft+te+ue+se+Pn;return S.set(0,0,Ds),S.set(0,1,Xo),S.set(0,2,uu),S.set(1,0,go),S.set(1,1,vo),S.set(1,2,KA),S.set(2,0,hu),S.set(2,1,Xl),S.set(2,2,du),S}mmulStrassen(C){C=pe.checkMatrix(C);let S=this.clone(),w=S.rows,M=S.columns,k=C.rows,nt=C.columns;M!==k&&console.warn(`Multiplying ${w} x ${M} and ${k} x ${nt} matrix: dimensions do not match.`);function rt(vt,Zt,ce){let Ht=vt.rows,qt=vt.columns;if(Ht===Zt&&qt===ce)return vt;{let Ce=me.zeros(Zt,ce);return Ce=Ce.setSubMatrix(vt,0,0),Ce}}let ot=Math.max(w,k),At=Math.max(M,nt);S=rt(S,ot,At),C=rt(C,ot,At);function It(vt,Zt,ce,Ht){if(ce<=512||Ht<=512)return vt.mmul(Zt);ce%2===1&&Ht%2===1?(vt=rt(vt,ce+1,Ht+1),Zt=rt(Zt,ce+1,Ht+1)):ce%2===1?(vt=rt(vt,ce+1,Ht),Zt=rt(Zt,ce+1,Ht)):Ht%2===1&&(vt=rt(vt,ce,Ht+1),Zt=rt(Zt,ce,Ht+1));let qt=parseInt(vt.rows/2,10),Ce=parseInt(vt.columns/2,10),Et=vt.subMatrix(0,qt-1,0,Ce-1),$t=Zt.subMatrix(0,qt-1,0,Ce-1),Ee=vt.subMatrix(0,qt-1,Ce,vt.columns-1),He=Zt.subMatrix(0,qt-1,Ce,Zt.columns-1),je=vt.subMatrix(qt,vt.rows-1,0,Ce-1),Wn=Zt.subMatrix(qt,Zt.rows-1,0,Ce-1),Ie=vt.subMatrix(qt,vt.rows-1,Ce,vt.columns-1),De=Zt.subMatrix(qt,Zt.rows-1,Ce,Zt.columns-1),on=It(me.add(Et,Ie),me.add($t,De),qt,Ce),Ft=It(me.add(je,Ie),$t,qt,Ce),te=It(Et,me.sub(He,De),qt,Ce),ue=It(Ie,me.sub(Wn,$t),qt,Ce),se=It(me.add(Et,Ee),De,qt,Ce),Jn=It(me.sub(je,Et),me.add($t,He),qt,Ce),Qn=It(me.sub(Ee,Ie),me.add(Wn,De),qt,Ce),jn=me.add(on,ue);jn.sub(se),jn.add(Qn);let qn=me.add(te,se),Qr=me.add(Ft,ue),Tr=me.sub(on,Ft);Tr.add(te),Tr.add(Jn);let Dn=me.zeros(2*jn.rows,2*jn.columns);return Dn=Dn.setSubMatrix(jn,0,0),Dn=Dn.setSubMatrix(qn,jn.rows,0),Dn=Dn.setSubMatrix(Qr,0,jn.columns),Dn=Dn.setSubMatrix(Tr,jn.rows,jn.columns),Dn.subMatrix(0,ce-1,0,Ht-1)}return It(S,C,ot,At)}scaleRows(C={}){if(typeof C!="object")throw new TypeError("options must be an object");const{min:S=0,max:w=1}=C;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(S>=w)throw new RangeError("min must be smaller than max");let M=new pe(this.rows,this.columns);for(let k=0;k0&&pt(nt,{min:S,max:w,output:nt}),M.setRow(k,nt)}return M}scaleColumns(C={}){if(typeof C!="object")throw new TypeError("options must be an object");const{min:S=0,max:w=1}=C;if(!Number.isFinite(S))throw new TypeError("min must be a number");if(!Number.isFinite(w))throw new TypeError("max must be a number");if(S>=w)throw new RangeError("min must be smaller than max");let M=new pe(this.rows,this.columns);for(let k=0;kw||S<0||S>=this.columns||w<0||w>=this.columns)throw new RangeError("Argument out of range");let M=new pe(C.length,w-S+1);for(let k=0;k=this.rows)throw new RangeError(`Row index out of range: ${C[k]}`);M.set(k,nt-S,this.get(C[k],nt))}return M}subMatrixColumn(C,S,w){if(S===void 0&&(S=0),w===void 0&&(w=this.rows-1),S>w||S<0||S>=this.rows||w<0||w>=this.rows)throw new RangeError("Argument out of range");let M=new pe(w-S+1,C.length);for(let k=0;k=this.columns)throw new RangeError(`Column index out of range: ${C[k]}`);M.set(nt-S,k,this.get(nt,C[k]))}return M}setSubMatrix(C,S,w){if(C=pe.checkMatrix(C),C.isEmpty())return this;let M=S+C.rows-1,k=w+C.columns-1;sn(this,S,M,w,k);for(let nt=0;nttypeof C=="number")}me.random=me.rand,me.randomInt=me.randInt,me.diagonal=me.diag,me.prototype.diagonal=me.prototype.diag,me.identity=me.eye,me.prototype.negate=me.prototype.neg,me.prototype.tensorProduct=me.prototype.kroneckerProduct;const Zi=class fw extends me{constructor(C,S){if(super(),H(this,$),G(this,"data"),fw.isMatrix(C))Z(this,$,ct).call(this,C.rows,C.columns),fw.copy(C,this);else if(Number.isInteger(C)&&C>=0)Z(this,$,ct).call(this,C,S);else if(Ct.isAnyArray(C)){const w=C;if(C=w.length,S=C?w[0].length:0,typeof S!="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 S=0;S=0)J(this,ht,new pe(C,C));else if(J(this,ht,new pe(C)),!this.isSymmetric())throw new TypeError("not symmetric data")}get size(){return _(this,ht).size}get rows(){return _(this,ht).rows}get columns(){return _(this,ht).columns}get diagonalSize(){return this.rows}static isSymmetricMatrix(C){return pe.isMatrix(C)&&C.klassType==="SymmetricMatrix"}static zeros(C){return new this(C)}static ones(C){return new this(C).fill(1)}clone(){const C=new gw(this.diagonalSize);for(const[S,w,M]of this.upperRightEntries())C.set(S,w,M);return C}toMatrix(){return new pe(this)}get(C,S){return _(this,ht).get(C,S)}set(C,S,w){return _(this,ht).set(C,S,w),_(this,ht).set(S,C,w),this}removeCross(C){return _(this,ht).removeRow(C),_(this,ht).removeColumn(C),this}addCross(C,S){S===void 0&&(S=C,C=this.diagonalSize);const w=S.slice();return w.splice(C,1),_(this,ht).addRow(C,w),_(this,ht).addColumn(C,S),this}applyMask(C){if(C.length!==this.diagonalSize)throw new RangeError("Mask size do not match with matrix size");const S=[];for(const[w,M]of C.entries())M||S.push(w);S.reverse();for(const w of S)this.removeCross(w);return this}toCompact(){const{diagonalSize:C}=this,S=new Array(C*(C+1)/2);for(let w=0,M=0,k=0;k=C&&(w=++M);return S}static fromCompact(C){const S=C.length,w=(Math.sqrt(8*S+1)-1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a Symmetric Matrix, ${JSON.stringify(C)}`);const M=new gw(w);for(let k=0,nt=0,rt=0;rt=w&&(k=++nt);return M}*upperRightEntries(){for(let C=0,S=0;C=this.diagonalSize&&(S=++C)}}*upperRightValues(){for(let C=0,S=0;C=this.diagonalSize&&(S=++C)}};ht=new WeakMap;let kr=Wa;kr.prototype.klassType="SymmetricMatrix";class Fr extends kr{static isDistanceMatrix(C){return kr.isSymmetricMatrix(C)&&C.klassSubType==="DistanceMatrix"}constructor(C){if(super(C),!this.isDistance())throw new TypeError("Provided arguments do no produce a distance matrix")}set(C,S,w){return C===S&&(w=0),super.set(C,S,w)}addCross(C,S){return S===void 0&&(S=C,C=this.diagonalSize),S=S.slice(),S[C]=0,super.addCross(C,S)}toSymmetricMatrix(){return new kr(this)}clone(){const C=new Fr(this.diagonalSize);for(const[S,w,M]of this.upperRightEntries())S!==w&&C.set(S,w,M);return C}toCompact(){const{diagonalSize:C}=this,S=(C-1)*C/2,w=new Array(S);for(let M=1,k=0,nt=0;nt=C&&(M=++k+1);return w}static fromCompact(C){const S=C.length;if(S===0)return new this(0);const w=(Math.sqrt(8*S+1)+1)/2;if(!Number.isInteger(w))throw new TypeError(`This array is not a compact representation of a DistanceMatrix, ${JSON.stringify(C)}`);const M=new this(w);for(let k=1,nt=0,rt=0;rt=w&&(k=++nt+1);return M}}Fr.prototype.klassSubType="DistanceMatrix";class fi extends me{constructor(C,S,w){super(),this.matrix=C,this.rows=S,this.columns=w}}class ls extends fi{constructor(C,S){Wt(C,S),super(C,C.rows,1),this.column=S}set(C,S,w){return this.matrix.set(C,this.column,w),this}get(C){return this.matrix.get(C,this.column)}}class Yi extends fi{constructor(C,S){Oe(C,S),super(C,C.rows,S.length),this.columnIndices=S}set(C,S,w){return this.matrix.set(C,this.columnIndices[S],w),this}get(C,S){return this.matrix.get(C,this.columnIndices[S])}}class cs extends fi{constructor(C){super(C,C.rows,C.columns)}set(C,S,w){return this.matrix.set(C,this.columns-S-1,w),this}get(C,S){return this.matrix.get(C,this.columns-S-1)}}class Li extends fi{constructor(C){super(C,C.rows,C.columns)}set(C,S,w){return this.matrix.set(this.rows-C-1,S,w),this}get(C,S){return this.matrix.get(this.rows-C-1,S)}}class qr extends fi{constructor(C,S){ae(C,S),super(C,1,C.columns),this.row=S}set(C,S,w){return this.matrix.set(this.row,S,w),this}get(C,S){return this.matrix.get(this.row,S)}}class Ba extends fi{constructor(C,S){de(C,S),super(C,S.length,C.columns),this.rowIndices=S}set(C,S,w){return this.matrix.set(this.rowIndices[C],S,w),this}get(C,S){return this.matrix.get(this.rowIndices[C],S)}}class ba extends fi{constructor(C,S,w){de(C,S),Oe(C,w),super(C,S.length,w.length),this.rowIndices=S,this.columnIndices=w}set(C,S,w){return this.matrix.set(this.rowIndices[C],this.columnIndices[S],w),this}get(C,S){return this.matrix.get(this.rowIndices[C],this.columnIndices[S])}}class la extends fi{constructor(C,S,w,M,k){sn(C,S,w,M,k),super(C,w-S+1,k-M+1),this.startRow=S,this.startColumn=M}set(C,S,w){return this.matrix.set(this.startRow+C,this.startColumn+S,w),this}get(C,S){return this.matrix.get(this.startRow+C,this.startColumn+S)}}class xa extends fi{constructor(C){super(C,C.columns,C.rows)}set(C,S,w){return this.matrix.set(S,C,w),this}get(C,S){return this.matrix.get(S,C)}}class $r extends me{constructor(C,S={}){const{rows:w=1}=S;if(C.length%w!==0)throw new Error("the data length is not divisible by the number of rows");super(),this.rows=w,this.columns=C.length/w,this.data=C}set(C,S,w){let M=this._calculateIndex(C,S);return this.data[M]=w,this}get(C,S){let w=this._calculateIndex(C,S);return this.data[w]}_calculateIndex(C,S){return C*this.columns+S}}class Ar extends me{constructor(C){super(),this.data=C,this.rows=C.length,this.columns=C[0].length}set(C,S,w){return this.data[C][S]=w,this}get(C,S){return this.data[C][S]}}function jo(Y,C){if(Ct.isAnyArray(Y))return Y[0]&&Ct.isAnyArray(Y[0])?new Ar(Y):new $r(Y,C);throw new Error("the argument is not an array")}class Xi{constructor(C){C=Ar.checkMatrix(C);let S=C.clone(),w=S.rows,M=S.columns,k=new Float64Array(w),nt=1,rt,ot,At,It,vt,Zt,ce,Ht,qt;for(rt=0;rtMath.abs(Ht[It])&&(It=rt);if(It!==ot){for(At=0;At=0;At--){for(ot=0;otnt?M.set(k,nt,C.get(k,nt)):k===nt?M.set(k,nt,1):M.set(k,nt,0);return M}get upperTriangularMatrix(){let C=this.LU,S=C.rows,w=C.columns,M=new pe(S,w);for(let k=0;kMath.abs(C)?(S=C/Y,Math.abs(Y)*Math.sqrt(1+S*S)):C!==0?(S=Y/C,Math.abs(C)*Math.sqrt(1+S*S)):0}class fo{constructor(C){C=Ar.checkMatrix(C);let S=C.clone(),w=C.rows,M=C.columns,k=new Float64Array(M),nt,rt,ot,At;for(ot=0;ot=0;At--){for(ot=0;ot=0;rt--){for(k=0;k=0;Ft--)if(Ht[Ft]!==0){for(let te=Ft+1;te=0;Ft--){if(Ft0;){let Ft,te;for(Ft=Ie-2;Ft>=-1&&Ft!==-1;Ft--){const ue=Number.MIN_VALUE+on*Math.abs(Ht[Ft]+Math.abs(Ht[Ft+1]));if(Math.abs(Et[Ft])<=ue||Number.isNaN(Et[Ft])){Et[Ft]=0;break}}if(Ft===Ie-2)te=4;else{let ue;for(ue=Ie-1;ue>=Ft&&ue!==Ft;ue--){let se=(ue!==Ie?Math.abs(Et[ue]):0)+(ue!==Ft+1?Math.abs(Et[ue-1]):0);if(Math.abs(Ht[ue])<=on*se){Ht[ue]=0;break}}ue===Ft?te=3:ue===Ie-1?te=1:(te=2,Ft=ue)}switch(Ft++,te){case 1:{let ue=Et[Ie-2];Et[Ie-2]=0;for(let se=Ie-2;se>=Ft;se--){let Jn=Ji(Ht[se],ue),Qn=Ht[se]/Jn,jn=ue/Jn;if(Ht[se]=Jn,se!==Ft&&(ue=-jn*Et[se-1],Et[se-1]=Qn*Et[se-1]),At)for(let qn=0;qn=Ht[Ft+1]);){let ue=Ht[Ft];if(Ht[Ft]=Ht[Ft+1],Ht[Ft+1]=ue,At&&FtS&&k.set(It,vt,C.get(It,vt)/this.s[vt]);let nt=this.U,rt=nt.rows,ot=nt.columns,At=new pe(w,rt);for(let It=0;ItC&&S++;return S}get diagonal(){return Array.from(this.s)}get threshold(){return Number.EPSILON/2*Math.max(this.m,this.n)*this.s[0]}get leftSingularVectors(){return this.U}get rightSingularVectors(){return this.V}get diagonalMatrix(){return pe.diag(this.s)}}function Zo(Y,C=!1){return Y=Ar.checkMatrix(Y),C?new ja(Y).inverse():_A(Y,pe.eye(Y.rows))}function _A(Y,C,S=!1){return Y=Ar.checkMatrix(Y),C=Ar.checkMatrix(C),S?new ja(Y).solve(C):Y.isSquare()?new Xi(Y).solve(C):new fo(Y).solve(C)}function Rs(Y){if(Y=pe.checkMatrix(Y),Y.isSquare()){if(Y.columns===0)return 1;let C,S,w,M;if(Y.columns===2)return C=Y.get(0,0),S=Y.get(0,1),w=Y.get(1,0),M=Y.get(1,1),C*M-S*w;if(Y.columns===3){let k,nt,rt;return k=new ba(Y,[1,2],[1,2]),nt=new ba(Y,[1,2],[0,2]),rt=new ba(Y,[1,2],[0,1]),C=Y.get(0,0),S=Y.get(0,1),w=Y.get(0,2),C*Rs(k)-S*Rs(nt)+w*Rs(rt)}else return new Xi(Y).determinant}else throw Error("determinant can only be calculated for a square matrix")}function HA(Y,C){let S=[];for(let w=0;wM)return new Array(C.rows+1).fill(0);{let k=C.addRow(S,[0]);for(let nt=0;ntC?k[nt]=1/k[nt]:k[nt]=0;return M.mmul(pe.diag(k).mmul(w.transpose()))}function nd(Y,C=Y,S={}){Y=new pe(Y);let w=!1;if(typeof C=="object"&&!pe.isMatrix(C)&&!Ct.isAnyArray(C)?(S=C,C=Y,w=!0):C=new pe(C),Y.rows!==C.rows)throw new TypeError("Both matrices must have the same number of rows");const{center:M=!0}=S;M&&(Y=Y.center("column"),w||(C=C.center("column")));const k=Y.transpose().mmul(C);for(let nt=0;nt0?M.set(k,k+1,S[k]):S[k]<0&&M.set(k,k-1,S[k])}return M}}function GA(Y,C,S,w){let M,k,nt,rt,ot,At,It,vt;for(ot=0;ot0;rt--){for(vt=0,nt=0,At=0;At0&&(k=-k),C[rt]=vt*k,nt=nt-M*k,S[rt-1]=M-k,ot=0;otAt)do{for(M=S[At],vt=(S[At+1]-M)/(2*C[At]),Zt=Ji(vt,1),vt<0&&(Zt=-Zt),S[At]=C[At]/(vt+Zt),S[At+1]=C[At]*(vt+Zt),ce=S[At+1],k=M-S[At],nt=At+2;nt=At;nt--)for(Ce=qt,qt=Ht,Ee=$t,M=Ht*C[nt],k=Ht*vt,Zt=Ji(vt,C[nt]),C[nt+1]=$t*Zt,$t=C[nt]/Zt,Ht=vt/Zt,vt=Ht*S[nt]-$t*M,S[nt+1]=k+$t*(Ht*M+$t*S[nt]),ot=0;otWn*je);S[At]=S[At]+He,C[At]=0}for(nt=0;nt=vt;At--)S[At]=C.get(At,vt-1)/Zt,ot+=S[At]*S[At];for(rt=Math.sqrt(ot),S[vt]>0&&(rt=-rt),ot=ot-S[vt]*rt,S[vt]=S[vt]-rt,It=vt;It=vt;At--)nt+=S[At]*C.get(At,It);for(nt=nt/ot,At=vt;At<=k;At++)C.set(At,It,C.get(At,It)-nt*S[At])}for(At=0;At<=k;At++){for(nt=0,It=k;It>=vt;It--)nt+=S[It]*C.get(At,It);for(nt=nt/ot,It=vt;It<=k;It++)C.set(At,It,C.get(At,It)-nt*S[It])}S[vt]=Zt*S[vt],C.set(vt,vt-1,Zt*rt)}}for(At=0;At=M+1;vt--)if(C.get(vt,vt-1)!==0){for(At=vt+1;At<=k;At++)S[At]=C.get(At,vt-1);for(It=vt;It<=k;It++){for(rt=0,At=vt;At<=k;At++)rt+=S[At]*w.get(At,It);for(rt=rt/S[vt]/C.get(vt,vt-1),At=vt;At<=k;At++)w.set(At,It,w.get(At,It)+rt*S[At])}}}function zA(Y,C,S,w,M){let k=Y-1,nt=0,rt=Y-1,ot=Number.EPSILON,At=0,It=0,vt=0,Zt=0,ce=0,Ht=0,qt=0,Ce=0,Et,$t,Ee,He,je,Wn,Ie,De,on,Ft,te,ue,se,Jn,Qn;for(Et=0;Etrt)&&(S[Et]=M.get(Et,Et),C[Et]=0),$t=Math.max(Et-1,0);$t=nt;){for(He=k;He>nt&&(Ht=Math.abs(M.get(He-1,He-1))+Math.abs(M.get(He,He)),Ht===0&&(Ht=It),!(Math.abs(M.get(He,He-1))=0){for(qt=vt>=0?vt+qt:vt-qt,S[k-1]=De+qt,S[k]=S[k-1],qt!==0&&(S[k]=De-Ie/qt),C[k-1]=0,C[k]=0,De=M.get(k,k-1),Ht=Math.abs(De)+Math.abs(qt),vt=De/Ht,Zt=qt/Ht,ce=Math.sqrt(vt*vt+Zt*Zt),vt=vt/ce,Zt=Zt/ce,$t=k-1;$t0)){for(Ht=Math.sqrt(Ht),on=He&&(qt=M.get(je,je),ce=De-qt,Ht=on-qt,vt=(ce*Ht-Ie)/M.get(je+1,je)+M.get(je,je+1),Zt=M.get(je+1,je+1)-qt-ce-Ht,ce=M.get(je+2,je+1),Ht=Math.abs(vt)+Math.abs(Zt)+Math.abs(ce),vt=vt/Ht,Zt=Zt/Ht,ce=ce/Ht,!(je===He||Math.abs(M.get(je,je-1))*(Math.abs(Zt)+Math.abs(ce))je+2&&M.set(Et,Et-3,0);for(Ee=je;Ee<=k-1&&(Jn=Ee!==k-1,Ee!==je&&(vt=M.get(Ee,Ee-1),Zt=M.get(Ee+1,Ee-1),ce=Jn?M.get(Ee+2,Ee-1):0,De=Math.abs(vt)+Math.abs(Zt)+Math.abs(ce),De!==0&&(vt=vt/De,Zt=Zt/De,ce=ce/De)),De!==0);Ee++)if(Ht=Math.sqrt(vt*vt+Zt*Zt+ce*ce),vt<0&&(Ht=-Ht),Ht!==0){for(Ee!==je?M.set(Ee,Ee-1,-Ht*De):He!==je&&M.set(Ee,Ee-1,-M.get(Ee,Ee-1)),vt=vt+Ht,De=vt/Ht,on=Zt/Ht,qt=ce/Ht,Zt=Zt/vt,ce=ce/vt,$t=Ee;$t=0;k--)if(vt=S[k],Zt=C[k],Zt===0)for(He=k,M.set(k,k,1),Et=k-1;Et>=0;Et--){for(Ie=M.get(Et,Et)-vt,ce=0,$t=He;$t<=k;$t++)ce=ce+M.get(Et,$t)*M.get($t,k);if(C[Et]<0)qt=Ie,Ht=ce;else if(He=Et,C[Et]===0?M.set(Et,k,Ie!==0?-ce/Ie:-ce/(ot*It)):(De=M.get(Et,Et+1),on=M.get(Et+1,Et),Zt=(S[Et]-vt)*(S[Et]-vt)+C[Et]*C[Et],Wn=(De*Ht-qt*ce)/Zt,M.set(Et,k,Wn),M.set(Et+1,k,Math.abs(De)>Math.abs(qt)?(-ce-Ie*Wn)/De:(-Ht-on*Wn)/qt)),Wn=Math.abs(M.get(Et,k)),ot*Wn*Wn>1)for($t=Et;$t<=k;$t++)M.set($t,k,M.get($t,k)/Wn)}else if(Zt<0)for(He=k-1,Math.abs(M.get(k,k-1))>Math.abs(M.get(k-1,k))?(M.set(k-1,k-1,Zt/M.get(k,k-1)),M.set(k-1,k,-(M.get(k,k)-vt)/M.get(k,k-1))):(Qn=Yo(0,-M.get(k-1,k),M.get(k-1,k-1)-vt,Zt),M.set(k-1,k-1,Qn[0]),M.set(k-1,k,Qn[1])),M.set(k,k-1,0),M.set(k,k,1),Et=k-2;Et>=0;Et--){for(Ft=0,te=0,$t=He;$t<=k;$t++)Ft=Ft+M.get(Et,$t)*M.get($t,k-1),te=te+M.get(Et,$t)*M.get($t,k);if(Ie=M.get(Et,Et)-vt,C[Et]<0)qt=Ie,ce=Ft,Ht=te;else if(He=Et,C[Et]===0?(Qn=Yo(-Ft,-te,Ie,Zt),M.set(Et,k-1,Qn[0]),M.set(Et,k,Qn[1])):(De=M.get(Et,Et+1),on=M.get(Et+1,Et),ue=(S[Et]-vt)*(S[Et]-vt)+C[Et]*C[Et]-Zt*Zt,se=(S[Et]-vt)*2*Zt,ue===0&&se===0&&(ue=ot*It*(Math.abs(Ie)+Math.abs(Zt)+Math.abs(De)+Math.abs(on)+Math.abs(qt))),Qn=Yo(De*ce-qt*Ft+Zt*te,De*Ht-qt*te-Zt*Ft,ue,se),M.set(Et,k-1,Qn[0]),M.set(Et,k,Qn[1]),Math.abs(De)>Math.abs(qt)+Math.abs(Zt)?(M.set(Et+1,k-1,(-Ft-Ie*M.get(Et,k-1)+Zt*M.get(Et,k))/De),M.set(Et+1,k,(-te-Ie*M.get(Et,k)-Zt*M.get(Et,k-1))/De)):(Qn=Yo(-ce-on*M.get(Et,k-1),-Ht-on*M.get(Et,k),qt,Zt),M.set(Et+1,k-1,Qn[0]),M.set(Et+1,k,Qn[1]))),Wn=Math.max(Math.abs(M.get(Et,k-1)),Math.abs(M.get(Et,k))),ot*Wn*Wn>1)for($t=Et;$t<=k;$t++)M.set($t,k-1,M.get($t,k-1)/Wn),M.set($t,k,M.get($t,k)/Wn)}for(Et=0;Etrt)for($t=Et;$t=nt;$t--)for(Et=nt;Et<=rt;Et++){for(qt=0,Ee=nt;Ee<=Math.min($t,rt);Ee++)qt=qt+w.get(Et,Ee)*M.get(Ee,$t);w.set(Et,$t,qt)}}}function Yo(Y,C,S,w){let M,k;return Math.abs(S)>Math.abs(w)?(M=w/S,k=S+M*w,[(Y+M*C)/k,(C-M*Y)/k]):(M=S/w,k=w+M*S,[(M*Y+C)/k,(M*C-Y)/k])}class Zl{constructor(C){if(C=Ar.checkMatrix(C),!C.isSymmetric())throw new Error("Matrix is not symmetric");let S=C,w=S.rows,M=new pe(w,w),k=!0,nt,rt,ot;for(rt=0;rt0),M.set(rt,rt,Math.sqrt(Math.max(At,0))),ot=rt+1;ot=0;ot--)for(rt=0;rtnt;ce++)vt=C.transpose().mmul(rt).div(rt.transpose().mmul(rt).get(0,0)),vt=vt.div(vt.norm()),At=C.mmul(vt).div(vt.transpose().mmul(vt).get(0,0)),ce>0&&(ot=At.clone().sub(Zt).pow(2).sum()),Zt=At.clone(),w?(It=w.transpose().mmul(At).div(At.transpose().mmul(At).get(0,0)),It=It.div(It.norm()),rt=w.mmul(It).div(It.transpose().mmul(It).get(0,0))):rt=At;if(w){let ce=C.transpose().mmul(At).div(At.transpose().mmul(At).get(0,0));ce=ce.div(ce.norm());let Ht=C.clone().sub(At.clone().mmul(ce.transpose())),qt=rt.transpose().mmul(At).div(At.transpose().mmul(At).get(0,0)),Ce=w.clone().sub(At.clone().mulS(qt.get(0,0)).mmul(It.transpose()));this.t=At,this.p=ce.transpose(),this.w=vt.transpose(),this.q=It,this.u=rt,this.s=At.transpose().mmul(At),this.xResidual=Ht,this.yResidual=Ce,this.betas=qt}else this.w=vt.transpose(),this.s=At.transpose().mmul(At).sqrt(),M?this.t=At.clone().div(this.s.get(0,0)):this.t=At,this.xResidual=C.sub(At.mmul(vt.transpose()))}}st.XA=me,st.a_=Zl,st.yQ=Zl,st.Hs=Fr,st.Ec=pn,st.dx=pn,st.LU=Xi,st.Rm=Xi,st.y3=pe,st.qK=Yi,st.pb=ls,st.j=cs,st.sO=Li,st.BZ=Ba,st.EK=qr,st.Db=ba,st.Fx=la,st.tU=xa,st.Ym=Yl,st.rs=Yl,st.QR=fo,st.TB=fo,st.oH=ja,st.Sc=ja,st.BN=kr,st.it=$r,st.$r=Ar,st.QM=Wl,st.AV=nd,I=pe,st.GH=Rs,st.SO=Zo,st.uZ=cu,st.yU=ed,st.F1=_A,st.re=jo},45411:function(X){"use strict";X.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},75196:function(X,st,T){var I=T(45411),W=T(81683),z=Object.hasOwnProperty,P=Object.create(null);for(var N in I)z.call(I,N)&&(P[I[N]]=N);var G=X.exports={to:{},get:{}};G.get=function(H){var J=H.substring(0,3).toLowerCase(),Z,$;switch(J){case"hsl":Z=G.get.hsl(H),$="hsl";break;case"hwb":Z=G.get.hwb(H),$="hwb";break;default:Z=G.get.rgb(H),$="rgb";break}return Z?{model:$,value:Z}:null},G.get.rgb=function(H){if(!H)return null;var J=/^#([a-f0-9]{3,4})$/i,Z=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,$=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,ct=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,ht=/^(\w+)$/,Ct=[0,0,0,1],pt,ut,Bt;if(pt=H.match(Z)){for(Bt=pt[2],pt=pt[1],ut=0;ut<3;ut++){var wt=ut*2;Ct[ut]=parseInt(pt.slice(wt,wt+2),16)}Bt&&(Ct[3]=parseInt(Bt,16)/255)}else if(pt=H.match(J)){for(pt=pt[1],Bt=pt[3],ut=0;ut<3;ut++)Ct[ut]=parseInt(pt[ut]+pt[ut],16);Bt&&(Ct[3]=parseInt(Bt+Bt,16)/255)}else if(pt=H.match($)){for(ut=0;ut<3;ut++)Ct[ut]=parseInt(pt[ut+1],0);pt[4]&&(pt[5]?Ct[3]=parseFloat(pt[4])*.01:Ct[3]=parseFloat(pt[4]))}else if(pt=H.match(ct)){for(ut=0;ut<3;ut++)Ct[ut]=Math.round(parseFloat(pt[ut+1])*2.55);pt[4]&&(pt[5]?Ct[3]=parseFloat(pt[4])*.01:Ct[3]=parseFloat(pt[4]))}else return(pt=H.match(ht))?pt[1]==="transparent"?[0,0,0,0]:z.call(I,pt[1])?(Ct=I[pt[1]],Ct[3]=1,Ct):null:null;for(ut=0;ut<3;ut++)Ct[ut]=K(Ct[ut],0,255);return Ct[3]=K(Ct[3],0,1),Ct},G.get.hsl=function(H){if(!H)return null;var J=/^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*)?\)$/,Z=H.match(J);if(Z){var $=parseFloat(Z[4]),ct=(parseFloat(Z[1])%360+360)%360,ht=K(parseFloat(Z[2]),0,100),Ct=K(parseFloat(Z[3]),0,100),pt=K(isNaN($)?1:$,0,1);return[ct,ht,Ct,pt]}return null},G.get.hwb=function(H){if(!H)return null;var J=/^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*)?\)$/,Z=H.match(J);if(Z){var $=parseFloat(Z[4]),ct=(parseFloat(Z[1])%360+360)%360,ht=K(parseFloat(Z[2]),0,100),Ct=K(parseFloat(Z[3]),0,100),pt=K(isNaN($)?1:$,0,1);return[ct,ht,Ct,pt]}return null},G.to.hex=function(){var H=W(arguments);return"#"+_(H[0])+_(H[1])+_(H[2])+(H[3]<1?_(Math.round(H[3]*255)):"")},G.to.rgb=function(){var H=W(arguments);return H.length<4||H[3]===1?"rgb("+Math.round(H[0])+", "+Math.round(H[1])+", "+Math.round(H[2])+")":"rgba("+Math.round(H[0])+", "+Math.round(H[1])+", "+Math.round(H[2])+", "+H[3]+")"},G.to.rgb.percent=function(){var H=W(arguments),J=Math.round(H[0]/255*100),Z=Math.round(H[1]/255*100),$=Math.round(H[2]/255*100);return H.length<4||H[3]===1?"rgb("+J+"%, "+Z+"%, "+$+"%)":"rgba("+J+"%, "+Z+"%, "+$+"%, "+H[3]+")"},G.to.hsl=function(){var H=W(arguments);return H.length<4||H[3]===1?"hsl("+H[0]+", "+H[1]+"%, "+H[2]+"%)":"hsla("+H[0]+", "+H[1]+"%, "+H[2]+"%, "+H[3]+")"},G.to.hwb=function(){var H=W(arguments),J="";return H.length>=4&&H[3]!==1&&(J=", "+H[3]),"hwb("+H[0]+", "+H[1]+"%, "+H[2]+"%"+J+")"},G.to.keyword=function(H){return P[H.slice(0,3)]};function K(H,J,Z){return Math.min(Math.max(J,H),Z)}function _(H){var J=Math.round(H).toString(16).toUpperCase();return J.length<2?"0"+J:J}},92546:function(X,st,T){X.exports={graphlib:T(76626),layout:T(47194),debug:T(11303),util:{time:T(53063).time,notime:T(53063).notime},version:T(11897)}},81255:function(X,st,T){"use strict";var I=T(72361),W=T(39240);X.exports={run:z,undo:N};function z(G){var K=G.graph().acyclicer==="greedy"?W(G,_(G)):P(G);I.forEach(K,function(H){var J=G.edge(H);G.removeEdge(H),J.forwardName=H.name,J.reversed=!0,G.setEdge(H.w,H.v,J,I.uniqueId("rev"))});function _(H){return function(J){return H.edge(J).weight}}}function P(G){var K=[],_={},H={};function J(Z){I.has(H,Z)||(H[Z]=!0,_[Z]=!0,I.forEach(G.outEdges(Z),function($){I.has(_,$.w)?K.push($):J($.w)}),delete _[Z])}return I.forEach(G.nodes(),J),K}function N(G){I.forEach(G.edges(),function(K){var _=G.edge(K);if(_.reversed){G.removeEdge(K);var H=_.forwardName;delete _.reversed,delete _.forwardName,G.setEdge(K.w,K.v,_,H)}})}},60765:function(X,st,T){var I=T(72361),W=T(53063);X.exports=z;function z(N){function G(K){var _=N.children(K),H=N.node(K);if(_.length&&I.forEach(_,G),I.has(H,"minRank")){H.borderLeft=[],H.borderRight=[];for(var J=H.minRank,Z=H.maxRank+1;J0;--ut)if(pt=Z[ut].dequeue(),pt){ct=ct.concat(K(J,Z,$,pt,!0));break}}}return ct}function K(J,Z,$,ct,ht){var Ct=ht?[]:void 0;return I.forEach(J.inEdges(ct.v),function(pt){var ut=J.edge(pt),Bt=J.node(pt.v);ht&&Ct.push({v:pt.v,w:pt.w}),Bt.out-=ut,H(Z,$,Bt)}),I.forEach(J.outEdges(ct.v),function(pt){var ut=J.edge(pt),Bt=pt.w,wt=J.node(Bt);wt.in-=ut,H(Z,$,wt)}),J.removeNode(ct.v),Ct}function _(J,Z){var $=new W,ct=0,ht=0;I.forEach(J.nodes(),function(ut){$.setNode(ut,{v:ut,in:0,out:0})}),I.forEach(J.edges(),function(ut){var Bt=$.edge(ut.v,ut.w)||0,wt=Z(ut),Tt=Bt+wt;$.setEdge(ut.v,ut.w,Tt),ht=Math.max(ht,$.node(ut.v).out+=wt),ct=Math.max(ct,$.node(ut.w).in+=wt)});var Ct=I.range(ht+ct+3).map(function(){return new z}),pt=ct+1;return I.forEach($.nodes(),function(ut){H(Ct,pt,$.node(ut))}),{graph:$,buckets:Ct,zeroIdx:pt}}function H(J,Z,$){$.out?$.in?J[$.out-$.in+Z].enqueue($):J[J.length-1].enqueue($):J[0].enqueue($)}},47194:function(X,st,T){"use strict";var I=T(72361),W=T(81255),z=T(27163),P=T(64505),N=T(53063).normalizeRanks,G=T(71970),K=T(53063).removeEmptyRanks,_=T(31733),H=T(60765),J=T(13257),Z=T(62852),$=T(93021),ct=T(53063),ht=T(76626).Graph;X.exports=Ct;function Ct(gt,Mt){var Lt=Mt&&Mt.debugTiming?ct.time:ct.notime;Lt("layout",function(){var ee=Lt(" buildLayoutGraph",function(){return Wt(gt)});Lt(" runLayout",function(){pt(ee,Lt)}),Lt(" updateInputGraph",function(){ut(gt,ee)})})}function pt(gt,Mt){Mt(" makeSpaceForEdgeLabels",function(){ie(gt)}),Mt(" removeSelfEdges",function(){As(gt)}),Mt(" acyclic",function(){W.run(gt)}),Mt(" nestingGraph.run",function(){_.run(gt)}),Mt(" rank",function(){P(ct.asNonCompoundGraph(gt))}),Mt(" injectEdgeLabelProxies",function(){ve(gt)}),Mt(" removeEmptyRanks",function(){K(gt)}),Mt(" nestingGraph.cleanup",function(){_.cleanup(gt)}),Mt(" normalizeRanks",function(){N(gt)}),Mt(" assignRankMinMax",function(){de(gt)}),Mt(" removeEdgeLabelProxies",function(){Oe(gt)}),Mt(" normalize.run",function(){z.run(gt)}),Mt(" parentDummyChains",function(){G(gt)}),Mt(" addBorderSegments",function(){H(gt)}),Mt(" order",function(){Z(gt)}),Mt(" insertSelfEdges",function(){ho(gt)}),Mt(" adjustCoordinateSystem",function(){J.adjust(gt)}),Mt(" position",function(){$(gt)}),Mt(" positionSelfEdges",function(){Pt(gt)}),Mt(" removeBorderNodes",function(){ji(gt)}),Mt(" normalize.undo",function(){z.undo(gt)}),Mt(" fixupEdgeLabelCoords",function(){Xn(gt)}),Mt(" undoCoordinateSystem",function(){J.undo(gt)}),Mt(" translateGraph",function(){sn(gt)}),Mt(" assignNodeIntersects",function(){dn(gt)}),Mt(" reversePoints",function(){Jr(gt)}),Mt(" acyclic.undo",function(){W.undo(gt)})}function ut(gt,Mt){I.forEach(gt.nodes(),function(Lt){var ee=gt.node(Lt),be=Mt.node(Lt);ee&&(ee.x=be.x,ee.y=be.y,Mt.children(Lt).length&&(ee.width=be.width,ee.height=be.height))}),I.forEach(gt.edges(),function(Lt){var ee=gt.edge(Lt),be=Mt.edge(Lt);ee.points=be.points,I.has(be,"x")&&(ee.x=be.x,ee.y=be.y)}),gt.graph().width=Mt.graph().width,gt.graph().height=Mt.graph().height}var Bt=["nodesep","edgesep","ranksep","marginx","marginy"],wt={ranksep:50,edgesep:20,nodesep:50,rankdir:"tb"},Tt=["acyclicer","ranker","rankdir","align"],kt=["width","height"],_t={width:0,height:0},Ot=["minlen","weight","width","height","labeloffset"],Gt={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},ae=["labelpos"];function Wt(gt){var Mt=new ht({multigraph:!0,compound:!0}),Lt=jt(gt.graph());return Mt.setGraph(I.merge({},wt,zt(Lt,Bt),I.pick(Lt,Tt))),I.forEach(gt.nodes(),function(ee){var be=jt(gt.node(ee));Mt.setNode(ee,I.defaults(zt(be,kt),_t)),Mt.setParent(ee,gt.parent(ee))}),I.forEach(gt.edges(),function(ee){var be=jt(gt.edge(ee));Mt.setEdge(ee,I.merge({},Gt,zt(be,Ot),I.pick(be,ae)))}),Mt}function ie(gt){var Mt=gt.graph();Mt.ranksep/=2,I.forEach(gt.edges(),function(Lt){var ee=gt.edge(Lt);ee.minlen*=2,ee.labelpos.toLowerCase()!=="c"&&(Mt.rankdir==="TB"||Mt.rankdir==="BT"?ee.width+=ee.labeloffset:ee.height+=ee.labeloffset)})}function ve(gt){I.forEach(gt.edges(),function(Mt){var Lt=gt.edge(Mt);if(Lt.width&&Lt.height){var ee=gt.node(Mt.v),be=gt.node(Mt.w),_e={rank:(be.rank-ee.rank)/2+ee.rank,e:Mt};ct.addDummyNode(gt,"edge-proxy",_e,"_ep")}})}function de(gt){var Mt=0;I.forEach(gt.nodes(),function(Lt){var ee=gt.node(Lt);ee.borderTop&&(ee.minRank=gt.node(ee.borderTop).rank,ee.maxRank=gt.node(ee.borderBottom).rank,Mt=I.max(Mt,ee.maxRank))}),gt.graph().maxRank=Mt}function Oe(gt){I.forEach(gt.nodes(),function(Mt){var Lt=gt.node(Mt);Lt.dummy==="edge-proxy"&&(gt.edge(Lt.e).labelRank=Lt.rank,gt.removeNode(Mt))})}function sn(gt){var Mt=Number.POSITIVE_INFINITY,Lt=0,ee=Number.POSITIVE_INFINITY,be=0,_e=gt.graph(),Me=_e.marginx||0,nn=_e.marginy||0;function rr(or){var Ge=or.x,ze=or.y,me=or.width,Ve=or.height;Mt=Math.min(Mt,Ge-me/2),Lt=Math.max(Lt,Ge+me/2),ee=Math.min(ee,ze-Ve/2),be=Math.max(be,ze+Ve/2)}I.forEach(gt.nodes(),function(or){rr(gt.node(or))}),I.forEach(gt.edges(),function(or){var Ge=gt.edge(or);I.has(Ge,"x")&&rr(Ge)}),Mt-=Me,ee-=nn,I.forEach(gt.nodes(),function(or){var Ge=gt.node(or);Ge.x-=Mt,Ge.y-=ee}),I.forEach(gt.edges(),function(or){var Ge=gt.edge(or);I.forEach(Ge.points,function(ze){ze.x-=Mt,ze.y-=ee}),I.has(Ge,"x")&&(Ge.x-=Mt),I.has(Ge,"y")&&(Ge.y-=ee)}),_e.width=Lt-Mt+Me,_e.height=be-ee+nn}function dn(gt){I.forEach(gt.edges(),function(Mt){var Lt=gt.edge(Mt),ee=gt.node(Mt.v),be=gt.node(Mt.w),_e,Me;Lt.points?(_e=Lt.points[0],Me=Lt.points[Lt.points.length-1]):(Lt.points=[],_e=be,Me=ee),Lt.points.unshift(ct.intersectRect(ee,_e)),Lt.points.push(ct.intersectRect(be,Me))})}function Xn(gt){I.forEach(gt.edges(),function(Mt){var Lt=gt.edge(Mt);if(I.has(Lt,"x"))switch((Lt.labelpos==="l"||Lt.labelpos==="r")&&(Lt.width-=Lt.labeloffset),Lt.labelpos){case"l":Lt.x-=Lt.width/2+Lt.labeloffset;break;case"r":Lt.x+=Lt.width/2+Lt.labeloffset;break}})}function Jr(gt){I.forEach(gt.edges(),function(Mt){var Lt=gt.edge(Mt);Lt.reversed&&Lt.points.reverse()})}function ji(gt){I.forEach(gt.nodes(),function(Mt){if(gt.children(Mt).length){var Lt=gt.node(Mt),ee=gt.node(Lt.borderTop),be=gt.node(Lt.borderBottom),_e=gt.node(I.last(Lt.borderLeft)),Me=gt.node(I.last(Lt.borderRight));Lt.width=Math.abs(Me.x-_e.x),Lt.height=Math.abs(be.y-ee.y),Lt.x=_e.x+Lt.width/2,Lt.y=ee.y+Lt.height/2}}),I.forEach(gt.nodes(),function(Mt){gt.node(Mt).dummy==="border"&>.removeNode(Mt)})}function As(gt){I.forEach(gt.edges(),function(Mt){if(Mt.v===Mt.w){var Lt=gt.node(Mt.v);Lt.selfEdges||(Lt.selfEdges=[]),Lt.selfEdges.push({e:Mt,label:gt.edge(Mt)}),gt.removeEdge(Mt)}})}function ho(gt){var Mt=ct.buildLayerMatrix(gt);I.forEach(Mt,function(Lt){var ee=0;I.forEach(Lt,function(be,_e){var Me=gt.node(be);Me.order=_e+ee,I.forEach(Me.selfEdges,function(nn){ct.addDummyNode(gt,"selfedge",{width:nn.label.width,height:nn.label.height,rank:Me.rank,order:_e+ ++ee,e:nn.e,label:nn.label},"_se")}),delete Me.selfEdges})})}function Pt(gt){I.forEach(gt.nodes(),function(Mt){var Lt=gt.node(Mt);if(Lt.dummy==="selfedge"){var ee=gt.node(Lt.e.v),be=ee.x+ee.width/2,_e=ee.y,Me=Lt.x-be,nn=ee.height/2;gt.setEdge(Lt.e,Lt.label),gt.removeNode(Mt),Lt.label.points=[{x:be+2*Me/3,y:_e-nn},{x:be+5*Me/6,y:_e-nn},{x:be+Me,y:_e},{x:be+5*Me/6,y:_e+nn},{x:be+2*Me/3,y:_e+nn}],Lt.label.x=Lt.x,Lt.label.y=Lt.y}})}function zt(gt,Mt){return I.mapValues(I.pick(gt,Mt),Number)}function jt(gt){var Mt={};return I.forEach(gt,function(Lt,ee){Mt[ee.toLowerCase()]=Lt}),Mt}},72361:function(X,st,T){var I;try{I={cloneDeep:T(44187),constant:T(46221),defaults:T(34981),each:T(61475),filter:T(3130),find:T(48835),flatten:T(1332),forEach:T(47177),forIn:T(59946),has:T(64760),isUndefined:T(68408),last:T(47522),map:T(81426),mapValues:T(60032),max:T(18038),merge:T(55056),min:T(60169),minBy:T(13604),now:T(76308),pick:T(72333),range:T(69235),reduce:T(9695),sortBy:T(35020),uniqueId:T(69624),values:T(72834),zipObject:T(79261)}}catch(W){}I||(I=window._),X.exports=I},31733:function(X,st,T){var I=T(72361),W=T(53063);X.exports={run:z,cleanup:K};function z(_){var H=W.addDummyNode(_,"root",{},"_root"),J=N(_),Z=I.max(I.values(J))-1,$=2*Z+1;_.graph().nestingRoot=H,I.forEach(_.edges(),function(ht){_.edge(ht).minlen*=$});var ct=G(_)+1;I.forEach(_.children(),function(ht){P(_,H,$,ct,Z,J,ht)}),_.graph().nodeRankFactor=$}function P(_,H,J,Z,$,ct,ht){var Ct=_.children(ht);if(!Ct.length){ht!==H&&_.setEdge(H,ht,{weight:0,minlen:J});return}var pt=W.addBorderNode(_,"_bt"),ut=W.addBorderNode(_,"_bb"),Bt=_.node(ht);_.setParent(pt,ht),Bt.borderTop=pt,_.setParent(ut,ht),Bt.borderBottom=ut,I.forEach(Ct,function(wt){P(_,H,J,Z,$,ct,wt);var Tt=_.node(wt),kt=Tt.borderTop?Tt.borderTop:wt,_t=Tt.borderBottom?Tt.borderBottom:wt,Ot=Tt.borderTop?Z:2*Z,Gt=kt!==_t?1:$-ct[ht]+1;_.setEdge(pt,kt,{weight:Ot,minlen:Gt,nestingEdge:!0}),_.setEdge(_t,ut,{weight:Ot,minlen:Gt,nestingEdge:!0})}),_.parent(ht)||_.setEdge(H,pt,{weight:0,minlen:$+ct[ht]})}function N(_){var H={};function J(Z,$){var ct=_.children(Z);ct&&ct.length&&I.forEach(ct,function(ht){J(ht,$+1)}),H[Z]=$}return I.forEach(_.children(),function(Z){J(Z,1)}),H}function G(_){return I.reduce(_.edges(),function(H,J){return H+_.edge(J).weight},0)}function K(_){var H=_.graph();_.removeNode(H.nestingRoot),delete H.nestingRoot,I.forEach(_.edges(),function(J){var Z=_.edge(J);Z.nestingEdge&&_.removeEdge(J)})}},27163:function(X,st,T){"use strict";var I=T(72361),W=T(53063);X.exports={run:z,undo:N};function z(G){G.graph().dummyChains=[],I.forEach(G.edges(),function(K){P(G,K)})}function P(G,K){var _=K.v,H=G.node(_).rank,J=K.w,Z=G.node(J).rank,$=K.name,ct=G.edge(K),ht=ct.labelRank;if(Z!==H+1){G.removeEdge(K);var Ct,pt,ut;for(ut=0,++H;H0;)ht%2&&(Ct+=Z[ht+1]),ht=ht-1>>1,Z[ht]+=ct.weight;$+=ct.weight*Ct})),$}},62852:function(X,st,T){"use strict";var I=T(72361),W=T(18043),z=T(45456),P=T(86490),N=T(59105),G=T(52205),K=T(76626).Graph,_=T(53063);X.exports=H;function H(ct){var ht=_.maxRank(ct),Ct=J(ct,I.range(1,ht+1),"inEdges"),pt=J(ct,I.range(ht-1,-1,-1),"outEdges"),ut=W(ct);$(ct,ut);for(var Bt=Number.POSITIVE_INFINITY,wt,Tt=0,kt=0;kt<4;++Tt,++kt){Z(Tt%2?Ct:pt,Tt%4>=2),ut=_.buildLayerMatrix(ct);var _t=z(ct,ut);_t=J.barycenter)&&P(J,Z)}}function _(J){return function(Z){Z.in.push(J),--Z.indegree===0&&N.push(Z)}}for(;N.length;){var H=N.pop();G.push(H),I.forEach(H.in.reverse(),K(H)),I.forEach(H.out,_(H))}return I.map(I.filter(G,function(J){return!J.merged}),function(J){return I.pick(J,["vs","i","barycenter","weight"])})}function P(N,G){var K=0,_=0;N.weight&&(K+=N.barycenter*N.weight,_+=N.weight),G.weight&&(K+=G.barycenter*G.weight,_+=G.weight),N.vs=G.vs.concat(N.vs),N.barycenter=K/_,N.weight=_,N.i=Math.min(G.i,N.i),G.merged=!0}},86490:function(X,st,T){var I=T(72361),W=T(99506),z=T(45926),P=T(1349);X.exports=N;function N(_,H,J,Z){var $=_.children(H),ct=_.node(H),ht=ct?ct.borderLeft:void 0,Ct=ct?ct.borderRight:void 0,pt={};ht&&($=I.filter($,function(_t){return _t!==ht&&_t!==Ct}));var ut=W(_,$);I.forEach(ut,function(_t){if(_.children(_t.v).length){var Ot=N(_,_t.v,J,Z);pt[_t.v]=Ot,I.has(Ot,"barycenter")&&K(_t,Ot)}});var Bt=z(ut,J);G(Bt,pt);var wt=P(Bt,Z);if(ht&&(wt.vs=I.flatten([ht,wt.vs,Ct],!0),_.predecessors(ht).length)){var Tt=_.node(_.predecessors(ht)[0]),kt=_.node(_.predecessors(Ct)[0]);I.has(wt,"barycenter")||(wt.barycenter=0,wt.weight=0),wt.barycenter=(wt.barycenter*wt.weight+Tt.order+kt.order)/(wt.weight+2),wt.weight+=2}return wt}function G(_,H){I.forEach(_,function(J){J.vs=I.flatten(J.vs.map(function(Z){return H[Z]?H[Z].vs:Z}),!0)})}function K(_,H){I.isUndefined(_.barycenter)?(_.barycenter=H.barycenter,_.weight=H.weight):(_.barycenter=(_.barycenter*_.weight+H.barycenter*H.weight)/(_.weight+H.weight),_.weight+=H.weight)}},1349:function(X,st,T){var I=T(72361),W=T(53063);X.exports=z;function z(G,K){var _=W.partition(G,function(pt){return I.has(pt,"barycenter")}),H=_.lhs,J=I.sortBy(_.rhs,function(pt){return-pt.i}),Z=[],$=0,ct=0,ht=0;H.sort(N(!!K)),ht=P(Z,J,ht),I.forEach(H,function(pt){ht+=pt.vs.length,Z.push(pt.vs),$+=pt.barycenter*pt.weight,ct+=pt.weight,ht=P(Z,J,ht)});var Ct={vs:I.flatten(Z,!0)};return ct&&(Ct.barycenter=$/ct,Ct.weight=ct),Ct}function P(G,K,_){for(var H;K.length&&(H=I.last(K)).i<=_;)K.pop(),G.push(H.vs),_++;return _}function N(G){return function(K,_){return K.barycenter<_.barycenter?-1:K.barycenter>_.barycenter?1:G?_.i-K.i:K.i-_.i}}},71970:function(X,st,T){var I=T(72361);X.exports=W;function W(N){var G=P(N);I.forEach(N.graph().dummyChains,function(K){for(var _=N.node(K),H=_.edgeObj,J=z(N,G,H.v,H.w),Z=J.path,$=J.lca,ct=0,ht=Z[ct],Ct=!0;K!==H.w;){if(_=N.node(K),Ct){for(;(ht=Z[ct])!==$&&N.node(ht).maxRank<_.rank;)ct++;ht===$&&(Ct=!1)}if(!Ct){for(;ctZ||$>G[ct].lim));for(ht=ct,ct=_;(ct=N.parent(ct))!==ht;)J.push(ct);return{path:H.concat(J.reverse()),lca:ht}}function P(N){var G={},K=0;function _(H){var J=K;I.forEach(N.children(H),_),G[H]={low:J,lim:K++}}return I.forEach(N.children(),_),G}},92080:function(X,st,T){"use strict";var I=T(72361),W=T(76626).Graph,z=T(53063);X.exports={positionX:Ct,findType1Conflicts:P,findType2Conflicts:N,addConflict:K,hasConflict:_,verticalAlignment:H,horizontalCompaction:J,alignCoordinates:ct,findSmallestWidthAlignment:$,balance:ht};function P(Bt,wt){var Tt={};function kt(_t,Ot){var Gt=0,ae=0,Wt=_t.length,ie=I.last(Ot);return I.forEach(Ot,function(ve,de){var Oe=G(Bt,ve),sn=Oe?Bt.node(Oe).order:Wt;(Oe||ve===ie)&&(I.forEach(Ot.slice(ae,de+1),function(dn){I.forEach(Bt.predecessors(dn),function(Xn){var Jr=Bt.node(Xn),ji=Jr.order;(jiie)&&K(Tt,Oe,ve)})})}function _t(Ot,Gt){var ae=-1,Wt,ie=0;return I.forEach(Gt,function(ve,de){if(Bt.node(ve).dummy==="border"){var Oe=Bt.predecessors(ve);Oe.length&&(Wt=Bt.node(Oe[0]).order,kt(Gt,ie,de,ae,Wt),ie=de,ae=Wt)}kt(Gt,ie,Gt.length,Wt,Ot.length)}),Gt}return I.reduce(wt,_t),Tt}function G(Bt,wt){if(Bt.node(wt).dummy)return I.find(Bt.predecessors(wt),function(Tt){return Bt.node(Tt).dummy})}function K(Bt,wt,Tt){if(wt>Tt){var kt=wt;wt=Tt,Tt=kt}var _t=Bt[wt];_t||(Bt[wt]=_t={}),_t[Tt]=!0}function _(Bt,wt,Tt){if(wt>Tt){var kt=wt;wt=Tt,Tt=kt}return I.has(Bt[wt],Tt)}function H(Bt,wt,Tt,kt){var _t={},Ot={},Gt={};return I.forEach(wt,function(ae){I.forEach(ae,function(Wt,ie){_t[Wt]=Wt,Ot[Wt]=Wt,Gt[Wt]=ie})}),I.forEach(wt,function(ae){var Wt=-1;I.forEach(ae,function(ie){var ve=kt(ie);if(ve.length){ve=I.sortBy(ve,function(Xn){return Gt[Xn]});for(var de=(ve.length-1)/2,Oe=Math.floor(de),sn=Math.ceil(de);Oe<=sn;++Oe){var dn=ve[Oe];Ot[ie]===ie&&WtWt.lim&&(ie=Wt,ve=!0);var de=I.filter(kt.edges(),function(Oe){return ve===wt(Tt,Tt.node(Oe.v),ie)&&ve!==wt(Tt,Tt.node(Oe.w),ie)});return I.minBy(de,function(Oe){return z(kt,Oe)})}function pt(Tt,kt,_t,Ot){var Gt=_t.v,ae=_t.w;Tt.removeEdge(Gt,ae),Tt.setEdge(Ot.v,Ot.w,{}),$(Tt),H(Tt,kt),ut(Tt,kt)}function ut(Tt,kt){var _t=I.find(Tt.nodes(),function(Gt){return!kt.node(Gt).parent}),Ot=N(Tt,_t);Ot=Ot.slice(1),I.forEach(Ot,function(Gt){var ae=Tt.node(Gt).parent,Wt=kt.edge(Gt,ae),ie=!1;Wt||(Wt=kt.edge(ae,Gt),ie=!0),kt.node(Gt).rank=kt.node(ae).rank+(ie?Wt.minlen:-Wt.minlen)})}function Bt(Tt,kt,_t){return Tt.hasEdge(kt,_t)}function wt(Tt,kt,_t){return _t.low<=kt.lim&&kt.lim<=_t.lim}},2416:function(X,st,T){"use strict";var I=T(72361);X.exports={longestPath:W,slack:z};function W(P){var N={};function G(K){var _=P.node(K);if(I.has(N,K))return _.rank;N[K]=!0;var H=I.min(I.map(P.outEdges(K),function(J){return G(J.w)-P.edge(J).minlen}));return(H===Number.POSITIVE_INFINITY||H===void 0||H===null)&&(H=0),_.rank=H}I.forEach(P.sources(),G)}function z(P,N){return P.node(N.w).rank-P.node(N.v).rank-P.edge(N).minlen}},53063:function(X,st,T){"use strict";var I=T(72361),W=T(76626).Graph;X.exports={addDummyNode:z,simplify:P,asNonCompoundGraph:N,successorWeights:G,predecessorWeights:K,intersectRect:_,buildLayerMatrix:H,normalizeRanks:J,removeEmptyRanks:Z,addBorderNode:$,maxRank:ct,partition:ht,time:Ct,notime:pt};function z(ut,Bt,wt,Tt){var kt;do kt=I.uniqueId(Tt);while(ut.hasNode(kt));return wt.dummy=Bt,ut.setNode(kt,wt),kt}function P(ut){var Bt=new W().setGraph(ut.graph());return I.forEach(ut.nodes(),function(wt){Bt.setNode(wt,ut.node(wt))}),I.forEach(ut.edges(),function(wt){var Tt=Bt.edge(wt.v,wt.w)||{weight:0,minlen:1},kt=ut.edge(wt);Bt.setEdge(wt.v,wt.w,{weight:Tt.weight+kt.weight,minlen:Math.max(Tt.minlen,kt.minlen)})}),Bt}function N(ut){var Bt=new W({multigraph:ut.isMultigraph()}).setGraph(ut.graph());return I.forEach(ut.nodes(),function(wt){ut.children(wt).length||Bt.setNode(wt,ut.node(wt))}),I.forEach(ut.edges(),function(wt){Bt.setEdge(wt,ut.edge(wt))}),Bt}function G(ut){var Bt=I.map(ut.nodes(),function(wt){var Tt={};return I.forEach(ut.outEdges(wt),function(kt){Tt[kt.w]=(Tt[kt.w]||0)+ut.edge(kt).weight}),Tt});return I.zipObject(ut.nodes(),Bt)}function K(ut){var Bt=I.map(ut.nodes(),function(wt){var Tt={};return I.forEach(ut.inEdges(wt),function(kt){Tt[kt.v]=(Tt[kt.v]||0)+ut.edge(kt).weight}),Tt});return I.zipObject(ut.nodes(),Bt)}function _(ut,Bt){var wt=ut.x,Tt=ut.y,kt=Bt.x-wt,_t=Bt.y-Tt,Ot=ut.width/2,Gt=ut.height/2;if(!kt&&!_t)throw new Error("Not possible to find intersection inside of the rectangle");var ae,Wt;return Math.abs(_t)*Ot>Math.abs(kt)*Gt?(_t<0&&(Gt=-Gt),ae=Gt*kt/_t,Wt=Gt):(kt<0&&(Ot=-Ot),ae=Ot,Wt=Ot*_t/kt),{x:wt+ae,y:Tt+Wt}}function H(ut){var Bt=I.map(I.range(ct(ut)+1),function(){return[]});return I.forEach(ut.nodes(),function(wt){var Tt=ut.node(wt),kt=Tt.rank;I.isUndefined(kt)||(Bt[kt][Tt.order]=wt)}),Bt}function J(ut){var Bt=I.min(I.map(ut.nodes(),function(wt){return ut.node(wt).rank}));I.forEach(ut.nodes(),function(wt){var Tt=ut.node(wt);I.has(Tt,"rank")&&(Tt.rank-=Bt)})}function Z(ut){var Bt=I.min(I.map(ut.nodes(),function(_t){return ut.node(_t).rank})),wt=[];I.forEach(ut.nodes(),function(_t){var Ot=ut.node(_t).rank-Bt;wt[Ot]||(wt[Ot]=[]),wt[Ot].push(_t)});var Tt=0,kt=ut.graph().nodeRankFactor;I.forEach(wt,function(_t,Ot){I.isUndefined(_t)&&Ot%kt!==0?--Tt:Tt&&I.forEach(_t,function(Gt){ut.node(Gt).rank+=Tt})})}function $(ut,Bt,wt,Tt){var kt={width:0,height:0};return arguments.length>=4&&(kt.rank=wt,kt.order=Tt),z(ut,"border",kt,Bt)}function ct(ut){return I.max(I.map(ut.nodes(),function(Bt){var wt=ut.node(Bt).rank;if(!I.isUndefined(wt))return wt}))}function ht(ut,Bt){var wt={lhs:[],rhs:[]};return I.forEach(ut,function(Tt){Bt(Tt)?wt.lhs.push(Tt):wt.rhs.push(Tt)}),wt}function Ct(ut,Bt){var wt=I.now();try{return Bt()}finally{console.log(ut+" time: "+(I.now()-wt)+"ms")}}function pt(ut,Bt){return Bt()}},11897:function(X){X.exports="0.8.5"},94856:function(X){"use strict";var st=Object.prototype.hasOwnProperty,T="~";function I(){}Object.create&&(I.prototype=Object.create(null),new I().__proto__||(T=!1));function W(G,K,_){this.fn=G,this.context=K,this.once=_||!1}function z(G,K,_,H,J){if(typeof _!="function")throw new TypeError("The listener must be a function");var Z=new W(_,H||G,J),$=T?T+K:K;return G._events[$]?G._events[$].fn?G._events[$]=[G._events[$],Z]:G._events[$].push(Z):(G._events[$]=Z,G._eventsCount++),G}function P(G,K){--G._eventsCount===0?G._events=new I:delete G._events[K]}function N(){this._events=new I,this._eventsCount=0}N.prototype.eventNames=function(){var K=[],_,H;if(this._eventsCount===0)return K;for(H in _=this._events)st.call(_,H)&&K.push(T?H.slice(1):H);return Object.getOwnPropertySymbols?K.concat(Object.getOwnPropertySymbols(_)):K},N.prototype.listeners=function(K){var _=T?T+K:K,H=this._events[_];if(!H)return[];if(H.fn)return[H.fn];for(var J=0,Z=H.length,$=new Array(Z);J0&&($=Z.removeMin(),ct=J[$],ct.distance!==Number.POSITIVE_INFINITY);)H($).forEach(ht);return J}},59324:function(X,st,T){var I=T(95329),W=T(94558);X.exports=z;function z(P){return I.filter(W(P),function(N){return N.length>1||N.length===1&&P.hasEdge(N[0],N[0])})}},22893:function(X,st,T){var I=T(95329);X.exports=z;var W=I.constant(1);function z(N,G,K){return P(N,G||W,K||function(_){return N.outEdges(_)})}function P(N,G,K){var _={},H=N.nodes();return H.forEach(function(J){_[J]={},_[J][J]={distance:0},H.forEach(function(Z){J!==Z&&(_[J][Z]={distance:Number.POSITIVE_INFINITY})}),K(J).forEach(function(Z){var $=Z.v===J?Z.w:Z.v,ct=G(Z);_[J][$]={distance:ct,predecessor:J}})}),H.forEach(function(J){var Z=_[J];H.forEach(function($){var ct=_[$];H.forEach(function(ht){var Ct=ct[J],pt=Z[ht],ut=ct[ht],Bt=Ct.distance+pt.distance;Bt0;){if(J=H.removeMin(),I.has(_,J))K.setEdge(J,_[J]);else{if($)throw new Error("Input graph is not connected: "+N);$=!0}N.nodeEdges(J).forEach(Z)}return K}},94558:function(X,st,T){var I=T(95329);X.exports=W;function W(z){var P=0,N=[],G={},K=[];function _(H){var J=G[H]={onStack:!0,lowlink:P,index:P++};if(N.push(H),z.successors(H).forEach(function(ct){I.has(G,ct)?G[ct].onStack&&(J.lowlink=Math.min(J.lowlink,G[ct].index)):(_(ct),J.lowlink=Math.min(J.lowlink,G[ct].lowlink))}),J.lowlink===J.index){var Z=[],$;do $=N.pop(),G[$].onStack=!1,Z.push($);while(H!==$);K.push(Z)}}return z.nodes().forEach(function(H){I.has(G,H)||_(H)}),K}},7793:function(X,st,T){var I=T(95329);X.exports=W,W.CycleException=z;function W(P){var N={},G={},K=[];function _(H){if(I.has(G,H))throw new z;I.has(N,H)||(G[H]=!0,N[H]=!0,I.each(P.predecessors(H),_),delete G[H],K.push(H))}if(I.each(P.sinks(),_),I.size(N)!==P.nodeCount())throw new z;return K}function z(){}z.prototype=new Error},36614:function(X,st,T){var I=T(95329);X.exports=W;function W(){this._arr=[],this._keyIndices={}}W.prototype.size=function(){return this._arr.length},W.prototype.keys=function(){return this._arr.map(function(z){return z.key})},W.prototype.has=function(z){return I.has(this._keyIndices,z)},W.prototype.priority=function(z){var P=this._keyIndices[z];if(P!==void 0)return this._arr[P].priority},W.prototype.min=function(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key},W.prototype.add=function(z,P){var N=this._keyIndices;if(z=String(z),!I.has(N,z)){var G=this._arr,K=G.length;return N[z]=K,G.push({key:z,priority:P}),this._decrease(K),!0}return!1},W.prototype.removeMin=function(){this._swap(0,this._arr.length-1);var z=this._arr.pop();return delete this._keyIndices[z.key],this._heapify(0),z.key},W.prototype.decrease=function(z,P){var N=this._keyIndices[z];if(P>this._arr[N].priority)throw new Error("New priority is greater than current priority. Key: "+z+" Old: "+this._arr[N].priority+" New: "+P);this._arr[N].priority=P,this._decrease(N)},W.prototype._heapify=function(z){var P=this._arr,N=2*z,G=N+1,K=z;N>1,!(P[G].priority1?ht.setNode(Ct,$):ht.setNode(Ct)}),this},N.prototype.setNode=function(Z,$){return I.has(this._nodes,Z)?(arguments.length>1&&(this._nodes[Z]=$),this):(this._nodes[Z]=arguments.length>1?$:this._defaultNodeLabelFn(Z),this._isCompound&&(this._parent[Z]=z,this._children[Z]={},this._children[z][Z]=!0),this._in[Z]={},this._preds[Z]={},this._out[Z]={},this._sucs[Z]={},++this._nodeCount,this)},N.prototype.node=function(Z){return this._nodes[Z]},N.prototype.hasNode=function(Z){return I.has(this._nodes,Z)},N.prototype.removeNode=function(Z){var $=this;if(I.has(this._nodes,Z)){var ct=function(ht){$.removeEdge($._edgeObjs[ht])};delete this._nodes[Z],this._isCompound&&(this._removeFromParentsChildList(Z),delete this._parent[Z],I.each(this.children(Z),function(ht){$.setParent(ht)}),delete this._children[Z]),I.each(I.keys(this._in[Z]),ct),delete this._in[Z],delete this._preds[Z],I.each(I.keys(this._out[Z]),ct),delete this._out[Z],delete this._sucs[Z],--this._nodeCount}return this},N.prototype.setParent=function(Z,$){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(I.isUndefined($))$=z;else{$+="";for(var ct=$;!I.isUndefined(ct);ct=this.parent(ct))if(ct===Z)throw new Error("Setting "+$+" as parent of "+Z+" would create a cycle");this.setNode($)}return this.setNode(Z),this._removeFromParentsChildList(Z),this._parent[Z]=$,this._children[$][Z]=!0,this},N.prototype._removeFromParentsChildList=function(Z){delete this._children[this._parent[Z]][Z]},N.prototype.parent=function(Z){if(this._isCompound){var $=this._parent[Z];if($!==z)return $}},N.prototype.children=function(Z){if(I.isUndefined(Z)&&(Z=z),this._isCompound){var $=this._children[Z];if($)return I.keys($)}else{if(Z===z)return this.nodes();if(this.hasNode(Z))return[]}},N.prototype.predecessors=function(Z){var $=this._preds[Z];if($)return I.keys($)},N.prototype.successors=function(Z){var $=this._sucs[Z];if($)return I.keys($)},N.prototype.neighbors=function(Z){var $=this.predecessors(Z);if($)return I.union($,this.successors(Z))},N.prototype.isLeaf=function(Z){var $;return this.isDirected()?$=this.successors(Z):$=this.neighbors(Z),$.length===0},N.prototype.filterNodes=function(Z){var $=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});$.setGraph(this.graph());var ct=this;I.each(this._nodes,function(pt,ut){Z(ut)&&$.setNode(ut,pt)}),I.each(this._edgeObjs,function(pt){$.hasNode(pt.v)&&$.hasNode(pt.w)&&$.setEdge(pt,ct.edge(pt))});var ht={};function Ct(pt){var ut=ct.parent(pt);return ut===void 0||$.hasNode(ut)?(ht[pt]=ut,ut):ut in ht?ht[ut]:Ct(ut)}return this._isCompound&&I.each($.nodes(),function(pt){$.setParent(pt,Ct(pt))}),$},N.prototype.setDefaultEdgeLabel=function(Z){return I.isFunction(Z)||(Z=I.constant(Z)),this._defaultEdgeLabelFn=Z,this},N.prototype.edgeCount=function(){return this._edgeCount},N.prototype.edges=function(){return I.values(this._edgeObjs)},N.prototype.setPath=function(Z,$){var ct=this,ht=arguments;return I.reduce(Z,function(Ct,pt){return ht.length>1?ct.setEdge(Ct,pt,$):ct.setEdge(Ct,pt),pt}),this},N.prototype.setEdge=function(){var Z,$,ct,ht,Ct=!1,pt=arguments[0];typeof pt=="object"&&pt!==null&&"v"in pt?(Z=pt.v,$=pt.w,ct=pt.name,arguments.length===2&&(ht=arguments[1],Ct=!0)):(Z=pt,$=arguments[1],ct=arguments[3],arguments.length>2&&(ht=arguments[2],Ct=!0)),Z=""+Z,$=""+$,I.isUndefined(ct)||(ct=""+ct);var ut=_(this._isDirected,Z,$,ct);if(I.has(this._edgeLabels,ut))return Ct&&(this._edgeLabels[ut]=ht),this;if(!I.isUndefined(ct)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(Z),this.setNode($),this._edgeLabels[ut]=Ct?ht:this._defaultEdgeLabelFn(Z,$,ct);var Bt=H(this._isDirected,Z,$,ct);return Z=Bt.v,$=Bt.w,Object.freeze(Bt),this._edgeObjs[ut]=Bt,G(this._preds[$],Z),G(this._sucs[Z],$),this._in[$][ut]=Bt,this._out[Z][ut]=Bt,this._edgeCount++,this},N.prototype.edge=function(Z,$,ct){var ht=arguments.length===1?J(this._isDirected,arguments[0]):_(this._isDirected,Z,$,ct);return this._edgeLabels[ht]},N.prototype.hasEdge=function(Z,$,ct){var ht=arguments.length===1?J(this._isDirected,arguments[0]):_(this._isDirected,Z,$,ct);return I.has(this._edgeLabels,ht)},N.prototype.removeEdge=function(Z,$,ct){var ht=arguments.length===1?J(this._isDirected,arguments[0]):_(this._isDirected,Z,$,ct),Ct=this._edgeObjs[ht];return Ct&&(Z=Ct.v,$=Ct.w,delete this._edgeLabels[ht],delete this._edgeObjs[ht],K(this._preds[$],Z),K(this._sucs[Z],$),delete this._in[$][ht],delete this._out[Z][ht],this._edgeCount--),this},N.prototype.inEdges=function(Z,$){var ct=this._in[Z];if(ct){var ht=I.values(ct);return $?I.filter(ht,function(Ct){return Ct.v===$}):ht}},N.prototype.outEdges=function(Z,$){var ct=this._out[Z];if(ct){var ht=I.values(ct);return $?I.filter(ht,function(Ct){return Ct.w===$}):ht}},N.prototype.nodeEdges=function(Z,$){var ct=this.inEdges(Z,$);if(ct)return ct.concat(this.outEdges(Z,$))};function G(Z,$){Z[$]?Z[$]++:Z[$]=1}function K(Z,$){--Z[$]||delete Z[$]}function _(Z,$,ct,ht){var Ct=""+$,pt=""+ct;if(!Z&&Ct>pt){var ut=Ct;Ct=pt,pt=ut}return Ct+P+pt+P+(I.isUndefined(ht)?W:ht)}function H(Z,$,ct,ht){var Ct=""+$,pt=""+ct;if(!Z&&Ct>pt){var ut=Ct;Ct=pt,pt=ut}var Bt={v:Ct,w:pt};return ht&&(Bt.name=ht),Bt}function J(Z,$){return _(Z,$.v,$.w,$.name)}},89224:function(X,st,T){X.exports={Graph:T(6349),version:T(16544)}},17401:function(X,st,T){var I=T(95329),W=T(6349);X.exports={write:z,read:G};function z(K){var _={options:{directed:K.isDirected(),multigraph:K.isMultigraph(),compound:K.isCompound()},nodes:P(K),edges:N(K)};return I.isUndefined(K.graph())||(_.value=I.clone(K.graph())),_}function P(K){return I.map(K.nodes(),function(_){var H=K.node(_),J=K.parent(_),Z={v:_};return I.isUndefined(H)||(Z.value=H),I.isUndefined(J)||(Z.parent=J),Z})}function N(K){return I.map(K.edges(),function(_){var H=K.edge(_),J={v:_.v,w:_.w};return I.isUndefined(_.name)||(J.name=_.name),I.isUndefined(H)||(J.value=H),J})}function G(K){var _=new W(K.options).setGraph(K.value);return I.each(K.nodes,function(H){_.setNode(H.v,H.value),H.parent&&_.setParent(H.v,H.parent)}),I.each(K.edges,function(H){_.setEdge({v:H.v,w:H.w,name:H.name},H.value)}),_}},95329:function(X,st,T){var I;try{I={clone:T(40633),constant:T(46221),each:T(61475),filter:T(3130),has:T(64760),isArray:T(41594),isEmpty:T(74336),isFunction:T(92581),isUndefined:T(68408),keys:T(66357),map:T(81426),reduce:T(9695),size:T(24727),transform:T(61477),union:T(99477),values:T(72834)}}catch(W){}I||(I=window._),X.exports=I},16544:function(X){X.exports="2.1.8"},64270:function(X){(function(st,T){X.exports=T()})(this,function(){"use strict";var st=function(E,m){return st=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,B){b.__proto__=B}||function(b,B){for(var Q in B)Object.prototype.hasOwnProperty.call(B,Q)&&(b[Q]=B[Q])},st(E,m)};function T(E,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");st(E,m);function b(){this.constructor=E}E.prototype=m===null?Object.create(m):(b.prototype=m.prototype,new b)}var I=function(){return I=Object.assign||function(m){for(var b,B=1,Q=arguments.length;B0&&V[V.length-1])&&(bt[0]===6||bt[0]===2)){b=0;continue}if(bt[0]===3&&(!V||bt[1]>V[0]&&bt[1]=55296&&Q<=56319&&b>10)+55296,tt%1024+56320)),(Q+1===b||B.length>16384)&&(V+=String.fromCharCode.apply(String,B),B.length=0)}return V},J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Z=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),$=0;$>4,St[Q++]=(tt&15)<<4|lt>>2,St[Q++]=(lt&3)<<6|at&63;return bt},ut=function(E){for(var m=E.length,b=[],B=0;B>wt,Gt=1<>wt,ie=Ot+Wt,ve=ie,de=32,Oe=ve+de,sn=65536>>Tt,dn=1<<_t,Xn=dn-1,Jr=function(E,m,b){return E.slice?E.slice(m,b):new Uint16Array(Array.prototype.slice.call(E,m,b))},ji=function(E,m,b){return E.slice?E.slice(m,b):new Uint32Array(Array.prototype.slice.call(E,m,b))},As=function(E,m){var b=pt(E),B=Array.isArray(b)?Bt(b):new Uint32Array(b),Q=Array.isArray(b)?ut(b):new Uint16Array(b),V=24,tt=Jr(Q,V/2,B[4]/2),lt=B[5]===2?Jr(Q,(V+B[4])/2):ji(B,Math.ceil((V+B[4])/4));return new ho(B[0],B[1],B[2],B[3],tt,lt)},ho=function(){function E(m,b,B,Q,V,tt){this.initialValue=m,this.errorValue=b,this.highStart=B,this.highValueIndex=Q,this.index=V,this.data=tt}return E.prototype.get=function(m){var b;if(m>=0){if(m<55296||m>56319&&m<=65535)return b=this.index[m>>wt],b=(b<>wt)],b=(b<>Tt),b=this.index[b],b+=m>>wt&Xn,b=this.index[b],b=(b<Mt?(Q.push(!0),lt-=Mt):Q.push(!1),["normal","auto","loose"].indexOf(m)!==-1&&[8208,8211,12316,12448].indexOf(V)!==-1)return B.push(tt),b.push(pe);if(lt===_e||lt===ze){if(tt===0)return B.push(tt),b.push($r);var at=b[tt-1];return Yl.indexOf(at)===-1?(B.push(B[tt-1]),b.push(at)):(B.push(tt),b.push($r))}if(B.push(tt),lt===Ar)return b.push(m==="strict"?ls:Zo);if(lt===cu||lt===xa)return b.push($r);if(lt===ed)return V>=131072&&V<=196605||V>=196608&&V<=262141?b.push(Zo):b.push($r);b.push(lt)}),[B,b,Q]},w=function(E,m,b,B){var Q=B[b];if(Array.isArray(E)?E.indexOf(Q)!==-1:E===Q)for(var V=b;V<=B.length;){V++;var tt=B[V];if(tt===m)return!0;if(tt!==Ge)break}if(Q===Ge)for(var V=b;V>0;){V--;var lt=B[V];if(Array.isArray(E)?E.indexOf(lt)!==-1:E===lt)for(var at=b;at<=B.length;){at++;var tt=B[at];if(tt===m)return!0;if(tt!==Ge)break}if(lt!==Ge)break}return!1},M=function(E,m){for(var b=E;b>=0;){var B=m[b];if(B===Ge)b--;else return B}return 0},k=function(E,m,b,B,Q){if(b[B]===0)return pn;var V=B-1;if(Array.isArray(Q)&&Q[V]===!0)return pn;var tt=V-1,lt=V+1,at=m[V],bt=tt>=0?m[tt]:0,St=m[lt];if(at===ee&&St===be)return pn;if(zA.indexOf(at)!==-1)return Wl;if(zA.indexOf(St)!==-1||Yo.indexOf(St)!==-1)return pn;if(M(V,m)===rr)return GA;if(jl.get(E[V])===ze||(at===jo||at===Xi)&&jl.get(E[lt])===ze||at===nn||St===nn||at===or||[Ge,Ve,Zi].indexOf(at)===-1&&St===or||[Wa,kr,Fr,Li,la].indexOf(St)!==-1||M(V,m)===Yi||w(cs,Yi,V,m)||w([Wa,kr],ls,V,m)||w(me,me,V,m))return pn;if(at===Ge)return GA;if(at===cs||St===cs)return pn;if(St===pe||at===pe)return GA;if([Ve,Zi,ls].indexOf(St)!==-1||at===zr||bt===ja&&C.indexOf(at)!==-1||at===la&&St===ja||St===fi||Ca.indexOf(St)!==-1&&at===qr||Ca.indexOf(at)!==-1&&St===qr||at===ba&&[Zo,jo,Xi].indexOf(St)!==-1||[Zo,jo,Xi].indexOf(at)!==-1&&St===Ba||Ca.indexOf(at)!==-1&&Zl.indexOf(St)!==-1||Zl.indexOf(at)!==-1&&Ca.indexOf(St)!==-1||[ba,Ba].indexOf(at)!==-1&&(St===qr||[Yi,Zi].indexOf(St)!==-1&&m[lt+1]===qr)||[Yi,Zi].indexOf(at)!==-1&&St===qr||at===qr&&[qr,la,Li].indexOf(St)!==-1)return pn;if([qr,la,Li,Wa,kr].indexOf(St)!==-1)for(var Ut=V;Ut>=0;){var Jt=m[Ut];if(Jt===qr)return pn;if([la,Li].indexOf(Jt)!==-1)Ut--;else break}if([ba,Ba].indexOf(St)!==-1)for(var Ut=[Wa,kr].indexOf(at)!==-1?tt:V;Ut>=0;){var Jt=m[Ut];if(Jt===qr)return pn;if([la,Li].indexOf(Jt)!==-1)Ut--;else break}if(_A===at&&[_A,Rs,Ji,fo].indexOf(St)!==-1||[Rs,Ji].indexOf(at)!==-1&&[Rs,HA].indexOf(St)!==-1||[HA,fo].indexOf(at)!==-1&&St===HA||Y.indexOf(at)!==-1&&[fi,Ba].indexOf(St)!==-1||Y.indexOf(St)!==-1&&at===ba||Ca.indexOf(at)!==-1&&Ca.indexOf(St)!==-1||at===Li&&Ca.indexOf(St)!==-1||Ca.concat(qr).indexOf(at)!==-1&&St===Yi&&nd.indexOf(E[lt])===-1||Ca.concat(qr).indexOf(St)!==-1&&at===kr)return pn;if(at===Vl&&St===Vl){for(var Te=b[V],he=1;Te>0&&(Te--,m[Te]===Vl);)he++;if(he%2!==0)return pn}return at===jo&&St===Xi?pn:GA},nt=function(E,m){m||(m={lineBreak:"normal",wordBreak:"normal"});var b=S(E,m.lineBreak),B=b[0],Q=b[1],V=b[2];(m.wordBreak==="break-all"||m.wordBreak==="break-word")&&(Q=Q.map(function(lt){return[qr,$r,cu].indexOf(lt)!==-1?Zo:lt}));var tt=m.wordBreak==="keep-all"?V.map(function(lt,at){return lt&&E[at]>=19968&&E[at]<=40959}):void 0;return[B,Q,tt]},rt=function(){function E(m,b,B,Q){this.codePoints=m,this.required=b===Wl,this.start=B,this.end=Q}return E.prototype.slice=function(){return H.apply(void 0,this.codePoints.slice(this.start,this.end))},E}(),ot=function(E,m){var b=_(E),B=nt(b,m),Q=B[0],V=B[1],tt=B[2],lt=b.length,at=0,bt=0;return{next:function(){if(bt>=lt)return{done:!0,value:null};for(var St=pn;bt=fu&&E<=57},gv=function(E){return E>=55296&&E<=57343},po=function(E){return Kr(E)||E>=id&&E<=pu||E>=gu&&E<=rd},vv=function(E){return E>=gu&&E<=hv},sd=function(E){return E>=id&&E<=fv},pv=function(E){return vv(E)||sd(E)},vw=function(E){return E>=Er},mu=function(E){return E===ce||E===Ce||E===Et},Jl=function(E){return pv(E)||vw(E)||E===Ft},mv=function(E){return Jl(E)||Kr(E)||E===te},pw=function(E){return E>=vo&&E<=KA||E===hu||E>=Xl&&E<=du||E===cv},mo=function(E,m){return E!==qt?!1:m!==ce},yu=function(E,m,b){return E===te?Jl(m)||mo(m,b):Jl(E)?!0:!!(E===qt&&mo(E,m))},od=function(E,m,b){return E===Pn||E===te?Kr(m)?!0:m===go&&Kr(b):Kr(E===go?m:E)},mw=function(E){var m=0,b=1;(E[m]===Pn||E[m]===te)&&(E[m]===te&&(b=-1),m++);for(var B=[];Kr(E[m]);)B.push(E[m++]);var Q=B.length?parseInt(H.apply(void 0,B),10):0;E[m]===go&&m++;for(var V=[];Kr(E[m]);)V.push(E[m++]);var tt=V.length,lt=tt?parseInt(H.apply(void 0,V),10):0;(E[m]===ad||E[m]===vu)&&m++;var at=1;(E[m]===Pn||E[m]===te)&&(E[m]===te&&(at=-1),m++);for(var bt=[];Kr(E[m]);)bt.push(E[m++]);var St=bt.length?parseInt(H.apply(void 0,bt),10):0;return b*(Q+lt*Math.pow(10,-tt))*Math.pow(10,at*St)},yw={type:2},ww={type:3},Ew={type:4},Bw={type:13},bw={type:8},xw={type:21},Cw={type:9},Sw={type:10},Mw={type:11},Fw={type:12},Tw={type:14},wu={type:23},Ow={type:1},Iw={type:25},Nw={type:24},Lw={type:26},kw={type:27},Qw={type:28},Uw={type:29},Rw={type:31},Ad={type:32},Br=function(){function E(){this._value=[]}return E.prototype.write=function(m){this._value=this._value.concat(_(m))},E.prototype.read=function(){for(var m=[],b=this.consumeToken();b!==Ad;)m.push(b),b=this.consumeToken();return m},E.prototype.consumeToken=function(){var m=this.consumeCodePoint();switch(m){case $t:return this.consumeStringToken($t);case He:var b=this.peekCodePoint(0),B=this.peekCodePoint(1),Q=this.peekCodePoint(2);if(mv(b)||mo(B,Q)){var V=yu(b,B,Q)?It:At,tt=this.consumeName();return{type:5,value:tt,flags:V}}break;case je:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),Bw;break;case Ie:return this.consumeStringToken(Ie);case De:return yw;case on:return ww;case ei:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),Tw;break;case Pn:if(od(m,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(m),this.consumeNumericToken();break;case Ds:return Ew;case te:var lt=m,at=this.peekCodePoint(0),bt=this.peekCodePoint(1);if(od(lt,at,bt))return this.reconsumeCodePoint(m),this.consumeNumericToken();if(yu(lt,at,bt))return this.reconsumeCodePoint(m),this.consumeIdentLikeToken();if(at===te&&bt===Jn)return this.consumeCodePoint(),this.consumeCodePoint(),Nw;break;case go:if(od(m,this.peekCodePoint(0),this.peekCodePoint(1)))return this.reconsumeCodePoint(m),this.consumeNumericToken();break;case Ht:if(this.peekCodePoint(0)===ei)for(this.consumeCodePoint();;){var St=this.consumeCodePoint();if(St===ei&&(St=this.consumeCodePoint(),St===Ht))return this.consumeToken();if(St===Za)return this.consumeToken()}break;case Xo:return Lw;case uu:return kw;case se:if(this.peekCodePoint(0)===ue&&this.peekCodePoint(1)===te&&this.peekCodePoint(2)===te)return this.consumeCodePoint(),this.consumeCodePoint(),Iw;break;case Qn:var Ut=this.peekCodePoint(0),Jt=this.peekCodePoint(1),Te=this.peekCodePoint(2);if(yu(Ut,Jt,Te)){var tt=this.consumeName();return{type:7,value:tt}}break;case jn:return Qw;case qt:if(mo(m,this.peekCodePoint(0)))return this.reconsumeCodePoint(m),this.consumeIdentLikeToken();break;case qn:return Uw;case Qr:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),bw;break;case Tr:return Mw;case qi:return Fw;case uv:case dv:var he=this.peekCodePoint(0),Be=this.peekCodePoint(1);return he===Pn&&(po(Be)||Be===Dn)&&(this.consumeCodePoint(),this.consumeUnicodeRangeToken()),this.reconsumeCodePoint(m),this.consumeIdentLikeToken();case $i:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),Cw;if(this.peekCodePoint(0)===$i)return this.consumeCodePoint(),xw;break;case fn:if(this.peekCodePoint(0)===Ee)return this.consumeCodePoint(),Sw;break;case Za:return Ad}return mu(m)?(this.consumeWhiteSpace(),Rw):Kr(m)?(this.reconsumeCodePoint(m),this.consumeNumericToken()):Jl(m)?(this.reconsumeCodePoint(m),this.consumeIdentLikeToken()):{type:6,value:H(m)}},E.prototype.consumeCodePoint=function(){var m=this._value.shift();return typeof m=="undefined"?-1:m},E.prototype.reconsumeCodePoint=function(m){this._value.unshift(m)},E.prototype.peekCodePoint=function(m){return m>=this._value.length?-1:this._value[m]},E.prototype.consumeUnicodeRangeToken=function(){for(var m=[],b=this.consumeCodePoint();po(b)&&m.length<6;)m.push(b),b=this.consumeCodePoint();for(var B=!1;b===Dn&&m.length<6;)m.push(b),b=this.consumeCodePoint(),B=!0;if(B){var Q=parseInt(H.apply(void 0,m.map(function(at){return at===Dn?fu:at})),16),V=parseInt(H.apply(void 0,m.map(function(at){return at===Dn?pu:at})),16);return{type:30,start:Q,end:V}}var tt=parseInt(H.apply(void 0,m),16);if(this.peekCodePoint(0)===te&&po(this.peekCodePoint(1))){this.consumeCodePoint(),b=this.consumeCodePoint();for(var lt=[];po(b)&<.length<6;)lt.push(b),b=this.consumeCodePoint();var V=parseInt(H.apply(void 0,lt),16);return{type:30,start:tt,end:V}}else return{type:30,start:tt,end:tt}},E.prototype.consumeIdentLikeToken=function(){var m=this.consumeName();return m.toLowerCase()==="url"&&this.peekCodePoint(0)===De?(this.consumeCodePoint(),this.consumeUrlToken()):this.peekCodePoint(0)===De?(this.consumeCodePoint(),{type:19,value:m}):{type:20,value:m}},E.prototype.consumeUrlToken=function(){var m=[];if(this.consumeWhiteSpace(),this.peekCodePoint(0)===Za)return{type:22,value:""};var b=this.peekCodePoint(0);if(b===Ie||b===$t){var B=this.consumeStringToken(this.consumeCodePoint());return B.type===0&&(this.consumeWhiteSpace(),this.peekCodePoint(0)===Za||this.peekCodePoint(0)===on)?(this.consumeCodePoint(),{type:22,value:B.value}):(this.consumeBadUrlRemnants(),wu)}for(;;){var Q=this.consumeCodePoint();if(Q===Za||Q===on)return{type:22,value:H.apply(void 0,m)};if(mu(Q))return this.consumeWhiteSpace(),this.peekCodePoint(0)===Za||this.peekCodePoint(0)===on?(this.consumeCodePoint(),{type:22,value:H.apply(void 0,m)}):(this.consumeBadUrlRemnants(),wu);if(Q===$t||Q===Ie||Q===De||pw(Q))return this.consumeBadUrlRemnants(),wu;if(Q===qt)if(mo(Q,this.peekCodePoint(0)))m.push(this.consumeEscapedCodePoint());else return this.consumeBadUrlRemnants(),wu;else m.push(Q)}},E.prototype.consumeWhiteSpace=function(){for(;mu(this.peekCodePoint(0));)this.consumeCodePoint()},E.prototype.consumeBadUrlRemnants=function(){for(;;){var m=this.consumeCodePoint();if(m===on||m===Za)return;mo(m,this.peekCodePoint(0))&&this.consumeEscapedCodePoint()}},E.prototype.consumeStringSlice=function(m){for(var b=5e4,B="";m>0;){var Q=Math.min(b,m);B+=H.apply(void 0,this._value.splice(0,Q)),m-=Q}return this._value.shift(),B},E.prototype.consumeStringToken=function(m){var b="",B=0;do{var Q=this._value[B];if(Q===Za||Q===void 0||Q===m)return b+=this.consumeStringSlice(B),{type:0,value:b};if(Q===ce)return this._value.splice(0,B),Ow;if(Q===qt){var V=this._value[B+1];V!==Za&&V!==void 0&&(V===ce?(b+=this.consumeStringSlice(B),B=-1,this._value.shift()):mo(Q,V)&&(b+=this.consumeStringSlice(B),b+=H(this.consumeEscapedCodePoint()),B=-1))}B++}while(!0)},E.prototype.consumeNumber=function(){var m=[],b=vt,B=this.peekCodePoint(0);for((B===Pn||B===te)&&m.push(this.consumeCodePoint());Kr(this.peekCodePoint(0));)m.push(this.consumeCodePoint());B=this.peekCodePoint(0);var Q=this.peekCodePoint(1);if(B===go&&Kr(Q))for(m.push(this.consumeCodePoint(),this.consumeCodePoint()),b=Zt;Kr(this.peekCodePoint(0));)m.push(this.consumeCodePoint());B=this.peekCodePoint(0),Q=this.peekCodePoint(1);var V=this.peekCodePoint(2);if((B===ad||B===vu)&&((Q===Pn||Q===te)&&Kr(V)||Kr(Q)))for(m.push(this.consumeCodePoint(),this.consumeCodePoint()),b=Zt;Kr(this.peekCodePoint(0));)m.push(this.consumeCodePoint());return[mw(m),b]},E.prototype.consumeNumericToken=function(){var m=this.consumeNumber(),b=m[0],B=m[1],Q=this.peekCodePoint(0),V=this.peekCodePoint(1),tt=this.peekCodePoint(2);if(yu(Q,V,tt)){var lt=this.consumeName();return{type:15,number:b,flags:B,unit:lt}}return Q===Wn?(this.consumeCodePoint(),{type:16,number:b,flags:B}):{type:17,number:b,flags:B}},E.prototype.consumeEscapedCodePoint=function(){var m=this.consumeCodePoint();if(po(m)){for(var b=H(m);po(this.peekCodePoint(0))&&b.length<6;)b+=H(this.consumeCodePoint());mu(this.peekCodePoint(0))&&this.consumeCodePoint();var B=parseInt(b,16);return B===0||gv(B)||B>1114111?ti:B}return m===Za?ti:m},E.prototype.consumeName=function(){for(var m="";;){var b=this.consumeCodePoint();if(mv(b))m+=H(b);else if(mo(b,this.peekCodePoint(0)))m+=H(this.consumeEscapedCodePoint());else return this.reconsumeCodePoint(b),m}},E}(),yv=function(){function E(m){this._tokens=m}return E.create=function(m){var b=new Br;return b.write(m),new E(b.read())},E.parseValue=function(m){return E.create(m).parseComponentValue()},E.parseValues=function(m){return E.create(m).parseComponentValues()},E.prototype.parseComponentValue=function(){for(var m=this.consumeToken();m.type===31;)m=this.consumeToken();if(m.type===32)throw new SyntaxError("Error parsing CSS component value, unexpected EOF");this.reconsumeToken(m);var b=this.consumeComponentValue();do m=this.consumeToken();while(m.type===31);if(m.type===32)return b;throw new SyntaxError("Error parsing CSS component value, multiple values found when expecting only one")},E.prototype.parseComponentValues=function(){for(var m=[];;){var b=this.consumeComponentValue();if(b.type===32)return m;m.push(b),m.push()}},E.prototype.consumeComponentValue=function(){var m=this.consumeToken();switch(m.type){case 11:case 28:case 2:return this.consumeSimpleBlock(m.type);case 19:return this.consumeFunction(m)}return m},E.prototype.consumeSimpleBlock=function(m){for(var b={type:m,values:[]},B=this.consumeToken();;){if(B.type===32||Ev(B,m))return b;this.reconsumeToken(B),b.values.push(this.consumeComponentValue()),B=this.consumeToken()}},E.prototype.consumeFunction=function(m){for(var b={name:m.value,values:[],type:18};;){var B=this.consumeToken();if(B.type===32||B.type===3)return b;this.reconsumeToken(B),b.values.push(this.consumeComponentValue())}},E.prototype.consumeToken=function(){var m=this._tokens.shift();return typeof m=="undefined"?Ad:m},E.prototype.reconsumeToken=function(m){this._tokens.unshift(m)},E}(),ca=function(E){return E.type===15},VA=function(E){return E.type===17},$n=function(E){return E.type===20},Ps=function(E){return E.type===0},ld=function(E,m){return $n(E)&&E.value===m},wv=function(E){return E.type!==31},WA=function(E){return E.type!==31&&E.type!==4},us=function(E){var m=[],b=[];return E.forEach(function(B){if(B.type===4){if(b.length===0)throw new Error("Error parsing function args, zero tokens for arg");m.push(b),b=[];return}B.type!==31&&b.push(B)}),b.length&&m.push(b),m},Ev=function(E,m){return m===11&&E.type===12||m===28&&E.type===29?!0:m===2&&E.type===3},_s=function(E){return E.type===17||E.type===15},Ur=function(E){return E.type===16||_s(E)},ql=function(E){return E.length>1?[E[0],E[1]]:[E[0]]},gi={type:17,number:0,flags:vt},jA={type:16,number:50,flags:vt},yo={type:16,number:100,flags:vt},ZA=function(E,m,b){var B=E[0],Q=E[1];return[Gn(B,m),Gn(typeof Q!="undefined"?Q:B,b)]},Gn=function(E,m){if(E.type===16)return E.number/100*m;if(ca(E))switch(E.unit){case"rem":case"em":return 16*E.number;case"px":default:return E.number}return E.number},Bv="deg",bv="grad",cd="rad",YA="turn",XA={name:"angle",parse:function(E,m){if(m.type===15)switch(m.unit){case Bv:return Math.PI*m.number/180;case bv:return Math.PI/200*m.number;case cd:return m.number;case YA:return Math.PI*2*m.number}throw new Error("Unsupported angle type")}},xv=function(E){return E.type===15&&(E.unit===Bv||E.unit===bv||E.unit===cd||E.unit===YA)},Eu=function(E){var m=E.filter($n).map(function(b){return b.value}).join(" ");switch(m){case"to bottom right":case"to right bottom":case"left top":case"top left":return[gi,gi];case"to top":case"bottom":return ua(0);case"to bottom left":case"to left bottom":case"right top":case"top right":return[gi,yo];case"to right":case"left":return ua(90);case"to top left":case"to left top":case"right bottom":case"bottom right":return[yo,yo];case"to bottom":case"top":return ua(180);case"to top right":case"to right top":case"left bottom":case"bottom left":return[yo,gi];case"to left":case"right":return ua(270)}return 0},ua=function(E){return Math.PI*E/180},Hs={name:"color",parse:function(E,m){if(m.type===18){var b=Dw[m.name];if(typeof b=="undefined")throw new Error('Attempting to parse an unsupported color function "'+m.name+'"');return b(E,m.values)}if(m.type===5){if(m.value.length===3){var B=m.value.substring(0,1),Q=m.value.substring(1,2),V=m.value.substring(2,3);return Eo(parseInt(B+B,16),parseInt(Q+Q,16),parseInt(V+V,16),1)}if(m.value.length===4){var B=m.value.substring(0,1),Q=m.value.substring(1,2),V=m.value.substring(2,3),tt=m.value.substring(3,4);return Eo(parseInt(B+B,16),parseInt(Q+Q,16),parseInt(V+V,16),parseInt(tt+tt,16)/255)}if(m.value.length===6){var B=m.value.substring(0,2),Q=m.value.substring(2,4),V=m.value.substring(4,6);return Eo(parseInt(B,16),parseInt(Q,16),parseInt(V,16),1)}if(m.value.length===8){var B=m.value.substring(0,2),Q=m.value.substring(2,4),V=m.value.substring(4,6),tt=m.value.substring(6,8);return Eo(parseInt(B,16),parseInt(Q,16),parseInt(V,16),parseInt(tt,16)/255)}}if(m.type===20){var lt=Gs[m.value.toUpperCase()];if(typeof lt!="undefined")return lt}return Gs.TRANSPARENT}},wo=function(E){return(255&E)===0},ni=function(E){var m=255&E,b=255&E>>8,B=255&E>>16,Q=255&E>>24;return m<255?"rgba("+Q+","+B+","+b+","+m/255+")":"rgb("+Q+","+B+","+b+")"},Eo=function(E,m,b,B){return(E<<24|m<<16|b<<8|Math.round(B*255)<<0)>>>0},Cv=function(E,m){if(E.type===17)return E.number;if(E.type===16){var b=m===3?1:255;return m===3?E.number/100*b:Math.round(E.number/100*b)}return 0},Sv=function(E,m){var b=m.filter(WA);if(b.length===3){var B=b.map(Cv),Q=B[0],V=B[1],tt=B[2];return Eo(Q,V,tt,1)}if(b.length===4){var lt=b.map(Cv),Q=lt[0],V=lt[1],tt=lt[2],at=lt[3];return Eo(Q,V,tt,at)}return 0};function Jo(E,m,b){return b<0&&(b+=1),b>=1&&(b-=1),b<1/6?(m-E)*b*6+E:b<1/2?m:b<2/3?(m-E)*6*(2/3-b)+E:E}var Mv=function(E,m){var b=m.filter(WA),B=b[0],Q=b[1],V=b[2],tt=b[3],lt=(B.type===17?ua(B.number):XA.parse(E,B))/(Math.PI*2),at=Ur(Q)?Q.number/100:0,bt=Ur(V)?V.number/100:0,St=typeof tt!="undefined"&&Ur(tt)?Gn(tt,1):1;if(at===0)return Eo(bt*255,bt*255,bt*255,1);var Ut=bt<=.5?bt*(at+1):bt+at-bt*at,Jt=bt*2-Ut,Te=Jo(Jt,Ut,lt+1/3),he=Jo(Jt,Ut,lt),Be=Jo(Jt,Ut,lt-1/3);return Eo(Te*255,he*255,Be*255,St)},Dw={hsl:Mv,hsla:Mv,rgb:Sv,rgba:Sv},$l=function(E,m){return Hs.parse(E,yv.create(m).parseComponentValue())},Gs={ALICEBLUE:4042850303,ANTIQUEWHITE:4209760255,AQUA:16777215,AQUAMARINE:2147472639,AZURE:4043309055,BEIGE:4126530815,BISQUE:4293182719,BLACK:255,BLANCHEDALMOND:4293643775,BLUE:65535,BLUEVIOLET:2318131967,BROWN:2771004159,BURLYWOOD:3736635391,CADETBLUE:1604231423,CHARTREUSE:2147418367,CHOCOLATE:3530104575,CORAL:4286533887,CORNFLOWERBLUE:1687547391,CORNSILK:4294499583,CRIMSON:3692313855,CYAN:16777215,DARKBLUE:35839,DARKCYAN:9145343,DARKGOLDENROD:3095837695,DARKGRAY:2846468607,DARKGREEN:6553855,DARKGREY:2846468607,DARKKHAKI:3182914559,DARKMAGENTA:2332068863,DARKOLIVEGREEN:1433087999,DARKORANGE:4287365375,DARKORCHID:2570243327,DARKRED:2332033279,DARKSALMON:3918953215,DARKSEAGREEN:2411499519,DARKSLATEBLUE:1211993087,DARKSLATEGRAY:793726975,DARKSLATEGREY:793726975,DARKTURQUOISE:13554175,DARKVIOLET:2483082239,DEEPPINK:4279538687,DEEPSKYBLUE:12582911,DIMGRAY:1768516095,DIMGREY:1768516095,DODGERBLUE:512819199,FIREBRICK:2988581631,FLORALWHITE:4294635775,FORESTGREEN:579543807,FUCHSIA:4278255615,GAINSBORO:3705462015,GHOSTWHITE:4177068031,GOLD:4292280575,GOLDENROD:3668254975,GRAY:2155905279,GREEN:8388863,GREENYELLOW:2919182335,GREY:2155905279,HONEYDEW:4043305215,HOTPINK:4285117695,INDIANRED:3445382399,INDIGO:1258324735,IVORY:4294963455,KHAKI:4041641215,LAVENDER:3873897215,LAVENDERBLUSH:4293981695,LAWNGREEN:2096890111,LEMONCHIFFON:4294626815,LIGHTBLUE:2916673279,LIGHTCORAL:4034953471,LIGHTCYAN:3774873599,LIGHTGOLDENRODYELLOW:4210742015,LIGHTGRAY:3553874943,LIGHTGREEN:2431553791,LIGHTGREY:3553874943,LIGHTPINK:4290167295,LIGHTSALMON:4288707327,LIGHTSEAGREEN:548580095,LIGHTSKYBLUE:2278488831,LIGHTSLATEGRAY:2005441023,LIGHTSLATEGREY:2005441023,LIGHTSTEELBLUE:2965692159,LIGHTYELLOW:4294959359,LIME:16711935,LIMEGREEN:852308735,LINEN:4210091775,MAGENTA:4278255615,MAROON:2147483903,MEDIUMAQUAMARINE:1724754687,MEDIUMBLUE:52735,MEDIUMORCHID:3126187007,MEDIUMPURPLE:2473647103,MEDIUMSEAGREEN:1018393087,MEDIUMSLATEBLUE:2070474495,MEDIUMSPRINGGREEN:16423679,MEDIUMTURQUOISE:1221709055,MEDIUMVIOLETRED:3340076543,MIDNIGHTBLUE:421097727,MINTCREAM:4127193855,MISTYROSE:4293190143,MOCCASIN:4293178879,NAVAJOWHITE:4292783615,NAVY:33023,OLDLACE:4260751103,OLIVE:2155872511,OLIVEDRAB:1804477439,ORANGE:4289003775,ORANGERED:4282712319,ORCHID:3664828159,PALEGOLDENROD:4008225535,PALEGREEN:2566625535,PALETURQUOISE:2951671551,PALEVIOLETRED:3681588223,PAPAYAWHIP:4293907967,PEACHPUFF:4292524543,PERU:3448061951,PINK:4290825215,PLUM:3718307327,POWDERBLUE:2967529215,PURPLE:2147516671,REBECCAPURPLE:1714657791,RED:4278190335,ROSYBROWN:3163525119,ROYALBLUE:1097458175,SADDLEBROWN:2336560127,SALMON:4202722047,SANDYBROWN:4104413439,SEAGREEN:780883967,SEASHELL:4294307583,SIENNA:2689740287,SILVER:3233857791,SKYBLUE:2278484991,SLATEBLUE:1784335871,SLATEGRAY:1887473919,SLATEGREY:1887473919,SNOW:4294638335,SPRINGGREEN:16744447,STEELBLUE:1182971135,TAN:3535047935,TEAL:8421631,THISTLE:3636451583,TOMATO:4284696575,TRANSPARENT:0,TURQUOISE:1088475391,VIOLET:4001558271,WHEAT:4125012991,WHITE:4294967295,WHITESMOKE:4126537215,YELLOW:4294902015,YELLOWGREEN:2597139199},Pw={name:"background-clip",initialValue:"border-box",prefix:!1,type:1,parse:function(E,m){return m.map(function(b){if($n(b))switch(b.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Bu={name:"background-color",initialValue:"transparent",prefix:!1,type:3,format:"color"},bu=function(E,m){var b=Hs.parse(E,m[0]),B=m[1];return B&&Ur(B)?{color:b,stop:B}:{color:b,stop:null}},Fv=function(E,m){var b=E[0],B=E[E.length-1];b.stop===null&&(b.stop=gi),B.stop===null&&(B.stop=yo);for(var Q=[],V=0,tt=0;ttV?Q.push(at):Q.push(V),V=at}else Q.push(null)}for(var bt=null,tt=0;tttt.optimumDistance)?{optimumCorner:lt,optimumDistance:St}:tt},{optimumDistance:Q?1/0:-1/0,optimumCorner:null}).optimumCorner},_w=function(E,m,b,B,Q){var V=0,tt=0;switch(E.size){case 0:E.shape===0?V=tt=Math.min(Math.abs(m),Math.abs(m-B),Math.abs(b),Math.abs(b-Q)):E.shape===1&&(V=Math.min(Math.abs(m),Math.abs(m-B)),tt=Math.min(Math.abs(b),Math.abs(b-Q)));break;case 2:if(E.shape===0)V=tt=Math.min(Ya(m,b),Ya(m,b-Q),Ya(m-B,b),Ya(m-B,b-Q));else if(E.shape===1){var lt=Math.min(Math.abs(b),Math.abs(b-Q))/Math.min(Math.abs(m),Math.abs(m-B)),at=Iv(B,Q,m,b,!0),bt=at[0],St=at[1];V=Ya(bt-m,(St-b)/lt),tt=lt*V}break;case 1:E.shape===0?V=tt=Math.max(Math.abs(m),Math.abs(m-B),Math.abs(b),Math.abs(b-Q)):E.shape===1&&(V=Math.max(Math.abs(m),Math.abs(m-B)),tt=Math.max(Math.abs(b),Math.abs(b-Q)));break;case 3:if(E.shape===0)V=tt=Math.max(Ya(m,b),Ya(m,b-Q),Ya(m-B,b),Ya(m-B,b-Q));else if(E.shape===1){var lt=Math.max(Math.abs(b),Math.abs(b-Q))/Math.max(Math.abs(m),Math.abs(m-B)),Ut=Iv(B,Q,m,b,!1),bt=Ut[0],St=Ut[1];V=Ya(bt-m,(St-b)/lt),tt=lt*V}break}return Array.isArray(E.size)&&(V=Gn(E.size[0],B),tt=E.size.length===2?Gn(E.size[1],Q):V),[V,tt]},Hw=function(E,m){var b=ua(180),B=[];return us(m).forEach(function(Q,V){if(V===0){var tt=Q[0];if(tt.type===20&&tt.value==="to"){b=Eu(Q);return}else if(xv(tt)){b=XA.parse(E,tt);return}}var lt=bu(E,Q);B.push(lt)}),{angle:b,stops:B,type:1}},xu=function(E,m){var b=ua(180),B=[];return us(m).forEach(function(Q,V){if(V===0){var tt=Q[0];if(tt.type===20&&["top","left","right","bottom"].indexOf(tt.value)!==-1){b=Eu(Q);return}else if(xv(tt)){b=(XA.parse(E,tt)+ua(270))%ua(360);return}}var lt=bu(E,Q);B.push(lt)}),{angle:b,stops:B,type:1}},Gw=function(E,m){var b=ua(180),B=[],Q=1,V=0,tt=3,lt=[];return us(m).forEach(function(at,bt){var St=at[0];if(bt===0){if($n(St)&&St.value==="linear"){Q=1;return}else if($n(St)&&St.value==="radial"){Q=2;return}}if(St.type===18){if(St.name==="from"){var Ut=Hs.parse(E,St.values[0]);B.push({stop:gi,color:Ut})}else if(St.name==="to"){var Ut=Hs.parse(E,St.values[0]);B.push({stop:yo,color:Ut})}else if(St.name==="color-stop"){var Jt=St.values.filter(WA);if(Jt.length===2){var Ut=Hs.parse(E,Jt[1]),Te=Jt[0];VA(Te)&&B.push({stop:{type:16,number:Te.number*100,flags:Te.flags},color:Ut})}}}}),Q===1?{angle:(b+ua(180))%ua(360),stops:B,type:Q}:{size:tt,shape:V,stops:B,position:lt,type:Q}},Nv="closest-side",Lv="farthest-side",kv="closest-corner",Qv="farthest-corner",Uv="circle",Rv="ellipse",Dv="cover",Pv="contain",zw=function(E,m){var b=0,B=3,Q=[],V=[];return us(m).forEach(function(tt,lt){var at=!0;if(lt===0){var bt=!1;at=tt.reduce(function(Ut,Jt){if(bt)if($n(Jt))switch(Jt.value){case"center":return V.push(jA),Ut;case"top":case"left":return V.push(gi),Ut;case"right":case"bottom":return V.push(yo),Ut}else(Ur(Jt)||_s(Jt))&&V.push(Jt);else if($n(Jt))switch(Jt.value){case Uv:return b=0,!1;case Rv:return b=1,!1;case"at":return bt=!0,!1;case Nv:return B=0,!1;case Dv:case Lv:return B=1,!1;case Pv:case kv:return B=2,!1;case Qv:return B=3,!1}else if(_s(Jt)||Ur(Jt))return Array.isArray(B)||(B=[]),B.push(Jt),!1;return Ut},at)}if(at){var St=bu(E,tt);Q.push(St)}}),{size:B,shape:b,stops:Q,position:V,type:2}},Cu=function(E,m){var b=0,B=3,Q=[],V=[];return us(m).forEach(function(tt,lt){var at=!0;if(lt===0?at=tt.reduce(function(St,Ut){if($n(Ut))switch(Ut.value){case"center":return V.push(jA),!1;case"top":case"left":return V.push(gi),!1;case"right":case"bottom":return V.push(yo),!1}else if(Ur(Ut)||_s(Ut))return V.push(Ut),!1;return St},at):lt===1&&(at=tt.reduce(function(St,Ut){if($n(Ut))switch(Ut.value){case Uv:return b=0,!1;case Rv:return b=1,!1;case Pv:case Nv:return B=0,!1;case Lv:return B=1,!1;case kv:return B=2,!1;case Dv:case Qv:return B=3,!1}else if(_s(Ut)||Ur(Ut))return Array.isArray(B)||(B=[]),B.push(Ut),!1;return St},at)),at){var bt=bu(E,tt);Q.push(bt)}}),{size:B,shape:b,stops:Q,position:V,type:2}},Kw=function(E){return E.type===1},_v=function(E){return E.type===2},Su={name:"image",parse:function(E,m){if(m.type===22){var b={url:m.value,type:0};return E.cache.addImage(m.value),b}if(m.type===18){var B=Hv[m.name];if(typeof B=="undefined")throw new Error('Attempting to parse an unsupported image function "'+m.name+'"');return B(E,m.values)}throw new Error("Unsupported image type "+m.type)}};function Vw(E){return!(E.type===20&&E.value==="none")&&(E.type!==18||!!Hv[E.name])}var Hv={"linear-gradient":Hw,"-moz-linear-gradient":xu,"-ms-linear-gradient":xu,"-o-linear-gradient":xu,"-webkit-linear-gradient":xu,"radial-gradient":zw,"-moz-radial-gradient":Cu,"-ms-radial-gradient":Cu,"-o-radial-gradient":Cu,"-webkit-radial-gradient":Cu,"-webkit-gradient":Gw},Ww={name:"background-image",initialValue:"none",type:1,prefix:!1,parse:function(E,m){if(m.length===0)return[];var b=m[0];return b.type===20&&b.value==="none"?[]:m.filter(function(B){return WA(B)&&Vw(B)}).map(function(B){return Su.parse(E,B)})}},jw={name:"background-origin",initialValue:"border-box",prefix:!1,type:1,parse:function(E,m){return m.map(function(b){if($n(b))switch(b.value){case"padding-box":return 1;case"content-box":return 2}return 0})}},Zw={name:"background-position",initialValue:"0% 0%",type:1,prefix:!1,parse:function(E,m){return us(m).map(function(b){return b.filter(Ur)}).map(ql)}},Yw={name:"background-repeat",initialValue:"repeat",prefix:!1,type:1,parse:function(E,m){return us(m).map(function(b){return b.filter($n).map(function(B){return B.value}).join(" ")}).map(Xw)}},Xw=function(E){switch(E){case"no-repeat":return 1;case"repeat-x":case"repeat no-repeat":return 2;case"repeat-y":case"no-repeat repeat":return 3;case"repeat":default:return 0}},JA;(function(E){E.AUTO="auto",E.CONTAIN="contain",E.COVER="cover"})(JA||(JA={}));var Jw={name:"background-size",initialValue:"0",prefix:!1,type:1,parse:function(E,m){return us(m).map(function(b){return b.filter(qw)})}},qw=function(E){return $n(E)||Ur(E)},Mu=function(E){return{name:"border-"+E+"-color",initialValue:"transparent",prefix:!1,type:3,format:"color"}},$w=Mu("top"),Gv=Mu("right"),tE=Mu("bottom"),eE=Mu("left"),Fu=function(E){return{name:"border-radius-"+E,initialValue:"0 0",prefix:!1,type:1,parse:function(m,b){return ql(b.filter(Ur))}}},nE=Fu("top-left"),rE=Fu("top-right"),iE=Fu("bottom-right"),aE=Fu("bottom-left"),Tu=function(E){return{name:"border-"+E+"-style",initialValue:"solid",prefix:!1,type:2,parse:function(m,b){switch(b){case"none":return 0;case"dashed":return 2;case"dotted":return 3;case"double":return 4}return 1}}},sE=Tu("top"),ye=Tu("right"),ki=Tu("bottom"),Re=Tu("left"),gn=function(E){return{name:"border-"+E+"-width",initialValue:"0",type:0,prefix:!1,parse:function(m,b){return ca(b)?b.number:0}}},zv=gn("top"),dr=gn("right"),D=gn("bottom"),qA=gn("left"),ud={name:"color",initialValue:"transparent",prefix:!1,type:3,format:"color"},hd={name:"direction",initialValue:"ltr",prefix:!1,type:2,parse:function(E,m){switch(m){case"rtl":return 1;case"ltr":default:return 0}}},dd={name:"display",initialValue:"inline-block",prefix:!1,type:1,parse:function(E,m){return m.filter($n).reduce(function(b,B){return b|fd(B.value)},0)}},fd=function(E){switch(E){case"block":case"-webkit-box":return 2;case"inline":return 4;case"run-in":return 8;case"flow":return 16;case"flow-root":return 32;case"table":return 64;case"flex":case"-webkit-flex":return 128;case"grid":case"-ms-grid":return 256;case"ruby":return 512;case"subgrid":return 1024;case"list-item":return 2048;case"table-row-group":return 4096;case"table-header-group":return 8192;case"table-footer-group":return 16384;case"table-row":return 32768;case"table-cell":return 65536;case"table-column-group":return 131072;case"table-column":return 262144;case"table-caption":return 524288;case"ruby-base":return 1048576;case"ruby-text":return 2097152;case"ruby-base-container":return 4194304;case"ruby-text-container":return 8388608;case"contents":return 16777216;case"inline-block":return 33554432;case"inline-list-item":return 67108864;case"inline-table":return 134217728;case"inline-flex":return 268435456;case"inline-grid":return 536870912}return 0},gd={name:"float",initialValue:"none",prefix:!1,type:2,parse:function(E,m){switch(m){case"left":return 1;case"right":return 2;case"inline-start":return 3;case"inline-end":return 4}return 0}},Kv={name:"letter-spacing",initialValue:"0",prefix:!1,type:0,parse:function(E,m){return m.type===20&&m.value==="normal"?0:m.type===17||m.type===15?m.number:0}},tc;(function(E){E.NORMAL="normal",E.STRICT="strict"})(tc||(tc={}));var qo={name:"line-break",initialValue:"normal",prefix:!1,type:2,parse:function(E,m){switch(m){case"strict":return tc.STRICT;case"normal":default:return tc.NORMAL}}},Vv={name:"line-height",initialValue:"normal",prefix:!1,type:4},vd=function(E,m){return $n(E)&&E.value==="normal"?1.2*m:E.type===17?m*E.number:Ur(E)?Gn(E,m):m},ec={name:"list-style-image",initialValue:"none",type:0,prefix:!1,parse:function(E,m){return m.type===20&&m.value==="none"?null:Su.parse(E,m)}},Wv={name:"list-style-position",initialValue:"outside",prefix:!1,type:2,parse:function(E,m){switch(m){case"inside":return 0;case"outside":default:return 1}}},Ou={name:"list-style-type",initialValue:"none",prefix:!1,type:2,parse:function(E,m){switch(m){case"disc":return 0;case"circle":return 1;case"square":return 2;case"decimal":return 3;case"cjk-decimal":return 4;case"decimal-leading-zero":return 5;case"lower-roman":return 6;case"upper-roman":return 7;case"lower-greek":return 8;case"lower-alpha":return 9;case"upper-alpha":return 10;case"arabic-indic":return 11;case"armenian":return 12;case"bengali":return 13;case"cambodian":return 14;case"cjk-earthly-branch":return 15;case"cjk-heavenly-stem":return 16;case"cjk-ideographic":return 17;case"devanagari":return 18;case"ethiopic-numeric":return 19;case"georgian":return 20;case"gujarati":return 21;case"gurmukhi":return 22;case"hebrew":return 22;case"hiragana":return 23;case"hiragana-iroha":return 24;case"japanese-formal":return 25;case"japanese-informal":return 26;case"kannada":return 27;case"katakana":return 28;case"katakana-iroha":return 29;case"khmer":return 30;case"korean-hangul-formal":return 31;case"korean-hanja-formal":return 32;case"korean-hanja-informal":return 33;case"lao":return 34;case"lower-armenian":return 35;case"malayalam":return 36;case"mongolian":return 37;case"myanmar":return 38;case"oriya":return 39;case"persian":return 40;case"simp-chinese-formal":return 41;case"simp-chinese-informal":return 42;case"tamil":return 43;case"telugu":return 44;case"thai":return 45;case"tibetan":return 46;case"trad-chinese-formal":return 47;case"trad-chinese-informal":return 48;case"upper-armenian":return 49;case"disclosure-open":return 50;case"disclosure-closed":return 51;case"none":default:return-1}}},nc=function(E){return{name:"margin-"+E,initialValue:"0",prefix:!1,type:4}},jv=nc("top"),Zv=nc("right"),Yv=nc("bottom"),Xv=nc("left"),rc={name:"overflow",initialValue:"visible",prefix:!1,type:1,parse:function(E,m){return m.filter($n).map(function(b){switch(b.value){case"hidden":return 1;case"scroll":return 2;case"clip":return 3;case"auto":return 4;case"visible":default:return 0}})}},zs={name:"overflow-wrap",initialValue:"normal",prefix:!1,type:2,parse:function(E,m){switch(m){case"break-word":return"break-word";case"normal":default:return"normal"}}},$o=function(E){return{name:"padding-"+E,initialValue:"0",prefix:!1,type:3,format:"length-percentage"}},pd=$o("top"),Jv=$o("right"),qv=$o("bottom"),$v=$o("left"),md={name:"text-align",initialValue:"left",prefix:!1,type:2,parse:function(E,m){switch(m){case"right":return 2;case"center":case"justify":return 1;case"left":default:return 0}}},tp={name:"position",initialValue:"static",prefix:!1,type:2,parse:function(E,m){switch(m){case"relative":return 1;case"absolute":return 2;case"fixed":return 3;case"sticky":return 4}return 0}},ep={name:"text-shadow",initialValue:"none",type:1,prefix:!1,parse:function(E,m){return m.length===1&&ld(m[0],"none")?[]:us(m).map(function(b){for(var B={color:Gs.TRANSPARENT,offsetX:gi,offsetY:gi,blur:gi},Q=0,V=0;V1?1:0],this.overflowWrap=Vt(m,zs,b.overflowWrap),this.paddingTop=Vt(m,pd,b.paddingTop),this.paddingRight=Vt(m,Jv,b.paddingRight),this.paddingBottom=Vt(m,qv,b.paddingBottom),this.paddingLeft=Vt(m,$v,b.paddingLeft),this.paintOrder=Vt(m,Ze,b.paintOrder),this.position=Vt(m,tp,b.position),this.textAlign=Vt(m,md,b.textAlign),this.textDecorationColor=Vt(m,Bd,(B=b.textDecorationColor)!==null&&B!==void 0?B:b.color),this.textDecorationLine=Vt(m,sp,(Q=b.textDecorationLine)!==null&&Q!==void 0?Q:b.textDecoration),this.textShadow=Vt(m,ep,b.textShadow),this.textTransform=Vt(m,yd,b.textTransform),this.transform=Vt(m,np,b.transform),this.transformOrigin=Vt(m,rp,b.transformOrigin),this.visibility=Vt(m,Ed,b.visibility),this.webkitTextStrokeColor=Vt(m,fp,b.webkitTextStrokeColor),this.webkitTextStrokeWidth=Vt(m,gp,b.webkitTextStrokeWidth),this.wordBreak=Vt(m,ip,b.wordBreak),this.zIndex=Vt(m,sc,b.zIndex)}return E.prototype.isVisible=function(){return this.display>0&&this.opacity>0&&this.visibility===0},E.prototype.isTransparent=function(){return wo(this.backgroundColor)},E.prototype.isTransformed=function(){return this.transform!==null},E.prototype.isPositioned=function(){return this.position!==0},E.prototype.isPositionedWithZIndex=function(){return this.isPositioned()&&!this.zIndex.auto},E.prototype.isFloating=function(){return this.float!==0},E.prototype.isInlineLevel=function(){return Rr(this.display,4)||Rr(this.display,33554432)||Rr(this.display,268435456)||Rr(this.display,536870912)||Rr(this.display,67108864)||Rr(this.display,134217728)},E}(),vp=function(){function E(m,b){this.content=Vt(m,lp,b.content),this.quotes=Vt(m,hp,b.quotes)}return E}(),eA=function(){function E(m,b){this.counterIncrement=Vt(m,Cd,b.counterIncrement),this.counterReset=Vt(m,cp,b.counterReset)}return E}(),Vt=function(E,m,b){var B=new Br,Q=b!==null&&typeof b!="undefined"?b.toString():m.initialValue;B.write(Q);var V=new yv(B.read());switch(m.type){case 2:var tt=V.parseComponentValue();return m.parse(E,$n(tt)?tt.value:m.initialValue);case 0:return m.parse(E,V.parseComponentValue());case 1:return m.parse(E,V.parseComponentValues());case 4:return V.parseComponentValue();case 3:switch(m.format){case"angle":return XA.parse(E,V.parseComponentValue());case"color":return Hs.parse(E,V.parseComponentValue());case"image":return Su.parse(E,V.parseComponentValue());case"length":var lt=V.parseComponentValue();return _s(lt)?lt:gi;case"length-percentage":var at=V.parseComponentValue();return Ur(at)?at:gi;case"time":return oc.parse(E,V.parseComponentValue())}break}},br="data-html2canvas-debug",pp=function(E){var m=E.getAttribute(br);switch(m){case"all":return 1;case"clone":return 2;case"parse":return 3;case"render":return 4;default:return 0}},we=function(E,m){var b=pp(E);return b===1||m===b},Sa=function(){function E(m,b){if(this.context=m,this.textNodes=[],this.elements=[],this.flags=0,we(b,3))debugger;this.styles=new Md(m,window.getComputedStyle(b,null)),Vu(b)&&(this.styles.animationDuration.some(function(B){return B>0})&&(b.style.animationDuration="0s"),this.styles.transform!==null&&(b.style.transform="none")),this.bounds=G(this.context,b),we(b,4)&&(this.flags|=16)}return E}(),mp="AAAAAAAAAAAAEA4AGBkAAFAaAAACAAAAAAAIABAAGAAwADgACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAQABIAEQATAAIABAACAAQAAgAEAAIABAAVABcAAgAEAAIABAACAAQAGAAaABwAHgAgACIAI4AlgAIABAAmwCjAKgAsAC2AL4AvQDFAMoA0gBPAVYBWgEIAAgACACMANoAYgFkAWwBdAF8AX0BhQGNAZUBlgGeAaMBlQGWAasBswF8AbsBwwF0AcsBYwHTAQgA2wG/AOMBdAF8AekB8QF0AfkB+wHiAHQBfAEIAAMC5gQIAAsCEgIIAAgAFgIeAggAIgIpAggAMQI5AkACygEIAAgASAJQAlgCYAIIAAgACAAKBQoFCgUTBRMFGQUrBSsFCAAIAAgACAAIAAgACAAIAAgACABdAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABoAmgCrwGvAQgAbgJ2AggAHgEIAAgACADnAXsCCAAIAAgAgwIIAAgACAAIAAgACACKAggAkQKZAggAPADJAAgAoQKkAqwCsgK6AsICCADJAggA0AIIAAgACAAIANYC3gIIAAgACAAIAAgACABAAOYCCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAkASoB+QIEAAgACAA8AEMCCABCBQgACABJBVAFCAAIAAgACAAIAAgACAAIAAgACABTBVoFCAAIAFoFCABfBWUFCAAIAAgACAAIAAgAbQUIAAgACAAIAAgACABzBXsFfQWFBYoFigWKBZEFigWKBYoFmAWfBaYFrgWxBbkFCAAIAAgACAAIAAgACAAIAAgACAAIAMEFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAMgFCADQBQgACAAIAAgACAAIAAgACAAIAAgACAAIAO4CCAAIAAgAiQAIAAgACABAAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAD0AggACAD8AggACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIANYFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAMDvwAIAAgAJAIIAAgACAAIAAgACAAIAAgACwMTAwgACAB9BOsEGwMjAwgAKwMyAwsFYgE3A/MEPwMIAEUDTQNRAwgAWQOsAGEDCAAIAAgACAAIAAgACABpAzQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFOgU0BTUFNgU3BTgFOQU6BTQFNQU2BTcFOAU5BToFNAU1BTYFNwU4BTkFIQUoBSwFCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABtAwgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABMAEwACAAIAAgACAAIABgACAAIAAgACAC/AAgACAAyAQgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACAAIAAwAAgACAAIAAgACAAIAAgACAAIAAAARABIAAgACAAIABQASAAIAAgAIABwAEAAjgCIABsAqAC2AL0AigDQAtwC+IJIQqVAZUBWQqVAZUBlQGVAZUBlQGrC5UBlQGVAZUBlQGVAZUBlQGVAXsKlQGVAbAK6wsrDGUMpQzlDJUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAZUBlQGVAfAKAAuZA64AtwCJALoC6ADwAAgAuACgA/oEpgO6AqsD+AAIAAgAswMIAAgACAAIAIkAuwP5AfsBwwPLAwgACAAIAAgACADRA9kDCAAIAOED6QMIAAgACAAIAAgACADuA/YDCAAIAP4DyQAIAAgABgQIAAgAXQAOBAgACAAIAAgACAAIABMECAAIAAgACAAIAAgACAD8AAQBCAAIAAgAGgQiBCoECAExBAgAEAEIAAgACAAIAAgACAAIAAgACAAIAAgACAA4BAgACABABEYECAAIAAgATAQYAQgAVAQIAAgACAAIAAgACAAIAAgACAAIAFoECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAOQEIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAB+BAcACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAEABhgSMBAgACAAIAAgAlAQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAwAEAAQABAADAAMAAwADAAQABAAEAAQABAAEAAQABHATAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAdQMIAAgACAAIAAgACAAIAMkACAAIAAgAfQMIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACACFA4kDCAAIAAgACAAIAOcBCAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAIcDCAAIAAgACAAIAAgACAAIAAgACAAIAJEDCAAIAAgACADFAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABgBAgAZgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAbAQCBXIECAAIAHkECAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACABAAJwEQACjBKoEsgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAC6BMIECAAIAAgACAAIAAgACABmBAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAxwQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAGYECAAIAAgAzgQIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBd0FXwUIAOIF6gXxBYoF3gT5BQAGCAaKBYoFigWKBYoFigWKBYoFigWKBYoFigXWBIoFigWKBYoFigWKBYoFigWKBYsFEAaKBYoFigWKBYoFigWKBRQGCACKBYoFigWKBQgACAAIANEECAAIABgGigUgBggAJgYIAC4GMwaKBYoF0wQ3Bj4GigWKBYoFigWKBYoFigWKBYoFigWKBYoFigUIAAgACAAIAAgACAAIAAgAigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWKBYoFigWLBf///////wQABAAEAAQABAAEAAQABAAEAAQAAwAEAAQAAgAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAQADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUAAAAFAAUAAAAFAAUAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUAAQAAAAUABQAFAAUABQAFAAAAAAAFAAUAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAFAAUAAQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAAABwAHAAcAAAAHAAcABwAFAAEAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAcABwAFAAUAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAAAAQABAAAAAAAAAAAAAAAFAAUABQAFAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAHAAcAAAAHAAcAAAAAAAUABQAHAAUAAQAHAAEABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwABAAUABQAFAAUAAAAAAAAAAAAAAAEAAQABAAEAAQABAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABQANAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEAAQABAAEAAQABAAEAAQABAAEAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAABQAHAAUABQAFAAAAAAAAAAcABQAFAAUABQAFAAQABAAEAAQABAAEAAQABAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAEAAQABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUAAAAFAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAUAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAcABwAFAAcABwAAAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUABwAHAAUABQAFAAUAAAAAAAcABwAAAAAABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAABQAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAAAAAAAAAAABQAFAAAAAAAFAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAFAAUABQAFAAUAAAAFAAUABwAAAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABwAFAAUABQAFAAAAAAAHAAcAAAAAAAcABwAFAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAAAAAAAAAHAAcABwAAAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAABQAHAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAUABQAFAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAHAAcABQAHAAcAAAAFAAcABwAAAAcABwAFAAUAAAAAAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAFAAcABwAFAAUABQAAAAUAAAAHAAcABwAHAAcABwAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAHAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAABwAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAUAAAAFAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABwAFAAUABQAFAAUAAAAFAAUAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABwAFAAUABQAFAAUABQAAAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABQAFAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABQAFAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAHAAUABQAFAAUABQAFAAUABwAHAAcABwAHAAcABwAHAAUABwAHAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABwAHAAcABwAFAAUABwAHAAcAAAAAAAAAAAAHAAcABQAHAAcABwAHAAcABwAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAcABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAUABQAFAAUABQAFAAUAAAAFAAAABQAAAAAABQAFAAUABQAFAAUABQAFAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAFAAUAAAAAAAUABQAFAAUABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABwAFAAcABwAHAAcABwAFAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAUABQAFAAUABwAHAAUABQAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABQAFAAcABwAHAAUABwAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAcABQAFAAUABQAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAAAAAABwAFAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAAAAAAAAAFAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAUABQAHAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAUABQAFAAUABQAHAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAcABwAFAAUABQAFAAcABwAFAAUABwAHAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAFAAcABwAFAAUABwAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAFAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAFAAUABQAAAAAABQAFAAAAAAAAAAAAAAAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAcABwAAAAAAAAAAAAAABwAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAcABwAFAAcABwAAAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAFAAUABQAAAAUABQAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABwAFAAUABQAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAUABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAHAAcABQAHAAUABQAAAAAAAAAAAAAAAAAFAAAABwAHAAcABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAHAAcABwAAAAAABwAHAAAAAAAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABwAHAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAFAAUABwAFAAcABwAFAAcABQAFAAcABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAHAAcABQAFAAUABQAAAAAABwAHAAcABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAHAAUABQAFAAUABQAFAAUABQAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABwAFAAcABwAFAAUABQAFAAUABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAcABwAFAAUABQAFAAcABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAUABQAFAAUABQAHAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAFAAUABQAFAAAAAAAFAAUABwAHAAcABwAFAAAAAAAAAAcAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABwAHAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAcABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUAAAAHAAUABQAFAAUABQAFAAUABwAFAAUABwAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUAAAAAAAAABQAAAAUABQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcABwAHAAcAAAAFAAUAAAAHAAcABQAHAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAAAAUABQAFAAAAAAAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAFAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAFAAUABQAAAAAABQAFAAUABQAFAAUABQAAAAUABQAAAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAUABQAFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABQAFAAUABQAFAAUABQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAFAAUABQAFAAUADgAOAA4ADgAOAA4ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAA8ADwAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAcABwAHAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAgACAAIAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAMAAwADAAMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkACQAJAAkAAAAAAAAAAAAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAKAAoACgAAAAAAAAAAAAsADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwACwAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAMAAwADAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAADgAOAA4AAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAAAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4AAAAOAAAAAAAAAAAAAAAAAA4AAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAAAAAAAAAAAA4AAAAOAAAAAAAAAAAADgAOAA4AAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAA4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4AAAAAAA4ADgAOAA4ADgAOAA4ADgAOAAAADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4ADgAOAAAAAAAAAAAAAAAAAAAAAAAAAAAADgAOAA4ADgAOAA4AAAAAAAAAAAAAAAAAAAAAAA4ADgAOAA4ADgAOAA4ADgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAOAA4ADgAOAA4ADgAAAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4ADgAOAA4AAAAAAAAAAAA=",Ac="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ks=typeof Uint8Array=="undefined"?[]:new Uint8Array(256),lc=0;lc>4,St[Q++]=(tt&15)<<4|lt>>2,St[Q++]=(lt&3)<<6|at&63;return bt},cc=function(E){for(var m=E.length,b=[],B=0;B>Vs,wp=1<>Vs,Bp=Td+Ep,Od=Bp,Id=32,bp=Od+Id,oE=65536>>Nu,AE=1<=0){if(m<55296||m>56319&&m<=65535)return b=this.index[m>>Vs],b=(b<>Vs)],b=(b<>Nu),b=this.index[b],b+=m>>Vs&xp,b=this.index[b],b=(b<=55296&&Q<=56319&&b>10)+55296,tt%1024+56320)),(Q+1===b||B.length>16384)&&(V+=String.fromCharCode.apply(String,B),B.length=0)}return V},Dd=lE(mp),ha="\xD7",Hu="\xF7",uE=function(E){return Dd.get(E)},hE=function(E,m,b){var B=b-2,Q=m[B],V=m[b-1],tt=m[b];if(V===hs&&tt===uc)return ha;if(V===hs||V===uc||V===Uu||tt===hs||tt===uc||tt===Uu)return Hu;if(V===kd&&[kd,Qd,Pu,Mp].indexOf(tt)!==-1||(V===Pu||V===Qd)&&(tt===Qd||tt===Du)||(V===Mp||V===Du)&&tt===Du||tt===Fp||tt===Ld||tt===Ru||V===cE)return ha;if(V===Fp&&tt===_u){for(;Q===Ld;)Q=m[--B];if(Q===_u)return ha}if(V===hc&&tt===hc){for(var lt=0;Q===hc;)lt++,Q=m[--B];if(lt%2===0)return ha}return Hu},dE=function(E){var m=Ud(E),b=m.length,B=0,Q=0,V=m.map(uE);return{next:function(){if(B>=b)return{done:!0,value:null};for(var tt=ha;Btt.x||St.y>tt.y;return tt=St,bt===0?!0:Ut});return E.body.removeChild(m),lt},vE=function(){return typeof new Image().crossOrigin!="undefined"},pE=function(){return typeof new XMLHttpRequest().responseType=="string"},mE=function(E){var m=new Image,b=E.createElement("canvas"),B=b.getContext("2d");if(!B)return!1;m.src="data:image/svg+xml,";try{B.drawImage(m,0,0),b.toDataURL()}catch(Q){return!1}return!0},nA=function(E){return E[0]===0&&E[1]===255&&E[2]===0&&E[3]===255},Pd=function(E){var m=E.createElement("canvas"),b=100;m.width=b,m.height=b;var B=m.getContext("2d");if(!B)return Promise.reject(!1);B.fillStyle="rgb(0, 255, 0)",B.fillRect(0,0,b,b);var Q=new Image,V=m.toDataURL();Q.src=V;var tt=Gu(b,b,0,0,Q);return B.fillStyle="red",B.fillRect(0,0,b,b),fc(tt).then(function(lt){B.drawImage(lt,0,0);var at=B.getImageData(0,0,b,b).data;B.fillStyle="red",B.fillRect(0,0,b,b);var bt=E.createElement("div");return bt.style.backgroundImage="url("+V+")",bt.style.height=b+"px",nA(at)?fc(Gu(b,b,0,0,bt)):Promise.reject(!1)}).then(function(lt){return B.drawImage(lt,0,0),nA(B.getImageData(0,0,b,b).data)}).catch(function(){return!1})},Gu=function(E,m,b,B,Q){var V="http://www.w3.org/2000/svg",tt=document.createElementNS(V,"svg"),lt=document.createElementNS(V,"foreignObject");return tt.setAttributeNS(null,"width",E.toString()),tt.setAttributeNS(null,"height",m.toString()),lt.setAttributeNS(null,"width","100%"),lt.setAttributeNS(null,"height","100%"),lt.setAttributeNS(null,"x",b.toString()),lt.setAttributeNS(null,"y",B.toString()),lt.setAttributeNS(null,"externalResourcesRequired","true"),tt.appendChild(lt),lt.appendChild(Q),tt},fc=function(E){return new Promise(function(m,b){var B=new Image;B.onload=function(){return m(B)},B.onerror=b,B.src="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(E))})},ri={get SUPPORT_RANGE_BOUNDS(){var E=fE(document);return Object.defineProperty(ri,"SUPPORT_RANGE_BOUNDS",{value:E}),E},get SUPPORT_WORD_BREAKING(){var E=ri.SUPPORT_RANGE_BOUNDS&&gE(document);return Object.defineProperty(ri,"SUPPORT_WORD_BREAKING",{value:E}),E},get SUPPORT_SVG_DRAWING(){var E=mE(document);return Object.defineProperty(ri,"SUPPORT_SVG_DRAWING",{value:E}),E},get SUPPORT_FOREIGNOBJECT_DRAWING(){var E=typeof Array.from=="function"&&typeof window.fetch=="function"?Pd(document):Promise.resolve(!1);return Object.defineProperty(ri,"SUPPORT_FOREIGNOBJECT_DRAWING",{value:E}),E},get SUPPORT_CORS_IMAGES(){var E=vE();return Object.defineProperty(ri,"SUPPORT_CORS_IMAGES",{value:E}),E},get SUPPORT_RESPONSE_TYPE(){var E=pE();return Object.defineProperty(ri,"SUPPORT_RESPONSE_TYPE",{value:E}),E},get SUPPORT_CORS_XHR(){var E="withCredentials"in new XMLHttpRequest;return Object.defineProperty(ri,"SUPPORT_CORS_XHR",{value:E}),E},get SUPPORT_NATIVE_TEXT_SEGMENTATION(){var E=!!(typeof Intl!="undefined"&&Intl.Segmenter);return Object.defineProperty(ri,"SUPPORT_NATIVE_TEXT_SEGMENTATION",{value:E}),E}},gc=function(){function E(m,b){this.text=m,this.bounds=b}return E}(),Tp=function(E,m,b,B){var Q=Ja(m,b),V=[],tt=0;return Q.forEach(function(lt){if(b.textDecorationLine.length||lt.trim().length>0)if(ri.SUPPORT_RANGE_BOUNDS){var at=ii(B,tt,lt.length).getClientRects();if(at.length>1){var bt=Xa(lt),St=0;bt.forEach(function(Jt){V.push(new gc(Jt,N.fromDOMRectList(E,ii(B,St+tt,Jt.length).getClientRects()))),St+=Jt.length})}else V.push(new gc(lt,N.fromDOMRectList(E,at)))}else{var Ut=B.splitText(lt.length);V.push(new gc(lt,Op(E,B))),B=Ut}else ri.SUPPORT_RANGE_BOUNDS||(B=B.splitText(lt.length));tt+=lt.length}),V},Op=function(E,m){var b=m.ownerDocument;if(b){var B=b.createElement("html2canvaswrapper");B.appendChild(m.cloneNode(!0));var Q=m.parentNode;if(Q){Q.replaceChild(B,m);var V=G(E,B);return B.firstChild&&Q.replaceChild(B.firstChild,B),V}}return N.EMPTY},ii=function(E,m,b){var B=E.ownerDocument;if(!B)throw new Error("Node has no owner document");var Q=B.createRange();return Q.setStart(E,m),Q.setEnd(E,m+b),Q},Xa=function(E){if(ri.SUPPORT_NATIVE_TEXT_SEGMENTATION){var m=new Intl.Segmenter(void 0,{granularity:"grapheme"});return Array.from(m.segment(E)).map(function(b){return b.segment})}return dc(E)},Ws=function(E,m){if(ri.SUPPORT_NATIVE_TEXT_SEGMENTATION){var b=new Intl.Segmenter(void 0,{granularity:"word"});return Array.from(b.segment(E)).map(function(B){return B.segment})}return vc(E,m)},Ja=function(E,m){return m.letterSpacing!==0?Xa(E):Ws(E,m)},Kt=[32,160,4961,65792,65793,4153,4241],vc=function(E,m){for(var b=ot(E,{lineBreak:m.lineBreak,wordBreak:m.overflowWrap==="break-word"?"break-word":m.wordBreak}),B=[],Q,V=function(){if(Q.value){var tt=Q.value.slice(),lt=_(tt),at="";lt.forEach(function(bt){Kt.indexOf(bt)===-1?at+=H(bt):(at.length&&B.push(at),B.push(H(bt)),at="")}),at.length&&B.push(at)}};!(Q=b.next()).done;)V();return B},ds=function(){function E(m,b,B){this.text=Ip(b.data,B.textTransform),this.textBounds=Tp(m,this.text,B,b)}return E}(),Ip=function(E,m){switch(m){case 1:return E.toLowerCase();case 3:return E.replace(zu,rA);case 2:return E.toUpperCase();default:return E}},zu=/(^|\s|:|-|\(|\))([a-z])/g,rA=function(E,m,b){return E.length>0?m+b.toUpperCase():E},_d=function(E){T(m,E);function m(b,B){var Q=E.call(this,b,B)||this;return Q.src=B.currentSrc||B.src,Q.intrinsicWidth=B.naturalWidth,Q.intrinsicHeight=B.naturalHeight,Q.context.cache.addImage(Q.src),Q}return m}(Sa),Hd=function(E){T(m,E);function m(b,B){var Q=E.call(this,b,B)||this;return Q.canvas=B,Q.intrinsicWidth=B.width,Q.intrinsicHeight=B.height,Q}return m}(Sa),Ku=function(E){T(m,E);function m(b,B){var Q=E.call(this,b,B)||this,V=new XMLSerializer,tt=G(b,B);return B.setAttribute("width",tt.width+"px"),B.setAttribute("height",tt.height+"px"),Q.svg="data:image/svg+xml,"+encodeURIComponent(V.serializeToString(B)),Q.intrinsicWidth=B.width.baseVal.value,Q.intrinsicHeight=B.height.baseVal.value,Q.context.cache.addImage(Q.svg),Q}return m}(Sa),pc=function(E){T(m,E);function m(b,B){var Q=E.call(this,b,B)||this;return Q.value=B.value,Q}return m}(Sa),Zn=function(E){T(m,E);function m(b,B){var Q=E.call(this,b,B)||this;return Q.start=B.start,Q.reversed=typeof B.reversed=="boolean"&&B.reversed===!0,Q}return m}(Sa),Np=[{type:15,flags:0,unit:"px",number:3}],iA=[{type:16,flags:0,number:50}],Lp=function(E){return E.width>E.height?new N(E.left+(E.width-E.height)/2,E.top,E.height,E.height):E.width0)b.textNodes.push(new ds(E,Q,b.styles));else if(gs(Q))if(Bc(Q)&&Q.assignedNodes)Q.assignedNodes().forEach(function(lt){return yc(E,lt,b,B)});else{var tt=bi(E,Q);tt.styles.isVisible()&&(yE(Q,tt,B)?tt.flags|=4:wE(tt.styles)&&(tt.flags|=2),Un.indexOf(Q.tagName)!==-1&&(tt.flags|=8),b.elements.push(tt),Q.slot,Q.shadowRoot?yc(E,Q.shadowRoot,tt,B):!oA(Q)&&!Fa(Q)&&!In(Q)&&yc(E,Q,tt,B))}},bi=function(E,m){return Ec(m)?new _d(E,m):sA(m)?new Hd(E,m):Fa(m)?new Ku(E,m):Wu(m)?new pc(E,m):kp(m)?new Zn(E,m):Qp(m)?new js(E,m):In(m)?new mc(E,m):oA(m)?new pi(E,m):jd(m)?new zd(E,m):new Sa(E,m)},Kd=function(E,m){var b=bi(E,m);return b.flags|=4,yc(E,m,b,b),b},yE=function(E,m,b){return m.styles.isPositionedWithZIndex()||m.styles.opacity<1||m.styles.isTransformed()||ta(E)&&b.styles.isTransparent()},wE=function(E){return E.isPositioned()||E.isFloating()},Vd=function(E){return E.nodeType===Node.TEXT_NODE},gs=function(E){return E.nodeType===Node.ELEMENT_NODE},Vu=function(E){return gs(E)&&typeof E.style!="undefined"&&!wc(E)},wc=function(E){return typeof E.className=="object"},Wu=function(E){return E.tagName==="LI"},kp=function(E){return E.tagName==="OL"},Qp=function(E){return E.tagName==="INPUT"},Wd=function(E){return E.tagName==="HTML"},Fa=function(E){return E.tagName==="svg"},ta=function(E){return E.tagName==="BODY"},sA=function(E){return E.tagName==="CANVAS"},Ke=function(E){return E.tagName==="VIDEO"},Ec=function(E){return E.tagName==="IMG"},jd=function(E){return E.tagName==="IFRAME"},Zd=function(E){return E.tagName==="STYLE"},Up=function(E){return E.tagName==="SCRIPT"},oA=function(E){return E.tagName==="TEXTAREA"},In=function(E){return E.tagName==="SELECT"},Bc=function(E){return E.tagName==="SLOT"},ea=function(E){return E.tagName.indexOf("-")>0},Yd=function(){function E(){this.counters={}}return E.prototype.getCounterValue=function(m){var b=this.counters[m];return b&&b.length?b[b.length-1]:1},E.prototype.getCounterValues=function(m){var b=this.counters[m];return b||[]},E.prototype.pop=function(m){var b=this;m.forEach(function(B){return b.counters[B].pop()})},E.prototype.parse=function(m){var b=this,B=m.counterIncrement,Q=m.counterReset,V=!0;B!==null&&B.forEach(function(lt){var at=b.counters[lt.counter];at&<.increment!==0&&(V=!1,at.length||at.push(1),at[Math.max(0,at.length-1)]+=lt.increment)});var tt=[];return V&&Q.forEach(function(lt){var at=b.counters[lt.counter];tt.push(lt.counter),at||(at=b.counters[lt.counter]=[]),at.push(lt.reset)}),tt},E}(),ju={integers:[1e3,900,500,400,100,90,50,40,10,9,5,4,1],values:["M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"]},Zu={integers:[9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u0554","\u0553","\u0552","\u0551","\u0550","\u054F","\u054E","\u054D","\u054C","\u054B","\u054A","\u0549","\u0548","\u0547","\u0546","\u0545","\u0544","\u0543","\u0542","\u0541","\u0540","\u053F","\u053E","\u053D","\u053C","\u053B","\u053A","\u0539","\u0538","\u0537","\u0536","\u0535","\u0534","\u0533","\u0532","\u0531"]},Rp={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,400,300,200,100,90,80,70,60,50,40,30,20,19,18,17,16,15,10,9,8,7,6,5,4,3,2,1],values:["\u05D9\u05F3","\u05D8\u05F3","\u05D7\u05F3","\u05D6\u05F3","\u05D5\u05F3","\u05D4\u05F3","\u05D3\u05F3","\u05D2\u05F3","\u05D1\u05F3","\u05D0\u05F3","\u05EA","\u05E9","\u05E8","\u05E7","\u05E6","\u05E4","\u05E2","\u05E1","\u05E0","\u05DE","\u05DC","\u05DB","\u05D9\u05D8","\u05D9\u05D7","\u05D9\u05D6","\u05D8\u05D6","\u05D8\u05D5","\u05D9","\u05D8","\u05D7","\u05D6","\u05D5","\u05D4","\u05D3","\u05D2","\u05D1","\u05D0"]},bc={integers:[1e4,9e3,8e3,7e3,6e3,5e3,4e3,3e3,2e3,1e3,900,800,700,600,500,400,300,200,100,90,80,70,60,50,40,30,20,10,9,8,7,6,5,4,3,2,1],values:["\u10F5","\u10F0","\u10EF","\u10F4","\u10EE","\u10ED","\u10EC","\u10EB","\u10EA","\u10E9","\u10E8","\u10E7","\u10E6","\u10E5","\u10E4","\u10F3","\u10E2","\u10E1","\u10E0","\u10DF","\u10DE","\u10DD","\u10F2","\u10DC","\u10DB","\u10DA","\u10D9","\u10D8","\u10D7","\u10F1","\u10D6","\u10D5","\u10D4","\u10D3","\u10D2","\u10D1","\u10D0"]},AA=function(E,m,b,B,Q,V){return Eb?ps(E,Q,V.length>0):B.integers.reduce(function(tt,lt,at){for(;E>=lt;)E-=lt,tt+=B.values[at];return tt},"")+V},lA=function(E,m,b,B){var Q="";do b||E--,Q=B(E)+Q,E/=m;while(E*m>=m);return Q},xr=function(E,m,b,B,Q){var V=b-m+1;return(E<0?"-":"")+(lA(Math.abs(E),V,B,function(tt){return H(Math.floor(tt%V)+m)})+Q)},Zs=function(E,m,b){b===void 0&&(b=". ");var B=m.length;return lA(Math.abs(E),B,!1,function(Q){return m[Math.floor(Q%B)]})+b},cA=1,vs=2,oe=4,Bo=8,qa=function(E,m,b,B,Q,V){if(E<-9999||E>9999)return ps(E,4,Q.length>0);var tt=Math.abs(E),lt=Q;if(tt===0)return m[0]+lt;for(var at=0;tt>0&&at<=4;at++){var bt=tt%10;bt===0&&Rr(V,cA)&<!==""?lt=m[bt]+lt:bt>1||bt===1&&at===0||bt===1&&at===1&&Rr(V,vs)||bt===1&&at===1&&Rr(V,oe)&&E>100||bt===1&&at>1&&Rr(V,Bo)?lt=m[bt]+(at>0?b[at-1]:"")+lt:bt===1&&at>0&&(lt=b[at-1]+lt),tt=Math.floor(tt/10)}return(E<0?B:"")+lt},uA="\u5341\u767E\u5343\u842C",hA="\u62FE\u4F70\u4EDF\u842C",el="\u30DE\u30A4\u30CA\u30B9",Ys="\uB9C8\uC774\uB108\uC2A4",ps=function(E,m,b){var B=b?". ":"",Q=b?"\u3001":"",V=b?", ":"",tt=b?" ":"";switch(m){case 0:return"\u2022"+tt;case 1:return"\u25E6"+tt;case 2:return"\u25FE"+tt;case 5:var lt=xr(E,48,57,!0,B);return lt.length<4?"0"+lt:lt;case 4:return Zs(E,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",Q);case 6:return AA(E,1,3999,ju,3,B).toLowerCase();case 7:return AA(E,1,3999,ju,3,B);case 8:return xr(E,945,969,!1,B);case 9:return xr(E,97,122,!1,B);case 10:return xr(E,65,90,!1,B);case 11:return xr(E,1632,1641,!0,B);case 12:case 49:return AA(E,1,9999,Zu,3,B);case 35:return AA(E,1,9999,Zu,3,B).toLowerCase();case 13:return xr(E,2534,2543,!0,B);case 14:case 30:return xr(E,6112,6121,!0,B);case 15:return Zs(E,"\u5B50\u4E11\u5BC5\u536F\u8FB0\u5DF3\u5348\u672A\u7533\u9149\u620C\u4EA5",Q);case 16:return Zs(E,"\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678",Q);case 17:case 48:return qa(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",uA,"\u8CA0",Q,vs|oe|Bo);case 47:return qa(E,"\u96F6\u58F9\u8CB3\u53C3\u8086\u4F0D\u9678\u67D2\u634C\u7396",hA,"\u8CA0",Q,cA|vs|oe|Bo);case 42:return qa(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D",uA,"\u8D1F",Q,vs|oe|Bo);case 41:return qa(E,"\u96F6\u58F9\u8D30\u53C1\u8086\u4F0D\u9646\u67D2\u634C\u7396",hA,"\u8D1F",Q,cA|vs|oe|Bo);case 26:return qa(E,"\u3007\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u4E07",el,Q,0);case 25:return qa(E,"\u96F6\u58F1\u5F10\u53C2\u56DB\u4F0D\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343\u4E07",el,Q,cA|vs|oe);case 31:return qa(E,"\uC601\uC77C\uC774\uC0BC\uC0AC\uC624\uC721\uCE60\uD314\uAD6C","\uC2ED\uBC31\uCC9C\uB9CC",Ys,V,cA|vs|oe);case 33:return qa(E,"\u96F6\u4E00\u4E8C\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u5341\u767E\u5343\u842C",Ys,V,0);case 32:return qa(E,"\u96F6\u58F9\u8CB3\u53C3\u56DB\u4E94\u516D\u4E03\u516B\u4E5D","\u62FE\u767E\u5343",Ys,V,cA|vs|oe);case 18:return xr(E,2406,2415,!0,B);case 20:return AA(E,1,19999,bc,3,B);case 21:return xr(E,2790,2799,!0,B);case 22:return xr(E,2662,2671,!0,B);case 22:return AA(E,1,10999,Rp,3,B);case 23:return Zs(E,"\u3042\u3044\u3046\u3048\u304A\u304B\u304D\u304F\u3051\u3053\u3055\u3057\u3059\u305B\u305D\u305F\u3061\u3064\u3066\u3068\u306A\u306B\u306C\u306D\u306E\u306F\u3072\u3075\u3078\u307B\u307E\u307F\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308A\u308B\u308C\u308D\u308F\u3090\u3091\u3092\u3093");case 24:return Zs(E,"\u3044\u308D\u306F\u306B\u307B\u3078\u3068\u3061\u308A\u306C\u308B\u3092\u308F\u304B\u3088\u305F\u308C\u305D\u3064\u306D\u306A\u3089\u3080\u3046\u3090\u306E\u304A\u304F\u3084\u307E\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304D\u3086\u3081\u307F\u3057\u3091\u3072\u3082\u305B\u3059");case 27:return xr(E,3302,3311,!0,B);case 28:return Zs(E,"\u30A2\u30A4\u30A6\u30A8\u30AA\u30AB\u30AD\u30AF\u30B1\u30B3\u30B5\u30B7\u30B9\u30BB\u30BD\u30BF\u30C1\u30C4\u30C6\u30C8\u30CA\u30CB\u30CC\u30CD\u30CE\u30CF\u30D2\u30D5\u30D8\u30DB\u30DE\u30DF\u30E0\u30E1\u30E2\u30E4\u30E6\u30E8\u30E9\u30EA\u30EB\u30EC\u30ED\u30EF\u30F0\u30F1\u30F2\u30F3",Q);case 29:return Zs(E,"\u30A4\u30ED\u30CF\u30CB\u30DB\u30D8\u30C8\u30C1\u30EA\u30CC\u30EB\u30F2\u30EF\u30AB\u30E8\u30BF\u30EC\u30BD\u30C4\u30CD\u30CA\u30E9\u30E0\u30A6\u30F0\u30CE\u30AA\u30AF\u30E4\u30DE\u30B1\u30D5\u30B3\u30A8\u30C6\u30A2\u30B5\u30AD\u30E6\u30E1\u30DF\u30B7\u30F1\u30D2\u30E2\u30BB\u30B9",Q);case 34:return xr(E,3792,3801,!0,B);case 37:return xr(E,6160,6169,!0,B);case 38:return xr(E,4160,4169,!0,B);case 39:return xr(E,2918,2927,!0,B);case 40:return xr(E,1776,1785,!0,B);case 43:return xr(E,3046,3055,!0,B);case 44:return xr(E,3174,3183,!0,B);case 45:return xr(E,3664,3673,!0,B);case 46:return xr(E,3872,3881,!0,B);case 3:default:return xr(E,48,57,!0,B)}},Ta="data-html2canvas-ignore",Xd=function(){function E(m,b,B){if(this.context=m,this.options=B,this.scrolledElements=[],this.referenceElement=b,this.counters=new Yd,this.quoteDepth=0,!b.ownerDocument)throw new Error("Cloned element does not have an owner document");this.documentElement=this.cloneNode(b.ownerDocument.documentElement,!1)}return E.prototype.toIFrame=function(m,b){var B=this,Q=Dp(m,b);if(!Q.contentWindow)return Promise.reject("Unable to find iframe window");var V=m.defaultView.pageXOffset,tt=m.defaultView.pageYOffset,lt=Q.contentWindow,at=lt.document,bt=Hp(Q).then(function(){return W(B,void 0,void 0,function(){var St,Ut;return z(this,function(Jt){switch(Jt.label){case 0:return this.scrolledElements.forEach(Kp),lt&&(lt.scrollTo(b.left,b.top),/(iPad|iPhone|iPod)/g.test(navigator.userAgent)&&(lt.scrollY!==b.top||lt.scrollX!==b.left)&&(this.context.logger.warn("Unable to restore scroll position for cloned document"),this.context.windowBounds=this.context.windowBounds.add(lt.scrollX-b.left,lt.scrollY-b.top,0,0))),St=this.options.onclone,Ut=this.clonedReferenceElement,typeof Ut=="undefined"?[2,Promise.reject("Error finding the "+this.referenceElement.nodeName+" in the cloned document")]:at.fonts&&at.fonts.ready?[4,at.fonts.ready]:[3,2];case 1:Jt.sent(),Jt.label=2;case 2:return/(AppleWebKit)/g.test(navigator.userAgent)?[4,_p(at)]:[3,4];case 3:Jt.sent(),Jt.label=4;case 4:return typeof St=="function"?[2,Promise.resolve().then(function(){return St(at,Ut)}).then(function(){return Q})]:[2,Q]}})})});return at.open(),at.write(Jd(document.doctype)+""),zp(this.referenceElement.ownerDocument,V,tt),at.replaceChild(at.adoptNode(this.documentElement),at.documentElement),at.close(),bt},E.prototype.createElementClone=function(m){if(we(m,2))debugger;if(sA(m))return this.createCanvasClone(m);if(Ke(m))return this.createVideoClone(m);if(Zd(m))return this.createStyleClone(m);var b=m.cloneNode(!1);return Ec(b)&&(Ec(m)&&m.currentSrc&&m.currentSrc!==m.src&&(b.src=m.currentSrc,b.srcset=""),b.loading==="lazy"&&(b.loading="eager")),ea(b)?this.createCustomElementClone(b):b},E.prototype.createCustomElementClone=function(m){var b=document.createElement("html2canvascustomelement");return xc(m.style,b),b},E.prototype.createStyleClone=function(m){try{var b=m.sheet;if(b&&b.cssRules){var B=[].slice.call(b.cssRules,0).reduce(function(V,tt){return tt&&typeof tt.cssText=="string"?V+tt.cssText:V},""),Q=m.cloneNode(!1);return Q.textContent=B,Q}}catch(V){if(this.context.logger.error("Unable to access cssRules property",V),V.name!=="SecurityError")throw V}return m.cloneNode(!1)},E.prototype.createCanvasClone=function(m){var b;if(this.options.inlineImages&&m.ownerDocument){var B=m.ownerDocument.createElement("img");try{return B.src=m.toDataURL(),B}catch(bt){this.context.logger.info("Unable to inline canvas contents, canvas is tainted",m)}}var Q=m.cloneNode(!1);try{Q.width=m.width,Q.height=m.height;var V=m.getContext("2d"),tt=Q.getContext("2d");if(tt)if(!this.options.allowTaint&&V)tt.putImageData(V.getImageData(0,0,m.width,m.height),0,0);else{var lt=(b=m.getContext("webgl2"))!==null&&b!==void 0?b:m.getContext("webgl");if(lt){var at=lt.getContextAttributes();(at==null?void 0:at.preserveDrawingBuffer)===!1&&this.context.logger.warn("Unable to clone WebGL context as it has preserveDrawingBuffer=false",m)}tt.drawImage(m,0,0)}return Q}catch(bt){this.context.logger.info("Unable to clone canvas as it is tainted",m)}return Q},E.prototype.createVideoClone=function(m){var b=m.ownerDocument.createElement("canvas");b.width=m.offsetWidth,b.height=m.offsetHeight;var B=b.getContext("2d");try{return B&&(B.drawImage(m,0,0,b.width,b.height),this.options.allowTaint||B.getImageData(0,0,b.width,b.height)),b}catch(V){this.context.logger.info("Unable to clone video as it is tainted",m)}var Q=m.ownerDocument.createElement("canvas");return Q.width=m.offsetWidth,Q.height=m.offsetHeight,Q},E.prototype.appendChildNode=function(m,b,B){(!gs(b)||!Up(b)&&!b.hasAttribute(Ta)&&(typeof this.options.ignoreElements!="function"||!this.options.ignoreElements(b)))&&(!this.options.copyStyles||!gs(b)||!Zd(b))&&m.appendChild(this.cloneNode(b,B))},E.prototype.cloneChildNodes=function(m,b,B){for(var Q=this,V=m.shadowRoot?m.shadowRoot.firstChild:m.firstChild;V;V=V.nextSibling)if(gs(V)&&Bc(V)&&typeof V.assignedNodes=="function"){var tt=V.assignedNodes();tt.length&&tt.forEach(function(lt){return Q.appendChildNode(b,lt,B)})}else this.appendChildNode(b,V,B)},E.prototype.cloneNode=function(m,b){if(Vd(m))return document.createTextNode(m.data);if(!m.ownerDocument)return m.cloneNode(!1);var B=m.ownerDocument.defaultView;if(B&&gs(m)&&(Vu(m)||wc(m))){var Q=this.createElementClone(m);Q.style.transitionProperty="none";var V=B.getComputedStyle(m),tt=B.getComputedStyle(m,":before"),lt=B.getComputedStyle(m,":after");this.referenceElement===m&&Vu(Q)&&(this.clonedReferenceElement=Q),ta(Q)&&Vp(Q);var at=this.counters.parse(new eA(this.context,V)),bt=this.resolvePseudoContent(m,Q,tt,nl.BEFORE);ea(m)&&(b=!0),Ke(m)||this.cloneChildNodes(m,Q,b),bt&&Q.insertBefore(bt,Q.firstChild);var St=this.resolvePseudoContent(m,Q,lt,nl.AFTER);return St&&Q.appendChild(St),this.counters.pop(at),(V&&(this.options.copyStyles||wc(m))&&!jd(m)||b)&&xc(V,Q),(m.scrollTop!==0||m.scrollLeft!==0)&&this.scrolledElements.push([Q,m.scrollLeft,m.scrollTop]),(oA(m)||In(m))&&(oA(Q)||In(Q))&&(Q.value=m.value),Q}return m.cloneNode(!1)},E.prototype.resolvePseudoContent=function(m,b,B,Q){var V=this;if(B){var tt=B.content,lt=b.ownerDocument;if(!(!lt||!tt||tt==="none"||tt==="-moz-alt-content"||B.display==="none")){this.counters.parse(new eA(this.context,B));var at=new vp(this.context,B),bt=lt.createElement("html2canvaspseudoelement");xc(B,bt),at.content.forEach(function(Ut){if(Ut.type===0)bt.appendChild(lt.createTextNode(Ut.value));else if(Ut.type===22){var Jt=lt.createElement("img");Jt.src=Ut.value,Jt.style.opacity="1",bt.appendChild(Jt)}else if(Ut.type===18){if(Ut.name==="attr"){var Te=Ut.values.filter($n);Te.length&&bt.appendChild(lt.createTextNode(m.getAttribute(Te[0].value)||""))}else if(Ut.name==="counter"){var he=Ut.values.filter(WA),Be=he[0],rn=he[1];if(Be&&$n(Be)){var Ue=V.counters.getCounterValue(Be.value),Le=rn&&$n(rn)?Ou.parse(V.context,rn.value):3;bt.appendChild(lt.createTextNode(ps(Ue,Le,!1)))}}else if(Ut.name==="counters"){var Mn=Ut.values.filter(WA),Be=Mn[0],An=Mn[1],rn=Mn[2];if(Be&&$n(Be)){var Ye=V.counters.getCounterValues(Be.value),Fe=rn&&$n(rn)?Ou.parse(V.context,rn.value):3,bn=An&&An.type===0?An.value:"",xn=Ye.map(function(si){return ps(si,Fe,!1)}).join(bn);bt.appendChild(lt.createTextNode(xn))}}}else if(Ut.type===20)switch(Ut.value){case"open-quote":bt.appendChild(lt.createTextNode(Sd(at.quotes,V.quoteDepth++,!0)));break;case"close-quote":bt.appendChild(lt.createTextNode(Sd(at.quotes,--V.quoteDepth,!1)));break;default:bt.appendChild(lt.createTextNode(Ut.value))}}),bt.className=Sc+" "+dA;var St=Q===nl.BEFORE?" "+Sc:" "+dA;return wc(b)?b.className.baseValue+=St:b.className+=St,bt}}},E.destroy=function(m){return m.parentNode?(m.parentNode.removeChild(m),!0):!1},E}(),nl;(function(E){E[E.BEFORE=0]="BEFORE",E[E.AFTER=1]="AFTER"})(nl||(nl={}));var Dp=function(E,m){var b=E.createElement("iframe");return b.className="html2canvas-container",b.style.visibility="hidden",b.style.position="fixed",b.style.left="-10000px",b.style.top="0px",b.style.border="0",b.width=m.width.toString(),b.height=m.height.toString(),b.scrolling="no",b.setAttribute(Ta,"true"),E.body.appendChild(b),b},Pp=function(E){return new Promise(function(m){if(E.complete){m();return}if(!E.src){m();return}E.onload=m,E.onerror=m})},_p=function(E){return Promise.all([].slice.call(E.images,0).map(Pp))},Hp=function(E){return new Promise(function(m,b){var B=E.contentWindow;if(!B)return b("No window assigned for iframe");var Q=B.document;B.onload=E.onload=function(){B.onload=E.onload=null;var V=setInterval(function(){Q.body.childNodes.length>0&&Q.readyState==="complete"&&(clearInterval(V),m(E))},50)}})},Gp=["all","d","content"],xc=function(E,m){for(var b=E.length-1;b>=0;b--){var B=E.item(b);Gp.indexOf(B)===-1&&m.style.setProperty(B,E.getPropertyValue(B))}return m},Jd=function(E){var m="";return E&&(m+=""),m},zp=function(E,m,b){E&&E.defaultView&&(m!==E.defaultView.pageXOffset||b!==E.defaultView.pageYOffset)&&E.defaultView.scrollTo(m,b)},Kp=function(E){var m=E[0],b=E[1],B=E[2];m.scrollLeft=b,m.scrollTop=B},qd=":before",Cc=":after",Sc="___html2canvas___pseudoelement_before",dA="___html2canvas___pseudoelement_after",$d=`{ content: "" !important; display: none !important; }`,Vp=function(E){Ui(E,"."+Sc+qd+$d+` .`+dA+Cc+$d)},Ui=function(E,m){var b=E.ownerDocument;if(b){var B=b.createElement("style");B.textContent=m,E.appendChild(B)}},Yu=function(){function E(){}return E.getOrigin=function(m){var b=E._link;return b?(b.href=m,b.href=b.href,b.protocol+b.hostname+b.port):"about:blank"},E.isSameOrigin=function(m){return E.getOrigin(m)===E._origin},E.setContext=function(m){E._link=m.document.createElement("a"),E._origin=E.getOrigin(m.location.href)},E._origin="about:blank",E}(),Wp=function(){function E(m,b){this.context=m,this._options=b,this._cache={}}return E.prototype.addImage=function(m){var b=Promise.resolve();return this.has(m)||(Xu(m)||xo(m))&&(this._cache[m]=this.loadImage(m)).catch(function(){}),b},E.prototype.match=function(m){return this._cache[m]},E.prototype.loadImage=function(m){return W(this,void 0,void 0,function(){var b,B,Q,V,tt=this;return z(this,function(lt){switch(lt.label){case 0:return b=Yu.isSameOrigin(m),B=!Fc(m)&&this._options.useCORS===!0&&ri.SUPPORT_CORS_IMAGES&&!b,Q=!Fc(m)&&!b&&!Xu(m)&&typeof this._options.proxy=="string"&&ri.SUPPORT_CORS_XHR&&!B,!b&&this._options.allowTaint===!1&&!Fc(m)&&!Xu(m)&&!Q&&!B?[2]:(V=m,Q?[4,this.proxy(V)]:[3,2]);case 1:V=lt.sent(),lt.label=2;case 2:return this.context.logger.debug("Added image "+m.substring(0,256)),[4,new Promise(function(at,bt){var St=new Image;St.onload=function(){return at(St)},St.onerror=bt,(ef(V)||B)&&(St.crossOrigin="anonymous"),St.src=V,St.complete===!0&&setTimeout(function(){return at(St)},500),tt._options.imageTimeout>0&&setTimeout(function(){return bt("Timed out ("+tt._options.imageTimeout+"ms) loading image")},tt._options.imageTimeout)})];case 3:return[2,lt.sent()]}})})},E.prototype.has=function(m){return typeof this._cache[m]!="undefined"},E.prototype.keys=function(){return Promise.resolve(Object.keys(this._cache))},E.prototype.proxy=function(m){var b=this,B=this._options.proxy;if(!B)throw new Error("No proxy defined");var Q=m.substring(0,256);return new Promise(function(V,tt){var lt=ri.SUPPORT_RESPONSE_TYPE?"blob":"text",at=new XMLHttpRequest;at.onload=function(){if(at.status===200)if(lt==="text")V(at.response);else{var Ut=new FileReader;Ut.addEventListener("load",function(){return V(Ut.result)},!1),Ut.addEventListener("error",function(Jt){return tt(Jt)},!1),Ut.readAsDataURL(at.response)}else tt("Failed to proxy resource "+Q+" with status code "+at.status)},at.onerror=tt;var bt=B.indexOf("?")>-1?"&":"?";if(at.open("GET",""+B+bt+"url="+encodeURIComponent(m)+"&responseType="+lt),lt!=="text"&&at instanceof XMLHttpRequest&&(at.responseType=lt),b._options.imageTimeout){var St=b._options.imageTimeout;at.timeout=St,at.ontimeout=function(){return tt("Timed out ("+St+"ms) proxying "+Q)}}at.send()})},E}(),tf=/^data:image\/svg\+xml/i,Mc=/^data:image\/.*;base64,/i,bo=/^data:image\/.*/i,xo=function(E){return ri.SUPPORT_SVG_DRAWING||!Oa(E)},Fc=function(E){return bo.test(E)},ef=function(E){return Mc.test(E)},Xu=function(E){return E.substr(0,4)==="blob"},Oa=function(E){return E.substr(-3).toLowerCase()==="svg"||tf.test(E)},Se=function(){function E(m,b){this.type=0,this.x=m,this.y=b}return E.prototype.add=function(m,b){return new E(this.x+m,this.y+b)},E}(),ms=function(E,m,b){return new Se(E.x+(m.x-E.x)*b,E.y+(m.y-E.y)*b)},fA=function(){function E(m,b,B,Q){this.type=1,this.start=m,this.startControl=b,this.endControl=B,this.end=Q}return E.prototype.subdivide=function(m,b){var B=ms(this.start,this.startControl,m),Q=ms(this.startControl,this.endControl,m),V=ms(this.endControl,this.end,m),tt=ms(B,Q,m),lt=ms(Q,V,m),at=ms(tt,lt,m);return b?new E(this.start,B,tt,at):new E(at,lt,V,this.end)},E.prototype.add=function(m,b){return new E(this.start.add(m,b),this.startControl.add(m,b),this.endControl.add(m,b),this.end.add(m,b))},E.prototype.reverse=function(){return new E(this.end,this.endControl,this.startControl,this.start)},E}(),Nn=function(E){return E.type===1},fe=function(){function E(m){var b=m.styles,B=m.bounds,Q=ZA(b.borderTopLeftRadius,B.width,B.height),V=Q[0],tt=Q[1],lt=ZA(b.borderTopRightRadius,B.width,B.height),at=lt[0],bt=lt[1],St=ZA(b.borderBottomRightRadius,B.width,B.height),Ut=St[0],Jt=St[1],Te=ZA(b.borderBottomLeftRadius,B.width,B.height),he=Te[0],Be=Te[1],rn=[];rn.push((V+at)/B.width),rn.push((he+Ut)/B.width),rn.push((tt+Be)/B.height),rn.push((bt+Jt)/B.height);var Ue=Math.max.apply(Math,rn);Ue>1&&(V/=Ue,tt/=Ue,at/=Ue,bt/=Ue,Ut/=Ue,Jt/=Ue,he/=Ue,Be/=Ue);var Le=B.width-at,Mn=B.height-Jt,An=B.width-Ut,Ye=B.height-Be,Fe=b.borderTopWidth,bn=b.borderRightWidth,xn=b.borderBottomWidth,We=b.borderLeftWidth,Or=Gn(b.paddingTop,m.bounds.width),si=Gn(b.paddingRight,m.bounds.width),Di=Gn(b.paddingBottom,m.bounds.width),zn=Gn(b.paddingLeft,m.bounds.width);this.topLeftBorderDoubleOuterBox=V>0||tt>0?lr(B.left+We/3,B.top+Fe/3,V-We/3,tt-Fe/3,un.TOP_LEFT):new Se(B.left+We/3,B.top+Fe/3),this.topRightBorderDoubleOuterBox=V>0||tt>0?lr(B.left+Le,B.top+Fe/3,at-bn/3,bt-Fe/3,un.TOP_RIGHT):new Se(B.left+B.width-bn/3,B.top+Fe/3),this.bottomRightBorderDoubleOuterBox=Ut>0||Jt>0?lr(B.left+An,B.top+Mn,Ut-bn/3,Jt-xn/3,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn/3,B.top+B.height-xn/3),this.bottomLeftBorderDoubleOuterBox=he>0||Be>0?lr(B.left+We/3,B.top+Ye,he-We/3,Be-xn/3,un.BOTTOM_LEFT):new Se(B.left+We/3,B.top+B.height-xn/3),this.topLeftBorderDoubleInnerBox=V>0||tt>0?lr(B.left+We*2/3,B.top+Fe*2/3,V-We*2/3,tt-Fe*2/3,un.TOP_LEFT):new Se(B.left+We*2/3,B.top+Fe*2/3),this.topRightBorderDoubleInnerBox=V>0||tt>0?lr(B.left+Le,B.top+Fe*2/3,at-bn*2/3,bt-Fe*2/3,un.TOP_RIGHT):new Se(B.left+B.width-bn*2/3,B.top+Fe*2/3),this.bottomRightBorderDoubleInnerBox=Ut>0||Jt>0?lr(B.left+An,B.top+Mn,Ut-bn*2/3,Jt-xn*2/3,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn*2/3,B.top+B.height-xn*2/3),this.bottomLeftBorderDoubleInnerBox=he>0||Be>0?lr(B.left+We*2/3,B.top+Ye,he-We*2/3,Be-xn*2/3,un.BOTTOM_LEFT):new Se(B.left+We*2/3,B.top+B.height-xn*2/3),this.topLeftBorderStroke=V>0||tt>0?lr(B.left+We/2,B.top+Fe/2,V-We/2,tt-Fe/2,un.TOP_LEFT):new Se(B.left+We/2,B.top+Fe/2),this.topRightBorderStroke=V>0||tt>0?lr(B.left+Le,B.top+Fe/2,at-bn/2,bt-Fe/2,un.TOP_RIGHT):new Se(B.left+B.width-bn/2,B.top+Fe/2),this.bottomRightBorderStroke=Ut>0||Jt>0?lr(B.left+An,B.top+Mn,Ut-bn/2,Jt-xn/2,un.BOTTOM_RIGHT):new Se(B.left+B.width-bn/2,B.top+B.height-xn/2),this.bottomLeftBorderStroke=he>0||Be>0?lr(B.left+We/2,B.top+Ye,he-We/2,Be-xn/2,un.BOTTOM_LEFT):new Se(B.left+We/2,B.top+B.height-xn/2),this.topLeftBorderBox=V>0||tt>0?lr(B.left,B.top,V,tt,un.TOP_LEFT):new Se(B.left,B.top),this.topRightBorderBox=at>0||bt>0?lr(B.left+Le,B.top,at,bt,un.TOP_RIGHT):new Se(B.left+B.width,B.top),this.bottomRightBorderBox=Ut>0||Jt>0?lr(B.left+An,B.top+Mn,Ut,Jt,un.BOTTOM_RIGHT):new Se(B.left+B.width,B.top+B.height),this.bottomLeftBorderBox=he>0||Be>0?lr(B.left,B.top+Ye,he,Be,un.BOTTOM_LEFT):new Se(B.left,B.top+B.height),this.topLeftPaddingBox=V>0||tt>0?lr(B.left+We,B.top+Fe,Math.max(0,V-We),Math.max(0,tt-Fe),un.TOP_LEFT):new Se(B.left+We,B.top+Fe),this.topRightPaddingBox=at>0||bt>0?lr(B.left+Math.min(Le,B.width-bn),B.top+Fe,Le>B.width+bn?0:Math.max(0,at-bn),Math.max(0,bt-Fe),un.TOP_RIGHT):new Se(B.left+B.width-bn,B.top+Fe),this.bottomRightPaddingBox=Ut>0||Jt>0?lr(B.left+Math.min(An,B.width-We),B.top+Math.min(Mn,B.height-xn),Math.max(0,Ut-bn),Math.max(0,Jt-xn),un.BOTTOM_RIGHT):new Se(B.left+B.width-bn,B.top+B.height-xn),this.bottomLeftPaddingBox=he>0||Be>0?lr(B.left+We,B.top+Math.min(Ye,B.height-xn),Math.max(0,he-We),Math.max(0,Be-xn),un.BOTTOM_LEFT):new Se(B.left+We,B.top+B.height-xn),this.topLeftContentBox=V>0||tt>0?lr(B.left+We+zn,B.top+Fe+Or,Math.max(0,V-(We+zn)),Math.max(0,tt-(Fe+Or)),un.TOP_LEFT):new Se(B.left+We+zn,B.top+Fe+Or),this.topRightContentBox=at>0||bt>0?lr(B.left+Math.min(Le,B.width+We+zn),B.top+Fe+Or,Le>B.width+We+zn?0:at-We+zn,bt-(Fe+Or),un.TOP_RIGHT):new Se(B.left+B.width-(bn+si),B.top+Fe+Or),this.bottomRightContentBox=Ut>0||Jt>0?lr(B.left+Math.min(An,B.width-(We+zn)),B.top+Math.min(Mn,B.height+Fe+Or),Math.max(0,Ut-(bn+si)),Jt-(xn+Di),un.BOTTOM_RIGHT):new Se(B.left+B.width-(bn+si),B.top+B.height-(xn+Di)),this.bottomLeftContentBox=he>0||Be>0?lr(B.left+We+zn,B.top+Ye,Math.max(0,he-(We+zn)),Be-(xn+Di),un.BOTTOM_LEFT):new Se(B.left+We+zn,B.top+B.height-(xn+Di))}return E}(),un;(function(E){E[E.TOP_LEFT=0]="TOP_LEFT",E[E.TOP_RIGHT=1]="TOP_RIGHT",E[E.BOTTOM_RIGHT=2]="BOTTOM_RIGHT",E[E.BOTTOM_LEFT=3]="BOTTOM_LEFT"})(un||(un={}));var lr=function(E,m,b,B,Q){var V=4*((Math.sqrt(2)-1)/3),tt=b*V,lt=B*V,at=E+b,bt=m+B;switch(Q){case un.TOP_LEFT:return new fA(new Se(E,bt),new Se(E,bt-lt),new Se(at-tt,m),new Se(at,m));case un.TOP_RIGHT:return new fA(new Se(E,m),new Se(E+tt,m),new Se(at,bt-lt),new Se(at,bt));case un.BOTTOM_RIGHT:return new fA(new Se(at,m),new Se(at,m+lt),new Se(E+tt,bt),new Se(E,bt));case un.BOTTOM_LEFT:default:return new fA(new Se(at,bt),new Se(at-tt,bt),new Se(E,m+lt),new Se(E,m))}},Tc=function(E){return[E.topLeftBorderBox,E.topRightBorderBox,E.bottomRightBorderBox,E.bottomLeftBorderBox]},jp=function(E){return[E.topLeftContentBox,E.topRightContentBox,E.bottomRightContentBox,E.bottomLeftContentBox]},ys=function(E){return[E.topLeftPaddingBox,E.topRightPaddingBox,E.bottomRightPaddingBox,E.bottomLeftPaddingBox]},Zp=function(){function E(m,b,B){this.offsetX=m,this.offsetY=b,this.matrix=B,this.type=0,this.target=6}return E}(),Oc=function(){function E(m,b){this.path=m,this.target=b,this.type=1}return E}(),Yp=function(){function E(m){this.opacity=m,this.type=2,this.target=6}return E}(),Xp=function(E){return E.type===0},Ju=function(E){return E.type===1},qu=function(E){return E.type===2},rl=function(E,m){return E.length===m.length?E.some(function(b,B){return b===m[B]}):!1},Jp=function(E,m,b,B,Q){return E.map(function(V,tt){switch(tt){case 0:return V.add(m,b);case 1:return V.add(m+B,b);case 2:return V.add(m+B,b+Q);case 3:return V.add(m,b+Q)}return V})},ws=function(){function E(m){this.element=m,this.inlineLevel=[],this.nonInlineLevel=[],this.negativeZIndex=[],this.zeroOrAutoZIndexOrTransformedOrOpacity=[],this.positiveZIndex=[],this.nonPositionedFloats=[],this.nonPositionedInlineLevel=[]}return E}(),il=function(){function E(m,b){if(this.container=m,this.parent=b,this.effects=[],this.curves=new fe(this.container),this.container.styles.opacity<1&&this.effects.push(new Yp(this.container.styles.opacity)),this.container.styles.transform!==null){var B=this.container.bounds.left+this.container.styles.transformOrigin[0].number,Q=this.container.bounds.top+this.container.styles.transformOrigin[1].number,V=this.container.styles.transform;this.effects.push(new Zp(B,Q,V))}if(this.container.styles.overflowX!==0){var tt=Tc(this.curves),lt=ys(this.curves);rl(tt,lt)?this.effects.push(new Oc(tt,6)):(this.effects.push(new Oc(tt,2)),this.effects.push(new Oc(lt,4)))}}return E.prototype.getEffects=function(m){for(var b=[2,3].indexOf(this.container.styles.position)===-1,B=this.parent,Q=this.effects.slice(0);B;){var V=B.effects.filter(function(at){return!Ju(at)});if(b||B.container.styles.position!==0||!B.parent){if(Q.unshift.apply(Q,V),b=[2,3].indexOf(B.container.styles.position)===-1,B.container.styles.overflowX!==0){var tt=Tc(B.curves),lt=ys(B.curves);rl(tt,lt)||Q.unshift(new Oc(lt,6))}}else Q.unshift.apply(Q,V);B=B.parent}return Q.filter(function(at){return Rr(at.target,m)})},E}(),Ri=function(E,m,b,B){E.container.elements.forEach(function(Q){var V=Rr(Q.flags,4),tt=Rr(Q.flags,2),lt=new il(Q,E);Rr(Q.styles.display,2048)&&B.push(lt);var at=Rr(Q.flags,8)?[]:B;if(V||tt){var bt=V||Q.styles.isPositioned()?b:m,St=new ws(lt);if(Q.styles.isPositioned()||Q.styles.opacity<1||Q.styles.isTransformed()){var Ut=Q.styles.zIndex.order;if(Ut<0){var Jt=0;bt.negativeZIndex.some(function(he,Be){return Ut>he.element.container.styles.zIndex.order?(Jt=Be,!1):Jt>0}),bt.negativeZIndex.splice(Jt,0,St)}else if(Ut>0){var Te=0;bt.positiveZIndex.some(function(he,Be){return Ut>=he.element.container.styles.zIndex.order?(Te=Be+1,!1):Te>0}),bt.positiveZIndex.splice(Te,0,St)}else bt.zeroOrAutoZIndexOrTransformedOrOpacity.push(St)}else Q.styles.isFloating()?bt.nonPositionedFloats.push(St):bt.nonPositionedInlineLevel.push(St);Ri(lt,St,V?St:b,at)}else Q.styles.isInlineLevel()?m.inlineLevel.push(lt):m.nonInlineLevel.push(lt),Ri(lt,m,b,at);Rr(Q.flags,8)&&nf(Q,at)})},nf=function(E,m){for(var b=E instanceof Zn?E.start:1,B=E instanceof Zn?E.reversed:!1,Q=0;Q0&&b.intrinsicHeight>0){var V=gA(b),tt=ys(B);this.path(tt),this.ctx.save(),this.ctx.clip(),this.ctx.drawImage(Q,0,0,b.intrinsicWidth,b.intrinsicHeight,V.left,V.top,V.width,V.height),this.ctx.restore()}},m.prototype.renderNodeContent=function(b){return W(this,void 0,void 0,function(){var B,Q,V,tt,lt,at,Le,Le,bt,St,Ut,Jt,An,Te,he,Ye,Be,rn,Ue,Le,Mn,An,Ye;return z(this,function(Fe){switch(Fe.label){case 0:this.applyEffects(b.getEffects(4)),B=b.container,Q=b.curves,V=B.styles,tt=0,lt=B.textNodes,Fe.label=1;case 1:return tt0&&Vr>0&&(xn=V.ctx.createPattern(Ye,"repeat"),V.renderRepeat(Or,xn,xi,oi))):_v(St)&&(We=Ic(b,B,[null,null,null]),Or=We[0],si=We[1],Di=We[2],zn=We[3],Vr=We[4],Xs=St.position.length===0?[jA]:St.position,xi=Gn(Xs[0],zn),oi=Gn(Xs[Xs.length-1],Vr),Es=_w(St,xi,oi,zn,Vr),Na=Es[0],Js=Es[1],Na>0&&Js>0&&(Mo=V.ctx.createRadialGradient(si+xi,Di+oi,0,si+xi,Di+oi,Na),Fv(St.stops,Na*2).forEach(function(Lc){return Mo.addColorStop(Lc.stop,ni(Lc.color))}),V.path(Or),V.ctx.fillStyle=Mo,Na!==Js?(Fo=b.bounds.left+.5*b.bounds.width,$a=b.bounds.top+.5*b.bounds.height,To=Js/Na,Bs=1/To,V.ctx.save(),V.ctx.translate(Fo,$a),V.ctx.transform(1,0,0,To,0,0),V.ctx.translate(-Fo,-$a),V.ctx.fillRect(si,Bs*(Di-$a)+$a,zn,Vr*Bs),V.ctx.restore()):V.ctx.fill())),Al.label=6;case 6:return B--,[2]}})},V=this,tt=0,lt=b.styles.backgroundImage.slice(0).reverse(),bt.label=1;case 1:return tt0?St.style!==2?[3,5]:[4,this.renderDashedDottedBorder(St.color,St.width,lt,b.curves,2)]:[3,11]):[3,13];case 4:return Jt.sent(),[3,11];case 5:return St.style!==3?[3,7]:[4,this.renderDashedDottedBorder(St.color,St.width,lt,b.curves,3)];case 6:return Jt.sent(),[3,11];case 7:return St.style!==4?[3,9]:[4,this.renderDoubleBorder(St.color,St.width,lt,b.curves)];case 8:return Jt.sent(),[3,11];case 9:return[4,this.renderSolidBorder(St.color,lt,b.curves)];case 10:Jt.sent(),Jt.label=11;case 11:lt++,Jt.label=12;case 12:return at++,[3,3];case 13:return[2]}})})},m.prototype.renderDashedDottedBorder=function(b,B,Q,V,tt){return W(this,void 0,void 0,function(){var lt,at,bt,St,Ut,Jt,Te,he,Be,rn,Ue,Le,Mn,An,Ye,Fe,Ye,Fe;return z(this,function(bn){return this.ctx.save(),lt=th(V,Q),at=_n(V,Q),tt===2&&(this.path(at),this.ctx.clip()),Nn(at[0])?(bt=at[0].start.x,St=at[0].start.y):(bt=at[0].x,St=at[0].y),Nn(at[1])?(Ut=at[1].end.x,Jt=at[1].end.y):(Ut=at[1].x,Jt=at[1].y),Q===0||Q===2?Te=Math.abs(bt-Ut):Te=Math.abs(St-Jt),this.ctx.beginPath(),tt===3?this.formatPath(lt):this.formatPath(at.slice(0,2)),he=B<3?B*3:B*2,Be=B<3?B*2:B,tt===3&&(he=B,Be=B),rn=!0,Te<=he*2?rn=!1:Te<=he*2+Be?(Ue=Te/(2*he+Be),he*=Ue,Be*=Ue):(Le=Math.floor((Te+Be)/(he+Be)),Mn=(Te-Le*he)/(Le-1),An=(Te-(Le+1)*he)/Le,Be=An<=0||Math.abs(Be-Mn)=0&&(T.splice instanceof Function||Object.getOwnPropertyDescriptor(T,T.length-1)&&T.constructor.name!=="String")}},23346:function(X,st,T){var I=T(93454),W=T(40911),z=I(W,"DataView");X.exports=z},22477:function(X,st,T){var I=T(93454),W=T(40911),z=I(W,"Promise");X.exports=z},73230:function(X,st,T){var I=T(93454),W=T(40911),z=I(W,"Set");X.exports=z},66643:function(X,st,T){var I=T(97800),W=T(81685),z=T(1324);function P(N){var G=-1,K=N==null?0:N.length;for(this.__data__=new I;++G-1}X.exports=W},90746:function(X){function st(T,I,W){for(var z=-1,P=T==null?0:T.length;++z0&&G(Z)?N>1?z(Z,N-1,G,K,_):I(_,Z):K||(_[_.length]=Z)}return _}X.exports=z},23543:function(X,st,T){var I=T(43294),W=T(66357);function z(P,N){return P&&I(P,N,W)}X.exports=z},96980:function(X,st,T){var I=T(89382),W=T(90370);function z(P,N){N=I(N,P);for(var G=0,K=N.length;P!=null&&GI}X.exports=st},11874:function(X){var st=Object.prototype,T=st.hasOwnProperty;function I(W,z){return W!=null&&T.call(W,z)}X.exports=I},4769:function(X){function st(T,I){return T!=null&&I in Object(T)}X.exports=st},17713:function(X,st,T){var I=T(33405),W=T(17406),z=T(68048);function P(N,G,K){return G===G?z(N,G,K):I(N,W,K)}X.exports=P},30433:function(X,st,T){var I=T(98317),W=T(71161);function z(P,N,G,K,_){return P===N?!0:P==null||N==null||!W(P)&&!W(N)?P!==P&&N!==N:I(P,N,G,K,z,_)}X.exports=z},98317:function(X,st,T){var I=T(26163),W=T(70670),z=T(23499),P=T(83544),N=T(29148),G=T(41594),K=T(33636),_=T(53745),H=1,J="[object Arguments]",Z="[object Array]",$="[object Object]",ct=Object.prototype,ht=ct.hasOwnProperty;function Ct(pt,ut,Bt,wt,Tt,kt){var _t=G(pt),Ot=G(ut),Gt=_t?Z:N(pt),ae=Ot?Z:N(ut);Gt=Gt==J?$:Gt,ae=ae==J?$:ae;var Wt=Gt==$,ie=ae==$,ve=Gt==ae;if(ve&&K(pt)){if(!K(ut))return!1;_t=!0,Wt=!1}if(ve&&!Wt)return kt||(kt=new I),_t||_(pt)?W(pt,ut,Bt,wt,Tt,kt):z(pt,ut,Gt,Bt,wt,Tt,kt);if(!(Bt&H)){var de=Wt&&ht.call(pt,"__wrapped__"),Oe=ie&&ht.call(ut,"__wrapped__");if(de||Oe){var sn=de?pt.value():pt,dn=Oe?ut.value():ut;return kt||(kt=new I),Tt(sn,dn,Bt,wt,kt)}}return ve?(kt||(kt=new I),P(pt,ut,Bt,wt,Tt,kt)):!1}X.exports=Ct},9961:function(X,st,T){var I=T(29148),W=T(71161),z="[object Map]";function P(N){return W(N)&&I(N)==z}X.exports=P},44626:function(X,st,T){var I=T(26163),W=T(30433),z=1,P=2;function N(G,K,_,H){var J=_.length,Z=J,$=!H;if(G==null)return!Z;for(G=Object(G);J--;){var ct=_[J];if($&&ct[2]?ct[1]!==G[ct[0]]:!(ct[0]in G))return!1}for(;++J=K){var Bt=J?null:N(H);if(Bt)return G(Bt);Ct=!1,ct=P,ut=new I}else ut=J?[]:pt;t:for(;++$P||_&&H&&Z&&!J&&!$||G&&H&&Z||!N&&Z||!K)return 1;if(!G&&!_&&!$&&z=J)return Z;var $=N[G];return Z*($=="desc"?-1:1)}}return z.index-P.index}X.exports=W},45280:function(X,st,T){var I=T(39408),W=T(69601);function z(P,N){return I(P,W(P),N)}X.exports=z},24299:function(X,st,T){var I=T(39408),W=T(72426);function z(P,N){return I(P,W(P),N)}X.exports=z},26503:function(X,st,T){var I=T(9015);function W(z,P){return function(N,G){if(N==null)return N;if(!I(N))return z(N,G);for(var K=N.length,_=P?K:-1,H=Object(N);(P?_--:++_-1?H[J?G[Z]:Z]:void 0}}X.exports=P},6651:function(X,st,T){var I=T(91018),W=T(20688),z=T(925);function P(N){return function(G,K,_){return _&&typeof _!="number"&&W(G,K,_)&&(K=_=void 0),G=z(G),K===void 0?(K=G,G=0):K=z(K),_=_===void 0?Ght))return!1;var pt=$.get(K),ut=$.get(_);if(pt&&ut)return pt==_&&ut==K;var Bt=-1,wt=!0,Tt=H&N?new I:void 0;for($.set(K,_),$.set(_,K);++Bt2?H[2]:void 0;for($&&z(H[0],H[1],$)&&(Z=1);++J1&&P(G,K[0],K[1])?K=[]:_>2&&P(K[0],K[1],K[2])&&(K=[K[0]]),W(G,I(K,1),[])});X.exports=N},57004:function(X){function st(){return[]}X.exports=st},925:function(X,st,T){var I=T(13933),W=1/0,z=17976931348623157e292;function P(N){if(!N)return N===0?N:0;if(N=I(N),N===W||N===-W){var G=N<0?-1:1;return G*z}return N===N?N:0}X.exports=P},46588:function(X,st,T){var I=T(925);function W(z){var P=I(z),N=P%1;return P===P?N?P-N:P:0}X.exports=W},13933:function(X,st,T){var I=T(8944),W=T(71721),z=T(66459),P=NaN,N=/^[-+]0x[0-9a-f]+$/i,G=/^0b[01]+$/i,K=/^0o[0-7]+$/i,_=parseInt;function H(J){if(typeof J=="number")return J;if(z(J))return P;if(W(J)){var Z=typeof J.valueOf=="function"?J.valueOf():J;J=W(Z)?Z+"":Z}if(typeof J!="string")return J===0?J:+J;J=I(J);var $=G.test(J);return $||K.test(J)?_(J.slice(2),$?2:8):N.test(J)?P:+J}X.exports=H},14135:function(X,st,T){var I=T(12580);function W(z){return z==null?"":I(z)}X.exports=W},61477:function(X,st,T){var I=T(22899),W=T(93511),z=T(23543),P=T(71499),N=T(13530),G=T(41594),K=T(33636),_=T(92581),H=T(71721),J=T(53745);function Z($,ct,ht){var Ct=G($),pt=Ct||K($)||J($);if(ct=P(ct,4),ht==null){var ut=$&&$.constructor;pt?ht=Ct?new ut:[]:H($)?ht=_(ut)?W(N($)):{}:ht={}}return(pt?I:z)($,function(Bt,wt,Tt){return ct(ht,Bt,wt,Tt)}),ht}X.exports=Z},99477:function(X,st,T){var I=T(27417),W=T(2440),z=T(75996),P=T(20577),N=W(function(G){return z(I(G,1,P,!0))});X.exports=N},69624:function(X,st,T){var I=T(14135),W=0;function z(P){var N=++W;return I(P)+N}X.exports=z},72834:function(X,st,T){var I=T(98030),W=T(66357);function z(P){return P==null?[]:I(P,W(P))}X.exports=z},79261:function(X,st,T){var I=T(78436),W=T(30232);function z(P,N){return W(P||[],N||[],I)}X.exports=z},34402:function(X,st,T){"use strict";T.r(st),T.d(st,{default:function(){return P}});var I=T(34634);function W(N){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,I.isAnyArray)(N))throw new TypeError("input must be an array");if(N.length===0)throw new TypeError("input must not be empty");var K=G.fromIndex,_=K===void 0?0:K,H=G.toIndex,J=H===void 0?N.length:H;if(_<0||_>=N.length||!Number.isInteger(_))throw new Error("fromIndex must be a positive integer smaller than length");if(J<=_||J>N.length||!Number.isInteger(J))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var Z=N[_],$=_+1;$Z&&(Z=N[$]);return Z}function z(N){var G=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!(0,I.isAnyArray)(N))throw new TypeError("input must be an array");if(N.length===0)throw new TypeError("input must not be empty");var K=G.fromIndex,_=K===void 0?0:K,H=G.toIndex,J=H===void 0?N.length:H;if(_<0||_>=N.length||!Number.isInteger(_))throw new Error("fromIndex must be a positive integer smaller than length");if(J<=_||J>N.length||!Number.isInteger(J))throw new Error("toIndex must be an integer greater than fromIndex and at most equal to length");for(var Z=N[_],$=_+1;$1&&arguments[1]!==void 0?arguments[1]:{};if((0,I.isAnyArray)(N)){if(N.length===0)throw new TypeError("input must not be empty")}else throw new TypeError("input must be an array");var K;if(G.output!==void 0){if(!(0,I.isAnyArray)(G.output))throw new TypeError("output option must be an array if specified");K=G.output}else K=new Array(N.length);var _=z(N),H=W(N);if(_===H)throw new RangeError("minimum and maximum input values are equal. Cannot rescale a constant array");var J=G.min,Z=J===void 0?G.autoMinMax?_:0:J,$=G.max,ct=$===void 0?G.autoMinMax?H:1:$;if(Z>=ct)throw new RangeError("min option must be smaller than max option");for(var ht=(ct-Z)/(H-_),Ct=0;Ct=0;be--)(ee=Pt[be])&&(Lt=(Mt<3?ee(Lt):Mt>3?ee(zt,jt,Lt):ee(zt,jt))||Lt);return Mt>3&&Lt&&Object.defineProperty(zt,jt,Lt),Lt}function G(Pt,zt){return function(jt,gt){zt(jt,gt,Pt)}}function K(Pt,zt,jt,gt,Mt,Lt){function ee(zr){if(zr!==void 0&&typeof zr!="function")throw new TypeError("Function expected");return zr}for(var be=gt.kind,_e=be==="getter"?"get":be==="setter"?"set":"value",Me=!zt&&Pt?gt.static?Pt:Pt.prototype:null,nn=zt||(Me?Object.getOwnPropertyDescriptor(Me,gt.name):{}),rr,or=!1,Ge=jt.length-1;Ge>=0;Ge--){var ze={};for(var me in gt)ze[me]=me==="access"?{}:gt[me];for(var me in gt.access)ze.access[me]=gt.access[me];ze.addInitializer=function(zr){if(or)throw new TypeError("Cannot add initializers after decoration has completed");Lt.push(ee(zr||null))};var Ve=(0,jt[Ge])(be==="accessor"?{get:nn.get,set:nn.set}:nn[_e],ze);if(be==="accessor"){if(Ve===void 0)continue;if(Ve===null||typeof Ve!="object")throw new TypeError("Object expected");(rr=ee(Ve.get))&&(nn.get=rr),(rr=ee(Ve.set))&&(nn.set=rr),(rr=ee(Ve.init))&&Mt.unshift(rr)}else(rr=ee(Ve))&&(be==="field"?Mt.unshift(rr):nn[_e]=rr)}Me&&Object.defineProperty(Me,gt.name,nn),or=!0}function _(Pt,zt,jt){for(var gt=arguments.length>2,Mt=0;Mt0&&Lt[Lt.length-1])&&(Me[0]===6||Me[0]===2)){jt=0;continue}if(Me[0]===3&&(!Lt||Me[1]>Lt[0]&&Me[1]=Pt.length&&(Pt=void 0),{value:Pt&&Pt[gt++],done:!Pt}}};throw new TypeError(zt?"Object is not iterable.":"Symbol.iterator is not defined.")}function ut(Pt,zt){var jt=typeof Symbol=="function"&&Pt[Symbol.iterator];if(!jt)return Pt;var gt=jt.call(Pt),Mt,Lt=[],ee;try{for(;(zt===void 0||zt-- >0)&&!(Mt=gt.next()).done;)Lt.push(Mt.value)}catch(be){ee={error:be}}finally{try{Mt&&!Mt.done&&(jt=gt.return)&&jt.call(gt)}finally{if(ee)throw ee.error}}return Lt}function Bt(){for(var Pt=[],zt=0;zt1||_e(Ge,me)})},ze&&(Mt[Ge]=ze(Mt[Ge])))}function _e(Ge,ze){try{Me(gt[Ge](ze))}catch(me){or(Lt[0][3],me)}}function Me(Ge){Ge.value instanceof kt?Promise.resolve(Ge.value.v).then(nn,rr):or(Lt[0][2],Ge)}function nn(Ge){_e("next",Ge)}function rr(Ge){_e("throw",Ge)}function or(Ge,ze){Ge(ze),Lt.shift(),Lt.length&&_e(Lt[0][0],Lt[0][1])}}function Ot(Pt){var zt,jt;return zt={},gt("next"),gt("throw",function(Mt){throw Mt}),gt("return"),zt[Symbol.iterator]=function(){return this},zt;function gt(Mt,Lt){zt[Mt]=Pt[Mt]?function(ee){return(jt=!jt)?{value:kt(Pt[Mt](ee)),done:!1}:Lt?Lt(ee):ee}:Lt}}function Gt(Pt){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var zt=Pt[Symbol.asyncIterator],jt;return zt?zt.call(Pt):(Pt=typeof pt=="function"?pt(Pt):Pt[Symbol.iterator](),jt={},gt("next"),gt("throw"),gt("return"),jt[Symbol.asyncIterator]=function(){return this},jt);function gt(Lt){jt[Lt]=Pt[Lt]&&function(ee){return new Promise(function(be,_e){ee=Pt[Lt](ee),Mt(be,_e,ee.done,ee.value)})}}function Mt(Lt,ee,be,_e){Promise.resolve(_e).then(function(Me){Lt({value:Me,done:be})},ee)}}function ae(Pt,zt){return Object.defineProperty?Object.defineProperty(Pt,"raw",{value:zt}):Pt.raw=zt,Pt}var Wt=Object.create?function(Pt,zt){Object.defineProperty(Pt,"default",{enumerable:!0,value:zt})}:function(Pt,zt){Pt.default=zt},ie=function(Pt){return ie=Object.getOwnPropertyNames||function(zt){var jt=[];for(var gt in zt)Object.prototype.hasOwnProperty.call(zt,gt)&&(jt[jt.length]=gt);return jt},ie(Pt)};function ve(Pt){if(Pt&&Pt.__esModule)return Pt;var zt={};if(Pt!=null)for(var jt=ie(Pt),gt=0;gt