(()=>{"use strict";var t={value:()=>{}};function n(){for(var t,n=0,e=arguments.length,i={};n=0&&(r=t.slice(e+1),t=t.slice(0,e)),t&&!n.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:r}}))}function i(t,n){for(var r,e=0,i=t.length;e0)for(var r,e,i=new Array(r),o=0;o=0&&n._call.call(null,t),n=n._next;--s}()}finally{s=0,function(){var t,n,r=a,e=1/0;for(;r;)r._call?(e>r._time&&(e=r._time),t=r,r=r._next):(n=r._next,r._next=null,r=t?t._next=n:a=n);f=t,A(e)}(),y=0}}function N(){var t=v.now(),n=t-c;n>1e3&&(x-=n,c=t)}function A(t){s||(l&&(l=clearTimeout(l)),t-y>24?(t<1/0&&(l=setTimeout(m,t-v.now()-x)),h&&(h=clearInterval(h))):(h||(c=v.now(),h=setInterval(N,1e3)),s=1,_(m)))}d.prototype=w.prototype={constructor:d,restart:function(t,n,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?g():+r)+(null==n?0:+n),this._next||f===this||(f?f._next=this:a=this,f=this),this._call=t,this._time=r,A()},stop:function(){this._call&&(this._call=null,this._time=1/0,A())}};const k=4294967296;var b=Math.PI*(3-Math.sqrt(5));function M(t){var n,r=1,e=.001,i=1-Math.pow(e,1/300),o=0,a=.6,f=new Map,s=w(c),l=u("tick","end"),h=function(){let t=1;return()=>(t=(1664525*t+1013904223)%k)/k}();function c(){y(),l.call("tick",n),r1?(null==r?f.delete(t):f.set(t,v(r)),n):f.get(t)},find:function(n,r,e){var i,o,u,a,f,s=0,l=t.length;for(null==e?e=1/0:e*=e,s=0;s1?(l.on(t,r),n):l.on(t)}}}function E(t){return function(){return t}}function q(t){return 1e-6*(t()-.5)}function z(t){return t.index}function T(t,n){var r=t.get(n);if(!r)throw new Error("node not found: "+n);return r}function j(t,n,r,e){if(isNaN(n)||isNaN(r))return t;var i,o,u,a,f,s,l,h,c,y=t._root,x={data:e},v=t._x0,_=t._y0,g=t._x1,p=t._y1;if(!y)return t._root=x,t;for(;y.length;)if((s=n>=(o=(v+g)/2))?v=o:g=o,(l=r>=(u=(_+p)/2))?_=u:p=u,i=y,!(y=y[h=l<<1|s]))return i[h]=x,t;if(a=+t._x.call(null,y.data),f=+t._y.call(null,y.data),n===a&&r===f)return x.next=y,i?i[h]=x:t._root=x,t;do{i=i?i[h]=new Array(4):t._root=new Array(4),(s=n>=(o=(v+g)/2))?v=o:g=o,(l=r>=(u=(_+p)/2))?_=u:p=u}while((h=l<<1|s)==(c=(f>=u)<<1|a>=o));return i[c]=y,i[h]=x,t}function D(t,n,r,e,i){this.node=t,this.x0=n,this.y0=r,this.x1=e,this.y1=i}function O(t){return t[0]}function P(t){return t[1]}function I(t,n,r){var e=new L(null==n?O:n,null==r?P:r,NaN,NaN,NaN,NaN);return null==t?e:e.addAll(t)}function L(t,n,r,e,i,o){this._x=t,this._y=n,this._x0=r,this._y0=e,this._x1=i,this._y1=o,this._root=void 0}function S(t){for(var n={data:t.data},r=n;t=t.next;)r=r.next={data:t.data};return n}var F=I.prototype=L.prototype;function R(t){return t.x+t.vx}function X(t){return t.y+t.vy}F.copy=function(){var t,n,r=new L(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root;if(!e)return r;if(!e.length)return r._root=S(e),r;for(t=[{source:e,target:r._root=new Array(4)}];e=t.pop();)for(var i=0;i<4;++i)(n=e.source[i])&&(n.length?t.push({source:n,target:e.target[i]=new Array(4)}):e.target[i]=S(n));return r},F.add=function(t){const n=+this._x.call(null,t),r=+this._y.call(null,t);return j(this.cover(n,r),n,r,t)},F.addAll=function(t){var n,r,e,i,o=t.length,u=new Array(o),a=new Array(o),f=1/0,s=1/0,l=-1/0,h=-1/0;for(r=0;rl&&(l=e),ih&&(h=i));if(f>l||s>h)return this;for(this.cover(f,s).cover(l,h),r=0;rt||t>=i||e>n||n>=o;)switch(a=(nc||(o=f.y0)>y||(u=f.x1)=g)<<1|t>=_)&&(f=x[x.length-1],x[x.length-1]=x[x.length-1-s],x[x.length-1-s]=f)}else{var p=t-+this._x.call(null,v.data),d=n-+this._y.call(null,v.data),w=p*p+d*d;if(w=(a=(x+_)/2))?x=a:_=a,(l=u>=(f=(v+g)/2))?v=f:g=f,n=y,!(y=y[h=l<<1|s]))return this;if(!y.length)break;(n[h+1&3]||n[h+2&3]||n[h+3&3])&&(r=n,c=h)}for(;y.data!==t;)if(e=y,!(y=y.next))return this;return(i=y.next)&&delete y.next,e?(i?e.next=i:delete e.next,this):n?(i?n[h]=i:delete n[h],(y=n[0]||n[1]||n[2]||n[3])&&y===(n[3]||n[2]||n[1]||n[0])&&!y.length&&(r?r[c]=y:this._root=y),this):(this._root=i,this)},F.removeAll=function(t){for(var n=0,r=t.length;n{const{nodes:n,edges:r,config:e}=t.data;!function(t,n,r){let{roots:e,secondLevelRoots:i}=function(t,n){const r={},e=t.reduce(((t,n)=>(t[n.id]=n,t)),{}),i=n.reduce(((t,n)=>{const r=n.source;return t[r]=[...t[r]||[],n],t}),{});let o=t.filter((t=>0===t.incoming));o.length||(o=[t[0]]);let u=o.reduce(((t,n)=>(t.push(...i[n.id]?i[n.id].map((t=>e[t.target])):[]),t)),[]);const a=300,f=200,s=200;let l=0;for(const t of o){let n=[t],o=0;for(;n.length>0;){const t=[];let u=l;for(const a of n)r[a.id]||(a.x=o,a.y=u,r[a.id]=!0,u+=f,i[a.id]&&t.push(...i[a.id].map((t=>e[t.target]))));n=t,o+=s,u=l}l+=a}return{roots:o,secondLevelRoots:u}}(t,n);[...e,...i].forEach(((t,n)=>{t.fx=t.x}));const o=M(t).force("link",function(t){var n,r,e,i,o,u,a=z,f=function(t){return 1/Math.min(i[t.source.index],i[t.target.index])},s=E(30),l=1;function h(e){for(var i=0,a=t.length;i[a(t,n,e),t])));for(u=0,i=new Array(s);ut.id)).distance(r.linkDistance).strength(r.linkStrength)).force("x",function(t){var n,r,e,i=E(.1);function o(t){for(var i,o=0,u=n.length;os+x||ol+x||uf.index){var v=s-a.x-a.vx,_=l-a.y-a.vy,g=v*v+_*_;gt.r&&(t.r=t[n].r)}function f(){if(n){var e,i,o=n.length;for(r=new Array(o),e=0;e(n.x>t.right&&(t.right=n.x),n.xt.bottom&&(t.bottom=n.y),n.y