@loradb/lora-graph-canvas 0.11.0 → 0.11.2

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/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react/jsx-runtime"),M=require("react"),Z=require("three"),cl=require("three/examples/jsm/controls/DragControls.js"),ul=require("three/webgpu"),fl=require("three/examples/jsm/controls/TrackballControls.js"),dl=require("three/examples/jsm/controls/OrbitControls.js"),hl=require("three/examples/jsm/controls/FlyControls.js"),pl=require("three/examples/jsm/postprocessing/EffectComposer.js"),gl=require("three/examples/jsm/postprocessing/RenderPass.js"),Ko=new Map,vl=Math.floor(Math.random()*1e3);function Ft(e="n"){const t=(Ko.get(e)??vl)+1;return Ko.set(e,t),`${e}_${t.toString(36)}`}const yl={nodes:[],links:[]},ml=["x","y","z","vx","vy","vz","index","_neighbors","_links"];function bl(e){let t=!1;const n=e.nodes.map(o=>{const i=o;if(i.vx===void 0&&i.vy===void 0&&i.vz===void 0&&i.index===void 0)return o;t=!0;const a={};for(const s in i)ml.includes(s)||(a[s]=i[s]);return a}),r=e.links.map(o=>{const i=o.source,a=o.target,s=i!==null&&typeof i=="object",l=a!==null&&typeof a=="object";return!s&&!l?o:(t=!0,{...o,source:s?i.id:i,target:l?a.id:a})});return t?{nodes:n,links:r}:e}function _l(e){const t=e.controlled!==void 0,n=M.useCallback(m=>{for(const b of m.links)b.id===void 0&&(b.id=Ft("l"));return m},[]),[r,o]=M.useState(()=>{const m=e.defaultData??e.controlled??yl;return n(bl(m))});M.useEffect(()=>{t&&e.controlled&&o(n(e.controlled))},[t,e.controlled,n]);const i=M.useRef(r);i.current=r;const a=M.useRef(e.onChange);a.current=e.onChange;const s=M.useCallback(m=>{i.current=m,t||o(m),a.current?.(m)},[t]),l=M.useCallback(m=>s(n(m)),[s,n]),c=M.useCallback((m,b)=>{const x=m?.id??Ft("n"),w={...m??{},id:x,...b?.at??{}},_={nodes:[...i.current.nodes,w],links:i.current.links};return s(_),w},[s]),f=M.useCallback(m=>{const b=m.map(w=>({...w,id:w.id??Ft("n")})),x={nodes:[...i.current.nodes,...b],links:i.current.links};return s(x),b},[s]),u=M.useCallback((m,b)=>{const x=i.current.nodes.map(w=>w.id===m?{...w,...b}:w);s({nodes:x,links:i.current.links})},[s]),v=M.useCallback(m=>{const b=i.current,x=b.nodes.filter(_=>_.id!==m),w=b.links.filter(_=>{const k=typeof _.source=="object"?_.source?.id:_.source,S=typeof _.target=="object"?_.target?.id:_.target;return k!==m&&S!==m});s({nodes:x,links:w})},[s]),h=M.useCallback(m=>{const b=new Set(m),x=i.current,w=x.nodes.filter(k=>!b.has(k.id)),_=x.links.filter(k=>{const S=typeof k.source=="object"?k.source?.id:k.source,A=typeof k.target=="object"?k.target?.id:k.target;return S!==void 0&&A!==void 0&&!b.has(S)&&!b.has(A)});s({nodes:w,links:_})},[s]),p=M.useCallback(m=>{const b={id:Ft("l"),...m};return s({nodes:i.current.nodes,links:[...i.current.links,b]}),b},[s]),g=M.useCallback(m=>{const b=m.map(x=>({id:Ft("l"),...x}));return s({nodes:i.current.nodes,links:[...i.current.links,...b]}),b},[s]),y=M.useCallback(m=>{const b=i.current.links.filter(x=>!m(x));s({nodes:i.current.nodes,links:b})},[s]),d=M.useCallback(()=>{s({nodes:[],links:[]})},[s]);return{data:r,setData:l,addNode:c,addNodes:f,updateNode:u,removeNode:v,removeNodes:h,addLink:p,addLinks:g,removeLink:y,clear:d}}function xl(e,t,n){var r,o=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function i(){var a,s=r.length,l,c=0,f=0,u=0;for(a=0;a<s;++a)l=r[a],c+=l.x||0,f+=l.y||0,u+=l.z||0;for(c=(c/s-e)*o,f=(f/s-t)*o,u=(u/s-n)*o,a=0;a<s;++a)l=r[a],c&&(l.x-=c),f&&(l.y-=f),u&&(l.z-=u)}return i.initialize=function(a){r=a},i.x=function(a){return arguments.length?(e=+a,i):e},i.y=function(a){return arguments.length?(t=+a,i):t},i.z=function(a){return arguments.length?(n=+a,i):n},i.strength=function(a){return arguments.length?(o=+a,i):o},i}function wl(e){const t=+this._x.call(null,e);return oa(this.cover(t),t,e)}function oa(e,t,n){if(isNaN(t))return e;var r,o=e._root,i={data:n},a=e._x0,s=e._x1,l,c,f,u,v;if(!o)return e._root=i,e;for(;o.length;)if((f=t>=(l=(a+s)/2))?a=l:s=l,r=o,!(o=o[u=+f]))return r[u]=i,e;if(c=+e._x.call(null,o.data),t===c)return i.next=o,r?r[u]=i:e._root=i,e;do r=r?r[u]=new Array(2):e._root=new Array(2),(f=t>=(l=(a+s)/2))?a=l:s=l;while((u=+f)==(v=+(c>=l)));return r[v]=o,r[u]=i,e}function kl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t);let r=1/0,o=-1/0;for(let i=0,a;i<t;++i)isNaN(a=+this._x.call(null,e[i]))||(n[i]=a,a<r&&(r=a),a>o&&(o=a));if(r>o)return this;this.cover(r).cover(o);for(let i=0;i<t;++i)oa(this,n[i],e[i]);return this}function Cl(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,o=this._root,i,a;t>e||e>=n;)switch(a=+(e<t),i=new Array(2),i[a]=o,o=i,r*=2,a){case 0:n=t+r;break;case 1:t=n-r;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._x1=n,this}function Sl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Ml(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function st(e,t,n){this.node=e,this.x0=t,this.x1=n}function Pl(e,t){var n,r=this._x0,o,i,a=this._x1,s=[],l=this._root,c,f;for(l&&s.push(new st(l,r,a)),t==null?t=1/0:(r=e-t,a=e+t);c=s.pop();)if(!(!(l=c.node)||(o=c.x0)>a||(i=c.x1)<r))if(l.length){var u=(o+i)/2;s.push(new st(l[1],u,i),new st(l[0],o,u)),(f=+(e>=u))&&(c=s[s.length-1],s[s.length-1]=s[s.length-1-f],s[s.length-1-f]=c)}else{var v=Math.abs(e-+this._x.call(null,l.data));v<t&&(t=v,r=e-v,a=e+v,n=l.data)}return n}function Ol(e){if(isNaN(l=+this._x.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._x1,l,c,f,u,v;if(!n)return this;if(n.length)for(;;){if((f=l>=(c=(a+s)/2))?a=c:s=c,t=n,!(n=n[u=+f]))return this;if(!n.length)break;t[u+1&1]&&(r=t,v=u)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[u]=i:delete t[u],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[v]=n:this._root=n),this):(this._root=i,this)}function Al(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function jl(){return this._root}function Tl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function El(e){var t=[],n,r=this._root,o,i,a;for(r&&t.push(new st(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.x1)&&r.length){var s=(i+a)/2;(o=r[1])&&t.push(new st(o,s,a)),(o=r[0])&&t.push(new st(o,i,s))}return this}function Ll(e){var t=[],n=[],r;for(this._root&&t.push(new st(this._root,this._x0,this._x1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.x1,l=(a+s)/2;(i=o[0])&&t.push(new st(i,a,l)),(i=o[1])&&t.push(new st(i,l,s))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function Rl(e){return e[0]}function Nl(e){return arguments.length?(this._x=e,this):this._x}function Zr(e,t){var n=new Jr(t??Rl,NaN,NaN);return e==null?n:n.addAll(e)}function Jr(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function Qo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var De=Zr.prototype=Jr.prototype;De.copy=function(){var e=new Jr(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Qo(t),e;for(n=[{source:t,target:e._root=new Array(2)}];t=n.pop();)for(var o=0;o<2;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(2)}):t.target[o]=Qo(r));return e};De.add=wl;De.addAll=kl;De.cover=Cl;De.data=Sl;De.extent=Ml;De.find=Pl;De.remove=Ol;De.removeAll=Al;De.root=jl;De.size=Tl;De.visit=El;De.visitAfter=Ll;De.x=Nl;function Dl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return ia(this.cover(t,n),t,n,e)}function ia(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var o,i=e._root,a={data:r},s=e._x0,l=e._y0,c=e._x1,f=e._y1,u,v,h,p,g,y,d,m;if(!i)return e._root=a,e;for(;i.length;)if((g=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(v=(l+f)/2))?l=v:f=v,o=i,!(i=i[d=y<<1|g]))return o[d]=a,e;if(h=+e._x.call(null,i.data),p=+e._y.call(null,i.data),t===h&&n===p)return a.next=i,o?o[d]=a:e._root=a,e;do o=o?o[d]=new Array(4):e._root=new Array(4),(g=t>=(u=(s+c)/2))?s=u:c=u,(y=n>=(v=(l+f)/2))?l=v:f=v;while((d=y<<1|g)===(m=(p>=v)<<1|h>=u));return o[m]=i,o[d]=a,e}function zl(e){var t,n,r=e.length,o,i,a=new Array(r),s=new Array(r),l=1/0,c=1/0,f=-1/0,u=-1/0;for(n=0;n<r;++n)isNaN(o=+this._x.call(null,t=e[n]))||isNaN(i=+this._y.call(null,t))||(a[n]=o,s[n]=i,o<l&&(l=o),o>f&&(f=o),i<c&&(c=i),i>u&&(u=i));if(l>f||c>u)return this;for(this.cover(l,c).cover(f,u),n=0;n<r;++n)ia(this,a[n],s[n],e[n]);return this}function Il(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,o=this._x1,i=this._y1;if(isNaN(n))o=(n=Math.floor(e))+1,i=(r=Math.floor(t))+1;else{for(var a=o-n||1,s=this._root,l,c;n>e||e>=o||r>t||t>=i;)switch(c=(t<r)<<1|e<n,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:o=n+a,i=r+a;break;case 1:n=o-a,i=r+a;break;case 2:o=n+a,r=i-a;break;case 3:n=o-a,r=i-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this}function Fl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Bl(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Ae(e,t,n,r,o){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=o}function $l(e,t,n){var r,o=this._x0,i=this._y0,a,s,l,c,f=this._x1,u=this._y1,v=[],h=this._root,p,g;for(h&&v.push(new Ae(h,o,i,f,u)),n==null?n=1/0:(o=e-n,i=t-n,f=e+n,u=t+n,n*=n);p=v.pop();)if(!(!(h=p.node)||(a=p.x0)>f||(s=p.y0)>u||(l=p.x1)<o||(c=p.y1)<i))if(h.length){var y=(a+l)/2,d=(s+c)/2;v.push(new Ae(h[3],y,d,l,c),new Ae(h[2],a,d,y,c),new Ae(h[1],y,s,l,d),new Ae(h[0],a,s,y,d)),(g=(t>=d)<<1|e>=y)&&(p=v[v.length-1],v[v.length-1]=v[v.length-1-g],v[v.length-1-g]=p)}else{var m=e-+this._x.call(null,h.data),b=t-+this._y.call(null,h.data),x=m*m+b*b;if(x<n){var w=Math.sqrt(n=x);o=e-w,i=t-w,f=e+w,u=t+w,r=h.data}}return r}function Hl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(u=+this._y.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._y0,l=this._x1,c=this._y1,f,u,v,h,p,g,y,d;if(!n)return this;if(n.length)for(;;){if((p=f>=(v=(a+l)/2))?a=v:l=v,(g=u>=(h=(s+c)/2))?s=h:c=h,t=n,!(n=n[y=g<<1|p]))return this;if(!n.length)break;(t[y+1&3]||t[y+2&3]||t[y+3&3])&&(r=t,d=y)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[y]=i:delete t[y],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[d]=n:this._root=n),this):(this._root=i,this)}function Ul(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function ql(){return this._root}function Gl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function Vl(e){var t=[],n,r=this._root,o,i,a,s,l;for(r&&t.push(new Ae(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,s=n.x1,l=n.y1)&&r.length){var c=(i+s)/2,f=(a+l)/2;(o=r[3])&&t.push(new Ae(o,c,f,s,l)),(o=r[2])&&t.push(new Ae(o,i,f,c,l)),(o=r[1])&&t.push(new Ae(o,c,a,s,f)),(o=r[0])&&t.push(new Ae(o,i,a,c,f))}return this}function Wl(e){var t=[],n=[],r;for(this._root&&t.push(new Ae(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.y0,l=r.x1,c=r.y1,f=(a+l)/2,u=(s+c)/2;(i=o[0])&&t.push(new Ae(i,a,s,f,u)),(i=o[1])&&t.push(new Ae(i,f,s,l,u)),(i=o[2])&&t.push(new Ae(i,a,u,f,c)),(i=o[3])&&t.push(new Ae(i,f,u,l,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function Xl(e){return e[0]}function Yl(e){return arguments.length?(this._x=e,this):this._x}function Kl(e){return e[1]}function Ql(e){return arguments.length?(this._y=e,this):this._y}function eo(e,t,n){var r=new to(t??Xl,n??Kl,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function to(e,t,n,r,o,i){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=o,this._y1=i,this._root=void 0}function Zo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var je=eo.prototype=to.prototype;je.copy=function(){var e=new to(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Zo(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var o=0;o<4;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(4)}):t.target[o]=Zo(r));return e};je.add=Dl;je.addAll=zl;je.cover=Il;je.data=Fl;je.extent=Bl;je.find=$l;je.remove=Hl;je.removeAll=Ul;je.root=ql;je.size=Gl;je.visit=Vl;je.visitAfter=Wl;je.x=Yl;je.y=Ql;function Zl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return aa(this.cover(t,n,r),t,n,r,e)}function aa(e,t,n,r,o){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var i,a=e._root,s={data:o},l=e._x0,c=e._y0,f=e._z0,u=e._x1,v=e._y1,h=e._z1,p,g,y,d,m,b,x,w,_,k,S;if(!a)return e._root=s,e;for(;a.length;)if((x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(g=(c+v)/2))?c=g:v=g,(_=r>=(y=(f+h)/2))?f=y:h=y,i=a,!(a=a[k=_<<2|w<<1|x]))return i[k]=s,e;if(d=+e._x.call(null,a.data),m=+e._y.call(null,a.data),b=+e._z.call(null,a.data),t===d&&n===m&&r===b)return s.next=a,i?i[k]=s:e._root=s,e;do i=i?i[k]=new Array(8):e._root=new Array(8),(x=t>=(p=(l+u)/2))?l=p:u=p,(w=n>=(g=(c+v)/2))?c=g:v=g,(_=r>=(y=(f+h)/2))?f=y:h=y;while((k=_<<2|w<<1|x)===(S=(b>=y)<<2|(m>=g)<<1|d>=p));return i[S]=a,i[k]=s,e}function Jl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t),r=new Float64Array(t),o=new Float64Array(t);let i=1/0,a=1/0,s=1/0,l=-1/0,c=-1/0,f=-1/0;for(let u=0,v,h,p,g;u<t;++u)isNaN(h=+this._x.call(null,v=e[u]))||isNaN(p=+this._y.call(null,v))||isNaN(g=+this._z.call(null,v))||(n[u]=h,r[u]=p,o[u]=g,h<i&&(i=h),h>l&&(l=h),p<a&&(a=p),p>c&&(c=p),g<s&&(s=g),g>f&&(f=g));if(i>l||a>c||s>f)return this;this.cover(i,a,s).cover(l,c,f);for(let u=0;u<t;++u)aa(this,n[u],r[u],o[u],e[u]);return this}function ec(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,o=this._y0,i=this._z0,a=this._x1,s=this._y1,l=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,s=(o=Math.floor(t))+1,l=(i=Math.floor(n))+1;else{for(var c=a-r||1,f=this._root,u,v;r>e||e>=a||o>t||t>=s||i>n||n>=l;)switch(v=(n<i)<<2|(t<o)<<1|e<r,u=new Array(8),u[v]=f,f=u,c*=2,v){case 0:a=r+c,s=o+c,l=i+c;break;case 1:r=a-c,s=o+c,l=i+c;break;case 2:a=r+c,o=s-c,l=i+c;break;case 3:r=a-c,o=s-c,l=i+c;break;case 4:a=r+c,s=o+c,i=l-c;break;case 5:r=a-c,s=o+c,i=l-c;break;case 6:a=r+c,o=s-c,i=l-c;break;case 7:r=a-c,o=s-c,i=l-c;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=l,this}function tc(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function nc(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function ue(e,t,n,r,o,i,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=o,this.y1=i,this.z1=a}function rc(e,t,n,r){var o,i=this._x0,a=this._y0,s=this._z0,l,c,f,u,v,h,p=this._x1,g=this._y1,y=this._z1,d=[],m=this._root,b,x;for(m&&d.push(new ue(m,i,a,s,p,g,y)),r==null?r=1/0:(i=e-r,a=t-r,s=n-r,p=e+r,g=t+r,y=n+r,r*=r);b=d.pop();)if(!(!(m=b.node)||(l=b.x0)>p||(c=b.y0)>g||(f=b.z0)>y||(u=b.x1)<i||(v=b.y1)<a||(h=b.z1)<s))if(m.length){var w=(l+u)/2,_=(c+v)/2,k=(f+h)/2;d.push(new ue(m[7],w,_,k,u,v,h),new ue(m[6],l,_,k,w,v,h),new ue(m[5],w,c,k,u,_,h),new ue(m[4],l,c,k,w,_,h),new ue(m[3],w,_,f,u,v,k),new ue(m[2],l,_,f,w,v,k),new ue(m[1],w,c,f,u,_,k),new ue(m[0],l,c,f,w,_,k)),(x=(n>=k)<<2|(t>=_)<<1|e>=w)&&(b=d[d.length-1],d[d.length-1]=d[d.length-1-x],d[d.length-1-x]=b)}else{var S=e-+this._x.call(null,m.data),A=t-+this._y.call(null,m.data),O=n-+this._z.call(null,m.data),E=S*S+A*A+O*O;if(E<r){var T=Math.sqrt(r=E);i=e-T,a=t-T,s=n-T,p=e+T,g=t+T,y=n+T,o=m.data}}return o}const oc=(e,t,n,r,o,i)=>Math.sqrt((e-r)**2+(t-o)**2+(n-i)**2);function ic(e,t,n,r){const o=[],i=e-r,a=t-r,s=n-r,l=e+r,c=t+r,f=n+r;return this.visit((u,v,h,p,g,y,d)=>{if(!u.length)do{const m=u.data;oc(e,t,n,this._x(m),this._y(m),this._z(m))<=r&&o.push(m)}while(u=u.next);return v>l||h>c||p>f||g<i||y<a||d<s}),o}function ac(e){if(isNaN(v=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(p=+this._z.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,s=this._y0,l=this._z0,c=this._x1,f=this._y1,u=this._z1,v,h,p,g,y,d,m,b,x,w,_;if(!n)return this;if(n.length)for(;;){if((m=v>=(g=(a+c)/2))?a=g:c=g,(b=h>=(y=(s+f)/2))?s=y:f=y,(x=p>=(d=(l+u)/2))?l=d:u=d,t=n,!(n=n[w=x<<2|b<<1|m]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,_=w)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[w]=i:delete t[w],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=i,this)}function sc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function lc(){return this._root}function cc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function uc(e){var t=[],n,r=this._root,o,i,a,s,l,c,f;for(r&&t.push(new ue(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,s=n.z0,l=n.x1,c=n.y1,f=n.z1)&&r.length){var u=(i+l)/2,v=(a+c)/2,h=(s+f)/2;(o=r[7])&&t.push(new ue(o,u,v,h,l,c,f)),(o=r[6])&&t.push(new ue(o,i,v,h,u,c,f)),(o=r[5])&&t.push(new ue(o,u,a,h,l,v,f)),(o=r[4])&&t.push(new ue(o,i,a,h,u,v,f)),(o=r[3])&&t.push(new ue(o,u,v,s,l,c,h)),(o=r[2])&&t.push(new ue(o,i,v,s,u,c,h)),(o=r[1])&&t.push(new ue(o,u,a,s,l,v,h)),(o=r[0])&&t.push(new ue(o,i,a,s,u,v,h))}return this}function fc(e){var t=[],n=[],r;for(this._root&&t.push(new ue(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,s=r.y0,l=r.z0,c=r.x1,f=r.y1,u=r.z1,v=(a+c)/2,h=(s+f)/2,p=(l+u)/2;(i=o[0])&&t.push(new ue(i,a,s,l,v,h,p)),(i=o[1])&&t.push(new ue(i,v,s,l,c,h,p)),(i=o[2])&&t.push(new ue(i,a,h,l,v,f,p)),(i=o[3])&&t.push(new ue(i,v,h,l,c,f,p)),(i=o[4])&&t.push(new ue(i,a,s,p,v,h,u)),(i=o[5])&&t.push(new ue(i,v,s,p,c,h,u)),(i=o[6])&&t.push(new ue(i,a,h,p,v,f,u)),(i=o[7])&&t.push(new ue(i,v,h,p,c,f,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function dc(e){return e[0]}function hc(e){return arguments.length?(this._x=e,this):this._x}function pc(e){return e[1]}function gc(e){return arguments.length?(this._y=e,this):this._y}function vc(e){return e[2]}function yc(e){return arguments.length?(this._z=e,this):this._z}function no(e,t,n,r){var o=new ro(t??dc,n??pc,r??vc,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function ro(e,t,n,r,o,i,a,s,l){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=s,this._z1=l,this._root=void 0}function Jo(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Me=no.prototype=ro.prototype;Me.copy=function(){var e=new ro(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=Jo(t),e;for(n=[{source:t,target:e._root=new Array(8)}];t=n.pop();)for(var o=0;o<8;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(8)}):t.target[o]=Jo(r));return e};Me.add=Zl;Me.addAll=Jl;Me.cover=ec;Me.data=tc;Me.extent=nc;Me.find=rc;Me.findAllWithinRadius=ic;Me.remove=ac;Me.removeAll=sc;Me.root=lc;Me.size=cc;Me.visit=uc;Me.visitAfter=fc;Me.x=hc;Me.y=gc;Me.z=yc;function we(e){return function(){return e}}function Ue(e){return(e()-.5)*1e-6}function pr(e){return e.x+e.vx}function ei(e){return e.y+e.vy}function mc(e){return e.z+e.vz}function ti(e){var t,n,r,o,i=1,a=1;typeof e!="function"&&(e=we(e==null?1:+e));function s(){for(var f,u=t.length,v,h,p,g,y,d,m,b=0;b<a;++b)for(v=(n===1?Zr(t,pr):n===2?eo(t,pr,ei):n===3?no(t,pr,ei,mc):null).visitAfter(l),f=0;f<u;++f)h=t[f],d=r[h.index],m=d*d,p=h.x+h.vx,n>1&&(g=h.y+h.vy),n>2&&(y=h.z+h.vz),v.visit(x);function x(w,_,k,S,A,O,E){var T=[_,k,S,A,O,E],I=T[0],C=T[1],P=T[2],R=T[n],H=T[n+1],V=T[n+2],X=w.data,oe=w.r,D=d+oe;if(X){if(X.index>h.index){var F=p-X.x-X.vx,W=n>1?g-X.y-X.vy:0,Q=n>2?y-X.z-X.vz:0,N=F*F+W*W+Q*Q;N<D*D&&(F===0&&(F=Ue(o),N+=F*F),n>1&&W===0&&(W=Ue(o),N+=W*W),n>2&&Q===0&&(Q=Ue(o),N+=Q*Q),N=(D-(N=Math.sqrt(N)))/N*i,h.vx+=(F*=N)*(D=(oe*=oe)/(m+oe)),n>1&&(h.vy+=(W*=N)*D),n>2&&(h.vz+=(Q*=N)*D),X.vx-=F*(D=1-D),n>1&&(X.vy-=W*D),n>2&&(X.vz-=Q*D))}return}return I>p+D||R<p-D||n>1&&(C>g+D||H<g-D)||n>2&&(P>y+D||V<y-D)}}function l(f){if(f.data)return f.r=r[f.data.index];for(var u=f.r=0;u<Math.pow(2,n);++u)f[u]&&f[u].r>f.r&&(f.r=f[u].r)}function c(){if(t){var f,u=t.length,v;for(r=new Array(u),f=0;f<u;++f)v=t[f],r[v.index]=+e(v,f,t)}}return s.initialize=function(f,...u){t=f,o=u.find(v=>typeof v=="function")||Math.random,n=u.find(v=>[1,2,3].includes(v))||2,c()},s.iterations=function(f){return arguments.length?(a=+f,s):a},s.strength=function(f){return arguments.length?(i=+f,s):i},s.radius=function(f){return arguments.length?(e=typeof f=="function"?f:we(+f),c(),s):e},s}function bc(e){return e.index}function ni(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function _c(e){var t=bc,n=v,r,o=we(30),i,a,s,l,c,f,u=1;e==null&&(e=[]);function v(d){return 1/Math.min(l[d.source.index],l[d.target.index])}function h(d){for(var m=0,b=e.length;m<u;++m)for(var x=0,w,_,k,S=0,A=0,O=0,E,T;x<b;++x)w=e[x],_=w.source,k=w.target,S=k.x+k.vx-_.x-_.vx||Ue(f),s>1&&(A=k.y+k.vy-_.y-_.vy||Ue(f)),s>2&&(O=k.z+k.vz-_.z-_.vz||Ue(f)),E=Math.sqrt(S*S+A*A+O*O),E=(E-i[x])/E*d*r[x],S*=E,A*=E,O*=E,k.vx-=S*(T=c[x]),s>1&&(k.vy-=A*T),s>2&&(k.vz-=O*T),_.vx+=S*(T=1-T),s>1&&(_.vy+=A*T),s>2&&(_.vz+=O*T)}function p(){if(a){var d,m=a.length,b=e.length,x=new Map(a.map((_,k)=>[t(_,k,a),_])),w;for(d=0,l=new Array(m);d<b;++d)w=e[d],w.index=d,typeof w.source!="object"&&(w.source=ni(x,w.source)),typeof w.target!="object"&&(w.target=ni(x,w.target)),l[w.source.index]=(l[w.source.index]||0)+1,l[w.target.index]=(l[w.target.index]||0)+1;for(d=0,c=new Array(b);d<b;++d)w=e[d],c[d]=l[w.source.index]/(l[w.source.index]+l[w.target.index]);r=new Array(b),g(),i=new Array(b),y()}}function g(){if(a)for(var d=0,m=e.length;d<m;++d)r[d]=+n(e[d],d,e)}function y(){if(a)for(var d=0,m=e.length;d<m;++d)i[d]=+o(e[d],d,e)}return h.initialize=function(d,...m){a=d,f=m.find(b=>typeof b=="function")||Math.random,s=m.find(b=>[1,2,3].includes(b))||2,p()},h.links=function(d){return arguments.length?(e=d,p(),h):e},h.id=function(d){return arguments.length?(t=d,h):t},h.iterations=function(d){return arguments.length?(u=+d,h):u},h.strength=function(d){return arguments.length?(n=typeof d=="function"?d:we(+d),g(),h):n},h.distance=function(d){return arguments.length?(o=typeof d=="function"?d:we(+d),y(),h):o},h}var xc={value:()=>{}};function sa(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new En(n)}function En(e){this._=e}function wc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}En.prototype=sa.prototype={constructor:En,on:function(e,t){var n=this._,r=wc(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=kc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(o=(e=r[i]).type)n[o]=ri(n[o],e.name,t);else if(t==null)for(o in n)n[o]=ri(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new En(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function kc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function ri(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=xc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Bt=0,sn=0,Jt=0,la=1e3,Nn,ln,Dn=0,Mt=0,Wn=0,pn=typeof performance=="object"&&performance.now?performance:Date,ca=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function ua(){return Mt||(ca(Cc),Mt=pn.now()+Wn)}function Cc(){Mt=0}function Tr(){this._call=this._time=this._next=null}Tr.prototype=fa.prototype={constructor:Tr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?ua():+n)+(t==null?0:+t),!this._next&&ln!==this&&(ln?ln._next=this:Nn=this,ln=this),this._call=e,this._time=n,Er()},stop:function(){this._call&&(this._call=null,this._time=1/0,Er())}};function fa(e,t,n){var r=new Tr;return r.restart(e,t,n),r}function Sc(){ua(),++Bt;for(var e=Nn,t;e;)(t=Mt-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Bt}function oi(){Mt=(Dn=pn.now())+Wn,Bt=sn=0;try{Sc()}finally{Bt=0,Pc(),Mt=0}}function Mc(){var e=pn.now(),t=e-Dn;t>la&&(Wn-=t,Dn=e)}function Pc(){for(var e,t=Nn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Nn=n);ln=e,Er(r)}function Er(e){if(!Bt){sn&&(sn=clearTimeout(sn));var t=e-Mt;t>24?(e<1/0&&(sn=setTimeout(oi,e-pn.now()-Wn)),Jt&&(Jt=clearInterval(Jt))):(Jt||(Dn=pn.now(),Jt=setInterval(Mc,la)),Bt=1,ca(oi))}}const Oc=1664525,Ac=1013904223,ii=4294967296;function jc(){let e=1;return()=>(e=(Oc*e+Ac)%ii)/ii}var ai=3;function gr(e){return e.x}function si(e){return e.y}function Tc(e){return e.z}var Ec=10,Lc=Math.PI*(3-Math.sqrt(5)),Rc=Math.PI*20/(9+Math.sqrt(221));function Nc(e,t){t=t||2;var n=Math.min(ai,Math.max(1,Math.round(t))),r,o=1,i=.001,a=1-Math.pow(i,1/300),s=0,l=.6,c=new Map,f=fa(h),u=sa("tick","end"),v=jc();e==null&&(e=[]);function h(){p(),u.call("tick",r),o<i&&(f.stop(),u.call("end",r))}function p(d){var m,b=e.length,x;d===void 0&&(d=1);for(var w=0;w<d;++w)for(o+=(s-o)*a,c.forEach(function(_){_(o)}),m=0;m<b;++m)x=e[m],x.fx==null?x.x+=x.vx*=l:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=l:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=l:(x.z=x.fz,x.vz=0));return r}function g(){for(var d=0,m=e.length,b;d<m;++d){if(b=e[d],b.index=d,b.fx!=null&&(b.x=b.fx),b.fy!=null&&(b.y=b.fy),b.fz!=null&&(b.z=b.fz),isNaN(b.x)||n>1&&isNaN(b.y)||n>2&&isNaN(b.z)){var x=Ec*(n>2?Math.cbrt(.5+d):n>1?Math.sqrt(.5+d):d),w=d*Lc,_=d*Rc;n===1?b.x=x:n===2?(b.x=x*Math.cos(w),b.y=x*Math.sin(w)):(b.x=x*Math.sin(w)*Math.cos(_),b.y=x*Math.cos(w),b.z=x*Math.sin(w)*Math.sin(_))}(isNaN(b.vx)||n>1&&isNaN(b.vy)||n>2&&isNaN(b.vz))&&(b.vx=0,n>1&&(b.vy=0),n>2&&(b.vz=0))}}function y(d){return d.initialize&&d.initialize(e,v,n),d}return g(),r={tick:p,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(d){return arguments.length?(n=Math.min(ai,Math.max(1,Math.round(d))),c.forEach(y),r):n},nodes:function(d){return arguments.length?(e=d,g(),c.forEach(y),r):e},alpha:function(d){return arguments.length?(o=+d,r):o},alphaMin:function(d){return arguments.length?(i=+d,r):i},alphaDecay:function(d){return arguments.length?(a=+d,r):+a},alphaTarget:function(d){return arguments.length?(s=+d,r):s},velocityDecay:function(d){return arguments.length?(l=1-d,r):1-l},randomSource:function(d){return arguments.length?(v=d,c.forEach(y),r):v},force:function(d,m){return arguments.length>1?(m==null?c.delete(d):c.set(d,y(m)),r):c.get(d)},find:function(){var d=Array.prototype.slice.call(arguments),m=d.shift()||0,b=(n>1?d.shift():null)||0,x=(n>2?d.shift():null)||0,w=d.shift()||1/0,_=0,k=e.length,S,A,O,E,T,I;for(w*=w,_=0;_<k;++_)T=e[_],S=m-T.x,A=b-(T.y||0),O=x-(T.z||0),E=S*S+A*A+O*O,E<w&&(I=T,w=E);return I},on:function(d,m){return arguments.length>1?(u.on(d,m),r):u.on(d)}}}function Dc(){var e,t,n,r,o,i=we(-30),a,s=1,l=1/0,c=.81;function f(p){var g,y=e.length,d=(t===1?Zr(e,gr):t===2?eo(e,gr,si):t===3?no(e,gr,si,Tc):null).visitAfter(v);for(o=p,g=0;g<y;++g)n=e[g],d.visit(h)}function u(){if(e){var p,g=e.length,y;for(a=new Array(g),p=0;p<g;++p)y=e[p],a[y.index]=+i(y,p,e)}}function v(p){var g=0,y,d,m=0,b,x,w,_,k=p.length;if(k){for(b=x=w=_=0;_<k;++_)(y=p[_])&&(d=Math.abs(y.value))&&(g+=y.value,m+=d,b+=d*(y.x||0),x+=d*(y.y||0),w+=d*(y.z||0));g*=Math.sqrt(4/k),p.x=b/m,t>1&&(p.y=x/m),t>2&&(p.z=w/m)}else{y=p,y.x=y.data.x,t>1&&(y.y=y.data.y),t>2&&(y.z=y.data.z);do g+=a[y.data.index];while(y=y.next)}p.value=g}function h(p,g,y,d,m){if(!p.value)return!0;var b=[y,d,m][t-1],x=p.x-n.x,w=t>1?p.y-n.y:0,_=t>2?p.z-n.z:0,k=b-g,S=x*x+w*w+_*_;if(k*k/c<S)return S<l&&(x===0&&(x=Ue(r),S+=x*x),t>1&&w===0&&(w=Ue(r),S+=w*w),t>2&&_===0&&(_=Ue(r),S+=_*_),S<s&&(S=Math.sqrt(s*S)),n.vx+=x*p.value*o/S,t>1&&(n.vy+=w*p.value*o/S),t>2&&(n.vz+=_*p.value*o/S)),!0;if(p.length||S>=l)return;(p.data!==n||p.next)&&(x===0&&(x=Ue(r),S+=x*x),t>1&&w===0&&(w=Ue(r),S+=w*w),t>2&&_===0&&(_=Ue(r),S+=_*_),S<s&&(S=Math.sqrt(s*S)));do p.data!==n&&(k=a[p.data.index]*o/S,n.vx+=x*k,t>1&&(n.vy+=w*k),t>2&&(n.vz+=_*k));while(p=p.next)}return f.initialize=function(p,...g){e=p,r=g.find(y=>typeof y=="function")||Math.random,t=g.find(y=>[1,2,3].includes(y))||2,u()},f.strength=function(p){return arguments.length?(i=typeof p=="function"?p:we(+p),u(),f):i},f.distanceMin=function(p){return arguments.length?(s=p*p,f):Math.sqrt(s)},f.distanceMax=function(p){return arguments.length?(l=p*p,f):Math.sqrt(l)},f.theta=function(p){return arguments.length?(c=p*p,f):Math.sqrt(c)},f}function zc(e,t,n,r){var o,i,a=we(.1),s,l;typeof e!="function"&&(e=we(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function c(u){for(var v=0,h=o.length;v<h;++v){var p=o[v],g=p.x-t||1e-6,y=(p.y||0)-n||1e-6,d=(p.z||0)-r||1e-6,m=Math.sqrt(g*g+y*y+d*d),b=(l[v]-m)*s[v]*u/m;p.vx+=g*b,i>1&&(p.vy+=y*b),i>2&&(p.vz+=d*b)}}function f(){if(o){var u,v=o.length;for(s=new Array(v),l=new Array(v),u=0;u<v;++u)l[u]=+e(o[u],u,o),s[u]=isNaN(l[u])?0:+a(o[u],u,o)}}return c.initialize=function(u,...v){o=u,i=v.find(h=>[1,2,3].includes(h))||2,f()},c.strength=function(u){return arguments.length?(a=typeof u=="function"?u:we(+u),f(),c):a},c.radius=function(u){return arguments.length?(e=typeof u=="function"?u:we(+u),f(),c):e},c.x=function(u){return arguments.length?(t=+u,c):t},c.y=function(u){return arguments.length?(n=+u,c):n},c.z=function(u){return arguments.length?(r=+u,c):r},c}function li(e){var t=we(.1),n,r,o;typeof e!="function"&&(e=we(e==null?0:+e));function i(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vx+=(o[l]-f.x)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),o=new Array(l),s=0;s<l;++s)r[s]=isNaN(o[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return i.initialize=function(s){n=s,a()},i.strength=function(s){return arguments.length?(t=typeof s=="function"?s:we(+s),a(),i):t},i.x=function(s){return arguments.length?(e=typeof s=="function"?s:we(+s),a(),i):e},i}function ci(e){var t=we(.1),n,r,o;typeof e!="function"&&(e=we(e==null?0:+e));function i(s){for(var l=0,c=n.length,f;l<c;++l)f=n[l],f.vy+=(o[l]-f.y)*r[l]*s}function a(){if(n){var s,l=n.length;for(r=new Array(l),o=new Array(l),s=0;s<l;++s)r[s]=isNaN(o[s]=+e(n[s],s,n))?0:+t(n[s],s,n)}}return i.initialize=function(s){n=s,a()},i.strength=function(s){return arguments.length?(t=typeof s=="function"?s:we(+s),a(),i):t},i.y=function(s){return arguments.length?(e=typeof s=="function"?s:we(+s),a(),i):e},i}function da(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Ic(e){Bc(e);const t=Fc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Fc(e){let t=Object.create(null);return{on:function(n,r,o){if(typeof r!="function")throw new Error("callback is expected to be a function");let i=t[n];return i||(i=t[n]=[]),i.push({callback:r,ctx:o}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if(typeof r!="function")delete t[n];else{const o=t[n];for(let i=0;i<o.length;++i)o[i].callback===r&&o.splice(i,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let o;arguments.length>1&&(o=Array.prototype.slice.call(arguments,1));for(let i=0;i<r.length;++i){const a=r[i];a.callback.apply(a.ctx,o)}return e}}}function Bc(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}var oo=Ic;const $c=da(oo);function Hc(e){if(e=e||{},"uniqueLinkId"in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),A=require("react"),re=require("three"),bl=require("three/examples/jsm/controls/DragControls.js"),_l=require("three/webgpu"),xl=require("three/examples/jsm/controls/TrackballControls.js"),wl=require("three/examples/jsm/controls/OrbitControls.js"),kl=require("three/examples/jsm/controls/FlyControls.js"),Cl=require("three/examples/jsm/postprocessing/EffectComposer.js"),Sl=require("three/examples/jsm/postprocessing/RenderPass.js"),ii=new Map,Ml=Math.floor(Math.random()*1e3);function It(e="n"){const t=(ii.get(e)??Ml)+1;return ii.set(e,t),`${e}_${t.toString(36)}`}const Pl={nodes:[],links:[]},Al=["x","y","z","vx","vy","vz","index","_neighbors","_links"];function ai(e){let t=!1;const n=e.nodes.map(o=>{const i=o;if(i.vx===void 0&&i.vy===void 0&&i.vz===void 0&&i.index===void 0)return o;t=!0;const a={};for(const l in i)Al.includes(l)||(a[l]=i[l]);return a}),r=e.links.map(o=>{const i=o.source,a=o.target,l=i!==null&&typeof i=="object",s=a!==null&&typeof a=="object";return!l&&!s?o:(t=!0,{...o,source:l?i.id:i,target:s?a.id:a})});return t?{nodes:n,links:r}:e}function Ol(e){const t=e.controlled!==void 0,n=A.useCallback(_=>{for(const x of _.links)x.id===void 0&&(x.id=It("l"));return _},[]),r=A.useCallback(_=>{let x=!1;const w=_.links.map(b=>b.id!==void 0?b:(x=!0,{...b,id:It("l")}));return x?{nodes:_.nodes,links:w}:_},[]),[o,i]=A.useState(()=>e.defaultData!==void 0?n(ai(e.defaultData)):e.controlled!==void 0?r(ai(e.controlled)):Pl);A.useEffect(()=>{t&&e.controlled&&i(r(e.controlled))},[t,e.controlled,r]);const a=A.useRef(o);a.current=o;const l=A.useRef(e.onChange);l.current=e.onChange;const s=A.useCallback(_=>{a.current=_,t||i(_),l.current?.(_)},[t]),u=A.useCallback(_=>s(t?r(_):n(_)),[s,n,r,t]),f=A.useCallback((_,x)=>{const w=_?.id??It("n"),b={..._??{},id:w,...x?.at??{}},M={nodes:[...a.current.nodes,b],links:a.current.links};return s(M),b},[s]),c=A.useCallback(_=>{const x=_.map(b=>({...b,id:b.id??It("n")})),w={nodes:[...a.current.nodes,...x],links:a.current.links};return s(w),x},[s]),p=A.useCallback((_,x)=>{const w=a.current.nodes.map(b=>b.id===_?{...b,...x}:b);s({nodes:w,links:a.current.links})},[s]),h=A.useCallback(_=>{const x=a.current,w=x.nodes.filter(M=>M.id!==_),b=x.links.filter(M=>{const P=typeof M.source=="object"?M.source?.id:M.source,N=typeof M.target=="object"?M.target?.id:M.target;return P!==_&&N!==_});s({nodes:w,links:b})},[s]),d=A.useCallback(_=>{const x=new Set(_),w=a.current,b=w.nodes.filter(P=>!x.has(P.id)),M=w.links.filter(P=>{const N=typeof P.source=="object"?P.source?.id:P.source,j=typeof P.target=="object"?P.target?.id:P.target;return N!==void 0&&j!==void 0&&!x.has(N)&&!x.has(j)});s({nodes:b,links:M})},[s]),m=A.useCallback(_=>{const x={id:It("l"),..._};return s({nodes:a.current.nodes,links:[...a.current.links,x]}),x},[s]),v=A.useCallback(_=>{const x=_.map(w=>({id:It("l"),...w}));return s({nodes:a.current.nodes,links:[...a.current.links,...x]}),x},[s]),g=A.useCallback(_=>{const x=a.current.links.filter(w=>!_(w));s({nodes:a.current.nodes,links:x})},[s]),S=A.useCallback(()=>{s({nodes:[],links:[]})},[s]);return A.useMemo(()=>({data:o,setData:u,addNode:f,addNodes:c,updateNode:p,removeNode:h,removeNodes:d,addLink:m,addLinks:v,removeLink:g,clear:S}),[o,u,f,c,p,h,d,m,v,g,S])}function jl(e,t,n){var r,o=1;e==null&&(e=0),t==null&&(t=0),n==null&&(n=0);function i(){var a,l=r.length,s,u=0,f=0,c=0;for(a=0;a<l;++a)s=r[a],u+=s.x||0,f+=s.y||0,c+=s.z||0;for(u=(u/l-e)*o,f=(f/l-t)*o,c=(c/l-n)*o,a=0;a<l;++a)s=r[a],u&&(s.x-=u),f&&(s.y-=f),c&&(s.z-=c)}return i.initialize=function(a){r=a},i.x=function(a){return arguments.length?(e=+a,i):e},i.y=function(a){return arguments.length?(t=+a,i):t},i.z=function(a){return arguments.length?(n=+a,i):n},i.strength=function(a){return arguments.length?(o=+a,i):o},i}function zl(e){const t=+this._x.call(null,e);return ga(this.cover(t),t,e)}function ga(e,t,n){if(isNaN(t))return e;var r,o=e._root,i={data:n},a=e._x0,l=e._x1,s,u,f,c,p;if(!o)return e._root=i,e;for(;o.length;)if((f=t>=(s=(a+l)/2))?a=s:l=s,r=o,!(o=o[c=+f]))return r[c]=i,e;if(u=+e._x.call(null,o.data),t===u)return i.next=o,r?r[c]=i:e._root=i,e;do r=r?r[c]=new Array(2):e._root=new Array(2),(f=t>=(s=(a+l)/2))?a=s:l=s;while((c=+f)==(p=+(u>=s)));return r[p]=o,r[c]=i,e}function Tl(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t);let r=1/0,o=-1/0;for(let i=0,a;i<t;++i)isNaN(a=+this._x.call(null,e[i]))||(n[i]=a,a<r&&(r=a),a>o&&(o=a));if(r>o)return this;this.cover(r).cover(o);for(let i=0;i<t;++i)ga(this,n[i],e[i]);return this}function El(e){if(isNaN(e=+e))return this;var t=this._x0,n=this._x1;if(isNaN(t))n=(t=Math.floor(e))+1;else{for(var r=n-t||1,o=this._root,i,a;t>e||e>=n;)switch(a=+(e<t),i=new Array(2),i[a]=o,o=i,r*=2,a){case 0:n=t+r;break;case 1:t=n-r;break}this._root&&this._root.length&&(this._root=o)}return this._x0=t,this._x1=n,this}function Ll(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Nl(e){return arguments.length?this.cover(+e[0][0]).cover(+e[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]}function kt(e,t,n){this.node=e,this.x0=t,this.x1=n}function Rl(e,t){var n,r=this._x0,o,i,a=this._x1,l=[],s=this._root,u,f;for(s&&l.push(new kt(s,r,a)),t==null?t=1/0:(r=e-t,a=e+t);u=l.pop();)if(!(!(s=u.node)||(o=u.x0)>a||(i=u.x1)<r))if(s.length){var c=(o+i)/2;l.push(new kt(s[1],c,i),new kt(s[0],o,c)),(f=+(e>=c))&&(u=l[l.length-1],l[l.length-1]=l[l.length-1-f],l[l.length-1-f]=u)}else{var p=Math.abs(e-+this._x.call(null,s.data));p<t&&(t=p,r=e-p,a=e+p,n=s.data)}return n}function Dl(e){if(isNaN(s=+this._x.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._x1,s,u,f,c,p;if(!n)return this;if(n.length)for(;;){if((f=s>=(u=(a+l)/2))?a=u:l=u,t=n,!(n=n[c=+f]))return this;if(!n.length)break;t[c+1&1]&&(r=t,p=c)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[c]=i:delete t[c],(n=t[0]||t[1])&&n===(t[1]||t[0])&&!n.length&&(r?r[p]=n:this._root=n),this):(this._root=i,this)}function Il(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Fl(){return this._root}function Bl(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function $l(e){var t=[],n,r=this._root,o,i,a;for(r&&t.push(new kt(r,this._x0,this._x1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.x1)&&r.length){var l=(i+a)/2;(o=r[1])&&t.push(new kt(o,l,a)),(o=r[0])&&t.push(new kt(o,i,l))}return this}function Hl(e){var t=[],n=[],r;for(this._root&&t.push(new kt(this._root,this._x0,this._x1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.x1,s=(a+l)/2;(i=o[0])&&t.push(new kt(i,a,s)),(i=o[1])&&t.push(new kt(i,s,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.x1);return this}function ql(e){return e[0]}function Ul(e){return arguments.length?(this._x=e,this):this._x}function ao(e,t){var n=new so(t??ql,NaN,NaN);return e==null?n:n.addAll(e)}function so(e,t,n){this._x=e,this._x0=t,this._x1=n,this._root=void 0}function si(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ve=ao.prototype=so.prototype;Ve.copy=function(){var e=new so(this._x,this._x0,this._x1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=si(t),e;for(n=[{source:t,target:e._root=new Array(2)}];t=n.pop();)for(var o=0;o<2;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(2)}):t.target[o]=si(r));return e};Ve.add=zl;Ve.addAll=Tl;Ve.cover=El;Ve.data=Ll;Ve.extent=Nl;Ve.find=Rl;Ve.remove=Dl;Ve.removeAll=Il;Ve.root=Fl;Ve.size=Bl;Ve.visit=$l;Ve.visitAfter=Hl;Ve.x=Ul;function Gl(e){const t=+this._x.call(null,e),n=+this._y.call(null,e);return va(this.cover(t,n),t,n,e)}function va(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var o,i=e._root,a={data:r},l=e._x0,s=e._y0,u=e._x1,f=e._y1,c,p,h,d,m,v,g,S;if(!i)return e._root=a,e;for(;i.length;)if((m=t>=(c=(l+u)/2))?l=c:u=c,(v=n>=(p=(s+f)/2))?s=p:f=p,o=i,!(i=i[g=v<<1|m]))return o[g]=a,e;if(h=+e._x.call(null,i.data),d=+e._y.call(null,i.data),t===h&&n===d)return a.next=i,o?o[g]=a:e._root=a,e;do o=o?o[g]=new Array(4):e._root=new Array(4),(m=t>=(c=(l+u)/2))?l=c:u=c,(v=n>=(p=(s+f)/2))?s=p:f=p;while((g=v<<1|m)===(S=(d>=p)<<1|h>=c));return o[S]=i,o[g]=a,e}function Vl(e){var t,n,r=e.length,o,i,a=new Array(r),l=new Array(r),s=1/0,u=1/0,f=-1/0,c=-1/0;for(n=0;n<r;++n)isNaN(o=+this._x.call(null,t=e[n]))||isNaN(i=+this._y.call(null,t))||(a[n]=o,l[n]=i,o<s&&(s=o),o>f&&(f=o),i<u&&(u=i),i>c&&(c=i));if(s>f||u>c)return this;for(this.cover(s,u).cover(f,c),n=0;n<r;++n)va(this,a[n],l[n],e[n]);return this}function Wl(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,o=this._x1,i=this._y1;if(isNaN(n))o=(n=Math.floor(e))+1,i=(r=Math.floor(t))+1;else{for(var a=o-n||1,l=this._root,s,u;n>e||e>=o||r>t||t>=i;)switch(u=(t<r)<<1|e<n,s=new Array(4),s[u]=l,l=s,a*=2,u){case 0:o=n+a,i=r+a;break;case 1:n=o-a,i=r+a;break;case 2:o=n+a,r=i-a;break;case 3:n=o-a,r=i-a;break}this._root&&this._root.length&&(this._root=l)}return this._x0=n,this._y0=r,this._x1=o,this._y1=i,this}function Yl(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function Xl(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function Be(e,t,n,r,o){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=o}function Kl(e,t,n){var r,o=this._x0,i=this._y0,a,l,s,u,f=this._x1,c=this._y1,p=[],h=this._root,d,m;for(h&&p.push(new Be(h,o,i,f,c)),n==null?n=1/0:(o=e-n,i=t-n,f=e+n,c=t+n,n*=n);d=p.pop();)if(!(!(h=d.node)||(a=d.x0)>f||(l=d.y0)>c||(s=d.x1)<o||(u=d.y1)<i))if(h.length){var v=(a+s)/2,g=(l+u)/2;p.push(new Be(h[3],v,g,s,u),new Be(h[2],a,g,v,u),new Be(h[1],v,l,s,g),new Be(h[0],a,l,v,g)),(m=(t>=g)<<1|e>=v)&&(d=p[p.length-1],p[p.length-1]=p[p.length-1-m],p[p.length-1-m]=d)}else{var S=e-+this._x.call(null,h.data),_=t-+this._y.call(null,h.data),x=S*S+_*_;if(x<n){var w=Math.sqrt(n=x);o=e-w,i=t-w,f=e+w,c=t+w,r=h.data}}return r}function Zl(e){if(isNaN(f=+this._x.call(null,e))||isNaN(c=+this._y.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._y0,s=this._x1,u=this._y1,f,c,p,h,d,m,v,g;if(!n)return this;if(n.length)for(;;){if((d=f>=(p=(a+s)/2))?a=p:s=p,(m=c>=(h=(l+u)/2))?l=h:u=h,t=n,!(n=n[v=m<<1|d]))return this;if(!n.length)break;(t[v+1&3]||t[v+2&3]||t[v+3&3])&&(r=t,g=v)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[v]=i:delete t[v],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[g]=n:this._root=n),this):(this._root=i,this)}function Ql(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function Jl(){return this._root}function ec(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function tc(e){var t=[],n,r=this._root,o,i,a,l,s;for(r&&t.push(new Be(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,l=n.x1,s=n.y1)&&r.length){var u=(i+l)/2,f=(a+s)/2;(o=r[3])&&t.push(new Be(o,u,f,l,s)),(o=r[2])&&t.push(new Be(o,i,f,u,s)),(o=r[1])&&t.push(new Be(o,u,a,l,f)),(o=r[0])&&t.push(new Be(o,i,a,u,f))}return this}function nc(e){var t=[],n=[],r;for(this._root&&t.push(new Be(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.y0,s=r.x1,u=r.y1,f=(a+s)/2,c=(l+u)/2;(i=o[0])&&t.push(new Be(i,a,l,f,c)),(i=o[1])&&t.push(new Be(i,f,l,s,c)),(i=o[2])&&t.push(new Be(i,a,c,f,u)),(i=o[3])&&t.push(new Be(i,f,c,s,u))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function rc(e){return e[0]}function oc(e){return arguments.length?(this._x=e,this):this._x}function ic(e){return e[1]}function ac(e){return arguments.length?(this._y=e,this):this._y}function lo(e,t,n){var r=new co(t??rc,n??ic,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function co(e,t,n,r,o,i){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=o,this._y1=i,this._root=void 0}function li(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var $e=lo.prototype=co.prototype;$e.copy=function(){var e=new co(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=li(t),e;for(n=[{source:t,target:e._root=new Array(4)}];t=n.pop();)for(var o=0;o<4;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(4)}):t.target[o]=li(r));return e};$e.add=Gl;$e.addAll=Vl;$e.cover=Wl;$e.data=Yl;$e.extent=Xl;$e.find=Kl;$e.remove=Zl;$e.removeAll=Ql;$e.root=Jl;$e.size=ec;$e.visit=tc;$e.visitAfter=nc;$e.x=oc;$e.y=ac;function sc(e){const t=+this._x.call(null,e),n=+this._y.call(null,e),r=+this._z.call(null,e);return ya(this.cover(t,n,r),t,n,r,e)}function ya(e,t,n,r,o){if(isNaN(t)||isNaN(n)||isNaN(r))return e;var i,a=e._root,l={data:o},s=e._x0,u=e._y0,f=e._z0,c=e._x1,p=e._y1,h=e._z1,d,m,v,g,S,_,x,w,b,M,P;if(!a)return e._root=l,e;for(;a.length;)if((x=t>=(d=(s+c)/2))?s=d:c=d,(w=n>=(m=(u+p)/2))?u=m:p=m,(b=r>=(v=(f+h)/2))?f=v:h=v,i=a,!(a=a[M=b<<2|w<<1|x]))return i[M]=l,e;if(g=+e._x.call(null,a.data),S=+e._y.call(null,a.data),_=+e._z.call(null,a.data),t===g&&n===S&&r===_)return l.next=a,i?i[M]=l:e._root=l,e;do i=i?i[M]=new Array(8):e._root=new Array(8),(x=t>=(d=(s+c)/2))?s=d:c=d,(w=n>=(m=(u+p)/2))?u=m:p=m,(b=r>=(v=(f+h)/2))?f=v:h=v;while((M=b<<2|w<<1|x)===(P=(_>=v)<<2|(S>=m)<<1|g>=d));return i[P]=a,i[M]=l,e}function lc(e){Array.isArray(e)||(e=Array.from(e));const t=e.length,n=new Float64Array(t),r=new Float64Array(t),o=new Float64Array(t);let i=1/0,a=1/0,l=1/0,s=-1/0,u=-1/0,f=-1/0;for(let c=0,p,h,d,m;c<t;++c)isNaN(h=+this._x.call(null,p=e[c]))||isNaN(d=+this._y.call(null,p))||isNaN(m=+this._z.call(null,p))||(n[c]=h,r[c]=d,o[c]=m,h<i&&(i=h),h>s&&(s=h),d<a&&(a=d),d>u&&(u=d),m<l&&(l=m),m>f&&(f=m));if(i>s||a>u||l>f)return this;this.cover(i,a,l).cover(s,u,f);for(let c=0;c<t;++c)ya(this,n[c],r[c],o[c],e[c]);return this}function cc(e,t,n){if(isNaN(e=+e)||isNaN(t=+t)||isNaN(n=+n))return this;var r=this._x0,o=this._y0,i=this._z0,a=this._x1,l=this._y1,s=this._z1;if(isNaN(r))a=(r=Math.floor(e))+1,l=(o=Math.floor(t))+1,s=(i=Math.floor(n))+1;else{for(var u=a-r||1,f=this._root,c,p;r>e||e>=a||o>t||t>=l||i>n||n>=s;)switch(p=(n<i)<<2|(t<o)<<1|e<r,c=new Array(8),c[p]=f,f=c,u*=2,p){case 0:a=r+u,l=o+u,s=i+u;break;case 1:r=a-u,l=o+u,s=i+u;break;case 2:a=r+u,o=l-u,s=i+u;break;case 3:r=a-u,o=l-u,s=i+u;break;case 4:a=r+u,l=o+u,i=s-u;break;case 5:r=a-u,l=o+u,i=s-u;break;case 6:a=r+u,o=l-u,i=s-u;break;case 7:r=a-u,o=l-u,i=s-u;break}this._root&&this._root.length&&(this._root=f)}return this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=l,this._z1=s,this}function uc(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function fc(e){return arguments.length?this.cover(+e[0][0],+e[0][1],+e[0][2]).cover(+e[1][0],+e[1][1],+e[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]}function me(e,t,n,r,o,i,a){this.node=e,this.x0=t,this.y0=n,this.z0=r,this.x1=o,this.y1=i,this.z1=a}function dc(e,t,n,r){var o,i=this._x0,a=this._y0,l=this._z0,s,u,f,c,p,h,d=this._x1,m=this._y1,v=this._z1,g=[],S=this._root,_,x;for(S&&g.push(new me(S,i,a,l,d,m,v)),r==null?r=1/0:(i=e-r,a=t-r,l=n-r,d=e+r,m=t+r,v=n+r,r*=r);_=g.pop();)if(!(!(S=_.node)||(s=_.x0)>d||(u=_.y0)>m||(f=_.z0)>v||(c=_.x1)<i||(p=_.y1)<a||(h=_.z1)<l))if(S.length){var w=(s+c)/2,b=(u+p)/2,M=(f+h)/2;g.push(new me(S[7],w,b,M,c,p,h),new me(S[6],s,b,M,w,p,h),new me(S[5],w,u,M,c,b,h),new me(S[4],s,u,M,w,b,h),new me(S[3],w,b,f,c,p,M),new me(S[2],s,b,f,w,p,M),new me(S[1],w,u,f,c,b,M),new me(S[0],s,u,f,w,b,M)),(x=(n>=M)<<2|(t>=b)<<1|e>=w)&&(_=g[g.length-1],g[g.length-1]=g[g.length-1-x],g[g.length-1-x]=_)}else{var P=e-+this._x.call(null,S.data),N=t-+this._y.call(null,S.data),j=n-+this._z.call(null,S.data),F=P*P+N*N+j*j;if(F<r){var I=Math.sqrt(r=F);i=e-I,a=t-I,l=n-I,d=e+I,m=t+I,v=n+I,o=S.data}}return o}const hc=(e,t,n,r,o,i)=>Math.sqrt((e-r)**2+(t-o)**2+(n-i)**2);function pc(e,t,n,r){const o=[],i=e-r,a=t-r,l=n-r,s=e+r,u=t+r,f=n+r;return this.visit((c,p,h,d,m,v,g)=>{if(!c.length)do{const S=c.data;hc(e,t,n,this._x(S),this._y(S),this._z(S))<=r&&o.push(S)}while(c=c.next);return p>s||h>u||d>f||m<i||v<a||g<l}),o}function gc(e){if(isNaN(p=+this._x.call(null,e))||isNaN(h=+this._y.call(null,e))||isNaN(d=+this._z.call(null,e)))return this;var t,n=this._root,r,o,i,a=this._x0,l=this._y0,s=this._z0,u=this._x1,f=this._y1,c=this._z1,p,h,d,m,v,g,S,_,x,w,b;if(!n)return this;if(n.length)for(;;){if((S=p>=(m=(a+u)/2))?a=m:u=m,(_=h>=(v=(l+f)/2))?l=v:f=v,(x=d>=(g=(s+c)/2))?s=g:c=g,t=n,!(n=n[w=x<<2|_<<1|S]))return this;if(!n.length)break;(t[w+1&7]||t[w+2&7]||t[w+3&7]||t[w+4&7]||t[w+5&7]||t[w+6&7]||t[w+7&7])&&(r=t,b=w)}for(;n.data!==e;)if(o=n,!(n=n.next))return this;return(i=n.next)&&delete n.next,o?(i?o.next=i:delete o.next,this):t?(i?t[w]=i:delete t[w],(n=t[0]||t[1]||t[2]||t[3]||t[4]||t[5]||t[6]||t[7])&&n===(t[7]||t[6]||t[5]||t[4]||t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[b]=n:this._root=n),this):(this._root=i,this)}function vc(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function yc(){return this._root}function mc(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function bc(e){var t=[],n,r=this._root,o,i,a,l,s,u,f;for(r&&t.push(new me(r,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));n=t.pop();)if(!e(r=n.node,i=n.x0,a=n.y0,l=n.z0,s=n.x1,u=n.y1,f=n.z1)&&r.length){var c=(i+s)/2,p=(a+u)/2,h=(l+f)/2;(o=r[7])&&t.push(new me(o,c,p,h,s,u,f)),(o=r[6])&&t.push(new me(o,i,p,h,c,u,f)),(o=r[5])&&t.push(new me(o,c,a,h,s,p,f)),(o=r[4])&&t.push(new me(o,i,a,h,c,p,f)),(o=r[3])&&t.push(new me(o,c,p,l,s,u,h)),(o=r[2])&&t.push(new me(o,i,p,l,c,u,h)),(o=r[1])&&t.push(new me(o,c,a,l,s,p,h)),(o=r[0])&&t.push(new me(o,i,a,l,c,p,h))}return this}function _c(e){var t=[],n=[],r;for(this._root&&t.push(new me(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));r=t.pop();){var o=r.node;if(o.length){var i,a=r.x0,l=r.y0,s=r.z0,u=r.x1,f=r.y1,c=r.z1,p=(a+u)/2,h=(l+f)/2,d=(s+c)/2;(i=o[0])&&t.push(new me(i,a,l,s,p,h,d)),(i=o[1])&&t.push(new me(i,p,l,s,u,h,d)),(i=o[2])&&t.push(new me(i,a,h,s,p,f,d)),(i=o[3])&&t.push(new me(i,p,h,s,u,f,d)),(i=o[4])&&t.push(new me(i,a,l,d,p,h,c)),(i=o[5])&&t.push(new me(i,p,l,d,u,h,c)),(i=o[6])&&t.push(new me(i,a,h,d,p,f,c)),(i=o[7])&&t.push(new me(i,p,h,d,u,f,c))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.z0,r.x1,r.y1,r.z1);return this}function xc(e){return e[0]}function wc(e){return arguments.length?(this._x=e,this):this._x}function kc(e){return e[1]}function Cc(e){return arguments.length?(this._y=e,this):this._y}function Sc(e){return e[2]}function Mc(e){return arguments.length?(this._z=e,this):this._z}function uo(e,t,n,r){var o=new fo(t??xc,n??kc,r??Sc,NaN,NaN,NaN,NaN,NaN,NaN);return e==null?o:o.addAll(e)}function fo(e,t,n,r,o,i,a,l,s){this._x=e,this._y=t,this._z=n,this._x0=r,this._y0=o,this._z0=i,this._x1=a,this._y1=l,this._z1=s,this._root=void 0}function ci(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var Ee=uo.prototype=fo.prototype;Ee.copy=function(){var e=new fo(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ci(t),e;for(n=[{source:t,target:e._root=new Array(8)}];t=n.pop();)for(var o=0;o<8;++o)(r=t.source[o])&&(r.length?n.push({source:r,target:t.target[o]=new Array(8)}):t.target[o]=ci(r));return e};Ee.add=sc;Ee.addAll=lc;Ee.cover=cc;Ee.data=uc;Ee.extent=fc;Ee.find=dc;Ee.findAllWithinRadius=pc;Ee.remove=gc;Ee.removeAll=vc;Ee.root=yc;Ee.size=mc;Ee.visit=bc;Ee.visitAfter=_c;Ee.x=wc;Ee.y=Cc;Ee.z=Mc;function Oe(e){return function(){return e}}function nt(e){return(e()-.5)*1e-6}function _r(e){return e.x+e.vx}function ui(e){return e.y+e.vy}function Pc(e){return e.z+e.vz}function fi(e){var t,n,r,o,i=1,a=1;typeof e!="function"&&(e=Oe(e==null?1:+e));function l(){for(var f,c=t.length,p,h,d,m,v,g,S,_=0;_<a;++_)for(p=(n===1?ao(t,_r):n===2?lo(t,_r,ui):n===3?uo(t,_r,ui,Pc):null).visitAfter(s),f=0;f<c;++f)h=t[f],g=r[h.index],S=g*g,d=h.x+h.vx,n>1&&(m=h.y+h.vy),n>2&&(v=h.z+h.vz),p.visit(x);function x(w,b,M,P,N,j,F){var I=[b,M,P,N,j,F],K=I[0],O=I[1],y=I[2],k=I[n],C=I[n+1],$=I[n+2],B=w.data,X=w.r,L=g+X;if(B){if(B.index>h.index){var D=d-B.x-B.vx,q=n>1?m-B.y-B.vy:0,Y=n>2?v-B.z-B.vz:0,E=D*D+q*q+Y*Y;E<L*L&&(D===0&&(D=nt(o),E+=D*D),n>1&&q===0&&(q=nt(o),E+=q*q),n>2&&Y===0&&(Y=nt(o),E+=Y*Y),E=(L-(E=Math.sqrt(E)))/E*i,h.vx+=(D*=E)*(L=(X*=X)/(S+X)),n>1&&(h.vy+=(q*=E)*L),n>2&&(h.vz+=(Y*=E)*L),B.vx-=D*(L=1-L),n>1&&(B.vy-=q*L),n>2&&(B.vz-=Y*L))}return}return K>d+L||k<d-L||n>1&&(O>m+L||C<m-L)||n>2&&(y>v+L||$<v-L)}}function s(f){if(f.data)return f.r=r[f.data.index];for(var c=f.r=0;c<Math.pow(2,n);++c)f[c]&&f[c].r>f.r&&(f.r=f[c].r)}function u(){if(t){var f,c=t.length,p;for(r=new Array(c),f=0;f<c;++f)p=t[f],r[p.index]=+e(p,f,t)}}return l.initialize=function(f,...c){t=f,o=c.find(p=>typeof p=="function")||Math.random,n=c.find(p=>[1,2,3].includes(p))||2,u()},l.iterations=function(f){return arguments.length?(a=+f,l):a},l.strength=function(f){return arguments.length?(i=+f,l):i},l.radius=function(f){return arguments.length?(e=typeof f=="function"?f:Oe(+f),u(),l):e},l}function Ac(e){return e.index}function di(e,t){var n=e.get(t);if(!n)throw new Error("node not found: "+t);return n}function Oc(e){var t=Ac,n=p,r,o=Oe(30),i,a,l,s,u,f,c=1;e==null&&(e=[]);function p(g){return 1/Math.min(s[g.source.index],s[g.target.index])}function h(g){for(var S=0,_=e.length;S<c;++S)for(var x=0,w,b,M,P=0,N=0,j=0,F,I;x<_;++x)w=e[x],b=w.source,M=w.target,P=M.x+M.vx-b.x-b.vx||nt(f),l>1&&(N=M.y+M.vy-b.y-b.vy||nt(f)),l>2&&(j=M.z+M.vz-b.z-b.vz||nt(f)),F=Math.sqrt(P*P+N*N+j*j),F=(F-i[x])/F*g*r[x],P*=F,N*=F,j*=F,M.vx-=P*(I=u[x]),l>1&&(M.vy-=N*I),l>2&&(M.vz-=j*I),b.vx+=P*(I=1-I),l>1&&(b.vy+=N*I),l>2&&(b.vz+=j*I)}function d(){if(a){var g,S=a.length,_=e.length,x=new Map(a.map((b,M)=>[t(b,M,a),b])),w;for(g=0,s=new Array(S);g<_;++g)w=e[g],w.index=g,typeof w.source!="object"&&(w.source=di(x,w.source)),typeof w.target!="object"&&(w.target=di(x,w.target)),s[w.source.index]=(s[w.source.index]||0)+1,s[w.target.index]=(s[w.target.index]||0)+1;for(g=0,u=new Array(_);g<_;++g)w=e[g],u[g]=s[w.source.index]/(s[w.source.index]+s[w.target.index]);r=new Array(_),m(),i=new Array(_),v()}}function m(){if(a)for(var g=0,S=e.length;g<S;++g)r[g]=+n(e[g],g,e)}function v(){if(a)for(var g=0,S=e.length;g<S;++g)i[g]=+o(e[g],g,e)}return h.initialize=function(g,...S){a=g,f=S.find(_=>typeof _=="function")||Math.random,l=S.find(_=>[1,2,3].includes(_))||2,d()},h.links=function(g){return arguments.length?(e=g,d(),h):e},h.id=function(g){return arguments.length?(t=g,h):t},h.iterations=function(g){return arguments.length?(c=+g,h):c},h.strength=function(g){return arguments.length?(n=typeof g=="function"?g:Oe(+g),m(),h):n},h.distance=function(g){return arguments.length?(o=typeof g=="function"?g:Oe(+g),v(),h):o},h}var jc={value:()=>{}};function ma(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Un(n)}function Un(e){this._=e}function zc(e,t){return e.trim().split(/^|\s+/).map(function(n){var r="",o=n.indexOf(".");if(o>=0&&(r=n.slice(o+1),n=n.slice(0,o)),n&&!t.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Un.prototype=ma.prototype={constructor:Un,on:function(e,t){var n=this._,r=zc(e+"",n),o,i=-1,a=r.length;if(arguments.length<2){for(;++i<a;)if((o=(e=r[i]).type)&&(o=Tc(n[o],e.name)))return o;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++i<a;)if(o=(e=r[i]).type)n[o]=hi(n[o],e.name,t);else if(t==null)for(o in n)n[o]=hi(n[o],e.name,null);return this},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new Un(e)},call:function(e,t){if((o=arguments.length-2)>0)for(var n=new Array(o),r=0,o,i;r<o;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(i=this._[e],r=0,o=i.length;r<o;++r)i[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var r=this._[e],o=0,i=r.length;o<i;++o)r[o].value.apply(t,n)}};function Tc(e,t){for(var n=0,r=e.length,o;n<r;++n)if((o=e[n]).name===t)return o.value}function hi(e,t,n){for(var r=0,o=e.length;r<o;++r)if(e[r].name===t){e[r]=jc,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var Jt=0,mn=0,un=0,ba=1e3,Wn,bn,Yn=0,$t=0,ir=0,Sn=typeof performance=="object"&&performance.now?performance:Date,_a=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function xa(){return $t||(_a(Ec),$t=Sn.now()+ir)}function Ec(){$t=0}function Fr(){this._call=this._time=this._next=null}Fr.prototype=wa.prototype={constructor:Fr,restart:function(e,t,n){if(typeof e!="function")throw new TypeError("callback is not a function");n=(n==null?xa():+n)+(t==null?0:+t),!this._next&&bn!==this&&(bn?bn._next=this:Wn=this,bn=this),this._call=e,this._time=n,Br()},stop:function(){this._call&&(this._call=null,this._time=1/0,Br())}};function wa(e,t,n){var r=new Fr;return r.restart(e,t,n),r}function Lc(){xa(),++Jt;for(var e=Wn,t;e;)(t=$t-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Jt}function pi(){$t=(Yn=Sn.now())+ir,Jt=mn=0;try{Lc()}finally{Jt=0,Rc(),$t=0}}function Nc(){var e=Sn.now(),t=e-Yn;t>ba&&(ir-=t,Yn=e)}function Rc(){for(var e,t=Wn,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:Wn=n);bn=e,Br(r)}function Br(e){if(!Jt){mn&&(mn=clearTimeout(mn));var t=e-$t;t>24?(e<1/0&&(mn=setTimeout(pi,e-Sn.now()-ir)),un&&(un=clearInterval(un))):(un||(Yn=Sn.now(),un=setInterval(Nc,ba)),Jt=1,_a(pi))}}const Dc=1664525,Ic=1013904223,gi=4294967296;function Fc(){let e=1;return()=>(e=(Dc*e+Ic)%gi)/gi}var vi=3;function xr(e){return e.x}function yi(e){return e.y}function Bc(e){return e.z}var $c=10,Hc=Math.PI*(3-Math.sqrt(5)),qc=Math.PI*20/(9+Math.sqrt(221));function Uc(e,t){t=t||2;var n=Math.min(vi,Math.max(1,Math.round(t))),r,o=1,i=.001,a=1-Math.pow(i,1/300),l=0,s=.6,u=new Map,f=wa(h),c=ma("tick","end"),p=Fc();e==null&&(e=[]);function h(){d(),c.call("tick",r),o<i&&(f.stop(),c.call("end",r))}function d(g){var S,_=e.length,x;g===void 0&&(g=1);for(var w=0;w<g;++w)for(o+=(l-o)*a,u.forEach(function(b){b(o)}),S=0;S<_;++S)x=e[S],x.fx==null?x.x+=x.vx*=s:(x.x=x.fx,x.vx=0),n>1&&(x.fy==null?x.y+=x.vy*=s:(x.y=x.fy,x.vy=0)),n>2&&(x.fz==null?x.z+=x.vz*=s:(x.z=x.fz,x.vz=0));return r}function m(){for(var g=0,S=e.length,_;g<S;++g){if(_=e[g],_.index=g,_.fx!=null&&(_.x=_.fx),_.fy!=null&&(_.y=_.fy),_.fz!=null&&(_.z=_.fz),isNaN(_.x)||n>1&&isNaN(_.y)||n>2&&isNaN(_.z)){var x=$c*(n>2?Math.cbrt(.5+g):n>1?Math.sqrt(.5+g):g),w=g*Hc,b=g*qc;n===1?_.x=x:n===2?(_.x=x*Math.cos(w),_.y=x*Math.sin(w)):(_.x=x*Math.sin(w)*Math.cos(b),_.y=x*Math.cos(w),_.z=x*Math.sin(w)*Math.sin(b))}(isNaN(_.vx)||n>1&&isNaN(_.vy)||n>2&&isNaN(_.vz))&&(_.vx=0,n>1&&(_.vy=0),n>2&&(_.vz=0))}}function v(g){return g.initialize&&g.initialize(e,p,n),g}return m(),r={tick:d,restart:function(){return f.restart(h),r},stop:function(){return f.stop(),r},numDimensions:function(g){return arguments.length?(n=Math.min(vi,Math.max(1,Math.round(g))),u.forEach(v),r):n},nodes:function(g){return arguments.length?(e=g,m(),u.forEach(v),r):e},alpha:function(g){return arguments.length?(o=+g,r):o},alphaMin:function(g){return arguments.length?(i=+g,r):i},alphaDecay:function(g){return arguments.length?(a=+g,r):+a},alphaTarget:function(g){return arguments.length?(l=+g,r):l},velocityDecay:function(g){return arguments.length?(s=1-g,r):1-s},randomSource:function(g){return arguments.length?(p=g,u.forEach(v),r):p},force:function(g,S){return arguments.length>1?(S==null?u.delete(g):u.set(g,v(S)),r):u.get(g)},find:function(){var g=Array.prototype.slice.call(arguments),S=g.shift()||0,_=(n>1?g.shift():null)||0,x=(n>2?g.shift():null)||0,w=g.shift()||1/0,b=0,M=e.length,P,N,j,F,I,K;for(w*=w,b=0;b<M;++b)I=e[b],P=S-I.x,N=_-(I.y||0),j=x-(I.z||0),F=P*P+N*N+j*j,F<w&&(K=I,w=F);return K},on:function(g,S){return arguments.length>1?(c.on(g,S),r):c.on(g)}}}function Gc(){var e,t,n,r,o,i=Oe(-30),a,l=1,s=1/0,u=.81;function f(d){var m,v=e.length,g=(t===1?ao(e,xr):t===2?lo(e,xr,yi):t===3?uo(e,xr,yi,Bc):null).visitAfter(p);for(o=d,m=0;m<v;++m)n=e[m],g.visit(h)}function c(){if(e){var d,m=e.length,v;for(a=new Array(m),d=0;d<m;++d)v=e[d],a[v.index]=+i(v,d,e)}}function p(d){var m=0,v,g,S=0,_,x,w,b,M=d.length;if(M){for(_=x=w=b=0;b<M;++b)(v=d[b])&&(g=Math.abs(v.value))&&(m+=v.value,S+=g,_+=g*(v.x||0),x+=g*(v.y||0),w+=g*(v.z||0));m*=Math.sqrt(4/M),d.x=_/S,t>1&&(d.y=x/S),t>2&&(d.z=w/S)}else{v=d,v.x=v.data.x,t>1&&(v.y=v.data.y),t>2&&(v.z=v.data.z);do m+=a[v.data.index];while(v=v.next)}d.value=m}function h(d,m,v,g,S){if(!d.value)return!0;var _=[v,g,S][t-1],x=d.x-n.x,w=t>1?d.y-n.y:0,b=t>2?d.z-n.z:0,M=_-m,P=x*x+w*w+b*b;if(M*M/u<P)return P<s&&(x===0&&(x=nt(r),P+=x*x),t>1&&w===0&&(w=nt(r),P+=w*w),t>2&&b===0&&(b=nt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)),n.vx+=x*d.value*o/P,t>1&&(n.vy+=w*d.value*o/P),t>2&&(n.vz+=b*d.value*o/P)),!0;if(d.length||P>=s)return;(d.data!==n||d.next)&&(x===0&&(x=nt(r),P+=x*x),t>1&&w===0&&(w=nt(r),P+=w*w),t>2&&b===0&&(b=nt(r),P+=b*b),P<l&&(P=Math.sqrt(l*P)));do d.data!==n&&(M=a[d.data.index]*o/P,n.vx+=x*M,t>1&&(n.vy+=w*M),t>2&&(n.vz+=b*M));while(d=d.next)}return f.initialize=function(d,...m){e=d,r=m.find(v=>typeof v=="function")||Math.random,t=m.find(v=>[1,2,3].includes(v))||2,c()},f.strength=function(d){return arguments.length?(i=typeof d=="function"?d:Oe(+d),c(),f):i},f.distanceMin=function(d){return arguments.length?(l=d*d,f):Math.sqrt(l)},f.distanceMax=function(d){return arguments.length?(s=d*d,f):Math.sqrt(s)},f.theta=function(d){return arguments.length?(u=d*d,f):Math.sqrt(u)},f}function Vc(e,t,n,r){var o,i,a=Oe(.1),l,s;typeof e!="function"&&(e=Oe(+e)),t==null&&(t=0),n==null&&(n=0),r==null&&(r=0);function u(c){for(var p=0,h=o.length;p<h;++p){var d=o[p],m=d.x-t||1e-6,v=(d.y||0)-n||1e-6,g=(d.z||0)-r||1e-6,S=Math.sqrt(m*m+v*v+g*g),_=(s[p]-S)*l[p]*c/S;d.vx+=m*_,i>1&&(d.vy+=v*_),i>2&&(d.vz+=g*_)}}function f(){if(o){var c,p=o.length;for(l=new Array(p),s=new Array(p),c=0;c<p;++c)s[c]=+e(o[c],c,o),l[c]=isNaN(s[c])?0:+a(o[c],c,o)}}return u.initialize=function(c,...p){o=c,i=p.find(h=>[1,2,3].includes(h))||2,f()},u.strength=function(c){return arguments.length?(a=typeof c=="function"?c:Oe(+c),f(),u):a},u.radius=function(c){return arguments.length?(e=typeof c=="function"?c:Oe(+c),f(),u):e},u.x=function(c){return arguments.length?(t=+c,u):t},u.y=function(c){return arguments.length?(n=+c,u):n},u.z=function(c){return arguments.length?(r=+c,u):r},u}function mi(e){var t=Oe(.1),n,r,o;typeof e!="function"&&(e=Oe(e==null?0:+e));function i(l){for(var s=0,u=n.length,f;s<u;++s)f=n[s],f.vx+=(o[s]-f.x)*r[s]*l}function a(){if(n){var l,s=n.length;for(r=new Array(s),o=new Array(s),l=0;l<s;++l)r[l]=isNaN(o[l]=+e(n[l],l,n))?0:+t(n[l],l,n)}}return i.initialize=function(l){n=l,a()},i.strength=function(l){return arguments.length?(t=typeof l=="function"?l:Oe(+l),a(),i):t},i.x=function(l){return arguments.length?(e=typeof l=="function"?l:Oe(+l),a(),i):e},i}function bi(e){var t=Oe(.1),n,r,o;typeof e!="function"&&(e=Oe(e==null?0:+e));function i(l){for(var s=0,u=n.length,f;s<u;++s)f=n[s],f.vy+=(o[s]-f.y)*r[s]*l}function a(){if(n){var l,s=n.length;for(r=new Array(s),o=new Array(s),l=0;l<s;++l)r[l]=isNaN(o[l]=+e(n[l],l,n))?0:+t(n[l],l,n)}}return i.initialize=function(l){n=l,a()},i.strength=function(l){return arguments.length?(t=typeof l=="function"?l:Oe(+l),a(),i):t},i.y=function(l){return arguments.length?(e=typeof l=="function"?l:Oe(+l),a(),i):e},i}function ka(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Wc(e){Xc(e);const t=Yc(e);return e.on=t.on,e.off=t.off,e.fire=t.fire,e}function Yc(e){let t=Object.create(null);return{on:function(n,r,o){if(typeof r!="function")throw new Error("callback is expected to be a function");let i=t[n];return i||(i=t[n]=[]),i.push({callback:r,ctx:o}),e},off:function(n,r){if(typeof n>"u")return t=Object.create(null),e;if(t[n])if(typeof r!="function")delete t[n];else{const o=t[n];for(let i=0;i<o.length;++i)o[i].callback===r&&o.splice(i,1)}return e},fire:function(n){const r=t[n];if(!r)return e;let o;arguments.length>1&&(o=Array.prototype.slice.call(arguments,1));for(let i=0;i<r.length;++i){const a=r[i];a.callback.apply(a.ctx,o)}return e}}}function Xc(e){if(!e)throw new Error("Eventify cannot use falsy object as events subject");const t=["on","fire","off"];for(let n=0;n<t.length;++n)if(e.hasOwnProperty(t[n]))throw new Error("Subject cannot be eventified, since it already has property '"+t[n]+"'")}var ho=Wc;const Kc=ka(ho);function Zc(e){if(e=e||{},"uniqueLinkId"in e&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
2
2
  `,`Note: there is also change in default behavior: From now on each graph
3
- is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},o=0,i=e.multigraph?x:b,a=[],s=H,l=H,c=H,f=H,u={version:20,addNode:g,addLink:m,removeLink:S,removeNode:d,getNode:y,getNodeCount:w,getLinkCount:_,getEdgeCount:_,getLinksCount:_,getNodesCount:w,getLinks:k,forEachNode:oe,forEachLinkedNode:C,forEachLink:I,beginUpdate:c,endUpdate:f,clear:T,hasLink:O,hasNode:y,getLink:O,getLinkById:E};return $c(u),v(),u;function v(){var D=u.on;u.on=F;function F(){return u.beginUpdate=c=V,u.endUpdate=f=X,s=h,l=p,u.on=D,D.apply(u,arguments)}}function h(D,F){a.push({link:D,changeType:F})}function p(D,F){a.push({node:D,changeType:F})}function g(D,F){if(D===void 0)throw new Error("Invalid node identifier");c();var W=y(D);return W?(W.data=F,l(W,"update")):(W=new Uc(D,F),l(W,"add")),t.set(D,W),f(),W}function y(D){return t.get(D)}function d(D){var F=y(D);if(!F)return!1;c();var W=F.links;return W&&(W.forEach(A),F.links=null),t.delete(D),l(F,"remove"),f(),!0}function m(D,F,W){c();var Q=y(D)||g(D),N=y(F)||g(F),U=i(D,F,W),z=n.has(U.id);return n.set(U.id,U),ui(Q,U),D!==F&&ui(N,U),s(U,z?"update":"add"),f(),U}function b(D,F,W){var Q=Pn(D,F),N=n.get(Q);return N?(N.data=W,N):new fi(D,F,W,Q)}function x(D,F,W){var Q=Pn(D,F),N=r.hasOwnProperty(Q);if(N||O(D,F)){N||(r[Q]=0);var U="@"+ ++r[Q];Q=Pn(D+U,F+U)}return new fi(D,F,W,Q)}function w(){return t.size}function _(){return n.size}function k(D){var F=y(D);return F?F.links:null}function S(D,F){return F!==void 0&&(D=O(D,F)),A(D)}function A(D){if(!D||!n.get(D.id))return!1;c(),n.delete(D.id);var F=y(D.fromId),W=y(D.toId);return F&&F.links.delete(D),W&&W.links.delete(D),s(D,"remove"),f(),!0}function O(D,F){if(!(D===void 0||F===void 0))return n.get(Pn(D,F))}function E(D){if(D!==void 0)return n.get(D)}function T(){c(),oe(function(D){d(D.id)}),f()}function I(D){if(typeof D=="function")for(var F=n.values(),W=F.next();!W.done;){if(D(W.value))return!0;W=F.next()}}function C(D,F,W){var Q=y(D);if(Q&&Q.links&&typeof F=="function")return W?R(Q.links,D,F):P(Q.links,D,F)}function P(D,F,W){for(var Q,N=D.values(),U=N.next();!U.done;){var z=U.value,G=z.fromId===F?z.toId:z.fromId;if(Q=W(t.get(G),z),Q)return!0;U=N.next()}}function R(D,F,W){for(var Q,N=D.values(),U=N.next();!U.done;){var z=U.value;if(z.fromId===F&&(Q=W(t.get(z.toId),z),Q))return!0;U=N.next()}}function H(){}function V(){o+=1}function X(){o-=1,o===0&&a.length>0&&(u.fire("changed",a),a.length=0)}function oe(D){if(typeof D!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+D);for(var F=t.values(),W=F.next();!W.done;){if(D(W.value))return!0;W=F.next()}}}function Uc(e,t){this.id=e,this.links=null,this.data=t}function ui(e,t){e.links?e.links.add(t):e.links=new Set([t])}function fi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Pn(e,t){return e.toString()+"👉 "+t.toString()}var io={exports:{}},vn={exports:{}},ha=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const qc=ha;var Gt=function(t){return n;function n(r,o){let i=o&&o.indent||0,a=o&&o.join!==void 0?o.join:`
4
- `,s=Array(i+1).join(" "),l=[];for(let c=0;c<t;++c){let f=qc(c),u=c===0?"":s;l.push(u+r.replace(/{var}/g,f))}return l.join(a)}};const pa=Gt;vn.exports=Gc;vn.exports.generateCreateBodyFunctionBody=ga;vn.exports.getVectorCode=ya;vn.exports.getBodyCode=va;function Gc(e,t){let n=ga(e,t),{Body:r}=new Function(n)();return r}function ga(e,t){return`
5
- ${ya(e,t)}
6
- ${va(e)}
3
+ is considered to be not a multigraph by default (each edge is unique).`),e.multigraph=e.uniqueLinkId),e.multigraph===void 0&&(e.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var t=new Map,n=new Map,r={},o=0,i=e.multigraph?x:_,a=[],l=C,s=C,u=C,f=C,c={version:20,addNode:m,addLink:S,removeLink:P,removeNode:g,getNode:v,getNodeCount:w,getLinkCount:b,getEdgeCount:b,getLinksCount:b,getNodesCount:w,getLinks:M,forEachNode:X,forEachLinkedNode:O,forEachLink:K,beginUpdate:u,endUpdate:f,clear:I,hasLink:j,hasNode:v,getLink:j,getLinkById:F};return Kc(c),p(),c;function p(){var L=c.on;c.on=D;function D(){return c.beginUpdate=u=$,c.endUpdate=f=B,l=h,s=d,c.on=L,L.apply(c,arguments)}}function h(L,D){a.push({link:L,changeType:D})}function d(L,D){a.push({node:L,changeType:D})}function m(L,D){if(L===void 0)throw new Error("Invalid node identifier");u();var q=v(L);return q?(q.data=D,s(q,"update")):(q=new Qc(L,D),s(q,"add")),t.set(L,q),f(),q}function v(L){return t.get(L)}function g(L){var D=v(L);if(!D)return!1;u();var q=D.links;return q&&(q.forEach(N),D.links=null),t.delete(L),s(D,"remove"),f(),!0}function S(L,D,q){u();var Y=v(L)||m(L),E=v(D)||m(D),H=i(L,D,q),T=n.has(H.id);return n.set(H.id,H),_i(Y,H),L!==D&&_i(E,H),l(H,T?"update":"add"),f(),H}function _(L,D,q){var Y=Fn(L,D),E=n.get(Y);return E?(E.data=q,E):new xi(L,D,q,Y)}function x(L,D,q){var Y=Fn(L,D),E=r.hasOwnProperty(Y);if(E||j(L,D)){E||(r[Y]=0);var H="@"+ ++r[Y];Y=Fn(L+H,D+H)}return new xi(L,D,q,Y)}function w(){return t.size}function b(){return n.size}function M(L){var D=v(L);return D?D.links:null}function P(L,D){return D!==void 0&&(L=j(L,D)),N(L)}function N(L){if(!L||!n.get(L.id))return!1;u(),n.delete(L.id);var D=v(L.fromId),q=v(L.toId);return D&&D.links.delete(L),q&&q.links.delete(L),l(L,"remove"),f(),!0}function j(L,D){if(!(L===void 0||D===void 0))return n.get(Fn(L,D))}function F(L){if(L!==void 0)return n.get(L)}function I(){u(),X(function(L){g(L.id)}),f()}function K(L){if(typeof L=="function")for(var D=n.values(),q=D.next();!q.done;){if(L(q.value))return!0;q=D.next()}}function O(L,D,q){var Y=v(L);if(Y&&Y.links&&typeof D=="function")return q?k(Y.links,L,D):y(Y.links,L,D)}function y(L,D,q){for(var Y,E=L.values(),H=E.next();!H.done;){var T=H.value,W=T.fromId===D?T.toId:T.fromId;if(Y=q(t.get(W),T),Y)return!0;H=E.next()}}function k(L,D,q){for(var Y,E=L.values(),H=E.next();!H.done;){var T=H.value;if(T.fromId===D&&(Y=q(t.get(T.toId),T),Y))return!0;H=E.next()}}function C(){}function $(){o+=1}function B(){o-=1,o===0&&a.length>0&&(c.fire("changed",a),a.length=0)}function X(L){if(typeof L!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+L);for(var D=t.values(),q=D.next();!q.done;){if(L(q.value))return!0;q=D.next()}}}function Qc(e,t){this.id=e,this.links=null,this.data=t}function _i(e,t){e.links?e.links.add(t):e.links=new Set([t])}function xi(e,t,n,r){this.fromId=e,this.toId=t,this.data=n,this.id=r}function Fn(e,t){return e.toString()+"👉 "+t.toString()}var po={exports:{}},Pn={exports:{}},Ca=function(t){return t===0?"x":t===1?"y":t===2?"z":"c"+(t+1)};const Jc=Ca;var on=function(t){return n;function n(r,o){let i=o&&o.indent||0,a=o&&o.join!==void 0?o.join:`
4
+ `,l=Array(i+1).join(" "),s=[];for(let u=0;u<t;++u){let f=Jc(u),c=u===0?"":l;s.push(c+r.replace(/{var}/g,f))}return s.join(a)}};const Sa=on;Pn.exports=eu;Pn.exports.generateCreateBodyFunctionBody=Ma;Pn.exports.getVectorCode=Aa;Pn.exports.getBodyCode=Pa;function eu(e,t){let n=Ma(e,t),{Body:r}=new Function(n)();return r}function Ma(e,t){return`
5
+ ${Aa(e,t)}
6
+ ${Pa(e)}
7
7
  return {Body: Body, Vector: Vector};
8
- `}function va(e){let t=pa(e),n=t("{var}",{join:", "});return`
8
+ `}function Pa(e){let t=Sa(e),n=t("{var}",{join:", "});return`
9
9
  function Body(${n}) {
10
10
  this.isPinned = false;
11
11
  this.pos = new Vector(${n});
@@ -25,7 +25,7 @@ Body.prototype.reset = function() {
25
25
 
26
26
  Body.prototype.setPosition = function (${n}) {
27
27
  ${t("this.pos.{var} = {var} || 0;",{indent:2})}
28
- };`}function ya(e,t){let n=pa(e),r="";return t&&(r=`${n(`
28
+ };`}function Aa(e,t){let n=Sa(e),r="";return t&&(r=`${n(`
29
29
  var v{var};
30
30
  Object.defineProperty(this, '{var}', {
31
31
  set: function(v) {
@@ -47,12 +47,12 @@ Object.defineProperty(this, '{var}', {
47
47
 
48
48
  Vector.prototype.reset = function () {
49
49
  ${n("this.{var} = ",{join:""})}0;
50
- };`}var Vc=vn.exports,ht={exports:{}};const ao=Gt,ct=ha;ht.exports=Wc;ht.exports.generateQuadTreeFunctionBody=ma;ht.exports.getInsertStackCode=ka;ht.exports.getQuadNodeCode=wa;ht.exports.isSamePosition=ba;ht.exports.getChildBodyCode=xa;ht.exports.setChildBodyCode=_a;function Wc(e){let t=ma(e);return new Function(t)()}function ma(e){let t=ao(e),n=Math.pow(2,e);return`
51
- ${ka()}
52
- ${wa(e)}
53
- ${ba(e)}
54
- ${xa(e)}
55
- ${_a(e)}
50
+ };`}var tu=Pn.exports,Ot={exports:{}};const go=on,St=Ca;Ot.exports=nu;Ot.exports.generateQuadTreeFunctionBody=Oa;Ot.exports.getInsertStackCode=La;Ot.exports.getQuadNodeCode=Ea;Ot.exports.isSamePosition=ja;Ot.exports.getChildBodyCode=Ta;Ot.exports.setChildBodyCode=za;function nu(e){let t=Oa(e);return new Function(t)()}function Oa(e){let t=go(e),n=Math.pow(2,e);return`
51
+ ${La()}
52
+ ${Ea(e)}
53
+ ${ja(e)}
54
+ ${Ta(e)}
55
+ ${za(e)}
56
56
 
57
57
  function createQuadTree(options, random) {
58
58
  options = options || {};
@@ -167,7 +167,7 @@ ${a(" node.")}
167
167
  }
168
168
  // If s / r < θ, treat this internal node as a single body, and calculate the
169
169
  // force it exerts on sourceBody, and add this amount to sourceBody's net force.
170
- if ((node.max_${ct(0)} - node.min_${ct(0)}) / r < theta) {
170
+ if ((node.max_${St(0)} - node.min_${St(0)}) / r < theta) {
171
171
  // in the if statement above we consider node's width only
172
172
  // because the region was made into square during tree creation.
173
173
  // Thus there is no difference between using width or height.
@@ -290,24 +290,24 @@ ${o(8)}
290
290
  }
291
291
  return createQuadTree;
292
292
 
293
- `;function o(s){let l=[],c=Array(s+1).join(" ");for(let f=0;f<e;++f)l.push(c+`if (${ct(f)} > max_${ct(f)}) {`),l.push(c+` quadIdx = quadIdx + ${Math.pow(2,f)};`),l.push(c+` min_${ct(f)} = max_${ct(f)};`),l.push(c+` max_${ct(f)} = node.max_${ct(f)};`),l.push(c+"}");return l.join(`
294
- `)}function i(){let s=Array(11).join(" "),l=[];for(let c=0;c<n;++c)l.push(s+`if (node.quad${c}) {`),l.push(s+` queue[pushIdx] = node.quad${c};`),l.push(s+" queueLength += 1;"),l.push(s+" pushIdx += 1;"),l.push(s+"}");return l.join(`
295
- `)}function a(s){let l=[];for(let c=0;c<n;++c)l.push(`${s}quad${c} = null;`);return l.join(`
296
- `)}}function ba(e){let t=ao(e);return`
293
+ `;function o(l){let s=[],u=Array(l+1).join(" ");for(let f=0;f<e;++f)s.push(u+`if (${St(f)} > max_${St(f)}) {`),s.push(u+` quadIdx = quadIdx + ${Math.pow(2,f)};`),s.push(u+` min_${St(f)} = max_${St(f)};`),s.push(u+` max_${St(f)} = node.max_${St(f)};`),s.push(u+"}");return s.join(`
294
+ `)}function i(){let l=Array(11).join(" "),s=[];for(let u=0;u<n;++u)s.push(l+`if (node.quad${u}) {`),s.push(l+` queue[pushIdx] = node.quad${u};`),s.push(l+" queueLength += 1;"),s.push(l+" pushIdx += 1;"),s.push(l+"}");return s.join(`
295
+ `)}function a(l){let s=[];for(let u=0;u<n;++u)s.push(`${l}quad${u} = null;`);return s.join(`
296
+ `)}}function ja(e){let t=go(e);return`
297
297
  function isSamePosition(point1, point2) {
298
298
  ${t("var d{var} = Math.abs(point1.{var} - point2.{var});",{indent:2})}
299
299
 
300
300
  return ${t("d{var} < 1e-8",{join:" && "})};
301
301
  }
302
- `}function _a(e){var t=Math.pow(2,e);return`
302
+ `}function za(e){var t=Math.pow(2,e);return`
303
303
  function setChild(node, idx, child) {
304
304
  ${n()}
305
305
  }`;function n(){let r=[];for(let o=0;o<t;++o){let i=o===0?" ":" else ";r.push(`${i}if (idx === ${o}) node.quad${o} = child;`)}return r.join(`
306
- `)}}function xa(e){return`function getChild(node, idx) {
306
+ `)}}function Ta(e){return`function getChild(node, idx) {
307
307
  ${t()}
308
308
  return null;
309
309
  }`;function t(){let n=[],r=Math.pow(2,e);for(let o=0;o<r;++o)n.push(` if (idx === ${o}) return node.quad${o};`);return n.join(`
310
- `)}}function wa(e){let t=ao(e),n=Math.pow(2,e);var r=`
310
+ `)}}function Ea(e){let t=go(e),n=Math.pow(2,e);var r=`
311
311
  function QuadNode() {
312
312
  // body stored inside this node. In quad tree only leaf nodes (by construction)
313
313
  // contain bodies:
@@ -329,8 +329,8 @@ ${o(" this.")}
329
329
  ${t("this.min_{var} = 0;",{indent:2})}
330
330
  ${t("this.max_{var} = 0;",{indent:2})}
331
331
  }
332
- `;return r;function o(i){let a=[];for(let s=0;s<n;++s)a.push(`${i}quad${s} = null;`);return a.join(`
333
- `)}}function ka(){return`
332
+ `;return r;function o(i){let a=[];for(let l=0;l<n;++l)a.push(`${i}quad${l} = null;`);return a.join(`
333
+ `)}}function La(){return`
334
334
  /**
335
335
  * Our implementation of QuadTree is non-recursive to avoid GC hit
336
336
  * This data structure represent stack of elements
@@ -371,7 +371,7 @@ function InsertStackElement(node, body) {
371
371
  this.node = node; // QuadTree node
372
372
  this.body = body; // physical body which needs to be inserted to node
373
373
  }
374
- `}var Xc=ht.exports,so={exports:{}};so.exports=Kc;so.exports.generateFunctionBody=Ca;const Yc=Gt;function Kc(e){let t=Ca(e);return new Function("bodies","settings","random",t)}function Ca(e){let t=Yc(e);return`
374
+ `}var ru=Ot.exports,vo={exports:{}};vo.exports=iu;vo.exports.generateFunctionBody=Na;const ou=on;function iu(e){let t=Na(e);return new Function("bodies","settings","random",t)}function Na(e){let t=ou(e);return`
375
375
  var boundingBox = {
376
376
  ${t("min_{var}: 0, max_{var}: 0,",{indent:4})}
377
377
  };
@@ -425,15 +425,15 @@ function InsertStackElement(node, body) {
425
425
  function resetBoundingBox() {
426
426
  ${t("boundingBox.min_{var} = boundingBox.max_{var} = 0;",{indent:4})}
427
427
  }
428
- `}var Qc=so.exports,lo={exports:{}};const Zc=Gt;lo.exports=Jc;lo.exports.generateCreateDragForceFunctionBody=Sa;function Jc(e){let t=Sa(e);return new Function("options",t)}function Sa(e){return`
428
+ `}var au=vo.exports,yo={exports:{}};const su=on;yo.exports=lu;yo.exports.generateCreateDragForceFunctionBody=Ra;function lu(e){let t=Ra(e);return new Function("options",t)}function Ra(e){return`
429
429
  if (!Number.isFinite(options.dragCoefficient)) throw new Error('dragCoefficient is not a finite number');
430
430
 
431
431
  return {
432
432
  update: function(body) {
433
- ${Zc(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
433
+ ${su(e)("body.force.{var} -= options.dragCoefficient * body.velocity.{var};",{indent:6})}
434
434
  }
435
435
  };
436
- `}var eu=lo.exports,co={exports:{}};const tu=Gt;co.exports=nu;co.exports.generateCreateSpringForceFunctionBody=Ma;function nu(e){let t=Ma(e);return new Function("options","random",t)}function Ma(e){let t=tu(e);return`
436
+ `}var cu=yo.exports,mo={exports:{}};const uu=on;mo.exports=fu;mo.exports.generateCreateSpringForceFunctionBody=Da;function fu(e){let t=Da(e);return new Function("options","random",t)}function Da(e){let t=uu(e);return`
437
437
  if (!Number.isFinite(options.springCoefficient)) throw new Error('Spring coefficient is not a number');
438
438
  if (!Number.isFinite(options.springLength)) throw new Error('Spring length is not a number');
439
439
 
@@ -465,7 +465,7 @@ function InsertStackElement(node, body) {
465
465
  body2.springLength += r;
466
466
  }
467
467
  };
468
- `}var ru=co.exports,uo={exports:{}};const ou=Gt;uo.exports=iu;uo.exports.generateIntegratorFunctionBody=Pa;function iu(e){let t=Pa(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function Pa(e){let t=ou(e);return`
468
+ `}var du=mo.exports,bo={exports:{}};const hu=on;bo.exports=pu;bo.exports.generateIntegratorFunctionBody=Ia;function pu(e){let t=Ia(e);return new Function("bodies","timeStep","adaptiveTimeStepWeight",t)}function Ia(e){let t=hu(e);return`
469
469
  var length = bodies.length;
470
470
  if (length === 0) return 0;
471
471
 
@@ -499,12 +499,12 @@ function InsertStackElement(node, body) {
499
499
  }
500
500
 
501
501
  return (${t("t{var} * t{var}",{join:" + "})})/length;
502
- `}var au=uo.exports,vr,di;function su(){if(di)return vr;di=1,vr=e;function e(t,n,r,o){this.from=t,this.to=n,this.length=r,this.coefficient=o}return vr}var yr,hi;function lu(){if(hi)return yr;hi=1,yr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var o=t.hasOwnProperty(r),i=typeof n[r],a=!o||typeof t[r]!==i;a?t[r]=n[r]:i==="object"&&(t[r]=e(t[r],n[r]))}}return t}return yr}var en={exports:{}},pi;function cu(){if(pi)return en.exports;pi=1,en.exports=e,en.exports.random=e,en.exports.randomIterator=s;function e(l){var c=typeof l=="number"?l:+new Date;return new t(c)}function t(l){this.seed=l}t.prototype.next=a,t.prototype.nextDouble=i,t.prototype.uniform=i,t.prototype.gaussian=n,t.prototype.random=i;function n(){var l,c,f;do c=this.nextDouble()*2-1,f=this.nextDouble()*2-1,l=c*c+f*f;while(l>=1||l===0);return c*Math.sqrt(-2*Math.log(l)/l)}t.prototype.levy=r;function r(){var l=1.5,c=Math.pow(o(1+l)*Math.sin(Math.PI*l/2)/(o((1+l)/2)*l*Math.pow(2,(l-1)/2)),1/l);return this.gaussian()*c/Math.pow(Math.abs(this.gaussian()),1/l)}function o(l){return Math.sqrt(2*Math.PI/l)*Math.pow(1/Math.E*(l+1/(12*l-1/(10*l))),l)}function i(){var l=this.seed;return l=l+2127912214+(l<<12)&4294967295,l=(l^3345072700^l>>>19)&4294967295,l=l+374761393+(l<<5)&4294967295,l=(l+3550635116^l<<9)&4294967295,l=l+4251993797+(l<<3)&4294967295,l=(l^3042594569^l>>>16)&4294967295,this.seed=l,(l&268435455)/268435456}function a(l){return Math.floor(this.nextDouble()*l)}function s(l,c){var f=c||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:v,shuffle:u};function u(){var h,p,g;for(h=l.length-1;h>0;--h)p=f.next(h+1),g=l[p],l[p]=l[h],l[h]=g;return l}function v(h){var p,g,y;for(p=l.length-1;p>0;--p)g=f.next(p+1),y=l[g],l[g]=l[p],l[p]=y,h(y);l.length&&h(l[0])}}return en.exports}var Oa=vu,uu=Vc,fu=Xc,du=Qc,hu=eu,pu=ru,gu=au,gi={};function vu(e){var t=su(),n=lu(),r=oo;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var o=gi[e.dimensions];if(!o){var i=e.dimensions;o={Body:uu(i,e.debug),createQuadTree:fu(i),createBounds:du(i),createDragForce:hu(i),createSpringForce:pu(i),integrate:gu(i)},gi[i]=o}var a=o.Body,s=o.createQuadTree,l=o.createBounds,c=o.createDragForce,f=o.createSpringForce,u=o.integrate,v=P=>new a(P),h=cu().random(42),p=[],g=[],y=s(e,h),d=l(p,e,h),m=f(e,h),b=c(e),x=0,w=[],_=new Map,k=0;O("nbody",I),O("spring",C);var S={bodies:p,quadTree:y,springs:g,settings:e,addForce:O,removeForce:E,getForces:T,step:function(){for(var P=0;P<w.length;++P)w[P](k);var R=u(p,e.timeStep,e.adaptiveTimeStepWeight);return k+=1,R},addBody:function(P){if(!P)throw new Error("Body is required");return p.push(P),P},addBodyAt:function(P){if(!P)throw new Error("Body position is required");var R=v(P);return p.push(R),R},removeBody:function(P){if(P){var R=p.indexOf(P);if(!(R<0))return p.splice(R,1),p.length===0&&d.reset(),!0}},addSpring:function(P,R,H,V){if(!P||!R)throw new Error("Cannot add null spring to force simulator");typeof H!="number"&&(H=-1);var X=new t(P,R,H,V>=0?V:-1);return g.push(X),X},getTotalMovement:function(){return x},removeSpring:function(P){if(P){var R=g.indexOf(P);if(R>-1)return g.splice(R,1),!0}},getBestNewBodyPosition:function(P){return d.getBestNewPosition(P)},getBBox:A,getBoundingBox:A,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(P){return P!==void 0?(e.gravity=P,y.options({gravity:P}),this):e.gravity},theta:function(P){return P!==void 0?(e.theta=P,y.options({theta:P}),this):e.theta},random:h};return yu(e,S),r(S),S;function A(){return d.update(),d.box}function O(P,R){if(_.has(P))throw new Error("Force "+P+" is already added");_.set(P,R),w.push(R)}function E(P){var R=w.indexOf(_.get(P));R<0||(w.splice(R,1),_.delete(P))}function T(){return _}function I(){if(p.length!==0){y.insertBodies(p);for(var P=p.length;P--;){var R=p[P];R.isPinned||(R.reset(),y.updateBodyForce(R),b.update(R))}}}function C(){for(var P=g.length;P--;)m.update(g[P])}}function yu(e,t){for(var n in e)mu(e,t,n)}function mu(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(o){if(o!==void 0){if(!Number.isFinite(o))throw new Error("Value of "+n+" should be a valid number.");return e[n]=o,t}return e[n]}:t[n]=function(o){return o!==void 0?(e[n]=o,t):e[n]}}}io.exports=_u;io.exports.simulator=Oa;var bu=oo;function _u(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||Oa,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var o=e.version>19?I:T;t&&typeof t.nodeMass=="function"&&(o=t.nodeMass);var i=new Map,a={},s=0,l=r.settings.springTransform||xu;b(),y();var c=!1,f={step:function(){if(s===0)return u(!0),!0;var C=r.step();f.lastMove=C,f.fire("step");var P=C/s,R=P<=.01;return u(R),R},getNodePosition:function(C){return E(C).pos},setNodePosition:function(C){var P=E(C);P.setPosition.apply(P,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(C){var P=a[C];if(P)return{from:P.from.pos,to:P.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:v,pinNode:function(C,P){var R=E(C.id);R.isPinned=!!P},isNodePinned:function(C){return E(C.id).isPinned},dispose:function(){e.off("changed",m),f.fire("disposed")},getBody:g,getSpring:p,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return bu(f),f;function u(C){c!==C&&(c=C,d(C))}function v(C){i.forEach(C)}function h(){var C=0,P=0;return v(function(R){C+=Math.abs(R.force.x),P+=Math.abs(R.force.y)}),Math.sqrt(C*C+P*P)}function p(C,P){var R;if(P===void 0)typeof C!="object"?R=C:R=C.id;else{var H=e.hasLink(C,P);if(!H)return;R=H.id}return a[R]}function g(C){return i.get(C)}function y(){e.on("changed",m)}function d(C){f.fire("stable",C)}function m(C){for(var P=0;P<C.length;++P){var R=C[P];R.changeType==="add"?(R.node&&x(R.node.id),R.link&&_(R.link)):R.changeType==="remove"&&(R.node&&w(R.node),R.link&&k(R.link))}s=e.getNodesCount()}function b(){s=0,e.forEachNode(function(C){x(C.id),s+=1}),e.forEachLink(_)}function x(C){var P=i.get(C);if(!P){var R=e.getNode(C);if(!R)throw new Error("initBody() was called with unknown node id");var H=R.position;if(!H){var V=S(R);H=r.getBestNewBodyPosition(V)}P=r.addBodyAt(H),P.id=C,i.set(C,P),A(C),O(R)&&(P.isPinned=!0)}}function w(C){var P=C.id,R=i.get(P);R&&(i.delete(P),r.removeBody(R))}function _(C){A(C.fromId),A(C.toId);var P=i.get(C.fromId),R=i.get(C.toId),H=r.addSpring(P,R,C.length);l(C,H),a[C.id]=H}function k(C){var P=a[C.id];if(P){var R=e.getNode(C.fromId),H=e.getNode(C.toId);R&&A(R.id),H&&A(H.id),delete a[C.id],r.removeSpring(P)}}function S(C){var P=[];if(!C.links)return P;for(var R=Math.min(C.links.length,2),H=0;H<R;++H){var V=C.links[H],X=V.fromId!==C.id?i.get(V.fromId):i.get(V.toId);X&&X.pos&&P.push(X)}return P}function A(C){var P=i.get(C);if(P.mass=o(C),Number.isNaN(P.mass))throw new Error("Node mass should be a number")}function O(C){return C&&(C.isPinned||C.data&&C.data.isPinned)}function E(C){var P=i.get(C);return P||(x(C),P=i.get(C)),P}function T(C){var P=e.getLinks(C);return P?1+P.length/3:1}function I(C){var P=e.getLinks(C);return P?1+P.size/3:1}}function xu(){}var wu=io.exports;const ku=da(wu);function Lr(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Cu=typeof global=="object"&&global&&global.Object===Object&&global,Su=typeof self=="object"&&self&&self.Object===Object&&self,Aa=Cu||Su||Function("return this")(),mr=function(){return Aa.Date.now()},Mu=/\s/;function Pu(e){for(var t=e.length;t--&&Mu.test(e.charAt(t)););return t}var Ou=/^\s+/;function Au(e){return e&&e.slice(0,Pu(e)+1).replace(Ou,"")}var zn=Aa.Symbol,ja=Object.prototype,ju=ja.hasOwnProperty,Tu=ja.toString,tn=zn?zn.toStringTag:void 0;function Eu(e){var t=ju.call(e,tn),n=e[tn];try{e[tn]=void 0;var r=!0}catch{}var o=Tu.call(e);return r&&(t?e[tn]=n:delete e[tn]),o}var Lu=Object.prototype,Ru=Lu.toString;function Nu(e){return Ru.call(e)}var Du="[object Null]",zu="[object Undefined]",vi=zn?zn.toStringTag:void 0;function Iu(e){return e==null?e===void 0?zu:Du:vi&&vi in Object(e)?Eu(e):Nu(e)}function Fu(e){return e!=null&&typeof e=="object"}var Bu="[object Symbol]";function $u(e){return typeof e=="symbol"||Fu(e)&&Iu(e)==Bu}var yi=NaN,Hu=/^[-+]0x[0-9a-f]+$/i,Uu=/^0b[01]+$/i,qu=/^0o[0-7]+$/i,Gu=parseInt;function mi(e){if(typeof e=="number")return e;if($u(e))return yi;if(Lr(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=Lr(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Au(e);var n=Uu.test(e);return n||qu.test(e)?Gu(e.slice(2),n?2:8):Hu.test(e)?yi:+e}var Vu="Expected a function",Wu=Math.max,Xu=Math.min;function Yu(e,t,n){var r,o,i,a,s,l,c=0,f=!1,u=!1,v=!0;if(typeof e!="function")throw new TypeError(Vu);t=mi(t)||0,Lr(n)&&(f=!!n.leading,u="maxWait"in n,i=u?Wu(mi(n.maxWait)||0,t):i,v="trailing"in n?!!n.trailing:v);function h(_){var k=r,S=o;return r=o=void 0,c=_,a=e.apply(S,k),a}function p(_){return c=_,s=setTimeout(d,t),f?h(_):a}function g(_){var k=_-l,S=_-c,A=t-k;return u?Xu(A,i-S):A}function y(_){var k=_-l,S=_-c;return l===void 0||k>=t||k<0||u&&S>=i}function d(){var _=mr();if(y(_))return m(_);s=setTimeout(d,g(_))}function m(_){return s=void 0,v&&r?h(_):(r=o=void 0,a)}function b(){s!==void 0&&clearTimeout(s),c=0,r=l=o=s=void 0}function x(){return s===void 0?a:m(mr())}function w(){var _=mr(),k=y(_);if(r=arguments,o=this,l=_,k){if(s===void 0)return p(l);if(u)return clearTimeout(s),s=setTimeout(d,t),h(l)}return s===void 0&&(s=setTimeout(d,t)),a}return w.cancel=b,w.flush=x,w}function bi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Ku(e){if(Array.isArray(e))return e}function Qu(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Zu(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function Ju(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function ef(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
503
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function tf(e,t){return Ku(e)||Ju(e,t)||nf(e,t)||ef()}function nf(e,t){if(e){if(typeof e=="string")return bi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bi(e,t):void 0}}var rf=Zu(function e(t,n){var r=n.default,o=r===void 0?null:r,i=n.triggerUpdate,a=i===void 0?!0:i,s=n.onChange,l=s===void 0?function(c,f){}:s;Qu(this,e),this.name=t,this.defaultVal=o,this.triggerUpdate=a,this.onChange=l});function fo(e){var t=e.stateInit,n=t===void 0?function(){return{}}:t,r=e.props,o=r===void 0?{}:r,i=e.methods,a=i===void 0?{}:i,s=e.aliases,l=s===void 0?{}:s,c=e.init,f=c===void 0?function(){}:c,u=e.update,v=u===void 0?function(){}:u,h=Object.keys(o).map(function(p){return new rf(p,o[p])});return function p(){for(var g=arguments.length,y=new Array(g),d=0;d<g;d++)y[d]=arguments[d];var m=!!(this instanceof p&&this.constructor),b=m?y.shift():void 0,x=y[0],w=x===void 0?{}:x,_=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),k={};function S(E){return A(E,w),O(),S}var A=function(T,I){f.call(S,T,_,I),_.initialised=!0},O=Yu(function(){_.initialised&&(v.call(S,_,k),k={})},1);return h.forEach(function(E){S[E.name]=T(E);function T(I){var C=I.name,P=I.triggerUpdate,R=P===void 0?!1:P,H=I.onChange,V=H===void 0?function(D,F){}:H,X=I.defaultVal,oe=X===void 0?null:X;return function(D){var F=_[C];if(!arguments.length)return F;var W=D===void 0?oe:D;return _[C]=W,V.call(S,W,_,F),!k.hasOwnProperty(C)&&(k[C]=F),R&&O(),S}}}),Object.keys(a).forEach(function(E){S[E]=function(){for(var T,I=arguments.length,C=new Array(I),P=0;P<I;P++)C[P]=arguments[P];return(T=a[E]).call.apply(T,[S,_].concat(C))}}),Object.entries(l).forEach(function(E){var T=tf(E,2),I=T[0],C=T[1];return S[I]=S[C]}),S.resetProps=function(){return h.forEach(function(E){S[E.name](E.defaultVal)}),S},S.resetProps(),_._rerender=O,m&&b&&S(b),S}}var le=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class _i extends Map{constructor(t,n=sf){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,o]of t)this.set(r,o)}get(t){return super.get(xi(this,t))}has(t){return super.has(xi(this,t))}set(t,n){return super.set(of(this,t),n)}delete(t){return super.delete(af(this,t))}}function xi({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function of({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function af({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function sf(e){return e!==null&&typeof e=="object"?e.valueOf():e}function lf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function cf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Rr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function uf(e){if(Array.isArray(e))return e}function ff(e){if(Array.isArray(e))return Rr(e)}function Ta(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function df(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function hf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Pe(e,t){return e.get(Ta(e,t))}function Tt(e,t,n){df(e,t),t.set(e,n)}function On(e,t,n){return e.set(Ta(e,t),n),n}function pf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,kf(r.key),r)}}function gf(e,t,n){return t&&pf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function vf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function yf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function mf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
504
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bf(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
505
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _f(e,t){return uf(e)||yf(e,t)||Ea(e,t)||mf()}function xf(e){return ff(e)||vf(e)||Ea(e)||bf()}function wf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function kf(e){var t=wf(e,"string");return typeof t=="symbol"?t:t+""}function Ea(e,t){if(e){if(typeof e=="string")return Rr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Rr(e,t):void 0}}var Et=new WeakMap,nn=new WeakMap,Lt=new WeakMap,br=new WeakMap,_r=new WeakMap,xr=new WeakMap,Cf=function(){function e(){hf(this,e),Tt(this,Et,new Map),Tt(this,nn,new Map),Tt(this,Lt,function(t){return t}),Tt(this,br,function(){return{}}),Tt(this,_r,function(){}),Tt(this,xr,function(){})}return gf(e,[{key:"getObj",value:function(n){return Pe(Et,this).get(Pe(Lt,this).call(this,n))}},{key:"getData",value:function(n){return Pe(nn,this).get(n)}},{key:"entries",value:function(){return xf(Pe(nn,this).entries()).map(function(n){var r=_f(n,2),o=r[0],i=r[1];return[i,o]})}},{key:"id",value:function(n){return On(Lt,this,le(n)),this}},{key:"onCreateObj",value:function(n){return On(br,this,n),this}},{key:"onUpdateObj",value:function(n){return On(_r,this,n),this}},{key:"onRemoveObj",value:function(n){return On(xr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(i){return!Pe(Et,r).has(Pe(Lt,r).call(r,i))}).forEach(function(i){var a=Pe(br,r).call(r,i);Pe(Et,r).set(Pe(Lt,r).call(r,i),a),Pe(nn,r).set(a,i)});var o=new Map(n.map(function(i){return[Pe(Lt,r).call(r,i),i]}));return Pe(Et,this).forEach(function(i,a){o.has(a)?Pe(_r,r).call(r,i,o.get(a)):(Pe(xr,r).call(r,i,a),Pe(Et,r).delete(a),Pe(nn,r).delete(i))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function Sf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const wi=Symbol("implicit");function La(){var e=new _i,t=[],n=[],r=wi;function o(i){let a=e.get(i);if(a===void 0){if(r!==wi)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new _i;for(const a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return La(t,n).unknown(r)},Sf.apply(o,arguments),o}function Mf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const Pf=Mf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function In(e){"@babel/helpers - typeof";return In=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},In(e)}var Of=/^\s+/,Af=/\s+$/;function Y(e,t){if(e=e||"",t=t||{},e instanceof Y)return e;if(!(this instanceof Y))return new Y(e,t);var n=jf(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}Y.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,o,i,a,s;return n=t.r/255,r=t.g/255,o=t.b/255,n<=.03928?i=n/12.92:i=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),o<=.03928?s=o/12.92:s=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*a+.0722*s},setAlpha:function(t){return this._a=Ra(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Ci(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Ci(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+o+"%)":"hsva("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=ki(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=ki(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+o+"%)":"hsla("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return Si(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return Rf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(ge(this._r,255)*100)+"%",g:Math.round(ge(this._g,255)*100)+"%",b:Math.round(ge(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(ge(this._r,255)*100)+"%, "+Math.round(ge(this._g,255)*100)+"%, "+Math.round(ge(this._b,255)*100)+"%)":"rgba("+Math.round(ge(this._r,255)*100)+"%, "+Math.round(ge(this._g,255)*100)+"%, "+Math.round(ge(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:Vf[Si(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+Mi(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=Y(t);r="#"+Mi(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,o=this._a<1&&this._a>=0,i=!n&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return i?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return Y(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(If,arguments)},brighten:function(){return this._applyModification(Ff,arguments)},darken:function(){return this._applyModification(Bf,arguments)},desaturate:function(){return this._applyModification(Nf,arguments)},saturate:function(){return this._applyModification(Df,arguments)},greyscale:function(){return this._applyModification(zf,arguments)},spin:function(){return this._applyModification($f,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(qf,arguments)},complement:function(){return this._applyCombination(Hf,arguments)},monochromatic:function(){return this._applyCombination(Gf,arguments)},splitcomplement:function(){return this._applyCombination(Uf,arguments)},triad:function(){return this._applyCombination(Pi,[3])},tetrad:function(){return this._applyCombination(Pi,[4])}};Y.fromRatio=function(e,t){if(In(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=cn(e[r]));e=n}return Y(e,t)};function jf(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,i=null,a=!1,s=!1;return typeof e=="string"&&(e=Kf(e)),In(e)=="object"&&(it(e.r)&&it(e.g)&&it(e.b)?(t=Tf(e.r,e.g,e.b),a=!0,s=String(e.r).substr(-1)==="%"?"prgb":"rgb"):it(e.h)&&it(e.s)&&it(e.v)?(r=cn(e.s),o=cn(e.v),t=Lf(e.h,r,o),a=!0,s="hsv"):it(e.h)&&it(e.s)&&it(e.l)&&(r=cn(e.s),i=cn(e.l),t=Ef(e.h,r,i),a=!0,s="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ra(n),{ok:a,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function Tf(e,t,n){return{r:ge(e,255)*255,g:ge(t,255)*255,b:ge(n,255)*255}}function ki(e,t,n){e=ge(e,255),t=ge(t,255),n=ge(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,s=(r+o)/2;if(r==o)i=a=0;else{var l=r-o;switch(a=s>.5?l/(2-r-o):l/(r+o),r){case e:i=(t-n)/l+(t<n?6:0);break;case t:i=(n-e)/l+2;break;case n:i=(e-t)/l+4;break}i/=6}return{h:i,s:a,l:s}}function Ef(e,t,n){var r,o,i;e=ge(e,360),t=ge(t,100),n=ge(n,100);function a(c,f,u){return u<0&&(u+=1),u>1&&(u-=1),u<1/6?c+(f-c)*6*u:u<1/2?f:u<2/3?c+(f-c)*(2/3-u)*6:c}if(t===0)r=o=i=n;else{var s=n<.5?n*(1+t):n+t-n*t,l=2*n-s;r=a(l,s,e+1/3),o=a(l,s,e),i=a(l,s,e-1/3)}return{r:r*255,g:o*255,b:i*255}}function Ci(e,t,n){e=ge(e,255),t=ge(t,255),n=ge(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,s=r,l=r-o;if(a=r===0?0:l/r,r==o)i=0;else{switch(r){case e:i=(t-n)/l+(t<n?6:0);break;case t:i=(n-e)/l+2;break;case n:i=(e-t)/l+4;break}i/=6}return{h:i,s:a,v:s}}function Lf(e,t,n){e=ge(e,360)*6,t=ge(t,100),n=ge(n,100);var r=Math.floor(e),o=e-r,i=n*(1-t),a=n*(1-o*t),s=n*(1-(1-o)*t),l=r%6,c=[n,a,i,i,s,n][l],f=[s,n,n,a,i,i][l],u=[i,i,s,n,n,a][l];return{r:c*255,g:f*255,b:u*255}}function Si(e,t,n,r){var o=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function Rf(e,t,n,r,o){var i=[Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16)),Ye(Na(r))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function Mi(e,t,n,r){var o=[Ye(Na(r)),Ye(Math.round(e).toString(16)),Ye(Math.round(t).toString(16)),Ye(Math.round(n).toString(16))];return o.join("")}Y.equals=function(e,t){return!e||!t?!1:Y(e).toRgbString()==Y(t).toRgbString()};Y.random=function(){return Y.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Nf(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.s-=t/100,n.s=Xn(n.s),Y(n)}function Df(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.s+=t/100,n.s=Xn(n.s),Y(n)}function zf(e){return Y(e).desaturate(100)}function If(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.l+=t/100,n.l=Xn(n.l),Y(n)}function Ff(e,t){t=t===0?0:t||10;var n=Y(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),Y(n)}function Bf(e,t){t=t===0?0:t||10;var n=Y(e).toHsl();return n.l-=t/100,n.l=Xn(n.l),Y(n)}function $f(e,t){var n=Y(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,Y(n)}function Hf(e){var t=Y(e).toHsl();return t.h=(t.h+180)%360,Y(t)}function Pi(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=Y(e).toHsl(),r=[Y(e)],o=360/t,i=1;i<t;i++)r.push(Y({h:(n.h+i*o)%360,s:n.s,l:n.l}));return r}function Uf(e){var t=Y(e).toHsl(),n=t.h;return[Y(e),Y({h:(n+72)%360,s:t.s,l:t.l}),Y({h:(n+216)%360,s:t.s,l:t.l})]}function qf(e,t,n){t=t||6,n=n||30;var r=Y(e).toHsl(),o=360/n,i=[Y(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(Y(r));return i}function Gf(e,t){t=t||6;for(var n=Y(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],s=1/t;t--;)a.push(Y({h:r,s:o,v:i})),i=(i+s)%1;return a}Y.mix=function(e,t,n){n=n===0?0:n||50;var r=Y(e).toRgb(),o=Y(t).toRgb(),i=n/100,a={r:(o.r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b,a:(o.a-r.a)*i+r.a};return Y(a)};Y.readability=function(e,t){var n=Y(e),r=Y(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};Y.isReadable=function(e,t,n){var r=Y.readability(e,t),o,i;switch(i=!1,o=Qf(n),o.level+o.size){case"AAsmall":case"AAAlarge":i=r>=4.5;break;case"AAlarge":i=r>=3;break;case"AAAsmall":i=r>=7;break}return i};Y.mostReadable=function(e,t,n){var r=null,o=0,i,a,s,l;n=n||{},a=n.includeFallbackColors,s=n.level,l=n.size;for(var c=0;c<t.length;c++)i=Y.readability(e,t[c]),i>o&&(o=i,r=Y(t[c]));return Y.isReadable(e,r,{level:s,size:l})||!a?r:(n.includeFallbackColors=!1,Y.mostReadable(e,["#fff","#000"],n))};var Nr=Y.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Vf=Y.hexNames=Wf(Nr);function Wf(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ra(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function ge(e,t){Xf(e)&&(e="100%");var n=Yf(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function Xn(e){return Math.min(1,Math.max(0,e))}function Ie(e){return parseInt(e,16)}function Xf(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function Yf(e){return typeof e=="string"&&e.indexOf("%")!=-1}function Ye(e){return e.length==1?"0"+e:""+e}function cn(e){return e<=1&&(e=e*100+"%"),e}function Na(e){return Math.round(parseFloat(e)*255).toString(16)}function Oi(e){return Ie(e)/255}var We=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function it(e){return!!We.CSS_UNIT.exec(e)}function Kf(e){e=e.replace(Of,"").replace(Af,"").toLowerCase();var t=!1;if(Nr[e])e=Nr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=We.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=We.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=We.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=We.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=We.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=We.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=We.hex8.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),a:Oi(n[4]),format:t?"name":"hex8"}:(n=We.hex6.exec(e))?{r:Ie(n[1]),g:Ie(n[2]),b:Ie(n[3]),format:t?"name":"hex"}:(n=We.hex4.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),a:Oi(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=We.hex3.exec(e))?{r:Ie(n[1]+""+n[1]),g:Ie(n[2]+""+n[2]),b:Ie(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function Qf(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Dr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Zf(e){if(Array.isArray(e))return e}function Jf(e){if(Array.isArray(e))return Dr(e)}function Da(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function ed(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function za(e,t,n){return t=$t(t),ld(e,ho()?Reflect.construct(t,n||[],$t(e).constructor):t.apply(e,n))}function td(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Ia(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function wr(e,t){return e.get(Da(e,t))}function Ai(e,t,n){td(e,t),t.set(e,n)}function ji(e,t,n){return e.set(Da(e,t),n),n}function Fa(e,t,n){if(ho())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return o}function nd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ha(r.key),r)}}function Ba(e,t,n){return t&&nd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Yn(e,t,n){return(t=Ha(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function zr(){return zr=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=cd(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},zr.apply(null,arguments)}function $t(e){return $t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},$t(e)}function $a(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Ir(e,t)}function ho(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ho=function(){return!!e})()}function rd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function od(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function id(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
506
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ad(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
507
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ti(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function sd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ti(Object(n),!0).forEach(function(r){Yn(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ti(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ld(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return ed(e)}function Ir(e,t){return Ir=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Ir(e,t)}function fn(e,t){return Zf(e)||od(e,t)||Ua(e,t)||id()}function cd(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=$t(e))!==null;);return e}function kr(e,t,n,r){var o=zr($t(e.prototype),t,n);return typeof o=="function"?function(i){return o.apply(n,i)}:o}function Xe(e){return Jf(e)||rd(e)||Ua(e)||ad()}function ud(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ha(e){var t=ud(e,"string");return typeof t=="symbol"?t:t+""}function Fr(e){"@babel/helpers - typeof";return Fr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fr(e)}function Ua(e,t){if(e){if(typeof e=="string")return Dr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Dr(e,t):void 0}}var qa=function(t){t instanceof Array?t.forEach(qa):(t.map&&t.map.dispose(),t.dispose())},po=function(t){t.geometry&&t.geometry.dispose(),t.material&&qa(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(po)},Ei=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),po(n)}},Cr=new WeakMap,An=new WeakMap,rn=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=o.dataBindAttr,a=i===void 0?"__data":i,s=o.objBindAttr,l=s===void 0?"__threeObj":s;return Ia(this,t),r=za(this,t),Yn(r,"scene",void 0),Ai(r,Cr,void 0),Ai(r,An,void 0),r.scene=n,ji(Cr,r,a),ji(An,r,l),r.onRemoveObj(function(){}),r}return $a(t,e),Ba(t,[{key:"onCreateObj",value:function(r){var o=this;return kr(t,"onCreateObj",this)([function(i){var a=r(i);return i[wr(An,o)]=a,a[wr(Cr,o)]=i,o.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var o=this;return kr(t,"onRemoveObj",this)([function(i,a){var s=kr(t,"getData",o)([i]);r(i,a),o.scene.remove(i),po(i),delete s[wr(An,o)]}]),this}}])}(Cf),on=function(t){return isNaN(t)?parseInt(Y(t).toHex(),16):t},Sr=function(t){return isNaN(t)?Y(t).getAlpha():1},fd=La(Pf);function Li(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=fd(t(r))})}function dd(e,t){var n=e.nodes,r=e.links,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.nodeFilter,a=i===void 0?function(){return!0}:i,s=o.onLoopError,l=s===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:s,c={};n.forEach(function(h){return c[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var p=h.source,g=h.target,y=x(p),d=x(g);if(!c.hasOwnProperty(y))throw"Missing source node with id: ".concat(y);if(!c.hasOwnProperty(d))throw"Missing target node with id: ".concat(d);var m=c[y],b=c[d];m.out.push(b);function x(w){return Fr(w)==="object"?t(w):w}});var f=[];v(Object.values(c));var u=Object.assign.apply(Object,[{}].concat(Xe(Object.entries(c).filter(function(h){var p=fn(h,2),g=p[1];return!g.skip}).map(function(h){var p=fn(h,2),g=p[0],y=p[1];return Yn({},g,y.depth)}))));return u;function v(h){for(var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],g=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,y=function(){var x=h[d];if(p.indexOf(x)!==-1){var w=[].concat(Xe(p.slice(p.indexOf(x))),[x]).map(function(_){return t(_.data)});return f.some(function(_){return _.length===w.length&&_.every(function(k,S){return k===w[S]})})||(f.push(w),l(w)),1}g>x.depth&&(x.depth=g,v(x.out,[].concat(Xe(p),[x]),g+(x.skip?0:1)))},d=0,m=h.length;d<m;d++)y()}}var J=window.THREE?window.THREE:{Group:Z.Group,Mesh:Z.Mesh,MeshLambertMaterial:Z.MeshLambertMaterial,Color:Z.Color,BufferGeometry:Z.BufferGeometry,BufferAttribute:Z.BufferAttribute,Matrix4:Z.Matrix4,Vector3:Z.Vector3,SphereGeometry:Z.SphereGeometry,CylinderGeometry:Z.CylinderGeometry,TubeGeometry:Z.TubeGeometry,ConeGeometry:Z.ConeGeometry,Line:Z.Line,LineBasicMaterial:Z.LineBasicMaterial,QuadraticBezierCurve3:Z.QuadraticBezierCurve3,CubicBezierCurve3:Z.CubicBezierCurve3,Box3:Z.Box3},Ri={graph:Hc,forcelayout:ku},hd=2,Mr=new J.BufferGeometry().setAttribute?"setAttribute":"addAttribute",jn=new J.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",pd=fo({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(o){return o.json()}).then(function(o){n.fetchingJson=!1,n.onFinishLoading(o),r.graphData(o)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&o(n.graphData.nodes,"z"),t<2&&o(n.graphData.nodes,"y");function o(i,a){i.forEach(function(s){delete s[a],delete s["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),o(),i(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=le(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(v){var h=fn(v,2),p=h[0],g=h[1];if(g){var y=n?p:t.layout.getNodePosition(p[t.nodeId]),d=a(p);(!t.nodePositionUpdate||!t.nodePositionUpdate(d?g.children[0]:g,{x:y.x,y:y.y,z:y.z},p)||d)&&(g.position.x=y.x,g.position.y=y.y||0,g.position.z=y.z||0)}});var s=le(t.linkWidth),l=le(t.linkCurvature),c=le(t.linkCurveRotation),f=le(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(v){var h=fn(v,2),p=h[0],g=h[1];if(g){var y=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=y[n?"source":"from"],m=y[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){u(p);var b=f(p);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(b?g.children[1]:g,{start:{x:d.x,y:d.y,z:d.z},end:{x:m.x,y:m.y,z:m.z}},p)&&!b)){var x=30,w=p.__curve,_=g.children.length?g.children[0]:g;if(_.type==="Line"){if(w){var S=w.getPoints(x);_.geometry.getAttribute("position").array.length!==S.length*3&&_.geometry[Mr]("position",new J.BufferAttribute(new Float32Array(S.length*3),3)),_.geometry.setFromPoints(S)}else{var k=_.geometry.getAttribute("position");(!k||!k.array||k.array.length!==6)&&_.geometry[Mr]("position",k=new J.BufferAttribute(new Float32Array(2*3),3)),k.array[0]=d.x,k.array[1]=d.y||0,k.array[2]=d.z||0,k.array[3]=m.x,k.array[4]=m.y||0,k.array[5]=m.z||0,k.needsUpdate=!0}_.geometry.computeBoundingSphere()}else if(_.type==="Mesh")if(w){_.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1));var P=Math.ceil(s(p)*10)/10,R=P/2,H=new J.TubeGeometry(w,x,R,t.linkResolution,!1);_.geometry.dispose(),_.geometry=H}else{if(!_.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var A=Math.ceil(s(p)*10)/10,O=A/2,E=new J.CylinderGeometry(O,O,1,t.linkResolution,1,!1);E[jn](new J.Matrix4().makeTranslation(0,1/2,0)),E[jn](new J.Matrix4().makeRotationX(Math.PI/2)),_.geometry.dispose(),_.geometry=E}var T=new J.Vector3(d.x,d.y||0,d.z||0),I=new J.Vector3(m.x,m.y||0,m.z||0),C=T.distanceTo(I);_.position.x=T.x,_.position.y=T.y,_.position.z=T.z,_.scale.z=C,_.parent.localToWorld(I),_.lookAt(I)}}}}});function u(v){var h=n?v:t.layout.getLinkPosition(t.layout.graph.getLink(v.source,v.target).id),p=h[n?"source":"from"],g=h[n?"target":"to"];if(!(!p||!g||!p.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var y=l(v);if(!y)v.__curve=null;else{var d=new J.Vector3(p.x,p.y||0,p.z||0),m=new J.Vector3(g.x,g.y||0,g.z||0),b=d.distanceTo(m),x,w=c(v);if(b>0){var _=g.x-p.x,k=g.y-p.y||0,S=new J.Vector3().subVectors(m,d),A=S.clone().multiplyScalar(y).cross(_!==0||k!==0?new J.Vector3(0,0,1):new J.Vector3(0,1,0)).applyAxisAngle(S.normalize(),w).add(new J.Vector3().addVectors(d,m).divideScalar(2));x=new J.QuadraticBezierCurve3(d,A,m)}else{var O=y*70,E=-w,T=E+Math.PI/2;x=new J.CubicBezierCurve3(d,new J.Vector3(O*Math.cos(T),O*Math.sin(T),0).add(d),new J.Vector3(O*Math.cos(E),O*Math.sin(E),0).add(d),m)}v.__curve=x}}}}function o(){var a=le(t.linkDirectionalArrowRelPos),s=le(t.linkDirectionalArrowLength),l=le(t.nodeVal);t.arrowDataMapper.entries().forEach(function(c){var f=fn(c,2),u=f[0],v=f[1];if(v){var h=n?u:t.layout.getLinkPosition(t.layout.graph.getLink(u.source,u.target).id),p=h[n?"source":"from"],g=h[n?"target":"to"];if(!(!p||!g||!p.hasOwnProperty("x")||!g.hasOwnProperty("x"))){var y=Math.cbrt(Math.max(0,l(p)||1))*t.nodeRelSize,d=Math.cbrt(Math.max(0,l(g)||1))*t.nodeRelSize,m=s(u),b=a(u),x=u.__curve?function(O){return u.__curve.getPoint(O)}:function(O){var E=function(I,C,P,R){return C[I]+(P[I]-C[I])*R||0};return{x:E("x",p,g,O),y:E("y",p,g,O),z:E("z",p,g,O)}},w=u.__curve?u.__curve.getLength():Math.sqrt(["x","y","z"].map(function(O){return Math.pow((g[O]||0)-(p[O]||0),2)}).reduce(function(O,E){return O+E},0)),_=y+m+(w-y-d-m)*b,k=x(_/w),S=x((_-m)/w);["x","y","z"].forEach(function(O){return v.position[O]=S[O]});var A=Fa(J.Vector3,Xe(["x","y","z"].map(function(O){return k[O]})));v.parent.localToWorld(A),v.lookAt(A)}}})}function i(){var a=le(t.linkDirectionalParticleSpeed),s=le(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(l){var c=t.particlesDataMapper.getObj(l),f=c&&c.children,u=l.__singleHopPhotonsObj&&l.__singleHopPhotonsObj.children;if(!((!u||!u.length)&&(!f||!f.length))){var v=n?l:t.layout.getLinkPosition(t.layout.graph.getLink(l.source,l.target).id),h=v[n?"source":"from"],p=v[n?"target":"to"];if(!(!h||!p||!h.hasOwnProperty("x")||!p.hasOwnProperty("x"))){var g=a(l),y=Math.abs(s(l)),d=l.__curve?function(b){return l.__curve.getPoint(b)}:function(b){var x=function(_,k,S,A){return k[_]+(S[_]-k[_])*A||0};return{x:x("x",h,p,b),y:x("y",h,p,b),z:x("z",h,p,b)}},m=[].concat(Xe(f||[]),Xe(u||[]));m.forEach(function(b,x){var w=b.parent.__linkThreeObjType==="singleHopPhotons";if(b.hasOwnProperty("__progressRatio")||(b.__progressRatio=w?g<0?1:0:(x+y)/f.length),b.__progressRatio+=g,b.__progressRatio>=1||b.__progressRatio<0)if(!w)b.__progressRatio=b.__progressRatio%1,b.__progressRatio<0&&b.__progressRatio++;else{b.parent.remove(b),Ei(b);return}var _=b.__progressRatio,k=d(_);b.geometry.type!=="SphereGeometry"&&b.lookAt(k.x,k.y,k.z),["x","y","z"].forEach(function(S){return b.position[S]=k[S]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new J.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var o=le(t.linkDirectionalParticleThreeObject)(n);if(o&&t.linkDirectionalParticleThreeObject===o&&(o=o.clone()),!o){var i=le(t.linkDirectionalParticleWidth),a=Math.ceil(i(n)*10)/10/2,s=t.linkDirectionalParticleResolution,l=new J.SphereGeometry(a,s,s),c=le(t.linkColor),f=le(t.linkDirectionalParticleColor),u=f(n)||c(n)||"#f0f0f0",v=new J.Color(on(u)),h=t.linkOpacity*3,p=new J.MeshLambertMaterial({color:v,transparent:!0,opacity:h});o=new J.Mesh(l,p)}n.__singleHopPhotonsObj.add(o)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function o(i){var a=[];if(i.geometry){i.geometry.computeBoundingBox();var s=new J.Box3;s.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),a.push(s)}return a.concat.apply(a,Xe((i.children||[]).filter(function(l){return!l.hasOwnProperty("__graphObjType")||l.__graphObjType==="node"&&n(l.__data)}).map(o)))}(t.graphScene);return r.length?Object.assign.apply(Object,Xe(["x","y","z"].map(function(o){return Yn({},o,[cf(r,function(i){return i.min[o]}),lf(r,function(i){return i.max[o]})])}))):null}},stateInit:function(){return{d3ForceLayout:Nc().force("link",_c()).force("charge",Dc()).force("center",xl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new rn(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new rn(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new rn(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new rn(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(U){return U.some(function(z){return n.hasOwnProperty(z)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&Li(t.graphData.nodes,le(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&Li(t.graphData.links,le(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var o=le(t.nodeThreeObject),i=le(t.nodeThreeObjectExtend),a=le(t.nodeVal),s=le(t.nodeColor),l=le(t.nodeVisibility),c={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(N){var U=o(N),z=i(N);U&&t.nodeThreeObject===U&&(U=U.clone());var G;return U&&!z?G=U:(G=new J.Mesh,G.__graphDefaultObj=!0,U&&z&&G.add(U)),G.__graphObjType="node",G}).onUpdateObj(function(N,U){if(N.__graphDefaultObj){var z=a(U)||1,G=Math.cbrt(z)*t.nodeRelSize,q=t.nodeResolution;(!N.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||N.geometry.parameters.radius!==G||N.geometry.parameters.widthSegments!==q)&&(c.hasOwnProperty(z)||(c[z]=new J.SphereGeometry(G,q,q)),N.geometry.dispose(),N.geometry=c[z]);var $=s(U),B=new J.Color(on($||"#ffffaa")),te=t.nodeOpacity*Sr($);(N.material.type!=="MeshLambertMaterial"||!N.material.color.equals(B)||N.material.opacity!==te)&&(f.hasOwnProperty($)||(f[$]=new J.MeshLambertMaterial({color:B,transparent:!0,opacity:te})),N.material.dispose(),N.material=f[$])}}).digest(t.graphData.nodes.filter(l))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var u=le(t.linkThreeObject),v=le(t.linkThreeObjectExtend),h=le(t.linkMaterial),p=le(t.linkVisibility),g=le(t.linkColor),y=le(t.linkWidth),d={},m={},b={},x=t.graphData.links.filter(p);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(N){var U=N.__data&&N.__data.__singleHopPhotonsObj;U&&(U.parent.remove(U),Ei(U),delete N.__data.__singleHopPhotonsObj)}).onCreateObj(function(N){var U=u(N),z=v(N);U&&t.linkThreeObject===U&&(U=U.clone());var G;if(!U||z){var q=!!y(N);if(q)G=new J.Mesh;else{var $=new J.BufferGeometry;$[Mr]("position",new J.BufferAttribute(new Float32Array(2*3),3)),G=new J.Line($)}}var B;return U?z?(B=new J.Group,B.__graphDefaultObj=!0,B.add(G),B.add(U)):B=U:(B=G,B.__graphDefaultObj=!0),B.renderOrder=10,B.__graphObjType="link",B}).onUpdateObj(function(N,U){if(N.__graphDefaultObj){var z=N.children.length?N.children[0]:N,G=Math.ceil(y(U)*10)/10,q=!!G;if(q){var $=G/2,B=t.linkResolution;if(!z.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||z.geometry.parameters.radiusTop!==$||z.geometry.parameters.radialSegments!==B){if(!d.hasOwnProperty(G)){var te=new J.CylinderGeometry($,$,1,B,1,!1);te[jn](new J.Matrix4().makeTranslation(0,1/2,0)),te[jn](new J.Matrix4().makeRotationX(Math.PI/2)),d[G]=te}z.geometry.dispose(),z.geometry=d[G]}}var ae=h(U);if(ae)z.material=ae;else{var ce=g(U),ye=new J.Color(on(ce||"#f0f0f0")),fe=t.linkOpacity*Sr(ce),Te=q?"MeshLambertMaterial":"LineBasicMaterial";if(z.material.type!==Te||!z.material.color.equals(ye)||z.material.opacity!==fe){var Be=q?m:b;Be.hasOwnProperty(ce)||(Be[ce]=new J[Te]({color:ye,transparent:fe<1,opacity:fe,depthWrite:fe>=1})),z.material.dispose(),z.material=Be[ce]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=le(t.linkDirectionalArrowLength),_=le(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var N=new J.Mesh(void 0,new J.MeshLambertMaterial({transparent:!0}));return N.__linkThreeObjType="arrow",N}).onUpdateObj(function(N,U){var z=w(U),G=t.linkDirectionalArrowResolution;if(!N.geometry.type.match(/^Cone(Buffer)?Geometry$/)||N.geometry.parameters.height!==z||N.geometry.parameters.radialSegments!==G){var q=new J.ConeGeometry(z*.25,z,G);q.translate(0,z/2,0),q.rotateX(Math.PI/2),N.geometry.dispose(),N.geometry=q}var $=_(U)||g(U)||"#f0f0f0";N.material.color=new J.Color(on($)),N.material.opacity=t.linkOpacity*3*Sr($)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var k=le(t.linkDirectionalParticles),S=le(t.linkDirectionalParticleWidth),A=le(t.linkDirectionalParticleColor),O=le(t.linkDirectionalParticleThreeObject),E={},T={};t.particlesDataMapper.onCreateObj(function(){var N=new J.Group;return N.__linkThreeObjType="photons",N.__photonDataMapper=new rn(N),N}).onUpdateObj(function(N,U){var z=!!N.children.length&&N.children[0],G=O(U),q,$;if(G)q=G.geometry,$=G.material;else{var B=Math.ceil(S(U)*10)/10/2,te=t.linkDirectionalParticleResolution;z&&z.geometry.parameters.radius===B&&z.geometry.parameters.widthSegments===te?q=z.geometry:(T.hasOwnProperty(B)||(T[B]=new J.SphereGeometry(B,te,te)),q=T[B]);var ae=A(U)||g(U)||"#f0f0f0",ce=new J.Color(on(ae)),ye=t.linkOpacity*3;z&&z.material.color.equals(ce)&&z.material.opacity===ye?$=z.material:(E.hasOwnProperty(ae)||(E[ae]=new J.MeshLambertMaterial({color:ce,transparent:!0,opacity:ye})),$=E[ae])}z&&(z.geometry!==q&&z.geometry.dispose(),z.material!==$&&z.material.dispose());var fe=Math.round(Math.abs(k(U)));N.__photonDataMapper.id(function(Te){return Te.idx}).onCreateObj(function(){return new J.Mesh(q,$)}).onUpdateObj(function(Te){Te.geometry=q,Te.material=$}).digest(Xe(new Array(fe)).map(function(Te,Be){return{idx:Be}}))}).digest(x.filter(k))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(N){N.source=N[t.linkSource],N.target=N[t.linkTarget]});var I=t.forceEngine!=="ngraph",C;if(I){(C=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var P=t.d3ForceLayout.force("link");P&&P.id(function(N){return N[t.nodeId]}).links(t.graphData.links);var R=t.dagMode&&dd(t.graphData,function(N){return N[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),H=Math.max.apply(Math,Xe(Object.values(R||[]))),V=t.dagLevelDistance||t.graphData.nodes.length/(H||1)*hd*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var X=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(N){return delete N[X]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var oe=["rl","td","zout"].includes(t.dagMode),D=function(U){return(R[U[t.nodeId]]-H/2)*V*(oe?-1:1)},F=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(N){return N[F]=D(N)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?zc(function(N){var U=R[N[t.nodeId]]||-1;return(t.dagMode==="radialin"?H-U:U)*V}).strength(function(N){return t.dagNodeFilter(N)?1:0}):null)}else{var W=Ri.graph();t.graphData.nodes.forEach(function(N){W.addNode(N[t.nodeId])}),t.graphData.links.forEach(function(N){W.addLink(N.source,N.target)}),C=Ri.forcelayout(W,sd({dimensions:t.numDimensions},t.ngraphPhysics)),C.graph=W}for(var Q=0;Q<t.warmupTicks&&!(I&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Q++)C[I?"tick":"step"]();t.layout=C,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function gd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(o){function i(){var a;Ia(this,i);for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return a=za(this,i,[].concat(l)),a.__kapsuleInstance=Fa(e,[].concat(Xe(n?[a]:[]),l)),a}return $a(i,o),Ba(i)}(t);return Object.keys(e()).forEach(function(o){return r.prototype[o]=function(){var i,a=(i=this.__kapsuleInstance)[o].apply(i,arguments);return a===this.__kapsuleInstance?this:a}}),r}var vd=window.THREE?window.THREE:{Group:Z.Group},Ga=gd(pd,vd.Group,!0);function Ne(){return Ne=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ne.apply(null,arguments)}function yd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function gn(e,t){return gn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},gn(e,t)}function md(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,gn(e,t)}function Br(e){return Br=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Br(e)}function bd(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function Va(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Va=function(){return!!e})()}function _d(e,t,n){if(Va())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&gn(o,n.prototype),o}function $r(e){var t=typeof Map=="function"?new Map:void 0;return $r=function(r){if(r===null||!bd(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,o)}function o(){return _d(r,arguments,Br(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),gn(o,r)},$r(e)}var xd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
502
+ `}var gu=bo.exports,wr,wi;function vu(){if(wi)return wr;wi=1,wr=e;function e(t,n,r,o){this.from=t,this.to=n,this.length=r,this.coefficient=o}return wr}var kr,ki;function yu(){if(ki)return kr;ki=1,kr=e;function e(t,n){var r;if(t||(t={}),n){for(r in n)if(n.hasOwnProperty(r)){var o=t.hasOwnProperty(r),i=typeof n[r],a=!o||typeof t[r]!==i;a?t[r]=n[r]:i==="object"&&(t[r]=e(t[r],n[r]))}}return t}return kr}var fn={exports:{}},Ci;function mu(){if(Ci)return fn.exports;Ci=1,fn.exports=e,fn.exports.random=e,fn.exports.randomIterator=l;function e(s){var u=typeof s=="number"?s:+new Date;return new t(u)}function t(s){this.seed=s}t.prototype.next=a,t.prototype.nextDouble=i,t.prototype.uniform=i,t.prototype.gaussian=n,t.prototype.random=i;function n(){var s,u,f;do u=this.nextDouble()*2-1,f=this.nextDouble()*2-1,s=u*u+f*f;while(s>=1||s===0);return u*Math.sqrt(-2*Math.log(s)/s)}t.prototype.levy=r;function r(){var s=1.5,u=Math.pow(o(1+s)*Math.sin(Math.PI*s/2)/(o((1+s)/2)*s*Math.pow(2,(s-1)/2)),1/s);return this.gaussian()*u/Math.pow(Math.abs(this.gaussian()),1/s)}function o(s){return Math.sqrt(2*Math.PI/s)*Math.pow(1/Math.E*(s+1/(12*s-1/(10*s))),s)}function i(){var s=this.seed;return s=s+2127912214+(s<<12)&4294967295,s=(s^3345072700^s>>>19)&4294967295,s=s+374761393+(s<<5)&4294967295,s=(s+3550635116^s<<9)&4294967295,s=s+4251993797+(s<<3)&4294967295,s=(s^3042594569^s>>>16)&4294967295,this.seed=s,(s&268435455)/268435456}function a(s){return Math.floor(this.nextDouble()*s)}function l(s,u){var f=u||e();if(typeof f.next!="function")throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:p,shuffle:c};function c(){var h,d,m;for(h=s.length-1;h>0;--h)d=f.next(h+1),m=s[d],s[d]=s[h],s[h]=m;return s}function p(h){var d,m,v;for(d=s.length-1;d>0;--d)m=f.next(d+1),v=s[m],s[m]=s[d],s[d]=v,h(v);s.length&&h(s[0])}}return fn.exports}var Fa=Su,bu=tu,_u=ru,xu=au,wu=cu,ku=du,Cu=gu,Si={};function Su(e){var t=vu(),n=yu(),r=ho;if(e){if(e.springCoeff!==void 0)throw new Error("springCoeff was renamed to springCoefficient");if(e.dragCoeff!==void 0)throw new Error("dragCoeff was renamed to dragCoefficient")}e=n(e,{springLength:10,springCoefficient:.8,gravity:-12,theta:.8,dragCoefficient:.9,timeStep:.5,adaptiveTimeStepWeight:0,dimensions:2,debug:!1});var o=Si[e.dimensions];if(!o){var i=e.dimensions;o={Body:bu(i,e.debug),createQuadTree:_u(i),createBounds:xu(i),createDragForce:wu(i),createSpringForce:ku(i),integrate:Cu(i)},Si[i]=o}var a=o.Body,l=o.createQuadTree,s=o.createBounds,u=o.createDragForce,f=o.createSpringForce,c=o.integrate,p=y=>new a(y),h=mu().random(42),d=[],m=[],v=l(e,h),g=s(d,e,h),S=f(e,h),_=u(e),x=0,w=[],b=new Map,M=0;j("nbody",K),j("spring",O);var P={bodies:d,quadTree:v,springs:m,settings:e,addForce:j,removeForce:F,getForces:I,step:function(){for(var y=0;y<w.length;++y)w[y](M);var k=c(d,e.timeStep,e.adaptiveTimeStepWeight);return M+=1,k},addBody:function(y){if(!y)throw new Error("Body is required");return d.push(y),y},addBodyAt:function(y){if(!y)throw new Error("Body position is required");var k=p(y);return d.push(k),k},removeBody:function(y){if(y){var k=d.indexOf(y);if(!(k<0))return d.splice(k,1),d.length===0&&g.reset(),!0}},addSpring:function(y,k,C,$){if(!y||!k)throw new Error("Cannot add null spring to force simulator");typeof C!="number"&&(C=-1);var B=new t(y,k,C,$>=0?$:-1);return m.push(B),B},getTotalMovement:function(){return x},removeSpring:function(y){if(y){var k=m.indexOf(y);if(k>-1)return m.splice(k,1),!0}},getBestNewBodyPosition:function(y){return g.getBestNewPosition(y)},getBBox:N,getBoundingBox:N,invalidateBBox:function(){console.warn("invalidateBBox() is deprecated, bounds always recomputed on `getBBox()` call")},gravity:function(y){return y!==void 0?(e.gravity=y,v.options({gravity:y}),this):e.gravity},theta:function(y){return y!==void 0?(e.theta=y,v.options({theta:y}),this):e.theta},random:h};return Mu(e,P),r(P),P;function N(){return g.update(),g.box}function j(y,k){if(b.has(y))throw new Error("Force "+y+" is already added");b.set(y,k),w.push(k)}function F(y){var k=w.indexOf(b.get(y));k<0||(w.splice(k,1),b.delete(y))}function I(){return b}function K(){if(d.length!==0){v.insertBodies(d);for(var y=d.length;y--;){var k=d[y];k.isPinned||(k.reset(),v.updateBodyForce(k),_.update(k))}}}function O(){for(var y=m.length;y--;)S.update(m[y])}}function Mu(e,t){for(var n in e)Pu(e,t,n)}function Pu(e,t,n){if(e.hasOwnProperty(n)&&typeof t[n]!="function"){var r=Number.isFinite(e[n]);r?t[n]=function(o){if(o!==void 0){if(!Number.isFinite(o))throw new Error("Value of "+n+" should be a valid number.");return e[n]=o,t}return e[n]}:t[n]=function(o){return o!==void 0?(e[n]=o,t):e[n]}}}po.exports=Ou;po.exports.simulator=Fa;var Au=ho;function Ou(e,t){if(!e)throw new Error("Graph structure cannot be undefined");var n=t&&t.createSimulator||Fa,r=n(t);if(Array.isArray(t))throw new Error("Physics settings is expected to be an object");var o=e.version>19?K:I;t&&typeof t.nodeMass=="function"&&(o=t.nodeMass);var i=new Map,a={},l=0,s=r.settings.springTransform||ju;_(),v();var u=!1,f={step:function(){if(l===0)return c(!0),!0;var O=r.step();f.lastMove=O,f.fire("step");var y=O/l,k=y<=.01;return c(k),k},getNodePosition:function(O){return F(O).pos},setNodePosition:function(O){var y=F(O);y.setPosition.apply(y,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(O){var y=a[O];if(y)return{from:y.from.pos,to:y.to.pos}},getGraphRect:function(){return r.getBBox()},forEachBody:p,pinNode:function(O,y){var k=F(O.id);k.isPinned=!!y},isNodePinned:function(O){return F(O.id).isPinned},dispose:function(){e.off("changed",S),f.fire("disposed")},getBody:m,getSpring:d,getForceVectorLength:h,simulator:r,graph:e,lastMove:0};return Au(f),f;function c(O){u!==O&&(u=O,g(O))}function p(O){i.forEach(O)}function h(){var O=0,y=0;return p(function(k){O+=Math.abs(k.force.x),y+=Math.abs(k.force.y)}),Math.sqrt(O*O+y*y)}function d(O,y){var k;if(y===void 0)typeof O!="object"?k=O:k=O.id;else{var C=e.hasLink(O,y);if(!C)return;k=C.id}return a[k]}function m(O){return i.get(O)}function v(){e.on("changed",S)}function g(O){f.fire("stable",O)}function S(O){for(var y=0;y<O.length;++y){var k=O[y];k.changeType==="add"?(k.node&&x(k.node.id),k.link&&b(k.link)):k.changeType==="remove"&&(k.node&&w(k.node),k.link&&M(k.link))}l=e.getNodesCount()}function _(){l=0,e.forEachNode(function(O){x(O.id),l+=1}),e.forEachLink(b)}function x(O){var y=i.get(O);if(!y){var k=e.getNode(O);if(!k)throw new Error("initBody() was called with unknown node id");var C=k.position;if(!C){var $=P(k);C=r.getBestNewBodyPosition($)}y=r.addBodyAt(C),y.id=O,i.set(O,y),N(O),j(k)&&(y.isPinned=!0)}}function w(O){var y=O.id,k=i.get(y);k&&(i.delete(y),r.removeBody(k))}function b(O){N(O.fromId),N(O.toId);var y=i.get(O.fromId),k=i.get(O.toId),C=r.addSpring(y,k,O.length);s(O,C),a[O.id]=C}function M(O){var y=a[O.id];if(y){var k=e.getNode(O.fromId),C=e.getNode(O.toId);k&&N(k.id),C&&N(C.id),delete a[O.id],r.removeSpring(y)}}function P(O){var y=[];if(!O.links)return y;for(var k=Math.min(O.links.length,2),C=0;C<k;++C){var $=O.links[C],B=$.fromId!==O.id?i.get($.fromId):i.get($.toId);B&&B.pos&&y.push(B)}return y}function N(O){var y=i.get(O);if(y.mass=o(O),Number.isNaN(y.mass))throw new Error("Node mass should be a number")}function j(O){return O&&(O.isPinned||O.data&&O.data.isPinned)}function F(O){var y=i.get(O);return y||(x(O),y=i.get(O)),y}function I(O){var y=e.getLinks(O);return y?1+y.length/3:1}function K(O){var y=e.getLinks(O);return y?1+y.size/3:1}}function ju(){}var zu=po.exports;const Tu=ka(zu);function $r(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Eu=typeof global=="object"&&global&&global.Object===Object&&global,Lu=typeof self=="object"&&self&&self.Object===Object&&self,Ba=Eu||Lu||Function("return this")(),Cr=function(){return Ba.Date.now()},Nu=/\s/;function Ru(e){for(var t=e.length;t--&&Nu.test(e.charAt(t)););return t}var Du=/^\s+/;function Iu(e){return e&&e.slice(0,Ru(e)+1).replace(Du,"")}var Xn=Ba.Symbol,$a=Object.prototype,Fu=$a.hasOwnProperty,Bu=$a.toString,dn=Xn?Xn.toStringTag:void 0;function $u(e){var t=Fu.call(e,dn),n=e[dn];try{e[dn]=void 0;var r=!0}catch{}var o=Bu.call(e);return r&&(t?e[dn]=n:delete e[dn]),o}var Hu=Object.prototype,qu=Hu.toString;function Uu(e){return qu.call(e)}var Gu="[object Null]",Vu="[object Undefined]",Mi=Xn?Xn.toStringTag:void 0;function Wu(e){return e==null?e===void 0?Vu:Gu:Mi&&Mi in Object(e)?$u(e):Uu(e)}function Yu(e){return e!=null&&typeof e=="object"}var Xu="[object Symbol]";function Ku(e){return typeof e=="symbol"||Yu(e)&&Wu(e)==Xu}var Pi=NaN,Zu=/^[-+]0x[0-9a-f]+$/i,Qu=/^0b[01]+$/i,Ju=/^0o[0-7]+$/i,ef=parseInt;function Ai(e){if(typeof e=="number")return e;if(Ku(e))return Pi;if($r(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=$r(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Iu(e);var n=Qu.test(e);return n||Ju.test(e)?ef(e.slice(2),n?2:8):Zu.test(e)?Pi:+e}var tf="Expected a function",nf=Math.max,rf=Math.min;function of(e,t,n){var r,o,i,a,l,s,u=0,f=!1,c=!1,p=!0;if(typeof e!="function")throw new TypeError(tf);t=Ai(t)||0,$r(n)&&(f=!!n.leading,c="maxWait"in n,i=c?nf(Ai(n.maxWait)||0,t):i,p="trailing"in n?!!n.trailing:p);function h(b){var M=r,P=o;return r=o=void 0,u=b,a=e.apply(P,M),a}function d(b){return u=b,l=setTimeout(g,t),f?h(b):a}function m(b){var M=b-s,P=b-u,N=t-M;return c?rf(N,i-P):N}function v(b){var M=b-s,P=b-u;return s===void 0||M>=t||M<0||c&&P>=i}function g(){var b=Cr();if(v(b))return S(b);l=setTimeout(g,m(b))}function S(b){return l=void 0,p&&r?h(b):(r=o=void 0,a)}function _(){l!==void 0&&clearTimeout(l),u=0,r=s=o=l=void 0}function x(){return l===void 0?a:S(Cr())}function w(){var b=Cr(),M=v(b);if(r=arguments,o=this,s=b,M){if(l===void 0)return d(s);if(c)return clearTimeout(l),l=setTimeout(g,t),h(s)}return l===void 0&&(l=setTimeout(g,t)),a}return w.cancel=_,w.flush=x,w}function Oi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function af(e){if(Array.isArray(e))return e}function sf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function lf(e,t,n){return Object.defineProperty(e,"prototype",{writable:!1}),e}function cf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function uf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
503
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ff(e,t){return af(e)||cf(e,t)||df(e,t)||uf()}function df(e,t){if(e){if(typeof e=="string")return Oi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Oi(e,t):void 0}}var hf=lf(function e(t,n){var r=n.default,o=r===void 0?null:r,i=n.triggerUpdate,a=i===void 0?!0:i,l=n.onChange,s=l===void 0?function(u,f){}:l;sf(this,e),this.name=t,this.defaultVal=o,this.triggerUpdate=a,this.onChange=s});function _o(e){var t=e.stateInit,n=t===void 0?function(){return{}}:t,r=e.props,o=r===void 0?{}:r,i=e.methods,a=i===void 0?{}:i,l=e.aliases,s=l===void 0?{}:l,u=e.init,f=u===void 0?function(){}:u,c=e.update,p=c===void 0?function(){}:c,h=Object.keys(o).map(function(d){return new hf(d,o[d])});return function d(){for(var m=arguments.length,v=new Array(m),g=0;g<m;g++)v[g]=arguments[g];var S=!!(this instanceof d&&this.constructor),_=S?v.shift():void 0,x=v[0],w=x===void 0?{}:x,b=Object.assign({},n instanceof Function?n(w):n,{initialised:!1}),M={};function P(F){return N(F,w),j(),P}var N=function(I,K){f.call(P,I,b,K),b.initialised=!0},j=of(function(){b.initialised&&(p.call(P,b,M),M={})},1);return h.forEach(function(F){P[F.name]=I(F);function I(K){var O=K.name,y=K.triggerUpdate,k=y===void 0?!1:y,C=K.onChange,$=C===void 0?function(L,D){}:C,B=K.defaultVal,X=B===void 0?null:B;return function(L){var D=b[O];if(!arguments.length)return D;var q=L===void 0?X:L;return b[O]=q,$.call(P,q,b,D),!M.hasOwnProperty(O)&&(M[O]=D),k&&j(),P}}}),Object.keys(a).forEach(function(F){P[F]=function(){for(var I,K=arguments.length,O=new Array(K),y=0;y<K;y++)O[y]=arguments[y];return(I=a[F]).call.apply(I,[P,b].concat(O))}}),Object.entries(s).forEach(function(F){var I=ff(F,2),K=I[0],O=I[1];return P[K]=P[O]}),P.resetProps=function(){return h.forEach(function(F){P[F.name](F.defaultVal)}),P},P.resetProps(),b._rerender=j,S&&_&&P(_),P}}var de=function(e){return typeof e=="function"?e:typeof e=="string"?function(t){return t[e]}:function(t){return e}};class ji extends Map{constructor(t,n=vf){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[r,o]of t)this.set(r,o)}get(t){return super.get(zi(this,t))}has(t){return super.has(zi(this,t))}set(t,n){return super.set(pf(this,t),n)}delete(t){return super.delete(gf(this,t))}}function zi({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):n}function pf({_intern:e,_key:t},n){const r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function gf({_intern:e,_key:t},n){const r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function vf(e){return e!==null&&typeof e=="object"?e.valueOf():e}function yf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n<o||n===void 0&&o>=o)&&(n=o)}return n}function mf(e,t){let n;if(t===void 0)for(const r of e)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);else{let r=-1;for(let o of e)(o=t(o,++r,e))!=null&&(n>o||n===void 0&&o>=o)&&(n=o)}return n}function Hr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function bf(e){if(Array.isArray(e))return e}function _f(e){if(Array.isArray(e))return Hr(e)}function Ha(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function xf(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function wf(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function De(e,t){return e.get(Ha(e,t))}function Vt(e,t,n){xf(e,t),t.set(e,n)}function Bn(e,t,n){return e.set(Ha(e,t),n),n}function kf(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Tf(r.key),r)}}function Cf(e,t,n){return t&&kf(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Sf(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Mf(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function Pf(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
504
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Af(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
505
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Of(e,t){return bf(e)||Mf(e,t)||qa(e,t)||Pf()}function jf(e){return _f(e)||Sf(e)||qa(e)||Af()}function zf(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function Tf(e){var t=zf(e,"string");return typeof t=="symbol"?t:t+""}function qa(e,t){if(e){if(typeof e=="string")return Hr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hr(e,t):void 0}}var Wt=new WeakMap,hn=new WeakMap,Yt=new WeakMap,Sr=new WeakMap,Mr=new WeakMap,Pr=new WeakMap,Ef=function(){function e(){wf(this,e),Vt(this,Wt,new Map),Vt(this,hn,new Map),Vt(this,Yt,function(t){return t}),Vt(this,Sr,function(){return{}}),Vt(this,Mr,function(){}),Vt(this,Pr,function(){})}return Cf(e,[{key:"getObj",value:function(n){return De(Wt,this).get(De(Yt,this).call(this,n))}},{key:"getData",value:function(n){return De(hn,this).get(n)}},{key:"entries",value:function(){return jf(De(hn,this).entries()).map(function(n){var r=Of(n,2),o=r[0],i=r[1];return[i,o]})}},{key:"id",value:function(n){return Bn(Yt,this,de(n)),this}},{key:"onCreateObj",value:function(n){return Bn(Sr,this,n),this}},{key:"onUpdateObj",value:function(n){return Bn(Mr,this,n),this}},{key:"onRemoveObj",value:function(n){return Bn(Pr,this,n),this}},{key:"digest",value:function(n){var r=this;n.filter(function(i){return!De(Wt,r).has(De(Yt,r).call(r,i))}).forEach(function(i){var a=De(Sr,r).call(r,i);De(Wt,r).set(De(Yt,r).call(r,i),a),De(hn,r).set(a,i)});var o=new Map(n.map(function(i){return[De(Yt,r).call(r,i),i]}));return De(Wt,this).forEach(function(i,a){o.has(a)?De(Mr,r).call(r,i,o.get(a)):(De(Pr,r).call(r,i,a),De(Wt,r).delete(a),De(hn,r).delete(i))}),this}},{key:"clear",value:function(){return this.digest([]),this}}])}();function Lf(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e);break}return this}const Ti=Symbol("implicit");function Ua(){var e=new ji,t=[],n=[],r=Ti;function o(i){let a=e.get(i);if(a===void 0){if(r!==Ti)return r;e.set(i,a=t.push(i)-1)}return n[a%n.length]}return o.domain=function(i){if(!arguments.length)return t.slice();t=[],e=new ji;for(const a of i)e.has(a)||e.set(a,t.push(a)-1);return o},o.range=function(i){return arguments.length?(n=Array.from(i),o):n.slice()},o.unknown=function(i){return arguments.length?(r=i,o):r},o.copy=function(){return Ua(t,n).unknown(r)},Lf.apply(o,arguments),o}function Nf(e){for(var t=e.length/6|0,n=new Array(t),r=0;r<t;)n[r]="#"+e.slice(r*6,++r*6);return n}const Rf=Nf("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928");function Kn(e){"@babel/helpers - typeof";return Kn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Kn(e)}var Df=/^\s+/,If=/\s+$/;function J(e,t){if(e=e||"",t=t||{},e instanceof J)return e;if(!(this instanceof J))return new J(e,t);var n=Ff(e);this._originalInput=e,this._r=n.r,this._g=n.g,this._b=n.b,this._a=n.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||n.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=n.ok}J.prototype={isDark:function(){return this.getBrightness()<128},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var t=this.toRgb();return(t.r*299+t.g*587+t.b*114)/1e3},getLuminance:function(){var t=this.toRgb(),n,r,o,i,a,l;return n=t.r/255,r=t.g/255,o=t.b/255,n<=.03928?i=n/12.92:i=Math.pow((n+.055)/1.055,2.4),r<=.03928?a=r/12.92:a=Math.pow((r+.055)/1.055,2.4),o<=.03928?l=o/12.92:l=Math.pow((o+.055)/1.055,2.4),.2126*i+.7152*a+.0722*l},setAlpha:function(t){return this._a=Ga(t),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var t=Li(this._r,this._g,this._b);return{h:t.h*360,s:t.s,v:t.v,a:this._a}},toHsvString:function(){var t=Li(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.v*100);return this._a==1?"hsv("+n+", "+r+"%, "+o+"%)":"hsva("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHsl:function(){var t=Ei(this._r,this._g,this._b);return{h:t.h*360,s:t.s,l:t.l,a:this._a}},toHslString:function(){var t=Ei(this._r,this._g,this._b),n=Math.round(t.h*360),r=Math.round(t.s*100),o=Math.round(t.l*100);return this._a==1?"hsl("+n+", "+r+"%, "+o+"%)":"hsla("+n+", "+r+"%, "+o+"%, "+this._roundA+")"},toHex:function(t){return Ni(this._r,this._g,this._b,t)},toHexString:function(t){return"#"+this.toHex(t)},toHex8:function(t){return qf(this._r,this._g,this._b,this._a,t)},toHex8String:function(t){return"#"+this.toHex8(t)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(we(this._r,255)*100)+"%",g:Math.round(we(this._g,255)*100)+"%",b:Math.round(we(this._b,255)*100)+"%",a:this._a}},toPercentageRgbString:function(){return this._a==1?"rgb("+Math.round(we(this._r,255)*100)+"%, "+Math.round(we(this._g,255)*100)+"%, "+Math.round(we(this._b,255)*100)+"%)":"rgba("+Math.round(we(this._r,255)*100)+"%, "+Math.round(we(this._g,255)*100)+"%, "+Math.round(we(this._b,255)*100)+"%, "+this._roundA+")"},toName:function(){return this._a===0?"transparent":this._a<1?!1:td[Ni(this._r,this._g,this._b,!0)]||!1},toFilter:function(t){var n="#"+Ri(this._r,this._g,this._b,this._a),r=n,o=this._gradientType?"GradientType = 1, ":"";if(t){var i=J(t);r="#"+Ri(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+o+"startColorstr="+n+",endColorstr="+r+")"},toString:function(t){var n=!!t;t=t||this._format;var r=!1,o=this._a<1&&this._a>=0,i=!n&&o&&(t==="hex"||t==="hex6"||t==="hex3"||t==="hex4"||t==="hex8"||t==="name");return i?t==="name"&&this._a===0?this.toName():this.toRgbString():(t==="rgb"&&(r=this.toRgbString()),t==="prgb"&&(r=this.toPercentageRgbString()),(t==="hex"||t==="hex6")&&(r=this.toHexString()),t==="hex3"&&(r=this.toHexString(!0)),t==="hex4"&&(r=this.toHex8String(!0)),t==="hex8"&&(r=this.toHex8String()),t==="name"&&(r=this.toName()),t==="hsl"&&(r=this.toHslString()),t==="hsv"&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return J(this.toString())},_applyModification:function(t,n){var r=t.apply(null,[this].concat([].slice.call(n)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(Wf,arguments)},brighten:function(){return this._applyModification(Yf,arguments)},darken:function(){return this._applyModification(Xf,arguments)},desaturate:function(){return this._applyModification(Uf,arguments)},saturate:function(){return this._applyModification(Gf,arguments)},greyscale:function(){return this._applyModification(Vf,arguments)},spin:function(){return this._applyModification(Kf,arguments)},_applyCombination:function(t,n){return t.apply(null,[this].concat([].slice.call(n)))},analogous:function(){return this._applyCombination(Jf,arguments)},complement:function(){return this._applyCombination(Zf,arguments)},monochromatic:function(){return this._applyCombination(ed,arguments)},splitcomplement:function(){return this._applyCombination(Qf,arguments)},triad:function(){return this._applyCombination(Di,[3])},tetrad:function(){return this._applyCombination(Di,[4])}};J.fromRatio=function(e,t){if(Kn(e)=="object"){var n={};for(var r in e)e.hasOwnProperty(r)&&(r==="a"?n[r]=e[r]:n[r]=_n(e[r]));e=n}return J(e,t)};function Ff(e){var t={r:0,g:0,b:0},n=1,r=null,o=null,i=null,a=!1,l=!1;return typeof e=="string"&&(e=id(e)),Kn(e)=="object"&&(xt(e.r)&&xt(e.g)&&xt(e.b)?(t=Bf(e.r,e.g,e.b),a=!0,l=String(e.r).substr(-1)==="%"?"prgb":"rgb"):xt(e.h)&&xt(e.s)&&xt(e.v)?(r=_n(e.s),o=_n(e.v),t=Hf(e.h,r,o),a=!0,l="hsv"):xt(e.h)&&xt(e.s)&&xt(e.l)&&(r=_n(e.s),i=_n(e.l),t=$f(e.h,r,i),a=!0,l="hsl"),e.hasOwnProperty("a")&&(n=e.a)),n=Ga(n),{ok:a,format:e.format||l,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}function Bf(e,t,n){return{r:we(e,255)*255,g:we(t,255)*255,b:we(n,255)*255}}function Ei(e,t,n){e=we(e,255),t=we(t,255),n=we(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,l=(r+o)/2;if(r==o)i=a=0;else{var s=r-o;switch(a=l>.5?s/(2-r-o):s/(r+o),r){case e:i=(t-n)/s+(t<n?6:0);break;case t:i=(n-e)/s+2;break;case n:i=(e-t)/s+4;break}i/=6}return{h:i,s:a,l}}function $f(e,t,n){var r,o,i;e=we(e,360),t=we(t,100),n=we(n,100);function a(u,f,c){return c<0&&(c+=1),c>1&&(c-=1),c<1/6?u+(f-u)*6*c:c<1/2?f:c<2/3?u+(f-u)*(2/3-c)*6:u}if(t===0)r=o=i=n;else{var l=n<.5?n*(1+t):n+t-n*t,s=2*n-l;r=a(s,l,e+1/3),o=a(s,l,e),i=a(s,l,e-1/3)}return{r:r*255,g:o*255,b:i*255}}function Li(e,t,n){e=we(e,255),t=we(t,255),n=we(n,255);var r=Math.max(e,t,n),o=Math.min(e,t,n),i,a,l=r,s=r-o;if(a=r===0?0:s/r,r==o)i=0;else{switch(r){case e:i=(t-n)/s+(t<n?6:0);break;case t:i=(n-e)/s+2;break;case n:i=(e-t)/s+4;break}i/=6}return{h:i,s:a,v:l}}function Hf(e,t,n){e=we(e,360)*6,t=we(t,100),n=we(n,100);var r=Math.floor(e),o=e-r,i=n*(1-t),a=n*(1-o*t),l=n*(1-(1-o)*t),s=r%6,u=[n,a,i,i,l,n][s],f=[l,n,n,a,i,i][s],c=[i,i,l,n,n,a][s];return{r:u*255,g:f*255,b:c*255}}function Ni(e,t,n,r){var o=[ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16))];return r&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0):o.join("")}function qf(e,t,n,r,o){var i=[ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16)),ut(Va(r))];return o&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)&&i[3].charAt(0)==i[3].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0)+i[3].charAt(0):i.join("")}function Ri(e,t,n,r){var o=[ut(Va(r)),ut(Math.round(e).toString(16)),ut(Math.round(t).toString(16)),ut(Math.round(n).toString(16))];return o.join("")}J.equals=function(e,t){return!e||!t?!1:J(e).toRgbString()==J(t).toRgbString()};J.random=function(){return J.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function Uf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.s-=t/100,n.s=ar(n.s),J(n)}function Gf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.s+=t/100,n.s=ar(n.s),J(n)}function Vf(e){return J(e).desaturate(100)}function Wf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.l+=t/100,n.l=ar(n.l),J(n)}function Yf(e,t){t=t===0?0:t||10;var n=J(e).toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),J(n)}function Xf(e,t){t=t===0?0:t||10;var n=J(e).toHsl();return n.l-=t/100,n.l=ar(n.l),J(n)}function Kf(e,t){var n=J(e).toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,J(n)}function Zf(e){var t=J(e).toHsl();return t.h=(t.h+180)%360,J(t)}function Di(e,t){if(isNaN(t)||t<=0)throw new Error("Argument to polyad must be a positive number");for(var n=J(e).toHsl(),r=[J(e)],o=360/t,i=1;i<t;i++)r.push(J({h:(n.h+i*o)%360,s:n.s,l:n.l}));return r}function Qf(e){var t=J(e).toHsl(),n=t.h;return[J(e),J({h:(n+72)%360,s:t.s,l:t.l}),J({h:(n+216)%360,s:t.s,l:t.l})]}function Jf(e,t,n){t=t||6,n=n||30;var r=J(e).toHsl(),o=360/n,i=[J(e)];for(r.h=(r.h-(o*t>>1)+720)%360;--t;)r.h=(r.h+o)%360,i.push(J(r));return i}function ed(e,t){t=t||6;for(var n=J(e).toHsv(),r=n.h,o=n.s,i=n.v,a=[],l=1/t;t--;)a.push(J({h:r,s:o,v:i})),i=(i+l)%1;return a}J.mix=function(e,t,n){n=n===0?0:n||50;var r=J(e).toRgb(),o=J(t).toRgb(),i=n/100,a={r:(o.r-r.r)*i+r.r,g:(o.g-r.g)*i+r.g,b:(o.b-r.b)*i+r.b,a:(o.a-r.a)*i+r.a};return J(a)};J.readability=function(e,t){var n=J(e),r=J(t);return(Math.max(n.getLuminance(),r.getLuminance())+.05)/(Math.min(n.getLuminance(),r.getLuminance())+.05)};J.isReadable=function(e,t,n){var r=J.readability(e,t),o,i;switch(i=!1,o=ad(n),o.level+o.size){case"AAsmall":case"AAAlarge":i=r>=4.5;break;case"AAlarge":i=r>=3;break;case"AAAsmall":i=r>=7;break}return i};J.mostReadable=function(e,t,n){var r=null,o=0,i,a,l,s;n=n||{},a=n.includeFallbackColors,l=n.level,s=n.size;for(var u=0;u<t.length;u++)i=J.readability(e,t[u]),i>o&&(o=i,r=J(t[u]));return J.isReadable(e,r,{level:l,size:s})||!a?r:(n.includeFallbackColors=!1,J.mostReadable(e,["#fff","#000"],n))};var qr=J.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},td=J.hexNames=nd(qr);function nd(e){var t={};for(var n in e)e.hasOwnProperty(n)&&(t[e[n]]=n);return t}function Ga(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function we(e,t){rd(e)&&(e="100%");var n=od(e);return e=Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(e*t,10)/100),Math.abs(e-t)<1e-6?1:e%t/parseFloat(t)}function ar(e){return Math.min(1,Math.max(0,e))}function Ke(e){return parseInt(e,16)}function rd(e){return typeof e=="string"&&e.indexOf(".")!=-1&&parseFloat(e)===1}function od(e){return typeof e=="string"&&e.indexOf("%")!=-1}function ut(e){return e.length==1?"0"+e:""+e}function _n(e){return e<=1&&(e=e*100+"%"),e}function Va(e){return Math.round(parseFloat(e)*255).toString(16)}function Ii(e){return Ke(e)/255}var lt=function(){var e="[-\\+]?\\d+%?",t="[-\\+]?\\d*\\.\\d+%?",n="(?:"+t+")|(?:"+e+")",r="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?",o="[\\s|\\(]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")[,|\\s]+("+n+")\\s*\\)?";return{CSS_UNIT:new RegExp(n),rgb:new RegExp("rgb"+r),rgba:new RegExp("rgba"+o),hsl:new RegExp("hsl"+r),hsla:new RegExp("hsla"+o),hsv:new RegExp("hsv"+r),hsva:new RegExp("hsva"+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function xt(e){return!!lt.CSS_UNIT.exec(e)}function id(e){e=e.replace(Df,"").replace(If,"").toLowerCase();var t=!1;if(qr[e])e=qr[e],t=!0;else if(e=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var n;return(n=lt.rgb.exec(e))?{r:n[1],g:n[2],b:n[3]}:(n=lt.rgba.exec(e))?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=lt.hsl.exec(e))?{h:n[1],s:n[2],l:n[3]}:(n=lt.hsla.exec(e))?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=lt.hsv.exec(e))?{h:n[1],s:n[2],v:n[3]}:(n=lt.hsva.exec(e))?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=lt.hex8.exec(e))?{r:Ke(n[1]),g:Ke(n[2]),b:Ke(n[3]),a:Ii(n[4]),format:t?"name":"hex8"}:(n=lt.hex6.exec(e))?{r:Ke(n[1]),g:Ke(n[2]),b:Ke(n[3]),format:t?"name":"hex"}:(n=lt.hex4.exec(e))?{r:Ke(n[1]+""+n[1]),g:Ke(n[2]+""+n[2]),b:Ke(n[3]+""+n[3]),a:Ii(n[4]+""+n[4]),format:t?"name":"hex8"}:(n=lt.hex3.exec(e))?{r:Ke(n[1]+""+n[1]),g:Ke(n[2]+""+n[2]),b:Ke(n[3]+""+n[3]),format:t?"name":"hex"}:!1}function ad(e){var t,n;return e=e||{level:"AA",size:"small"},t=(e.level||"AA").toUpperCase(),n=(e.size||"small").toLowerCase(),t!=="AA"&&t!=="AAA"&&(t="AA"),n!=="small"&&n!=="large"&&(n="small"),{level:t,size:n}}function Ur(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function sd(e){if(Array.isArray(e))return e}function ld(e){if(Array.isArray(e))return Ur(e)}function Wa(e,t,n){if(typeof e=="function"?e===t:e.has(t))return arguments.length<3?t:n;throw new TypeError("Private element is not present on this object")}function cd(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Ya(e,t,n){return t=en(t),yd(e,xo()?Reflect.construct(t,n||[],en(e).constructor):t.apply(e,n))}function ud(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Xa(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function Ar(e,t){return e.get(Wa(e,t))}function Fi(e,t,n){ud(e,t),t.set(e,n)}function Bi(e,t,n){return e.set(Wa(e,t),n),n}function Ka(e,t,n){if(xo())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return o}function fd(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,Ja(r.key),r)}}function Za(e,t,n){return t&&fd(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function sr(e,t,n){return(t=Ja(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Gr(){return Gr=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=md(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},Gr.apply(null,arguments)}function en(e){return en=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},en(e)}function Qa(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Vr(e,t)}function xo(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(xo=function(){return!!e})()}function dd(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function hd(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function pd(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
506
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gd(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
507
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function $i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function vd(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?$i(Object(n),!0).forEach(function(r){sr(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):$i(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function yd(e,t){if(t&&(typeof t=="object"||typeof t=="function"))return t;if(t!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return cd(e)}function Vr(e,t){return Vr=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Vr(e,t)}function wn(e,t){return sd(e)||hd(e,t)||es(e,t)||pd()}function md(e,t){for(;!{}.hasOwnProperty.call(e,t)&&(e=en(e))!==null;);return e}function Or(e,t,n,r){var o=Gr(en(e.prototype),t,n);return typeof o=="function"?function(i){return o.apply(n,i)}:o}function ct(e){return ld(e)||dd(e)||es(e)||gd()}function bd(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ja(e){var t=bd(e,"string");return typeof t=="symbol"?t:t+""}function Wr(e){"@babel/helpers - typeof";return Wr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wr(e)}function es(e,t){if(e){if(typeof e=="string")return Ur(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ur(e,t):void 0}}var ts=function(t){t instanceof Array?t.forEach(ts):(t.map&&t.map.dispose(),t.dispose())},wo=function(t){t.geometry&&t.geometry.dispose(),t.material&&ts(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(wo)},Hi=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),wo(n)}},jr=new WeakMap,$n=new WeakMap,pn=function(e){function t(n){var r,o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=o.dataBindAttr,a=i===void 0?"__data":i,l=o.objBindAttr,s=l===void 0?"__threeObj":l;return Xa(this,t),r=Ya(this,t),sr(r,"scene",void 0),Fi(r,jr,void 0),Fi(r,$n,void 0),r.scene=n,Bi(jr,r,a),Bi($n,r,s),r.onRemoveObj(function(){}),r}return Qa(t,e),Za(t,[{key:"onCreateObj",value:function(r){var o=this;return Or(t,"onCreateObj",this)([function(i){var a=r(i);return i[Ar($n,o)]=a,a[Ar(jr,o)]=i,o.scene.add(a),a}]),this}},{key:"onRemoveObj",value:function(r){var o=this;return Or(t,"onRemoveObj",this)([function(i,a){var l=Or(t,"getData",o)([i]);r(i,a),o.scene.remove(i),wo(i),delete l[Ar($n,o)]}]),this}}])}(Ef),gn=function(t){return isNaN(t)?parseInt(J(t).toHex(),16):t},zr=function(t){return isNaN(t)?J(t).getAlpha():1},_d=Ua(Rf);function qi(e,t,n){!t||typeof n!="string"||e.filter(function(r){return!r[n]}).forEach(function(r){r[n]=_d(t(r))})}function xd(e,t){var n=e.nodes,r=e.links,o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=o.nodeFilter,a=i===void 0?function(){return!0}:i,l=o.onLoopError,s=l===void 0?function(h){throw"Invalid DAG structure! Found cycle in node path: ".concat(h.join(" -> "),".")}:l,u={};n.forEach(function(h){return u[t(h)]={data:h,out:[],depth:-1,skip:!a(h)}}),r.forEach(function(h){var d=h.source,m=h.target,v=x(d),g=x(m);if(!u.hasOwnProperty(v))throw"Missing source node with id: ".concat(v);if(!u.hasOwnProperty(g))throw"Missing target node with id: ".concat(g);var S=u[v],_=u[g];S.out.push(_);function x(w){return Wr(w)==="object"?t(w):w}});var f=[];p(Object.values(u));var c=Object.assign.apply(Object,[{}].concat(ct(Object.entries(u).filter(function(h){var d=wn(h,2),m=d[1];return!m.skip}).map(function(h){var d=wn(h,2),m=d[0],v=d[1];return sr({},m,v.depth)}))));return c;function p(h){for(var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],m=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,v=function(){var x=h[g];if(d.indexOf(x)!==-1){var w=[].concat(ct(d.slice(d.indexOf(x))),[x]).map(function(b){return t(b.data)});return f.some(function(b){return b.length===w.length&&b.every(function(M,P){return M===w[P]})})||(f.push(w),s(w)),1}m>x.depth&&(x.depth=m,p(x.out,[].concat(ct(d),[x]),m+(x.skip?0:1)))},g=0,S=h.length;g<S;g++)v()}}var oe=window.THREE?window.THREE:{Group:re.Group,Mesh:re.Mesh,MeshLambertMaterial:re.MeshLambertMaterial,Color:re.Color,BufferGeometry:re.BufferGeometry,BufferAttribute:re.BufferAttribute,Matrix4:re.Matrix4,Vector3:re.Vector3,SphereGeometry:re.SphereGeometry,CylinderGeometry:re.CylinderGeometry,TubeGeometry:re.TubeGeometry,ConeGeometry:re.ConeGeometry,Line:re.Line,LineBasicMaterial:re.LineBasicMaterial,QuadraticBezierCurve3:re.QuadraticBezierCurve3,CubicBezierCurve3:re.CubicBezierCurve3,Box3:re.Box3},Ui={graph:Zc,forcelayout:Tu},wd=2,Tr=new oe.BufferGeometry().setAttribute?"setAttribute":"addAttribute",Hn=new oe.BufferGeometry().applyMatrix4?"applyMatrix4":"applyMatrix",kd=_o({props:{jsonUrl:{onChange:function(t,n){var r=this;t&&!n.fetchingJson&&(n.fetchingJson=!0,n.onLoading(),fetch(t).then(function(o){return o.json()}).then(function(o){n.fetchingJson=!1,n.onFinishLoading(o),r.graphData(o)}))},triggerUpdate:!1},graphData:{default:{nodes:[],links:[]},onChange:function(t,n){n.engineRunning=!1}},numDimensions:{default:3,onChange:function(t,n){var r=n.d3ForceLayout.force("charge");r&&r.strength(t>2?-60:-30),t<3&&o(n.graphData.nodes,"z"),t<2&&o(n.graphData.nodes,"y");function o(i,a){i.forEach(function(l){delete l[a],delete l["v".concat(a)]})}}},dagMode:{onChange:function(t,n){!t&&n.forceEngine==="d3"&&(n.graphData.nodes||[]).forEach(function(r){return r.fx=r.fy=r.fz=void 0})}},dagLevelDistance:{},dagNodeFilter:{default:function(t){return!0}},onDagError:{triggerUpdate:!1},nodeRelSize:{default:4},nodeId:{default:"id"},nodeVal:{default:"val"},nodeResolution:{default:8},nodeColor:{default:"color"},nodeAutoColorBy:{},nodeOpacity:{default:.75},nodeVisibility:{default:!0},nodeThreeObject:{},nodeThreeObjectExtend:{default:!1},nodePositionUpdate:{triggerUpdate:!1},linkSource:{default:"source"},linkTarget:{default:"target"},linkVisibility:{default:!0},linkColor:{default:"color"},linkAutoColorBy:{},linkOpacity:{default:.2},linkWidth:{},linkResolution:{default:6},linkCurvature:{default:0,triggerUpdate:!1},linkCurveRotation:{default:0,triggerUpdate:!1},linkMaterial:{},linkThreeObject:{},linkThreeObjectExtend:{default:!1},linkPositionUpdate:{triggerUpdate:!1},linkDirectionalArrowLength:{default:0},linkDirectionalArrowColor:{},linkDirectionalArrowRelPos:{default:.5,triggerUpdate:!1},linkDirectionalArrowResolution:{default:8},linkDirectionalParticles:{default:0},linkDirectionalParticleSpeed:{default:.01,triggerUpdate:!1},linkDirectionalParticleOffset:{default:0,triggerUpdate:!1},linkDirectionalParticleWidth:{default:.5},linkDirectionalParticleColor:{},linkDirectionalParticleResolution:{default:4},linkDirectionalParticleThreeObject:{},forceEngine:{default:"d3"},d3AlphaMin:{default:0},d3AlphaDecay:{default:.0228,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaDecay(t)}},d3AlphaTarget:{default:0,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.alphaTarget(t)}},d3VelocityDecay:{default:.4,triggerUpdate:!1,onChange:function(t,n){n.d3ForceLayout.velocityDecay(t)}},ngraphPhysics:{default:{timeStep:20,gravity:-1.2,theta:.8,springLength:30,springCoefficient:8e-4,dragCoefficient:.02}},warmupTicks:{default:0,triggerUpdate:!1},cooldownTicks:{default:1/0,triggerUpdate:!1},cooldownTime:{default:15e3,triggerUpdate:!1},onLoading:{default:function(){},triggerUpdate:!1},onFinishLoading:{default:function(){},triggerUpdate:!1},onUpdate:{default:function(){},triggerUpdate:!1},onFinishUpdate:{default:function(){},triggerUpdate:!1},onEngineTick:{default:function(){},triggerUpdate:!1},onEngineStop:{default:function(){},triggerUpdate:!1}},methods:{refresh:function(t){return t._flushObjects=!0,t._rerender(),this},d3Force:function(t,n,r){return r===void 0?t.d3ForceLayout.force(n):(t.d3ForceLayout.force(n,r),this)},d3ReheatSimulation:function(t){return t.d3ForceLayout.alpha(1),this.resetCountdown(),this},resetCountdown:function(t){return t.cntTicks=0,t.startTickTime=new Date,t.engineRunning=!0,this},tickFrame:function(t){var n=t.forceEngine!=="ngraph";return t.engineRunning&&r(),o(),i(),this;function r(){++t.cntTicks>t.cooldownTicks||new Date-t.startTickTime>t.cooldownTime||n&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin?(t.engineRunning=!1,t.onEngineStop()):(t.layout[n?"tick":"step"](),t.onEngineTick());var a=de(t.nodeThreeObjectExtend);t.nodeDataMapper.entries().forEach(function(p){var h=wn(p,2),d=h[0],m=h[1];if(m){var v=n?d:t.layout.getNodePosition(d[t.nodeId]),g=a(d);(!t.nodePositionUpdate||!t.nodePositionUpdate(g?m.children[0]:m,{x:v.x,y:v.y,z:v.z},d)||g)&&(m.position.x=v.x,m.position.y=v.y||0,m.position.z=v.z||0)}});var l=de(t.linkWidth),s=de(t.linkCurvature),u=de(t.linkCurveRotation),f=de(t.linkThreeObjectExtend);t.linkDataMapper.entries().forEach(function(p){var h=wn(p,2),d=h[0],m=h[1];if(m){var v=n?d:t.layout.getLinkPosition(t.layout.graph.getLink(d.source,d.target).id),g=v[n?"source":"from"],S=v[n?"target":"to"];if(!(!g||!S||!g.hasOwnProperty("x")||!S.hasOwnProperty("x"))){c(d);var _=f(d);if(!(t.linkPositionUpdate&&t.linkPositionUpdate(_?m.children[1]:m,{start:{x:g.x,y:g.y,z:g.z},end:{x:S.x,y:S.y,z:S.z}},d)&&!_)){var x=30,w=d.__curve,b=m.children.length?m.children[0]:m;if(b.type==="Line"){if(w){var P=w.getPoints(x);b.geometry.getAttribute("position").array.length!==P.length*3&&b.geometry[Tr]("position",new oe.BufferAttribute(new Float32Array(P.length*3),3)),b.geometry.setFromPoints(P)}else{var M=b.geometry.getAttribute("position");(!M||!M.array||M.array.length!==6)&&b.geometry[Tr]("position",M=new oe.BufferAttribute(new Float32Array(2*3),3)),M.array[0]=g.x,M.array[1]=g.y||0,M.array[2]=g.z||0,M.array[3]=S.x,M.array[4]=S.y||0,M.array[5]=S.z||0,M.needsUpdate=!0}b.geometry.computeBoundingSphere()}else if(b.type==="Mesh")if(w){b.geometry.type.match(/^Tube(Buffer)?Geometry$/)||(b.position.set(0,0,0),b.rotation.set(0,0,0),b.scale.set(1,1,1));var y=Math.ceil(l(d)*10)/10,k=y/2,C=new oe.TubeGeometry(w,x,k,t.linkResolution,!1);b.geometry.dispose(),b.geometry=C}else{if(!b.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)){var N=Math.ceil(l(d)*10)/10,j=N/2,F=new oe.CylinderGeometry(j,j,1,t.linkResolution,1,!1);F[Hn](new oe.Matrix4().makeTranslation(0,1/2,0)),F[Hn](new oe.Matrix4().makeRotationX(Math.PI/2)),b.geometry.dispose(),b.geometry=F}var I=new oe.Vector3(g.x,g.y||0,g.z||0),K=new oe.Vector3(S.x,S.y||0,S.z||0),O=I.distanceTo(K);b.position.x=I.x,b.position.y=I.y,b.position.z=I.z,b.scale.z=O,b.parent.localToWorld(K),b.lookAt(K)}}}}});function c(p){var h=n?p:t.layout.getLinkPosition(t.layout.graph.getLink(p.source,p.target).id),d=h[n?"source":"from"],m=h[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var v=s(p);if(!v)p.__curve=null;else{var g=new oe.Vector3(d.x,d.y||0,d.z||0),S=new oe.Vector3(m.x,m.y||0,m.z||0),_=g.distanceTo(S),x,w=u(p);if(_>0){var b=m.x-d.x,M=m.y-d.y||0,P=new oe.Vector3().subVectors(S,g),N=P.clone().multiplyScalar(v).cross(b!==0||M!==0?new oe.Vector3(0,0,1):new oe.Vector3(0,1,0)).applyAxisAngle(P.normalize(),w).add(new oe.Vector3().addVectors(g,S).divideScalar(2));x=new oe.QuadraticBezierCurve3(g,N,S)}else{var j=v*70,F=-w,I=F+Math.PI/2;x=new oe.CubicBezierCurve3(g,new oe.Vector3(j*Math.cos(I),j*Math.sin(I),0).add(g),new oe.Vector3(j*Math.cos(F),j*Math.sin(F),0).add(g),S)}p.__curve=x}}}}function o(){var a=de(t.linkDirectionalArrowRelPos),l=de(t.linkDirectionalArrowLength),s=de(t.nodeVal);t.arrowDataMapper.entries().forEach(function(u){var f=wn(u,2),c=f[0],p=f[1];if(p){var h=n?c:t.layout.getLinkPosition(t.layout.graph.getLink(c.source,c.target).id),d=h[n?"source":"from"],m=h[n?"target":"to"];if(!(!d||!m||!d.hasOwnProperty("x")||!m.hasOwnProperty("x"))){var v=Math.cbrt(Math.max(0,s(d)||1))*t.nodeRelSize,g=Math.cbrt(Math.max(0,s(m)||1))*t.nodeRelSize,S=l(c),_=a(c),x=c.__curve?function(j){return c.__curve.getPoint(j)}:function(j){var F=function(K,O,y,k){return O[K]+(y[K]-O[K])*k||0};return{x:F("x",d,m,j),y:F("y",d,m,j),z:F("z",d,m,j)}},w=c.__curve?c.__curve.getLength():Math.sqrt(["x","y","z"].map(function(j){return Math.pow((m[j]||0)-(d[j]||0),2)}).reduce(function(j,F){return j+F},0)),b=v+S+(w-v-g-S)*_,M=x(b/w),P=x((b-S)/w);["x","y","z"].forEach(function(j){return p.position[j]=P[j]});var N=Ka(oe.Vector3,ct(["x","y","z"].map(function(j){return M[j]})));p.parent.localToWorld(N),p.lookAt(N)}}})}function i(){var a=de(t.linkDirectionalParticleSpeed),l=de(t.linkDirectionalParticleOffset);t.graphData.links.forEach(function(s){var u=t.particlesDataMapper.getObj(s),f=u&&u.children,c=s.__singleHopPhotonsObj&&s.__singleHopPhotonsObj.children;if(!((!c||!c.length)&&(!f||!f.length))){var p=n?s:t.layout.getLinkPosition(t.layout.graph.getLink(s.source,s.target).id),h=p[n?"source":"from"],d=p[n?"target":"to"];if(!(!h||!d||!h.hasOwnProperty("x")||!d.hasOwnProperty("x"))){var m=a(s),v=Math.abs(l(s)),g=s.__curve?function(_){return s.__curve.getPoint(_)}:function(_){var x=function(b,M,P,N){return M[b]+(P[b]-M[b])*N||0};return{x:x("x",h,d,_),y:x("y",h,d,_),z:x("z",h,d,_)}},S=[].concat(ct(f||[]),ct(c||[]));S.forEach(function(_,x){var w=_.parent.__linkThreeObjType==="singleHopPhotons";if(_.hasOwnProperty("__progressRatio")||(_.__progressRatio=w?m<0?1:0:(x+v)/f.length),_.__progressRatio+=m,_.__progressRatio>=1||_.__progressRatio<0)if(!w)_.__progressRatio=_.__progressRatio%1,_.__progressRatio<0&&_.__progressRatio++;else{_.parent.remove(_),Hi(_);return}var b=_.__progressRatio,M=g(b);_.geometry.type!=="SphereGeometry"&&_.lookAt(M.x,M.y,M.z),["x","y","z"].forEach(function(P){return _.position[P]=M[P]})})}}})}},emitParticle:function(t,n){if(n&&t.graphData.links.includes(n)){if(!n.__singleHopPhotonsObj){var r=new oe.Group;r.__linkThreeObjType="singleHopPhotons",n.__singleHopPhotonsObj=r,t.graphScene.add(r)}var o=de(t.linkDirectionalParticleThreeObject)(n);if(o&&t.linkDirectionalParticleThreeObject===o&&(o=o.clone()),!o){var i=de(t.linkDirectionalParticleWidth),a=Math.ceil(i(n)*10)/10/2,l=t.linkDirectionalParticleResolution,s=new oe.SphereGeometry(a,l,l),u=de(t.linkColor),f=de(t.linkDirectionalParticleColor),c=f(n)||u(n)||"#f0f0f0",p=new oe.Color(gn(c)),h=t.linkOpacity*3,d=new oe.MeshLambertMaterial({color:p,transparent:!0,opacity:h});o=new oe.Mesh(s,d)}n.__singleHopPhotonsObj.add(o)}return this},getGraphBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0};if(!t.initialised)return null;var r=function o(i){var a=[];if(i.geometry){i.geometry.computeBoundingBox();var l=new oe.Box3;l.copy(i.geometry.boundingBox).applyMatrix4(i.matrixWorld),a.push(l)}return a.concat.apply(a,ct((i.children||[]).filter(function(s){return!s.hasOwnProperty("__graphObjType")||s.__graphObjType==="node"&&n(s.__data)}).map(o)))}(t.graphScene);return r.length?Object.assign.apply(Object,ct(["x","y","z"].map(function(o){return sr({},o,[mf(r,function(i){return i.min[o]}),yf(r,function(i){return i.max[o]})])}))):null}},stateInit:function(){return{d3ForceLayout:Uc().force("link",Oc()).force("charge",Gc()).force("center",jl()).force("dagRadial",null).stop(),engineRunning:!1}},init:function(t,n){n.graphScene=t,n.nodeDataMapper=new pn(t,{objBindAttr:"__threeObj"}),n.linkDataMapper=new pn(t,{objBindAttr:"__lineObj"}),n.arrowDataMapper=new pn(t,{objBindAttr:"__arrowObj"}),n.particlesDataMapper=new pn(t,{objBindAttr:"__photonsObj"})},update:function(t,n){var r=function(H){return H.some(function(T){return n.hasOwnProperty(T)})};if(t.engineRunning=!1,typeof t.onUpdate=="function"&&t.onUpdate(),t.nodeAutoColorBy!==null&&r(["nodeAutoColorBy","graphData","nodeColor"])&&qi(t.graphData.nodes,de(t.nodeAutoColorBy),t.nodeColor),t.linkAutoColorBy!==null&&r(["linkAutoColorBy","graphData","linkColor"])&&qi(t.graphData.links,de(t.linkAutoColorBy),t.linkColor),t._flushObjects||r(["graphData","nodeThreeObject","nodeThreeObjectExtend","nodeVal","nodeColor","nodeVisibility","nodeRelSize","nodeResolution","nodeOpacity"])){var o=de(t.nodeThreeObject),i=de(t.nodeThreeObjectExtend),a=de(t.nodeVal),l=de(t.nodeColor),s=de(t.nodeVisibility),u={},f={};(t._flushObjects||r(["nodeThreeObject","nodeThreeObjectExtend"]))&&t.nodeDataMapper.clear(),t.nodeDataMapper.onCreateObj(function(E){var H=o(E),T=i(E);H&&t.nodeThreeObject===H&&(H=H.clone());var W;return H&&!T?W=H:(W=new oe.Mesh,W.__graphDefaultObj=!0,H&&T&&W.add(H)),W.__graphObjType="node",W}).onUpdateObj(function(E,H){if(E.__graphDefaultObj){var T=a(H)||1,W=Math.cbrt(T)*t.nodeRelSize,V=t.nodeResolution;(!E.geometry.type.match(/^Sphere(Buffer)?Geometry$/)||E.geometry.parameters.radius!==W||E.geometry.parameters.widthSegments!==V)&&(u.hasOwnProperty(T)||(u[T]=new oe.SphereGeometry(W,V,V)),E.geometry.dispose(),E.geometry=u[T]);var G=l(H),U=new oe.Color(gn(G||"#ffffaa")),ee=t.nodeOpacity*zr(G);(E.material.type!=="MeshLambertMaterial"||!E.material.color.equals(U)||E.material.opacity!==ee)&&(f.hasOwnProperty(G)||(f[G]=new oe.MeshLambertMaterial({color:U,transparent:!0,opacity:ee})),E.material.dispose(),E.material=f[G])}}).digest(t.graphData.nodes.filter(s))}if(t._flushObjects||r(["graphData","linkThreeObject","linkThreeObjectExtend","linkMaterial","linkColor","linkWidth","linkVisibility","linkResolution","linkOpacity","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject"])){var c=de(t.linkThreeObject),p=de(t.linkThreeObjectExtend),h=de(t.linkMaterial),d=de(t.linkVisibility),m=de(t.linkColor),v=de(t.linkWidth),g={},S={},_={},x=t.graphData.links.filter(d);if((t._flushObjects||r(["linkThreeObject","linkThreeObjectExtend","linkWidth"]))&&t.linkDataMapper.clear(),t.linkDataMapper.onRemoveObj(function(E){var H=E.__data&&E.__data.__singleHopPhotonsObj;H&&(H.parent.remove(H),Hi(H),delete E.__data.__singleHopPhotonsObj)}).onCreateObj(function(E){var H=c(E),T=p(E);H&&t.linkThreeObject===H&&(H=H.clone());var W;if(!H||T){var V=!!v(E);if(V)W=new oe.Mesh;else{var G=new oe.BufferGeometry;G[Tr]("position",new oe.BufferAttribute(new Float32Array(2*3),3)),W=new oe.Line(G)}}var U;return H?T?(U=new oe.Group,U.__graphDefaultObj=!0,U.add(W),U.add(H)):U=H:(U=W,U.__graphDefaultObj=!0),U.renderOrder=10,U.__graphObjType="link",U}).onUpdateObj(function(E,H){if(E.__graphDefaultObj){var T=E.children.length?E.children[0]:E,W=Math.ceil(v(H)*10)/10,V=!!W;if(V){var G=W/2,U=t.linkResolution;if(!T.geometry.type.match(/^Cylinder(Buffer)?Geometry$/)||T.geometry.parameters.radiusTop!==G||T.geometry.parameters.radialSegments!==U){if(!g.hasOwnProperty(W)){var ee=new oe.CylinderGeometry(G,G,1,U,1,!1);ee[Hn](new oe.Matrix4().makeTranslation(0,1/2,0)),ee[Hn](new oe.Matrix4().makeRotationX(Math.PI/2)),g[W]=ee}T.geometry.dispose(),T.geometry=g[W]}}var ne=h(H);if(ne)T.material=ne;else{var ie=m(H),le=new oe.Color(gn(ie||"#f0f0f0")),ae=t.linkOpacity*zr(ie),ce=V?"MeshLambertMaterial":"LineBasicMaterial";if(T.material.type!==ce||!T.material.color.equals(le)||T.material.opacity!==ae){var be=V?S:_;be.hasOwnProperty(ie)||(be[ie]=new oe[ce]({color:le,transparent:ae<1,opacity:ae,depthWrite:ae>=1})),T.material.dispose(),T.material=be[ie]}}}}).digest(x),t.linkDirectionalArrowLength||n.hasOwnProperty("linkDirectionalArrowLength")){var w=de(t.linkDirectionalArrowLength),b=de(t.linkDirectionalArrowColor);t.arrowDataMapper.onCreateObj(function(){var E=new oe.Mesh(void 0,new oe.MeshLambertMaterial({transparent:!0}));return E.__linkThreeObjType="arrow",E}).onUpdateObj(function(E,H){var T=w(H),W=t.linkDirectionalArrowResolution;if(!E.geometry.type.match(/^Cone(Buffer)?Geometry$/)||E.geometry.parameters.height!==T||E.geometry.parameters.radialSegments!==W){var V=new oe.ConeGeometry(T*.25,T,W);V.translate(0,T/2,0),V.rotateX(Math.PI/2),E.geometry.dispose(),E.geometry=V}var G=b(H)||m(H)||"#f0f0f0";E.material.color=new oe.Color(gn(G)),E.material.opacity=t.linkOpacity*3*zr(G)}).digest(x.filter(w))}if(t.linkDirectionalParticles||n.hasOwnProperty("linkDirectionalParticles")){var M=de(t.linkDirectionalParticles),P=de(t.linkDirectionalParticleWidth),N=de(t.linkDirectionalParticleColor),j=de(t.linkDirectionalParticleThreeObject),F={},I={};t.particlesDataMapper.onCreateObj(function(){var E=new oe.Group;return E.__linkThreeObjType="photons",E.__photonDataMapper=new pn(E),E}).onUpdateObj(function(E,H){var T=!!E.children.length&&E.children[0],W=j(H),V,G;if(W)V=W.geometry,G=W.material;else{var U=Math.ceil(P(H)*10)/10/2,ee=t.linkDirectionalParticleResolution;T&&T.geometry.parameters.radius===U&&T.geometry.parameters.widthSegments===ee?V=T.geometry:(I.hasOwnProperty(U)||(I[U]=new oe.SphereGeometry(U,ee,ee)),V=I[U]);var ne=N(H)||m(H)||"#f0f0f0",ie=new oe.Color(gn(ne)),le=t.linkOpacity*3;T&&T.material.color.equals(ie)&&T.material.opacity===le?G=T.material:(F.hasOwnProperty(ne)||(F[ne]=new oe.MeshLambertMaterial({color:ie,transparent:!0,opacity:le})),G=F[ne])}T&&(T.geometry!==V&&T.geometry.dispose(),T.material!==G&&T.material.dispose());var ae=Math.round(Math.abs(M(H)));E.__photonDataMapper.id(function(ce){return ce.idx}).onCreateObj(function(){return new oe.Mesh(V,G)}).onUpdateObj(function(ce){ce.geometry=V,ce.material=G}).digest(ct(new Array(ae)).map(function(ce,be){return{idx:be}}))}).digest(x.filter(M))}}if(t._flushObjects=!1,r(["graphData","nodeId","linkSource","linkTarget","numDimensions","forceEngine","dagMode","dagNodeFilter","dagLevelDistance"])){t.engineRunning=!1,t.graphData.links.forEach(function(E){E.source=E[t.linkSource],E.target=E[t.linkTarget]});var K=t.forceEngine!=="ngraph",O;if(K){(O=t.d3ForceLayout).stop().alpha(1).numDimensions(t.numDimensions).nodes(t.graphData.nodes);var y=t.d3ForceLayout.force("link");y&&y.id(function(E){return E[t.nodeId]}).links(t.graphData.links);var k=t.dagMode&&xd(t.graphData,function(E){return E[t.nodeId]},{nodeFilter:t.dagNodeFilter,onLoopError:t.onDagError||void 0}),C=Math.max.apply(Math,ct(Object.values(k||[]))),$=t.dagLevelDistance||t.graphData.nodes.length/(C||1)*wd*(["radialin","radialout"].indexOf(t.dagMode)!==-1?.7:1);if(["lr","rl","td","bu","zin","zout"].includes(n.dagMode)){var B=["lr","rl"].includes(n.dagMode)?"fx":["td","bu"].includes(n.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(E){return delete E[B]})}if(["lr","rl","td","bu","zin","zout"].includes(t.dagMode)){var X=["rl","td","zout"].includes(t.dagMode),L=function(H){return(k[H[t.nodeId]]-C/2)*$*(X?-1:1)},D=["lr","rl"].includes(t.dagMode)?"fx":["td","bu"].includes(t.dagMode)?"fy":"fz";t.graphData.nodes.filter(t.dagNodeFilter).forEach(function(E){return E[D]=L(E)})}t.d3ForceLayout.force("dagRadial",["radialin","radialout"].indexOf(t.dagMode)!==-1?Vc(function(E){var H=k[E[t.nodeId]]||-1;return(t.dagMode==="radialin"?C-H:H)*$}).strength(function(E){return t.dagNodeFilter(E)?1:0}):null)}else{var q=Ui.graph();t.graphData.nodes.forEach(function(E){q.addNode(E[t.nodeId])}),t.graphData.links.forEach(function(E){q.addLink(E.source,E.target)}),O=Ui.forcelayout(q,vd({dimensions:t.numDimensions},t.ngraphPhysics)),O.graph=q}for(var Y=0;Y<t.warmupTicks&&!(K&&t.d3AlphaMin>0&&t.d3ForceLayout.alpha()<t.d3AlphaMin);Y++)O[K?"tick":"step"]();t.layout=O,this.resetCountdown()}t.engineRunning=!0,t.onFinishUpdate()}});function Cd(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Object,n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,r=function(o){function i(){var a;Xa(this,i);for(var l=arguments.length,s=new Array(l),u=0;u<l;u++)s[u]=arguments[u];return a=Ya(this,i,[].concat(s)),a.__kapsuleInstance=Ka(e,[].concat(ct(n?[a]:[]),s)),a}return Qa(i,o),Za(i)}(t);return Object.keys(e()).forEach(function(o){return r.prototype[o]=function(){var i,a=(i=this.__kapsuleInstance)[o].apply(i,arguments);return a===this.__kapsuleInstance?this:a}}),r}var Sd=window.THREE?window.THREE:{Group:re.Group},ns=Cd(kd,Sd.Group,!0);function Ge(){return Ge=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Ge.apply(null,arguments)}function Md(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Mn(e,t){return Mn=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Mn(e,t)}function Pd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Mn(e,t)}function Yr(e){return Yr=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},Yr(e)}function Ad(e){try{return Function.toString.call(e).indexOf("[native code]")!==-1}catch{return typeof e=="function"}}function rs(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(rs=function(){return!!e})()}function Od(e,t,n){if(rs())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var o=new(e.bind.apply(e,r));return n&&Mn(o,n.prototype),o}function Xr(e){var t=typeof Map=="function"?new Map:void 0;return Xr=function(r){if(r===null||!Ad(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(t!==void 0){if(t.has(r))return t.get(r);t.set(r,o)}function o(){return Od(r,arguments,Yr(this).constructor)}return o.prototype=Object.create(r.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Mn(o,r)},Xr(e)}var jd={1:`Passed invalid arguments to hsl, please pass multiple numbers e.g. hsl(360, 0.75, 0.4) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75 }).
508
508
 
509
509
  `,2:`Passed invalid arguments to hsla, please pass multiple numbers e.g. hsla(360, 0.75, 0.4, 0.7) or an object e.g. rgb({ hue: 255, saturation: 0.4, lightness: 0.75, alpha: 0.7 }).
510
510
 
@@ -652,8 +652,8 @@ To pass a single animation please supply them in simple values, e.g. animation('
652
652
  `,77:`remToPx expects a value in "rem" but you provided it in "%s".
653
653
 
654
654
  `,78:`base must be set in "px" or "%" but you set it in "%s".
655
- `};function wd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],o=[],i;for(i=1;i<t.length;i+=1)o.push(t[i]);return o.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var Je=function(e){md(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];r=e.call(this,wd.apply(void 0,[xd[n]].concat(i)))||this}return yd(r)}return t}($r(Error));function Pr(e){return Math.round(e*255)}function kd(e,t,n){return Pr(e)+","+Pr(t)+","+Pr(n)}function Fn(e,t,n,r){if(r===void 0&&(r=kd),t===0)return r(n,n,n);var o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(o%2-1)),s=0,l=0,c=0;o>=0&&o<1?(s=i,l=a):o>=1&&o<2?(s=a,l=i):o>=2&&o<3?(l=i,c=a):o>=3&&o<4?(l=a,c=i):o>=4&&o<5?(s=a,c=i):o>=5&&o<6&&(s=i,c=a);var f=n-i/2,u=s+f,v=l+f,h=c+f;return r(u,v,h)}var Ni={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function Cd(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Ni[t]?"#"+Ni[t]:e}var Sd=/^#[a-fA-F0-9]{6}$/,Md=/^#[a-fA-F0-9]{8}$/,Pd=/^#[a-fA-F0-9]{3}$/,Od=/^#[a-fA-F0-9]{4}$/,Or=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,Ad=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,jd=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Td=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function Ht(e){if(typeof e!="string")throw new Je(3);var t=Cd(e);if(t.match(Sd))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(Md)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(Pd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(Od)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=Or.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=Ad.exec(t.substring(0,50));if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])>1?parseFloat(""+i[4])/100:parseFloat(""+i[4])};var a=jd.exec(t);if(a){var s=parseInt(""+a[1],10),l=parseInt(""+a[2],10)/100,c=parseInt(""+a[3],10)/100,f="rgb("+Fn(s,l,c)+")",u=Or.exec(f);if(!u)throw new Je(4,t,f);return{red:parseInt(""+u[1],10),green:parseInt(""+u[2],10),blue:parseInt(""+u[3],10)}}var v=Td.exec(t.substring(0,50));if(v){var h=parseInt(""+v[1],10),p=parseInt(""+v[2],10)/100,g=parseInt(""+v[3],10)/100,y="rgb("+Fn(h,p,g)+")",d=Or.exec(y);if(!d)throw new Je(4,t,y);return{red:parseInt(""+d[1],10),green:parseInt(""+d[2],10),blue:parseInt(""+d[3],10),alpha:parseFloat(""+v[4])>1?parseFloat(""+v[4])/100:parseFloat(""+v[4])}}throw new Je(5)}function Ed(e){var t=e.red/255,n=e.green/255,r=e.blue/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=(o+i)/2;if(o===i)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var s,l=o-i,c=a>.5?l/(2-o-i):l/(o+i);switch(o){case t:s=(n-r)/l+(n<r?6:0);break;case n:s=(r-t)/l+2;break;default:s=(t-n)/l+4;break}return s*=60,e.alpha!==void 0?{hue:s,saturation:c,lightness:a,alpha:e.alpha}:{hue:s,saturation:c,lightness:a}}function pt(e){return Ed(Ht(e))}var Ld=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Hr=Ld;function Ct(e){var t=e.toString(16);return t.length===1?"0"+t:t}function Ar(e){return Ct(Math.round(e*255))}function Rd(e,t,n){return Hr("#"+Ar(e)+Ar(t)+Ar(n))}function Wa(e,t,n){return Fn(e,t,n,Rd)}function Nd(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return Wa(e.hue,e.saturation,e.lightness);throw new Je(1)}function Dd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Wa(e.hue,e.saturation,e.lightness):"rgba("+Fn(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new Je(2)}function Xa(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Hr("#"+Ct(e)+Ct(t)+Ct(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Hr("#"+Ct(e.red)+Ct(e.green)+Ct(e.blue));throw new Je(6)}function Kn(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?Xa(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new Je(7)}var zd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Id=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Fd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Bd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function gt(e){if(typeof e!="object")throw new Je(8);if(Id(e))return Kn(e);if(zd(e))return Xa(e);if(Bd(e))return Dd(e);if(Fd(e))return Nd(e);throw new Je(8)}function Ya(e,t,n){return function(){var o=n.concat(Array.prototype.slice.call(arguments));return o.length>=t?e.apply(this,o):Ya(e,t,o)}}function Fe(e){return Ya(e,e.length,[])}function $d(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{hue:n.hue+parseFloat(e)}))}Fe($d);function Vt(e,t,n){return Math.max(e,Math.min(t,n))}function Hd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{lightness:Vt(0,1,n.lightness-parseFloat(e))}))}Fe(Hd);function Ud(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{saturation:Vt(0,1,n.saturation-parseFloat(e))}))}Fe(Ud);function qd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{lightness:Vt(0,1,n.lightness+parseFloat(e))}))}Fe(qd);function Gd(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=Ht(t),o=Ne({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),i=Ht(n),a=Ne({},i,{alpha:typeof i.alpha=="number"?i.alpha:1}),s=o.alpha-a.alpha,l=parseFloat(e)*2-1,c=l*s===-1?l:l+s,f=1+l*s,u=(c/f+1)/2,v=1-u,h={red:Math.floor(o.red*u+a.red*v),green:Math.floor(o.green*u+a.green*v),blue:Math.floor(o.blue*u+a.blue*v),alpha:o.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return Kn(h)}var Vd=Fe(Gd),Ka=Vd;function Wd(e,t){if(t==="transparent")return t;var n=Ht(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ne({},n,{alpha:Vt(0,1,(r*100+parseFloat(e)*100)/100)});return Kn(o)}var Xd=Fe(Wd),Yd=Xd;function Kd(e,t){if(t==="transparent")return t;var n=pt(t);return gt(Ne({},n,{saturation:Vt(0,1,n.saturation+parseFloat(e))}))}Fe(Kd);function Qd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{hue:parseFloat(e)}))}Fe(Qd);function Zd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{lightness:parseFloat(e)}))}Fe(Zd);function Jd(e,t){return t==="transparent"?t:gt(Ne({},pt(t),{saturation:parseFloat(e)}))}Fe(Jd);function eh(e,t){return t==="transparent"?t:Ka(parseFloat(e),"rgb(0, 0, 0)",t)}Fe(eh);function th(e,t){return t==="transparent"?t:Ka(parseFloat(e),"rgb(255, 255, 255)",t)}Fe(th);function nh(e,t){if(t==="transparent")return t;var n=Ht(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ne({},n,{alpha:Vt(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return Kn(o)}Fe(nh);var St=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-St.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?St.Bounce.In(e*2)*.5:St.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),un=function(){return performance.now()},Qa=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];i._group=void 0,delete this._tweens[i.getId()],delete this._tweensAddedDuringUpdate[i.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=un()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<r.length;o++){var i=this._tweens[r[o]],a=!n;i&&i.update(t,a)===!1&&!n&&this.remove(i)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Ur={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=Ur.Utils.Linear;return t<0?i(e[0],e[1],r):t>1?i(e[n],e[n-1],n-r):i(e[o],e[o+1>n?n:o+1],r-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},Za=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),qr=new Qa,Di=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=St.Linear.None,this._interpolationFunction=Ur.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Za.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=qr,qr.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=un()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var i in this._valuesEnd)o[i]=this._valuesEnd[i];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,o,i){for(var a in r){var s=t[a],l=Array.isArray(s),c=l?"array":typeof s,f=!l&&Array.isArray(r[a]);if(!(c==="undefined"||c==="function")){if(f){var u=r[a];if(u.length===0)continue;for(var v=[s],h=0,p=u.length;h<p;h+=1){var g=this._handleRelativeValue(s,u[h]);if(isNaN(g)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}v.push(g)}f&&(r[a]=v)}if((c==="object"||l)&&s&&!f){n[a]=l?[]:{};var y=s;for(var d in y)n[a][d]=y[d];o[a]=l?[]:{};var u=r[a];if(!this._isDynamic){var m={};for(var d in u)m[d]=u[d];r[a]=u=m}this._setupProperties(y,n[a],u,o[a],i)}else(typeof n[a]>"u"||i)&&(n[a]=s),l||(n[a]*=1),f?o[a]=r[a].slice().reverse():o[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=un()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=un()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=St.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Ur.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,o;if(t===void 0&&(t=un()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,s=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),l=this._duration+this._repeat*s,c=function(){if(r._duration===0||a>l)return 1;var g=Math.trunc(a/s),y=a-g*s,d=Math.min(y/r._duration,1);return d===0&&a===r._duration?1:d},f=c(),u=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,u),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var v=Math.min(Math.trunc((a-this._duration)/s)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=v);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=s*v,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,p=this._chainedTweens.length;h<p;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,o){for(var i in r)if(n[i]!==void 0){var a=n[i]||0,s=r[i],l=Array.isArray(t[i]),c=Array.isArray(s),f=!l&&c;f?t[i]=this._interpolationFunction(s,o):typeof s=="object"&&s?this._updateProperties(t[i],a,s,o):(s=this._handleRelativeValue(a,s),typeof s=="number"&&(t[i]=a+(s-a)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();Za.nextId;var tt=qr;tt.getAll.bind(tt);tt.removeAll.bind(tt);tt.add.bind(tt);tt.remove.bind(tt);tt.update.bind(tt);var Gr="http://www.w3.org/1999/xhtml";const zi={svg:"http://www.w3.org/2000/svg",xhtml:Gr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ja(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),zi.hasOwnProperty(t)?{space:zi[t],local:e}:e}function rh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Gr&&t.documentElement.namespaceURI===Gr?t.createElement(e):t.createElementNS(n,e)}}function oh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function es(e){var t=Ja(e);return(t.local?oh:rh)(t)}function ih(){}function ts(e){return e==null?ih:function(){return this.querySelector(e)}}function ah(e){typeof e!="function"&&(e=ts(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,s=r[o]=new Array(a),l,c,f=0;f<a;++f)(l=i[f])&&(c=e.call(l,l.__data__,f,i))&&("__data__"in l&&(c.__data__=l.__data__),s[f]=c);return new qe(r,this._parents)}function sh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function lh(){return[]}function ch(e){return e==null?lh:function(){return this.querySelectorAll(e)}}function uh(e){return function(){return sh(e.apply(this,arguments))}}function fh(e){typeof e=="function"?e=uh(e):e=ch(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],s=a.length,l,c=0;c<s;++c)(l=a[c])&&(r.push(e.call(l,l.__data__,c,a)),o.push(l));return new qe(r,o)}function dh(e){return function(){return this.matches(e)}}function ns(e){return function(t){return t.matches(e)}}var hh=Array.prototype.find;function ph(e){return function(){return hh.call(this.children,e)}}function gh(){return this.firstElementChild}function vh(e){return this.select(e==null?gh:ph(typeof e=="function"?e:ns(e)))}var yh=Array.prototype.filter;function mh(){return Array.from(this.children)}function bh(e){return function(){return yh.call(this.children,e)}}function _h(e){return this.selectAll(e==null?mh:bh(typeof e=="function"?e:ns(e)))}function xh(e){typeof e!="function"&&(e=dh(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,s=r[o]=[],l,c=0;c<a;++c)(l=i[c])&&e.call(l,l.__data__,c,i)&&s.push(l);return new qe(r,this._parents)}function rs(e){return new Array(e.length)}function wh(){return new qe(this._enter||this._groups.map(rs),this._parents)}function Bn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Bn.prototype={constructor:Bn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function kh(e){return function(){return e}}function Ch(e,t,n,r,o,i){for(var a=0,s,l=t.length,c=i.length;a<c;++a)(s=t[a])?(s.__data__=i[a],r[a]=s):n[a]=new Bn(e,i[a]);for(;a<l;++a)(s=t[a])&&(o[a]=s)}function Sh(e,t,n,r,o,i,a){var s,l,c=new Map,f=t.length,u=i.length,v=new Array(f),h;for(s=0;s<f;++s)(l=t[s])&&(v[s]=h=a.call(l,l.__data__,s,t)+"",c.has(h)?o[s]=l:c.set(h,l));for(s=0;s<u;++s)h=a.call(e,i[s],s,i)+"",(l=c.get(h))?(r[s]=l,l.__data__=i[s],c.delete(h)):n[s]=new Bn(e,i[s]);for(s=0;s<f;++s)(l=t[s])&&c.get(v[s])===l&&(o[s]=l)}function Mh(e){return e.__data__}function Ph(e,t){if(!arguments.length)return Array.from(this,Mh);var n=t?Sh:Ch,r=this._parents,o=this._groups;typeof e!="function"&&(e=kh(e));for(var i=o.length,a=new Array(i),s=new Array(i),l=new Array(i),c=0;c<i;++c){var f=r[c],u=o[c],v=u.length,h=Oh(e.call(f,f&&f.__data__,c,r)),p=h.length,g=s[c]=new Array(p),y=a[c]=new Array(p),d=l[c]=new Array(v);n(f,u,g,y,d,h,t);for(var m=0,b=0,x,w;m<p;++m)if(x=g[m]){for(m>=b&&(b=m+1);!(w=y[b])&&++b<p;);x._next=w||null}}return a=new qe(a,r),a._enter=s,a._exit=l,a}function Oh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ah(){return new qe(this._exit||this._groups.map(rs),this._parents)}function jh(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Th(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),s=new Array(o),l=0;l<a;++l)for(var c=n[l],f=r[l],u=c.length,v=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p]||f[p])&&(v[p]=h);for(;l<o;++l)s[l]=n[l];return new qe(s,this._parents)}function Eh(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],a;--o>=0;)(a=r[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Lh(e){e||(e=Rh);function t(u,v){return u&&v?e(u.__data__,v.__data__):!u-!v}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],s=a.length,l=o[i]=new Array(s),c,f=0;f<s;++f)(c=a[f])&&(l[f]=c);l.sort(t)}return new qe(o,this._parents).order()}function Rh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Nh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Dh(){return Array.from(this)}function zh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function Ih(){let e=0;for(const t of this)++e;return e}function Fh(){return!this.node()}function Bh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,s;i<a;++i)(s=o[i])&&e.call(s,s.__data__,i,o);return this}function $h(e){return function(){this.removeAttribute(e)}}function Hh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Uh(e,t){return function(){this.setAttribute(e,t)}}function qh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Gh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function Vh(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function Wh(e,t){var n=Ja(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Hh:$h:typeof t=="function"?n.local?Vh:Gh:n.local?qh:Uh)(n,t))}function os(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function Xh(e){return function(){this.style.removeProperty(e)}}function Yh(e,t,n){return function(){this.style.setProperty(e,t,n)}}function Kh(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function Qh(e,t,n){return arguments.length>1?this.each((t==null?Xh:typeof t=="function"?Kh:Yh)(e,t,n??"")):Zh(this.node(),e)}function Zh(e,t){return e.style.getPropertyValue(t)||os(e).getComputedStyle(e,null).getPropertyValue(t)}function Jh(e){return function(){delete this[e]}}function ep(e,t){return function(){this[e]=t}}function tp(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function np(e,t){return arguments.length>1?this.each((t==null?Jh:typeof t=="function"?tp:ep)(e,t)):this.node()[e]}function is(e){return e.trim().split(/^|\s+/)}function go(e){return e.classList||new as(e)}function as(e){this._node=e,this._names=is(e.getAttribute("class")||"")}as.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ss(e,t){for(var n=go(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function ls(e,t){for(var n=go(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function rp(e){return function(){ss(this,e)}}function op(e){return function(){ls(this,e)}}function ip(e,t){return function(){(t.apply(this,arguments)?ss:ls)(this,e)}}function ap(e,t){var n=is(e+"");if(arguments.length<2){for(var r=go(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?ip:t?rp:op)(n,t))}function sp(){this.textContent=""}function lp(e){return function(){this.textContent=e}}function cp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function up(e){return arguments.length?this.each(e==null?sp:(typeof e=="function"?cp:lp)(e)):this.node().textContent}function fp(){this.innerHTML=""}function dp(e){return function(){this.innerHTML=e}}function hp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function pp(e){return arguments.length?this.each(e==null?fp:(typeof e=="function"?hp:dp)(e)):this.node().innerHTML}function gp(){this.nextSibling&&this.parentNode.appendChild(this)}function vp(){return this.each(gp)}function yp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function mp(){return this.each(yp)}function bp(e){var t=typeof e=="function"?e:es(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function _p(){return null}function xp(e,t){var n=typeof e=="function"?e:es(e),r=t==null?_p:typeof t=="function"?t:ts(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function wp(){var e=this.parentNode;e&&e.removeChild(this)}function kp(){return this.each(wp)}function Cp(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Sp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Mp(e){return this.select(e?Sp:Cp)}function Pp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Op(e){return function(t){e.call(this,t,this.__data__)}}function Ap(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function jp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Tp(e,t,n){return function(){var r=this.__on,o,i=Op(t);if(r){for(var a=0,s=r.length;a<s;++a)if((o=r[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function Ep(e,t,n){var r=Ap(e+""),o,i=r.length,a;if(arguments.length<2){var s=this.node().__on;if(s){for(var l=0,c=s.length,f;l<c;++l)for(o=0,f=s[l];o<i;++o)if((a=r[o]).type===f.type&&a.name===f.name)return f.value}return}for(s=t?Tp:jp,o=0;o<i;++o)this.each(s(r[o],t,n));return this}function cs(e,t,n){var r=os(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Lp(e,t){return function(){return cs(this,e,t)}}function Rp(e,t){return function(){return cs(this,e,t.apply(this,arguments))}}function Np(e,t){return this.each((typeof t=="function"?Rp:Lp)(e,t))}function*Dp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,a;o<i;++o)(a=r[o])&&(yield a)}var zp=[null];function qe(e,t){this._groups=e,this._parents=t}function Ip(){return this}qe.prototype={constructor:qe,select:ah,selectAll:fh,selectChild:vh,selectChildren:_h,filter:xh,data:Ph,enter:wh,exit:Ah,join:jh,merge:Th,selection:Ip,order:Eh,sort:Lh,call:Nh,nodes:Dh,node:zh,size:Ih,empty:Fh,each:Bh,attr:Wh,style:Qh,property:np,classed:ap,text:up,html:pp,raise:vp,lower:mp,append:bp,insert:xp,remove:kp,clone:Mp,datum:Pp,on:Ep,dispatch:Np,[Symbol.iterator]:Dp};function Fp(e){return typeof e=="string"?new qe([[document.querySelector(e)]],[document.documentElement]):new qe([[e]],zp)}function Bp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function $p(e,t){if(e=Bp(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}var yn,ve,us,fs,dt,Ii,ds,hs,jr,Ln,dn,ps,vo,Vr,Wr,$n={},Hn=[],Hp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Qn=Array.isArray;function et(e,t){for(var n in t)e[n]=t[n];return e}function yo(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Up(e,t,n){var r,o,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?yn.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return hn(e,a,r,o,null)}function hn(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++us,__i:-1,__u:0};return o==null&&ve.vnode!=null&&ve.vnode(i),i}function Zn(e){return e.children}function Rn(e,t){this.props=e,this.context=t}function Ut(e,t){if(t==null)return e.__?Ut(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?Ut(e):null}function qp(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=et({},t);i.__v=t.__v+1,ve.vnode&&ve.vnode(i),mo(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??Ut(t),!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,ms(r,i,o),t.__e=t.__=null,i.__e!=n&&gs(i)}}function gs(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),gs(e)}function Fi(e){(!e.__d&&(e.__d=!0)&&dt.push(e)&&!Un.__r++||Ii!=ve.debounceRendering)&&((Ii=ve.debounceRendering)||ds)(Un)}function Un(){try{for(var e,t=1;dt.length;)dt.length>t&&dt.sort(hs),e=dt.shift(),t=dt.length,qp(e)}finally{dt.length=Un.__r=0}}function vs(e,t,n,r,o,i,a,s,l,c,f){var u,v,h,p,g,y,d,m=r&&r.__k||Hn,b=t.length;for(l=Gp(n,t,m,l,b),u=0;u<b;u++)(h=n.__k[u])!=null&&(v=h.__i!=-1&&m[h.__i]||$n,h.__i=u,y=mo(e,h,v,o,i,a,s,l,c,f),p=h.__e,h.ref&&v.ref!=h.ref&&(v.ref&&bo(v.ref,null,h),f.push(h.ref,h.__c||p,h)),g==null&&p!=null&&(g=p),(d=!!(4&h.__u))||v.__k===h.__k?(l=ys(h,l,e,d),d&&v.__e&&(v.__e=null)):typeof h.type=="function"&&y!==void 0?l=y:p&&(l=p.nextSibling),h.__u&=-7);return n.__e=g,l}function Gp(e,t,n,r,o){var i,a,s,l,c,f=n.length,u=f,v=0;for(e.__k=new Array(o),i=0;i<o;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=hn(null,a,null,null,null):Qn(a)?a=e.__k[i]=hn(Zn,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=hn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,l=i+v,a.__=e,a.__b=e.__b+1,s=null,(c=a.__i=Vp(a,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(o>f?v--:o<f&&v++),typeof a.type!="function"&&(a.__u|=4)):c!=l&&(c==l-1?v--:c==l+1?v++:(c>l?v--:v++,a.__u|=4))):e.__k[i]=null;if(u)for(i=0;i<f;i++)(s=n[i])!=null&&!(2&s.__u)&&(s.__e==r&&(r=Ut(s)),_s(s,s));return r}function ys(e,t,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=ys(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=Ut(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Vp(e,t,n,r){var o,i,a,s=e.key,l=e.type,c=t[n],f=c!=null&&(2&c.__u)==0;if(c===null&&s==null||f&&s==c.key&&l==c.type)return n;if(r>(f?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((c=t[a=o>=0?o--:i++])!=null&&!(2&c.__u)&&s==c.key&&l==c.type)return a}return-1}function Bi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Hp.test(t)?n:n+"px"}function Tn(e,t,n,r,o){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Bi(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Bi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(ps,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[dn]=r[dn]:(n[dn]=vo,e.addEventListener(t,i?Wr:Vr,i)):e.removeEventListener(t,i?Wr:Vr,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function $i(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Ln]==null)t[Ln]=vo++;else if(t[Ln]<n[dn])return;return n(ve.event?ve.event(t):t)}}}function mo(e,t,n,r,o,i,a,s,l,c){var f,u,v,h,p,g,y,d,m,b,x,w,_,k,S,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),i=[s=t.__e=n.__e]),(f=ve.__b)&&f(t);e:if(typeof A=="function")try{if(d=t.props,m=A.prototype&&A.prototype.render,b=(f=A.contextType)&&r[f.__c],x=f?b?b.props.value:f.__:r,n.__c?y=(u=t.__c=n.__c).__=u.__E:(m?t.__c=u=new A(d,x):(t.__c=u=new Rn(d,x),u.constructor=A,u.render=Xp),b&&b.sub(u),u.state||(u.state={}),u.__n=r,v=u.__d=!0,u.__h=[],u._sb=[]),m&&u.__s==null&&(u.__s=u.state),m&&A.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=et({},u.__s)),et(u.__s,A.getDerivedStateFromProps(d,u.__s))),h=u.props,p=u.state,u.__v=t,v)m&&A.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),m&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(m&&A.getDerivedStateFromProps==null&&d!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(d,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(d,u.__s,x)===!1){t.__v!=n.__v&&(u.props=d,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(O){O&&(O.__=t)}),Hn.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&a.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(d,u.__s,x),m&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,p,g)})}if(u.context=x,u.props=d,u.__P=e,u.__e=!1,w=ve.__r,_=0,m)u.state=u.__s,u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),Hn.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,w&&w(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++_<25);u.state=u.__s,u.getChildContext!=null&&(r=et(et({},r),u.getChildContext())),m&&!v&&u.getSnapshotBeforeUpdate!=null&&(g=u.getSnapshotBeforeUpdate(h,p)),k=f!=null&&f.type===Zn&&f.key==null?bs(f.props.children):f,s=vs(e,Qn(k)?k:[k],t,n,r,o,i,a,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&a.push(u),y&&(u.__E=u.__=null)}catch(O){if(t.__v=null,l||i!=null)if(O.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;i[i.indexOf(s)]=null,t.__e=s}else{for(S=i.length;S--;)yo(i[S]);Xr(t)}else t.__e=n.__e,t.__k=n.__k,O.then||Xr(t);ve.__e(O,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Wp(n.__e,t,n,r,o,i,a,l,c);return(f=ve.diffed)&&f(t),128&t.__u?void 0:s}function Xr(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Xr))}function ms(e,t,n){for(var r=0;r<n.length;r++)bo(n[r],n[++r],n[++r]);ve.__c&&ve.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){ve.__e(i,o.__v)}})}function bs(e){return typeof e!="object"||e==null||e.__b>0?e:Qn(e)?e.map(bs):et({},e)}function Wp(e,t,n,r,o,i,a,s,l){var c,f,u,v,h,p,g,y=n.props||$n,d=t.props,m=t.type;if(m=="svg"?o="http://www.w3.org/2000/svg":m=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(c=0;c<i.length;c++)if((h=i[c])&&"setAttribute"in h==!!m&&(m?h.localName==m:h.nodeType==3)){e=h,i[c]=null;break}}if(e==null){if(m==null)return document.createTextNode(d);e=document.createElementNS(o,m,d.is&&d),s&&(ve.__m&&ve.__m(t,i),s=!1),i=null}if(m==null)y===d||s&&e.data==d||(e.data=d);else{if(i=i&&yn.call(e.childNodes),!s&&i!=null)for(y={},c=0;c<e.attributes.length;c++)y[(h=e.attributes[c]).name]=h.value;for(c in y)h=y[c],c=="dangerouslySetInnerHTML"?u=h:c=="children"||c in d||c=="value"&&"defaultValue"in d||c=="checked"&&"defaultChecked"in d||Tn(e,c,null,h,o);for(c in d)h=d[c],c=="children"?v=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?p=h:c=="checked"?g=h:s&&typeof h!="function"||y[c]===h||Tn(e,c,h,y[c],o);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),vs(t.type=="template"?e.content:e,Qn(v)?v:[v],t,n,r,m=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&Ut(n,0),s,l),i!=null)for(c=i.length;c--;)yo(i[c]);s||(c="value",m=="progress"&&p==null?e.removeAttribute("value"):p!=null&&(p!==e[c]||m=="progress"&&!p||m=="option"&&p!=y[c])&&Tn(e,c,p,y[c],o),c="checked",g!=null&&g!=e[c]&&Tn(e,c,g,y[c],o))}return e}function bo(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){ve.__e(o,n)}}function _s(e,t,n){var r,o;if(ve.unmount&&ve.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||bo(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){ve.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&_s(r[o],t,n||typeof e.type!="function");n||yo(e.__e),e.__c=e.__=e.__e=void 0}function Xp(e,t,n){return this.constructor(e,n)}function Yp(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),ve.__&&ve.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],mo(t,e=t.__k=Up(Zn,null,[e]),o||$n,$n,t.namespaceURI,o?null:t.firstChild?yn.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),ms(i,e,a)}function xs(e,t,n){var r,o,i,a,s=et({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?o=t[i]:s[i]=t[i]===void 0&&a!=null?a[i]:t[i];return arguments.length>2&&(s.children=arguments.length>3?yn.call(arguments,2):n),hn(e.type,s,r||e.key,o||e.ref,null)}yn=Hn.slice,ve={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(s){e=s}throw e}},us=0,fs=function(e){return e!=null&&e.constructor===void 0},Rn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=et({},this.state),typeof e=="function"&&(e=e(et({},n),this.props)),e&&et(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Fi(this))},Rn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Fi(this))},Rn.prototype.render=Zn,dt=[],ds=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,hs=function(e,t){return e.__v.__b-t.__v.__b},Un.__r=0,jr=Math.random().toString(8),Ln="__d"+jr,dn="__a"+jr,ps=/(PointerCapture)$|Capture$/i,vo=0,Vr=$i(!1),Wr=$i(!0);function Hi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function Kp(e){if(Array.isArray(e))return e}function Qp(e,t,n){return(t=rg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zp(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function Jp(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
656
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ui(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function eg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ui(Object(n),!0).forEach(function(r){Qp(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ui(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function tg(e,t){return Kp(e)||Zp(e,t)||og(e,t)||Jp()}function ng(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function rg(e){var t=ng(e,"string");return typeof t=="symbol"?t:t+""}function qn(e){"@babel/helpers - typeof";return qn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qn(e)}function og(e,t){if(e){if(typeof e=="string")return Hi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Hi(e,t):void 0}}var Yr=function(t){if(qn(t)!=="object")return t;var n=xs(t);if(n.props){var r;n.props=eg({},n.props),n!=null&&(r=n.props)!==null&&r!==void 0&&r.children&&(n.props.children=Array.isArray(n.props.children)?n.props.children.map(Yr):Yr(n.props.children))}return n},ig=function(t){return fs(xs(t))},ag=function(t,n){delete n.__k,Yp(Yr(t),n)};function sg(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var lg=`.float-tooltip-kap {
655
+ `};function zd(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t[0],o=[],i;for(i=1;i<t.length;i+=1)o.push(t[i]);return o.forEach(function(a){r=r.replace(/%[a-z]/,a)}),r}var gt=function(e){Pd(t,e);function t(n){var r;if(process.env.NODE_ENV==="production")r=e.call(this,"An error occurred. See https://github.com/styled-components/polished/blob/main/src/internalHelpers/errors.md#"+n+" for more information.")||this;else{for(var o=arguments.length,i=new Array(o>1?o-1:0),a=1;a<o;a++)i[a-1]=arguments[a];r=e.call(this,zd.apply(void 0,[jd[n]].concat(i)))||this}return Md(r)}return t}(Xr(Error));function Er(e){return Math.round(e*255)}function Td(e,t,n){return Er(e)+","+Er(t)+","+Er(n)}function Zn(e,t,n,r){if(r===void 0&&(r=Td),t===0)return r(n,n,n);var o=(e%360+360)%360/60,i=(1-Math.abs(2*n-1))*t,a=i*(1-Math.abs(o%2-1)),l=0,s=0,u=0;o>=0&&o<1?(l=i,s=a):o>=1&&o<2?(l=a,s=i):o>=2&&o<3?(s=i,u=a):o>=3&&o<4?(s=a,u=i):o>=4&&o<5?(l=a,u=i):o>=5&&o<6&&(l=i,u=a);var f=n-i/2,c=l+f,p=s+f,h=u+f;return r(c,p,h)}var Gi={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"639",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"};function Ed(e){if(typeof e!="string")return e;var t=e.toLowerCase();return Gi[t]?"#"+Gi[t]:e}var Ld=/^#[a-fA-F0-9]{6}$/,Nd=/^#[a-fA-F0-9]{8}$/,Rd=/^#[a-fA-F0-9]{3}$/,Dd=/^#[a-fA-F0-9]{4}$/,Lr=/^rgb\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*\)$/i,Id=/^rgb(?:a)?\(\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,)?\s*(\d{1,3})\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i,Fd=/^hsl\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*\)$/i,Bd=/^hsl(?:a)?\(\s*(\d{0,3}[.]?[0-9]+(?:deg)?)\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,)?\s*(\d{1,3}[.]?[0-9]?)%\s*(?:,|\/)\s*([-+]?\d*[.]?\d+[%]?)\s*\)$/i;function tn(e){if(typeof e!="string")throw new gt(3);var t=Ed(e);if(t.match(Ld))return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16)};if(t.match(Nd)){var n=parseFloat((parseInt(""+t[7]+t[8],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[2],16),green:parseInt(""+t[3]+t[4],16),blue:parseInt(""+t[5]+t[6],16),alpha:n}}if(t.match(Rd))return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16)};if(t.match(Dd)){var r=parseFloat((parseInt(""+t[4]+t[4],16)/255).toFixed(2));return{red:parseInt(""+t[1]+t[1],16),green:parseInt(""+t[2]+t[2],16),blue:parseInt(""+t[3]+t[3],16),alpha:r}}var o=Lr.exec(t);if(o)return{red:parseInt(""+o[1],10),green:parseInt(""+o[2],10),blue:parseInt(""+o[3],10)};var i=Id.exec(t.substring(0,50));if(i)return{red:parseInt(""+i[1],10),green:parseInt(""+i[2],10),blue:parseInt(""+i[3],10),alpha:parseFloat(""+i[4])>1?parseFloat(""+i[4])/100:parseFloat(""+i[4])};var a=Fd.exec(t);if(a){var l=parseInt(""+a[1],10),s=parseInt(""+a[2],10)/100,u=parseInt(""+a[3],10)/100,f="rgb("+Zn(l,s,u)+")",c=Lr.exec(f);if(!c)throw new gt(4,t,f);return{red:parseInt(""+c[1],10),green:parseInt(""+c[2],10),blue:parseInt(""+c[3],10)}}var p=Bd.exec(t.substring(0,50));if(p){var h=parseInt(""+p[1],10),d=parseInt(""+p[2],10)/100,m=parseInt(""+p[3],10)/100,v="rgb("+Zn(h,d,m)+")",g=Lr.exec(v);if(!g)throw new gt(4,t,v);return{red:parseInt(""+g[1],10),green:parseInt(""+g[2],10),blue:parseInt(""+g[3],10),alpha:parseFloat(""+p[4])>1?parseFloat(""+p[4])/100:parseFloat(""+p[4])}}throw new gt(5)}function $d(e){var t=e.red/255,n=e.green/255,r=e.blue/255,o=Math.max(t,n,r),i=Math.min(t,n,r),a=(o+i)/2;if(o===i)return e.alpha!==void 0?{hue:0,saturation:0,lightness:a,alpha:e.alpha}:{hue:0,saturation:0,lightness:a};var l,s=o-i,u=a>.5?s/(2-o-i):s/(o+i);switch(o){case t:l=(n-r)/s+(n<r?6:0);break;case n:l=(r-t)/s+2;break;default:l=(t-n)/s+4;break}return l*=60,e.alpha!==void 0?{hue:l,saturation:u,lightness:a,alpha:e.alpha}:{hue:l,saturation:u,lightness:a}}function jt(e){return $d(tn(e))}var Hd=function(t){return t.length===7&&t[1]===t[2]&&t[3]===t[4]&&t[5]===t[6]?"#"+t[1]+t[3]+t[5]:t},Kr=Hd;function Ft(e){var t=e.toString(16);return t.length===1?"0"+t:t}function Nr(e){return Ft(Math.round(e*255))}function qd(e,t,n){return Kr("#"+Nr(e)+Nr(t)+Nr(n))}function os(e,t,n){return Zn(e,t,n,qd)}function Ud(e,t,n){if(typeof e=="object"&&t===void 0&&n===void 0)return os(e.hue,e.saturation,e.lightness);throw new gt(1)}function Gd(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?os(e.hue,e.saturation,e.lightness):"rgba("+Zn(e.hue,e.saturation,e.lightness)+","+e.alpha+")";throw new gt(2)}function is(e,t,n){if(typeof e=="number"&&typeof t=="number"&&typeof n=="number")return Kr("#"+Ft(e)+Ft(t)+Ft(n));if(typeof e=="object"&&t===void 0&&n===void 0)return Kr("#"+Ft(e.red)+Ft(e.green)+Ft(e.blue));throw new gt(6)}function lr(e,t,n,r){if(typeof e=="object"&&t===void 0&&n===void 0&&r===void 0)return e.alpha>=1?is(e.red,e.green,e.blue):"rgba("+e.red+","+e.green+","+e.blue+","+e.alpha+")";throw new gt(7)}var Vd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Wd=function(t){return typeof t.red=="number"&&typeof t.green=="number"&&typeof t.blue=="number"&&typeof t.alpha=="number"},Yd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&(typeof t.alpha!="number"||typeof t.alpha>"u")},Xd=function(t){return typeof t.hue=="number"&&typeof t.saturation=="number"&&typeof t.lightness=="number"&&typeof t.alpha=="number"};function zt(e){if(typeof e!="object")throw new gt(8);if(Wd(e))return lr(e);if(Vd(e))return is(e);if(Xd(e))return Gd(e);if(Yd(e))return Ud(e);throw new gt(8)}function as(e,t,n){return function(){var o=n.concat(Array.prototype.slice.call(arguments));return o.length>=t?e.apply(this,o):as(e,t,o)}}function Ze(e){return as(e,e.length,[])}function Kd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{hue:n.hue+parseFloat(e)}))}Ze(Kd);function an(e,t,n){return Math.max(e,Math.min(t,n))}function Zd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{lightness:an(0,1,n.lightness-parseFloat(e))}))}Ze(Zd);function Qd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{saturation:an(0,1,n.saturation-parseFloat(e))}))}Ze(Qd);function Jd(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{lightness:an(0,1,n.lightness+parseFloat(e))}))}Ze(Jd);function eh(e,t,n){if(t==="transparent")return n;if(n==="transparent")return t;if(e===0)return n;var r=tn(t),o=Ge({},r,{alpha:typeof r.alpha=="number"?r.alpha:1}),i=tn(n),a=Ge({},i,{alpha:typeof i.alpha=="number"?i.alpha:1}),l=o.alpha-a.alpha,s=parseFloat(e)*2-1,u=s*l===-1?s:s+l,f=1+s*l,c=(u/f+1)/2,p=1-c,h={red:Math.floor(o.red*c+a.red*p),green:Math.floor(o.green*c+a.green*p),blue:Math.floor(o.blue*c+a.blue*p),alpha:o.alpha*parseFloat(e)+a.alpha*(1-parseFloat(e))};return lr(h)}var th=Ze(eh),ss=th;function nh(e,t){if(t==="transparent")return t;var n=tn(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ge({},n,{alpha:an(0,1,(r*100+parseFloat(e)*100)/100)});return lr(o)}var rh=Ze(nh),oh=rh;function ih(e,t){if(t==="transparent")return t;var n=jt(t);return zt(Ge({},n,{saturation:an(0,1,n.saturation+parseFloat(e))}))}Ze(ih);function ah(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{hue:parseFloat(e)}))}Ze(ah);function sh(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{lightness:parseFloat(e)}))}Ze(sh);function lh(e,t){return t==="transparent"?t:zt(Ge({},jt(t),{saturation:parseFloat(e)}))}Ze(lh);function ch(e,t){return t==="transparent"?t:ss(parseFloat(e),"rgb(0, 0, 0)",t)}Ze(ch);function uh(e,t){return t==="transparent"?t:ss(parseFloat(e),"rgb(255, 255, 255)",t)}Ze(uh);function fh(e,t){if(t==="transparent")return t;var n=tn(t),r=typeof n.alpha=="number"?n.alpha:1,o=Ge({},n,{alpha:an(0,1,+(r*100-parseFloat(e)*100).toFixed(2)/100)});return lr(o)}Ze(fh);var Bt=Object.freeze({Linear:Object.freeze({None:function(e){return e},In:function(e){return e},Out:function(e){return e},InOut:function(e){return e}}),Quadratic:Object.freeze({In:function(e){return e*e},Out:function(e){return e*(2-e)},InOut:function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)}}),Cubic:Object.freeze({In:function(e){return e*e*e},Out:function(e){return--e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}}),Quartic:Object.freeze({In:function(e){return e*e*e*e},Out:function(e){return 1- --e*e*e*e},InOut:function(e){return(e*=2)<1?.5*e*e*e*e:-.5*((e-=2)*e*e*e-2)}}),Quintic:Object.freeze({In:function(e){return e*e*e*e*e},Out:function(e){return--e*e*e*e*e+1},InOut:function(e){return(e*=2)<1?.5*e*e*e*e*e:.5*((e-=2)*e*e*e*e+2)}}),Sinusoidal:Object.freeze({In:function(e){return 1-Math.sin((1-e)*Math.PI/2)},Out:function(e){return Math.sin(e*Math.PI/2)},InOut:function(e){return .5*(1-Math.sin(Math.PI*(.5-e)))}}),Exponential:Object.freeze({In:function(e){return e===0?0:Math.pow(1024,e-1)},Out:function(e){return e===1?1:1-Math.pow(2,-10*e)},InOut:function(e){return e===0?0:e===1?1:(e*=2)<1?.5*Math.pow(1024,e-1):.5*(-Math.pow(2,-10*(e-1))+2)}}),Circular:Object.freeze({In:function(e){return 1-Math.sqrt(1-e*e)},Out:function(e){return Math.sqrt(1- --e*e)},InOut:function(e){return(e*=2)<1?-.5*(Math.sqrt(1-e*e)-1):.5*(Math.sqrt(1-(e-=2)*e)+1)}}),Elastic:Object.freeze({In:function(e){return e===0?0:e===1?1:-Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI)},Out:function(e){return e===0?0:e===1?1:Math.pow(2,-10*e)*Math.sin((e-.1)*5*Math.PI)+1},InOut:function(e){return e===0?0:e===1?1:(e*=2,e<1?-.5*Math.pow(2,10*(e-1))*Math.sin((e-1.1)*5*Math.PI):.5*Math.pow(2,-10*(e-1))*Math.sin((e-1.1)*5*Math.PI)+1)}}),Back:Object.freeze({In:function(e){var t=1.70158;return e===1?1:e*e*((t+1)*e-t)},Out:function(e){var t=1.70158;return e===0?0:--e*e*((t+1)*e+t)+1},InOut:function(e){var t=2.5949095;return(e*=2)<1?.5*(e*e*((t+1)*e-t)):.5*((e-=2)*e*((t+1)*e+t)+2)}}),Bounce:Object.freeze({In:function(e){return 1-Bt.Bounce.Out(1-e)},Out:function(e){return e<1/2.75?7.5625*e*e:e<2/2.75?7.5625*(e-=1.5/2.75)*e+.75:e<2.5/2.75?7.5625*(e-=2.25/2.75)*e+.9375:7.5625*(e-=2.625/2.75)*e+.984375},InOut:function(e){return e<.5?Bt.Bounce.In(e*2)*.5:Bt.Bounce.Out(e*2-1)*.5+.5}}),generatePow:function(e){return e===void 0&&(e=4),e=e<Number.EPSILON?Number.EPSILON:e,e=e>1e4?1e4:e,{In:function(t){return Math.pow(t,e)},Out:function(t){return 1-Math.pow(1-t,e)},InOut:function(t){return t<.5?Math.pow(t*2,e)/2:(1-Math.pow(2-t*2,e))/2+.5}}}}),xn=function(){return performance.now()},ls=function(){function e(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,t)}return e.prototype.getAll=function(){var t=this;return Object.keys(this._tweens).map(function(n){return t._tweens[n]})},e.prototype.removeAll=function(){this._tweens={}},e.prototype.add=function(){for(var t,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];for(var o=0,i=n;o<i.length;o++){var a=i[o];(t=a._group)===null||t===void 0||t.remove(a),a._group=this,this._tweens[a.getId()]=a,this._tweensAddedDuringUpdate[a.getId()]=a}},e.prototype.remove=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];for(var r=0,o=t;r<o.length;r++){var i=o[r];i._group=void 0,delete this._tweens[i.getId()],delete this._tweensAddedDuringUpdate[i.getId()]}},e.prototype.allStopped=function(){return this.getAll().every(function(t){return!t.isPlaying()})},e.prototype.update=function(t,n){t===void 0&&(t=xn()),n===void 0&&(n=!0);var r=Object.keys(this._tweens);if(r.length!==0)for(;r.length>0;){this._tweensAddedDuringUpdate={};for(var o=0;o<r.length;o++){var i=this._tweens[r[o]],a=!n;i&&i.update(t,a)===!1&&!n&&this.remove(i)}r=Object.keys(this._tweensAddedDuringUpdate)}},e}(),Zr={Linear:function(e,t){var n=e.length-1,r=n*t,o=Math.floor(r),i=Zr.Utils.Linear;return t<0?i(e[0],e[1],r):t>1?i(e[n],e[n-1],n-r):i(e[o],e[o+1>n?n:o+1],r-o)},Utils:{Linear:function(e,t,n){return(t-e)*n+e}}},cs=function(){function e(){}return e.nextId=function(){return e._nextId++},e._nextId=0,e}(),Qr=new ls,Vi=function(){function e(t,n){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Bt.Linear.None,this._interpolationFunction=Zr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=cs.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=t,typeof n=="object"?(this._group=n,n.add(this)):n===!0&&(this._group=Qr,Qr.add(this))}return e.prototype.getId=function(){return this._id},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isPaused=function(){return this._isPaused},e.prototype.getDuration=function(){return this._duration},e.prototype.to=function(t,n){if(n===void 0&&(n=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=t,this._propertiesAreSetUp=!1,this._duration=n<0?0:n,this},e.prototype.duration=function(t){return t===void 0&&(t=1e3),this._duration=t<0?0:t,this},e.prototype.dynamic=function(t){return t===void 0&&(t=!1),this._isDynamic=t,this},e.prototype.start=function(t,n){if(t===void 0&&(t=xn()),n===void 0&&(n=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var r in this._valuesStartRepeat)this._swapEndStartRepeatValues(r),this._valuesStart[r]=this._valuesStartRepeat[r]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=t,this._startTime+=this._delayTime,!this._propertiesAreSetUp||n){if(this._propertiesAreSetUp=!0,!this._isDynamic){var o={};for(var i in this._valuesEnd)o[i]=this._valuesEnd[i];this._valuesEnd=o}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,n)}return this},e.prototype.startFromCurrentValues=function(t){return this.start(t,!0)},e.prototype._setupProperties=function(t,n,r,o,i){for(var a in r){var l=t[a],s=Array.isArray(l),u=s?"array":typeof l,f=!s&&Array.isArray(r[a]);if(!(u==="undefined"||u==="function")){if(f){var c=r[a];if(c.length===0)continue;for(var p=[l],h=0,d=c.length;h<d;h+=1){var m=this._handleRelativeValue(l,c[h]);if(isNaN(m)){f=!1,console.warn("Found invalid interpolation list. Skipping.");break}p.push(m)}f&&(r[a]=p)}if((u==="object"||s)&&l&&!f){n[a]=s?[]:{};var v=l;for(var g in v)n[a][g]=v[g];o[a]=s?[]:{};var c=r[a];if(!this._isDynamic){var S={};for(var g in c)S[g]=c[g];r[a]=c=S}this._setupProperties(v,n[a],c,o[a],i)}else(typeof n[a]>"u"||i)&&(n[a]=l),s||(n[a]*=1),f?o[a]=r[a].slice().reverse():o[a]=n[a]||0}}},e.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},e.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},e.prototype.pause=function(t){return t===void 0&&(t=xn()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=t,this)},e.prototype.resume=function(t){return t===void 0&&(t=xn()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=t-this._pauseStart,this._pauseStart=0,this)},e.prototype.stopChainedTweens=function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop();return this},e.prototype.group=function(t){return t?(t.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},e.prototype.remove=function(){var t;return(t=this._group)===null||t===void 0||t.remove(this),this},e.prototype.delay=function(t){return t===void 0&&(t=0),this._delayTime=t,this},e.prototype.repeat=function(t){return t===void 0&&(t=0),this._initialRepeat=t,this._repeat=t,this},e.prototype.repeatDelay=function(t){return this._repeatDelayTime=t,this},e.prototype.yoyo=function(t){return t===void 0&&(t=!1),this._yoyo=t,this},e.prototype.easing=function(t){return t===void 0&&(t=Bt.Linear.None),this._easingFunction=t,this},e.prototype.interpolation=function(t){return t===void 0&&(t=Zr.Linear),this._interpolationFunction=t,this},e.prototype.chain=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return this._chainedTweens=t,this},e.prototype.onStart=function(t){return this._onStartCallback=t,this},e.prototype.onEveryStart=function(t){return this._onEveryStartCallback=t,this},e.prototype.onUpdate=function(t){return this._onUpdateCallback=t,this},e.prototype.onRepeat=function(t){return this._onRepeatCallback=t,this},e.prototype.onComplete=function(t){return this._onCompleteCallback=t,this},e.prototype.onStop=function(t){return this._onStopCallback=t,this},e.prototype.update=function(t,n){var r=this,o;if(t===void 0&&(t=xn()),n===void 0&&(n=e.autoStartOnUpdate),this._isPaused)return!0;var i;if(!this._goToEnd&&!this._isPlaying)if(n)this.start(t,!0);else return!1;if(this._goToEnd=!1,t<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var a=t-this._startTime,l=this._duration+((o=this._repeatDelayTime)!==null&&o!==void 0?o:this._delayTime),s=this._duration+this._repeat*l,u=function(){if(r._duration===0||a>s)return 1;var m=Math.trunc(a/l),v=a-m*l,g=Math.min(v/r._duration,1);return g===0&&a===r._duration?1:g},f=u(),c=this._easingFunction(f);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,c),this._onUpdateCallback&&this._onUpdateCallback(this._object,f),this._duration===0||a>=this._duration)if(this._repeat>0){var p=Math.min(Math.trunc((a-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=p);for(i in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[i]=="string"&&(this._valuesStartRepeat[i]=this._valuesStartRepeat[i]+parseFloat(this._valuesEnd[i])),this._yoyo&&this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*p,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var h=0,d=this._chainedTweens.length;h<d;h++)this._chainedTweens[h].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},e.prototype._updateProperties=function(t,n,r,o){for(var i in r)if(n[i]!==void 0){var a=n[i]||0,l=r[i],s=Array.isArray(t[i]),u=Array.isArray(l),f=!s&&u;f?t[i]=this._interpolationFunction(l,o):typeof l=="object"&&l?this._updateProperties(t[i],a,l,o):(l=this._handleRelativeValue(a,l),typeof l=="number"&&(t[i]=a+(l-a)*o))}},e.prototype._handleRelativeValue=function(t,n){return typeof n!="string"?n:n.charAt(0)==="+"||n.charAt(0)==="-"?t+parseFloat(n):parseFloat(n)},e.prototype._swapEndStartRepeatValues=function(t){var n=this._valuesStartRepeat[t],r=this._valuesEnd[t];typeof r=="string"?this._valuesStartRepeat[t]=this._valuesStartRepeat[t]+parseFloat(r):this._valuesStartRepeat[t]=this._valuesEnd[t],this._valuesEnd[t]=n},e.autoStartOnUpdate=!1,e}();cs.nextId;var yt=Qr;yt.getAll.bind(yt);yt.removeAll.bind(yt);yt.add.bind(yt);yt.remove.bind(yt);yt.update.bind(yt);var Jr="http://www.w3.org/1999/xhtml";const Wi={svg:"http://www.w3.org/2000/svg",xhtml:Jr,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function us(e){var t=e+="",n=t.indexOf(":");return n>=0&&(t=e.slice(0,n))!=="xmlns"&&(e=e.slice(n+1)),Wi.hasOwnProperty(t)?{space:Wi[t],local:e}:e}function dh(e){return function(){var t=this.ownerDocument,n=this.namespaceURI;return n===Jr&&t.documentElement.namespaceURI===Jr?t.createElement(e):t.createElementNS(n,e)}}function hh(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function fs(e){var t=us(e);return(t.local?hh:dh)(t)}function ph(){}function ds(e){return e==null?ph:function(){return this.querySelector(e)}}function gh(e){typeof e!="function"&&(e=ds(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=new Array(a),s,u,f=0;f<a;++f)(s=i[f])&&(u=e.call(s,s.__data__,f,i))&&("__data__"in s&&(u.__data__=s.__data__),l[f]=u);return new rt(r,this._parents)}function vh(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function yh(){return[]}function mh(e){return e==null?yh:function(){return this.querySelectorAll(e)}}function bh(e){return function(){return vh(e.apply(this,arguments))}}function _h(e){typeof e=="function"?e=bh(e):e=mh(e);for(var t=this._groups,n=t.length,r=[],o=[],i=0;i<n;++i)for(var a=t[i],l=a.length,s,u=0;u<l;++u)(s=a[u])&&(r.push(e.call(s,s.__data__,u,a)),o.push(s));return new rt(r,o)}function xh(e){return function(){return this.matches(e)}}function hs(e){return function(t){return t.matches(e)}}var wh=Array.prototype.find;function kh(e){return function(){return wh.call(this.children,e)}}function Ch(){return this.firstElementChild}function Sh(e){return this.select(e==null?Ch:kh(typeof e=="function"?e:hs(e)))}var Mh=Array.prototype.filter;function Ph(){return Array.from(this.children)}function Ah(e){return function(){return Mh.call(this.children,e)}}function Oh(e){return this.selectAll(e==null?Ph:Ah(typeof e=="function"?e:hs(e)))}function jh(e){typeof e!="function"&&(e=xh(e));for(var t=this._groups,n=t.length,r=new Array(n),o=0;o<n;++o)for(var i=t[o],a=i.length,l=r[o]=[],s,u=0;u<a;++u)(s=i[u])&&e.call(s,s.__data__,u,i)&&l.push(s);return new rt(r,this._parents)}function ps(e){return new Array(e.length)}function zh(){return new rt(this._enter||this._groups.map(ps),this._parents)}function Qn(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}Qn.prototype={constructor:Qn,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function Th(e){return function(){return e}}function Eh(e,t,n,r,o,i){for(var a=0,l,s=t.length,u=i.length;a<u;++a)(l=t[a])?(l.__data__=i[a],r[a]=l):n[a]=new Qn(e,i[a]);for(;a<s;++a)(l=t[a])&&(o[a]=l)}function Lh(e,t,n,r,o,i,a){var l,s,u=new Map,f=t.length,c=i.length,p=new Array(f),h;for(l=0;l<f;++l)(s=t[l])&&(p[l]=h=a.call(s,s.__data__,l,t)+"",u.has(h)?o[l]=s:u.set(h,s));for(l=0;l<c;++l)h=a.call(e,i[l],l,i)+"",(s=u.get(h))?(r[l]=s,s.__data__=i[l],u.delete(h)):n[l]=new Qn(e,i[l]);for(l=0;l<f;++l)(s=t[l])&&u.get(p[l])===s&&(o[l]=s)}function Nh(e){return e.__data__}function Rh(e,t){if(!arguments.length)return Array.from(this,Nh);var n=t?Lh:Eh,r=this._parents,o=this._groups;typeof e!="function"&&(e=Th(e));for(var i=o.length,a=new Array(i),l=new Array(i),s=new Array(i),u=0;u<i;++u){var f=r[u],c=o[u],p=c.length,h=Dh(e.call(f,f&&f.__data__,u,r)),d=h.length,m=l[u]=new Array(d),v=a[u]=new Array(d),g=s[u]=new Array(p);n(f,c,m,v,g,h,t);for(var S=0,_=0,x,w;S<d;++S)if(x=m[S]){for(S>=_&&(_=S+1);!(w=v[_])&&++_<d;);x._next=w||null}}return a=new rt(a,r),a._enter=l,a._exit=s,a}function Dh(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Ih(){return new rt(this._exit||this._groups.map(ps),this._parents)}function Fh(e,t,n){var r=this.enter(),o=this,i=this.exit();return typeof e=="function"?(r=e(r),r&&(r=r.selection())):r=r.append(e+""),t!=null&&(o=t(o),o&&(o=o.selection())),n==null?i.remove():n(i),r&&o?r.merge(o).order():o}function Bh(e){for(var t=e.selection?e.selection():e,n=this._groups,r=t._groups,o=n.length,i=r.length,a=Math.min(o,i),l=new Array(o),s=0;s<a;++s)for(var u=n[s],f=r[s],c=u.length,p=l[s]=new Array(c),h,d=0;d<c;++d)(h=u[d]||f[d])&&(p[d]=h);for(;s<o;++s)l[s]=n[s];return new rt(l,this._parents)}function $h(){for(var e=this._groups,t=-1,n=e.length;++t<n;)for(var r=e[t],o=r.length-1,i=r[o],a;--o>=0;)(a=r[o])&&(i&&a.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(a,i),i=a);return this}function Hh(e){e||(e=qh);function t(c,p){return c&&p?e(c.__data__,p.__data__):!c-!p}for(var n=this._groups,r=n.length,o=new Array(r),i=0;i<r;++i){for(var a=n[i],l=a.length,s=o[i]=new Array(l),u,f=0;f<l;++f)(u=a[f])&&(s[f]=u);s.sort(t)}return new rt(o,this._parents).order()}function qh(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function Uh(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function Gh(){return Array.from(this)}function Vh(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length;o<i;++o){var a=r[o];if(a)return a}return null}function Wh(){let e=0;for(const t of this)++e;return e}function Yh(){return!this.node()}function Xh(e){for(var t=this._groups,n=0,r=t.length;n<r;++n)for(var o=t[n],i=0,a=o.length,l;i<a;++i)(l=o[i])&&e.call(l,l.__data__,i,o);return this}function Kh(e){return function(){this.removeAttribute(e)}}function Zh(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Qh(e,t){return function(){this.setAttribute(e,t)}}function Jh(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function ep(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttribute(e):this.setAttribute(e,n)}}function tp(e,t){return function(){var n=t.apply(this,arguments);n==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,n)}}function np(e,t){var n=us(e);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((t==null?n.local?Zh:Kh:typeof t=="function"?n.local?tp:ep:n.local?Jh:Qh)(n,t))}function gs(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function rp(e){return function(){this.style.removeProperty(e)}}function op(e,t,n){return function(){this.style.setProperty(e,t,n)}}function ip(e,t,n){return function(){var r=t.apply(this,arguments);r==null?this.style.removeProperty(e):this.style.setProperty(e,r,n)}}function ap(e,t,n){return arguments.length>1?this.each((t==null?rp:typeof t=="function"?ip:op)(e,t,n??"")):sp(this.node(),e)}function sp(e,t){return e.style.getPropertyValue(t)||gs(e).getComputedStyle(e,null).getPropertyValue(t)}function lp(e){return function(){delete this[e]}}function cp(e,t){return function(){this[e]=t}}function up(e,t){return function(){var n=t.apply(this,arguments);n==null?delete this[e]:this[e]=n}}function fp(e,t){return arguments.length>1?this.each((t==null?lp:typeof t=="function"?up:cp)(e,t)):this.node()[e]}function vs(e){return e.trim().split(/^|\s+/)}function ko(e){return e.classList||new ys(e)}function ys(e){this._node=e,this._names=vs(e.getAttribute("class")||"")}ys.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function ms(e,t){for(var n=ko(e),r=-1,o=t.length;++r<o;)n.add(t[r])}function bs(e,t){for(var n=ko(e),r=-1,o=t.length;++r<o;)n.remove(t[r])}function dp(e){return function(){ms(this,e)}}function hp(e){return function(){bs(this,e)}}function pp(e,t){return function(){(t.apply(this,arguments)?ms:bs)(this,e)}}function gp(e,t){var n=vs(e+"");if(arguments.length<2){for(var r=ko(this.node()),o=-1,i=n.length;++o<i;)if(!r.contains(n[o]))return!1;return!0}return this.each((typeof t=="function"?pp:t?dp:hp)(n,t))}function vp(){this.textContent=""}function yp(e){return function(){this.textContent=e}}function mp(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function bp(e){return arguments.length?this.each(e==null?vp:(typeof e=="function"?mp:yp)(e)):this.node().textContent}function _p(){this.innerHTML=""}function xp(e){return function(){this.innerHTML=e}}function wp(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function kp(e){return arguments.length?this.each(e==null?_p:(typeof e=="function"?wp:xp)(e)):this.node().innerHTML}function Cp(){this.nextSibling&&this.parentNode.appendChild(this)}function Sp(){return this.each(Cp)}function Mp(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Pp(){return this.each(Mp)}function Ap(e){var t=typeof e=="function"?e:fs(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function Op(){return null}function jp(e,t){var n=typeof e=="function"?e:fs(e),r=t==null?Op:typeof t=="function"?t:ds(t);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function zp(){var e=this.parentNode;e&&e.removeChild(this)}function Tp(){return this.each(zp)}function Ep(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Lp(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function Np(e){return this.select(e?Lp:Ep)}function Rp(e){return arguments.length?this.property("__data__",e):this.node().__data__}function Dp(e){return function(t){e.call(this,t,this.__data__)}}function Ip(e){return e.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");return r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),{type:t,name:n}})}function Fp(e){return function(){var t=this.__on;if(t){for(var n=0,r=-1,o=t.length,i;n<o;++n)i=t[n],(!e.type||i.type===e.type)&&i.name===e.name?this.removeEventListener(i.type,i.listener,i.options):t[++r]=i;++r?t.length=r:delete this.__on}}}function Bp(e,t,n){return function(){var r=this.__on,o,i=Dp(t);if(r){for(var a=0,l=r.length;a<l;++a)if((o=r[a]).type===e.type&&o.name===e.name){this.removeEventListener(o.type,o.listener,o.options),this.addEventListener(o.type,o.listener=i,o.options=n),o.value=t;return}}this.addEventListener(e.type,i,n),o={type:e.type,name:e.name,value:t,listener:i,options:n},r?r.push(o):this.__on=[o]}}function $p(e,t,n){var r=Ip(e+""),o,i=r.length,a;if(arguments.length<2){var l=this.node().__on;if(l){for(var s=0,u=l.length,f;s<u;++s)for(o=0,f=l[s];o<i;++o)if((a=r[o]).type===f.type&&a.name===f.name)return f.value}return}for(l=t?Bp:Fp,o=0;o<i;++o)this.each(l(r[o],t,n));return this}function _s(e,t,n){var r=gs(e),o=r.CustomEvent;typeof o=="function"?o=new o(t,n):(o=r.document.createEvent("Event"),n?(o.initEvent(t,n.bubbles,n.cancelable),o.detail=n.detail):o.initEvent(t,!1,!1)),e.dispatchEvent(o)}function Hp(e,t){return function(){return _s(this,e,t)}}function qp(e,t){return function(){return _s(this,e,t.apply(this,arguments))}}function Up(e,t){return this.each((typeof t=="function"?qp:Hp)(e,t))}function*Gp(){for(var e=this._groups,t=0,n=e.length;t<n;++t)for(var r=e[t],o=0,i=r.length,a;o<i;++o)(a=r[o])&&(yield a)}var Vp=[null];function rt(e,t){this._groups=e,this._parents=t}function Wp(){return this}rt.prototype={constructor:rt,select:gh,selectAll:_h,selectChild:Sh,selectChildren:Oh,filter:jh,data:Rh,enter:zh,exit:Ih,join:Fh,merge:Bh,selection:Wp,order:$h,sort:Hh,call:Uh,nodes:Gh,node:Vh,size:Wh,empty:Yh,each:Xh,attr:np,style:ap,property:fp,classed:gp,text:bp,html:kp,raise:Sp,lower:Pp,append:Ap,insert:jp,remove:Tp,clone:Np,datum:Rp,on:$p,dispatch:Up,[Symbol.iterator]:Gp};function Yp(e){return typeof e=="string"?new rt([[document.querySelector(e)]],[document.documentElement]):new rt([[e]],Vp)}function Xp(e){let t;for(;t=e.sourceEvent;)e=t;return e}function Kp(e,t){if(e=Xp(e),t===void 0&&(t=e.currentTarget),t){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=e.clientX,r.y=e.clientY,r=r.matrixTransform(t.getScreenCTM().inverse()),[r.x,r.y]}if(t.getBoundingClientRect){var o=t.getBoundingClientRect();return[e.clientX-o.left-t.clientLeft,e.clientY-o.top-t.clientTop]}}return[e.pageX,e.pageY]}var An,ke,xs,ws,At,Yi,ks,Cs,Rr,Gn,kn,Ss,Co,eo,to,Jn={},er=[],Zp=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,cr=Array.isArray;function vt(e,t){for(var n in t)e[n]=t[n];return e}function So(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Qp(e,t,n){var r,o,i,a={};for(i in t)i=="key"?r=t[i]:i=="ref"?o=t[i]:a[i]=t[i];if(arguments.length>2&&(a.children=arguments.length>3?An.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(i in e.defaultProps)a[i]===void 0&&(a[i]=e.defaultProps[i]);return Cn(e,a,r,o,null)}function Cn(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++xs,__i:-1,__u:0};return o==null&&ke.vnode!=null&&ke.vnode(i),i}function ur(e){return e.children}function Vn(e,t){this.props=e,this.context=t}function nn(e,t){if(t==null)return e.__?nn(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?nn(e):null}function Jp(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],o=[],i=vt({},t);i.__v=t.__v+1,ke.vnode&&ke.vnode(i),Mo(e.__P,i,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??nn(t),!!(32&t.__u),o),i.__v=t.__v,i.__.__k[i.__i]=i,Os(r,i,o),t.__e=t.__=null,i.__e!=n&&Ms(i)}}function Ms(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),Ms(e)}function Xi(e){(!e.__d&&(e.__d=!0)&&At.push(e)&&!tr.__r++||Yi!=ke.debounceRendering)&&((Yi=ke.debounceRendering)||ks)(tr)}function tr(){try{for(var e,t=1;At.length;)At.length>t&&At.sort(Cs),e=At.shift(),t=At.length,Jp(e)}finally{At.length=tr.__r=0}}function Ps(e,t,n,r,o,i,a,l,s,u,f){var c,p,h,d,m,v,g,S=r&&r.__k||er,_=t.length;for(s=eg(n,t,S,s,_),c=0;c<_;c++)(h=n.__k[c])!=null&&(p=h.__i!=-1&&S[h.__i]||Jn,h.__i=c,v=Mo(e,h,p,o,i,a,l,s,u,f),d=h.__e,h.ref&&p.ref!=h.ref&&(p.ref&&Po(p.ref,null,h),f.push(h.ref,h.__c||d,h)),m==null&&d!=null&&(m=d),(g=!!(4&h.__u))||p.__k===h.__k?(s=As(h,s,e,g),g&&p.__e&&(p.__e=null)):typeof h.type=="function"&&v!==void 0?s=v:d&&(s=d.nextSibling),h.__u&=-7);return n.__e=m,s}function eg(e,t,n,r,o){var i,a,l,s,u,f=n.length,c=f,p=0;for(e.__k=new Array(o),i=0;i<o;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a=="string"||typeof a=="number"||typeof a=="bigint"||a.constructor==String?a=e.__k[i]=Cn(null,a,null,null,null):cr(a)?a=e.__k[i]=Cn(ur,{children:a},null,null,null):a.constructor===void 0&&a.__b>0?a=e.__k[i]=Cn(a.type,a.props,a.key,a.ref?a.ref:null,a.__v):e.__k[i]=a,s=i+p,a.__=e,a.__b=e.__b+1,l=null,(u=a.__i=tg(a,n,s,c))!=-1&&(c--,(l=n[u])&&(l.__u|=2)),l==null||l.__v==null?(u==-1&&(o>f?p--:o<f&&p++),typeof a.type!="function"&&(a.__u|=4)):u!=s&&(u==s-1?p--:u==s+1?p++:(u>s?p--:p++,a.__u|=4))):e.__k[i]=null;if(c)for(i=0;i<f;i++)(l=n[i])!=null&&!(2&l.__u)&&(l.__e==r&&(r=nn(l)),zs(l,l));return r}function As(e,t,n,r){var o,i;if(typeof e.type=="function"){for(o=e.__k,i=0;o&&i<o.length;i++)o[i]&&(o[i].__=e,t=As(o[i],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=nn(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function tg(e,t,n,r){var o,i,a,l=e.key,s=e.type,u=t[n],f=u!=null&&(2&u.__u)==0;if(u===null&&l==null||f&&l==u.key&&s==u.type)return n;if(r>(f?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((u=t[a=o>=0?o--:i++])!=null&&!(2&u.__u)&&l==u.key&&s==u.type)return a}return-1}function Ki(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Zp.test(t)?n:n+"px"}function qn(e,t,n,r,o){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Ki(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Ki(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")i=t!=(t=t.replace(Ss,"$1")),a=t.toLowerCase(),t=a in e||t=="onFocusOut"||t=="onFocusIn"?a.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?r?n[kn]=r[kn]:(n[kn]=Co,e.addEventListener(t,i?to:eo,i)):e.removeEventListener(t,i?to:eo,i);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function Zi(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Gn]==null)t[Gn]=Co++;else if(t[Gn]<n[kn])return;return n(ke.event?ke.event(t):t)}}}function Mo(e,t,n,r,o,i,a,l,s,u){var f,c,p,h,d,m,v,g,S,_,x,w,b,M,P,N=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(s=!!(32&n.__u),i=[l=t.__e=n.__e]),(f=ke.__b)&&f(t);e:if(typeof N=="function")try{if(g=t.props,S=N.prototype&&N.prototype.render,_=(f=N.contextType)&&r[f.__c],x=f?_?_.props.value:f.__:r,n.__c?v=(c=t.__c=n.__c).__=c.__E:(S?t.__c=c=new N(g,x):(t.__c=c=new Vn(g,x),c.constructor=N,c.render=rg),_&&_.sub(c),c.state||(c.state={}),c.__n=r,p=c.__d=!0,c.__h=[],c._sb=[]),S&&c.__s==null&&(c.__s=c.state),S&&N.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=vt({},c.__s)),vt(c.__s,N.getDerivedStateFromProps(g,c.__s))),h=c.props,d=c.state,c.__v=t,p)S&&N.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),S&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(S&&N.getDerivedStateFromProps==null&&g!==h&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(g,x),t.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(g,c.__s,x)===!1){t.__v!=n.__v&&(c.props=g,c.state=c.__s,c.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(j){j&&(j.__=t)}),er.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&a.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(g,c.__s,x),S&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(h,d,m)})}if(c.context=x,c.props=g,c.__P=e,c.__e=!1,w=ke.__r,b=0,S)c.state=c.__s,c.__d=!1,w&&w(t),f=c.render(c.props,c.state,c.context),er.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,w&&w(t),f=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++b<25);c.state=c.__s,c.getChildContext!=null&&(r=vt(vt({},r),c.getChildContext())),S&&!p&&c.getSnapshotBeforeUpdate!=null&&(m=c.getSnapshotBeforeUpdate(h,d)),M=f!=null&&f.type===ur&&f.key==null?js(f.props.children):f,l=Ps(e,cr(M)?M:[M],t,n,r,o,i,a,l,s,u),c.base=t.__e,t.__u&=-161,c.__h.length&&a.push(c),v&&(c.__E=c.__=null)}catch(j){if(t.__v=null,s||i!=null)if(j.then){for(t.__u|=s?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;i[i.indexOf(l)]=null,t.__e=l}else{for(P=i.length;P--;)So(i[P]);no(t)}else t.__e=n.__e,t.__k=n.__k,j.then||no(t);ke.__e(j,t,n)}else i==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=ng(n.__e,t,n,r,o,i,a,s,u);return(f=ke.diffed)&&f(t),128&t.__u?void 0:l}function no(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(no))}function Os(e,t,n){for(var r=0;r<n.length;r++)Po(n[r],n[++r],n[++r]);ke.__c&&ke.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){ke.__e(i,o.__v)}})}function js(e){return typeof e!="object"||e==null||e.__b>0?e:cr(e)?e.map(js):vt({},e)}function ng(e,t,n,r,o,i,a,l,s){var u,f,c,p,h,d,m,v=n.props||Jn,g=t.props,S=t.type;if(S=="svg"?o="http://www.w3.org/2000/svg":S=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i!=null){for(u=0;u<i.length;u++)if((h=i[u])&&"setAttribute"in h==!!S&&(S?h.localName==S:h.nodeType==3)){e=h,i[u]=null;break}}if(e==null){if(S==null)return document.createTextNode(g);e=document.createElementNS(o,S,g.is&&g),l&&(ke.__m&&ke.__m(t,i),l=!1),i=null}if(S==null)v===g||l&&e.data==g||(e.data=g);else{if(i=i&&An.call(e.childNodes),!l&&i!=null)for(v={},u=0;u<e.attributes.length;u++)v[(h=e.attributes[u]).name]=h.value;for(u in v)h=v[u],u=="dangerouslySetInnerHTML"?c=h:u=="children"||u in g||u=="value"&&"defaultValue"in g||u=="checked"&&"defaultChecked"in g||qn(e,u,null,h,o);for(u in g)h=g[u],u=="children"?p=h:u=="dangerouslySetInnerHTML"?f=h:u=="value"?d=h:u=="checked"?m=h:l&&typeof h!="function"||v[u]===h||qn(e,u,h,v[u],o);if(f)l||c&&(f.__html==c.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(c&&(e.innerHTML=""),Ps(t.type=="template"?e.content:e,cr(p)?p:[p],t,n,r,S=="foreignObject"?"http://www.w3.org/1999/xhtml":o,i,a,i?i[0]:n.__k&&nn(n,0),l,s),i!=null)for(u=i.length;u--;)So(i[u]);l||(u="value",S=="progress"&&d==null?e.removeAttribute("value"):d!=null&&(d!==e[u]||S=="progress"&&!d||S=="option"&&d!=v[u])&&qn(e,u,d,v[u],o),u="checked",m!=null&&m!=e[u]&&qn(e,u,m,v[u],o))}return e}function Po(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){ke.__e(o,n)}}function zs(e,t,n){var r,o;if(ke.unmount&&ke.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Po(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){ke.__e(i,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&zs(r[o],t,n||typeof e.type!="function");n||So(e.__e),e.__c=e.__=e.__e=void 0}function rg(e,t,n){return this.constructor(e,n)}function og(e,t,n){var r,o,i,a;t==document&&(t=document.documentElement),ke.__&&ke.__(e,t),o=(r=!1)?null:t.__k,i=[],a=[],Mo(t,e=t.__k=Qp(ur,null,[e]),o||Jn,Jn,t.namespaceURI,o?null:t.firstChild?An.call(t.childNodes):null,i,o?o.__e:t.firstChild,r,a),Os(i,e,a)}function Ts(e,t,n){var r,o,i,a,l=vt({},e.props);for(i in e.type&&e.type.defaultProps&&(a=e.type.defaultProps),t)i=="key"?r=t[i]:i=="ref"?o=t[i]:l[i]=t[i]===void 0&&a!=null?a[i]:t[i];return arguments.length>2&&(l.children=arguments.length>3?An.call(arguments,2):n),Cn(e.type,l,r||e.key,o||e.ref,null)}An=er.slice,ke={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!o.__)try{if((i=o.constructor)&&i.getDerivedStateFromError!=null&&(o.setState(i.getDerivedStateFromError(e)),a=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),a=o.__d),a)return o.__E=o}catch(l){e=l}throw e}},xs=0,ws=function(e){return e!=null&&e.constructor===void 0},Vn.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=vt({},this.state),typeof e=="function"&&(e=e(vt({},n),this.props)),e&&vt(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Xi(this))},Vn.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Xi(this))},Vn.prototype.render=ur,At=[],ks=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Cs=function(e,t){return e.__v.__b-t.__v.__b},tr.__r=0,Rr=Math.random().toString(8),Gn="__d"+Rr,kn="__a"+Rr,Ss=/(PointerCapture)$|Capture$/i,Co=0,eo=Zi(!1),to=Zi(!0);function Qi(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ig(e){if(Array.isArray(e))return e}function ag(e,t,n){return(t=dg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function sg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function lg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
656
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ji(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function cg(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Ji(Object(n),!0).forEach(function(r){ag(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ji(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ug(e,t){return ig(e)||sg(e,t)||hg(e,t)||lg()}function fg(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function dg(e){var t=fg(e,"string");return typeof t=="symbol"?t:t+""}function nr(e){"@babel/helpers - typeof";return nr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nr(e)}function hg(e,t){if(e){if(typeof e=="string")return Qi(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Qi(e,t):void 0}}var ro=function(t){if(nr(t)!=="object")return t;var n=Ts(t);if(n.props){var r;n.props=cg({},n.props),n!=null&&(r=n.props)!==null&&r!==void 0&&r.children&&(n.props.children=Array.isArray(n.props.children)?n.props.children.map(ro):ro(n.props.children))}return n},pg=function(t){return ws(Ts(t))},gg=function(t,n){delete n.__k,og(ro(t),n)};function vg(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var yg=`.float-tooltip-kap {
657
657
  position: absolute;
658
658
  width: max-content; /* prevent shrinking near right edge */
659
659
  max-width: max(50%, 150px);
@@ -664,7 +664,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
664
664
  background: rgba(0,0,0,0.6);
665
665
  pointer-events: none;
666
666
  }
667
- `;sg(lg);var cg=fo({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.style,i=o===void 0?{}:o,a=!!t&&qn(t)==="object"&&!!t.node&&typeof t.node=="function",s=Fp(a?t.node():t);s.style("position")==="static"&&s.style("position","relative"),n.tooltipEl=s.append("div").attr("class","float-tooltip-kap"),Object.entries(i).forEach(function(c){var f=tg(c,2),u=f[0],v=f[1];return n.tooltipEl.style(u,v)}),n.tooltipEl.style("left","-10000px").style("display","none");var l="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,s.on("mousemove.".concat(l),function(c){n.mouseInside=!0;var f=$p(c),u=s.node(),v=u.offsetWidth,h=u.offsetHeight,p=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/v*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(p.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseover.".concat(l),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),s.on("mouseout.".concat(l),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):ig(t.content)?(t.tooltipEl.text(""),ag(t.content,t.tooltipEl.node())):(t.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",t.content,t.content.toString())):t.tooltipEl.text("")}});function ug(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var fg=`.scene-nav-info {
667
+ `;vg(yg);var mg=_o({props:{content:{default:!1},offsetX:{triggerUpdate:!1},offsetY:{triggerUpdate:!1}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.style,i=o===void 0?{}:o,a=!!t&&nr(t)==="object"&&!!t.node&&typeof t.node=="function",l=Yp(a?t.node():t);l.style("position")==="static"&&l.style("position","relative"),n.tooltipEl=l.append("div").attr("class","float-tooltip-kap"),Object.entries(i).forEach(function(u){var f=ug(u,2),c=f[0],p=f[1];return n.tooltipEl.style(c,p)}),n.tooltipEl.style("left","-10000px").style("display","none");var s="tooltip-".concat(Math.round(Math.random()*1e12));n.mouseInside=!1,l.on("mousemove.".concat(s),function(u){n.mouseInside=!0;var f=Kp(u),c=l.node(),p=c.offsetWidth,h=c.offsetHeight,d=[n.offsetX===null||n.offsetX===void 0?"-".concat(f[0]/p*100,"%"):typeof n.offsetX=="number"?"calc(-50% + ".concat(n.offsetX,"px)"):n.offsetX,n.offsetY===null||n.offsetY===void 0?h>130&&h-f[1]<100?"calc(-100% - 6px)":"21px":typeof n.offsetY=="number"?n.offsetY<0?"calc(-100% - ".concat(Math.abs(n.offsetY),"px)"):"".concat(n.offsetY,"px"):n.offsetY];n.tooltipEl.style("left",f[0]+"px").style("top",f[1]+"px").style("transform","translate(".concat(d.join(","),")")),n.content&&n.tooltipEl.style("display","inline")}),l.on("mouseover.".concat(s),function(){n.mouseInside=!0,n.content&&n.tooltipEl.style("display","inline")}),l.on("mouseout.".concat(s),function(){n.mouseInside=!1,n.tooltipEl.style("display","none")})},update:function(t){t.tooltipEl.style("display",t.content&&t.mouseInside?"inline":"none"),t.content?t.content instanceof HTMLElement?(t.tooltipEl.text(""),t.tooltipEl.append(function(){return t.content})):typeof t.content=="string"?t.tooltipEl.html(t.content):pg(t.content)?(t.tooltipEl.text(""),gg(t.content,t.tooltipEl.node())):(t.tooltipEl.style("display","none"),console.warn("Tooltip content is invalid, skipping.",t.content,t.content.toString())):t.tooltipEl.text("")}});function bg(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(typeof document>"u")){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",n==="top"&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var _g=`.scene-nav-info {
668
668
  position: absolute;
669
669
  bottom: 5px;
670
670
  width: 100%;
@@ -679,7 +679,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
679
679
 
680
680
  .scene-container canvas:focus {
681
681
  outline: none;
682
- }`;ug(fg);function Kr(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function dg(e){if(Array.isArray(e))return e}function hg(e){if(Array.isArray(e))return Kr(e)}function pg(e,t,n){return(t=xg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function gg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function vg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,s=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(l=(r=i.call(n)).done)&&(s.push(r.value),s.length!==t);l=!0);}catch(f){c=!0,o=f}finally{try{if(!l&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw o}}return s}}function yg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
683
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
684
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bg(e,t){return dg(e)||vg(e,t)||ws(e,t)||yg()}function wt(e){return hg(e)||gg(e)||ws(e)||mg()}function _g(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function xg(e){var t=_g(e,"string");return typeof t=="symbol"?t:t+""}function ws(e,t){if(e){if(typeof e=="string")return Kr(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Kr(e,t):void 0}}var ks=function(t){t instanceof Array?t.forEach(ks):(t.map&&t.map.dispose(),t.dispose())},Cs=function(t){t.geometry&&t.geometry.dispose(),t.material&&ks(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(Cs)},wg=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),Cs(n)}},pe=window.THREE?window.THREE:{WebGLRenderer:Z.WebGLRenderer,Scene:Z.Scene,PerspectiveCamera:Z.PerspectiveCamera,Raycaster:Z.Raycaster,SRGBColorSpace:Z.SRGBColorSpace,TextureLoader:Z.TextureLoader,Vector2:Z.Vector2,Vector3:Z.Vector3,Box3:Z.Box3,Color:Z.Color,Mesh:Z.Mesh,SphereGeometry:Z.SphereGeometry,MeshBasicMaterial:Z.MeshBasicMaterial,BackSide:Z.BackSide,Timer:Z.Timer},Ss=fo({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var o=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&o.sort(function(a,s){return t.hoverOrderComparator(a.object,s.object)});var i=o.find(function(a){return t.hoverFilter(a.object)})||null;r=i?i.object:null,t.intersection=i||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&le(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,o=n.y;return{x:r,y:o}},cameraPosition:function(t,n,r,o){var i=t.camera;if(n&&t.initialised){var a=n,s=r||{x:0,y:0,z:0};if(!o)f(a),u(s);else{var l=Object.assign({},i.position),c=v();t.tweenGroup.add(new Di(l).to(a,o).easing(St.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new Di(c).to(s,o/3).easing(St.Quadratic.Out).onUpdate(u).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},i.position,{lookAt:v()});function f(h){var p=h.x,g=h.y,y=h.z;p!==void 0&&(i.position.x=p),g!==void 0&&(i.position.y=g),y!==void 0&&(i.position.z=y)}function u(h){var p=new pe.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=p:i.lookAt(p)}function v(){return Object.assign(new pe.Vector3(0,0,-1e3).applyQuaternion(i.quaternion).add(i.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,i),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,i=t.camera;if(n){var a=new pe.Vector3(0,0,0),s=Math.max.apply(Math,wt(Object.entries(n).map(function(h){var p=bg(h,2),g=p[0],y=p[1];return Math.max.apply(Math,wt(y.map(function(d){return Math.abs(a[g]-d)})))})))*2,l=(1-o*2/t.height)*i.fov,c=s/Math.atan(l*Math.PI/180),f=c/i.aspect,u=Math.max(c,f);if(u>0){var v=a.clone().sub(i.position).normalize().multiplyScalar(-u);this.cameraPosition(v,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new pe.Box3(new pe.Vector3(0,0,0),new pe.Vector3(0,0,0)),o=t.objects.filter(n);return o.length?(o.forEach(function(i){return r.expandByObject(i)}),Object.assign.apply(Object,wt(["x","y","z"].map(function(i){return pg({},i,[r.min[i],r.max[i]])})))):null},getScreenCoords:function(t,n,r,o){var i=new pe.Vector3(n,r,o);return i.project(this.camera()),{x:(i.x+1)*t.width/2,y:-(i.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=new pe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new pe.Raycaster;return a.setFromCamera(i,t.camera),Object.assign({},a.ray.at(o,new pe.Vector3))},intersectingObjects:function(t,n,r){var o=new pe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),i=new pe.Raycaster;return i.params.Line.threshold=t.lineHoverPrecision,i.params.Points.threshold=t.pointsHoverPrecision,i.setFromCamera(o,t.camera),i.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,o;wg(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(o=t.postProcessingComposer)===null||o===void 0||o.dispose()}},stateInit:function(){return{scene:new pe.Scene,camera:new pe.PerspectiveCamera,timer:new pe.Timer,tweenGroup:new Qa,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.controlType,i=o===void 0?"trackball":o,a=r.useWebGPU,s=a===void 0?!1:a,l=r.rendererConfig,c=l===void 0?{}:l,f=r.extraRenderers,u=f===void 0?[]:f,v=r.waitForLoadComplete,h=v===void 0?!0:v;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new cg(n.container),n.pointerPos=new pe.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(p){return n.container.addEventListener(p,function(g){if(p==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&g.type==="pointermove"&&(g.pressure>0||n.isPointerPressed)&&(g.pointerType==="mouse"||g.movementX===void 0||[g.movementX,g.movementY].some(function(m){return Math.abs(m)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var y=d(n.container);n.pointerPos.x=g.pageX-y.left,n.pointerPos.y=g.pageY-y.top}function d(m){var b=m.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:b.top+w,left:b.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(p){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){p.button===0&&n.onClick(n.hoverObj||null,p,n.intersection),p.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,p,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(p){n.onRightClick&&p.preventDefault()}),n.renderer=new(s?ul.WebGPURenderer:pe.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},c)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=u,n.extraRenderers.forEach(function(p){p.domElement.style.position="absolute",p.domElement.style.top="0px",p.domElement.style.pointerEvents="none",n.container.appendChild(p.domElement)}),n.postProcessingComposer=new pl.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new gl.RenderPass(n.scene,n.camera)),n.controls=new{trackball:fl.TrackballControls,orbit:dl.OrbitControls,fly:hl.FlyControls}[i](n.camera,n.renderer.domElement),i==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(i==="trackball"||i==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(wt(n.extraRenderers)).forEach(function(p){return p.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new pe.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,o=t.width,i=t.height;t.container.style.width="".concat(o,"px"),t.container.style.height="".concat(i,"px"),[t.renderer,t.postProcessingComposer].concat(wt(t.extraRenderers)).forEach(function(h){return h.setSize(o,i)}),t.camera.aspect=o/i;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[o,i].concat(wt(a),[o,i])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var s,l=t.width,c=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(s=t.camera).setViewOffset.apply(s,[l,c].concat(wt(f),[l,c])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new pe.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var u=Ht(t.backgroundColor).alpha;u===void 0&&(u=1),t.renderer.setClearColor(new pe.Color(Yd(1,t.backgroundColor)),u)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new pe.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=pe.SRGBColorSpace,t.skysphere.material=new pe.MeshBasicMaterial({map:h,side:pe.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&v()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&v())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function v(){t.loadComplete=t.scene.visible=!0}}});function kg(e,t){let n=null,r=null;const o=(...i)=>{r=i,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return o.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},o}class Cg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function Sg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:o={},init:i=()=>{},update:a=()=>{}}=e,s=Object.keys(n).map(c=>new Cg(c,n[c]));function l(...c){const f=this instanceof l,u=c.slice(),v=f?u.shift():void 0,h=u[0]??{},p=typeof t=="function"?t(h):t,g=Object.assign({},p,{initialised:!1,_rerender:()=>{}});let y={};const d=x=>(m(x,h),b(),d);function m(x,w){i.call(d,x,g,w),g.initialised=!0}const b=kg(()=>{g.initialised&&(a.call(d,g,y),y={})},1);for(const x of s){const{name:w,triggerUpdate:_,onChange:k,defaultVal:S}=x;d[w]=function(){const O=g[w];if(arguments.length===0)return O;const E=arguments[0],T=E===void 0?S:E;return g[w]=T,k.call(d,T,g,O),Object.prototype.hasOwnProperty.call(y,w)||(y[w]=O),_&&b(),d}}for(const x of Object.keys(r))d[x]=function(...w){return r[x].call(d,g,...w)};for(const[x,w]of Object.entries(o))d[x]=d[w];return d.resetProps=function(){for(const x of s)d[x.name](x.defaultVal);return d},d.resetProps(),g._rerender=b,f&&v!==void 0&&d(v),d}return l}function qi(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function Ms(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(o){return{default:r[o](),onChange(i,a){n.forEach(s=>{a[s][o].call(a[s],i)})},triggerUpdate:!1}},linkMethod(o){return function(i,...a){const s=[];return n.forEach(l=>{const c=i[l],f=c[o].apply(c,a);f!==c&&s.push(f)}),s.length?s[0]:this}}}}const Gi=globalThis,Vi=Gi.THREE?Gi.THREE:{AmbientLight:Z.AmbientLight,DirectionalLight:Z.DirectionalLight},Mg=170,Ps=Ms("forceGraph",Ga),Pg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],Og=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],Jn=Ms("renderObjs",Ss),Ag=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],jg=["lights","cameraPosition","postProcessingComposer"],_o={};for(const e of Pg)_o[e]=Ps.linkProp(e);for(const e of Ag)_o[e]=Jn.linkProp(e);const mn={};for(const e of Og)mn[e]=Ps.linkMethod(e);for(const e of jg)mn[e]=Jn.linkMethod(e);mn.graph2ScreenCoords=Jn.linkMethod("getScreenCoords");mn.screen2GraphCoords=Jn.linkMethod("getSceneCoords");const $e=e=>e;function at(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const Tg=Sg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){$e(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=$e(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},..._o},methods:{zoomToFit(e,t,n,...r){return $e(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=$e(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return $e(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=$e(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return $e(e).renderObjs.scene()},camera(e){return $e(e).renderObjs.camera()},renderer(e){return $e(e).renderObjs.renderer()},controls(e){return $e(e).renderObjs.controls()},_destructor(e){const t=$e(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...mn},stateInit:e=>{const t=e??{},n=new Ga,r=Ss({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new Vi.AmbientLight(13421772,Math.PI),new Vi.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=$e(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const o=n.renderObjs.camera(),i=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=o.position.z;const s=document.createElement("div");s.className="graph-info-msg",s.textContent="",n.container.appendChild(s);const l=n.forceGraph;l.onLoading(()=>{s.textContent="Loading..."}),l.onFinishLoading(()=>{s.textContent=""}),l.onUpdate(()=>{if(n.graphData=l.graphData(),o.position.x===0&&o.position.y===0&&o.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){o.lookAt(l.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*Mg;o.position.z=f,n.lastSetCameraZ=f}}),l.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(u=>u.__initialFixedPos&&!u.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),u=new cl.DragControls(f,o,i.domElement);n._dragControls=u,u.addEventListener("dragstart",h=>{const p=h,g=at(p.object);if(!g)return;a&&(a.enabled=!1),p.object.__initialPos=p.object.position.clone(),p.object.__prevPos=p.object.position.clone();const y=g.__data;y.__initialFixedPos||(y.__initialFixedPos={fx:y.fx,fy:y.fy,fz:y.fz}),y.__initialPos||(y.__initialPos={x:y.x,y:y.y,z:y.z});for(const d of["x","y","z"])y[`f${d}`]=y[d];i.domElement.classList.add("grabbable")});const v=4;u.addEventListener("drag",h=>{const p=h,g=at(p.object);if(!g)return;if(!Object.prototype.hasOwnProperty.call(p.object,"__graphObjType")){const b=p.object.__initialPos,x=p.object.__prevPos,w=p.object.position,_=w.clone().sub(x);g.position.add(_),x.copy(w),w.copy(b)}const y=g.__data,d=g.position;if(!y.__dragCommitted){const b=y.__initialPos,x=b?.x??d.x,w=b?.y??d.y,_=b?.z??d.z,k=d.x-x,S=d.y-w,A=d.z-_;if(k*k+S*S+A*A<v)return;y.__dragCommitted=!0}const m={x:d.x-(y.x??0),y:d.y-(y.y??0),z:d.z-(y.z??0)};for(const b of["x","y","z"])y[`f${b}`]=d[b],y[b]=d[b];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),y.__dragged=!0,n.onNodeDrag?.(y,m)}),u.addEventListener("dragend",h=>{const p=h,g=at(p.object);if(!g)return;delete p.object.__initialPos,delete p.object.__prevPos;const y=g.__data;y.__disposeControlsAfterDrag&&(u.dispose(),delete y.__disposeControlsAfterDrag);const d=y.__initialFixedPos,m=y.__initialPos,b=m?{x:m.x-y.x,y:m.y-y.y,z:m.z-y.z}:{x:0,y:0,z:0};if(d){for(const x of["x","y","z"]){const w=`f${x}`;d[w]===void 0&&delete y[w]}delete y.__initialFixedPos,delete y.__initialPos,delete y.__dragCommitted,y.__dragged&&(delete y.__dragged,n.onNodeDragEnd?.(y,b))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status!==void 0&&(a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"})))),i.domElement.classList.remove("grabbable")})}}),parseInt(Z.REVISION,10)<155&&(i.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,u)=>{const v=at(f);if(!v)return 1;const h=at(u);if(!h)return-1;const p=g=>g.__graphObjType==="node"?1:0;return p(h)-p(v)}).tooltipContent(f=>{const u=at(f);if(!u)return"";const v=n[`${u.__graphObjType}Label`];return qi(v)(u.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const u=at(f);if(u===n.hoverObj)return;const v=n.hoverObj??null,h=v?v.__graphObjType:null,p=v?v.__data:null,g=u?u.__graphObjType:null,y=u?u.__data:null;if(h&&h!==g){const b=n[`on${h==="node"?"Node":"Link"}Hover`];b?.(null,p)}if(g){const b=n[`on${g==="node"?"Node":"Link"}Hover`];b?.(y,h===g?p:null)}const m=!!(u?n[`on${g==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&qi(n.showPointerCursor)(y);i.domElement.classList[m?"add":"remove"]("clickable"),n.hoverObj=u}).clickAfterDrag(!1).onClick((f,u)=>{const v=at(f);if(v){const h=n[`on${v.__graphObjType==="node"?"Node":"Link"}Click`];h?.(v.__data,u)}else n.onBackgroundClick&&n.onBackgroundClick(u)}).onRightClick((f,u)=>{const v=at(f);if(v){const h=n[`on${v.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(v.__data,u)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(u)}),this._animationCycle()},update(){}});function kt(e,t,n,r=Eg){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const o=performance.now();let i=null,a=!1;const s=l=>{if(a)return;const c=l-o,f=Math.min(1,c/Math.max(e,1));t(r(f)),f<1?i=requestAnimationFrame(s):i=null};return i=requestAnimationFrame(s),()=>{a=!0,i!==null&&cancelAnimationFrame(i),i=null}}function Eg(e){return 1-(1-e)*(1-e)}function Wi(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function ne(e,t,n){return e+(t-e)*n}const re=()=>!0,He=e=>e==="2d",be=e=>e==="3d",Lg=[{key:"nodeId",setter:"nodeId",supports:re},{key:"linkSource",setter:"linkSource",supports:re},{key:"linkTarget",setter:"linkTarget",supports:re},{key:"backgroundColor",setter:"backgroundColor",supports:re},{key:"nodeColor",setter:"nodeColor",supports:re},{key:"nodeLabel",setter:"nodeLabel",supports:re},{key:"nodeVal",setter:"nodeVal",supports:re},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:re},{key:"nodeRelSize",setter:"nodeRelSize",supports:re},{key:"nodeVisibility",setter:"nodeVisibility",supports:re},{key:"linkColor",setter:"linkColor",supports:re},{key:"linkLabel",setter:"linkLabel",supports:re},{key:"linkWidth",setter:"linkWidth",supports:re},{key:"linkCurvature",setter:"linkCurvature",supports:re},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:re},{key:"linkVisibility",setter:"linkVisibility",supports:re},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:re},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:re},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:re},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:re},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:re},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:re},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:re},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:re},{key:"cooldownTicks",setter:"cooldownTicks",supports:re},{key:"cooldownTime",setter:"cooldownTime",supports:re},{key:"warmupTicks",setter:"warmupTicks",supports:re},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:re},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:re},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:re},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:re},{key:"dagMode",setter:"dagMode",supports:re},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:re},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:re},{key:"onDagError",setter:"onDagError",supports:re},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:re},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:re},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:re},{key:"showPointerCursor",setter:"showPointerCursor",supports:re},{key:"enableZoom",setter:"enableZoomInteraction",supports:He},{key:"enablePan",setter:"enablePanInteraction",supports:He},{key:"minZoom",setter:"minZoom",supports:He},{key:"maxZoom",setter:"maxZoom",supports:He},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:He},{key:"linkLineDash",setter:"linkLineDash",supports:He},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:He},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:He},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:He},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:He},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:He},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:He},{key:"showNavInfo",setter:"showNavInfo",supports:be},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:be},{key:"nodeOpacity",setter:"nodeOpacity",supports:be},{key:"nodeResolution",setter:"nodeResolution",supports:be},{key:"linkOpacity",setter:"linkOpacity",supports:be},{key:"linkResolution",setter:"linkResolution",supports:be},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:be},{key:"linkMaterial",setter:"linkMaterial",supports:be},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:be},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:be},{key:"linkThreeObject",setter:"linkThreeObject",supports:be},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:be},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:be},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:be},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:be},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:be},{key:"numDimensions",setter:"numDimensions",supports:be},{key:"forceEngine",setter:"forceEngine",supports:be},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:be},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:be}];function Xi(e,t,n,r){if(t!==n)for(const o of Lg){if(!o.supports(r))continue;const i=t[o.key],a=n[o.key];if(Object.is(i,a))continue;const s=e[o.setter];typeof s=="function"&&s.call(e,i)}}const Rg=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],Rt=1200,Nt=300;function Ng(e,t,n){const r=new Tg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);for(const g of Rg){const y=r[g];typeof y=="function"&&y.call(r,(...d)=>{const m=n.current[g];typeof m=="function"&&m(...d)})}Xi(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let o=t.initialMode,i=o==="2d"?Rt:Nt,a=null,s=null;const l=g=>{const y=r.controls?.();if(!y)return;const d=y;g==="2d"?(d.noRotate=!0,d.enableRotate=!1,d.zoomToCursor=!0,d.screenSpacePanning=!0,d.zoomSpeed=1.6,d.panSpeed=1.2,d.mouseButtons&&(d.mouseButtons.LEFT=Z.MOUSE.PAN)):(d.noRotate=!1,d.enableRotate=!0,d.zoomToCursor=!1,d.screenSpacePanning=!1,d.zoomSpeed=1,d.panSpeed=1,d.mouseButtons&&(d.mouseButtons.LEFT=Z.MOUSE.ROTATE))},c=()=>{const g=r.graphData();for(const y of g.nodes)y.fz=0},f=()=>{const g=r.graphData();for(const y of g.nodes)delete y.fz},u=()=>{const g=r.graphData(),y=new Map;let d=0;for(const b of g.nodes){const x=b.x??0,w=b.y??0,_=Math.hypot(x,w);_>d&&(d=_)}const m=Math.max(40,d*.6);for(const b of g.nodes)y.set(b,(Math.random()-.5)*2*m);return y};o==="2d"?(c(),l("2d"),r.cameraPosition?.({x:0,y:0,z:Rt},{x:0,y:0,z:0},0)):(l("3d"),r.cameraPosition?.({x:0,y:0,z:Nt},{x:0,y:0,z:0},0));const v=()=>r.cameraPosition?.();return{get mode(){return o},setGraphData(g){r.graphData(g),o==="2d"&&c()},getGraphData(){return r.graphData()},fit(g,y){s?.();const d=g??400,m=y??40,b=r.getGraphBbox?.();if(!b)return;const x=r.camera?.()??{},w=x.fov??50,_=r.width?.()??t.width,k=r.height?.()??t.height;if(_<=0||k<=0)return;const S=Math.max(1,_-2*m),A=Math.max(1,k-2*m),O=x.aspect??_/k,E={x:(b.x[0]+b.x[1])/2,y:(b.y[0]+b.y[1])/2,z:(b.z[0]+b.z[1])/2},T=Math.max((b.x[1]-b.x[0])/2,1),I=Math.max((b.y[1]-b.y[0])/2,1),C=Math.max((b.z[1]-b.z[0])/2,0),P=w*Math.PI/180/2,R=Math.tan(P),H=60,V=v();if(!V)return;let X;const oe={x:E.x,y:E.y,z:E.z};if(o==="2d"){const F=I*k/A/R,W=T*k/S/R,Q=Math.max(F,W,H);X={x:E.x,y:E.y,z:E.z+Q},i=Q}else{const F=Math.hypot(T,I,C),W=Math.atan(R*O),Q=F*k/(A*Math.sin(P)),N=F*_/(S*Math.sin(W)),U=Math.max(Q,N,H),z=V.lookAt??{x:0,y:0,z:0},G=V.x-z.x,q=V.y-z.y,$=V.z-z.z,B=Math.hypot(G,q,$),te=B===0?{x:0,y:0,z:1}:{x:G/B,y:q/B,z:$/B};X={x:E.x+te.x*U,y:E.y+te.y*U,z:E.z+te.z*U},i=U}if(d<=0){r.cameraPosition?.(X,oe,0);return}const D=V.lookAt??{x:0,y:0,z:0};s=kt(d,F=>{r.cameraPosition?.({x:ne(V.x,X.x,F),y:ne(V.y,X.y,F),z:ne(V.z,X.z,F)},{x:ne(D.x,oe.x,F),y:ne(D.y,oe.y,F),z:ne(D.z,oe.z,F)},0)})},centerAt(g,y,d,m){if(o==="2d"){r.cameraPosition?.({x:g,y,z:Rt},{x:g,y,z:0},m??0);return}const b=v();r.cameraPosition?.({x:g,y,z:d??i},b?.lookAt,m??0)},zoom(g,y){const d=v();if(!d)return;const m=Math.hypot(d.x,d.y,d.z);i=m/Math.max(g,.001);const b=m===0?{x:0,y:0,z:1}:{x:d.x/m,y:d.y/m,z:d.z/m};r.cameraPosition?.({x:b.x*i,y:b.y*i,z:b.z*i},d.lookAt,y??0)},getZoom(){const g=v();if(!g)return 1;const y=Math.hypot(g.x,g.y,g.z);return y===0?1:i/y},screen2Graph(g,y,d){return r.screen2GraphCoords?.(g,y,d??0)??{x:g,y,z:0}},graph2Screen(g,y,d){return r.graph2ScreenCoords?.(g,y,d??0)??{x:g,y,z:d??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(g,y){r.width(g),r.height(y)},d3Force(g,y){const d=r.d3Force;if(typeof d=="function")return y===void 0?d.call(r,g):d.call(r,g,y)},emitParticle(g){r.emitParticle?.(g)},stopAnimation(){s?.(),s=null},focusOn(g,y){s?.();const d=v();if(!d)return;const m=g.z??0,b=y?.durationMs??1e3;if(o==="2d"){const I=y?.zoom!==void 0?i/Math.max(y.zoom,.001):Rt;s=kt(b,C=>{const P=ne(d.x,g.x,C),R=ne(d.y,g.y,C),H=ne(d.z,I,C);r.cameraPosition?.({x:P,y:R,z:H},{x:P,y:R,z:0},0)});return}const x=d.x-g.x,w=d.y-g.y,_=d.z-m,k=Math.hypot(x,w,_),S=y?.distance??120,A=k===0?{x:0,y:0,z:1}:{x:x/k,y:w/k,z:_/k},O={x:g.x+A.x*S,y:g.y+A.y*S,z:m+A.z*S},E={x:g.x,y:g.y,z:m},T=d.lookAt??{x:0,y:0,z:0};s=kt(b,I=>{r.cameraPosition?.({x:ne(d.x,O.x,I),y:ne(d.y,O.y,I),z:ne(d.z,O.z,I)},{x:ne(T.x,E.x,I),y:ne(T.y,E.y,I),z:ne(T.z,E.z,I)},0)})},getCameraState(){const g=v()??{x:0,y:0,z:Nt};if(o==="2d"){const y=g.lookAt??{x:0,y:0},d=i/Math.max(Math.hypot(g.x,g.y,g.z),1);return{mode:"2d",x:y.x,y:y.y,k:d}}return{mode:"3d",x:g.x,y:g.y,z:g.z,lookAt:g.lookAt??{x:0,y:0,z:0}}},setCameraState(g,y){s?.();const d=y??0,m=v()??{x:0,y:0,z:Nt};if(g.mode==="2d"){const x=p(g.k)??Rt;if(d<=0){r.cameraPosition?.({x:g.x,y:g.y,z:x},{x:g.x,y:g.y,z:0},0);return}const w=m.lookAt??{x:0,y:0};s=kt(d,_=>{const k=ne(m.x,g.x,_),S=ne(m.y,g.y,_),A=ne(m.z,x,_);r.cameraPosition?.({x:k,y:S,z:A},{x:ne(w.x,g.x,_),y:ne(w.y,g.y,_),z:0},0)});return}if(d<=0){r.cameraPosition?.({x:g.x,y:g.y,z:g.z},g.lookAt,0);return}const b=m.lookAt??g.lookAt;s=kt(d,x=>{r.cameraPosition?.({x:ne(m.x,g.x,x),y:ne(m.y,g.y,x),z:ne(m.z,g.z,x)},{x:ne(b.x,g.lookAt.x,x),y:ne(b.y,g.lookAt.y,x),z:ne(b.z,g.lookAt.z,x)},0)})},applyProps(g,y){Xi(r,g,y,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(g,y=800){if(g===o)return;o=g,s?.();const d=v()??{x:0,y:0,z:Nt};if(g==="2d"){a={x:d.x,y:d.y,z:d.z,lookAt:d.lookAt??{x:0,y:0,z:0}};const T=r.graphData(),I=new Map;for(const V of T.nodes){const X=V.z;I.set(V,typeof X=="number"?X:0)}const C=d.lookAt??{x:0,y:0,z:0},P={x:C.x,y:C.y,z:0},R=Math.hypot(d.x-C.x,d.y-C.y,d.z-C.z)||Rt,H={x:C.x,y:C.y,z:C.z+R};s=kt(y,V=>{for(const[X,oe]of I)X.z=ne(oe,0,V);r.cameraPosition?.({x:ne(d.x,H.x,V),y:ne(d.y,H.y,V),z:ne(d.z,H.z,V)},{x:ne(C.x,P.x,V),y:ne(C.y,P.y,V),z:ne(C.z,P.z,V)},0),V>=1&&(c(),l("2d"),i=R)},void 0,Wi);return}f(),l("3d");const m=u(),b=new Map;for(const[T]of m){const I=T.z;b.set(T,typeof I=="number"?I:0)}const x=d.lookAt??{x:0,y:0,z:0},w=d.x-x.x,_=d.y-x.y,k=d.z-x.z,S=Math.hypot(w,_,k)||Nt,A=Math.PI/6,O=a??{x:x.x,y:x.y-S*Math.sin(A),z:x.z+S*Math.cos(A),lookAt:{...x}},E=O.lookAt??{x:0,y:0,z:0};s=kt(y,T=>{for(const[I,C]of m){const P=b.get(I)??0;I.z=ne(P,C,T)}r.cameraPosition?.({x:ne(d.x,O.x,T),y:ne(d.y,O.y,T),z:ne(d.z,O.z,T)},{x:ne(x.x,E.x,T),y:ne(x.y,E.y,T),z:ne(x.z,E.z,T)},0),T>=1&&(r.d3ReheatSimulation?.(),i=Math.hypot(O.x-E.x,O.y-E.y,O.z-E.z))},void 0,Wi)}};function p(g){return!Number.isFinite(g)||g===0?null:i/g}}function Dg(e){const{mount:t,mode:n,width:r,height:o,data:i,props:a,paused:s,modeTransitionMs:l=800}=e,[c,f]=M.useState(null),u=M.useRef(a);u.current=a;const v=M.useRef(a),h=M.useRef(n);return M.useEffect(()=>{if(!t)return;const p=Ng(t,{initialProps:a,initialData:i,width:r,height:o,initialMode:h.current},u);return v.current=a,f(p),()=>{p.destroy(),f(null)}},[t]),M.useEffect(()=>{c&&c.mode!==n&&c.setMode(n,l)},[c,n,l]),M.useEffect(()=>{c&&(s?c.pause():c.resume())},[c,s]),M.useEffect(()=>{c&&c.resize(r,o)},[c,r,o]),M.useEffect(()=>{c&&c.setGraphData(i)},[c,i]),M.useEffect(()=>{c&&(c.applyProps(a,v.current),v.current=a)},[c,a]),c}function zg(e){const[t,n]=M.useState(null);return M.useEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(i=>{const a=i[0];if(!a)return;const s=a.contentRect;n({width:s.width,height:s.height})});return o.observe(r),()=>o.disconnect()},[e]),t}function Ig(e){const t=e.mode??"single",[n,r]=M.useState([]),o=M.useRef(e.onChange);o.current=e.onChange;const i=M.useRef(!0);M.useEffect(()=>{if(i.current){i.current=!1;return}o.current?.(n)},[n]);const a=M.useCallback((f,u)=>{t!=="none"&&r(v=>{const h=v.includes(f);return t==="single"||!u?.additive?h&&v.length===1?[]:[f]:h?v.filter(p=>p!==f):[...v,f]})},[t]),s=M.useCallback(f=>{t!=="none"&&r(t==="single"?f.slice(0,1):f)},[t]),l=M.useCallback(()=>r([]),[]),c=M.useCallback(f=>n.includes(f),[n]);return{selected:n,toggle:a,set:s,clear:l,isSelected:c}}function Fg(){const[e,t]=M.useState(!1);return M.useEffect(()=>{const n=i=>{i.key==="Shift"&&t(!0)},r=i=>{i.key==="Shift"&&t(!1)},o=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",o),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",o)}},[]),e}function Bg(e,t){const n=M.useRef(!1);M.useEffect(()=>{if(!e)return;!n.current&&t.nodes.length>0&&Object.isFrozen(t.nodes[0])&&(n.current=!0,console.warn("[lora-graph-canvas] autoIndexNeighbors is enabled but node objects appear to be frozen. The hover-highlight index needs to mutate nodes to attach `_neighbors`/`_links`. Either pass `autoIndexNeighbors={false}` (and `highlightNeighborsOnHover={false}`) or supply mutable node objects."));const r=new Map;for(const o of t.nodes)r.set(o.id,o),o._neighbors=[],o._links=[];for(const o of t.links){const i=typeof o.source=="object"?o.source.id:o.source,a=typeof o.target=="object"?o.target.id:o.target,s=r.get(i),l=r.get(a);!s||!l||(s._neighbors.push(l),l._neighbors.push(s),s._links.push(o),l._links.push(o))}},[e,t])}function $g(e){const{mount:t,engineRef:n,selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:s}=e,l=M.useRef({selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:s});l.current.selection=r,l.current.nodes=o,l.current.links=i,l.current.setSelectedLinkIds=a,l.current.liveHoverNodeIdRef=s;const[c,f]=M.useState(null),u=M.useRef(null),v=M.useRef({x:0,y:0}).current;return M.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const p=()=>{h=t.getBoundingClientRect()},g=new ResizeObserver(p);g.observe(t),window.addEventListener("scroll",p,{passive:!0,capture:!0});const y=x=>{v.x=x.clientX-h.left,v.y=x.clientY-h.top,u.current=v};t.addEventListener("mousemove",y);const d=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||l.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,_=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:_,x1:w,y1:_,additive:x.shiftKey});let k=null;const S=()=>{k===null&&(k=requestAnimationFrame(()=>{k=null;const E=n.current;E&&f(T=>{if(!T)return T;const I=Math.min(T.x0,T.x1),C=Math.min(T.y0,T.y1),P=Math.max(T.x0,T.x1),R=Math.max(T.y0,T.y1);if(P-I<4&&R-C<4){if(T.count===void 0)return T;const{count:V,...X}=T;return X}let H=0;for(const V of l.current.nodes){if(V.x===void 0||V.y===void 0)continue;const X=E.graph2Screen(V.x,V.y,V.z);X.x>=I&&X.x<=P&&X.y>=C&&X.y<=R&&H++}return T.count===H?T:{...T,count:H}})}))},A=E=>{const T=E.clientX-h.left,I=E.clientY-h.top;f(C=>C&&{...C,x1:T,y1:I}),S()},O=E=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",O,!0),k!==null&&(cancelAnimationFrame(k),k=null);const T=E.clientX-h.left,I=E.clientY-h.top;f(null);const C=n.current;if(!C)return;const P=Math.min(w,T),R=Math.min(_,I),H=Math.max(w,T),V=Math.max(_,I);if(H-P<3&&V-R<3)return;const X=l.current,oe=X.nodes,D=X.links,F=X.selection,W=X.setSelectedLinkIds,Q=[],N=($,B)=>$>=P&&$<=H&&B>=R&&B<=V,U=new Map;for(const $ of oe){if(U.set($.id,$),$.x===void 0||$.y===void 0)continue;const B=C.graph2Screen($.x,$.y,$.z);N(B.x,B.y)&&Q.push($.id)}const z=[],G=$=>{if($&&typeof $=="object"){const B=$;if(B.x!==void 0&&B.y!==void 0)return B.z!==void 0?{x:B.x,y:B.y,z:B.z}:{x:B.x,y:B.y}}if(typeof $=="string"||typeof $=="number"){const B=U.get($);if(B&&B.x!==void 0&&B.y!==void 0)return B.z!==void 0?{x:B.x,y:B.y,z:B.z}:{x:B.x,y:B.y}}return null};for(const $ of D){if($.id===void 0)continue;const B=G($.source),te=G($.target);if(!B||!te)continue;const ae=C.graph2Screen((B.x+te.x)/2,(B.y+te.y)/2,B.z!==void 0&&te.z!==void 0?(B.z+te.z)/2:void 0),ce=C.graph2Screen(B.x,B.y,B.z),ye=C.graph2Screen(te.x,te.y,te.z);(N(ae.x,ae.y)||N(ce.x,ce.y)&&N(ye.x,ye.y))&&z.push($.id)}if(E.shiftKey||E.metaKey||E.ctrlKey){const $=F.selected,B=$.slice(),te=new Set($);for(const ae of Q)te.has(ae)||(te.add(ae),B.push(ae));F.set(B),W(ae=>{const ce=ae.slice(),ye=new Set(ae);for(const fe of z)ye.has(fe)||(ye.add(fe),ce.push(fe));return ce})}else F.set(Q),W(z)};window.addEventListener("mousemove",A),window.addEventListener("mouseup",O,!0)};t.addEventListener("mousedown",d,!0);const m=()=>n.current?.stopAnimation(),b=()=>n.current?.stopAnimation();return t.addEventListener("wheel",m,{passive:!0,capture:!0}),t.addEventListener("touchstart",b,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",y),t.removeEventListener("mousedown",d,!0),t.removeEventListener("wheel",m,{capture:!0}),t.removeEventListener("touchstart",b,{capture:!0}),window.removeEventListener("scroll",p,{capture:!0}),g.disconnect()}},[t,n]),{marquee:c,lastCursorRef:u}}const Hg=60;function Ug(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,o=n.pressGraceMs??Hg;M.useEffect(()=>{if(!e)return;const i=r*r;let a=!1,s=!1,l=0,c=0,f=0;const u=p=>{e.contains(p.target)&&(a=!0,s=!1,l=p.clientX,c=p.clientY,f=performance.now())},v=p=>{if(!a||s)return;if(performance.now()-f<o){p.stopPropagation();return}const g=p.clientX-l,y=p.clientY-c;g*g+y*y<i?p.stopPropagation():s=!0},h=()=>{a=!1,s=!1};return window.addEventListener("pointerdown",u,!0),window.addEventListener("pointermove",v,!0),window.addEventListener("mousemove",v,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",u,!0),window.removeEventListener("pointermove",v,!0),window.removeEventListener("mousemove",v,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,o])}function qg(e){const{enableClipboard:t,dataApi:n,deleteGate:r,selection:o,setSelectedLinkIds:i,engineRef:a,lastCursorRef:s,onCopy:l,onCut:c,onPaste:f}=e,u=M.useRef([]),v=M.useCallback(()=>{const x=new Set(o.selected),w=[];for(const _ of n.data.nodes){if(!x.has(_.id))continue;const{id:k,x:S,y:A,z:O,vx:E,vy:T,vz:I,fx:C,fy:P,fz:R,...H}=_;w.push(H)}return w},[n.data.nodes,o.selected]),h=M.useCallback(()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(_=>x.has(_.id));return u.current=v(),l?.(w),w},[t,n.data.nodes,o.selected,v,l]),p=M.useCallback(async()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(k=>x.has(k.id));return w.length===0?[]:await r.requestNodeDelete(o.selected,"cut")?(u.current=v(),c?.(w),w):[]},[t,n,r,o,v,c]),g=M.useCallback(x=>{if(!t)return[];const w=u.current;if(w.length===0)return[];const _=x||(()=>{const S=s.current;if(!(!S||!a.current))return a.current.screen2Graph(S.x,S.y)})(),k=n.addNodes(w.map((S,A)=>{const O=A%3*24,E=Math.floor(A/3)*24;return{...S,..._?{x:_.x+O,y:_.y+E,..._.z!==void 0?{z:_.z+E}:{}}:{}}}));return o.set(k.map(S=>S.id)),i([]),f?.(k),k},[t,n,o,i,f,a,s]),y=M.useCallback(()=>{const x=new Set(o.selected),w=[];let _=0;for(const S of n.data.nodes){if(!x.has(S.id))continue;const{id:A,vx:O,vy:E,vz:T,fx:I,fy:C,fz:P,...R}=S,H=_%3*24,V=Math.floor(_/3)*24;w.push({...R,...S.x!==void 0?{x:S.x+H}:{},...S.y!==void 0?{y:S.y+V}:{},...S.z!==void 0?{z:S.z}:{}}),_++}if(w.length===0)return[];const k=n.addNodes(w);return o.set(k.map(S=>S.id)),i([]),k},[n,o,i]),d=M.useCallback(x=>{const w=o.selected;if(w.length===0)return null;const _=n.data.nodes.filter(O=>w.includes(O.id));if(_.length===0)return null;let k=x?.at;if(!k){let O=0,E=0,T=0,I=!1;for(const C of _)O+=C.x??0,E+=C.y??0,T+=C.z??0,(C.x!==void 0||C.y!==void 0)&&(I=!0);I&&(k={x:O/_.length+30,y:E/_.length+30,z:T/_.length})}const S=x?.label!==void 0?{label:x.label}:{},A=n.addNode(S,k?{at:k}:void 0);for(const O of _)n.addLink({source:O.id,target:A.id});return o.set([A.id]),i([]),A},[n,o,i]),m=M.useCallback(x=>{const w=n.data.nodes.find(_=>_.id===x);w&&(w.fx!==void 0?n.updateNode(x,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(x,{fx:w.x,fy:w.y,...w.z!==void 0?{fz:w.z}:{}}))},[n]),b=M.useCallback(()=>u.current.length>0,[]);return M.useMemo(()=>({hasClipboard:b,copy:h,cut:p,paste:g,duplicate:y,addConnectedNode:d,togglePin:m}),[b,h,p,g,y,d,m])}async function Yi(e,t,n){if(t.length===0||!e)return!0;try{return await e(t,{source:n})}catch{return!1}}function Gg(e){const{dataApi:t,beforeNode:n,beforeLink:r,onNodeDeleted:o,onLinkDeleted:i,afterNodeDelete:a,afterLinkDelete:s}=e,l=M.useCallback((u,v)=>{if(u.length===0)return Promise.resolve(!1);const h=new Set(u),p=t.data.nodes.filter(y=>h.has(y.id));if(p.length===0)return Promise.resolve(!1);const g=()=>(t.removeNodes(u),o?.(p,{source:v}),a?.(u),!0);return n?Promise.resolve(Yi(n,p,v)).then(y=>y?g():!1):Promise.resolve(g())},[t,n,o,a]),c=M.useCallback((u,v)=>{const h=typeof u=="function"?u:(()=>{const y=new Set(u);return d=>d.id!==void 0&&y.has(d.id)})(),p=t.data.links.filter(h);if(p.length===0)return Promise.resolve(!1);const g=()=>{t.removeLink(h),i?.(p,{source:v});const y=p.map(d=>d.id).filter(d=>d!==void 0);return s?.(y),!0};return r?Promise.resolve(Yi(r,p,v)).then(y=>y?g():!1):Promise.resolve(g())},[t,r,i,s]),f=M.useCallback(async(u,v,h)=>{const[p,g]=await Promise.all([u.length>0?l(u,h):Promise.resolve(!1),v.length>0?c(v,h):Promise.resolve(!1)]);return p||g},[l,c]);return M.useMemo(()=>({requestNodeDelete:l,requestLinkDelete:c,requestMixedDelete:f}),[l,c,f])}const Vg=40;function Wg(e){const t=M.useRef(e);t.current=e,M.useEffect(()=>{let n=-1;const r=o=>{const i=t.current,a=i.hostRef.current,s=document.activeElement;if(a&&s&&s!==document.body&&!a.contains(s))return;const l=o.target;if(!(l&&(l.tagName==="INPUT"||l.tagName==="TEXTAREA"||l.isContentEditable)))switch(o.key){case"v":case"V":i.enableClipboard&&(o.metaKey||o.ctrlKey)?(i.paste(),o.preventDefault()):i.setActiveTool("select");break;case"h":case"H":i.setActiveTool("pan");break;case"n":case"N":i.setActiveTool("add-node");break;case"l":case"L":i.setActiveTool("add-link");break;case"f":case"F":case"0":i.engine?.fit(400,40),o.preventDefault();break;case"+":case"=":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)*1.2,200),o.preventDefault());break;case"-":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)/1.2,200),o.preventDefault());break;case"3":i.setMode(i.mode==="2d"?"3d":"2d");break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{const f=i.engine;if(!f)return;const u=f.getGraphBbox(),v=(u.x[0]+u.x[1])/2,h=(u.y[0]+u.y[1])/2,p=f.getZoom?.()??1,g=Vg/Math.max(p,.1);let y=0,d=0;o.key==="ArrowLeft"?y=-g:o.key==="ArrowRight"?y=g:o.key==="ArrowUp"?d=-g:d=g,f.centerAt(v+y,h+d,void 0,120),o.preventDefault();break}case"Tab":{const f=i.engine,u=i.dataApi.data.nodes;if(!f||u.length===0)return;n=o.shiftKey?(n-1+u.length)%u.length:(n+1)%u.length;const v=u[n];if(!v||v.x===void 0||v.y===void 0)return;i.selection.set([v.id]),f.focusOn({x:v.x,y:v.y,...v.z!==void 0?{z:v.z}:{}},{distance:120,zoom:4,durationMs:400}),o.preventDefault();break}case"Backspace":case"Delete":(i.selection.selected.length>0||i.selectedLinkIds.length>0)&&(i.deleteGate.requestMixedDelete(i.selection.selected,i.selectedLinkIds,"keyboard"),o.preventDefault());break;case"a":case"A":(o.metaKey||o.ctrlKey)&&(i.selection.set(i.dataApi.data.nodes.map(f=>f.id)),i.setSelectedLinkIds(i.dataApi.data.links.map(f=>f.id).filter(f=>f!==void 0)),o.preventDefault());break;case"c":case"C":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&i.copy();break;case"x":case"X":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&(i.cut(),o.preventDefault());break;case"d":case"D":(o.metaKey||o.ctrlKey)&&(i.duplicate(),o.preventDefault());break;case"p":case"P":for(const f of i.selection.selected)i.togglePin(f);break;case"Enter":i.selection.selected.length>0&&(i.addConnectedNode(),o.preventDefault());break;case"Escape":i.selection.clear(),i.setSelectedLinkIds([]),i.setLinkSourceId(null);break}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[])}function Xg(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:o}=e;M.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const i=typeof n=="number"?n:(o??4)+2;return t.d3Force("collide",ti(i)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,o,r]),M.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const i=r===!0?{}:r,a=i.axis??"x",s=i.strength??.2,l=i.value,c=v=>{const h=String(v);let p=0;for(let g=0;g<h.length;g++)p=p*31+h.charCodeAt(g)|0;return(p%600+600)%600-300},f=v=>{const h=v;if(typeof l=="function")return l(h);if(typeof l=="string"){const p=h[l];if(typeof p=="number")return p;if(typeof p=="string")return Number(p)||0}return c(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",li(f)),t.d3Force("y",ci(0).strength(s))):(t.d3Force("y",ci(f)),t.d3Force("x",li(0).strength(s)));const u=(o??4)+2;t.d3Force("collide",ti(u)),t.reheat()},[t,r,o])}function qt(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function Ki(e,t){const n=qt(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function Qi(e,t){const n=qt(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,o=t.target,i=typeof r=="object"&&r!==null?r.id:r,a=typeof o=="object"&&o!==null?o.id:o;return i===void 0&&a===void 0?"":`${i??""} → ${a??""}`}function an(e,t){if(e.startsWith("#")){const o=e.slice(1),i=o.length===3?o.split("").map(a=>a+a).join(""):o;if(i.length===6){const a=parseInt(i.slice(0,2),16),s=parseInt(i.slice(2,4),16),l=parseInt(i.slice(4,6),16);return`rgba(${a}, ${s}, ${l}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Dt=new Set;function Yg(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:o,linkWidth:i,nodeVal:a,nodeRelSize:s,nodePointerAreaPaint:l,nodeAutoColorBy:c,nodeVisibility:f,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m}=e,b=M.useRef({mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m});b.current={mode:t,accentColor:n,selectedNodeSet:u,selectedLinkSet:v,highlightNeighborsOnHover:h,highlightedNodeIds:p,highlightedLinkIds:g,hoverNodeId:y,hoverLinkId:d,hiddenGroups:m};const x=u.size>0||v.size>0||h&&p.size>0,w=M.useMemo(()=>{const z=r;return G=>{const q=b.current;if(G.id!==void 0&&q.selectedNodeSet.has(G.id))return q.accentColor;if(q.highlightNeighborsOnHover&&q.highlightedNodeIds.size>0&&G.id!==void 0&&q.highlightedNodeIds.has(G.id))return q.hoverNodeId===G.id?q.accentColor:an(q.accentColor,.7);let B;return typeof z=="function"?B=z(G):typeof z=="string"?B=z:B=G.color??"#888",(q.selectedNodeSet.size>0||q.selectedLinkSet.size>0)&&q.mode!=="3d"?an(B,.25):B}},[r,u,v,y,p]),_=x?w:r,k=c!==void 0&&m.size>0,S=u.size>0||v.size>0||d!==null||h&&g.size>0||k,A="rgba(96, 102, 110, 0.55)",O="rgba(180, 188, 198, 0.55)",E=M.useMemo(()=>{const z=o,G=c;return q=>{const $=b.current,B=q.id,te=typeof q.source=="object"?q.source:null,ae=typeof q.target=="object"?q.target:null;if($.hiddenGroups.size>0&&G!==void 0){const Wt=Ke=>{if(!Ke)return null;const vt=typeof G=="function"?G(Ke):Ke[G];return vt==null?null:String(vt)},Pt=Wt(te),Xt=Wt(ae);if(Pt!==null&&$.hiddenGroups.has(Pt)||Xt!==null&&$.hiddenGroups.has(Xt)){let Ke;return typeof z=="function"?Ke=z(q):typeof z=="string"?Ke=z:Ke=q.color??A,an(Ke,.05)}}if(B!==void 0&&$.selectedLinkSet.has(B))return $.accentColor;const ce=te?.id??q.source,ye=ae?.id??q.target,fe=$.selectedNodeSet.size>0;if(fe&&(ce!==void 0&&$.selectedNodeSet.has(ce)||ye!==void 0&&$.selectedNodeSet.has(ye)))return an($.accentColor,.85);const Be=B!==void 0&&$.hoverLinkId===B,nt=$.highlightNeighborsOnHover&&B!==void 0&&$.highlightedLinkIds.has(B);if(Be||nt)return O;let Ee;return typeof z=="function"?Ee=z(q):typeof z=="string"?Ee=z:Ee=q.color??A,fe||$.selectedLinkSet.size>0?an(Ee,$.mode==="3d"?.45:.18):Ee}},[o,c,v,u,d,g,m]),T=S?E:o,I=u.size>0||v.size>0||d!==null||h&&g.size>0,C=.6,P=1.5,R=.4,H=1,V=.5,X=1.2,oe=M.useMemo(()=>{const z=i;return G=>{const q=b.current,$=G.id,B=$!==void 0&&q.selectedLinkSet.has($),te=typeof G.source=="object"?G.source.id:G.source,ae=typeof G.target=="object"?G.target.id:G.target,ye=q.selectedNodeSet.size>0&&(te!==void 0&&q.selectedNodeSet.has(te)||ae!==void 0&&q.selectedNodeSet.has(ae)),fe=$!==void 0&&q.hoverLinkId===$,Te=q.highlightNeighborsOnHover&&$!==void 0&&q.highlightedLinkIds.has($),Be=fe||Te,nt=typeof z=="function"?z(G):typeof z=="number"?z:G.width??1,Ee=q.mode==="3d";return B?nt+(Ee?V:X):Be?nt+(Ee?C:P):ye?nt+(Ee?R:H):nt}},[i]),D=I?oe:i,F=u.size>0||h&&p.size>0,W=M.useMemo(()=>{const z=a;return G=>{const q=b.current,$=G.id,B=typeof z=="function"?z(G):typeof z=="number"?z:G.val??1;return $!==void 0&&q.selectedNodeSet.has($)?B*2.25:q.highlightNeighborsOnHover&&q.highlightedNodeIds.size>0&&$!==void 0&&q.highlightedNodeIds.has($)?q.hoverNodeId===$?B*1.8:B*1.4:B}},[a]),Q=F?W:a,N=M.useMemo(()=>{if(t!=="2d"||l)return l;const z=a,G=s??4;return(q,$,B,te)=>{const ae=typeof z=="function"?z(q):typeof z=="number"?z:q.val??1,ce=Math.sqrt(Math.max(0,ae))*G+1/Math.max(te,1e-6);B.fillStyle=$,B.beginPath(),B.arc(q.x??0,q.y??0,ce,0,2*Math.PI,!1),B.fill()}},[t,a,s,l]),U=M.useMemo(()=>{const z=c&&m.size>0;if(!z&&f===void 0)return;const G=c,q=f;return $=>{if(z&&G){const B=typeof G=="function"?G($):$[G];if(B!=null&&m.has(String(B)))return!1}return typeof q=="function"?!!q($):typeof q=="boolean"?q:typeof q=="string"?!!$[q]:!0}},[c,f,m]);return M.useMemo(()=>({nodeColor:_,linkColor:T,linkWidth:D,nodeVal:Q,nodePointerAreaPaint:N,nodeVisibility:U}),[_,T,D,Q,N,U])}const Zi=250;function Ji(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function Kg(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:o,onLinkHover:i}=e,[a,s]=M.useState(null),[l,c]=M.useState(null),[f,u]=M.useState(Dt),[v,h]=M.useState(Dt),[p,g]=M.useState(null),y=M.useRef(null),d=M.useRef(null),m=M.useRef(null),b=M.useRef(null),x=M.useRef(null);M.useEffect(()=>()=>{b.current!==null&&(clearTimeout(b.current),b.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=M.useCallback((O,E)=>{if(o?.(O,E),y.current=O?.id??null,!O&&m.current!==null)return;if(b.current!==null&&(clearTimeout(b.current),b.current=null),!O){b.current=setTimeout(()=>{b.current=null,s(null),t&&(u(Dt),h(Dt)),d.current===null&&g(null)},Zi);return}if(t){const I=new Set([O.id]),C=new Set,P=O._neighbors??[];for(const H of P)H.id!==void 0&&I.add(H.id);const R=O._links??[];for(const H of R)H.id!==void 0&&C.add(H.id);s(O.id),u(I),h(C)}else s(O.id);const T=qt(n,O);g(Ji(T))},[o,n,t]),_=M.useCallback((O,E)=>{if(i?.(O,E),d.current=O?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!O){x.current=setTimeout(()=>{x.current=null,c(null),y.current===null&&g(null)},Zi);return}c(O.id??null);const T=qt(r,O);g(Ji(T))},[i,r]),k=M.useMemo(()=>a===null?Dt:t?f:new Set([a]),[a,t,f]),S=M.useMemo(()=>{if(l!==null){if(t&&a!==null){const O=new Set(v);return O.add(l),O}return new Set([l])}return a!==null&&t?v:Dt},[l,a,t,v]),A=M.useCallback(O=>{if(m.current=O?.id??null,O){w(O,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:l,liveHoverNodeIdRef:y,liveHoverLinkIdRef:d,highlightedNodeIds:f,highlightedLinkIds:v,hoveredNodeSet:k,hoveredLinkSet:S,tooltipContent:p,handleNodeHover:w,handleLinkHover:_,pinHover:A}}const ut={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},ea=new Z.Vector2;function Qg(e,t){const n=e.info?.render?.frame??-1;return n===ut.frameId&&t===ut.fov||(e.getSize(ea),ut.frameId=n,ut.fov=t,ut.tanHalfFov=Math.tan(t*Math.PI/180/2),ut.canvasHeightPx=ea.y||1),ut}function Gn(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function Vn(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:o="#ffffff",backgroundColor:i="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:s=4}=e,c=document.createElement("canvas").getContext("2d");if(!c)return new Z.Sprite(new Z.SpriteMaterial);c.font=`${n}px ${r}`;const f=Math.ceil(c.measureText(t).width),u=Math.ceil(n*1.2),v=f+a*2,h=u+a*2,p=(_,k,S)=>{_.width=v,_.height=h;const A=_.getContext("2d");if(A.font=`${n}px ${r}`,S){A.fillStyle=S;const O=Math.min(_.height/2,8),E=A;A.beginPath(),typeof E.roundRect=="function"?E.roundRect(0,0,_.width,_.height,O):A.rect(0,0,_.width,_.height),A.fill()}A.fillStyle=k,A.textAlign="center",A.textBaseline="middle",A.fillText(t,_.width/2,_.height/2)},g=document.createElement("canvas");p(g,o,i);const y=new Z.CanvasTexture(g);y.minFilter=Z.LinearFilter,y.magFilter=Z.LinearFilter,y.needsUpdate=!0;let d;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const _=document.createElement("canvas");p(_,e.selectedColor,e.selectedBackgroundColor),d=new Z.CanvasTexture(_),d.minFilter=Z.LinearFilter,d.magFilter=Z.LinearFilter,d.needsUpdate=!0}const m=new Z.SpriteMaterial({map:y,transparent:!0,depthWrite:!1}),b=new Z.Sprite(m),x=b.userData;x.normalTexture=y,d&&(x.selectedTexture=d);const w=v/h;if(b.scale.set(s*w,s,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const _=e.pixelHeight,k=new Z.Vector3;let S=-1;b.onBeforeRender=(A,O,E)=>{const T=E;if(!T.isPerspectiveCamera||typeof T.fov!="number")return;b.getWorldPosition(k);const I=T.position.distanceTo(k);if(I<=0)return;const C=Qg(A,T.fov),P=2*C.tanHalfFov*I*_/C.canvasHeightPx;S>0&&Math.abs(P-S)<S*.005||(S=P,b.scale.set(P*w,P,1))}}return b}function Zg(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,hostNodeCanvasObject:a,hostNodeThreeObject:s,nodeLabel:l,nodeVal:c,nodeRelSize:f,theme:u}=e,v=u?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=u?.tooltipForeground??"#ffffff",p=M.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:v,tooltipFg:h});p.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:v,tooltipFg:h};const g=M.useMemo(()=>{if(t!=="2d"||a)return;const _=u?.fontFamily??"system-ui, sans-serif";return(k,S,A)=>{const O=p.current,E=k.id!==void 0&&O.selectedNodeSet.has(k.id),T=k.id!==void 0&&O.hoveredNodeSet?.has(k.id)===!0;if(!O.showLabels&&!E&&!T)return;const I=Ki(l,k);if(!I)return;const C=qt(c,k)??1,P=f??4,R=Math.max(.5,Math.sqrt(Math.max(C,0))*P),H=14/A,V=6/A,X=4/A;S.font=`${H}px ${_}`;const D=S.measureText(I).width+V*2,F=H+X*2,W=k.x??0,Q=(k.y??0)-R*2-4/A-F;S.fillStyle=E?O.accentColor:O.tooltipBg;const N=Math.min(F/2,6/A),U=S;S.beginPath(),typeof U.roundRect=="function"?U.roundRect(W-D/2,Q,D,F,N):S.rect(W-D/2,Q,D,F),S.fill(),S.textAlign="center",S.textBaseline="top",S.fillStyle=E?"#ffffff":O.tooltipFg,S.fillText(I,W,Q+X)}},[t,a,l,c,f,u?.fontFamily]),y=o?.size??0,m=n||r.size>0||y>0?g:void 0,b=M.useRef(new Map),x=M.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o},M.useEffect(()=>{const _=b.current;return()=>{for(const k of _.values())k.sprite&&Gn(k.sprite);_.clear()}},[]);const w=M.useMemo(()=>{if(s)return;const _=b.current,k=u?.fontFamily??"system-ui, sans-serif";return S=>{const A=S.id,O=Ki(l,S),E=qt(c,S)??1,T=f??4,C=Math.cbrt(Math.max(E,0))*T*2+4,P=new Z.Group;if(A!==void 0&&O){const R={group:P,sprite:null,text:O,yOffset:C};_.set(A,R);const H=x.current,V=H.selectedNodeSet.has(A),X=H.hoveredNodeSet?.has(A)===!0;if(H.showLabels||V||X){const oe=Vn({text:O,fontFamily:k,fontSize:48,color:h,backgroundColor:v,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});if(oe.material.depthTest=!1,oe.renderOrder=1e3,oe.position.set(0,C,0),V){const D=oe.userData;if(D.selectedTexture){const F=oe.material;F.map=D.selectedTexture,F.needsUpdate=!0}}P.add(oe),R.sprite=oe}}return P}},[s,l,c,f,u?.fontFamily,v,h,i]);return M.useEffect(()=>{const _=b.current,k=u?.fontFamily??"system-ui, sans-serif";for(const[S,A]of _){if(A.group.parent===null){A.sprite&&Gn(A.sprite),_.delete(S);continue}const O=r.has(S),E=o?.has(S)===!0,T=n||O||E;if(T&&A.sprite===null){const C=Vn({text:A.text,fontFamily:k,fontSize:48,color:h,backgroundColor:v,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});C.material.depthTest=!1,C.renderOrder=1e3,C.position.set(0,A.yOffset,0),A.group.add(C),A.sprite=C}const I=A.sprite;if(I){I.visible=T;const C=I.userData,P=O&&C.selectedTexture?C.selectedTexture:C.normalTexture,R=I.material;P&&R.map!==P&&(R.map=P,R.needsUpdate=!0)}}},[n,r,o,i,v,h,u?.fontFamily]),{canvasObject:m,threeObject:w,renderFramePost:void 0}}function Jg(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,hostLinkCanvasObject:a,hostLinkThreeObject:s,hostLinkPositionUpdate:l,linkLabel:c,theme:f}=e,u=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",v=f?.tooltipForeground??"#1c1f23",h=M.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:u,tooltipFg:v});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:u,tooltipFg:v};const p=M.useMemo(()=>{if(t!=="2d"||a)return;const _=f?.fontFamily??"system-ui, sans-serif",k=4,S=6;return(A,O)=>{const E=h.current,T=A.id!==void 0&&E.selectedLinkSet.has(A.id),I=A.id!==void 0&&E.hoveredLinkSet?.has(A.id)===!0;if(!E.showLabels&&!T&&!I)return;const C=A.source,P=A.target;if(typeof C!="object"||typeof P!="object")return;const R=Qi(c,A);if(!R||R===" → ")return;const H=C.x,V=C.y,X=P.x,oe=P.y;if(H===void 0||V===void 0||X===void 0||oe===void 0)return;const D=X-H,F=oe-V,Q=Math.sqrt(D*D+F*F)-S*2;if(Q<=0)return;O.font=`1px ${_}`;const N=O.measureText(R).width||1,U=Math.min(k,Q/N);O.font=`${U}px ${_}`;let z=Math.atan2(F,D);z>Math.PI/2&&(z=-(Math.PI-z)),z<-Math.PI/2&&(z=-(-Math.PI-z));const G=(H+X)/2,q=(V+oe)/2,$=O.measureText(R).width,B=U*.6,te=U*.35,ae=$+B,ce=U+te,ye=Math.min(ce/2,U*.35);O.save(),O.translate(G,q),O.rotate(z),O.fillStyle=T?E.accentColor:E.tooltipBg;const fe=O;O.beginPath(),typeof fe.roundRect=="function"?fe.roundRect(-ae/2,-ce/2,ae,ce,ye):O.rect(-ae/2,-ce/2,ae,ce),O.fill(),O.textAlign="center",O.textBaseline="middle",O.fillStyle=T?"#ffffff":E.tooltipFg,O.fillText(R,0,0),O.restore()}},[t,a,c,f?.fontFamily]),g=o?.size??0,d=n||r.size>0||g>0?p:void 0,m=M.useRef(new Map),b=M.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o});b.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o},M.useEffect(()=>{const _=m.current;return()=>{for(const k of _.values())k.sprite&&Gn(k.sprite);_.clear()}},[]);const x=M.useMemo(()=>{if(s)return;const _=m.current,k=f?.fontFamily??"system-ui, sans-serif";return S=>{const A=Qi(c,S),O=new Z.Group,E=S.id;if(E!==void 0&&A&&A!==" → "){const T={group:O,sprite:null,text:A};_.set(E,T);const I=b.current,C=I.selectedLinkSet.has(E),P=I.hoveredLinkSet?.has(E)===!0;if(I.showLabels||C||P){const R=Vn({text:A,fontFamily:k,fontSize:48,color:v,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});if(R.material.depthTest=!1,R.renderOrder=500,C){const H=R.userData;if(H.selectedTexture){const V=R.material;V.map=H.selectedTexture,V.needsUpdate=!0}}O.add(R),T.sprite=R}}return O}},[s,c,f?.fontFamily,u,v,i]);M.useEffect(()=>{const _=m.current,k=f?.fontFamily??"system-ui, sans-serif";for(const[S,A]of _){if(A.group.parent===null){A.sprite&&Gn(A.sprite),_.delete(S);continue}const O=r.has(S),E=o?.has(S)===!0,T=n||O||E;if(T&&A.sprite===null){const C=Vn({text:A.text,fontFamily:k,fontSize:48,color:v,backgroundColor:u,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});C.material.depthTest=!1,C.renderOrder=500,A.group.add(C),A.sprite=C}const I=A.sprite;if(I){I.visible=T;const C=I.userData,P=O&&C.selectedTexture?C.selectedTexture:C.normalTexture,R=I.material;P&&R.map!==P&&(R.map=P,R.needsUpdate=!0)}}},[n,r,o,i,u,v,f?.fontFamily]);const w=M.useMemo(()=>{if(l!=null)return;const _=t==="2d";return(k,S)=>{if(k instanceof Z.Group){const A=(S.start.x+S.end.x)/2,O=(S.start.y+S.end.y)/2,E=(S.start.z+S.end.z)/2;k.position.set(A,O,E);const T=k.parent;if(T&&!T.userData.lgcOrderApplied){T.userData.lgcOrderApplied=!0,T.renderOrder=-1;for(const C of T.children)C!==k&&(C.renderOrder=-1)}const I=k.children[0];if(I instanceof Z.Sprite){const C=I.material;if(_){const P=S.end.x-S.start.x,R=S.end.y-S.start.y;let H=Math.atan2(R,P);H>Math.PI/2?H-=Math.PI:H<-Math.PI/2&&(H+=Math.PI),Math.abs(C.rotation-H)>.001&&(C.rotation=H)}else C.rotation!==0&&(C.rotation=0)}}return!0}},[t,l]);return{canvasObject:d,threeObject:x,positionUpdate:w}}function ev({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function tv(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?32:e==="xlarge"?100:200,n}function nv(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:o}=e;return M.useMemo(()=>{if(t==="off")return{};const i=t==="auto"?ev({nodeCount:n,linkCount:r}):t;return tv(i)},[t,n,r,o])}function rv(e){const{ref:t,dataApi:n,deleteGate:r,selection:o,engine:i,mode:a,setMode:s,setPaused:l,clipboard:c,exportJSON:f,importJSON:u,downloadJSON:v}=e;M.useImperativeHandle(t,()=>({getData:()=>n.data,setData:n.setData,addNode:n.addNode,addNodes:n.addNodes,updateNode:n.updateNode,removeNode:h=>r.requestNodeDelete([h],"imperative"),removeNodes:h=>r.requestNodeDelete(h,"imperative"),addLink:n.addLink,addLinks:n.addLinks,removeLink:h=>r.requestLinkDelete(h,"imperative"),clear:n.clear,getSelection:()=>o.selected,setSelection:o.set,selectAll:()=>o.set(n.data.nodes.map(h=>h.id)),clearSelection:o.clear,getMode:()=>a,setMode:s,fit:(h,p)=>i?.fit(h,p),centerAt:(h,p,g,y)=>i?.centerAt(h,p,g,y),zoom:(h,p)=>i?.zoom(h,p),zoomIn:(h=1.2)=>{i&&i.zoom((i.getZoom?.()??1)*h,200)},zoomOut:(h=1.2)=>{i&&i.zoom((i.getZoom?.()??1)/h,200)},pause:()=>{i?.pause(),l(!0)},resume:()=>{i?.resume(),l(!1)},reheat:()=>i?.reheat(),screenshot:async()=>{const h=i?.getCanvasElement();return h?new Promise(p=>h.toBlob(g=>p(g))):null},copy:c.copy,cut:c.cut,paste:h=>c.paste(h?.at),duplicate:c.duplicate,addConnectedNode:c.addConnectedNode,togglePin:c.togglePin,exportJSON:f,importJSON:u,downloadJSON:v,d3Force:(h,p)=>i?.d3Force(h,p),emitParticle:h=>i?.emitParticle(h),stopAnimation:()=>i?.stopAnimation(),engine2D:()=>i?.mode==="2d"?i:null,engine3D:()=>i?.mode==="3d"?i:null}),[t,n,r,i,a,s,l,o,c,f,u,v])}function ov(){const[e,t]=M.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return M.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>t(n.matches);return typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[]),e}const Ce={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},iv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),av=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),sv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"6",cy:"8",r:"3"}),L.jsx("path",{d:"M12 5v6M9 8h6"})]}),lv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"4",cy:"4",r:"2"}),L.jsx("circle",{cx:"12",cy:"12",r:"2"}),L.jsx("path",{d:"M5.5 5.5l5 5"})]}),Os=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),cv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),uv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"7",cy:"7",r:"4"}),L.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),fv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"7",cy:"7",r:"4"}),L.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),dv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M6 3v10M10 3v10"})}),hv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("path",{d:"M5 3l8 5-8 5z"})}),pv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),L.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),As=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),L.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),gv=e=>L.jsx("svg",{...Ce,...e,children:L.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),js=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),L.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),vv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),L.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),L.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),yv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),L.jsx("path",{d:"M3 12h10v2H3z"})]}),mv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),L.jsx("path",{d:"M3 12h10v2H3z"})]}),bv=e=>L.jsxs("svg",{...Ce,...e,children:[L.jsx("circle",{cx:"4",cy:"8",r:"2"}),L.jsx("path",{d:"M6 8h2.5"}),L.jsx("circle",{cx:"11",cy:"8",r:"2"}),L.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),Ts={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:iv,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:av,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:sv,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:lv,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:Os,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:cv,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:uv,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:fv,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:dv},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:hv},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:pv},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:As,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:js,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:vv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:yv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:mv}},Qr=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Es(e){return e==="2d"?As:gv}function _v(e,t){if(e===!1)return[];let n;if(e===!0)n=Qr;else if(Array.isArray(e))n=e;else{const r=e.include??Qr,o=new Set(e.exclude??[]);n=r.filter(i=>!o.has(i))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function xv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function wv(e){const{config:t,activeTool:n,paused:r,mode:o,isDisabled:i,onSelect:a}=e,s=_v(t,r),[l,c]=M.useState(0),f=M.useRef([]),u=M.useRef(!1);if(M.useEffect(()=>{if(!u.current)return;const g=Math.min(l,Math.max(0,s.length-1));f.current[g]?.focus()},[l,s.length]),s.length===0)return null;const v=xv(t),h=Math.min(l,Math.max(0,s.length-1)),p=g=>{u.current=!0,c(y=>(y+g+s.length)%s.length)};return L.jsx("div",{className:`lgc-toolbar lgc-toolbar--${v}`,role:"toolbar",children:s.map((g,y)=>{const d=Ts[g],m=g==="toggle-mode"?Es(o):d.icon,b=d.toggleable&&n===g,x=i?.(g)??!1,w=[d.hint,d.shortcut?`(${d.shortcut})`:""],_=y===h;return L.jsx("button",{ref:k=>{f.current[y]=k},type:"button",className:["lgc-tool",b?"lgc-tool--active":"",x?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":d.label,"aria-pressed":b?"true":void 0,disabled:x,tabIndex:_?0:-1,title:w.filter(Boolean).join(" "),onFocus:()=>c(y),onClick:()=>a(g),onKeyDown:k=>{k.key==="ArrowRight"?(k.preventDefault(),p(1)):k.key==="ArrowLeft"?(k.preventDefault(),p(-1)):k.key==="Home"?(k.preventDefault(),u.current=!0,c(0)):k.key==="End"&&(k.preventDefault(),u.current=!0,c(s.length-1))},children:L.jsx(m,{})},g)})})}const zt=8;function kv({x:e,y:t,items:n,onClose:r}){const o=M.useRef(null),[i,a]=M.useState({left:e,top:t});return M.useEffect(()=>{const s=l=>{l instanceof KeyboardEvent&&l.key!=="Escape"||l instanceof MouseEvent&&o.current&&o.current.contains(l.target)||r()};return window.addEventListener("mousedown",s),window.addEventListener("keydown",s),()=>{window.removeEventListener("mousedown",s),window.removeEventListener("keydown",s)}},[r]),M.useLayoutEffect(()=>{const s=o.current;if(!s)return;const l=s.parentElement;if(!l)return;const c=l.getBoundingClientRect(),f=s.offsetWidth,u=s.offsetHeight,v=Math.max(zt,c.width-f-zt),h=Math.max(zt,c.height-u-zt),p=Math.min(Math.max(e,zt),v),g=Math.min(Math.max(t,zt),h);(p!==i.left||g!==i.top)&&a({left:p,top:g})},[e,t,n,i.left,i.top]),L.jsx("div",{ref:o,className:"lgc-menu",role:"menu",style:{left:i.left,top:i.top},children:n.map((s,l)=>"separator"in s?L.jsx("div",{className:"lgc-menu-separator"},`sep-${l}`):L.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":s.disabled?"true":void 0,onClick:()=>{s.disabled||(s.onSelect(),r())},children:[L.jsx("span",{children:s.label}),s.shortcut?L.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:s.shortcut}):null]},s.id))})}const Cv=120,It=14;function Sv({content:e,hostRef:t}){const[n,r]=M.useState(null),[o,i]=M.useState(!1),a=M.useRef(null),s=M.useRef(null);M.useEffect(()=>{if(e===null){r(null),i(!1),a.current=null;return}const y=t.current;if(!y)return;a.current=y.getBoundingClientRect();const d=window.setTimeout(()=>i(!0),Cv),m=x=>{const w=a.current??y.getBoundingClientRect();r({x:x.clientX-w.left,y:x.clientY-w.top})},b=()=>{a.current=y.getBoundingClientRect()};return y.addEventListener("mousemove",m),window.addEventListener("resize",b),()=>{window.clearTimeout(d),y.removeEventListener("mousemove",m),window.removeEventListener("resize",b)}},[t,e]);const[l,c]=M.useState(!1),[f,u]=M.useState(!1);if(M.useLayoutEffect(()=>{if(!o||!n)return;const y=t.current,d=s.current;if(!y||!d)return;const m=a.current??y.getBoundingClientRect(),b=d.offsetWidth,x=d.offsetHeight;c(n.x+It+b>m.width),u(n.y+It+x>m.height)},[o,n,e,t]),e===null||n===null||!o)return null;const v=s.current?.offsetWidth??0,h=s.current?.offsetHeight??0,p=l?n.x-It-v:n.x+It,g=f?n.y-It-h:n.y+It;return L.jsx("div",{ref:s,className:"lgc-tooltip",role:"tooltip",style:{left:p,top:g,pointerEvents:"none"},children:typeof e=="string"?e:L.jsx("span",{ref:y=>y?.appendChild(e)})})}function Mv({rect:e,count:t}){if(!e)return null;const n=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),o=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return L.jsx("div",{className:"lgc-marquee",style:{left:n,top:r,width:o,height:i,pointerEvents:"none"},children:t&&t>0?L.jsx("span",{className:"lgc-marquee-count",children:t}):null})}function Pv(e){return L.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[L.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),L.jsx("path",{d:"M6 5h7v7"})]})}function Ov(e){return L.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[L.jsx("circle",{cx:"5",cy:"11",r:"2"}),L.jsx("circle",{cx:"11",cy:"11",r:"2"}),L.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function ta(e){return L.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[L.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),L.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function ft({label:e,shortcut:t,disabled:n,onClick:r,children:o}){return L.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:o})}function Av({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:o,onDuplicate:i,onAddConnected:a,onCopy:s,onCut:l,onPaste:c,onClear:f}){if(e===0&&t===0)return!r||!n?null:L.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[L.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),L.jsx(ft,{label:"Paste",shortcut:"⌘V",onClick:c,children:L.jsx(ta,{})})]});const u=[];e>0&&u.push(`${e} ${e===1?"node":"nodes"}`),t>0&&u.push(`${t} ${t===1?"link":"links"}`);const v=u.join(", ");return L.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[L.jsx("span",{className:"lgc-selpanel-label",children:v}),L.jsx("div",{className:"lgc-selpanel-divider"}),L.jsx(ft,{label:"Delete",shortcut:"⌫",onClick:o,children:L.jsx(Os,{width:14,height:14})}),L.jsx(ft,{label:"Duplicate",shortcut:"⌘D",onClick:i,children:L.jsx(js,{width:14,height:14})}),L.jsx(ft,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:L.jsx(bv,{})}),r?L.jsxs(L.Fragment,{children:[L.jsx(ft,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:s,children:L.jsx(Pv,{})}),L.jsx(ft,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:l,children:L.jsx(Ov,{})}),L.jsx(ft,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:c,children:L.jsx(ta,{})})]}):null,L.jsx("div",{className:"lgc-selpanel-divider"}),L.jsx(ft,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const na=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function jv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function Tv(e){return na[jv(e,na.length)]}function Ev({nodes:e,groupBy:t,hidden:n,onToggle:r}){const o=M.useMemo(()=>{if(!t)return[];const i=new Set;for(const a of e){const s=typeof t=="function"?t(a):a[t];s!=null&&i.add(String(s))}return Array.from(i).sort()},[e,t]);return o.length===0?null:L.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:o.map(i=>{const a=n.has(i);return L.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(i),"aria-pressed":a?"false":"true",title:`Toggle ${i}`,children:[L.jsx("span",{className:"lgc-legend-swatch",style:{background:Tv(i)}}),L.jsx("span",{children:i})]},i)})})}function Lv({mode:e,onToggle:t}){const n=Es(e),r=e==="2d"?"3D":"2D";return L.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[L.jsx(n,{width:14,height:14}),L.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function Rv(e){return L.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[L.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),L.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function Nv({items:e}){const[t,n]=M.useState(!1),r=M.useRef(null);return M.useEffect(()=>{if(!t)return;const o=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},i=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",o),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",i)}},[t]),e.length===0?null:L.jsxs("div",{ref:r,className:"lgc-options-menu",children:[L.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(o=>!o),children:L.jsx(Rv,{})}),t?L.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(o=>o.kind==="select"?L.jsxs("div",{className:"lgc-options-item",children:[L.jsxs("span",{className:"lgc-options-item-text",children:[L.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?L.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]}),L.jsx("select",{className:"lgc-options-select",value:o.value,onChange:i=>o.onChange(i.target.value),children:o.options.map(i=>L.jsx("option",{value:i.value,children:i.label??i.value},i.value))})]},o.id):L.jsxs("label",{className:"lgc-options-item",children:[L.jsx("input",{type:"checkbox",checked:o.checked,onChange:i=>o.onChange(i.target.checked)}),L.jsxs("span",{className:"lgc-options-item-text",children:[L.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?L.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]})]},o.id))}):null]})}function Dv(e,t,n={}){const r=n.spacing??50,o=n.color??"rgba(0,0,0,0.06)",i=e.canvas,s=e.getTransform().inverse(),l=s.transformPoint({x:0,y:0}),c=s.transformPoint({x:i.width,y:i.height}),f=Math.floor(l.x/r)*r,u=Math.ceil(c.x/r)*r,v=Math.floor(l.y/r)*r,h=Math.ceil(c.y/r)*r;e.save(),e.strokeStyle=o,e.lineWidth=1/t,e.beginPath();for(let p=f;p<=u;p+=r)e.moveTo(p,v),e.lineTo(p,h);for(let p=v;p<=h;p+=r)e.moveTo(f,p),e.lineTo(u,p);e.stroke(),e.restore()}const ra=15,zv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function Iv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const o=zv[n];o&&(t[o]=String(r))}return t}function Ls(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Fv(e){e&&e.toBlob(t=>{t&&Ls(t,`lora-graph-${Date.now()}.png`)})}function Bv(e,t){const{data:n,defaultData:r,onDataChange:o,mode:i,defaultMode:a,onModeChange:s,width:l,height:c,className:f,style:u,theme:v,tools:h=!0,selection:p="multi",showContextMenu:g=!0,showLegend:y=!1,showGrid:d=!1,showLabels:m=!1,enableClipboard:b=!0,enableTooltip:x=!0,introZoom:w=!0,focusOnClick:_=!1,highlightNeighborsOnHover:k=!0,autoIndexNeighbors:S=k,collideNodes:A=!1,fixOnDrop:O=!0,beeswarm:E=!1,onSelectionChange:T,onNodeClick:I,onNodeRightClick:C,onLinkClick:P,onLinkRightClick:R,onBackgroundClick:H,onBackgroundRightClick:V,onNodeDrag:X,onNodeDragEnd:oe,onNodeHover:D,onLinkHover:F,onNodeDoubleClick:W,onCopy:Q,onCut:N,onPaste:U,onBeforeNodeDelete:z,onBeforeLinkDelete:G,onNodeDeleted:q,onLinkDeleted:$,onRenderFramePre:B,nodeColor:te,nodeLabel:ae,nodeVal:ce,nodeAutoColorBy:ye,nodeRelSize:fe,nodeVisibility:Te,nodeCanvasObject:Be,linkColor:nt,linkLabel:Ee,linkWidth:er,linkHoverPrecision:Wt,backgroundColor:Pt,enableNavigationControls:Xt,performanceProfile:Ke,dagMode:vt}=e,[Ns,Ds]=M.useState(i??a??"2d"),tr=i!==void 0,_e=tr?i:Ns,xo=M.useRef(null),yt=M.useCallback(j=>{j!==_e&&(xo.current?.(),tr||Ds(j),s?.(j))},[_e,tr,s]),ie=_l({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...o?{onChange:o}:{}});Bg(S,ie.data);const me=Ig({mode:p,...T?{onChange:T}:{}}),[Ge,nr]=M.useState("select"),[rr,or]=M.useState(!1),zs=Kg({highlightNeighborsOnHover:k,...ae!==void 0?{nodeLabel:ae}:{},...Ee!==void 0?{linkLabel:Ee}:{},...D?{onNodeHover:D}:{},...F?{onLinkHover:F}:{}}),{hoverNodeId:Is,hoverLinkId:Fs,liveHoverNodeIdRef:Bs,highlightedNodeIds:$s,highlightedLinkIds:Hs,hoveredNodeSet:Us,hoveredLinkSet:qs,tooltipContent:Gs,handleNodeHover:wo,handleLinkHover:ko,pinHover:bn}=zs,[Co,Vs]=M.useState(()=>new Set),[Ot,So]=M.useState(!!_),[_n,Mo]=M.useState(!!m),[xn,Po]=M.useState(vt??null);M.useEffect(()=>{So(!!_)},[_]),M.useEffect(()=>{Mo(!!m)},[m]),M.useEffect(()=>{Po(vt??null)},[vt]);const rt=M.useRef(null),[Yt,wn]=M.useState(null),[Kt,kn]=M.useState(null),[Cn,mt]=M.useState(null),[bt,Qe]=M.useState([]),[Sn,At]=M.useState(null),Ws=Fg(),Qt=ov(),_t=M.useRef(null),ir=M.useRef(null),[ar,Xs]=M.useState(null),Ys=M.useCallback(j=>{ir.current=j,Xs(j)},[]),Oo=zg(_t),sr=l??Oo?.width??600,lr=c??Oo?.height??400,ze=M.useRef(null),{marquee:Mn,lastCursorRef:Ks}=$g({mount:ar,engineRef:ze,selection:me,nodes:ie.data.nodes,links:ie.data.links,setSelectedLinkIds:Qe,liveHoverNodeIdRef:Bs});Ug(ar);const Ve=Gg({dataApi:ie,...z?{beforeNode:z}:{},...G?{beforeLink:G}:{},...q?{onNodeDeleted:q}:{},...$?{onLinkDeleted:$}:{},afterNodeDelete:()=>me.clear(),afterLinkDelete:()=>Qe([])}),Se=qg({enableClipboard:b,dataApi:ie,deleteGate:Ve,selection:me,setSelectedLinkIds:Qe,engineRef:ze,lastCursorRef:Ks,...Q?{onCopy:Q}:{},...N?{onCut:N}:{},...U?{onPaste:U}:{}}),Ao=M.useRef(null),jo=M.useCallback((j,K)=>{I?.(j,K);const ee=performance.now(),xe=Ao.current,de=xe&&xe.id===j.id&&ee-xe.at<280;if(Ao.current={id:j.id,at:ee},de){W?.(j,K);return}if(Ge==="add-link"&&j.id!==void 0){Cn===null?mt(j.id):(Cn!==j.id&&ie.addLink({source:Cn,target:j.id}),mt(null));return}if(p!=="none"&&j.id!==void 0){const se=K.shiftKey||K.ctrlKey||K.metaKey;me.toggle(j.id,{additive:se}),se||Qe([])}if(Ot&&j.id!==void 0&&ze.current){const se=ze.current;Yt===j.id?(rt.current&&se.setCameraState(rt.current,800),wn(null),rt.current=null):(Yt===null&&Kt===null&&(rt.current=se.getCameraState()),se.focusOn({x:j.x??0,y:j.y??0,z:j.z??0},{distance:120,zoom:8,durationMs:Qt?0:1e3}),wn(j.id),kn(null))}},[I,W,me,p,Ge,Cn,ie,Ot,Yt,Kt]),To=M.useCallback(j=>{if(H?.(j),ze.current?.stopAnimation(),Ge==="add-node"){const ee=ir.current?.getBoundingClientRect(),xe=ee?j.clientX-ee.left:j.clientX,de=ee?j.clientY-ee.top:j.clientY,se=ze.current?.screen2Graph(xe,de)??{x:xe,y:de};ie.addNode(void 0,{at:{x:se.x,y:se.y,...se.z!==void 0?{z:se.z}:{}}});return}Ge==="add-link"&&mt(null),j.shiftKey||j.ctrlKey||j.metaKey||(me.clear(),Qe([])),At(null)},[H,Ge,ie,me]),Eo=M.useCallback((j,K)=>{if(C?.(j,K),!g)return;const ee=_t.current?.getBoundingClientRect(),xe=ee?K.clientX-ee.left:K.clientX,de=ee?K.clientY-ee.top:K.clientY,se=j.id,he=me.selected,lt=he.length>1&&he.includes(se)?[{id:"pin-all",label:`Pin ${he.length} nodes`,onSelect:()=>{for(const Re of he){const Ze=ie.data.nodes.find(xt=>xt.id===Re);Ze&&ie.updateNode(Re,{fx:Ze.x,fy:Ze.y,fz:Ze.z})}}},{id:"unpin-all",label:`Unpin ${he.length} nodes`,onSelect:()=>{for(const Re of he)ie.updateNode(Re,{fx:void 0,fy:void 0,fz:void 0})}},{separator:!0},{id:"duplicate",label:`Duplicate ${he.length} nodes`,shortcut:"⌘D",onSelect:()=>Se.duplicate()},{id:"delete-all",label:`Delete ${he.length} nodes`,shortcut:"⌫",onSelect:()=>{Ve.requestNodeDelete(he,"contextMenu")}}]:[{id:"pin",label:j.fx!==void 0?"Unpin":"Pin",onSelect:()=>{ie.updateNode(se,j.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:j.x,fy:j.y,fz:j.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{nr("add-link"),mt(se)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{Ve.requestNodeDelete([se],"contextMenu")}}];At({x:xe,y:de,items:lt})},[C,g,ie,me,Se,Ve]),Lo=M.useCallback((j,K)=>{P?.(j,K);const ee=j.id;if(ee===void 0)return;const xe=K.shiftKey||K.ctrlKey||K.metaKey;if(Qe(de=>{const se=de.includes(ee);return!xe||p!=="multi"?se&&de.length===1?[]:[ee]:se?de.filter(he=>he!==ee):[...de,ee]}),xe||me.clear(),Ot&&ze.current){const de=ze.current;if(Kt===ee)rt.current&&de.setCameraState(rt.current,800),kn(null),rt.current=null;else{const se=typeof j.source=="object"?j.source:null,he=typeof j.target=="object"?j.target:null;if(se&&he&&se.x!==void 0&&he.x!==void 0){Yt===null&&Kt===null&&(rt.current=de.getCameraState());const Le=se.x??0,lt=se.y??0,Re=he.x??0,Ze=he.y??0,xt=se.z??0,Zt=he.z??0,tl={x:(Le+Re)/2,y:(lt+Ze)/2,z:(xt+Zt)/2},hr=1.5,Xo=Re-Le,Yo=Ze-lt,nl=Zt-xt,rl=Math.max(Math.abs(Xo),1),ol=Math.max(Math.abs(Yo),1),il=Math.min(sr/(rl*hr),lr/(ol*hr)),al=Math.min(16,Math.max(.5,il)),sl=Math.hypot(Xo,Yo,nl)/2/.466*hr,ll=Math.max(60,sl);de.focusOn(tl,{distance:ll,zoom:al,durationMs:Qt?0:1e3}),kn(ee),wn(null)}}}},[P,me,p,Ot,Kt,Yt,sr,lr]),Ro=M.useCallback((j,K)=>{if(R?.(j,K),!g)return;const ee=_t.current?.getBoundingClientRect(),xe=ee?K.clientX-ee.left:K.clientX,de=ee?K.clientY-ee.top:K.clientY;At({x:xe,y:de,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{Ve.requestLinkDelete(se=>se===j,"contextMenu")}},{id:"reverse",label:"Reverse direction",onSelect:()=>{ie.removeLink(se=>se===j),ie.addLink({...j,source:typeof j.target=="object"?j.target.id:j.target,target:typeof j.source=="object"?j.source.id:j.source})}}]})},[R,g,ie,Ve]),cr=M.useRef(null),No=M.useRef(ie.data.nodes);No.current=ie.data.nodes;const Do=M.useCallback((j,K)=>{if(X?.(j,K),ze.current?.stopAnimation(),bn(j),Ge==="add-link"){const ee=No.current,xe=j.x??0,de=j.y??0,se=ra*ra;let he=null,Le=1/0;for(let lt=0;lt<ee.length;lt++){const Re=ee[lt];if(!Re||Re===j||Re.id===j.id)continue;const Ze=(Re.x??0)-xe,xt=(Re.y??0)-de,Zt=Ze*Ze+xt*xt;Zt<Le&&(Le=Zt,he=Re)}cr.current=he&&Le<se?he:null}},[X,Ge,bn]),zo=M.useCallback((j,K)=>{if(oe?.(j,K),bn(null),Ge==="add-link"){const ee=cr.current;if(cr.current=null,!ee||ee.id===void 0||j.id===void 0)return;ie.addLink({source:j.id,target:ee.id});return}if(O){const ee=j;j.x!==void 0&&(ee.fx=j.x),j.y!==void 0&&(ee.fy=j.y),j.z!==void 0&&(ee.fz=j.z)}},[oe,Ge,ie,O,bn]),Io=M.useCallback(j=>{if(V?.(j),!g)return;const K=_t.current?.getBoundingClientRect(),ee=K?j.clientX-K.left:j.clientX,xe=K?j.clientY-K.top:j.clientY,de=ir.current?.getBoundingClientRect(),se=de?j.clientX-de.left:j.clientX,he=de?j.clientY-de.top:j.clientY,Le=ze.current?.screen2Graph(se,he)??{x:se,y:he};At({x:ee,y:xe,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{ie.addNode(void 0,{at:{x:Le.x,y:Le.y,...Le.z!==void 0?{z:Le.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>ze.current?.fit(400,40)},{id:"toggle-mode",label:_e==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>yt(_e==="2d"?"3d":"2d")}]})},[V,g,ie,_e,yt]),ur=v?.accent??"#4f8ef7",Fo=M.useMemo(()=>new Set(me.selected),[me.selected]),Bo=M.useMemo(()=>new Set(bt),[bt]),ke=Yg({mode:_e,accentColor:ur,...te!==void 0?{nodeColor:te}:{},...nt!==void 0?{linkColor:nt}:{},...er!==void 0?{linkWidth:er}:{},...ce!==void 0?{nodeVal:ce}:{},...fe!==void 0?{nodeRelSize:fe}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...ye!==void 0?{nodeAutoColorBy:ye}:{},...Te!==void 0?{nodeVisibility:Te}:{},selectedNodeSet:Fo,selectedLinkSet:Bo,highlightNeighborsOnHover:k,highlightedNodeIds:$s,highlightedLinkIds:Hs,hoverNodeId:Is,hoverLinkId:Fs,hiddenGroups:Co}),jt=Zg({mode:_e,showLabels:_n,selectedNodeSet:Fo,hoveredNodeSet:Us,accentColor:ur,...Be?{hostNodeCanvasObject:Be}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...ae!==void 0?{nodeLabel:ae}:{},...ce!==void 0?{nodeVal:ce}:{},...fe!==void 0?{nodeRelSize:fe}:{},...v?{theme:v}:{}}),ot=Jg({mode:_e,showLabels:_n,selectedLinkSet:Bo,hoveredLinkSet:qs,accentColor:ur,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...Ee!==void 0?{linkLabel:Ee}:{},...v?{theme:v}:{}}),$o=nv({profile:Ke,nodeCount:ie.data.nodes.length,linkCount:ie.data.links.length,mode:_e}),Ho=_e==="3d"&&(Ws||Mn!==null),Uo=M.useMemo(()=>Pt!==void 0?Pt:v?.background&&v.background!=="transparent"?v.background:"#ffffff",[Pt,v?.background]),Qs=M.useMemo(()=>{const j={...$o,...e,dagMode:xn};return j.backgroundColor===void 0&&(j.backgroundColor=Uo),j.linkColor===void 0&&(j.linkColor="rgba(96, 102, 110, 0.55)"),j.linkOpacity===void 0&&(j.linkOpacity=1),j.nodeOpacity===void 0&&(j.nodeOpacity=1),ke.nodeColor!==void 0&&(j.nodeColor=ke.nodeColor),ke.linkColor!==void 0&&(j.linkColor=ke.linkColor),ke.linkWidth!==void 0&&(j.linkWidth=ke.linkWidth),ke.nodeVal!==void 0&&(j.nodeVal=ke.nodeVal),ke.nodePointerAreaPaint!==void 0&&(j.nodePointerAreaPaint=ke.nodePointerAreaPaint),jt.canvasObject&&(j.nodeCanvasObject=jt.canvasObject,j.nodeCanvasObjectMode=()=>"after"),ot.canvasObject&&(j.linkCanvasObject=ot.canvasObject,j.linkCanvasObjectMode=()=>"after"),jt.threeObject&&(j.nodeThreeObject=jt.threeObject,j.nodeThreeObjectExtend=!0),ot.threeObject&&(j.linkThreeObject=ot.threeObject,j.linkThreeObjectExtend=!0,ot.positionUpdate&&(j.linkPositionUpdate=ot.positionUpdate)),j.linkHoverPrecision=Wt??8,j.enableNavigationControls=Ho?!1:Xt??!0,j.onNodeClick=jo,j.onNodeRightClick=Eo,j.onLinkClick=Lo,j.onLinkRightClick=Ro,j.onBackgroundClick=To,j.onBackgroundRightClick=Io,j.onNodeDrag=Do,j.onNodeDragEnd=zo,j.nodeLabel=()=>"",j.linkLabel=()=>"",j.onNodeHover=wo,j.onLinkHover=ko,d&&(j.onRenderFramePre=(K,ee)=>{Dv(K,ee,typeof d=="object"?d:{}),B?.(K,ee)}),ke.nodeVisibility&&(j.nodeVisibility=ke.nodeVisibility),j},[e,xn,Uo,ke.nodeColor,ke.linkColor,ke.linkWidth,ke.nodeVal,ke.nodePointerAreaPaint,ke.nodeVisibility,$o,Ho,Wt,Xt,jo,Eo,Lo,Ro,To,Io,Do,zo,wo,ko,d,B,Qt,jt.canvasObject,jt.threeObject,ot.canvasObject,ot.threeObject,ot.positionUpdate]),Oe=Dg({mount:ar,mode:_e,width:sr,height:lr,data:ie.data,props:Qs,paused:rr,...Qt?{modeTransitionMs:0}:{}});ze.current=Oe,xo.current=()=>{wn(null),kn(null),rt.current=null,mt(null),At(null)};const qo=M.useRef(!1),Go=ie.data.nodes.length;M.useEffect(()=>{if(!w||!Oe||qo.current||Go===0)return;qo.current=!0;const j=Qt?0:1e3,K=setTimeout(()=>{ze.current?.fit(j,40)},150);return()=>clearTimeout(K)},[Oe,w,Go]),Xg({engine:Oe,collideNodes:A,beeswarm:E,...fe!==void 0?{nodeRelSize:fe}:{}});const Vo=M.useRef(null),fr=M.useCallback(()=>JSON.stringify({nodes:ie.data.nodes.map(j=>{const{vx:K,vy:ee,vz:xe,index:de,_neighbors:se,_links:he,...Le}=j;return Le}),links:ie.data.links},null,2),[ie.data]),Wo=M.useCallback(j=>{const K=JSON.parse(j);if(!K||!Array.isArray(K.nodes)||!Array.isArray(K.links))throw new Error("invalid graph JSON");ie.setData(K),me.clear(),Qe([])},[ie,me]),dr=M.useCallback((j=`graph-${Date.now()}.json`)=>{const K=new Blob([fr()],{type:"application/json"});Ls(K,j)},[fr]),Zs=M.useCallback(j=>{switch(j){case"select":case"pan":case"add-node":case"add-link":nr(j);break;case"delete":Ve.requestMixedDelete(me.selected,bt,"toolbar");break;case"duplicate":Se.duplicate();break;case"select-all":me.set(ie.data.nodes.map(K=>K.id)),Qe(ie.data.links.map(K=>K.id).filter(K=>K!==void 0));break;case"fit":Oe?.fit(400,40);break;case"zoom-in":Oe&&Oe.zoom((Oe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Oe&&Oe.zoom((Oe.getZoom?.()??1)/1.2,200);break;case"pause":or(!0);break;case"resume":or(!1);break;case"screenshot":Fv(Oe?.getCanvasElement());break;case"export-json":dr();break;case"import-json":Vo.current?.click();break;case"toggle-mode":yt(_e==="2d"?"3d":"2d");break}},[Oe,ie,me,_e,yt,bt,Se,dr,Ve]);Wg({engine:Oe,dataApi:ie,deleteGate:Ve,selection:me,mode:_e,setMode:yt,selectedLinkIds:bt,setSelectedLinkIds:Qe,setLinkSourceId:mt,setActiveTool:nr,enableClipboard:b,copy:Se.copy,cut:Se.cut,paste:Se.paste,duplicate:Se.duplicate,addConnectedNode:Se.addConnectedNode,togglePin:Se.togglePin,hostRef:_t}),rv({ref:t,dataApi:ie,deleteGate:Ve,selection:me,engine:Oe,mode:_e,setMode:yt,setPaused:or,clipboard:Se,exportJSON:fr,importJSON:Wo,downloadJSON:dr});const Js=M.useMemo(()=>({position:"relative",width:l??"100%",height:c??"100%",...Iv(v),...u}),[l,c,v,u]),el=M.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:Ot,onChange:So},{id:"show-labels",kind:"toggle",label:"Always show labels",hint:"Draw every node + link label on the canvas, not just the selected ones. 2D only.",checked:_n,onChange:Mo},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:xn??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:j=>Po(j==="null"?null:j)}],[Ot,_n,xn]);return L.jsxs("div",{ref:_t,className:["lora-graph-canvas",f??""].join(" ").trim(),style:Js,"data-mode":_e,"data-tool":Ge,"data-paused":rr?"true":void 0,tabIndex:0,role:"application","aria-label":"Graph canvas",children:[L.jsx("div",{ref:Ys,className:"lgc-engine-mount"}),L.jsx(wv,{config:h,activeTool:Ge,paused:rr,mode:_e,onSelect:Zs}),h!==!1?L.jsxs(L.Fragment,{children:[L.jsx(Nv,{items:el}),L.jsx(Lv,{mode:_e,onToggle:()=>yt(_e==="2d"?"3d":"2d")})]}):null,Sn?L.jsx(kv,{x:Sn.x,y:Sn.y,items:Sn.items,onClose:()=>At(null)}):null,x?L.jsx(Sv,{content:Gs,hostRef:_t}):null,L.jsx(Mv,{rect:Mn,...Mn?.count!==void 0?{count:Mn.count}:{}}),y&&ye?L.jsx(Ev,{nodes:ie.data.nodes,groupBy:ye,hidden:Co,onToggle:j=>Vs(K=>{const ee=new Set(K);return ee.has(j)?ee.delete(j):ee.add(j),ee})}):null,L.jsx(Av,{nodeCount:me.selected.length,linkCount:bt.length,hasClipboard:Se.hasClipboard(),enableClipboard:b,onDelete:()=>{Ve.requestMixedDelete(me.selected,bt,"selectionPanel")},onDuplicate:()=>Se.duplicate(),onAddConnected:()=>Se.addConnectedNode(),onCopy:()=>Se.copy(),onCut:()=>Se.cut(),onPaste:()=>Se.paste(),onClear:()=>{me.clear(),Qe([])}}),L.jsx("input",{ref:Vo,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:j=>{const K=j.target.files?.[0];K&&(K.text().then(Wo).catch(ee=>{console.error("[lora-graph-canvas] import failed:",ee)}),j.target.value="")}})]})}const Rs=M.forwardRef(Bv);Rs.displayName="LoraGraphCanvas";const $v={background:"#ffffff",foreground:"#1c1f23",border:"#d8dde3",accent:"#4f8ef7",toolbarBackground:"rgba(255, 255, 255, 0.92)",toolbarForeground:"#1c1f23",toolbarBorder:"#d8dde3",toolActiveBackground:"rgba(79, 142, 247, 0.18)",toolHoverBackground:"rgba(0, 0, 0, 0.05)",tooltipBackground:"rgba(28, 31, 35, 0.9)",tooltipForeground:"#ffffff",menuBackground:"#ffffff",menuForeground:"#1c1f23",menuHoverBackground:"rgba(0, 0, 0, 0.06)"},Hv={background:"#101216",foreground:"#e6e9ee",border:"#2a2f37",accent:"#6aa3ff",toolbarBackground:"rgba(20, 23, 28, 0.92)",toolbarForeground:"#e6e9ee",toolbarBorder:"#2a2f37",toolActiveBackground:"rgba(106, 163, 255, 0.25)",toolHoverBackground:"rgba(255, 255, 255, 0.08)",tooltipBackground:"rgba(240, 240, 240, 0.92)",tooltipForeground:"#101216",menuBackground:"#161a20",menuForeground:"#e6e9ee",menuHoverBackground:"rgba(255, 255, 255, 0.08)"};exports.DEFAULT_TOOL_ORDER=Qr;exports.LoraGraphCanvas=Rs;exports.TOOL_DESCRIPTORS=Ts;exports.createId=Ft;exports.darkTheme=Hv;exports.lightTheme=$v;
682
+ }`;bg(_g);function oo(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function xg(e){if(Array.isArray(e))return e}function wg(e){if(Array.isArray(e))return oo(e)}function kg(e,t,n){return(t=jg(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Cg(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Sg(e,t){var n=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(n!=null){var r,o,i,a,l=[],s=!0,u=!1;try{if(i=(n=n.call(e)).next,t!==0)for(;!(s=(r=i.call(n)).done)&&(l.push(r.value),l.length!==t);s=!0);}catch(f){u=!0,o=f}finally{try{if(!s&&n.return!=null&&(a=n.return(),Object(a)!==a))return}finally{if(u)throw o}}return l}}function Mg(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
683
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Pg(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
684
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ag(e,t){return xg(e)||Sg(e,t)||Es(e,t)||Mg()}function Rt(e){return wg(e)||Cg(e)||Es(e)||Pg()}function Og(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function jg(e){var t=Og(e,"string");return typeof t=="symbol"?t:t+""}function Es(e,t){if(e){if(typeof e=="string")return oo(e,t);var n={}.toString.call(e).slice(8,-1);return n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set"?Array.from(e):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?oo(e,t):void 0}}var Ls=function(t){t instanceof Array?t.forEach(Ls):(t.map&&t.map.dispose(),t.dispose())},Ns=function(t){t.geometry&&t.geometry.dispose(),t.material&&Ls(t.material),t.texture&&t.texture.dispose(),t.children&&t.children.forEach(Ns)},zg=function(t){for(;t.children.length;){var n=t.children[0];t.remove(n),Ns(n)}},xe=window.THREE?window.THREE:{WebGLRenderer:re.WebGLRenderer,Scene:re.Scene,PerspectiveCamera:re.PerspectiveCamera,Raycaster:re.Raycaster,SRGBColorSpace:re.SRGBColorSpace,TextureLoader:re.TextureLoader,Vector2:re.Vector2,Vector3:re.Vector3,Box3:re.Box3,Color:re.Color,Mesh:re.Mesh,SphereGeometry:re.SphereGeometry,MeshBasicMaterial:re.MeshBasicMaterial,BackSide:re.BackSide,Timer:re.Timer},Rs=_o({props:{width:{default:window.innerWidth,onChange:function(t,n,r){isNaN(t)&&(n.width=r)}},height:{default:window.innerHeight,onChange:function(t,n,r){isNaN(t)&&(n.height=r)}},viewOffset:{default:[0,0]},backgroundColor:{default:"#000011"},backgroundImageUrl:{},onBackgroundImageLoaded:{},showNavInfo:{default:!0},skyRadius:{default:5e4},objects:{default:[]},lights:{default:[]},enablePointerInteraction:{default:!0,onChange:function(t,n){n.hoverObj=null,n.tooltip&&n.tooltip.content(null)},triggerUpdate:!1},pointerRaycasterThrottleMs:{default:50,triggerUpdate:!1},lineHoverPrecision:{default:1,triggerUpdate:!1},pointsHoverPrecision:{default:1,triggerUpdate:!1},hoverOrderComparator:{triggerUpdate:!1},hoverFilter:{default:function(){return!0},triggerUpdate:!1},tooltipContent:{triggerUpdate:!1},hoverDuringDrag:{default:!1,triggerUpdate:!1},clickAfterDrag:{default:!1,triggerUpdate:!1},onHover:{default:function(){},triggerUpdate:!1},onClick:{default:function(){},triggerUpdate:!1},onRightClick:{triggerUpdate:!1}},methods:{tick:function(t){if(t.initialised){t.controls.enabled&&t.controls.update&&t.controls.update(Math.min(1,t.timer.update().getDelta())),t.postProcessingComposer?t.postProcessingComposer.render():t.renderer.render(t.scene,t.camera),t.extraRenderers.forEach(function(a){return a.render(t.scene,t.camera)});var n=+new Date;if(t.enablePointerInteraction&&n-t.lastRaycasterCheck>=t.pointerRaycasterThrottleMs){t.lastRaycasterCheck=n;var r=null;if(t.hoverDuringDrag||!t.isPointerDragging){var o=this.intersectingObjects(t.pointerPos.x,t.pointerPos.y);t.hoverOrderComparator&&o.sort(function(a,l){return t.hoverOrderComparator(a.object,l.object)});var i=o.find(function(a){return t.hoverFilter(a.object)})||null;r=i?i.object:null,t.intersection=i||null}r!==t.hoverObj&&(t.onHover(r,t.hoverObj,t.intersection),t.tooltip.content(r&&de(t.tooltipContent)(r,t.intersection)||null),t.hoverObj=r)}t.tweenGroup.update()}return this},getPointerPos:function(t){var n=t.pointerPos,r=n.x,o=n.y;return{x:r,y:o}},cameraPosition:function(t,n,r,o){var i=t.camera;if(n&&t.initialised){var a=n,l=r||{x:0,y:0,z:0};if(!o)f(a),c(l);else{var s=Object.assign({},i.position),u=p();t.tweenGroup.add(new Vi(s).to(a,o).easing(Bt.Quadratic.Out).onUpdate(f).onComplete(function(){t.tweenGroup.remove(this)}).start()),t.tweenGroup.add(new Vi(u).to(l,o/3).easing(Bt.Quadratic.Out).onUpdate(c).onComplete(function(){t.tweenGroup.remove(this)}).start())}return this}return Object.assign({},i.position,{lookAt:p()});function f(h){var d=h.x,m=h.y,v=h.z;d!==void 0&&(i.position.x=d),m!==void 0&&(i.position.y=m),v!==void 0&&(i.position.z=v)}function c(h){var d=new xe.Vector3(h.x,h.y,h.z);t.controls.enabled&&t.controls.target?t.controls.target=d:i.lookAt(d)}function p(){return Object.assign(new xe.Vector3(0,0,-1e3).applyQuaternion(i.quaternion).add(i.position))}},zoomToFit:function(t){for(var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:10,o=arguments.length,i=new Array(o>3?o-3:0),a=3;a<o;a++)i[a-3]=arguments[a];return this.fitToBbox(this.getBbox.apply(this,i),n,r)},fitToBbox:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:10,i=t.camera;if(n){var a=new xe.Vector3(0,0,0),l=Math.max.apply(Math,Rt(Object.entries(n).map(function(h){var d=Ag(h,2),m=d[0],v=d[1];return Math.max.apply(Math,Rt(v.map(function(g){return Math.abs(a[m]-g)})))})))*2,s=(1-o*2/t.height)*i.fov,u=l/Math.atan(s*Math.PI/180),f=u/i.aspect,c=Math.max(u,f);if(c>0){var p=a.clone().sub(i.position).normalize().multiplyScalar(-c);this.cameraPosition(p,a,r)}}return this},getBbox:function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:function(){return!0},r=new xe.Box3(new xe.Vector3(0,0,0),new xe.Vector3(0,0,0)),o=t.objects.filter(n);return o.length?(o.forEach(function(i){return r.expandByObject(i)}),Object.assign.apply(Object,Rt(["x","y","z"].map(function(i){return kg({},i,[r.min[i],r.max[i]])})))):null},getScreenCoords:function(t,n,r,o){var i=new xe.Vector3(n,r,o);return i.project(this.camera()),{x:(i.x+1)*t.width/2,y:-(i.y-1)*t.height/2}},getSceneCoords:function(t,n,r){var o=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=new xe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),a=new xe.Raycaster;return a.setFromCamera(i,t.camera),Object.assign({},a.ray.at(o,new xe.Vector3))},intersectingObjects:function(t,n,r){var o=new xe.Vector2(n/t.width*2-1,-(r/t.height)*2+1),i=new xe.Raycaster;return i.params.Line.threshold=t.lineHoverPrecision,i.params.Points.threshold=t.pointsHoverPrecision,i.setFromCamera(o,t.camera),i.intersectObjects(t.objects,!0)},renderer:function(t){return t.renderer},scene:function(t){return t.scene},camera:function(t){return t.camera},postProcessingComposer:function(t){return t.postProcessingComposer},controls:function(t){return t.controls},tbControls:function(t){return t.controls},_destructor:function(t){var n,r,o;zg(t.scene),(n=t.controls)===null||n===void 0||n.dispose(),(r=t.renderer)===null||r===void 0||r.dispose(),(o=t.postProcessingComposer)===null||o===void 0||o.dispose()}},stateInit:function(){return{scene:new xe.Scene,camera:new xe.PerspectiveCamera,timer:new xe.Timer,tweenGroup:new ls,lastRaycasterCheck:0}},init:function(t,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},o=r.controlType,i=o===void 0?"trackball":o,a=r.useWebGPU,l=a===void 0?!1:a,s=r.rendererConfig,u=s===void 0?{}:s,f=r.extraRenderers,c=f===void 0?[]:f,p=r.waitForLoadComplete,h=p===void 0?!0:p;t.innerHTML="",t.appendChild(n.container=document.createElement("div")),n.container.className="scene-container",n.container.style.position="relative",n.container.appendChild(n.navInfo=document.createElement("div")),n.navInfo.className="scene-nav-info",n.navInfo.textContent={orbit:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",trackball:"Left-click: rotate, Mouse-wheel/middle-click: zoom, Right-click: pan",fly:"WASD: move, R|F: up | down, Q|E: roll, up|down: pitch, left|right: yaw"}[i]||"",n.navInfo.style.display=n.showNavInfo?null:"none",n.tooltip=new mg(n.container),n.pointerPos=new xe.Vector2,n.pointerPos.x=-2,n.pointerPos.y=-2,["pointermove","pointerdown"].forEach(function(d){return n.container.addEventListener(d,function(m){if(d==="pointerdown"&&(n.isPointerPressed=!0),!n.isPointerDragging&&m.type==="pointermove"&&(m.pressure>0||n.isPointerPressed)&&(m.pointerType==="mouse"||m.movementX===void 0||[m.movementX,m.movementY].some(function(S){return Math.abs(S)>1}))&&(n.isPointerDragging=!0),n.enablePointerInteraction){var v=g(n.container);n.pointerPos.x=m.pageX-v.left,n.pointerPos.y=m.pageY-v.top}function g(S){var _=S.getBoundingClientRect(),x=window.pageXOffset||document.documentElement.scrollLeft,w=window.pageYOffset||document.documentElement.scrollTop;return{top:_.top+w,left:_.left+x}}},{passive:!0})}),n.container.addEventListener("pointerup",function(d){n.isPointerPressed&&(n.isPointerPressed=!1,!(n.isPointerDragging&&(n.isPointerDragging=!1,!n.clickAfterDrag))&&requestAnimationFrame(function(){d.button===0&&n.onClick(n.hoverObj||null,d,n.intersection),d.button===2&&n.onRightClick&&n.onRightClick(n.hoverObj||null,d,n.intersection)}))},{passive:!0,capture:!0}),n.container.addEventListener("contextmenu",function(d){n.onRightClick&&d.preventDefault()}),n.renderer=new(l?_l.WebGPURenderer:xe.WebGLRenderer)(Object.assign({antialias:!0,alpha:!0},u)),n.renderer.setPixelRatio(Math.min(2,window.devicePixelRatio)),n.container.appendChild(n.renderer.domElement),n.extraRenderers=c,n.extraRenderers.forEach(function(d){d.domElement.style.position="absolute",d.domElement.style.top="0px",d.domElement.style.pointerEvents="none",n.container.appendChild(d.domElement)}),n.postProcessingComposer=new Cl.EffectComposer(n.renderer),n.postProcessingComposer.addPass(new Sl.RenderPass(n.scene,n.camera)),n.controls=new{trackball:xl.TrackballControls,orbit:wl.OrbitControls,fly:kl.FlyControls}[i](n.camera,n.renderer.domElement),i==="fly"&&(n.controls.movementSpeed=300,n.controls.rollSpeed=Math.PI/6,n.controls.dragToLook=!0),(i==="trackball"||i==="orbit")&&(n.controls.minDistance=.1,n.controls.maxDistance=n.skyRadius,n.controls.addEventListener("start",function(){n.controlsEngaged=!0}),n.controls.addEventListener("change",function(){n.controlsEngaged&&(n.controlsDragging=!0)}),n.controls.addEventListener("end",function(){n.controlsEngaged=!1,n.controlsDragging=!1})),[n.renderer,n.postProcessingComposer].concat(Rt(n.extraRenderers)).forEach(function(d){return d.setSize(n.width,n.height)}),n.camera.aspect=n.width/n.height,n.camera.updateProjectionMatrix(),n.camera.position.z=1e3,n.scene.add(n.skysphere=new xe.Mesh),n.skysphere.visible=!1,n.loadComplete=n.scene.visible=!h,window.scene=n.scene},update:function(t,n){if(t.width&&t.height&&(n.hasOwnProperty("width")||n.hasOwnProperty("height"))){var r,o=t.width,i=t.height;t.container.style.width="".concat(o,"px"),t.container.style.height="".concat(i,"px"),[t.renderer,t.postProcessingComposer].concat(Rt(t.extraRenderers)).forEach(function(h){return h.setSize(o,i)}),t.camera.aspect=o/i;var a=t.viewOffset.slice(0,2);a.some(function(h){return h})&&(r=t.camera).setViewOffset.apply(r,[o,i].concat(Rt(a),[o,i])),t.camera.updateProjectionMatrix()}if(n.hasOwnProperty("viewOffset")){var l,s=t.width,u=t.height,f=t.viewOffset.slice(0,2);f.some(function(h){return h})?(l=t.camera).setViewOffset.apply(l,[s,u].concat(Rt(f),[s,u])):t.camera.clearViewOffset()}if(n.hasOwnProperty("skyRadius")&&t.skyRadius&&(t.controls.hasOwnProperty("maxDistance")&&n.skyRadius&&(t.controls.maxDistance=Math.min(t.controls.maxDistance,t.skyRadius)),t.camera.far=t.skyRadius*2.5,t.camera.updateProjectionMatrix(),t.skysphere.geometry=new xe.SphereGeometry(t.skyRadius)),n.hasOwnProperty("backgroundColor")){var c=tn(t.backgroundColor).alpha;c===void 0&&(c=1),t.renderer.setClearColor(new xe.Color(oh(1,t.backgroundColor)),c)}n.hasOwnProperty("backgroundImageUrl")&&(t.backgroundImageUrl?new xe.TextureLoader().load(t.backgroundImageUrl,function(h){h.colorSpace=xe.SRGBColorSpace,t.skysphere.material=new xe.MeshBasicMaterial({map:h,side:xe.BackSide}),t.skysphere.visible=!0,t.onBackgroundImageLoaded&&setTimeout(t.onBackgroundImageLoaded),!t.loadComplete&&p()}):(t.skysphere.visible=!1,t.skysphere.material.map=null,!t.loadComplete&&p())),n.hasOwnProperty("showNavInfo")&&(t.navInfo.style.display=t.showNavInfo?null:"none"),n.hasOwnProperty("lights")&&((n.lights||[]).forEach(function(h){return t.scene.remove(h)}),t.lights.forEach(function(h){return t.scene.add(h)})),n.hasOwnProperty("objects")&&((n.objects||[]).forEach(function(h){return t.scene.remove(h)}),t.objects.forEach(function(h){return t.scene.add(h)}));function p(){t.loadComplete=t.scene.visible=!0}}});function Tg(e,t){let n=null,r=null;const o=(...i)=>{r=i,n!==null&&clearTimeout(n),n=setTimeout(()=>{n=null;const a=r;r=null,e(...a)},t)};return o.cancel=()=>{n!==null&&(clearTimeout(n),n=null),r=null},o}class Eg{name;defaultVal;triggerUpdate;onChange;constructor(t,n){this.name=t,this.defaultVal=n.default??null,this.triggerUpdate=n.triggerUpdate??!0,this.onChange=n.onChange??(()=>{})}}function Lg(e={}){const{stateInit:t=()=>({}),props:n={},methods:r={},aliases:o={},init:i=()=>{},update:a=()=>{}}=e,l=Object.keys(n).map(u=>new Eg(u,n[u]));function s(...u){const f=this instanceof s,c=u.slice(),p=f?c.shift():void 0,h=c[0]??{},d=typeof t=="function"?t(h):t,m=Object.assign({},d,{initialised:!1,_rerender:()=>{}});let v={};const g=x=>(S(x,h),_(),g);function S(x,w){i.call(g,x,m,w),m.initialised=!0}const _=Tg(()=>{m.initialised&&(a.call(g,m,v),v={})},1);for(const x of l){const{name:w,triggerUpdate:b,onChange:M,defaultVal:P}=x;g[w]=function(){const j=m[w];if(arguments.length===0)return j;const F=arguments[0],I=F===void 0?P:F;return m[w]=I,M.call(g,I,m,j),Object.prototype.hasOwnProperty.call(v,w)||(v[w]=j),b&&_(),g}}for(const x of Object.keys(r))g[x]=function(...w){return r[x].call(g,m,...w)};for(const[x,w]of Object.entries(o))g[x]=g[w];return g.resetProps=function(){for(const x of l)g[x.name](x.defaultVal);return g},g.resetProps(),m._rerender=_,f&&p!==void 0&&g(p),g}return s}function ea(e){if(typeof e=="function")return e;if(typeof e=="string"){const n=e;return r=>r?.[n]}const t=e;return()=>t}function Ds(e,t){const n=e instanceof Array?e:[e],r=new t;return r._destructor?.(),{linkProp(o){return{default:r[o](),onChange(i,a){n.forEach(l=>{a[l][o].call(a[l],i)})},triggerUpdate:!1}},linkMethod(o){return function(i,...a){const l=[];return n.forEach(s=>{const u=i[s],f=u[o].apply(u,a);f!==u&&l.push(f)}),l.length?l[0]:this}}}}const ta=globalThis,na=ta.THREE?ta.THREE:{AmbientLight:re.AmbientLight,DirectionalLight:re.DirectionalLight},Ng=170,Is=Ds("forceGraph",ns),Rg=["jsonUrl","graphData","numDimensions","dagMode","dagLevelDistance","dagNodeFilter","onDagError","nodeRelSize","nodeId","nodeVal","nodeResolution","nodeColor","nodeAutoColorBy","nodeOpacity","nodeVisibility","nodeThreeObject","nodeThreeObjectExtend","nodePositionUpdate","linkSource","linkTarget","linkVisibility","linkColor","linkAutoColorBy","linkOpacity","linkWidth","linkResolution","linkCurvature","linkCurveRotation","linkMaterial","linkThreeObject","linkThreeObjectExtend","linkPositionUpdate","linkDirectionalArrowLength","linkDirectionalArrowColor","linkDirectionalArrowRelPos","linkDirectionalArrowResolution","linkDirectionalParticles","linkDirectionalParticleSpeed","linkDirectionalParticleOffset","linkDirectionalParticleWidth","linkDirectionalParticleColor","linkDirectionalParticleResolution","linkDirectionalParticleThreeObject","forceEngine","d3AlphaDecay","d3VelocityDecay","d3AlphaMin","ngraphPhysics","warmupTicks","cooldownTicks","cooldownTime","onEngineTick","onEngineStop"],Dg=["refresh","getGraphBbox","d3Force","d3ReheatSimulation","emitParticle"],fr=Ds("renderObjs",Rs),Ig=["width","height","backgroundColor","showNavInfo","enablePointerInteraction"],Fg=["lights","cameraPosition","postProcessingComposer"],Ao={};for(const e of Rg)Ao[e]=Is.linkProp(e);for(const e of Ig)Ao[e]=fr.linkProp(e);const On={};for(const e of Dg)On[e]=Is.linkMethod(e);for(const e of Fg)On[e]=fr.linkMethod(e);On.graph2ScreenCoords=fr.linkMethod("getScreenCoords");On.screen2GraphCoords=fr.linkMethod("getSceneCoords");const et=e=>e;function wt(e){let t=e??null;for(;t&&!Object.prototype.hasOwnProperty.call(t,"__graphObjType");)t=t.parent;return t}const Bg=Lg({props:{nodeLabel:{default:"name",triggerUpdate:!1},linkLabel:{default:"name",triggerUpdate:!1},linkHoverPrecision:{default:1,onChange(e,t){et(t).renderObjs.lineHoverPrecision(e)},triggerUpdate:!1},enableNavigationControls:{default:!0,onChange(e,t){const r=et(t).renderObjs.controls();r&&(r.enabled=!!e,e&&r.domElement&&r.domElement.dispatchEvent(new PointerEvent("pointerup")))},triggerUpdate:!1},enableNodeDrag:{default:!0,triggerUpdate:!1},onNodeDrag:{default:()=>{},triggerUpdate:!1},onNodeDragEnd:{default:()=>{},triggerUpdate:!1},onNodeClick:{triggerUpdate:!1},onNodeRightClick:{triggerUpdate:!1},onNodeHover:{triggerUpdate:!1},onLinkClick:{triggerUpdate:!1},onLinkRightClick:{triggerUpdate:!1},onLinkHover:{triggerUpdate:!1},onBackgroundClick:{triggerUpdate:!1},onBackgroundRightClick:{triggerUpdate:!1},showPointerCursor:{default:!0,triggerUpdate:!1},...Ao},methods:{zoomToFit(e,t,n,...r){return et(e).renderObjs.fitToBbox(this.getGraphBbox(...r),t,n),this},pauseAnimation(e){const t=et(e);return t.animationFrameRequestId!=null&&(cancelAnimationFrame(t.animationFrameRequestId),t.animationFrameRequestId=null),this},resumeAnimation(e){return et(e).animationFrameRequestId==null&&this._animationCycle(),this},_animationCycle(e){const t=et(e);t.enablePointerInteraction&&(this.renderer().domElement.style.cursor=""),t.forceGraph.tickFrame(),t.renderObjs.tick(),t.animationFrameRequestId=requestAnimationFrame(this._animationCycle)},scene(e){return et(e).renderObjs.scene()},camera(e){return et(e).renderObjs.camera()},renderer(e){return et(e).renderObjs.renderer()},controls(e){return et(e).renderObjs.controls()},_destructor(e){const t=et(e);this.pauseAnimation(),this.graphData({nodes:[],links:[]}),t.forceGraph._destructor?.(),t.renderObjs._destructor()},...On},stateInit:e=>{const t=e??{},n=new ns,r=Rs({...t.controlType?{controlType:t.controlType}:{},...t.rendererConfig?{rendererConfig:t.rendererConfig}:{},...t.extraRenderers?{extraRenderers:t.extraRenderers}:{}});return r.objects([n]),r.lights([new na.AmbientLight(13421772,Math.PI),new na.DirectionalLight(16777215,.6*Math.PI)]),{forceGraph:n,renderObjs:r}},init(e,t){const n=et(t);e.innerHTML="",n.container=document.createElement("div"),n.container.style.position="relative",e.appendChild(n.container);const r=document.createElement("div");n.container.appendChild(r),n.renderObjs(r);const o=n.renderObjs.camera(),i=n.renderObjs.renderer(),a=n.renderObjs.controls();a&&(a.enabled=!!n.enableNavigationControls),n.lastSetCameraZ=o.position.z;const l=document.createElement("div");l.className="graph-info-msg",l.textContent="",n.container.appendChild(l);const s=n.forceGraph;s.onLoading(()=>{l.textContent="Loading..."}),s.onFinishLoading(()=>{l.textContent=""}),s.onUpdate(()=>{if(n.graphData=s.graphData(),o.position.x===0&&o.position.y===0&&o.position.z===n.lastSetCameraZ&&n.graphData.nodes.length){o.lookAt(s.position??{x:0,y:0,z:0});const f=Math.cbrt(n.graphData.nodes.length)*Ng;o.position.z=f,n.lastSetCameraZ=f}}),s.onFinishUpdate(()=>{if(n._dragControls){const f=n.graphData.nodes.find(c=>c.__initialFixedPos&&!c.__disposeControlsAfterDrag);f?f.__disposeControlsAfterDrag=!0:n._dragControls.dispose(),n._dragControls=void 0}if(n.enableNodeDrag&&n.enablePointerInteraction&&n.forceEngine==="d3"){const f=n.graphData.nodes.map(h=>h.__threeObj).filter(h=>!!h),c=new bl.DragControls(f,o,i.domElement);n._dragControls=c,c.addEventListener("dragstart",h=>{const d=h,m=wt(d.object);if(!m)return;a&&(a.enabled=!1),d.object.__initialPos=d.object.position.clone(),d.object.__prevPos=d.object.position.clone();const v=m.__data;v.__initialFixedPos||(v.__initialFixedPos={fx:v.fx,fy:v.fy,fz:v.fz}),v.__initialPos||(v.__initialPos={x:v.x,y:v.y,z:v.z});for(const g of["x","y","z"])v[`f${g}`]=v[g];i.domElement.classList.add("grabbable")});const p=4;c.addEventListener("drag",h=>{const d=h,m=wt(d.object);if(!m)return;if(!Object.prototype.hasOwnProperty.call(d.object,"__graphObjType")){const _=d.object.__initialPos,x=d.object.__prevPos,w=d.object.position,b=w.clone().sub(x);m.position.add(b),x.copy(w),w.copy(_)}const v=m.__data,g=m.position;if(!v.__dragCommitted){const _=v.__initialPos,x=_?.x??g.x,w=_?.y??g.y,b=_?.z??g.z,M=g.x-x,P=g.y-w,N=g.z-b;if(M*M+P*P+N*N<p)return;v.__dragCommitted=!0}const S={x:g.x-(v.x??0),y:g.y-(v.y??0),z:g.z-(v.z??0)};for(const _ of["x","y","z"])v[`f${_}`]=g[_],v[_]=g[_];n.forceGraph.d3AlphaTarget(.3).resetCountdown(),v.__dragged=!0,n.onNodeDrag?.(v,S)}),c.addEventListener("dragend",h=>{const d=h,m=wt(d.object);if(!m)return;delete d.object.__initialPos,delete d.object.__prevPos;const v=m.__data;v.__disposeControlsAfterDrag&&(c.dispose(),delete v.__disposeControlsAfterDrag);const g=v.__initialFixedPos,S=v.__initialPos,_=S?{x:S.x-v.x,y:S.y-v.y,z:S.z-v.z}:{x:0,y:0,z:0};if(g){for(const x of["x","y","z"]){const w=`f${x}`;g[w]===void 0&&delete v[w]}delete v.__initialFixedPos,delete v.__initialPos,delete v.__dragCommitted,v.__dragged&&(delete v.__dragged,n.onNodeDragEnd?.(v,_))}n.forceGraph.d3AlphaTarget(0).resetCountdown(),n.enableNavigationControls&&a&&(a.enabled=!0,a._status!==void 0&&(a._onPointerCancel?.(),a.domElement?.ownerDocument?.dispatchEvent(new PointerEvent("pointerup",{pointerType:"touch"})))),i.domElement.classList.remove("grabbable")})}}),parseInt(re.REVISION,10)<155&&(i.useLegacyLights=!1),n.renderObjs.hoverOrderComparator((f,c)=>{const p=wt(f);if(!p)return 1;const h=wt(c);if(!h)return-1;const d=m=>m.__graphObjType==="node"?1:0;return d(h)-d(p)}).tooltipContent(f=>{const c=wt(f);if(!c)return"";const p=n[`${c.__graphObjType}Label`];return ea(p)(c.__data)||""}).hoverDuringDrag(!1).onHover(f=>{const c=wt(f);if(c===n.hoverObj)return;const p=n.hoverObj??null,h=p?p.__graphObjType:null,d=p?p.__data:null,m=c?c.__graphObjType:null,v=c?c.__data:null;if(h&&h!==m){const _=n[`on${h==="node"?"Node":"Link"}Hover`];_?.(null,d)}if(m){const _=n[`on${m==="node"?"Node":"Link"}Hover`];_?.(v,h===m?d:null)}const S=!!(c?n[`on${m==="node"?"Node":"Link"}Click`]:n.onBackgroundClick)&&ea(n.showPointerCursor)(v);i.domElement.classList[S?"add":"remove"]("clickable"),n.hoverObj=c}).clickAfterDrag(!1).onClick((f,c)=>{const p=wt(f);if(p){const h=n[`on${p.__graphObjType==="node"?"Node":"Link"}Click`];h?.(p.__data,c)}else n.onBackgroundClick&&n.onBackgroundClick(c)}).onRightClick((f,c)=>{const p=wt(f);if(p){const h=n[`on${p.__graphObjType==="node"?"Node":"Link"}RightClick`];h?.(p.__data,c)}else n.onBackgroundRightClick&&n.onBackgroundRightClick(c)}),this._animationCycle()},update(){}});function pt(e,t,n,r=Hg){if(typeof requestAnimationFrame!="function")return t(1),()=>{};const o=performance.now();let i=null,a=!1;const l=s=>{if(a)return;const u=s-o,f=Math.min(1,u/Math.max(e,1));t(r(f)),f<1?i=requestAnimationFrame(l):i=null};return i=requestAnimationFrame(l),()=>{a=!0,i!==null&&cancelAnimationFrame(i),i=null}}function $g(e){if(typeof requestAnimationFrame!="function")return e(0),()=>{};let t=null,n=!1,r=performance.now();const o=i=>{if(n)return;const a=Math.min(.033,(i-r)/1e3);if(r=i,e(a)===!0){t=null;return}t=requestAnimationFrame(o)};return t=requestAnimationFrame(o),()=>{n=!0,t!==null&&cancelAnimationFrame(t),t=null}}function Hg(e){return 1-(1-e)*(1-e)}function ra(e){return e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2}function Q(e,t,n){return e+(t-e)*n}const fe=()=>!0,tt=e=>e==="2d",Me=e=>e==="3d",qg=[{key:"nodeId",setter:"nodeId",supports:fe},{key:"linkSource",setter:"linkSource",supports:fe},{key:"linkTarget",setter:"linkTarget",supports:fe},{key:"backgroundColor",setter:"backgroundColor",supports:fe},{key:"nodeColor",setter:"nodeColor",supports:fe},{key:"nodeLabel",setter:"nodeLabel",supports:fe},{key:"nodeVal",setter:"nodeVal",supports:fe},{key:"nodeAutoColorBy",setter:"nodeAutoColorBy",supports:fe},{key:"nodeRelSize",setter:"nodeRelSize",supports:fe},{key:"nodeVisibility",setter:"nodeVisibility",supports:fe},{key:"linkColor",setter:"linkColor",supports:fe},{key:"linkLabel",setter:"linkLabel",supports:fe},{key:"linkWidth",setter:"linkWidth",supports:fe},{key:"linkCurvature",setter:"linkCurvature",supports:fe},{key:"linkAutoColorBy",setter:"linkAutoColorBy",supports:fe},{key:"linkVisibility",setter:"linkVisibility",supports:fe},{key:"linkDirectionalArrowLength",setter:"linkDirectionalArrowLength",supports:fe},{key:"linkDirectionalArrowColor",setter:"linkDirectionalArrowColor",supports:fe},{key:"linkDirectionalArrowRelPos",setter:"linkDirectionalArrowRelPos",supports:fe},{key:"linkDirectionalParticles",setter:"linkDirectionalParticles",supports:fe},{key:"linkDirectionalParticleSpeed",setter:"linkDirectionalParticleSpeed",supports:fe},{key:"linkDirectionalParticleWidth",setter:"linkDirectionalParticleWidth",supports:fe},{key:"linkDirectionalParticleOffset",setter:"linkDirectionalParticleOffset",supports:fe},{key:"linkDirectionalParticleColor",setter:"linkDirectionalParticleColor",supports:fe},{key:"cooldownTicks",setter:"cooldownTicks",supports:fe},{key:"cooldownTime",setter:"cooldownTime",supports:fe},{key:"warmupTicks",setter:"warmupTicks",supports:fe},{key:"d3AlphaDecay",setter:"d3AlphaDecay",supports:fe},{key:"d3VelocityDecay",setter:"d3VelocityDecay",supports:fe},{key:"d3AlphaMin",setter:"d3AlphaMin",supports:fe},{key:"d3AlphaTarget",setter:"d3AlphaTarget",supports:fe},{key:"dagMode",setter:"dagMode",supports:fe},{key:"dagLevelDistance",setter:"dagLevelDistance",supports:fe},{key:"dagNodeFilter",setter:"dagNodeFilter",supports:fe},{key:"onDagError",setter:"onDagError",supports:fe},{key:"enableNodeDrag",setter:"enableNodeDrag",supports:fe},{key:"enablePointerInteraction",setter:"enablePointerInteraction",supports:fe},{key:"linkHoverPrecision",setter:"linkHoverPrecision",supports:fe},{key:"showPointerCursor",setter:"showPointerCursor",supports:fe},{key:"enableZoom",setter:"enableZoomInteraction",supports:tt},{key:"enablePan",setter:"enablePanInteraction",supports:tt},{key:"minZoom",setter:"minZoom",supports:tt},{key:"maxZoom",setter:"maxZoom",supports:tt},{key:"autoPauseRedraw",setter:"autoPauseRedraw",supports:tt},{key:"linkLineDash",setter:"linkLineDash",supports:tt},{key:"nodeCanvasObject",setter:"nodeCanvasObject",supports:tt},{key:"nodeCanvasObjectMode",setter:"nodeCanvasObjectMode",supports:tt},{key:"nodePointerAreaPaint",setter:"nodePointerAreaPaint",supports:tt},{key:"linkCanvasObject",setter:"linkCanvasObject",supports:tt},{key:"linkCanvasObjectMode",setter:"linkCanvasObjectMode",supports:tt},{key:"linkPointerAreaPaint",setter:"linkPointerAreaPaint",supports:tt},{key:"showNavInfo",setter:"showNavInfo",supports:Me},{key:"enableNavigationControls",setter:"enableNavigationControls",supports:Me},{key:"nodeOpacity",setter:"nodeOpacity",supports:Me},{key:"nodeResolution",setter:"nodeResolution",supports:Me},{key:"linkOpacity",setter:"linkOpacity",supports:Me},{key:"linkResolution",setter:"linkResolution",supports:Me},{key:"linkCurveRotation",setter:"linkCurveRotation",supports:Me},{key:"linkMaterial",setter:"linkMaterial",supports:Me},{key:"nodeThreeObject",setter:"nodeThreeObject",supports:Me},{key:"nodeThreeObjectExtend",setter:"nodeThreeObjectExtend",supports:Me},{key:"linkThreeObject",setter:"linkThreeObject",supports:Me},{key:"linkThreeObjectExtend",setter:"linkThreeObjectExtend",supports:Me},{key:"nodePositionUpdate",setter:"nodePositionUpdate",supports:Me},{key:"linkPositionUpdate",setter:"linkPositionUpdate",supports:Me},{key:"linkDirectionalArrowResolution",setter:"linkDirectionalArrowResolution",supports:Me},{key:"linkDirectionalParticleResolution",setter:"linkDirectionalParticleResolution",supports:Me},{key:"numDimensions",setter:"numDimensions",supports:Me},{key:"forceEngine",setter:"forceEngine",supports:Me},{key:"ngraphPhysics",setter:"ngraphPhysics",supports:Me},{key:"pointerRaycasterThrottleMs",setter:"pointerRaycasterThrottleMs",supports:Me}];function oa(e,t,n,r){if(t!==n)for(const o of qg){if(!o.supports(r))continue;const i=t[o.key],a=n[o.key];if(Object.is(i,a))continue;const l=e[o.setter];typeof l=="function"&&l.call(e,i)}}const Ug=["onNodeClick","onNodeRightClick","onNodeHover","onNodeDrag","onNodeDragEnd","onLinkClick","onLinkRightClick","onLinkHover","onBackgroundClick","onBackgroundRightClick","onEngineTick","onEngineStop"],Xt=1200,Dt=300,vn=Object.freeze({x:0,y:0,z:0});function Gg(e,t,n){const r=new Bg(e,{controlType:"orbit"});r.width(t.width),r.height(t.height);const o=new Set;for(const y of Ug){const k=r[y];if(typeof k=="function"){if(y==="onEngineStop"){k.call(r,(...C)=>{for(const B of[...o])try{B()}catch{}const $=n.current.onEngineStop;typeof $=="function"&&$(...C)});continue}k.call(r,(...C)=>{const $=n.current[y];typeof $=="function"&&$(...C)})}}oa(r,t.initialProps,{},"3d"),r.graphData(t.initialData);let i=t.initialMode,a=i==="2d"?Xt:Dt,l=null,s=null;const u=new WeakMap,f=new WeakMap,c=new WeakMap,p=new WeakMap;let h=!1,d=t.initialData;const m=(y,k)=>{if(y.nodes.length===0||k.nodes.length===0)return!1;const C=new Set;for(const B of y.nodes)C.add(B.id);let $=0;for(const B of k.nodes)C.has(B.id)&&$++;return $*2>=y.nodes.length},v=()=>{const y=r.graphData();for(const k of y.nodes){const C=k;C.fx===void 0&&typeof C.x=="number"&&(C.fx=C.x,u.set(k,C.x)),C.fy===void 0&&typeof C.y=="number"&&(C.fy=C.y,f.set(k,C.y)),C.fz===void 0&&typeof C.z=="number"&&(C.fz=C.z,c.set(k,C.z))}},g=()=>{h=!1,o.delete(g);const y=r.graphData();for(const k of y.nodes){const C=k,$=u.get(k);$!==void 0&&C.fx===$&&delete C.fx,u.delete(k);const B=f.get(k);B!==void 0&&C.fy===B&&delete C.fy,f.delete(k);const X=c.get(k);X!==void 0&&i==="3d"&&C.fz===X&&delete C.fz,c.delete(k)}},S=()=>{h||(h=!0,o.add(g))},_=y=>{const k=r.controls?.();if(!k)return;const C=k;y==="2d"?(C.noRotate=!0,C.enableRotate=!1,C.zoomToCursor=!0,C.screenSpacePanning=!0,C.zoomSpeed=1.6,C.panSpeed=1.2,C.mouseButtons&&(C.mouseButtons.LEFT=re.MOUSE.PAN)):(C.noRotate=!1,C.enableRotate=!0,C.zoomToCursor=!1,C.screenSpacePanning=!0,C.zoomSpeed=1,C.panSpeed=1,C.mouseButtons&&(C.mouseButtons.LEFT=re.MOUSE.ROTATE))},x=()=>{const y=r.graphData();for(const k of y.nodes)k.fz=0},w=()=>{const y=r.graphData();for(const k of y.nodes)delete k.fz},b=()=>{const y=r.graphData(),k=new Map;let C=0;for(const B of y.nodes){const X=B.x??0,L=B.y??0,D=Math.hypot(X,L);D>C&&(C=D)}const $=Math.max(40,C*.6);for(const B of y.nodes){const X=p.get(B);typeof X=="number"&&Number.isFinite(X)?k.set(B,X):k.set(B,(Math.random()-.5)*2*$)}return k};i==="2d"?(x(),_("2d"),r.cameraPosition?.({x:0,y:0,z:Xt},{x:0,y:0,z:0},0)):(_("3d"),r.cameraPosition?.({x:0,y:0,z:Dt},{x:0,y:0,z:0},0));const M=()=>r.cameraPosition?.(),P=()=>{const k=r.controls?.()?.target;return k?{x:k.x,y:k.y,z:k.z}:null},N=()=>{const y=r.getGraphBbox?.();if(!y)return null;const k=(y.x[0]+y.x[1])/2,C=(y.y[0]+y.y[1])/2,$=(y.z[0]+y.z[1])/2;return!Number.isFinite(k)||!Number.isFinite(C)||!Number.isFinite($)?null:{x:k,y:C,z:$}},j=60,F=y=>{const k=r.camera?.()??{},C=k.fov??50,$=r.width?.()??t.width,B=r.height?.()??t.height;if($<=0||B<=0)return null;const X=Math.max(1,$-2*y),L=Math.max(1,B-2*y),D=k.aspect??$/B,q=C*Math.PI/180/2,Y=Math.tan(q),E=Math.sin(q),H=Math.sin(Math.atan(Y*D));return{fov:C,aspect:D,w:$,h:B,effW:X,effH:L,halfFovV:q,tanHalfV:Y,sinHalfV:E,sinHalfH:H}},I=(y,k,C)=>{const $=r.getGraphBbox?.();if(!$)return null;const B=C??F(y);if(!B)return null;const X=($.x[0]+$.x[1])/2,L=($.y[0]+$.y[1])/2,D=($.z[0]+$.z[1])/2,q=Math.max(($.x[1]-$.x[0])/2,1),Y=Math.max(($.y[1]-$.y[0])/2,1),E=Math.max(($.z[1]-$.z[0])/2,0),H=M();if(!H)return null;k.endLookAt.x=X,k.endLookAt.y=L,k.endLookAt.z=D;let T;if(i==="2d"){const W=Y*B.h/B.effH/B.tanHalfV,V=q*B.h/B.effW/B.tanHalfV;T=W>V?W:V,T<j&&(T=j),k.endPos.x=X,k.endPos.y=L,k.endPos.z=D+T}else{const W=Math.sqrt(q*q+Y*Y+E*E),V=W*B.h/(B.effH*B.sinHalfV),G=W*B.w/(B.effW*B.sinHalfH);T=V>G?V:G,T<j&&(T=j);const U=H.lookAt??vn,ee=H.x-U.x,ne=H.y-U.y,ie=H.z-U.z,le=Math.sqrt(ee*ee+ne*ne+ie*ie),ae=le===0?0:ee/le,ce=le===0?0:ne/le,be=le===0?1:ie/le;k.endPos.x=X+ae*T,k.endPos.y=L+ce*T,k.endPos.z=D+be*T}return k.dist=T,a=T,k},K={get mode(){return i},setGraphData(y){if(y===d)return;const k=r.graphData();d=y;const C=m(k,y);C&&v(),r.graphData(y),i==="2d"&&x(),C&&S()},getGraphData(){return r.graphData()},fit(y,k){s?.();const C=y??400,B=I(k??40,{endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0});if(!B)return;const X=M();if(!X)return;if(C<=0){r.cameraPosition?.(B.endPos,B.endLookAt,0);return}const L=X.lookAt??vn,D=B.endPos,q=B.endLookAt;s=pt(C,Y=>{r.cameraPosition?.({x:Q(X.x,D.x,Y),y:Q(X.y,D.y,Y),z:Q(X.z,D.z,Y)},{x:Q(L.x,q.x,Y),y:Q(L.y,q.y,Y),z:Q(L.z,q.z,Y)},0)})},centerAt(y,k,C,$){if(i==="2d"){r.cameraPosition?.({x:y,y:k,z:Xt},{x:y,y:k,z:0},$??0);return}const B=M();r.cameraPosition?.({x:y,y:k,z:C??a},B?.lookAt,$??0)},zoom(y,k){const C=M();if(!C)return;const $=Math.hypot(C.x,C.y,C.z);a=$/Math.max(y,.001);const B=$===0?{x:0,y:0,z:1}:{x:C.x/$,y:C.y/$,z:C.z/$};r.cameraPosition?.({x:B.x*a,y:B.y*a,z:B.z*a},C.lookAt,k??0)},getZoom(){const y=M();if(!y)return 1;const k=Math.hypot(y.x,y.y,y.z);return k===0?1:a/k},screen2Graph(y,k,C){return r.screen2GraphCoords?.(y,k,C??0)??{x:y,y:k,z:0}},graph2Screen(y,k,C){return r.graph2ScreenCoords?.(y,k,C??0)??{x:y,y:k,z:C??0}},getGraphBbox(){return r.getGraphBbox?.()??{x:[0,0],y:[0,0],z:[0,0]}},pause(){r.pauseAnimation?.()},resume(){r.resumeAnimation?.()},reheat(){r.d3ReheatSimulation?.()},resize(y,k){r.width(y),r.height(k)},d3Force(y,k){const C=r.d3Force;if(typeof C=="function")return k===void 0?C.call(r,y):C.call(r,y,k)},emitParticle(y){r.emitParticle?.(y)},stopAnimation(){s?.(),s=null},focusOn(y,k){s?.();const C=M();if(!C)return;const $=y.z??0,B=k?.durationMs??1e3;if(i==="2d"){const V=k?.zoom!==void 0?a/Math.max(k.zoom,.001):Xt;s=pt(B,G=>{const U=Q(C.x,y.x,G),ee=Q(C.y,y.y,G),ne=Q(C.z,V,G);r.cameraPosition?.({x:U,y:ee,z:ne},{x:U,y:ee,z:0},0)});return}const X=C.x-y.x,L=C.y-y.y,D=C.z-$,q=Math.hypot(X,L,D),Y=k?.distance??120,E=q===0?{x:0,y:0,z:1}:{x:X/q,y:L/q,z:D/q},H={x:y.x+E.x*Y,y:y.y+E.y*Y,z:$+E.z*Y},T={x:y.x,y:y.y,z:$},W=C.lookAt??{x:0,y:0,z:0};s=pt(B,V=>{r.cameraPosition?.({x:Q(C.x,H.x,V),y:Q(C.y,H.y,V),z:Q(C.z,H.z,V)},{x:Q(W.x,T.x,V),y:Q(W.y,T.y,V),z:Q(W.z,T.z,V)},0)})},panBy(y,k){const C=y.x??0,$=y.y??0,B=i==="2d"?0:y.z??0;if(C===0&&$===0&&B===0)return;s?.();const X=M();if(!X)return;const L=X.lookAt??{x:0,y:0,z:0},D=k??0,q={x:X.x+C,y:X.y+$,z:X.z+B},Y={x:L.x+C,y:L.y+$,z:L.z+B};if(D<=0){r.cameraPosition?.(q,Y,0);return}s=pt(D,E=>{r.cameraPosition?.({x:Q(X.x,q.x,E),y:Q(X.y,q.y,E),z:Q(X.z,q.z,E)},{x:Q(L.x,Y.x,E),y:Q(L.y,Y.y,E),z:Q(L.z,Y.z,E)},0)})},goTo(y,k){s?.();const C=M();if(!C)return;const $=y.z??0,B=k?.durationMs??600,X=C.lookAt??{x:0,y:0,z:0},L=y.x-X.x,D=y.y-X.y,q=i==="2d"?0:$-X.z,Y={x:C.x+L,y:C.y+D,z:C.z+q},E={x:y.x,y:y.y,z:i==="2d"?0:$};if(B<=0){r.cameraPosition?.(Y,E,0);return}s=pt(B,H=>{r.cameraPosition?.({x:Q(C.x,Y.x,H),y:Q(C.y,Y.y,H),z:Q(C.z,Y.z,H)},{x:Q(X.x,E.x,H),y:Q(X.y,E.y,H),z:Q(X.z,E.z,H)},0)})},fitToNodes(y,k,C){const $=y;if($.length===0){K.fit(k,C);return}const B=new Set($),X=r.graphData();let L=1/0,D=-1/0,q=1/0,Y=-1/0,E=1/0,H=-1/0,T=0;for(const Ce of X.nodes){if(!B.has(Ce.id))continue;const Ie=Ce,Le=Ie.x??0,ve=Ie.y??0,Qe=Ie.z??0;Le<L&&(L=Le),Le>D&&(D=Le),ve<q&&(q=ve),ve>Y&&(Y=ve),Qe<E&&(E=Qe),Qe>H&&(H=Qe),T++}if(T===0){K.fit(k,C);return}const W=k??400,V=C??40,G=r.camera?.()??{},U=G.fov??50,ee=r.width?.()??t.width,ne=r.height?.()??t.height;if(ee<=0||ne<=0)return;const ie=Math.max(1,ee-2*V),le=Math.max(1,ne-2*V),ae=G.aspect??ee/ne,ce={x:(L+D)/2,y:(q+Y)/2,z:(E+H)/2},be=Math.max((D-L)/2,1),We=Math.max((Y-q)/2,1),Pe=Math.max((H-E)/2,0),Ye=U*Math.PI/180/2,Xe=Math.tan(Ye),ot=60,Ae=M();if(!Ae)return;let _e;const Se={x:ce.x,y:ce.y,z:ce.z};if(i==="2d"){const Ce=We*ne/le/Xe,Ie=be*ne/ie/Xe,Le=Math.max(Ce,Ie,ot);_e={x:ce.x,y:ce.y,z:ce.z+Le},a=Le}else{const Ce=Math.hypot(be,We,Pe),Ie=Math.atan(Xe*ae),Le=Ce*ne/(le*Math.sin(Ye)),ve=Ce*ee/(ie*Math.sin(Ie)),Qe=Math.max(Le,ve,ot),it=Ae.lookAt??{x:0,y:0,z:0},se=Ae.x-it.x,ye=Ae.y-it.y,qe=Ae.z-it.z,Ct=Math.hypot(se,ye,qe),Tt=Ct===0?{x:0,y:0,z:1}:{x:se/Ct,y:ye/Ct,z:qe/Ct};_e={x:ce.x+Tt.x*Qe,y:ce.y+Tt.y*Qe,z:ce.z+Tt.z*Qe},a=Qe}if(s?.(),W<=0){r.cameraPosition?.(_e,Se,0);return}const He=Ae.lookAt??{x:0,y:0,z:0};s=pt(W,Ce=>{r.cameraPosition?.({x:Q(Ae.x,_e.x,Ce),y:Q(Ae.y,_e.y,Ce),z:Q(Ae.z,_e.z,Ce)},{x:Q(He.x,Se.x,Ce),y:Q(He.y,Se.y,Ce),z:Q(He.z,Se.z,Ce)},0)})},getCameraState(){const y=M()??{x:0,y:0,z:Dt};if(i==="2d"){const k=y.lookAt??{x:0,y:0},C=a/Math.max(Math.hypot(y.x,y.y,y.z),1);return{mode:"2d",x:k.x,y:k.y,k:C}}return{mode:"3d",x:y.x,y:y.y,z:y.z,lookAt:y.lookAt??{x:0,y:0,z:0}}},setCameraState(y,k){s?.();const C=k??0,$=M()??{x:0,y:0,z:Dt};if(y.mode==="2d"){const X=O(y.k)??Xt;if(C<=0){r.cameraPosition?.({x:y.x,y:y.y,z:X},{x:y.x,y:y.y,z:0},0);return}const L=$.lookAt??{x:0,y:0};s=pt(C,D=>{const q=Q($.x,y.x,D),Y=Q($.y,y.y,D),E=Q($.z,X,D);r.cameraPosition?.({x:q,y:Y,z:E},{x:Q(L.x,y.x,D),y:Q(L.y,y.y,D),z:0},0)});return}if(C<=0){r.cameraPosition?.({x:y.x,y:y.y,z:y.z},y.lookAt,0);return}const B=$.lookAt??y.lookAt;s=pt(C,X=>{r.cameraPosition?.({x:Q($.x,y.x,X),y:Q($.y,y.y,X),z:Q($.z,y.z,X)},{x:Q(B.x,y.lookAt.x,X),y:Q(B.y,y.lookAt.y,X),z:Q(B.z,y.lookAt.z,X)},0)})},applyProps(y,k){oa(r,y,k,"3d")},getCanvasElement(){return e.querySelector("canvas")},destroy(){s?.(),s=null,r._destructor()},setMode(y,k=800){if(y===i)return;i=y,s?.();const C=M()??{x:0,y:0,z:Dt};if(y==="2d"){const T=P()??C.lookAt??vn,V=N()??{x:T.x,y:T.y};l={x:C.x,y:C.y,z:C.z,lookAt:{x:T.x,y:T.y,z:T.z}};const G=r.graphData(),U=new Map;for(const ae of G.nodes){const ce=ae.z,be=typeof ce=="number"?ce:0;U.set(ae,be),p.set(ae,be)}const ee={x:T.x,y:T.y,z:T.z},ne={x:V.x,y:V.y,z:0},ie=Math.hypot(C.x-T.x,C.y-T.y,C.z-T.z)||Xt,le={x:V.x,y:V.y,z:ie};s=pt(k,ae=>{for(const[ce,be]of U)ce.z=Q(be,0,ae);r.cameraPosition?.({x:Q(C.x,le.x,ae),y:Q(C.y,le.y,ae),z:Q(C.z,le.z,ae)},{x:Q(ee.x,ne.x,ae),y:Q(ee.y,ne.y,ae),z:Q(ee.z,ne.z,ae)},0),ae>=1&&(x(),_("2d"),a=ie)},void 0,ra);return}w(),_("3d");const $=b(),B=new Map;for(const[T]of $){const W=T.z;B.set(T,typeof W=="number"?W:0)}const X=P()??C.lookAt??vn,L={x:X.x,y:X.y,z:0},D=N(),q=D?{x:D.x,y:D.y,z:0}:{...L},Y=Math.abs(C.z)||Dt,E=Math.PI/6;let H;if(l){const T=l.lookAt??vn;H={x:q.x+(l.x-T.x),y:q.y+(l.y-T.y),z:q.z+(l.z-T.z)}}else H={x:q.x,y:q.y-Y*Math.sin(E),z:q.z+Y*Math.cos(E)};s=pt(k,T=>{for(const[W,V]of $){const G=B.get(W)??0;W.z=Q(G,V,T)}r.cameraPosition?.({x:Q(C.x,H.x,T),y:Q(C.y,H.y,T),z:Q(C.z,H.z,T)},{x:Q(L.x,q.x,T),y:Q(L.y,q.y,T),z:Q(L.z,q.z,T)},0),T>=1&&(r.d3ReheatSimulation?.(),a=Math.hypot(H.x-q.x,H.y-q.y,H.z-q.z))},void 0,ra)},introFollow(y){const k=y?.padding??40,C=y?.maxDurationMs??4e3,B=r.graphData().nodes?.length??0;if(B===0)return;const X=y?.tauSeconds??.18+.09*Math.log10(Math.max(1,B)),L=B<200?2:B<2e3?4:6;s?.();const D=r.cameraPosition,q=D?D.bind(r):null,Y={endPos:{x:0,y:0,z:0},endLookAt:{x:0,y:0,z:0},dist:0},E={x:0,y:0,z:0},H={x:0,y:0,z:0};let T=F(k);const W=I(k,Y,T);W&&q&&q(W.endPos,W.endLookAt,0);let V=W?.endPos.x??0,G=W?.endPos.y??0,U=W?.endPos.z??Dt,ee=W?.endLookAt.x??0,ne=W?.endLookAt.y??0,ie=W?.endLookAt.z??0,le=0,ae=0,ce=W!==null,be=!1;const Pe=r.renderer?.()?.domElement,Ye=()=>{be=!0};Pe?.addEventListener("pointerdown",Ye,{passive:!0}),Pe?.addEventListener("wheel",Ye,{passive:!0});const Xe=()=>{o.delete(Ae),Pe?.removeEventListener("pointerdown",Ye),Pe?.removeEventListener("wheel",Ye)},ot=()=>{!ce||!q||q(Y.endPos,Y.endLookAt,0)},Ae=()=>{if(ce){const _e=Y.endPos,Se=V-_e.x,He=G-_e.y,Ce=U-_e.z,Ie=Se*Se+He*He+Ce*Ce,Le=Math.max(.5,a*.001);Ie>Le*Le&&ot()}Xe(),s=null};o.add(Ae),s=$g(_e=>{if(be)return Xe(),s=null,!0;if(le+=_e*1e3,le>=C)return ot(),Xe(),s=null,!0;if(!(ae&31)){const Ie=F(k);Ie&&(T=Ie)}if(ae%L===0&&I(k,Y,T)&&(ce=!0),ae++,!ce||!q)return!1;const Se=1-Math.exp(-_e/X),He=Y.endPos,Ce=Y.endLookAt;V+=(He.x-V)*Se,G+=(He.y-G)*Se,U+=(He.z-U)*Se,ee+=(Ce.x-ee)*Se,ne+=(Ce.y-ne)*Se,ie+=(Ce.z-ie)*Se,E.x=V,E.y=G,E.z=U,H.x=ee,H.y=ne,H.z=ie,q(E,H,0)})}};return K;function O(y){return!Number.isFinite(y)||y===0?null:a/y}}function Vg(e){const{mount:t,mode:n,width:r,height:o,data:i,props:a,paused:l,modeTransitionMs:s=800}=e,[u,f]=A.useState(null),c=A.useRef(a);c.current=a;const p=A.useRef(a),h=A.useRef(null),d=A.useRef(n);return A.useEffect(()=>{if(!t)return;const m=Gg(t,{initialProps:a,initialData:i,width:r,height:o,initialMode:d.current},c);return p.current=a,h.current=i,f(m),()=>{m.destroy(),f(null),h.current=null}},[t]),A.useEffect(()=>{u&&u.mode!==n&&u.setMode(n,s)},[u,n,s]),A.useEffect(()=>{u&&(l?u.pause():u.resume())},[u,l]),A.useEffect(()=>{u&&u.resize(r,o)},[u,r,o]),A.useEffect(()=>{u&&h.current!==i&&(u.setGraphData(i),h.current=i)},[u,i]),A.useEffect(()=>{u&&(u.applyProps(a,p.current),p.current=a)},[u,a]),u}function Wg(e){const[t,n]=A.useState(null);return A.useEffect(()=>{const r=e.current;if(!r)return;const o=new ResizeObserver(i=>{const a=i[0];if(!a)return;const l=a.contentRect;n({width:l.width,height:l.height})});return o.observe(r),()=>o.disconnect()},[e]),t}const Fs=new Set,Bs=Object.freeze([]);function Dr(e){const t=new Set(e);return t.size===0?{set:Fs,arr:Bs}:{set:t,arr:Object.freeze([...t])}}const Ir={set:Fs,arr:Bs};function Yg(e){const t=e.mode??"single",[n,r]=A.useState(Ir),o=A.useRef(e.onChange);o.current=e.onChange;const i=A.useRef(!0);A.useEffect(()=>{if(i.current){i.current=!1;return}o.current?.([...n.arr])},[n]);const a=A.useCallback((c,p)=>{t!=="none"&&r(h=>{const d=h.set.has(c);if(t==="single"||!p?.additive)return d&&h.set.size===1?Ir:Dr([c]);const m=new Set(h.set);return d?m.delete(c):m.add(c),Dr(m)})},[t]),l=A.useCallback(c=>{t!=="none"&&r(()=>{const p=t==="single"?(()=>{for(const h of c)return[h];return[]})():c;return Dr(p)})},[t]),s=A.useCallback(()=>r(Ir),[]),u=A.useRef(n);u.current=n;const f=A.useCallback(c=>u.current.set.has(c),[]);return A.useMemo(()=>({selected:n.arr,selectedSet:n.set,toggle:a,set:l,clear:s,isSelected:f}),[n,a,l,s,f])}function Xg(){const[e,t]=A.useState(!1);return A.useEffect(()=>{const n=i=>{i.key==="Shift"&&t(!0)},r=i=>{i.key==="Shift"&&t(!1)},o=()=>t(!1);return window.addEventListener("keydown",n),window.addEventListener("keyup",r),window.addEventListener("blur",o),()=>{window.removeEventListener("keydown",n),window.removeEventListener("keyup",r),window.removeEventListener("blur",o)}},[]),e}function Kg(e,t){const n=A.useRef(!1);A.useEffect(()=>{if(!e)return;!n.current&&t.nodes.length>0&&Object.isFrozen(t.nodes[0])&&(n.current=!0,console.warn("[lora-graph-canvas] autoIndexNeighbors is enabled but node objects appear to be frozen. The hover-highlight index needs to mutate nodes to attach `_neighbors`/`_links`. Either pass `autoIndexNeighbors={false}` (and `highlightNeighborsOnHover={false}`) or supply mutable node objects."));const r=new Map;for(const o of t.nodes)r.set(o.id,o),o._neighbors=[],o._links=[];for(const o of t.links){const i=typeof o.source=="object"?o.source.id:o.source,a=typeof o.target=="object"?o.target.id:o.target,l=r.get(i),s=r.get(a);!l||!s||(l._neighbors.push(s),s._neighbors.push(l),l._links.push(o),s._links.push(o))}},[e,t])}function Zg(e){const{mount:t,engineRef:n,selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:l}=e,s=A.useRef({selection:r,nodes:o,links:i,setSelectedLinkIds:a,liveHoverNodeIdRef:l});s.current.selection=r,s.current.nodes=o,s.current.links=i,s.current.setSelectedLinkIds=a,s.current.liveHoverNodeIdRef=l;const[u,f]=A.useState(null),c=A.useRef(null),p=A.useRef({x:0,y:0}).current;return A.useEffect(()=>{if(!t)return;let h=t.getBoundingClientRect();const d=()=>{h=t.getBoundingClientRect()},m=new ResizeObserver(d);m.observe(t),window.addEventListener("scroll",d,{passive:!0,capture:!0});const v=x=>{p.x=x.clientX-h.left,p.y=x.clientY-h.top,c.current=p};t.addEventListener("mousemove",v);const g=x=>{if(n.current?.stopAnimation(),x.button!==0||!x.shiftKey||s.current.liveHoverNodeIdRef.current!==null)return;const w=x.clientX-h.left,b=x.clientY-h.top;x.stopPropagation(),x.preventDefault(),f({x0:w,y0:b,x1:w,y1:b,additive:x.shiftKey});let M=null;const P=()=>{M===null&&(M=requestAnimationFrame(()=>{M=null;const F=n.current;F&&f(I=>{if(!I)return I;const K=Math.min(I.x0,I.x1),O=Math.min(I.y0,I.y1),y=Math.max(I.x0,I.x1),k=Math.max(I.y0,I.y1);if(y-K<4&&k-O<4){if(I.count===void 0)return I;const{count:$,...B}=I;return B}let C=0;for(const $ of s.current.nodes){if($.x===void 0||$.y===void 0)continue;const B=F.graph2Screen($.x,$.y,$.z);B.x>=K&&B.x<=y&&B.y>=O&&B.y<=k&&C++}return I.count===C?I:{...I,count:C}})}))},N=F=>{const I=F.clientX-h.left,K=F.clientY-h.top;f(O=>O&&{...O,x1:I,y1:K}),P()},j=F=>{window.removeEventListener("mousemove",N),window.removeEventListener("mouseup",j,!0),M!==null&&(cancelAnimationFrame(M),M=null);const I=F.clientX-h.left,K=F.clientY-h.top;f(null);const O=n.current;if(!O)return;const y=Math.min(w,I),k=Math.min(b,K),C=Math.max(w,I),$=Math.max(b,K);if(C-y<3&&$-k<3)return;const B=s.current,X=B.nodes,L=B.links,D=B.selection,q=B.setSelectedLinkIds,Y=[],E=(G,U)=>G>=y&&G<=C&&U>=k&&U<=$,H=new Map;for(const G of X){if(H.set(G.id,G),G.x===void 0||G.y===void 0)continue;const U=O.graph2Screen(G.x,G.y,G.z);E(U.x,U.y)&&Y.push(G.id)}const T=[],W=G=>{if(G&&typeof G=="object"){const U=G;if(U.x!==void 0&&U.y!==void 0)return U.z!==void 0?{x:U.x,y:U.y,z:U.z}:{x:U.x,y:U.y}}if(typeof G=="string"||typeof G=="number"){const U=H.get(G);if(U&&U.x!==void 0&&U.y!==void 0)return U.z!==void 0?{x:U.x,y:U.y,z:U.z}:{x:U.x,y:U.y}}return null};for(const G of L){if(G.id===void 0)continue;const U=W(G.source),ee=W(G.target);if(!U||!ee)continue;const ne=O.graph2Screen((U.x+ee.x)/2,(U.y+ee.y)/2,U.z!==void 0&&ee.z!==void 0?(U.z+ee.z)/2:void 0),ie=O.graph2Screen(U.x,U.y,U.z),le=O.graph2Screen(ee.x,ee.y,ee.z);(E(ne.x,ne.y)||E(ie.x,ie.y)&&E(le.x,le.y))&&T.push(G.id)}if(F.shiftKey||F.metaKey||F.ctrlKey){const G=D.selected,U=G.slice(),ee=new Set(G);for(const ne of Y)ee.has(ne)||(ee.add(ne),U.push(ne));D.set(U),q(ne=>{const ie=ne.slice(),le=new Set(ne);for(const ae of T)le.has(ae)||(le.add(ae),ie.push(ae));return ie})}else D.set(Y),q(T)};window.addEventListener("mousemove",N),window.addEventListener("mouseup",j,!0)};t.addEventListener("mousedown",g,!0);const S=()=>n.current?.stopAnimation(),_=()=>n.current?.stopAnimation();return t.addEventListener("wheel",S,{passive:!0,capture:!0}),t.addEventListener("touchstart",_,{passive:!0,capture:!0}),()=>{t.removeEventListener("mousemove",v),t.removeEventListener("mousedown",g,!0),t.removeEventListener("wheel",S,{capture:!0}),t.removeEventListener("touchstart",_,{capture:!0}),window.removeEventListener("scroll",d,{capture:!0}),m.disconnect()}},[t,n]),{marquee:u,lastCursorRef:c}}const Qg=60;function Jg(e,t={}){const n=typeof t=="number"?{tolerancePx:t}:t,r=n.tolerancePx??12,o=n.pressGraceMs??Qg;A.useEffect(()=>{if(!e)return;const i=r*r;let a=!1,l=!1,s=0,u=0,f=0;const c=d=>{e.contains(d.target)&&(a=!0,l=!1,s=d.clientX,u=d.clientY,f=performance.now())},p=d=>{if(!a||l)return;if(performance.now()-f<o){d.stopPropagation();return}const m=d.clientX-s,v=d.clientY-u;m*m+v*v<i?d.stopPropagation():l=!0},h=()=>{a=!1,l=!1};return window.addEventListener("pointerdown",c,!0),window.addEventListener("pointermove",p,!0),window.addEventListener("mousemove",p,!0),window.addEventListener("pointerup",h,!0),window.addEventListener("pointercancel",h,!0),window.addEventListener("mouseup",h,!0),()=>{window.removeEventListener("pointerdown",c,!0),window.removeEventListener("pointermove",p,!0),window.removeEventListener("mousemove",p,!0),window.removeEventListener("pointerup",h,!0),window.removeEventListener("pointercancel",h,!0),window.removeEventListener("mouseup",h,!0)}},[e,r,o])}function ev(e){const{enableClipboard:t,dataApi:n,deleteGate:r,selection:o,setSelectedLinkIds:i,engineRef:a,lastCursorRef:l,onCopy:s,onCut:u,onPaste:f}=e,c=A.useRef([]),p=A.useCallback(()=>{const x=new Set(o.selected),w=[];for(const b of n.data.nodes){if(!x.has(b.id))continue;const{id:M,x:P,y:N,z:j,vx:F,vy:I,vz:K,fx:O,fy:y,fz:k,...C}=b;w.push(C)}return w},[n.data.nodes,o.selected]),h=A.useCallback(()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(b=>x.has(b.id));return c.current=p(),s?.(w),w},[t,n.data.nodes,o.selected,p,s]),d=A.useCallback(async()=>{if(!t)return[];const x=new Set(o.selected),w=n.data.nodes.filter(M=>x.has(M.id));return w.length===0?[]:await r.requestNodeDelete(o.selected,"cut")?(c.current=p(),u?.(w),w):[]},[t,n,r,o,p,u]),m=A.useCallback(x=>{if(!t)return[];const w=c.current;if(w.length===0)return[];const b=x||(()=>{const P=l.current;if(!(!P||!a.current))return a.current.screen2Graph(P.x,P.y)})(),M=n.addNodes(w.map((P,N)=>{const j=N%3*24,F=Math.floor(N/3)*24;return{...P,...b?{x:b.x+j,y:b.y+F,...b.z!==void 0?{z:b.z+F}:{}}:{}}}));return o.set(M.map(P=>P.id)),i([]),f?.(M),M},[t,n,o,i,f,a,l]),v=A.useCallback(()=>{const x=new Set(o.selected),w=[];let b=0;for(const P of n.data.nodes){if(!x.has(P.id))continue;const{id:N,vx:j,vy:F,vz:I,fx:K,fy:O,fz:y,...k}=P,C=b%3*24,$=Math.floor(b/3)*24;w.push({...k,...P.x!==void 0?{x:P.x+C}:{},...P.y!==void 0?{y:P.y+$}:{},...P.z!==void 0?{z:P.z}:{}}),b++}if(w.length===0)return[];const M=n.addNodes(w);return o.set(M.map(P=>P.id)),i([]),M},[n,o,i]),g=A.useCallback(x=>{const w=o.selected;if(w.length===0)return null;const b=n.data.nodes.filter(j=>w.includes(j.id));if(b.length===0)return null;let M=x?.at;if(!M){let j=0,F=0,I=0,K=!1;for(const O of b)j+=O.x??0,F+=O.y??0,I+=O.z??0,(O.x!==void 0||O.y!==void 0)&&(K=!0);K&&(M={x:j/b.length+30,y:F/b.length+30,z:I/b.length})}const P=x?.label!==void 0?{label:x.label}:{},N=n.addNode(P,M?{at:M}:void 0);for(const j of b)n.addLink({source:j.id,target:N.id});return o.set([N.id]),i([]),N},[n,o,i]),S=A.useCallback(x=>{const w=n.data.nodes.find(b=>b.id===x);w&&(w.fx!==void 0?n.updateNode(x,{fx:void 0,fy:void 0,fz:void 0}):n.updateNode(x,{fx:w.x,fy:w.y,...w.z!==void 0?{fz:w.z}:{}}))},[n]),_=A.useCallback(()=>c.current.length>0,[]);return A.useMemo(()=>({hasClipboard:_,copy:h,cut:d,paste:m,duplicate:v,addConnectedNode:g,togglePin:S}),[_,h,d,m,v,g,S])}async function ia(e,t,n){if(t.length===0||!e)return!0;try{return await e(t,{source:n})}catch{return!1}}function tv(e){const{dataApi:t,beforeNode:n,beforeLink:r,onNodeDeleted:o,onLinkDeleted:i,afterNodeDelete:a,afterLinkDelete:l}=e,s=A.useCallback((c,p)=>{if(c.length===0)return Promise.resolve(!1);const h=new Set(c),d=t.data.nodes.filter(v=>h.has(v.id));if(d.length===0)return Promise.resolve(!1);const m=()=>(t.removeNodes(c),o?.(d,{source:p}),a?.(c),!0);return n?Promise.resolve(ia(n,d,p)).then(v=>v?m():!1):Promise.resolve(m())},[t,n,o,a]),u=A.useCallback((c,p)=>{const h=typeof c=="function"?c:(()=>{const v=new Set(c);return g=>g.id!==void 0&&v.has(g.id)})(),d=t.data.links.filter(h);if(d.length===0)return Promise.resolve(!1);const m=()=>{t.removeLink(h),i?.(d,{source:p});const v=d.map(g=>g.id).filter(g=>g!==void 0);return l?.(v),!0};return r?Promise.resolve(ia(r,d,p)).then(v=>v?m():!1):Promise.resolve(m())},[t,r,i,l]),f=A.useCallback(async(c,p,h)=>{const[d,m]=await Promise.all([c.length>0?s(c,h):Promise.resolve(!1),p.length>0?u(p,h):Promise.resolve(!1)]);return d||m},[s,u]);return A.useMemo(()=>({requestNodeDelete:s,requestLinkDelete:u,requestMixedDelete:f}),[s,u,f])}const aa=40;function nv(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{let n=-1;const r=o=>{const i=t.current,a=i.hostRef.current,l=document.activeElement;if(a&&l&&l!==document.body&&!a.contains(l))return;const s=o.target;if(!(s&&(s.tagName==="INPUT"||s.tagName==="TEXTAREA"||s.isContentEditable)))switch(o.key){case"v":case"V":i.enableClipboard&&(o.metaKey||o.ctrlKey)?(i.paste(),o.preventDefault()):i.setActiveTool("select");break;case"h":case"H":i.setActiveTool("pan");break;case"n":case"N":i.setActiveTool("add-node");break;case"l":case"L":i.setActiveTool("add-link");break;case"f":case"F":case"0":if(o.shiftKey&&(o.key==="f"||o.key==="F")){[...i.selection.selected,...i.selectedLinkIds];const f=new Set(i.selection.selected);if(i.selectedLinkIds.length>0){const c=new Set(i.selectedLinkIds);for(const p of i.dataApi.data.links){const h=p.id;if(h===void 0||!c.has(h))continue;const d=typeof p.source=="object"?p.source.id:p.source,m=typeof p.target=="object"?p.target.id:p.target;d!==void 0&&f.add(d),m!==void 0&&f.add(m)}}f.size>0&&i.engine?.fitToNodes?i.engine.fitToNodes([...f],400,60):i.engine?.fit(400,40),o.preventDefault();break}i.engine?.fit(400,40),o.preventDefault();break;case"+":case"=":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)*1.2,200),o.preventDefault());break;case"-":i.engine&&(i.engine.zoom((i.engine.getZoom?.()??1)/1.2,200),o.preventDefault());break;case"3":i.setMode(i.mode==="2d"?"3d":"2d");break;case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"ArrowDown":{const f=i.engine;if(!f)return;const c=f.getZoom?.()??1,p=aa/Math.max(c,.1);let h=0,d=0,m=0;if(o.key==="ArrowLeft"?h=-p:o.key==="ArrowRight"?h=p:o.key==="ArrowUp"?d=-p:d=p,o.shiftKey&&(o.key==="ArrowUp"||o.key==="ArrowDown")&&i.mode==="3d"&&(m=o.key==="ArrowUp"?p:-p,d=0),f.panBy)f.panBy({x:h,y:d,z:m},120);else{const v=f.getGraphBbox(),g=(v.x[0]+v.x[1])/2,S=(v.y[0]+v.y[1])/2;f.centerAt(g+h,S+d,void 0,120)}o.preventDefault();break}case"PageUp":case"PageDown":case"q":case"Q":case"e":case"E":{const f=i.engine;if(!f)break;if(i.mode!=="3d"){if(o.key==="PageUp"||o.key==="PageDown")break;break}const c=f.getZoom?.()??1,p=aa/Math.max(c,.1),h=o.key==="PageUp"||o.key==="q"||o.key==="Q";f.panBy&&f.panBy({z:h?p:-p},120),o.preventDefault();break}case"Tab":{const f=i.engine,c=i.dataApi.data.nodes;if(!f||c.length===0)return;n=o.shiftKey?(n-1+c.length)%c.length:(n+1)%c.length;const p=c[n];if(!p||p.x===void 0||p.y===void 0)return;i.selection.set([p.id]),f.focusOn({x:p.x,y:p.y,...p.z!==void 0?{z:p.z}:{}},{distance:120,zoom:4,durationMs:400}),o.preventDefault();break}case"Backspace":case"Delete":(i.selection.selected.length>0||i.selectedLinkIds.length>0)&&(i.deleteGate.requestMixedDelete(i.selection.selected,i.selectedLinkIds,"keyboard"),o.preventDefault());break;case"a":case"A":(o.metaKey||o.ctrlKey)&&(i.selection.set(i.dataApi.data.nodes.map(f=>f.id)),i.setSelectedLinkIds(i.dataApi.data.links.map(f=>f.id).filter(f=>f!==void 0)),o.preventDefault());break;case"c":case"C":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&i.copy();break;case"x":case"X":i.enableClipboard&&(o.metaKey||o.ctrlKey)&&(i.cut(),o.preventDefault());break;case"d":case"D":(o.metaKey||o.ctrlKey)&&(i.duplicate(),o.preventDefault());break;case"p":case"P":for(const f of i.selection.selected)i.togglePin(f);break;case"Enter":i.selection.selected.length>0&&(i.addConnectedNode(),o.preventDefault());break;case"Escape":i.selection.clear(),i.setSelectedLinkIds([]),i.setLinkSourceId(null);break}};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[])}function rv(e){const{engine:t,collideNodes:n,beeswarm:r,nodeRelSize:o}=e;A.useEffect(()=>{if(!t||r)return;if(!n){t.d3Force("collide",null);return}const i=typeof n=="number"?n:(o??4)+2;return t.d3Force("collide",fi(i)),t.reheat(),()=>{t.d3Force("collide",null)}},[t,n,o,r]),A.useEffect(()=>{if(!t)return;if(!r){t.d3Force("x",null),t.d3Force("y",null);return}const i=r===!0?{}:r,a=i.axis??"x",l=i.strength??.2,s=i.value,u=p=>{const h=String(p);let d=0;for(let m=0;m<h.length;m++)d=d*31+h.charCodeAt(m)|0;return(d%600+600)%600-300},f=p=>{const h=p;if(typeof s=="function")return s(h);if(typeof s=="string"){const d=h[s];if(typeof d=="number")return d;if(typeof d=="string")return Number(d)||0}return u(h.id)};t.d3Force("center",null),t.d3Force("charge",null),a==="x"?(t.d3Force("x",mi(f)),t.d3Force("y",bi(0).strength(l))):(t.d3Force("y",bi(f)),t.d3Force("x",mi(0).strength(l)));const c=(o??4)+2;t.d3Force("collide",fi(c)),t.reheat()},[t,r,o])}function rn(e,t){return typeof e=="function"?e(t):typeof e=="string"?t[e]:e}function sa(e,t){const n=rn(e,t);return typeof n=="string"?n:typeof HTMLElement<"u"&&n instanceof HTMLElement?n.textContent??"":n!=null?String(n):typeof t.label=="string"&&t.label.length>0?t.label:t.id!==void 0?String(t.id):""}function la(e,t){const n=rn(e,t);if(typeof n=="string")return n;if(typeof HTMLElement<"u"&&n instanceof HTMLElement)return n.textContent??"";if(n!=null)return String(n);if(typeof t.label=="string"&&t.label.length>0)return t.label;const r=t.source,o=t.target,i=typeof r=="object"&&r!==null?r.id:r,a=typeof o=="object"&&o!==null?o.id:o;return i===void 0&&a===void 0?"":`${i??""} → ${a??""}`}function yn(e,t){if(e.startsWith("#")){const o=e.slice(1),i=o.length===3?o.split("").map(a=>a+a).join(""):o;if(i.length===6){const a=parseInt(i.slice(0,2),16),l=parseInt(i.slice(2,4),16),s=parseInt(i.slice(4,6),16);return`rgba(${a}, ${l}, ${s}, ${t})`}}const n=e.match(/^rgb\(([^)]+)\)$/);if(n)return`rgba(${n[1]}, ${t})`;const r=e.match(/^rgba\(([^,]+),([^,]+),([^,]+),[^)]+\)$/);return r?`rgba(${r[1]},${r[2]},${r[3]},${t})`:e}const Kt=new Set;function ov(e){const{mode:t,accentColor:n,nodeColor:r,linkColor:o,linkWidth:i,nodeVal:a,nodeRelSize:l,nodePointerAreaPaint:s,nodeAutoColorBy:u,nodeVisibility:f,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S}=e,_=A.useRef({mode:t,accentColor:n,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S});_.current={mode:t,accentColor:n,selectedNodeSet:c,selectedLinkSet:p,highlightNeighborsOnHover:h,highlightedNodeIds:d,highlightedLinkIds:m,hoverNodeId:v,hoverLinkId:g,hiddenGroups:S};const x=c.size>0||p.size>0||h&&d.size>0,w=A.useMemo(()=>{const T=r;return W=>{const V=_.current;if(W.id!==void 0&&V.selectedNodeSet.has(W.id))return V.accentColor;if(V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&W.id!==void 0&&V.highlightedNodeIds.has(W.id))return V.hoverNodeId===W.id?V.accentColor:yn(V.accentColor,.7);let U;return typeof T=="function"?U=T(W):typeof T=="string"?U=T:U=W.color??"#888",(V.selectedNodeSet.size>0||V.selectedLinkSet.size>0)&&V.mode!=="3d"?yn(U,.25):U}},[r,c,p,v,d]),b=x?w:r,M=u!==void 0&&S.size>0,P=c.size>0||p.size>0||g!==null||h&&m.size>0||M,N="rgba(96, 102, 110, 0.55)",j="rgba(180, 188, 198, 0.55)",F=A.useMemo(()=>{const T=o,W=u;return V=>{const G=_.current,U=V.id,ee=typeof V.source=="object"?V.source:null,ne=typeof V.target=="object"?V.target:null;if(G.hiddenGroups.size>0&&W!==void 0){const Xe=_e=>{if(!_e)return null;const Se=typeof W=="function"?W(_e):_e[W];return Se==null?null:String(Se)},ot=Xe(ee),Ae=Xe(ne);if(ot!==null&&G.hiddenGroups.has(ot)||Ae!==null&&G.hiddenGroups.has(Ae)){let _e;return typeof T=="function"?_e=T(V):typeof T=="string"?_e=T:_e=V.color??N,yn(_e,.05)}}if(U!==void 0&&G.selectedLinkSet.has(U))return G.accentColor;const ie=ee?.id??V.source,le=ne?.id??V.target,ae=G.selectedNodeSet.size>0;if(ae&&(ie!==void 0&&G.selectedNodeSet.has(ie)||le!==void 0&&G.selectedNodeSet.has(le)))return yn(G.accentColor,.85);const be=U!==void 0&&G.hoverLinkId===U,We=G.highlightNeighborsOnHover&&U!==void 0&&G.highlightedLinkIds.has(U);if(be||We)return j;let Pe;return typeof T=="function"?Pe=T(V):typeof T=="string"?Pe=T:Pe=V.color??N,ae||G.selectedLinkSet.size>0?yn(Pe,G.mode==="3d"?.45:.18):Pe}},[o,u,p,c,g,m,S]),I=P?F:o,K=c.size>0||p.size>0||g!==null||h&&m.size>0,O=.6,y=1.5,k=.4,C=1,$=.5,B=1.2,X=A.useMemo(()=>{const T=i;return W=>{const V=_.current,G=W.id,U=G!==void 0&&V.selectedLinkSet.has(G),ee=typeof W.source=="object"?W.source.id:W.source,ne=typeof W.target=="object"?W.target.id:W.target,le=V.selectedNodeSet.size>0&&(ee!==void 0&&V.selectedNodeSet.has(ee)||ne!==void 0&&V.selectedNodeSet.has(ne)),ae=G!==void 0&&V.hoverLinkId===G,ce=V.highlightNeighborsOnHover&&G!==void 0&&V.highlightedLinkIds.has(G),be=ae||ce,We=typeof T=="function"?T(W):typeof T=="number"?T:W.width??1,Pe=V.mode==="3d";return U?We+(Pe?$:B):be?We+(Pe?O:y):le?We+(Pe?k:C):We}},[i]),L=K?X:i,D=c.size>0||h&&d.size>0,q=A.useMemo(()=>{const T=a;return W=>{const V=_.current,G=W.id,U=typeof T=="function"?T(W):typeof T=="number"?T:W.val??1;return G!==void 0&&V.selectedNodeSet.has(G)?U*2.25:V.highlightNeighborsOnHover&&V.highlightedNodeIds.size>0&&G!==void 0&&V.highlightedNodeIds.has(G)?V.hoverNodeId===G?U*1.8:U*1.4:U}},[a]),Y=D?q:a,E=A.useMemo(()=>{if(t!=="2d"||s)return s;const T=a,W=l??4;return(V,G,U,ee)=>{const ne=typeof T=="function"?T(V):typeof T=="number"?T:V.val??1,ie=Math.sqrt(Math.max(0,ne))*W+1/Math.max(ee,1e-6);U.fillStyle=G,U.beginPath(),U.arc(V.x??0,V.y??0,ie,0,2*Math.PI,!1),U.fill()}},[t,a,l,s]),H=A.useMemo(()=>{const T=u&&S.size>0;if(!T&&f===void 0)return;const W=u,V=f;return G=>{if(T&&W){const U=typeof W=="function"?W(G):G[W];if(U!=null&&S.has(String(U)))return!1}return typeof V=="function"?!!V(G):typeof V=="boolean"?V:typeof V=="string"?!!G[V]:!0}},[u,f,S]);return A.useMemo(()=>({nodeColor:b,linkColor:I,linkWidth:L,nodeVal:Y,nodePointerAreaPaint:E,nodeVisibility:H}),[b,I,L,Y,E,H])}const ca=250;function ua(e){return e==null?null:typeof e=="string"||typeof HTMLElement<"u"&&e instanceof HTMLElement?e:String(e)}function iv(e){const{highlightNeighborsOnHover:t,nodeLabel:n,linkLabel:r,onNodeHover:o,onLinkHover:i}=e,[a,l]=A.useState(null),[s,u]=A.useState(null),[f,c]=A.useState(Kt),[p,h]=A.useState(Kt),[d,m]=A.useState(null),v=A.useRef(null),g=A.useRef(null),S=A.useRef(null),_=A.useRef(null),x=A.useRef(null);A.useEffect(()=>()=>{_.current!==null&&(clearTimeout(_.current),_.current=null),x.current!==null&&(clearTimeout(x.current),x.current=null)},[]);const w=A.useCallback((j,F)=>{if(o?.(j,F),v.current=j?.id??null,!j&&S.current!==null)return;if(_.current!==null&&(clearTimeout(_.current),_.current=null),!j){_.current=setTimeout(()=>{_.current=null,l(null),t&&(c(Kt),h(Kt)),g.current===null&&m(null)},ca);return}if(t){const K=new Set([j.id]),O=new Set,y=j._neighbors??[];for(const C of y)C.id!==void 0&&K.add(C.id);const k=j._links??[];for(const C of k)C.id!==void 0&&O.add(C.id);l(j.id),c(K),h(O)}else l(j.id);const I=rn(n,j);m(ua(I))},[o,n,t]),b=A.useCallback((j,F)=>{if(i?.(j,F),g.current=j?.id??null,x.current!==null&&(clearTimeout(x.current),x.current=null),!j){x.current=setTimeout(()=>{x.current=null,u(null),v.current===null&&m(null)},ca);return}u(j.id??null);const I=rn(r,j);m(ua(I))},[i,r]),M=A.useMemo(()=>a===null?Kt:t?f:new Set([a]),[a,t,f]),P=A.useMemo(()=>{if(s!==null){if(t&&a!==null){const j=new Set(p);return j.add(s),j}return new Set([s])}return a!==null&&t?p:Kt},[s,a,t,p]),N=A.useCallback(j=>{if(S.current=j?.id??null,j){w(j,null);return}w(null,null)},[w]);return{hoverNodeId:a,hoverLinkId:s,liveHoverNodeIdRef:v,liveHoverLinkIdRef:g,highlightedNodeIds:f,highlightedLinkIds:p,hoveredNodeSet:M,hoveredLinkSet:P,tooltipContent:d,handleNodeHover:w,handleLinkHover:b,pinHover:N}}const Mt={frameId:-1,fov:-1,tanHalfFov:0,canvasHeightPx:1},fa=new re.Vector2;function av(e,t){const n=e.info?.render?.frame??-1;return n===Mt.frameId&&t===Mt.fov||(e.getSize(fa),Mt.frameId=n,Mt.fov=t,Mt.tanHalfFov=Math.tan(t*Math.PI/180/2),Mt.canvasHeightPx=fa.y||1),Mt}function rr(e){const t=e.material,n=e.userData;n.normalTexture&&n.normalTexture.dispose(),n.selectedTexture&&n.selectedTexture.dispose(),t.dispose(),e.parent&&e.parent.remove(e)}function or(e){const{text:t,fontSize:n=32,fontFamily:r="system-ui, sans-serif",color:o="#ffffff",backgroundColor:i="rgba(28, 31, 35, 0.85)",padding:a=8,worldHeight:l=4}=e,u=document.createElement("canvas").getContext("2d");if(!u)return new re.Sprite(new re.SpriteMaterial);u.font=`${n}px ${r}`;const f=Math.ceil(u.measureText(t).width),c=Math.ceil(n*1.2),p=f+a*2,h=c+a*2,d=(b,M,P)=>{b.width=p,b.height=h;const N=b.getContext("2d");if(N.font=`${n}px ${r}`,P){N.fillStyle=P;const j=Math.min(b.height/2,8),F=N;N.beginPath(),typeof F.roundRect=="function"?F.roundRect(0,0,b.width,b.height,j):N.rect(0,0,b.width,b.height),N.fill()}N.fillStyle=M,N.textAlign="center",N.textBaseline="middle",N.fillText(t,b.width/2,b.height/2)},m=document.createElement("canvas");d(m,o,i);const v=new re.CanvasTexture(m);v.minFilter=re.LinearFilter,v.magFilter=re.LinearFilter,v.needsUpdate=!0;let g;if(e.selectedColor!==void 0&&e.selectedBackgroundColor!==void 0){const b=document.createElement("canvas");d(b,e.selectedColor,e.selectedBackgroundColor),g=new re.CanvasTexture(b),g.minFilter=re.LinearFilter,g.magFilter=re.LinearFilter,g.needsUpdate=!0}const S=new re.SpriteMaterial({map:v,transparent:!0,depthWrite:!1}),_=new re.Sprite(S),x=_.userData;x.normalTexture=v,g&&(x.selectedTexture=g);const w=p/h;if(_.scale.set(l*w,l,1),e.pixelHeight!==void 0&&e.pixelHeight>0){const b=e.pixelHeight,M=new re.Vector3;let P=-1;_.onBeforeRender=(N,j,F)=>{const I=F;if(!I.isPerspectiveCamera||typeof I.fov!="number")return;_.getWorldPosition(M);const K=I.position.distanceTo(M);if(K<=0)return;const O=av(N,I.fov),y=2*O.tanHalfFov*K*b/O.canvasHeightPx;P>0&&Math.abs(y-P)<P*.005||(P=y,_.scale.set(y*w,y,1))}}return _}function sv(e){const{mode:t,showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,hostNodeCanvasObject:a,hostNodeThreeObject:l,nodeLabel:s,nodeVal:u,nodeRelSize:f,theme:c}=e,p=c?.tooltipBackground??"rgba(28, 31, 35, 0.9)",h=c?.tooltipForeground??"#ffffff",d=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:p,tooltipFg:h});d.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o,accentColor:i,tooltipBg:p,tooltipFg:h};const m=A.useMemo(()=>{if(t!=="2d"||a)return;const b=c?.fontFamily??"system-ui, sans-serif";return(M,P,N)=>{const j=d.current,F=M.id!==void 0&&j.selectedNodeSet.has(M.id),I=M.id!==void 0&&j.hoveredNodeSet?.has(M.id)===!0;if(!j.showLabels&&!F&&!I)return;const K=sa(s,M);if(!K)return;const O=rn(u,M)??1,y=f??4,k=Math.max(.5,Math.sqrt(Math.max(O,0))*y),C=14/N,$=6/N,B=4/N;P.font=`${C}px ${b}`;const L=P.measureText(K).width+$*2,D=C+B*2,q=M.x??0,Y=(M.y??0)-k*2-4/N-D;P.fillStyle=F?j.accentColor:j.tooltipBg;const E=Math.min(D/2,6/N),H=P;P.beginPath(),typeof H.roundRect=="function"?H.roundRect(q-L/2,Y,L,D,E):P.rect(q-L/2,Y,L,D),P.fill(),P.textAlign="center",P.textBaseline="top",P.fillStyle=F?"#ffffff":j.tooltipFg,P.fillText(K,q,Y+B)}},[t,a,s,u,f,c?.fontFamily]),v=o?.size??0,S=n||r.size>0||v>0?m:void 0,_=A.useRef(new Map),x=A.useRef({showLabels:n,selectedNodeSet:r,hoveredNodeSet:o});x.current={showLabels:n,selectedNodeSet:r,hoveredNodeSet:o},A.useEffect(()=>{const b=_.current;return()=>{for(const M of b.values())M.sprite&&rr(M.sprite);b.clear()}},[]);const w=A.useMemo(()=>{if(l)return;const b=_.current,M=c?.fontFamily??"system-ui, sans-serif";return P=>{const N=P.id,j=sa(s,P),F=rn(u,P)??1,I=f??4,O=Math.cbrt(Math.max(F,0))*I*2+4,y=new re.Group;if(N!==void 0&&j){const k={group:y,sprite:null,text:j,yOffset:O};b.set(N,k);const C=x.current,$=C.selectedNodeSet.has(N),B=C.hoveredNodeSet?.has(N)===!0;if(C.showLabels||$||B){const X=or({text:j,fontFamily:M,fontSize:48,color:h,backgroundColor:p,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});if(X.material.depthTest=!1,X.renderOrder=1e3,X.position.set(0,O,0),$){const L=X.userData;if(L.selectedTexture){const D=X.material;D.map=L.selectedTexture,D.needsUpdate=!0}}y.add(X),k.sprite=X}}return y}},[l,s,u,f,c?.fontFamily,p,h,i]);return A.useEffect(()=>{const b=_.current,M=c?.fontFamily??"system-ui, sans-serif";for(const[P,N]of b){if(N.group.parent===null){N.sprite&&rr(N.sprite),b.delete(P);continue}const j=r.has(P),F=o?.has(P)===!0,I=n||j||F;if(I&&N.sprite===null){const O=or({text:N.text,fontFamily:M,fontSize:48,color:h,backgroundColor:p,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:28});O.material.depthTest=!1,O.renderOrder=1e3,O.position.set(0,N.yOffset,0),N.group.add(O),N.sprite=O}const K=N.sprite;if(K){K.visible=I;const O=K.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=K.material;y&&k.map!==y&&(k.map=y,k.needsUpdate=!0)}}},[n,r,o,i,p,h,c?.fontFamily]),{canvasObject:S,threeObject:w,renderFramePost:void 0}}function lv(e){const{mode:t,showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,hostLinkCanvasObject:a,hostLinkThreeObject:l,hostLinkPositionUpdate:s,linkLabel:u,theme:f}=e,c=f?.tooltipBackground??"rgba(255, 255, 255, 0.94)",p=f?.tooltipForeground??"#1c1f23",h=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:c,tooltipFg:p});h.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o,accentColor:i,tooltipBg:c,tooltipFg:p};const d=A.useMemo(()=>{if(t!=="2d"||a)return;const b=f?.fontFamily??"system-ui, sans-serif",M=4,P=6;return(N,j)=>{const F=h.current,I=N.id!==void 0&&F.selectedLinkSet.has(N.id),K=N.id!==void 0&&F.hoveredLinkSet?.has(N.id)===!0;if(!F.showLabels&&!I&&!K)return;const O=N.source,y=N.target;if(typeof O!="object"||typeof y!="object")return;const k=la(u,N);if(!k||k===" → ")return;const C=O.x,$=O.y,B=y.x,X=y.y;if(C===void 0||$===void 0||B===void 0||X===void 0)return;const L=B-C,D=X-$,Y=Math.sqrt(L*L+D*D)-P*2;if(Y<=0)return;j.font=`1px ${b}`;const E=j.measureText(k).width||1,H=Math.min(M,Y/E);j.font=`${H}px ${b}`;let T=Math.atan2(D,L);T>Math.PI/2&&(T=-(Math.PI-T)),T<-Math.PI/2&&(T=-(-Math.PI-T));const W=(C+B)/2,V=($+X)/2,G=j.measureText(k).width,U=H*.6,ee=H*.35,ne=G+U,ie=H+ee,le=Math.min(ie/2,H*.35);j.save(),j.translate(W,V),j.rotate(T),j.fillStyle=I?F.accentColor:F.tooltipBg;const ae=j;j.beginPath(),typeof ae.roundRect=="function"?ae.roundRect(-ne/2,-ie/2,ne,ie,le):j.rect(-ne/2,-ie/2,ne,ie),j.fill(),j.textAlign="center",j.textBaseline="middle",j.fillStyle=I?"#ffffff":F.tooltipFg,j.fillText(k,0,0),j.restore()}},[t,a,u,f?.fontFamily]),m=o?.size??0,g=n||r.size>0||m>0?d:void 0,S=A.useRef(new Map),_=A.useRef({showLabels:n,selectedLinkSet:r,hoveredLinkSet:o});_.current={showLabels:n,selectedLinkSet:r,hoveredLinkSet:o},A.useEffect(()=>{const b=S.current;return()=>{for(const M of b.values())M.sprite&&rr(M.sprite);b.clear()}},[]);const x=A.useMemo(()=>{if(l)return;const b=S.current,M=f?.fontFamily??"system-ui, sans-serif";return P=>{const N=la(u,P),j=new re.Group,F=P.id;if(F!==void 0&&N&&N!==" → "){const I={group:j,sprite:null,text:N};b.set(F,I);const K=_.current,O=K.selectedLinkSet.has(F),y=K.hoveredLinkSet?.has(F)===!0;if(K.showLabels||O||y){const k=or({text:N,fontFamily:M,fontSize:48,color:p,backgroundColor:c,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});if(k.material.depthTest=!1,k.renderOrder=500,O){const C=k.userData;if(C.selectedTexture){const $=k.material;$.map=C.selectedTexture,$.needsUpdate=!0}}j.add(k),I.sprite=k}}return j}},[l,u,f?.fontFamily,c,p,i]);A.useEffect(()=>{const b=S.current,M=f?.fontFamily??"system-ui, sans-serif";for(const[P,N]of b){if(N.group.parent===null){N.sprite&&rr(N.sprite),b.delete(P);continue}const j=r.has(P),F=o?.has(P)===!0,I=n||j||F;if(I&&N.sprite===null){const O=or({text:N.text,fontFamily:M,fontSize:48,color:p,backgroundColor:c,selectedColor:"#ffffff",selectedBackgroundColor:i,pixelHeight:22});O.material.depthTest=!1,O.renderOrder=500,N.group.add(O),N.sprite=O}const K=N.sprite;if(K){K.visible=I;const O=K.userData,y=j&&O.selectedTexture?O.selectedTexture:O.normalTexture,k=K.material;y&&k.map!==y&&(k.map=y,k.needsUpdate=!0)}}},[n,r,o,i,c,p,f?.fontFamily]);const w=A.useMemo(()=>{if(s!=null)return;const b=t==="2d";return(M,P)=>{if(M instanceof re.Group){const N=(P.start.x+P.end.x)/2,j=(P.start.y+P.end.y)/2,F=(P.start.z+P.end.z)/2;M.position.set(N,j,F);const I=M.parent;if(I&&!I.userData.lgcOrderApplied){I.userData.lgcOrderApplied=!0,I.renderOrder=-1;for(const O of I.children)O!==M&&(O.renderOrder=-1)}const K=M.children[0];if(K instanceof re.Sprite){const O=K.material;if(b){const y=P.end.x-P.start.x,k=P.end.y-P.start.y;let C=Math.atan2(k,y);C>Math.PI/2?C-=Math.PI:C<-Math.PI/2&&(C+=Math.PI),Math.abs(O.rotation-C)>.001&&(O.rotation=C)}else O.rotation!==0&&(O.rotation=0)}}return!0}},[t,s]);return{canvasObject:g,threeObject:x,positionUpdate:w}}function cv({nodeCount:e,linkCount:t}){const n=e+t*.5;return n>=5e4?"huge":n>=1e4?"xlarge":n>=2e3?"large":"default"}function uv(e,t){if(e==="default")return{};const n={cooldownTicks:e==="large"?100:e==="xlarge"?60:30,d3AlphaDecay:e==="large"?.04:e==="xlarge"?.08:.15,d3VelocityDecay:e==="huge"?.6:.4,linkHoverPrecision:e==="large"?4:2,warmupTicks:0,linkDirectionalParticles:0,linkDirectionalArrowLength:0};return n.forceEngine="ngraph",n.nodeResolution=e==="large"?8:e==="xlarge"?4:3,n.linkResolution=e==="large"?4:0,n.nodeOpacity=1,n.linkOpacity=1,n.pointerRaycasterThrottleMs=e==="large"?16:e==="xlarge"?32:64,n}function fv(e){const{profile:t="auto",nodeCount:n,linkCount:r,mode:o}=e;return A.useMemo(()=>{if(t==="off")return{};const i=t==="auto"?cv({nodeCount:n,linkCount:r}):t;return uv(i)},[t,n,r,o])}function dv(e){const{ref:t}=e,n=A.useRef(e);n.current=e,A.useImperativeHandle(t,()=>({getData:()=>n.current.dataApi.data,setData:r=>n.current.dataApi.setData(r),addNode:(r,o)=>n.current.dataApi.addNode(r,o),addNodes:r=>n.current.dataApi.addNodes(r),updateNode:(r,o)=>n.current.dataApi.updateNode(r,o),removeNode:r=>n.current.deleteGate.requestNodeDelete([r],"imperative"),removeNodes:r=>n.current.deleteGate.requestNodeDelete(r,"imperative"),addLink:r=>n.current.dataApi.addLink(r),addLinks:r=>n.current.dataApi.addLinks(r),removeLink:r=>n.current.deleteGate.requestLinkDelete(r,"imperative"),clear:()=>n.current.dataApi.clear(),getSelection:()=>[...n.current.selection.selected],setSelection:r=>n.current.selection.set(r),selectAll:()=>n.current.selection.set(n.current.dataApi.data.nodes.map(r=>r.id)),clearSelection:()=>n.current.selection.clear(),getMode:()=>n.current.mode,setMode:r=>n.current.setMode(r),fit:(r,o)=>n.current.engine?.fit(r,o),centerAt:(r,o,i,a)=>n.current.engine?.centerAt(r,o,i,a),zoom:(r,o)=>n.current.engine?.zoom(r,o),zoomIn:(r=1.2)=>{const o=n.current.engine;o&&o.zoom((o.getZoom?.()??1)*r,200)},zoomOut:(r=1.2)=>{const o=n.current.engine;o&&o.zoom((o.getZoom?.()??1)/r,200)},panBy:(r,o)=>n.current.engine?.panBy?.(r,o),goTo:(r,o)=>n.current.engine?.goTo?.(r,o),fitToNodes:(r,o,i)=>n.current.engine?.fitToNodes?.(r,o,i),fitToSelection:(r,o)=>{const i=n.current;if(!i.engine)return;const a=new Set(i.selection.selected);if(i.selectedLinkIds.length>0){const l=new Set(i.selectedLinkIds);for(const s of i.dataApi.data.links){const u=s.id;if(u===void 0||!l.has(u))continue;const f=typeof s.source=="object"?s.source.id:s.source,c=typeof s.target=="object"?s.target.id:s.target;f!==void 0&&a.add(f),c!==void 0&&a.add(c)}}a.size!==0&&i.engine.fitToNodes?.([...a],r??400,o??60)},pause:()=>{n.current.engine?.pause(),n.current.setPaused(!0)},resume:()=>{n.current.engine?.resume(),n.current.setPaused(!1)},reheat:()=>n.current.engine?.reheat(),screenshot:async()=>{const r=n.current.engine?.getCanvasElement();return r?new Promise(o=>r.toBlob(i=>o(i))):null},copy:()=>n.current.clipboard.copy(),cut:()=>n.current.clipboard.cut(),paste:r=>n.current.clipboard.paste(r?.at),duplicate:()=>n.current.clipboard.duplicate(),addConnectedNode:r=>n.current.clipboard.addConnectedNode(r),togglePin:r=>n.current.clipboard.togglePin(r),exportJSON:()=>n.current.exportJSON(),importJSON:r=>n.current.importJSON(r),downloadJSON:r=>n.current.downloadJSON(r),d3Force:(r,o)=>n.current.engine?.d3Force(r,o),emitParticle:r=>n.current.engine?.emitParticle(r),stopAnimation:()=>n.current.engine?.stopAnimation(),engine2D:()=>n.current.engine?.mode==="2d"?n.current.engine:null,engine3D:()=>n.current.engine?.mode==="3d"?n.current.engine:null}),[])}function hv(){const[e,t]=A.useState(()=>typeof window>"u"||typeof window.matchMedia!="function"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches);return A.useEffect(()=>{if(typeof window>"u"||typeof window.matchMedia!="function")return;const n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=()=>t(n.matches);return typeof n.addEventListener=="function"?(n.addEventListener("change",r),()=>n.removeEventListener("change",r)):(n.addListener(r),()=>n.removeListener(r))},[]),e}const ze={width:16,height:16,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},pv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 2.5l4 10 1.4-3.6 3.6-1.4z"})}),gv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M8 3v10M3 8h10M5 5l6 6M11 5L5 11"})}),vv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"6",cy:"8",r:"3"}),R.jsx("path",{d:"M12 5v6M9 8h6"})]}),yv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"4",cy:"4",r:"2"}),R.jsx("circle",{cx:"12",cy:"12",r:"2"}),R.jsx("path",{d:"M5.5 5.5l5 5"})]}),$s=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 5h10M6 5V3h4v2M5 5l1 8h4l1-8"})}),mv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M3 6V3h3M13 6V3h-3M3 10v3h3M13 10v3h-3"})}),bv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"7",cy:"7",r:"4"}),R.jsx("path",{d:"M5 7h4M7 5v4M10 10l3 3"})]}),_v=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"7",cy:"7",r:"4"}),R.jsx("path",{d:"M5 7h4M10 10l3 3"})]}),xv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M6 3v10M10 3v10"})}),wv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("path",{d:"M5 3l8 5-8 5z"})}),kv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M3 5h2l1-2h4l1 2h2v8H3z"}),R.jsx("circle",{cx:"8",cy:"9",r:"2.5"})]}),Hs=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 2l5 3v6l-5 3-5-3V5z"}),R.jsx("path",{d:"M8 8v7M8 8L3 5M8 8l5-3"})]}),Cv=e=>R.jsx("svg",{...ze,...e,children:R.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1"})}),qs=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),R.jsx("rect",{x:"5",y:"5",width:"8",height:"8",rx:"1"})]}),Sv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"10",height:"10",rx:"1",strokeDasharray:"2 2"}),R.jsx("circle",{cx:"6",cy:"6",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"10",cy:"6",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"6",cy:"10",r:"1",fill:"currentColor"}),R.jsx("circle",{cx:"10",cy:"10",r:"1",fill:"currentColor"})]}),Mv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 2v8M5 5l3-3 3 3"}),R.jsx("path",{d:"M3 12h10v2H3z"})]}),Pv=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("path",{d:"M8 10V2M5 7l3 3 3-3"}),R.jsx("path",{d:"M3 12h10v2H3z"})]}),Av=e=>R.jsxs("svg",{...ze,...e,children:[R.jsx("circle",{cx:"4",cy:"8",r:"2"}),R.jsx("path",{d:"M6 8h2.5"}),R.jsx("circle",{cx:"11",cy:"8",r:"2"}),R.jsx("path",{d:"M11 6.5v3M9.5 8h3"})]}),Us={select:{id:"select",label:"Select",hint:"Select / multi-select nodes",icon:pv,toggleable:!0,shortcut:"V"},pan:{id:"pan",label:"Pan",hint:"Pan the canvas",icon:gv,toggleable:!0,shortcut:"H"},"add-node":{id:"add-node",label:"Add node",hint:"Click on the canvas to add a node",icon:vv,toggleable:!0,shortcut:"N"},"add-link":{id:"add-link",label:"Add link",hint:"Click two nodes to connect them",icon:yv,toggleable:!0,shortcut:"L"},delete:{id:"delete",label:"Delete",hint:"Delete selected node(s)",icon:$s,shortcut:"⌫"},fit:{id:"fit",label:"Fit",hint:"Fit graph to viewport",icon:mv,shortcut:"F"},"zoom-in":{id:"zoom-in",label:"Zoom in",hint:"Zoom in",icon:bv,shortcut:"+"},"zoom-out":{id:"zoom-out",label:"Zoom out",hint:"Zoom out",icon:_v,shortcut:"-"},pause:{id:"pause",label:"Pause",hint:"Pause simulation",icon:xv},resume:{id:"resume",label:"Resume",hint:"Resume simulation",icon:wv},screenshot:{id:"screenshot",label:"Screenshot",hint:"Download a PNG of the canvas",icon:kv},"toggle-mode":{id:"toggle-mode",label:"2D / 3D",hint:"Toggle between 2D and 3D",icon:Hs,shortcut:"3"},duplicate:{id:"duplicate",label:"Duplicate",hint:"Duplicate the current selection",icon:qs,shortcut:"⌘D"},"select-all":{id:"select-all",label:"Select all",hint:"Select every node",icon:Sv,shortcut:"⌘A"},"export-json":{id:"export-json",label:"Export",hint:"Download the graph as JSON",icon:Mv},"import-json":{id:"import-json",label:"Import",hint:"Load a JSON graph from disk",icon:Pv}},io=["select","pan","add-node","add-link","select-all","fit","zoom-in","zoom-out","pause","resume","screenshot","export-json","import-json"];function Gs(e){return e==="2d"?Hs:Cv}function Ov(e,t){if(e===!1)return[];let n;if(e===!0)n=io;else if(Array.isArray(e))n=e;else{const r=e.include??io,o=new Set(e.exclude??[]);n=r.filter(i=>!o.has(i))}return n.filter(r=>r==="pause"?!t:r==="resume"?t:!0)}function jv(e){return e&&typeof e=="object"&&!Array.isArray(e)?e.position??"top-right":"top-right"}function zv(e){const{config:t,activeTool:n,paused:r,mode:o,isDisabled:i,onSelect:a}=e,l=Ov(t,r),[s,u]=A.useState(0),f=A.useRef([]),c=A.useRef(!1);if(A.useEffect(()=>{if(!c.current)return;const m=Math.min(s,Math.max(0,l.length-1));f.current[m]?.focus()},[s,l.length]),l.length===0)return null;const p=jv(t),h=Math.min(s,Math.max(0,l.length-1)),d=m=>{c.current=!0,u(v=>(v+m+l.length)%l.length)};return R.jsx("div",{className:`lgc-toolbar lgc-toolbar--${p}`,role:"toolbar",children:l.map((m,v)=>{const g=Us[m],S=m==="toggle-mode"?Gs(o):g.icon,_=g.toggleable&&n===m,x=i?.(m)??!1,w=[g.hint,g.shortcut?`(${g.shortcut})`:""],b=v===h;return R.jsx("button",{ref:M=>{f.current[v]=M},type:"button",className:["lgc-tool",_?"lgc-tool--active":"",x?"lgc-tool--disabled":""].join(" ").trim(),"aria-label":g.label,"aria-pressed":_?"true":void 0,disabled:x,tabIndex:b?0:-1,title:w.filter(Boolean).join(" "),onFocus:()=>u(v),onClick:()=>a(m),onKeyDown:M=>{M.key==="ArrowRight"?(M.preventDefault(),d(1)):M.key==="ArrowLeft"?(M.preventDefault(),d(-1)):M.key==="Home"?(M.preventDefault(),c.current=!0,u(0)):M.key==="End"&&(M.preventDefault(),c.current=!0,u(l.length-1))},children:R.jsx(S,{})},m)})})}const Zt=8;function Tv({x:e,y:t,items:n,onClose:r}){const o=A.useRef(null),[i,a]=A.useState({left:e,top:t});return A.useEffect(()=>{const l=s=>{s instanceof KeyboardEvent&&s.key!=="Escape"||s instanceof MouseEvent&&o.current&&o.current.contains(s.target)||r()};return window.addEventListener("mousedown",l),window.addEventListener("keydown",l),()=>{window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l)}},[r]),A.useLayoutEffect(()=>{const l=o.current;if(!l)return;const s=l.parentElement;if(!s)return;const u=s.getBoundingClientRect(),f=l.offsetWidth,c=l.offsetHeight,p=Math.max(Zt,u.width-f-Zt),h=Math.max(Zt,u.height-c-Zt),d=Math.min(Math.max(e,Zt),p),m=Math.min(Math.max(t,Zt),h);(d!==i.left||m!==i.top)&&a({left:d,top:m})},[e,t,n,i.left,i.top]),R.jsx("div",{ref:o,className:"lgc-menu",role:"menu",style:{left:i.left,top:i.top},children:n.map((l,s)=>"separator"in l?R.jsx("div",{className:"lgc-menu-separator"},`sep-${s}`):R.jsxs("div",{role:"menuitem",className:"lgc-menu-item","aria-disabled":l.disabled?"true":void 0,onClick:()=>{l.disabled||(l.onSelect(),r())},children:[R.jsx("span",{children:l.label}),l.shortcut?R.jsx("span",{style:{marginLeft:"auto",opacity:.6},children:l.shortcut}):null]},l.id))})}const Ev=120,Qt=14;function Lv({content:e,hostRef:t}){const[n,r]=A.useState(null),[o,i]=A.useState(!1),a=A.useRef(null),l=A.useRef(null);A.useEffect(()=>{if(e===null){r(null),i(!1),a.current=null;return}const v=t.current;if(!v)return;a.current=v.getBoundingClientRect();const g=window.setTimeout(()=>i(!0),Ev),S=x=>{const w=a.current??v.getBoundingClientRect();r({x:x.clientX-w.left,y:x.clientY-w.top})},_=()=>{a.current=v.getBoundingClientRect()};return v.addEventListener("mousemove",S),window.addEventListener("resize",_),()=>{window.clearTimeout(g),v.removeEventListener("mousemove",S),window.removeEventListener("resize",_)}},[t,e]);const[s,u]=A.useState(!1),[f,c]=A.useState(!1);if(A.useLayoutEffect(()=>{if(!o||!n)return;const v=t.current,g=l.current;if(!v||!g)return;const S=a.current??v.getBoundingClientRect(),_=g.offsetWidth,x=g.offsetHeight;u(n.x+Qt+_>S.width),c(n.y+Qt+x>S.height)},[o,n,e,t]),e===null||n===null||!o)return null;const p=l.current?.offsetWidth??0,h=l.current?.offsetHeight??0,d=s?n.x-Qt-p:n.x+Qt,m=f?n.y-Qt-h:n.y+Qt;return R.jsx("div",{ref:l,className:"lgc-tooltip",role:"tooltip",style:{left:d,top:m,pointerEvents:"none"},children:typeof e=="string"?e:R.jsx("span",{ref:v=>v?.appendChild(e)})})}function Nv({rect:e,count:t}){if(!e)return null;const n=Math.min(e.x0,e.x1),r=Math.min(e.y0,e.y1),o=Math.abs(e.x1-e.x0),i=Math.abs(e.y1-e.y0);return R.jsx("div",{className:"lgc-marquee",style:{left:n,top:r,width:o,height:i,pointerEvents:"none"},children:t&&t>0?R.jsx("span",{className:"lgc-marquee-count",children:t}):null})}function Rv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("rect",{x:"3",y:"3",width:"8",height:"8",rx:"1"}),R.jsx("path",{d:"M6 5h7v7"})]})}function Dv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("circle",{cx:"5",cy:"11",r:"2"}),R.jsx("circle",{cx:"11",cy:"11",r:"2"}),R.jsx("path",{d:"M6.5 9.5L13 3M5 8L9.5 9.5"})]})}function da(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("rect",{x:"3",y:"4",width:"10",height:"10",rx:"1"}),R.jsx("rect",{x:"5",y:"2",width:"6",height:"3",rx:"1"})]})}function Pt({label:e,shortcut:t,disabled:n,onClick:r,children:o}){return R.jsx("button",{type:"button",className:"lgc-selpanel-btn","aria-label":e,title:t?`${e} (${t})`:e,disabled:n,onClick:r,children:o})}function Iv({nodeCount:e,linkCount:t,hasClipboard:n,enableClipboard:r,onDelete:o,onDuplicate:i,onAddConnected:a,onCopy:l,onCut:s,onPaste:u,onClear:f}){if(e===0&&t===0)return!r||!n?null:R.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[R.jsx("span",{className:"lgc-selpanel-label",children:"Clipboard ready"}),R.jsx(Pt,{label:"Paste",shortcut:"⌘V",onClick:u,children:R.jsx(da,{})})]});const c=[];e>0&&c.push(`${e} ${e===1?"node":"nodes"}`),t>0&&c.push(`${t} ${t===1?"link":"links"}`);const p=c.join(", ");return R.jsxs("div",{className:"lgc-selpanel",role:"region","aria-label":"Selection",children:[R.jsx("span",{className:"lgc-selpanel-label",children:p}),R.jsx("div",{className:"lgc-selpanel-divider"}),R.jsx(Pt,{label:"Delete",shortcut:"⌫",onClick:o,children:R.jsx($s,{width:14,height:14})}),R.jsx(Pt,{label:"Duplicate",shortcut:"⌘D",onClick:i,children:R.jsx(qs,{width:14,height:14})}),R.jsx(Pt,{label:"Connect to new node",shortcut:"↵",disabled:e===0,onClick:a,children:R.jsx(Av,{})}),r?R.jsxs(R.Fragment,{children:[R.jsx(Pt,{label:"Copy",shortcut:"⌘C",disabled:e===0,onClick:l,children:R.jsx(Rv,{})}),R.jsx(Pt,{label:"Cut",shortcut:"⌘X",disabled:e===0,onClick:s,children:R.jsx(Dv,{})}),R.jsx(Pt,{label:"Paste",shortcut:"⌘V",disabled:!n,onClick:u,children:R.jsx(da,{})})]}):null,R.jsx("div",{className:"lgc-selpanel-divider"}),R.jsx(Pt,{label:"Clear selection",shortcut:"Esc",onClick:f,children:"✕"})]})}const ha=["#4e79a7","#f28e2b","#e15759","#76b7b2","#59a14f","#edc948","#b07aa1","#ff9da7","#9c755f","#bab0ac"];function Fv(e,t){let n=0;for(let r=0;r<e.length;r++)n=n*31+e.charCodeAt(r)|0;return Math.abs(n)%t}function Bv(e){return ha[Fv(e,ha.length)]}function $v({nodes:e,groupBy:t,hidden:n,onToggle:r}){const o=A.useMemo(()=>{if(!t)return[];const i=new Set;for(const a of e){const l=typeof t=="function"?t(a):a[t];l!=null&&i.add(String(l))}return Array.from(i).sort()},[e,t]);return o.length===0?null:R.jsx("div",{className:"lgc-legend",role:"region","aria-label":"Groups",children:o.map(i=>{const a=n.has(i);return R.jsxs("button",{type:"button",className:["lgc-legend-item",a?"lgc-legend-item--hidden":""].join(" ").trim(),onClick:()=>r(i),"aria-pressed":a?"false":"true",title:`Toggle ${i}`,children:[R.jsx("span",{className:"lgc-legend-swatch",style:{background:Bv(i)}}),R.jsx("span",{children:i})]},i)})})}function Hv({mode:e,onToggle:t}){const n=Gs(e),r=e==="2d"?"3D":"2D";return R.jsxs("button",{type:"button",className:"lgc-mode-toggle",onClick:t,"aria-label":`Switch to ${r}`,title:`Switch to ${r} (3)`,children:[R.jsx(n,{width:14,height:14}),R.jsx("span",{className:"lgc-mode-toggle-label",children:e.toUpperCase()})]})}function qv(e){return R.jsxs("svg",{width:14,height:14,viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,...e,children:[R.jsx("circle",{cx:"8",cy:"8",r:"2.4"}),R.jsx("path",{d:"M8 1v2M8 13v2M1 8h2M13 8h2M3.05 3.05l1.4 1.4M11.55 11.55l1.4 1.4M3.05 12.95l1.4-1.4M11.55 4.45l1.4-1.4"})]})}function Uv({items:e}){const[t,n]=A.useState(!1),r=A.useRef(null);return A.useEffect(()=>{if(!t)return;const o=a=>{r.current&&!r.current.contains(a.target)&&n(!1)},i=a=>{a.key==="Escape"&&n(!1)};return window.addEventListener("mousedown",o),window.addEventListener("keydown",i),()=>{window.removeEventListener("mousedown",o),window.removeEventListener("keydown",i)}},[t]),e.length===0?null:R.jsxs("div",{ref:r,className:"lgc-options-menu",children:[R.jsx("button",{type:"button",className:"lgc-options-trigger","aria-label":"Options","aria-expanded":t,title:"Options",onClick:()=>n(o=>!o),children:R.jsx(qv,{})}),t?R.jsx("div",{className:"lgc-options-panel",role:"menu",children:e.map(o=>o.kind==="select"?R.jsxs("div",{className:"lgc-options-item",children:[R.jsxs("span",{className:"lgc-options-item-text",children:[R.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?R.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]}),R.jsx("select",{className:"lgc-options-select",value:o.value,onChange:i=>o.onChange(i.target.value),children:o.options.map(i=>R.jsx("option",{value:i.value,children:i.label??i.value},i.value))})]},o.id):R.jsxs("label",{className:"lgc-options-item",children:[R.jsx("input",{type:"checkbox",checked:o.checked,onChange:i=>o.onChange(i.target.checked)}),R.jsxs("span",{className:"lgc-options-item-text",children:[R.jsx("span",{className:"lgc-options-item-label",children:o.label}),o.hint?R.jsx("span",{className:"lgc-options-item-hint",children:o.hint}):null]})]},o.id))}):null]})}function Gv(e,t,n={}){const r=n.spacing??50,o=n.color??"rgba(0,0,0,0.06)",i=e.canvas,l=e.getTransform().inverse(),s=l.transformPoint({x:0,y:0}),u=l.transformPoint({x:i.width,y:i.height}),f=Math.floor(s.x/r)*r,c=Math.ceil(u.x/r)*r,p=Math.floor(s.y/r)*r,h=Math.ceil(u.y/r)*r;e.save(),e.strokeStyle=o,e.lineWidth=1/t,e.beginPath();for(let d=f;d<=c;d+=r)e.moveTo(d,p),e.lineTo(d,h);for(let d=p;d<=h;d+=r)e.moveTo(f,d),e.lineTo(c,d);e.stroke(),e.restore()}const pa=15,Vv={background:"--lgc-bg",foreground:"--lgc-fg",border:"--lgc-border",accent:"--lgc-accent",toolbarBackground:"--lgc-toolbar-bg",toolbarForeground:"--lgc-toolbar-fg",toolbarBorder:"--lgc-toolbar-border",toolActiveBackground:"--lgc-tool-active-bg",toolHoverBackground:"--lgc-tool-hover-bg",tooltipBackground:"--lgc-tooltip-bg",tooltipForeground:"--lgc-tooltip-fg",menuBackground:"--lgc-menu-bg",menuForeground:"--lgc-menu-fg",menuHoverBackground:"--lgc-menu-hover-bg",fontFamily:"--lgc-font",fontSize:"--lgc-font-size"};function Wv(e){if(!e)return{};const t={};for(const[n,r]of Object.entries(e)){if(r===void 0)continue;const o=Vv[n];o&&(t[o]=String(r))}return t}function Vs(e,t){const n=URL.createObjectURL(e),r=document.createElement("a");r.href=n,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(n)}function Yv(e){e&&e.toBlob(t=>{t&&Vs(t,`lora-graph-${Date.now()}.png`)})}function Xv(e,t){const{data:n,defaultData:r,onDataChange:o,mode:i,defaultMode:a,onModeChange:l,width:s,height:u,className:f,style:c,theme:p,tools:h=!0,selection:d="multi",showContextMenu:m=!0,showLegend:v=!1,showGrid:g=!1,showLabels:S=!1,enableClipboard:_=!0,enableTooltip:x=!0,introZoom:w=!0,focusOnClick:b=!1,highlightNeighborsOnHover:M=!0,autoIndexNeighbors:P=M,collideNodes:N=!1,fixOnDrop:j=!0,fitOnSelect:F=!1,beeswarm:I=!1,onSelectionChange:K,onNodeClick:O,onNodeRightClick:y,onLinkClick:k,onLinkRightClick:C,onBackgroundClick:$,onBackgroundRightClick:B,onNodeDrag:X,onNodeDragEnd:L,onNodeHover:D,onLinkHover:q,onNodeDoubleClick:Y,onCopy:E,onCut:H,onPaste:T,onBeforeNodeDelete:W,onBeforeLinkDelete:V,onNodeDeleted:G,onLinkDeleted:U,onRenderFramePre:ee,nodeColor:ne,nodeLabel:ie,nodeVal:le,nodeAutoColorBy:ae,nodeRelSize:ce,nodeVisibility:be,nodeCanvasObject:We,linkColor:Pe,linkLabel:Ye,linkWidth:Xe,linkHoverPrecision:ot,backgroundColor:Ae,enableNavigationControls:_e,performanceProfile:Se,dagMode:He}=e,[Ce,Ie]=A.useState(i??a??"2d"),Le=i!==void 0,ve=Le?i:Ce,Qe=A.useRef(null),it=A.useCallback(z=>{z!==ve&&(Qe.current?.(),Le||Ie(z),l?.(z))},[ve,Le,l]),se=Ol({...n!==void 0?{controlled:n}:{},...r!==void 0?{defaultData:r}:{},...o?{onChange:o}:{}});Kg(P,se.data);const ye=Yg({mode:d,...K?{onChange:K}:{}}),[qe,Ct]=A.useState("select"),[Tt,dr]=A.useState(!1),Ys=iv({highlightNeighborsOnHover:M,...ie!==void 0?{nodeLabel:ie}:{},...Ye!==void 0?{linkLabel:Ye}:{},...D?{onNodeHover:D}:{},...q?{onLinkHover:q}:{}}),{hoverNodeId:Xs,hoverLinkId:Ks,liveHoverNodeIdRef:Zs,highlightedNodeIds:Qs,highlightedLinkIds:Js,hoveredNodeSet:el,hoveredLinkSet:tl,tooltipContent:nl,handleNodeHover:Oo,handleLinkHover:jo,pinHover:jn}=Ys,[zo,rl]=A.useState(()=>new Set),[Ht,To]=A.useState(!!b),[zn,Eo]=A.useState(!!S),[Tn,Lo]=A.useState(!!F),[En,No]=A.useState(He??null);A.useEffect(()=>{To(!!b)},[b]),A.useEffect(()=>{Eo(!!S)},[S]),A.useEffect(()=>{Lo(!!F)},[F]),A.useEffect(()=>{No(He??null)},[He]);const mt=A.useRef(null),[sn,Ln]=A.useState(null),[ln,Nn]=A.useState(null),[Rn,Et]=A.useState(null),[at,ft]=A.useState([]),[Dn,qt]=A.useState(null),ol=Xg(),bt=hv(),Lt=A.useRef(null),hr=A.useRef(null),[Nt,il]=A.useState(null),al=A.useCallback(z=>{hr.current=z,il(z)},[]),Ro=Wg(Lt),pr=s??Ro?.width??600,gr=u??Ro?.height??400,Ne=A.useRef(null),{marquee:In,lastCursorRef:sl}=Zg({mount:Nt,engineRef:Ne,selection:ye,nodes:se.data.nodes,links:se.data.links,setSelectedLinkIds:ft,liveHoverNodeIdRef:Zs});Jg(Nt);const st=tv({dataApi:se,...W?{beforeNode:W}:{},...V?{beforeLink:V}:{},...G?{onNodeDeleted:G}:{},...U?{onLinkDeleted:U}:{},afterNodeDelete:()=>ye.clear(),afterLinkDelete:()=>ft([])}),Te=ev({enableClipboard:_,dataApi:se,deleteGate:st,selection:ye,setSelectedLinkIds:ft,engineRef:Ne,lastCursorRef:sl,...E?{onCopy:E}:{},...H?{onCut:H}:{},...T?{onPaste:T}:{}}),Do=A.useRef(null),Io=A.useCallback((z,Z)=>{O?.(z,Z);const te=performance.now(),he=Do.current,pe=he&&he.id===z.id&&te-he.at<280;if(Do.current={id:z.id,at:te},pe){Y?.(z,Z);return}if(qe==="add-link"&&z.id!==void 0){Rn===null?Et(z.id):(Rn!==z.id&&se.addLink({source:Rn,target:z.id}),Et(null));return}if(d!=="none"&&z.id!==void 0){const ue=Z.shiftKey||Z.ctrlKey||Z.metaKey;ye.toggle(z.id,{additive:ue}),ue||ft([])}if(Ht&&z.id!==void 0&&Ne.current){const ue=Ne.current;sn===z.id?(mt.current&&ue.setCameraState(mt.current,800),Ln(null),mt.current=null):(sn===null&&ln===null&&(mt.current=ue.getCameraState()),ue.focusOn({x:z.x??0,y:z.y??0,z:z.z??0},{distance:120,zoom:8,durationMs:bt?0:1e3}),Ln(z.id),Nn(null))}},[O,Y,ye,d,qe,Rn,se,Ht,sn,ln,bt]),Fo=A.useCallback(z=>{if($?.(z),Ne.current?.stopAnimation(),qe==="add-node"){const te=hr.current?.getBoundingClientRect(),he=te?z.clientX-te.left:z.clientX,pe=te?z.clientY-te.top:z.clientY,ue=Ne.current?.screen2Graph(he,pe)??{x:he,y:pe};se.addNode(void 0,{at:{x:ue.x,y:ue.y,...ue.z!==void 0?{z:ue.z}:{}}});return}qe==="add-link"&&Et(null),z.shiftKey||z.ctrlKey||z.metaKey||(ye.clear(),ft([])),qt(null)},[$,qe,se,ye]),Bo=A.useCallback((z,Z)=>{if(y?.(z,Z),!m)return;const te=Lt.current?.getBoundingClientRect(),he=te?Z.clientX-te.left:Z.clientX,pe=te?Z.clientY-te.top:Z.clientY,ue=z.id,ge=ye.selected,dt=ge.length>1&&ge.includes(ue)?[{id:"pin-all",label:`Pin ${ge.length} nodes`,onSelect:()=>{for(const Re of ge){const Je=se.data.nodes.find(ht=>ht.id===Re);Je&&se.updateNode(Re,{fx:Je.x,fy:Je.y,fz:Je.z})}}},{id:"unpin-all",label:`Unpin ${ge.length} nodes`,onSelect:()=>{for(const Re of ge)se.updateNode(Re,{fx:void 0,fy:void 0,fz:void 0})}},{separator:!0},{id:"duplicate",label:`Duplicate ${ge.length} nodes`,shortcut:"⌘D",onSelect:()=>Te.duplicate()},{id:"delete-all",label:`Delete ${ge.length} nodes`,shortcut:"⌫",onSelect:()=>{st.requestNodeDelete(ge,"contextMenu")}}]:[{id:"pin",label:z.fx!==void 0?"Unpin":"Pin",onSelect:()=>{se.updateNode(ue,z.fx!==void 0?{fx:void 0,fy:void 0,fz:void 0}:{fx:z.x,fy:z.y,fz:z.z})}},{id:"connect",label:"Connect from here…",onSelect:()=>{Ct("add-link"),Et(ue)}},{separator:!0},{id:"delete",label:"Delete",shortcut:"⌫",onSelect:()=>{st.requestNodeDelete([ue],"contextMenu")}}];qt({x:he,y:pe,items:dt})},[y,m,se,ye,Te,st]),$o=A.useCallback((z,Z)=>{k?.(z,Z);const te=z.id;if(te===void 0)return;const he=Z.shiftKey||Z.ctrlKey||Z.metaKey;if(ft(pe=>{const ue=pe.includes(te);return!he||d!=="multi"?ue&&pe.length===1?[]:[te]:ue?pe.filter(ge=>ge!==te):[...pe,te]}),he||ye.clear(),Ht&&Ne.current){const pe=Ne.current;if(ln===te)mt.current&&pe.setCameraState(mt.current,800),Nn(null),mt.current=null;else{const ue=typeof z.source=="object"?z.source:null,ge=typeof z.target=="object"?z.target:null;if(ue&&ge&&ue.x!==void 0&&ge.x!==void 0){sn===null&&ln===null&&(mt.current=pe.getCameraState());const Ue=ue.x??0,dt=ue.y??0,Re=ge.x??0,Je=ge.y??0,ht=ue.z??0,Gt=ge.z??0,ni={x:(Ue+Re)/2,y:(dt+Je)/2,z:(ht+Gt)/2},cn=1.5,ri=Re-Ue,oi=Je-dt,dl=Gt-ht,hl=Math.max(Math.abs(ri),1),pl=Math.max(Math.abs(oi),1),gl=Math.min(pr/(hl*cn),gr/(pl*cn)),vl=Math.min(16,Math.max(.5,gl)),yl=Math.hypot(ri,oi,dl)/2/.466*cn,ml=Math.max(60,yl);pe.focusOn(ni,{distance:ml,zoom:vl,durationMs:bt?0:1e3}),Nn(te),Ln(null)}}}},[k,ye,d,Ht,ln,sn,pr,gr,bt]),Ho=A.useCallback((z,Z)=>{if(C?.(z,Z),!m)return;const te=Lt.current?.getBoundingClientRect(),he=te?Z.clientX-te.left:Z.clientX,pe=te?Z.clientY-te.top:Z.clientY;qt({x:he,y:pe,items:[{id:"delete",label:"Delete link",shortcut:"⌫",onSelect:()=>{st.requestLinkDelete(ue=>ue===z,"contextMenu")}},{id:"reverse",label:"Reverse direction",onSelect:()=>{se.removeLink(ue=>ue===z),se.addLink({...z,source:typeof z.target=="object"?z.target.id:z.target,target:typeof z.source=="object"?z.source.id:z.source})}}]})},[C,m,se,st]),vr=A.useRef(null),qo=A.useRef(se.data.nodes);qo.current=se.data.nodes;const Uo=A.useCallback((z,Z)=>{if(X?.(z,Z),Ne.current?.stopAnimation(),jn(z),qe==="add-link"){const te=qo.current,he=z.x??0,pe=z.y??0,ue=pa*pa;let ge=null,Ue=1/0;for(let dt=0;dt<te.length;dt++){const Re=te[dt];if(!Re||Re===z||Re.id===z.id)continue;const Je=(Re.x??0)-he,ht=(Re.y??0)-pe,Gt=Je*Je+ht*ht;Gt<Ue&&(Ue=Gt,ge=Re)}vr.current=ge&&Ue<ue?ge:null}},[X,qe,jn]),Go=A.useCallback((z,Z)=>{if(L?.(z,Z),jn(null),qe==="add-link"){const te=vr.current;if(vr.current=null,!te||te.id===void 0||z.id===void 0)return;se.addLink({source:z.id,target:te.id});return}if(j){const te=z;z.x!==void 0&&(te.fx=z.x),z.y!==void 0&&(te.fy=z.y),z.z!==void 0&&(te.fz=z.z)}},[L,qe,se,j,jn]),Vo=A.useCallback(z=>{if(B?.(z),!m)return;const Z=Lt.current?.getBoundingClientRect(),te=Z?z.clientX-Z.left:z.clientX,he=Z?z.clientY-Z.top:z.clientY,pe=hr.current?.getBoundingClientRect(),ue=pe?z.clientX-pe.left:z.clientX,ge=pe?z.clientY-pe.top:z.clientY,Ue=Ne.current?.screen2Graph(ue,ge)??{x:ue,y:ge};qt({x:te,y:he,items:[{id:"add-node-here",label:"Add node here",onSelect:()=>{se.addNode(void 0,{at:{x:Ue.x,y:Ue.y,...Ue.z!==void 0?{z:Ue.z}:{}}})}},{id:"fit",label:"Fit to view",shortcut:"F",onSelect:()=>Ne.current?.fit(400,40)},{id:"toggle-mode",label:ve==="2d"?"Switch to 3D":"Switch to 2D",shortcut:"3",onSelect:()=>it(ve==="2d"?"3d":"2d")}]})},[B,m,se,ve,it]),yr=p?.accent??"#4f8ef7",Wo=ye.selectedSet,Yo=A.useMemo(()=>new Set(at),[at]),je=ov({mode:ve,accentColor:yr,...ne!==void 0?{nodeColor:ne}:{},...Pe!==void 0?{linkColor:Pe}:{},...Xe!==void 0?{linkWidth:Xe}:{},...le!==void 0?{nodeVal:le}:{},...ce!==void 0?{nodeRelSize:ce}:{},...e.nodePointerAreaPaint!==void 0?{nodePointerAreaPaint:e.nodePointerAreaPaint}:{},...ae!==void 0?{nodeAutoColorBy:ae}:{},...be!==void 0?{nodeVisibility:be}:{},selectedNodeSet:Wo,selectedLinkSet:Yo,highlightNeighborsOnHover:M,highlightedNodeIds:Qs,highlightedLinkIds:Js,hoverNodeId:Xs,hoverLinkId:Ks,hiddenGroups:zo}),Ut=sv({mode:ve,showLabels:zn,selectedNodeSet:Wo,hoveredNodeSet:el,accentColor:yr,...We?{hostNodeCanvasObject:We}:{},...e.nodeThreeObject?{hostNodeThreeObject:e.nodeThreeObject}:{},...ie!==void 0?{nodeLabel:ie}:{},...le!==void 0?{nodeVal:le}:{},...ce!==void 0?{nodeRelSize:ce}:{},...p?{theme:p}:{}}),_t=lv({mode:ve,showLabels:zn,selectedLinkSet:Yo,hoveredLinkSet:tl,accentColor:yr,...e.linkCanvasObject?{hostLinkCanvasObject:e.linkCanvasObject}:{},...e.linkThreeObject?{hostLinkThreeObject:e.linkThreeObject}:{},...e.linkPositionUpdate!==void 0?{hostLinkPositionUpdate:e.linkPositionUpdate}:{},...Ye!==void 0?{linkLabel:Ye}:{},...p?{theme:p}:{}}),Xo=fv({profile:Se,nodeCount:se.data.nodes.length,linkCount:se.data.links.length,mode:ve}),Ko=ve==="3d"&&(ol||In!==null),Zo=A.useMemo(()=>Ae!==void 0?Ae:p?.background&&p.background!=="transparent"?p.background:"#ffffff",[Ae,p?.background]),ll=A.useMemo(()=>{const z={...Xo,...e,dagMode:En};return z.backgroundColor===void 0&&(z.backgroundColor=Zo),z.linkColor===void 0&&(z.linkColor="rgba(96, 102, 110, 0.55)"),z.linkOpacity===void 0&&(z.linkOpacity=1),z.nodeOpacity===void 0&&(z.nodeOpacity=1),je.nodeColor!==void 0&&(z.nodeColor=je.nodeColor),je.linkColor!==void 0&&(z.linkColor=je.linkColor),je.linkWidth!==void 0&&(z.linkWidth=je.linkWidth),je.nodeVal!==void 0&&(z.nodeVal=je.nodeVal),je.nodePointerAreaPaint!==void 0&&(z.nodePointerAreaPaint=je.nodePointerAreaPaint),Ut.canvasObject&&(z.nodeCanvasObject=Ut.canvasObject,z.nodeCanvasObjectMode=()=>"after"),_t.canvasObject&&(z.linkCanvasObject=_t.canvasObject,z.linkCanvasObjectMode=()=>"after"),Ut.threeObject&&(z.nodeThreeObject=Ut.threeObject,z.nodeThreeObjectExtend=!0),_t.threeObject&&(z.linkThreeObject=_t.threeObject,z.linkThreeObjectExtend=!0,_t.positionUpdate&&(z.linkPositionUpdate=_t.positionUpdate)),z.linkHoverPrecision=ot??8,z.enableNavigationControls=Ko?!1:_e??!0,z.onNodeClick=Io,z.onNodeRightClick=Bo,z.onLinkClick=$o,z.onLinkRightClick=Ho,z.onBackgroundClick=Fo,z.onBackgroundRightClick=Vo,z.onNodeDrag=Uo,z.onNodeDragEnd=Go,z.nodeLabel=()=>"",z.linkLabel=()=>"",z.onNodeHover=Oo,z.onLinkHover=jo,g&&(z.onRenderFramePre=(Z,te)=>{Gv(Z,te,typeof g=="object"?g:{}),ee?.(Z,te)}),je.nodeVisibility&&(z.nodeVisibility=je.nodeVisibility),z},[e,En,Zo,je.nodeColor,je.linkColor,je.linkWidth,je.nodeVal,je.nodePointerAreaPaint,je.nodeVisibility,Xo,Ko,ot,_e,Io,Bo,$o,Ho,Fo,Vo,Uo,Go,Oo,jo,g,ee,Ut.canvasObject,Ut.threeObject,_t.canvasObject,_t.threeObject,_t.positionUpdate]),Fe=Vg({mount:Nt,mode:ve,width:pr,height:gr,data:se.data,props:ll,paused:Tt,...bt?{modeTransitionMs:0}:{}});Ne.current=Fe,Qe.current=()=>{Ln(null),Nn(null),mt.current=null,Et(null),qt(null)};const Qo=A.useRef(!1),Jo=se.data.nodes.length;A.useEffect(()=>{if(w&&Fe&&!Qo.current&&Jo!==0){if(Qo.current=!0,bt){const z=setTimeout(()=>Ne.current?.fit(0,40),150);return()=>clearTimeout(z)}Ne.current?.introFollow({padding:40})}},[Fe,w,Jo,bt]),rv({engine:Fe,collideNodes:N,beeswarm:I,...ce!==void 0?{nodeRelSize:ce}:{}}),A.useEffect(()=>{if(!Tn)return;const z=Ne.current;if(!z?.fitToNodes)return;const Z=new Set(ye.selected);if(at.length>0){const te=new Set(at);for(const he of se.data.links){const pe=he.id;if(pe===void 0||!te.has(pe))continue;const ue=typeof he.source=="object"?he.source.id:he.source,ge=typeof he.target=="object"?he.target.id:he.target;ue!==void 0&&Z.add(ue),ge!==void 0&&Z.add(ge)}}Z.size!==0&&z.fitToNodes([...Z],bt?0:400,60)},[Tn,ye.selected,at,se.data.links,bt]),A.useEffect(()=>{if(!Nt)return;const z=Z=>{if(!Z.shiftKey||ve!=="3d")return;const te=Ne.current;if(!te?.panBy)return;Z.preventDefault(),Z.stopPropagation();const he=te.getZoom?.()??1,pe=-Z.deltaY/4/Math.max(he,.1);te.panBy({z:pe},0)};return Nt.addEventListener("wheel",z,{capture:!0,passive:!1}),()=>{Nt.removeEventListener("wheel",z,{capture:!0})}},[Nt,ve]);const ei=A.useRef(null),mr=A.useCallback(()=>JSON.stringify({nodes:se.data.nodes.map(z=>{const{vx:Z,vy:te,vz:he,index:pe,_neighbors:ue,_links:ge,__threeObj:Ue,__indexColor:dt,__initialFixedPos:Re,__initialPos:Je,__disposeControlsAfterDrag:ht,__dragCommitted:Gt,__dragged:ni,...cn}=z;return cn}),links:se.data.links.map(z=>{const Z=z,te=typeof Z.source=="object"&&Z.source!==null?Z.source.id:Z.source,he=typeof Z.target=="object"&&Z.target!==null?Z.target.id:Z.target,{source:pe,target:ue,__lineObj:ge,__arrowObj:Ue,__photonObjs:dt,__indexColor:Re,index:Je,...ht}=Z;return{...ht,source:te,target:he}})},null,2),[se.data]),ti=A.useCallback(z=>{const Z=JSON.parse(z);if(!Z||!Array.isArray(Z.nodes)||!Array.isArray(Z.links))throw new Error("invalid graph JSON");se.setData(Z),ye.clear(),ft([])},[se,ye]),br=A.useCallback((z=`graph-${Date.now()}.json`)=>{const Z=new Blob([mr()],{type:"application/json"});Vs(Z,z)},[mr]),cl=A.useCallback(z=>{switch(z){case"select":case"pan":case"add-node":case"add-link":Ct(z);break;case"delete":st.requestMixedDelete(ye.selected,at,"toolbar");break;case"duplicate":Te.duplicate();break;case"select-all":ye.set(se.data.nodes.map(Z=>Z.id)),ft(se.data.links.map(Z=>Z.id).filter(Z=>Z!==void 0));break;case"fit":Fe?.fit(400,40);break;case"zoom-in":Fe&&Fe.zoom((Fe.getZoom?.()??1)*1.2,200);break;case"zoom-out":Fe&&Fe.zoom((Fe.getZoom?.()??1)/1.2,200);break;case"pause":dr(!0);break;case"resume":dr(!1);break;case"screenshot":Yv(Fe?.getCanvasElement());break;case"export-json":br();break;case"import-json":ei.current?.click();break;case"toggle-mode":it(ve==="2d"?"3d":"2d");break}},[Fe,se,ye,ve,it,at,Te,br,st]);nv({engine:Fe,dataApi:se,deleteGate:st,selection:ye,mode:ve,setMode:it,selectedLinkIds:at,setSelectedLinkIds:ft,setLinkSourceId:Et,setActiveTool:Ct,enableClipboard:_,copy:Te.copy,cut:Te.cut,paste:Te.paste,duplicate:Te.duplicate,addConnectedNode:Te.addConnectedNode,togglePin:Te.togglePin,hostRef:Lt}),dv({ref:t,dataApi:se,deleteGate:st,selection:ye,engine:Fe,mode:ve,setMode:it,setPaused:dr,clipboard:Te,exportJSON:mr,importJSON:ti,downloadJSON:br,selectedLinkIds:at});const ul=A.useMemo(()=>({position:"relative",width:s??"100%",height:u??"100%",...Wv(p),...c}),[s,u,p,c]),fl=A.useMemo(()=>[{id:"focus-on-click",kind:"toggle",label:"Click to focus",hint:"Animate the camera to a clicked node; click again to restore.",checked:Ht,onChange:To},{id:"show-labels",kind:"toggle",label:"Always show labels",hint:"Draw every node + link label on the canvas, not just the selected ones. 2D only.",checked:zn,onChange:Eo},{id:"fit-on-select",kind:"toggle",label:"Fit to selection",hint:"Animate the camera to frame the current selection whenever it changes.",checked:Tn,onChange:Lo},{kind:"select",id:"dag-mode",label:"DAG orientation",hint:"Force a hierarchical / radial layout.",value:En??"null",options:[{value:"null",label:"off"},{value:"td",label:"td (top-down)"},{value:"bu",label:"bu (bottom-up)"},{value:"lr",label:"lr (left-right)"},{value:"rl",label:"rl (right-left)"},{value:"radialout"},{value:"radialin"}],onChange:z=>No(z==="null"?null:z)}],[Ht,zn,Tn,En]);return R.jsxs("div",{ref:Lt,className:["lora-graph-canvas",f??""].join(" ").trim(),style:ul,"data-mode":ve,"data-tool":qe,"data-paused":Tt?"true":void 0,tabIndex:0,role:"application","aria-label":"Graph canvas",children:[R.jsx("div",{ref:al,className:"lgc-engine-mount"}),R.jsx(zv,{config:h,activeTool:qe,paused:Tt,mode:ve,onSelect:cl}),h!==!1?R.jsxs(R.Fragment,{children:[R.jsx(Uv,{items:fl}),R.jsx(Hv,{mode:ve,onToggle:()=>it(ve==="2d"?"3d":"2d")})]}):null,Dn?R.jsx(Tv,{x:Dn.x,y:Dn.y,items:Dn.items,onClose:()=>qt(null)}):null,x?R.jsx(Lv,{content:nl,hostRef:Lt}):null,R.jsx(Nv,{rect:In,...In?.count!==void 0?{count:In.count}:{}}),v&&ae?R.jsx($v,{nodes:se.data.nodes,groupBy:ae,hidden:zo,onToggle:z=>rl(Z=>{const te=new Set(Z);return te.has(z)?te.delete(z):te.add(z),te})}):null,R.jsx(Iv,{nodeCount:ye.selected.length,linkCount:at.length,hasClipboard:Te.hasClipboard(),enableClipboard:_,onDelete:()=>{st.requestMixedDelete(ye.selected,at,"selectionPanel")},onDuplicate:()=>Te.duplicate(),onAddConnected:()=>Te.addConnectedNode(),onCopy:()=>Te.copy(),onCut:()=>Te.cut(),onPaste:()=>Te.paste(),onClear:()=>{ye.clear(),ft([])}}),R.jsx("input",{ref:ei,type:"file",accept:"application/json,.json",style:{display:"none"},onChange:z=>{const Z=z.target.files?.[0];Z&&(Z.text().then(ti).catch(te=>{console.error("[lora-graph-canvas] import failed:",te)}),z.target.value="")}})]})}const Ws=A.forwardRef(Xv);Ws.displayName="LoraGraphCanvas";const Kv={background:"#ffffff",foreground:"#1c1f23",border:"#d8dde3",accent:"#4f8ef7",toolbarBackground:"rgba(255, 255, 255, 0.92)",toolbarForeground:"#1c1f23",toolbarBorder:"#d8dde3",toolActiveBackground:"rgba(79, 142, 247, 0.18)",toolHoverBackground:"rgba(0, 0, 0, 0.05)",tooltipBackground:"rgba(28, 31, 35, 0.9)",tooltipForeground:"#ffffff",menuBackground:"#ffffff",menuForeground:"#1c1f23",menuHoverBackground:"rgba(0, 0, 0, 0.06)"},Zv={background:"#101216",foreground:"#e6e9ee",border:"#2a2f37",accent:"#6aa3ff",toolbarBackground:"rgba(20, 23, 28, 0.92)",toolbarForeground:"#e6e9ee",toolbarBorder:"#2a2f37",toolActiveBackground:"rgba(106, 163, 255, 0.25)",toolHoverBackground:"rgba(255, 255, 255, 0.08)",tooltipBackground:"rgba(240, 240, 240, 0.92)",tooltipForeground:"#101216",menuBackground:"#161a20",menuForeground:"#e6e9ee",menuHoverBackground:"rgba(255, 255, 255, 0.08)"};exports.DEFAULT_TOOL_ORDER=io;exports.LoraGraphCanvas=Ws;exports.TOOL_DESCRIPTORS=Us;exports.createId=It;exports.darkTheme=Zv;exports.lightTheme=Kv;
685
685
  //# sourceMappingURL=index.cjs.map