@kineviz/gl 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +506 -0
- package/LICENSE +21 -201
- package/NOTICE +9 -1
- package/README.md +1 -1
- package/dist/WebGLForceLayoutController-P6NPZ7WK.mjs +1538 -0
- package/dist/builtins.css +2 -0
- package/dist/builtins.d.mts +61 -0
- package/dist/builtins.d.ts +61 -0
- package/dist/builtins.js +3815 -0
- package/dist/builtins.mjs +2 -0
- package/dist/chunk-4PNV55G2.mjs +394 -0
- package/dist/chunk-67FBXXN6.mjs +2875 -0
- package/dist/chunk-EHGKWZTS.mjs +2 -0
- package/dist/chunk-L6OXJ7GJ.mjs +1245 -0
- package/dist/{chunk-EDTCHJCZ.mjs → chunk-Y34RQAIU.mjs} +2 -2
- package/dist/core-X3TWUvT9.d.ts +934 -0
- package/dist/core-ueqhAojr.d.mts +934 -0
- package/dist/core.css +2 -0
- package/dist/core.d.mts +11 -0
- package/dist/core.d.ts +11 -0
- package/dist/core.js +6187 -0
- package/dist/core.mjs +2 -0
- package/dist/index.css +1 -1
- package/dist/index.d.mts +414 -20112
- package/dist/index.d.ts +414 -20112
- package/dist/index.js +5268 -3479
- package/dist/index.mjs +309 -4564
- package/dist/kineviz-gl.css +1 -1
- package/dist/kineviz-gl.umd.js +5268 -3761
- package/dist/layout-gpu.js +45 -45
- package/dist/layout-gpu.mjs +1 -1
- package/dist/registry-BIPi31x_.d.mts +19930 -0
- package/dist/registry-BIPi31x_.d.ts +19930 -0
- package/dist/schemas.js +1 -1
- package/dist/schemas.mjs +1 -1
- package/dist/{webgpu-YXDFF4ZT.mjs → webgpu-SY2OB4QP.mjs} +2 -2
- package/dist/world-rings-6GQ4OWZC.mjs +2 -0
- package/package.json +22 -3
- package/dist/chunk-3CR3GHJ2.mjs +0 -2
- package/dist/chunk-VTIPA7FV.mjs +0 -2
package/dist/chunk-VTIPA7FV.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
function nn(t){var e=0,n=t.children,i=n&&n.length;if(!i)e=1;else for(;--i>=0;)e+=n[i].value;t.value=e}function Ut(){return this.eachAfter(nn)}function Ot(t,e){let n=-1;for(let i of this)t.call(e,i,++n,this);return this}function Ht(t,e){for(var n=this,i=[n],r,s,a=-1;n=i.pop();)if(t.call(e,n,++a,this),r=n.children)for(s=r.length-1;s>=0;--s)i.push(r[s]);return this}function Gt(t,e){for(var n=this,i=[n],r=[],s,a,o,u=-1;n=i.pop();)if(r.push(n),s=n.children)for(a=0,o=s.length;a<o;++a)i.push(s[a]);for(;n=r.pop();)t.call(e,n,++u,this);return this}function Wt(t,e){let n=-1;for(let i of this)if(t.call(e,i,++n,this))return i}function Qt(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,i=e.children,r=i&&i.length;--r>=0;)n+=i[r].value;e.value=n})}function Kt(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function Jt(t){for(var e=this,n=rn(e,t),i=[e];e!==n;)e=e.parent,i.push(e);for(var r=i.length;t!==n;)i.splice(r,0,t),t=t.parent;return i}function rn(t,e){if(t===e)return t;var n=t.ancestors(),i=e.ancestors(),r=null;for(t=n.pop(),e=i.pop();t===e;)r=t,t=n.pop(),e=i.pop();return r}function te(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function ee(){return Array.from(this)}function ne(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function ie(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*re(){var t=this,e,n=[t],i,r,s;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,i=t.children)for(r=0,s=i.length;r<s;++r)n.push(i[r]);while(n.length)}function Mt(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=an)):e===void 0&&(e=on);for(var n=new W(t),i,r=[n],s,a,o,u;i=r.pop();)if((a=e(i.data))&&(u=(a=Array.from(a)).length))for(i.children=a,o=u-1;o>=0;--o)r.push(s=a[o]=new W(a[o])),s.parent=i,s.depth=i.depth+1;return n.eachBefore(kt)}function sn(){return Mt(this).eachBefore(un)}function on(t){return t.children}function an(t){return Array.isArray(t)?t[1]:null}function un(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function kt(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function W(t){this.data=t,this.depth=this.height=0,this.parent=null}W.prototype=Mt.prototype={constructor:W,count:Ut,each:Ot,eachAfter:Gt,eachBefore:Ht,find:Wt,sum:Qt,sort:Kt,path:Jt,ancestors:te,descendants:ee,leaves:ne,links:ie,copy:sn,[Symbol.iterator]:re};function dt(t){return t==null?null:ln(t)}function ln(t){if(typeof t!="function")throw new Error;return t}var fn={depth:-1},se={},zt={};function cn(t){return t.id}function hn(t){return t.parentId}function Nt(){var t=cn,e=hn,n;function i(r){var s=Array.from(r),a=t,o=e,u,f,l,h,d,m,p,g,x=new Map;if(n!=null){let c=s.map((_,v)=>pn(n(_,v,r))),w=c.map(oe),M=new Set(c).add("");for(let _ of w)M.has(_)||(M.add(_),c.push(_),w.push(oe(_)),s.push(zt));a=(_,v)=>c[v],o=(_,v)=>w[v]}for(l=0,u=s.length;l<u;++l)f=s[l],m=s[l]=new W(f),(p=a(f,l,r))!=null&&(p+="")&&(g=m.id=p,x.set(g,x.has(g)?se:m)),(p=o(f,l,r))!=null&&(p+="")&&(m.parent=p);for(l=0;l<u;++l)if(m=s[l],p=m.parent){if(d=x.get(p),!d)throw new Error("missing: "+p);if(d===se)throw new Error("ambiguous: "+p);d.children?d.children.push(m):d.children=[m],m.parent=d}else{if(h)throw new Error("multiple roots");h=m}if(!h)throw new Error("no root");if(n!=null){for(;h.data===zt&&h.children.length===1;)h=h.children[0],--u;for(let c=s.length-1;c>=0&&(m=s[c],m.data===zt);--c)m.data=null}if(h.parent=fn,h.eachBefore(function(c){c.depth=c.parent.depth+1,--u}).eachBefore(kt),h.parent=null,u>0)throw new Error("cycle");return h}return i.id=function(r){return arguments.length?(t=dt(r),i):t},i.parentId=function(r){return arguments.length?(e=dt(r),i):e},i.path=function(r){return arguments.length?(n=dt(r),i):n},i}function pn(t){t=`${t}`;let e=t.length;return It(t,e-1)&&!It(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function oe(t){let e=t.length;if(e<2)return"";for(;--e>1&&!It(t,e););return t.slice(0,e)}function It(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if((n&1)===0)return!0}return!1}function dn(t,e){return t.parent===e.parent?1:2}function St(t){var e=t.children;return e?e[0]:t.t}function At(t){var e=t.children;return e?e[e.length-1]:t.t}function mn(t,e,n){var i=n/(e.i-t.i);e.c-=i,e.s+=n,t.c+=i,e.z+=n,e.m+=n}function gn(t){for(var e=0,n=0,i=t.children,r=i.length,s;--r>=0;)s=i[r],s.z+=e,s.m+=e,e+=s.s+(n+=s.c)}function yn(t,e,n){return t.a.parent===e.parent?t.a:n}function mt(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}mt.prototype=Object.create(W.prototype);function xn(t){for(var e=new mt(t,0),n,i=[e],r,s,a,o;n=i.pop();)if(s=n._.children)for(n.children=new Array(o=s.length),a=o-1;a>=0;--a)i.push(r=n.children[a]=new mt(s[a],a)),r.parent=n;return(e.parent=new mt(null,0)).children=[e],e}function Dt(){var t=dn,e=1,n=1,i=null;function r(f){var l=xn(f);if(l.eachAfter(s),l.parent.m=-l.z,l.eachBefore(a),i)f.eachBefore(u);else{var h=f,d=f,m=f;f.eachBefore(function(w){w.x<h.x&&(h=w),w.x>d.x&&(d=w),w.depth>m.depth&&(m=w)});var p=h===d?1:t(h,d)/2,g=p-h.x,x=e/(d.x+p+g),c=n/(m.depth||1);f.eachBefore(function(w){w.x=(w.x+g)*x,w.y=w.depth*c})}return f}function s(f){var l=f.children,h=f.parent.children,d=f.i?h[f.i-1]:null;if(l){gn(f);var m=(l[0].z+l[l.length-1].z)/2;d?(f.z=d.z+t(f._,d._),f.m=f.z-m):f.z=m}else d&&(f.z=d.z+t(f._,d._));f.parent.A=o(f,d,f.parent.A||h[0])}function a(f){f._.x=f.z+f.parent.m,f.m+=f.parent.m}function o(f,l,h){if(l){for(var d=f,m=f,p=l,g=d.parent.children[0],x=d.m,c=m.m,w=p.m,M=g.m,_;p=At(p),d=St(d),p&&d;)g=St(g),m=At(m),m.a=f,_=p.z+w-d.z-x+t(p._,d._),_>0&&(mn(yn(p,f,h),f,_),x+=_,c+=_),w+=p.m,x+=d.m,M+=g.m,c+=m.m;p&&!At(m)&&(m.t=p,m.m+=w-c),d&&!St(g)&&(g.t=d,g.m+=x-M,h=f)}return h}function u(f){f.x*=e,f.y=f.depth*n}return r.separation=function(f){return arguments.length?(t=f,r):t},r.size=function(f){return arguments.length?(i=!1,e=+f[0],n=+f[1],r):i?null:[e,n]},r.nodeSize=function(f){return arguments.length?(i=!0,e=+f[0],n=+f[1],r):i?[e,n]:null},r}import*as lt from"lodash";function ae(t){let e=+this._x.call(null,t);return ue(this.cover(e),e,t)}function ue(t,e,n){if(isNaN(e))return t;var i,r=t._root,s={data:n},a=t._x0,o=t._x1,u,f,l,h,d;if(!r)return t._root=s,t;for(;r.length;)if((l=e>=(u=(a+o)/2))?a=u:o=u,i=r,!(r=r[h=+l]))return i[h]=s,t;if(f=+t._x.call(null,r.data),e===f)return s.next=r,i?i[h]=s:t._root=s,t;do i=i?i[h]=new Array(2):t._root=new Array(2),(l=e>=(u=(a+o)/2))?a=u:o=u;while((h=+l)==(d=+(f>=u)));return i[d]=r,i[h]=s,t}function le(t){Array.isArray(t)||(t=Array.from(t));let e=t.length,n=new Float64Array(e),i=1/0,r=-1/0;for(let s=0,a;s<e;++s)isNaN(a=+this._x.call(null,t[s]))||(n[s]=a,a<i&&(i=a),a>r&&(r=a));if(i>r)return this;this.cover(i).cover(r);for(let s=0;s<e;++s)ue(this,n[s],t[s]);return this}function fe(t){if(isNaN(t=+t))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(t))+1;else{for(var i=n-e||1,r=this._root,s,a;e>t||t>=n;)switch(a=+(t<e),s=new Array(2),s[a]=r,r=s,i*=2,a){case 0:n=e+i;break;case 1:e=n-i;break}this._root&&this._root.length&&(this._root=r)}return this._x0=e,this._x1=n,this}function ce(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function he(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function j(t,e,n){this.node=t,this.x0=e,this.x1=n}function pe(t,e){var n,i=this._x0,r,s,a=this._x1,o=[],u=this._root,f,l;for(u&&o.push(new j(u,i,a)),e==null?e=1/0:(i=t-e,a=t+e);f=o.pop();)if(!(!(u=f.node)||(r=f.x0)>a||(s=f.x1)<i))if(u.length){var h=(r+s)/2;o.push(new j(u[1],h,s),new j(u[0],r,h)),(l=+(t>=h))&&(f=o[o.length-1],o[o.length-1]=o[o.length-1-l],o[o.length-1-l]=f)}else{var d=Math.abs(t-+this._x.call(null,u.data));d<e&&(e=d,i=t-d,a=t+d,n=u.data)}return n}function de(t){if(isNaN(u=+this._x.call(null,t)))return this;var e,n=this._root,i,r,s,a=this._x0,o=this._x1,u,f,l,h,d;if(!n)return this;if(n.length)for(;;){if((l=u>=(f=(a+o)/2))?a=f:o=f,e=n,!(n=n[h=+l]))return this;if(!n.length)break;e[h+1&1]&&(i=e,d=h)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,r?(s?r.next=s:delete r.next,this):e?(s?e[h]=s:delete e[h],(n=e[0]||e[1])&&n===(e[1]||e[0])&&!n.length&&(i?i[d]=n:this._root=n),this):(this._root=s,this)}function me(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function ge(){return this._root}function ye(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function xe(t){var e=[],n,i=this._root,r,s,a;for(i&&e.push(new j(i,this._x0,this._x1));n=e.pop();)if(!t(i=n.node,s=n.x0,a=n.x1)&&i.length){var o=(s+a)/2;(r=i[1])&&e.push(new j(r,o,a)),(r=i[0])&&e.push(new j(r,s,o))}return this}function _e(t){var e=[],n=[],i;for(this._root&&e.push(new j(this._root,this._x0,this._x1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.x1,u=(a+o)/2;(s=r[0])&&e.push(new j(s,a,u)),(s=r[1])&&e.push(new j(s,u,o))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.x1);return this}function ve(t){return t[0]}function we(t){return arguments.length?(this._x=t,this):this._x}function K(t,e){var n=new bt(e??ve,NaN,NaN);return t==null?n:n.addAll(t)}function bt(t,e,n){this._x=t,this._x0=e,this._x1=n,this._root=void 0}function Me(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var Z=K.prototype=bt.prototype;Z.copy=function(){var t=new bt(this._x,this._x0,this._x1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=Me(e),t;for(n=[{source:e,target:t._root=new Array(2)}];e=n.pop();)for(var r=0;r<2;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(2)}):e.target[r]=Me(i));return t};Z.add=ae;Z.addAll=le;Z.cover=fe;Z.data=ce;Z.extent=he;Z.find=pe;Z.remove=de;Z.removeAll=me;Z.root=ge;Z.size=ye;Z.visit=xe;Z.visitAfter=_e;Z.x=we;function ke(t){let e=+this._x.call(null,t),n=+this._y.call(null,t);return ze(this.cover(e,n),e,n,t)}function ze(t,e,n,i){if(isNaN(e)||isNaN(n))return t;var r,s=t._root,a={data:i},o=t._x0,u=t._y0,f=t._x1,l=t._y1,h,d,m,p,g,x,c,w;if(!s)return t._root=a,t;for(;s.length;)if((g=e>=(h=(o+f)/2))?o=h:f=h,(x=n>=(d=(u+l)/2))?u=d:l=d,r=s,!(s=s[c=x<<1|g]))return r[c]=a,t;if(m=+t._x.call(null,s.data),p=+t._y.call(null,s.data),e===m&&n===p)return a.next=s,r?r[c]=a:t._root=a,t;do r=r?r[c]=new Array(4):t._root=new Array(4),(g=e>=(h=(o+f)/2))?o=h:f=h,(x=n>=(d=(u+l)/2))?u=d:l=d;while((c=x<<1|g)===(w=(p>=d)<<1|m>=h));return r[w]=s,r[c]=a,t}function Ie(t){var e,n,i=t.length,r,s,a=new Array(i),o=new Array(i),u=1/0,f=1/0,l=-1/0,h=-1/0;for(n=0;n<i;++n)isNaN(r=+this._x.call(null,e=t[n]))||isNaN(s=+this._y.call(null,e))||(a[n]=r,o[n]=s,r<u&&(u=r),r>l&&(l=r),s<f&&(f=s),s>h&&(h=s));if(u>l||f>h)return this;for(this.cover(u,f).cover(l,h),n=0;n<i;++n)ze(this,a[n],o[n],t[n]);return this}function Ne(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,i=this._y0,r=this._x1,s=this._y1;if(isNaN(n))r=(n=Math.floor(t))+1,s=(i=Math.floor(e))+1;else{for(var a=r-n||1,o=this._root,u,f;n>t||t>=r||i>e||e>=s;)switch(f=(e<i)<<1|t<n,u=new Array(4),u[f]=o,o=u,a*=2,f){case 0:r=n+a,s=i+a;break;case 1:n=r-a,s=i+a;break;case 2:r=n+a,i=s-a;break;case 3:n=r-a,i=s-a;break}this._root&&this._root.length&&(this._root=o)}return this._x0=n,this._y0=i,this._x1=r,this._y1=s,this}function Se(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t}function Ae(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function E(t,e,n,i,r){this.node=t,this.x0=e,this.y0=n,this.x1=i,this.y1=r}function De(t,e,n){var i,r=this._x0,s=this._y0,a,o,u,f,l=this._x1,h=this._y1,d=[],m=this._root,p,g;for(m&&d.push(new E(m,r,s,l,h)),n==null?n=1/0:(r=t-n,s=e-n,l=t+n,h=e+n,n*=n);p=d.pop();)if(!(!(m=p.node)||(a=p.x0)>l||(o=p.y0)>h||(u=p.x1)<r||(f=p.y1)<s))if(m.length){var x=(a+u)/2,c=(o+f)/2;d.push(new E(m[3],x,c,u,f),new E(m[2],a,c,x,f),new E(m[1],x,o,u,c),new E(m[0],a,o,x,c)),(g=(e>=c)<<1|t>=x)&&(p=d[d.length-1],d[d.length-1]=d[d.length-1-g],d[d.length-1-g]=p)}else{var w=t-+this._x.call(null,m.data),M=e-+this._y.call(null,m.data),_=w*w+M*M;if(_<n){var v=Math.sqrt(n=_);r=t-v,s=e-v,l=t+v,h=e+v,i=m.data}}return i}function be(t){if(isNaN(l=+this._x.call(null,t))||isNaN(h=+this._y.call(null,t)))return this;var e,n=this._root,i,r,s,a=this._x0,o=this._y0,u=this._x1,f=this._y1,l,h,d,m,p,g,x,c;if(!n)return this;if(n.length)for(;;){if((p=l>=(d=(a+u)/2))?a=d:u=d,(g=h>=(m=(o+f)/2))?o=m:f=m,e=n,!(n=n[x=g<<1|p]))return this;if(!n.length)break;(e[x+1&3]||e[x+2&3]||e[x+3&3])&&(i=e,c=x)}for(;n.data!==t;)if(r=n,!(n=n.next))return this;return(s=n.next)&&delete n.next,r?(s?r.next=s:delete r.next,this):e?(s?e[x]=s:delete e[x],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(i?i[c]=n:this._root=n),this):(this._root=s,this)}function Ce(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function Pe(){return this._root}function Ee(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t}function Te(t){var e=[],n,i=this._root,r,s,a,o,u;for(i&&e.push(new E(i,this._x0,this._y0,this._x1,this._y1));n=e.pop();)if(!t(i=n.node,s=n.x0,a=n.y0,o=n.x1,u=n.y1)&&i.length){var f=(s+o)/2,l=(a+u)/2;(r=i[3])&&e.push(new E(r,f,l,o,u)),(r=i[2])&&e.push(new E(r,s,l,f,u)),(r=i[1])&&e.push(new E(r,f,a,o,l)),(r=i[0])&&e.push(new E(r,s,a,f,l))}return this}function Fe(t){var e=[],n=[],i;for(this._root&&e.push(new E(this._root,this._x0,this._y0,this._x1,this._y1));i=e.pop();){var r=i.node;if(r.length){var s,a=i.x0,o=i.y0,u=i.x1,f=i.y1,l=(a+u)/2,h=(o+f)/2;(s=r[0])&&e.push(new E(s,a,o,l,h)),(s=r[1])&&e.push(new E(s,l,o,u,h)),(s=r[2])&&e.push(new E(s,a,h,l,f)),(s=r[3])&&e.push(new E(s,l,h,u,f))}n.push(i)}for(;i=n.pop();)t(i.node,i.x0,i.y0,i.x1,i.y1);return this}function Le(t){return t[0]}function Ye(t){return arguments.length?(this._x=t,this):this._x}function Be(t){return t[1]}function Xe(t){return arguments.length?(this._y=t,this):this._y}function J(t,e,n){var i=new Ct(e??Le,n??Be,NaN,NaN,NaN,NaN);return t==null?i:i.addAll(t)}function Ct(t,e,n,i,r,s){this._x=t,this._y=e,this._x0=n,this._y0=i,this._x1=r,this._y1=s,this._root=void 0}function Ze(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var L=J.prototype=Ct.prototype;L.copy=function(){var t=new Ct(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,n,i;if(!e)return t;if(!e.length)return t._root=Ze(e),t;for(n=[{source:e,target:t._root=new Array(4)}];e=n.pop();)for(var r=0;r<4;++r)(i=e.source[r])&&(i.length?n.push({source:i,target:e.target[r]=new Array(4)}):e.target[r]=Ze(i));return t};L.add=ke;L.addAll=Ie;L.cover=Ne;L.data=Se;L.extent=Ae;L.find=De;L.remove=be;L.removeAll=Ce;L.root=Pe;L.size=Ee;L.visit=Te;L.visitAfter=Fe;L.x=Ye;L.y=Xe;import{octree as vn}from"d3-octree";function D(t){return function(){return t}}function Y(t){return(t()-.5)*1e-6}function Pt(t){return t.x+t.vx}function qe(t){return t.y+t.vy}function wn(t){return t.z+t.vz}function Et(t){var e,n,i,r,s=1,a=1;typeof t!="function"&&(t=D(t==null?1:+t));function o(){for(var l,h=e.length,d,m,p,g,x,c,w,M=0;M<a;++M)for(d=(n===1?K(e,Pt):n===2?J(e,Pt,qe):n===3?vn(e,Pt,qe,wn):null).visitAfter(u),l=0;l<h;++l)m=e[l],c=i[m.index],w=c*c,p=m.x+m.vx,n>1&&(g=m.y+m.vy),n>2&&(x=m.z+m.vz),d.visit(_);function _(v,y,z,k,b,C,S){var I=[y,z,k,b,C,S],N=I[0],B=I[1],O=I[2],q=I[n],V=I[n+1],X=I[n+2],R=v.data,it=v.r,P=c+it;if(R){if(R.index>m.index){var A=p-R.x-R.vx,F=n>1?g-R.y-R.vy:0,$=n>2?x-R.z-R.vz:0,T=A*A+F*F+$*$;T<P*P&&(A===0&&(A=Y(r),T+=A*A),n>1&&F===0&&(F=Y(r),T+=F*F),n>2&&$===0&&($=Y(r),T+=$*$),T=(P-(T=Math.sqrt(T)))/T*s,m.vx+=(A*=T)*(P=(it*=it)/(w+it)),n>1&&(m.vy+=(F*=T)*P),n>2&&(m.vz+=($*=T)*P),R.vx-=A*(P=1-P),n>1&&(R.vy-=F*P),n>2&&(R.vz-=$*P))}return}return N>p+P||q<p-P||n>1&&(B>g+P||V<g-P)||n>2&&(O>x+P||X<x-P)}}function u(l){if(l.data)return l.r=i[l.data.index];for(var h=l.r=0;h<Math.pow(2,n);++h)l[h]&&l[h].r>l.r&&(l.r=l[h].r)}function f(){if(e){var l,h=e.length,d;for(i=new Array(h),l=0;l<h;++l)d=e[l],i[d.index]=+t(d,l,e)}}return o.initialize=function(l,...h){e=l,r=h.find(d=>typeof d=="function")||Math.random,n=h.find(d=>[1,2,3].includes(d))||2,f()},o.iterations=function(l){return arguments.length?(a=+l,o):a},o.strength=function(l){return arguments.length?(s=+l,o):s},o.radius=function(l){return arguments.length?(t=typeof l=="function"?l:D(+l),f(),o):t},o}function Mn(t){return t.index}function Re(t,e){var n=t.get(e);if(!n)throw new Error("node not found: "+e);return n}function Tt(t){var e=Mn,n=d,i,r=D(30),s,a,o,u,f,l,h=1;t==null&&(t=[]);function d(c){return 1/Math.min(u[c.source.index],u[c.target.index])}function m(c){for(var w=0,M=t.length;w<h;++w)for(var _=0,v,y,z,k=0,b=0,C=0,S,I;_<M;++_)v=t[_],y=v.source,z=v.target,k=z.x+z.vx-y.x-y.vx||Y(l),o>1&&(b=z.y+z.vy-y.y-y.vy||Y(l)),o>2&&(C=z.z+z.vz-y.z-y.vz||Y(l)),S=Math.sqrt(k*k+b*b+C*C),S=(S-s[_])/S*c*i[_],k*=S,b*=S,C*=S,z.vx-=k*(I=f[_]),o>1&&(z.vy-=b*I),o>2&&(z.vz-=C*I),y.vx+=k*(I=1-I),o>1&&(y.vy+=b*I),o>2&&(y.vz+=C*I)}function p(){if(a){var c,w=a.length,M=t.length,_=new Map(a.map((y,z)=>[e(y,z,a),y])),v;for(c=0,u=new Array(w);c<M;++c)v=t[c],v.index=c,typeof v.source!="object"&&(v.source=Re(_,v.source)),typeof v.target!="object"&&(v.target=Re(_,v.target)),u[v.source.index]=(u[v.source.index]||0)+1,u[v.target.index]=(u[v.target.index]||0)+1;for(c=0,f=new Array(M);c<M;++c)v=t[c],f[c]=u[v.source.index]/(u[v.source.index]+u[v.target.index]);i=new Array(M),g(),s=new Array(M),x()}}function g(){if(a)for(var c=0,w=t.length;c<w;++c)i[c]=+n(t[c],c,t)}function x(){if(a)for(var c=0,w=t.length;c<w;++c)s[c]=+r(t[c],c,t)}return m.initialize=function(c,...w){a=c,l=w.find(M=>typeof M=="function")||Math.random,o=w.find(M=>[1,2,3].includes(M))||2,p()},m.links=function(c){return arguments.length?(t=c,p(),m):t},m.id=function(c){return arguments.length?(e=c,m):e},m.iterations=function(c){return arguments.length?(h=+c,m):h},m.strength=function(c){return arguments.length?(n=typeof c=="function"?c:D(+c),g(),m):n},m.distance=function(c){return arguments.length?(r=typeof c=="function"?c:D(+c),x(),m):r},m}import{octree as Pn}from"d3-octree";var kn={value:()=>{}};function Ve(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new gt(n)}function gt(t){this._=t}function zn(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",r=n.indexOf(".");if(r>=0&&(i=n.slice(r+1),n=n.slice(0,r)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}gt.prototype=Ve.prototype={constructor:gt,on:function(t,e){var n=this._,i=zn(t+"",n),r,s=-1,a=i.length;if(arguments.length<2){for(;++s<a;)if((r=(t=i[s]).type)&&(r=In(n[r],t.name)))return r;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++s<a;)if(r=(t=i[s]).type)n[r]=$e(n[r],t.name,e);else if(e==null)for(r in n)n[r]=$e(n[r],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new gt(t)},call:function(t,e){if((r=arguments.length-2)>0)for(var n=new Array(r),i=0,r,s;i<r;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(s=this._[t],i=0,r=s.length;i<r;++i)s[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)}};function In(t,e){for(var n=0,i=t.length,r;n<i;++n)if((r=t[n]).name===e)return r.value}function $e(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=kn,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var Ft=Ve;var st=0,ct=0,ft=0,Ue=1e3,yt,ht,xt=0,tt=0,_t=0,pt=typeof performance=="object"&&performance.now?performance:Date,Oe=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Bt(){return tt||(Oe(Nn),tt=pt.now()+_t)}function Nn(){tt=0}function Lt(){this._call=this._time=this._next=null}Lt.prototype=vt.prototype={constructor:Lt,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Bt():+n)+(e==null?0:+e),!this._next&&ht!==this&&(ht?ht._next=this:yt=this,ht=this),this._call=t,this._time=n,Yt()},stop:function(){this._call&&(this._call=null,this._time=1/0,Yt())}};function vt(t,e,n){var i=new Lt;return i.restart(t,e,n),i}function He(){Bt(),++st;for(var t=yt,e;t;)(e=tt-t._time)>=0&&t._call.call(void 0,e),t=t._next;--st}function je(){tt=(xt=pt.now())+_t,st=ct=0;try{He()}finally{st=0,An(),tt=0}}function Sn(){var t=pt.now(),e=t-xt;e>Ue&&(_t-=e,xt=t)}function An(){for(var t,e=yt,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:yt=n);ht=t,Yt(i)}function Yt(t){if(!st){ct&&(ct=clearTimeout(ct));var e=t-tt;e>24?(t<1/0&&(ct=setTimeout(je,t-pt.now()-_t)),ft&&(ft=clearInterval(ft))):(ft||(xt=pt.now(),ft=setInterval(Sn,Ue)),st=1,Oe(je))}}function Ge(){let t=1;return()=>(t=(1664525*t+1013904223)%4294967296)/4294967296}var We=3;function wt(t){return t.x}function Xt(t){return t.y}function Qe(t){return t.z}var Dn=10,bn=Math.PI*(3-Math.sqrt(5)),Cn=Math.PI*20/(9+Math.sqrt(221));function Zt(t,e){e=e||2;var n=Math.min(We,Math.max(1,Math.round(e))),i,r=1,s=.001,a=1-Math.pow(s,1/300),o=0,u=.6,f=new Map,l=vt(m),h=Ft("tick","end"),d=Ge();t==null&&(t=[]);function m(){p(),h.call("tick",i),r<s&&(l.stop(),h.call("end",i))}function p(c){var w,M=t.length,_;c===void 0&&(c=1);for(var v=0;v<c;++v)for(r+=(o-r)*a,f.forEach(function(y){y(r)}),w=0;w<M;++w)_=t[w],_.fx==null?_.x+=_.vx*=u:(_.x=_.fx,_.vx=0),n>1&&(_.fy==null?_.y+=_.vy*=u:(_.y=_.fy,_.vy=0)),n>2&&(_.fz==null?_.z+=_.vz*=u:(_.z=_.fz,_.vz=0));return i}function g(){for(var c=0,w=t.length,M;c<w;++c){if(M=t[c],M.index=c,M.fx!=null&&(M.x=M.fx),M.fy!=null&&(M.y=M.fy),M.fz!=null&&(M.z=M.fz),isNaN(M.x)||n>1&&isNaN(M.y)||n>2&&isNaN(M.z)){var _=Dn*(n>2?Math.cbrt(.5+c):n>1?Math.sqrt(.5+c):c),v=c*bn,y=c*Cn;n===1?M.x=_:n===2?(M.x=_*Math.cos(v),M.y=_*Math.sin(v)):(M.x=_*Math.sin(v)*Math.cos(y),M.y=_*Math.cos(v),M.z=_*Math.sin(v)*Math.sin(y))}(isNaN(M.vx)||n>1&&isNaN(M.vy)||n>2&&isNaN(M.vz))&&(M.vx=0,n>1&&(M.vy=0),n>2&&(M.vz=0))}}function x(c){return c.initialize&&c.initialize(t,d,n),c}return g(),i={tick:p,restart:function(){return l.restart(m),i},stop:function(){return l.stop(),i},numDimensions:function(c){return arguments.length?(n=Math.min(We,Math.max(1,Math.round(c))),f.forEach(x),i):n},nodes:function(c){return arguments.length?(t=c,g(),f.forEach(x),i):t},alpha:function(c){return arguments.length?(r=+c,i):r},alphaMin:function(c){return arguments.length?(s=+c,i):s},alphaDecay:function(c){return arguments.length?(a=+c,i):+a},alphaTarget:function(c){return arguments.length?(o=+c,i):o},velocityDecay:function(c){return arguments.length?(u=1-c,i):1-u},randomSource:function(c){return arguments.length?(d=c,f.forEach(x),i):d},force:function(c,w){return arguments.length>1?(w==null?f.delete(c):f.set(c,x(w)),i):f.get(c)},find:function(){var c=Array.prototype.slice.call(arguments),w=c.shift()||0,M=(n>1?c.shift():null)||0,_=(n>2?c.shift():null)||0,v=c.shift()||1/0,y=0,z=t.length,k,b,C,S,I,N;for(v*=v,y=0;y<z;++y)I=t[y],k=w-I.x,b=M-(I.y||0),C=_-(I.z||0),S=k*k+b*b+C*C,S<v&&(N=I,v=S);return N},on:function(c,w){return arguments.length>1?(h.on(c,w),i):h.on(c)}}}function qt(){var t,e,n,i,r,s=D(-30),a,o=1,u=1/0,f=.81;function l(p){var g,x=t.length,c=(e===1?K(t,wt):e===2?J(t,wt,Xt):e===3?Pn(t,wt,Xt,Qe):null).visitAfter(d);for(r=p,g=0;g<x;++g)n=t[g],c.visit(m)}function h(){if(t){var p,g=t.length,x;for(a=new Array(g),p=0;p<g;++p)x=t[p],a[x.index]=+s(x,p,t)}}function d(p){var g=0,x,c,w=0,M,_,v,y,z=p.length;if(z){for(M=_=v=y=0;y<z;++y)(x=p[y])&&(c=Math.abs(x.value))&&(g+=x.value,w+=c,M+=c*(x.x||0),_+=c*(x.y||0),v+=c*(x.z||0));g*=Math.sqrt(4/z),p.x=M/w,e>1&&(p.y=_/w),e>2&&(p.z=v/w)}else{x=p,x.x=x.data.x,e>1&&(x.y=x.data.y),e>2&&(x.z=x.data.z);do g+=a[x.data.index];while(x=x.next)}p.value=g}function m(p,g,x,c,w){if(!p.value)return!0;var M=[x,c,w][e-1],_=p.x-n.x,v=e>1?p.y-n.y:0,y=e>2?p.z-n.z:0,z=M-g,k=_*_+v*v+y*y;if(z*z/f<k)return k<u&&(_===0&&(_=Y(i),k+=_*_),e>1&&v===0&&(v=Y(i),k+=v*v),e>2&&y===0&&(y=Y(i),k+=y*y),k<o&&(k=Math.sqrt(o*k)),n.vx+=_*p.value*r/k,e>1&&(n.vy+=v*p.value*r/k),e>2&&(n.vz+=y*p.value*r/k)),!0;if(p.length||k>=u)return;(p.data!==n||p.next)&&(_===0&&(_=Y(i),k+=_*_),e>1&&v===0&&(v=Y(i),k+=v*v),e>2&&y===0&&(y=Y(i),k+=y*y),k<o&&(k=Math.sqrt(o*k)));do p.data!==n&&(z=a[p.data.index]*r/k,n.vx+=_*z,e>1&&(n.vy+=v*z),e>2&&(n.vz+=y*z));while(p=p.next)}return l.initialize=function(p,...g){t=p,i=g.find(x=>typeof x=="function")||Math.random,e=g.find(x=>[1,2,3].includes(x))||2,h()},l.strength=function(p){return arguments.length?(s=typeof p=="function"?p:D(+p),h(),l):s},l.distanceMin=function(p){return arguments.length?(o=p*p,l):Math.sqrt(o)},l.distanceMax=function(p){return arguments.length?(u=p*p,l):Math.sqrt(u)},l.theta=function(p){return arguments.length?(f=p*p,l):Math.sqrt(f)},l}function Rt(t){var e=D(.1),n,i,r;typeof t!="function"&&(t=D(t==null?0:+t));function s(o){for(var u=0,f=n.length,l;u<f;++u)l=n[u],l.vx+=(r[u]-l.x)*i[u]*o}function a(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return s.initialize=function(o){n=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:D(+o),a(),s):e},s.x=function(o){return arguments.length?(t=typeof o=="function"?o:D(+o),a(),s):t},s}function $t(t){var e=D(.1),n,i,r;typeof t!="function"&&(t=D(t==null?0:+t));function s(o){for(var u=0,f=n.length,l;u<f;++u)l=n[u],l.vy+=(r[u]-l.y)*i[u]*o}function a(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return s.initialize=function(o){n=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:D(+o),a(),s):e},s.y=function(o){return arguments.length?(t=typeof o=="function"?o:D(+o),a(),s):t},s}function Vt(t){var e=D(.1),n,i,r;typeof t!="function"&&(t=D(t==null?0:+t));function s(o){for(var u=0,f=n.length,l;u<f;++u)l=n[u],l.vz+=(r[u]-l.z)*i[u]*o}function a(){if(n){var o,u=n.length;for(i=new Array(u),r=new Array(u),o=0;o<u;++o)i[o]=isNaN(r[o]=+t(n[o],o,n))?0:+e(n[o],o,n)}}return s.initialize=function(o){n=o,a()},s.strength=function(o){return arguments.length?(e=typeof o=="function"?o:D(+o),a(),s):e},s.z=function(o){return arguments.length?(t=typeof o=="function"?o:D(+o),a(),s):t},s}function Q(t){let e=0,n=0,i=0,r=0;for(let[,s]of t)e+=s[0],n+=s[1],i+=s[2],r++;return r===0?[0,0,0]:[e/r,n/r,i/r]}var nt=1;function U(t,e){let n=new Map;for(let i=0;i<t.nodes.length;i++)n.set(t.nodes[i].id,e[i]);return{positions:n}}function En(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=Q(t.positions),r=e?.spacing??nt,s=e?.radius??Math.max(r,n*r/(2*Math.PI)),a=Math.PI*2/n,o=[];for(let u=0;u<n;u++)o.push([s*Math.cos(u*a)+i[0],s*Math.sin(u*a)+i[1],0]);return U(t,o)}function Tn(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=Q(t.positions),r=e?.columns&&e.columns>0?e.columns:Math.ceil(Math.sqrt(n)),s=e?.spacing??nt,a=s*(r-1),o=[];for(let u=0;u<n;u++)o.push([u%r*s-a/2+i[0],-Math.floor(u/r)*s+a/2+i[1],0]);return U(t,o)}function Fn(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=Q(t.positions),r=e?.axis??"x",s=e?.spacing??nt,a=s*(n-1),o=[];for(let u=0;u<n;u++){let f=n>1?-a/2+u*s:0,l=[i[0],i[1],i[2]],h=r==="x"?0:r==="y"?1:2;l[h]=f+i[h],o.push(l)}return U(t,o)}function Ln(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=Q(t.positions),r=e?.spacing??1.5,s=r/(2*Math.PI),a=2*Math.PI,o=[];for(let u=0;u<n;u++){let f=s*a;o.push([f*Math.cos(a)+i[0],f*Math.sin(a)+i[1],0]),a+=r/f}return U(t,o)}function Yn(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=Q(t.positions),r=Math.cbrt(n),s=Math.floor(r),a=Math.ceil(r),o=e?.size??(n-Math.pow(s,3)>Math.pow(a,3)-n?a:s),u=e?.spacing??nt,f=u*Math.max(o-1,0),l=[];for(let h=0;h<n;h++)l.push([h%o*u-f/2+i[0],-(Math.floor(h/o)%o)*u+f/2+i[1],-Math.floor(h/(o*o))*u+f/2+i[2]]);return U(t,l)}function Bn(t,e){let n=t.nodes.length;if(n<=1){let u=new Map;return n===1&&u.set(t.nodes[0].id,t.positions.get(t.nodes[0].id)??[0,0,0]),{positions:u}}let i=Q(t.positions),r=e?.spacing??nt,s=e?.density!==void 0?Math.sqrt(n/(4*Math.PI*e.density)):r*Math.sqrt(n/(4*Math.PI)),a=e?.radius??Math.max(r,s),o=[];for(let u=0;u<n;u++){let f=Math.acos(1-(2*(u+1)-1)/n),l=Math.sqrt(n*Math.PI)*f;o.push([a*Math.sin(f)*Math.cos(l)+i[0],a*Math.sin(f)*Math.sin(l)+i[1],a*Math.cos(f)+i[2]])}return U(t,o)}function Xn(t,e){let n=t.nodes.length;if(n===0)return{positions:new Map};let i=e?.spacing??nt,r=e?.range??Math.max(i,i*Math.cbrt(n)/2),s=e?.seed??42;function a(){s|=0,s=s+1831565813|0;let u=Math.imul(s^s>>>15,1|s);return u=u+Math.imul(u^u>>>7,61|u)^u,((u^u>>>14)>>>0)/4294967296}let o=[];for(let u=0;u<n;u++)o.push([(a()-.5)*r*2,(a()-.5)*r*2,(a()-.5)*r*2]);return U(t,o)}function Zn(t,e){if(t.nodes.length===0)return{positions:new Map};let i=e?.axis??"x",r=(e?.degrees??90)*Math.PI/180,s=Q(t.positions),a=[];for(let o of t.nodes){let u=t.positions.get(o.id)??[0,0,0],f=u[0]-s[0],l=u[1]-s[1],h=u[2]-s[2],d,m,p,g=Math.cos(r),x=Math.sin(r);i==="x"?(d=f,m=l*g-h*x,p=l*x+h*g):i==="y"?(d=f*g+h*x,m=l,p=-f*x+h*g):(d=f*g-l*x,m=f*x+l*g,p=h),a.push([d+s[0],m+s[1],p+s[2]])}return U(t,a)}function qn(t,e){if(t.nodes.length===0)return{positions:new Map};let i=e?.factor,r=i??e?.x??1,s=i??e?.y??1,a=i??e?.z??1,o=Q(t.positions),u=[];for(let f of t.nodes){let l=t.positions.get(f.id)??[0,0,0];u.push([l[0]+(l[0]-o[0])*(r-1),l[1]+(l[1]-o[1])*(s-1),l[2]+(l[2]-o[2])*(a-1)])}return U(t,u)}function Rn(t,e){if(t.nodes.length===0)return{positions:new Map};let i=e?.x??0,r=e?.y??0,s=e?.z??0,a=[];for(let o of t.nodes){let u=t.positions.get(o.id)??[0,0,0];a.push([u[0]+i,u[1]+r,u[2]+s])}return U(t,a)}function $n(t,e){if(t.nodes.length===0)return{positions:new Map};let i=e?.axis??"x",r=i==="x"?0:i==="y"?1:2,s=1/0,a=-1/0;for(let f of t.nodes){let l=t.positions.get(f.id)??[0,0,0];l[r]<s&&(s=l[r]),l[r]>a&&(a=l[r])}let o=(s+a)/2,u=[];for(let f of t.nodes){let l=t.positions.get(f.id)??[0,0,0],h=[l[0],l[1],l[2]];h[r]=o,u.push(h)}return U(t,u)}function Vn(t,e){let{depth:n=100,mode:i="tree",orientation:r="right",alongRelationships:s=[]}=e??{},a=e?.spacing??nt,o=e?.spacing===void 0?e?.edgeLength:void 0,u=t.nodes;if(u.length===0)return{positions:new Map};let f=new Set;for(let[y]of t.positions)f.add(y);let l=new Map,h=new Map;for(let y of t.edges)!f.has(y.source)||!f.has(y.target)||(h.set(y.id,y),l.has(y.source)||l.set(y.source,[]),l.has(y.target)||l.set(y.target,[]),l.get(y.source).push({nodeId:y.target,relationship:y.relationship}),l.get(y.target).push({nodeId:y.source,relationship:y.relationship}));let d=s.length>0?new Set(Array.from(l.entries()).filter(([,y])=>y.some(({relationship:z})=>s.includes(z))).map(([y])=>y)):f,m=u.filter(y=>d.has(y.id));if(m.length===0)return{positions:new Map};let p=new Map,g=m.map(y=>[{from:"",to:y.id}]),x=m.map(y=>[[y.id]]),c=m.map(()=>1),w=m.map(()=>[1]),M=m.map(y=>y.id),_=1;for(;_<=n&<.sum(x.map(y=>y[_-1]?.length??0))>0;)x.forEach((y,z)=>{let k=y[_-1];if(!k)return;let b=[];k.forEach(C=>{let S=l.get(C)??[],I=S.map(({nodeId:N})=>N);s.length>0&&(I=S.filter(({relationship:N})=>s.includes(N)).map(({nodeId:N})=>N)),I=lt.difference(lt.intersection(I,Array.from(d)),M),I.forEach(N=>{g[z].push({from:C,to:N}),b.push(N),M.push(N)})}),y[_]=b,b.length>0&&(w[z].push(b.length),c[z]++)}),_++;let v=Nt().id(y=>y.to).parentId(y=>y.from||null);return m.forEach((y,z)=>{let k=t.positions.get(y.id)??[0,0,0];if(g[z].length<=1){p.set(y.id,[k[0],k[1],k[2]]);return}let b;try{b=v(g[z])}catch{p.set(y.id,[k[0],k[1],k[2]]);return}let C=Math.max(...w[z],1),S=Math.max(c[z]-1,1),I=Math.max(C-1,1),N,B;i==="rings"?(N=2*Math.PI,o!==void 0?B=o*S:B=Math.max(a,a*C/(2*Math.PI))):o!==void 0?(N=o*C*.2*Math.pow(c[z],.3),B=o*S):(N=a*I,B=a*S);let q=Dt().size([N,B])(b);Je(i,r,q,q,k,p)}),{positions:p}}function Je(t,e,n,i,r,s){let a=i.id,o,u;if(t==="tree")switch(e){case"up":o=i.x+r[0]-n.x,u=i.y+r[1]+n.y;break;case"down":o=-i.x+r[0]+n.x,u=-i.y+r[1]-n.y;break;case"right":o=i.y+r[0]-n.y,u=-i.x+r[1]+n.x;break;case"left":o=-i.y+r[0]+n.y,u=i.x+r[1]-n.x;break}else switch(e){case"down":o=r[0]+i.y*Math.cos(i.x+Math.PI/2),u=r[1]+i.y*Math.sin(i.x+Math.PI/2);break;case"up":o=r[0]+i.y*Math.cos(i.x+3*Math.PI/2),u=r[1]+i.y*Math.sin(i.x+3*Math.PI/2);break;case"right":o=r[0]+i.y*Math.cos(i.x+Math.PI),u=r[1]+i.y*Math.sin(i.x+Math.PI);break;case"left":o=r[0]+i.y*Math.cos(i.x),u=r[1]+i.y*Math.sin(i.x);break}if(s.set(a,[o,u,r[2]]),i.children)for(let f of i.children)Je(t,e,n,f,r,s)}function et(t){if(t==null)return null;let e=Number(t);return Number.isNaN(e)?null:e}function ot(t,e,n){let[i,r]=e,[s,a]=n;return r===i?(s+a)/2:s+(t-i)/(r-i)*(a-s)}function at(t,e,n){let i=Math.max(e[0],1e-10),r=Math.max(e[1],1e-10),s=Math.max(t,1e-10),[a,o]=n;return r===i?(a+o)/2:a+(Math.log(s)-Math.log(i))/(Math.log(r)-Math.log(i))*(o-a)}function jn(t,e,n){let i=n??et,r=1/0,s=-1/0;for(let a of t){let o=a.properties?.[e],u=i(o);u!=null&&(u<r&&(r=u),u>s&&(s=u))}return r===1/0?[0,1]:r===s?[r-1,s+1]:[r,s]}function Un(t,e=5){let[n,i]=t,r=i-n;if(r===0)return[n-1,i+1];let s=r/e,a=Math.pow(10,Math.floor(Math.log10(s))),o=s/a,u;return o<=1.5?u=a:o<=3.5?u=2*a:o<=7.5?u=5*a:u=10*a,[Math.floor(n/u)*u,Math.ceil(i/u)*u]}function On(t,e=5){let[n,i]=t;if(n===i)return[n];let s=(i-n)/e,a=Math.pow(10,Math.floor(Math.log10(s))),o=s/a,u;o<=1.5?u=a:o<=3.5?u=2*a:o<=7.5?u=5*a:u=10*a;let f=Math.ceil(n/u)*u,l=[];for(let h=f;h<=i+u*.001;h+=u)l.push(Math.round(h*1e10)/1e10);return l}var jt=[{name:"1s",ms:1e3},{name:"5s",ms:5e3},{name:"15s",ms:15e3},{name:"30s",ms:3e4},{name:"1m",ms:6e4},{name:"5m",ms:3e5},{name:"15m",ms:9e5},{name:"30m",ms:18e5},{name:"1h",ms:36e5},{name:"3h",ms:108e5},{name:"6h",ms:216e5},{name:"12h",ms:432e5},{name:"1d",ms:864e5},{name:"3d",ms:2592e5},{name:"1w",ms:6048e5},{name:"1mo",ms:2592e6,calendarUnit:"month",calendarStep:1},{name:"3mo",ms:7776e6,calendarUnit:"month",calendarStep:3},{name:"6mo",ms:15552e6,calendarUnit:"month",calendarStep:6},{name:"1y",ms:31536e6,calendarUnit:"year",calendarStep:1},{name:"2y",ms:63072e6,calendarUnit:"year",calendarStep:2},{name:"5y",ms:15768e7,calendarUnit:"year",calendarStep:5},{name:"10y",ms:31536e7,calendarUnit:"year",calendarStep:10},{name:"20y",ms:63072e7,calendarUnit:"year",calendarStep:20},{name:"50y",ms:15768e8,calendarUnit:"year",calendarStep:50}];function Hn(t,e=5){let[n,i]=t,r=i-n;if(r<=0)return[n];let s=r/e,a=jt[jt.length-1];for(let u of jt)if(u.ms>=s*.6){a=u;break}let o=[];if(a.calendarUnit==="year"){let u=a.calendarStep,f=new Date(n),l=Math.ceil(f.getFullYear()/u)*u;for(;;){let h=new Date(l,0,1).getTime();if(h>i)break;h>=n&&o.push(h),l+=u}}else if(a.calendarUnit==="month"){let u=a.calendarStep,f=new Date(n),l=f.getFullYear(),h=Math.ceil(f.getMonth()/u)*u;for(;;){let d=new Date(l,h,1).getTime();if(d>i)break;d>=n&&o.push(d),h+=u,h>=12&&(l+=Math.floor(h/12),h=h%12)}}else{let u=a.ms,f=Math.ceil(n/u)*u;for(let l=f;l<=i;l+=u)o.push(l)}return o}function Gn(t,e){let n=e[1]-e[0],i=new Date(t);return n>365*864e5*2?String(i.getFullYear()):n>60*864e5?`${i.getFullYear()}-${String(i.getMonth()+1).padStart(2,"0")}`:n>2*864e5?`${i.getMonth()+1}/${i.getDate()}`:n>2*36e5?`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`:`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}:${String(i.getSeconds()).padStart(2,"0")}`}function ut(t,e,n){let i=t.domain??jn(e,t.property,t.parse);t.nice&&!t.domain&&(i=Un(i,t.tickCount));let s=(i[1]-i[0])*n,a=[i[0]-s,i[1]+s],o;t.tickValues?o=t.tickValues:t.isDate?o=Hn(i,t.tickCount):o=On(i,t.tickCount);let u=t.tickFormat;return!u&&t.isDate&&(u=f=>Gn(f,i)),{axisInfo:{property:t.property,label:t.property,domain:a,ticks:o,scale:t.scale,tickFormat:u},paddedDomain:a}}function Wn(t,e){let{propertyX:n,propertyY:i,propertyZ:r,range:s=[-2,2],scaleX:a="linear",scaleY:o="linear",scaleZ:u="linear",padding:f=.05}=e,l=e.parseX??et,h=e.parseY??et,d=e.parseZ??et,m=!!n,p=!!i,g=!!r,x=t.nodes,c=new Map,w=new Set,M=[];for(let N of x){let B=0,O=0,q=0,V=!1;if(m){let X=l(N.properties?.[n]);X==null?V=!0:B=X}if(p&&!V){let X=h(N.properties?.[i]);X==null?V=!0:O=X}if(g&&!V){let X=d(N.properties?.[r]);X==null?V=!0:q=X}V?w.add(N.id):M.push({id:N.id,x:B,y:O,z:q})}let _=m?ut({property:n,scale:a,domain:e.domainX,parse:l,tickFormat:e.tickFormatX,tickCount:e.tickCountX??5,tickValues:e.tickValuesX,nice:e.niceX??!0,isDate:e.dateAxisX??!1},x,f):null,v=p?ut({property:i,scale:o,domain:e.domainY,parse:h,tickFormat:e.tickFormatY,tickCount:e.tickCountY??5,tickValues:e.tickValuesY,nice:e.niceY??!0,isDate:e.dateAxisY??!1},x,f):null,y=g?ut({property:r,scale:u,domain:e.domainZ,parse:d,tickFormat:e.tickFormatZ,tickCount:e.tickCountZ??5,tickValues:e.tickValuesZ,nice:e.niceZ??!0,isDate:e.dateAxisZ??!1},x,f):null,z=a==="log"?at:ot,k=o==="log"?at:ot,b=u==="log"?at:ot,C=e.spread??1,S=[s[0]*C,s[1]*C],I=s[0];for(let N of M){let B=_?z(N.x,_.paddedDomain,S):I,O=v?k(N.y,v.paddedDomain,S):I,q=y?b(N.z,y.paddedDomain,S):0;c.set(N.id,[B,O,q])}return{positions:c,axes:{x:_?.axisInfo,y:v?.axisInfo,z:y?.axisInfo},range:S,baseRange:s,excludedNodeIds:w}}function Qn(t,e){let n=e.range??[-2,2],i=e.spread??1,r=[n[0]*i,n[1]*i],s=e.padding??.05,a=n[0],o=e.unmappedMode??"hide",u=new Map;for(let m of e.mappings)u.set(m.category,m);let f=new Map;for(let m of t.nodes){let p=m.category,g=f.get(p);g||(g=[],f.set(p,g)),g.push(m)}let l=new Map,h=new Set,d={};for(let[m,p]of f){let g=u.get(m);if(!g){if(o==="hide")for(let A of p)h.add(A.id);else{let A;o==="boundary"?A=n[0]:A=(n[0]+n[1])/2;for(let F of p)l.set(F.id,[A,A,0])}continue}let x=!!g.propertyX,c=!!g.propertyY,w=!!g.propertyZ,M=g.scaleX??"linear",_=g.scaleY??"linear",v=g.scaleZ??"linear",y=g.parseX??et,z=g.parseY??et,k=g.parseZ??et,b=g.tickCountX??e.tickCountX??5,C=g.tickCountY??e.tickCountY??5,S=g.tickCountZ??e.tickCountZ??5,I=g.niceX??e.niceX??!0,N=g.niceY??e.niceY??!0,B=g.niceZ??e.niceZ??!0,O=[];for(let A of p){let F=0,$=0,T=0,rt=!1;if(x){let G=y(A.properties?.[g.propertyX]);G==null?rt=!0:F=G}if(c&&!rt){let G=z(A.properties?.[g.propertyY]);G==null?rt=!0:$=G}if(w&&!rt){let G=k(A.properties?.[g.propertyZ]);G==null?rt=!0:T=G}rt?h.add(A.id):O.push({id:A.id,x:F,y:$,z:T})}let q=x?ut({property:g.propertyX,scale:M,domain:g.domainX,parse:y,tickFormat:g.tickFormatX,tickCount:b,tickValues:g.tickValuesX,nice:I,isDate:g.dateAxisX??!1},p,s):null,V=c?ut({property:g.propertyY,scale:_,domain:g.domainY,parse:z,tickFormat:g.tickFormatY,tickCount:C,tickValues:g.tickValuesY,nice:N,isDate:g.dateAxisY??!1},p,s):null,X=w?ut({property:g.propertyZ,scale:v,domain:g.domainZ,parse:k,tickFormat:g.tickFormatZ,tickCount:S,tickValues:g.tickValuesZ,nice:B,isDate:g.dateAxisZ??!1},p,s):null,R=M==="log"?at:ot,it=_==="log"?at:ot,P=v==="log"?at:ot;for(let A of O){let F=q?R(A.x,q.paddedDomain,r):a,$=V?it(A.y,V.paddedDomain,r):a,T=X?P(A.z,X.paddedDomain,r):0;l.set(A.id,[F,$,T])}d[m]={x:q?.axisInfo,y:V?.axisInfo,z:X?.axisInfo}}return{positions:l,axes:{x:void 0,y:void 0,z:void 0},range:r,baseRange:n,excludedNodeIds:h,categoryAxes:d}}var Kn=/^[a-z][a-zA-Z0-9]*$/,Jn=/^[a-z][a-z0-9-]*:[A-Za-z][A-Za-z0-9_-]*$/,ti=class tn{constructor(){this.entries=new Map}register(e,n,i={}){if(!Jn.test(e))throw new Error(`[LayoutRegistry] invalid layout name "${e}": extension layouts must be named "<pack>:<name>" (e.g. "acme:rack")`);return this.add(e,n,!1,i)}registerBuiltin(e,n,i){if(!Kn.test(e))throw new Error(`[LayoutRegistry] invalid built-in layout name "${e}"`);this.add(e,n,!0,{description:i})}add(e,n,i,r){if(typeof n!="function")throw new Error(`[LayoutRegistry] layout "${e}" must be a function`);let s=this.entries.get(e);if(s&&(s.builtin||!r.replace))throw new Error(`[LayoutRegistry] layout "${e}" is already registered`);let a={name:e,fn:n,builtin:i,description:r.description};return this.entries.set(e,a),()=>{this.entries.get(e)===a&&this.entries.delete(e)}}has(e){return this.entries.has(e)}get(e){return this.entries.get(e)}list(){let e=[...this.entries.values()];return[...e.filter(n=>n.builtin),...e.filter(n=>!n.builtin)]}execute(e,n,i){let r=this.entries.get(e);if(!r)throw new Error(`[LayoutRegistry] unknown layout "${e}". Registered: ${[...this.entries.keys()].join(", ")}`);return r.fn(n,i)}fork(){let e=new tn;for(let[n,i]of this.entries)e.entries.set(n,i);return e}};function ei(){let t=new ti;return t.registerBuiltin("circle",En,"Nodes on a circle."),t.registerBuiltin("grid",Tn,"Nodes on a 2-D grid."),t.registerBuiltin("line",Fn,"Nodes along an axis."),t.registerBuiltin("spiral",Ln,"Nodes on a spiral."),t.registerBuiltin("cube",Yn,"Nodes in a 3-D lattice."),t.registerBuiltin("sphere",Bn,"Nodes on a sphere."),t.registerBuiltin("scatter",Xn,"Nodes scattered randomly in a range."),t.registerBuiltin("ego",Vn,"Tree or rings around root node(s)."),t.registerBuiltin("rotate",Zn,"Rotate current positions (transform)."),t.registerBuiltin("scale",qn,"Scale current positions (transform)."),t.registerBuiltin("shift",Rn,"Translate current positions (transform)."),t.registerBuiltin("alignBy",$n,"Align nodes by an axis (transform)."),t.registerBuiltin("plotScatter",Wn,"Scatter plot by two properties."),t.registerBuiltin("plotMultiCategoryScatter",Qn,"Scatter plot with category axes."),t}var en=ei();function Es(){return en.fork()}function Ts(t,e){let n=en.get(e.type);return n?n.fn(t,e.options):{positions:new Map}}var ni={linear:t=>t,easeIn:t=>t*t,easeOut:t=>t*(2-t),easeInOut:t=>t<.5?2*t*t:-1+(4-2*t)*t},Fs=class{constructor(t,e,n){this._done=!1,this.startPositions=t,this.endPositions=e,this.startTime=performance.now(),this.duration=n?.duration??800,this.easingFn=ni[n?.easing??"easeInOut"],this.onComplete=n?.onComplete}get done(){return this._done}tick(t){let e=t-this.startTime,n=Math.min(e/this.duration,1),i=this.easingFn(n),r=new Map;for(let[s,a]of this.endPositions){let o=this.startPositions.get(s)??a;r.set(s,[o[0]+(a[0]-o[0])*i,o[1]+(a[1]-o[1])*i,o[2]+(a[2]-o[2])*i])}return n>=1&&!this._done&&(this._done=!0,this.onComplete?.()),r}},Ls=class{constructor(t,e,n={}){this.mode="cpu",this._status="idle",this._snapshot=null,this._positions=new Map,this._listeners=new Map,this._tickCount=0,this.id=t,this.compute=e,this._settings={dimensions:3,...n}}get status(){return this._status}getCapabilities(){return{mode:this.mode,supportsGpuTexture:!1,supportsCpuReadback:!0,supportsIncrementalDelta:!1,supportsPinning:!1,supportsDimensions:!0}}init(t,e){this._status!=="disposed"&&(this._snapshot=t,e&&(this._settings={...this._settings,...e}),this._positions=this.compute(this._snapshot,this._settings),this._status="idle")}applyDelta(t){if(!(!this._snapshot||this._status==="disposed")&&t.positionPatches){for(let e of t.positionPatches)this._positions.set(e.id,e.position);this._emit("positionsChanged",{nodeIds:t.positionPatches.map(e=>e.id)})}}tick(t){return this._tickCount++,{tick:this._tickCount,didChangePositions:!1,alpha:0}}start(){this._status!=="disposed"&&(this._status="running",this._emit("started",{}),this._status="stopped",this._emit("settled",{}))}stop(){this._status!=="disposed"&&(this._status="stopped",this._emit("stopped",{}))}dispose(){this._status="disposed",this._positions.clear(),this._snapshot=null,this._listeners.clear()}getSettings(){return{...this._settings}}updateSettings(t){this._settings={...this._settings,...t},this._snapshot&&this._status!=="disposed"&&(this._positions=this.compute(this._snapshot,this._settings),this._emit("positionsChanged",{}))}setDimensions(t){this.updateSettings({dimensions:t})}getReadback(){if(!this._snapshot)return{positions:null};let t=this._snapshot.nodes.length,e=new Float32Array(t*3);for(let n=0;n<t;n++){let i=this._snapshot.nodes[n].id,r=this._positions.get(i);r&&(e[n*3]=r.x,e[n*3+1]=r.y,e[n*3+2]=r.z)}return{positions:e}}getNodePosition(t){return this._positions.get(t)??null}setNodePosition(t,e){this._status!=="disposed"&&(this._positions.set(t,e),this._emit("positionsChanged",{nodeIds:[t]}))}pinNodes(t){}unpinNodes(t){}on(t,e){return this._listeners.has(t)||this._listeners.set(t,new Set),this._listeners.get(t).add(e),()=>this._listeners.get(t)?.delete(e)}_emit(t,e){this._listeners.get(t)?.forEach(n=>n(e))}};function Ke(t,e){let n=new Map(t.nodes.map(a=>[a.id,{...a}])),i=new Map(t.edges.map(a=>[a.id,{...a}]));for(let a of e.addNodes??[])n.set(a.id,a);for(let a of e.addEdges??[])i.set(a.id,a);for(let a of e.updateNodes??[]){let o=n.get(a.id);o&&n.set(a.id,{...o,...a.changes})}for(let a of e.updateEdges??[]){let o=i.get(a.id);o&&i.set(a.id,{...o,...a.changes})}for(let a of e.removeNodeIds??[])n.delete(a);for(let a of e.removeEdgeIds??[])i.delete(a);for(let a of e.positionPatches??[]){let o=n.get(a.id);o&&n.set(a.id,{...o,position:a.position})}for(let a of e.pinPatches??[]){let o=n.get(a.id);if(o){let u={...o,pinned:a.pinned};a.position&&(u.position=a.position),n.set(a.id,u)}}let r=Array.from(n.values()).map((a,o)=>({...a,index:o})),s=Array.from(i.values()).map((a,o)=>({...a,index:o}));return{...t,version:e.graphVersion,nodes:r,edges:s}}var H={dimensions:3,alpha:.6,alphaDecay:.1,velocityDecay:.3,charge:-.01,gravity:.1,collision:.15,linkDistance:.5,linkStrength:1,warmupTicks:0},Bs=class{constructor(t,e={}){this.mode="cpu",this._status="idle",this._snapshot=null,this._tickCount=0,this._listeners=new Map,this._simulation=null,this._simNodes=[],this._nodeIdToIndex=new Map,this._positions=new Float32Array(0),this.id=t,this._settings={...H,...e}}get status(){return this._status}getCapabilities(){return{mode:"cpu",supportsGpuTexture:!1,supportsCpuReadback:!0,supportsIncrementalDelta:!1,supportsPinning:!0,supportsDimensions:!0}}init(t,e){this._status!=="disposed"&&(this._snapshot=t,e&&(this._settings={...this._settings,...e}),this._buildSimulation(t),this._status="idle")}applyDelta(t){if(!this._snapshot||this._status==="disposed")return;if(t.addNodes&&t.addNodes.length>0||t.removeNodeIds&&t.removeNodeIds.length>0||t.addEdges&&t.addEdges.length>0||t.removeEdgeIds&&t.removeEdgeIds.length>0){this._snapshot=Ke(this._snapshot,t);let n=this._status==="running";this._buildSimulation(this._snapshot),n&&(this._status="running");return}if(t.positionPatches)for(let n of t.positionPatches){let i=this._nodeIdToIndex.get(n.id);if(i===void 0)continue;let r=this._simNodes[i];r.x=n.position.x,r.y=n.position.y,r.z=n.position.z}if(t.pinPatches)for(let n of t.pinPatches){let i=this._nodeIdToIndex.get(n.id);if(i===void 0)continue;let r=this._simNodes[i];if(n.pinned){let s=n.position??{x:r.x,y:r.y,z:r.z};r.fx=s.x,r.fy=s.y,r.fz=s.z}else r.fx=null,r.fy=null,r.fz=null}this._snapshot=Ke(this._snapshot,t)}tick(t){if(this._tickCount++,!this._simulation||this._status!=="running")return{tick:this._tickCount,didChangePositions:!1,alpha:0};this._simulation.tick(1),this._readPositionsFromSimulation();let e=this._simulation.alpha(),n={tick:this._tickCount,didChangePositions:!0,alpha:e};return this._emit("tick",n),e<(this._simulation.alphaMin?.()??.001)&&this._emit("settled",{}),n}start(){if(this._status!=="disposed"){if(this._simulation){let t=this._settings.alpha??H.alpha;this._simulation.alpha(t)}this._status="running",this._emit("started",{})}}stop(){this._status!=="disposed"&&(this._status="stopped",this._emit("stopped",{}))}dispose(){this._simulation&&(this._simulation.stop(),this._simulation=null),this._simNodes=[],this._nodeIdToIndex.clear(),this._positions=new Float32Array(0),this._snapshot=null,this._status="disposed",this._listeners.clear()}getSettings(){return{...this._settings}}updateSettings(t){this._settings={...this._settings,...t},this._simulation&&this._applySettingsToSimulation()}setDimensions(t){this._settings={...this._settings,dimensions:t},this._snapshot&&(this._snapshot={...this._snapshot,dimensions:t},this._buildSimulation(this._snapshot))}getReadback(){return{positions:this._positions.length>0?this._positions:null}}getNodePosition(t){let e=this._nodeIdToIndex.get(t);if(e===void 0)return null;let n=this._simNodes[e];return{x:n.x,y:n.y,z:n.z}}setNodePosition(t,e){if(this._status==="disposed")return;let n=this._nodeIdToIndex.get(t);if(n===void 0)return;let i=this._simNodes[n];i.x=e.x,i.y=e.y,i.z=e.z,i.fx=e.x,i.fy=e.y,i.fz=e.z;let r=n*4;this._positions[r]=e.x,this._positions[r+1]=e.y,this._positions[r+2]=e.z}pinNodes(t){if(this._status!=="disposed")for(let e of t){let n=this._nodeIdToIndex.get(e);if(n===void 0)continue;let i=this._simNodes[n];i.fx=i.x,i.fy=i.y,i.fz=i.z}}unpinNodes(t){if(this._status!=="disposed")for(let e of t){let n=this._nodeIdToIndex.get(e);if(n===void 0)continue;let i=this._simNodes[n];i.fx=null,i.fy=null,i.fz=null}}on(t,e){return this._listeners.has(t)||this._listeners.set(t,new Set),this._listeners.get(t).add(e),()=>this._listeners.get(t)?.delete(e)}_buildSimulation(t){let e=t.dimensions??this._settings.dimensions??3;this._simNodes=t.nodes.map(d=>{let m={id:d.id,x:d.position.x,y:d.position.y,z:d.position.z};return d.pinned&&(m.fx=d.position.x,m.fy=d.position.y,m.fz=d.position.z),m}),this._nodeIdToIndex=new Map;for(let d=0;d<this._simNodes.length;d++)this._nodeIdToIndex.set(this._simNodes[d].id,d);let n=[];for(let d of t.edges){let m=this._nodeIdToIndex.get(d.source),p=this._nodeIdToIndex.get(d.target);m!==void 0&&p!==void 0&&n.push({source:m,target:p})}let i=this._settings,r=i.charge??H.charge,s=i.gravity??H.gravity,a=i.linkDistance??H.linkDistance,o=i.linkStrength??H.linkStrength,u=i.collision??H.collision,f=i.alpha??H.alpha,l=i.alphaDecay??H.alphaDecay,h=i.velocityDecay??H.velocityDecay;this._simulation=Zt(this._simNodes,e).alpha(f).alphaDecay(l).velocityDecay(h).force("charge",qt().strength(r)).force("link",Tt(n).distance(a).strength(o)).force("x",Rt().strength(s)).force("y",$t().strength(s)).force("z",Vt().strength(e===2?0:s)).force("collision",Et().radius(u)).stop(),this._positions=new Float32Array(this._simNodes.length*4),this._readPositionsFromSimulation()}_applySettingsToSimulation(){if(!this._simulation)return;let t=this._settings;if(t.charge!==void 0&&this._simulation.force("charge")?.strength(t.charge),t.linkDistance!==void 0&&this._simulation.force("link")?.distance(t.linkDistance),t.linkStrength!==void 0&&this._simulation.force("link")?.strength(t.linkStrength),t.gravity!==void 0){let e=t.dimensions??this._snapshot?.dimensions??3;this._simulation.force("x")?.strength(t.gravity),this._simulation.force("y")?.strength(t.gravity),this._simulation.force("z")?.strength(e===2?0:t.gravity)}t.collision!==void 0&&this._simulation.force("collision")?.radius(t.collision),t.alpha!==void 0&&this._simulation.alpha(t.alpha),t.alphaDecay!==void 0&&this._simulation.alphaDecay(t.alphaDecay),t.velocityDecay!==void 0&&this._simulation.velocityDecay(t.velocityDecay)}_readPositionsFromSimulation(){for(let t=0;t<this._simNodes.length;t++){let e=this._simNodes[t],n=t*4;this._positions[n]=e.x??0,this._positions[n+1]=e.y??0,this._positions[n+2]=e.z??0,this._positions[n+3]=1}}_emit(t,e){this._listeners.get(t)?.forEach(n=>n(e))}};export{Ft as a,vt as b,Q as c,En as d,Tn as e,Fn as f,Ln as g,Yn as h,Bn as i,Xn as j,Zn as k,qn as l,Rn as m,$n as n,Vn as o,et as p,ot as q,at as r,jn as s,On as t,Wn as u,Qn as v,ti as w,en as x,Es as y,Ts as z,Fs as A,Ls as B,Bs as C};
|
|
2
|
-
//# sourceMappingURL=chunk-VTIPA7FV.mjs.map
|