diff --git a/assets/index-bJPb1TF2.js b/assets/index-B59v_s5U.js similarity index 55% rename from assets/index-bJPb1TF2.js rename to assets/index-B59v_s5U.js index 732070c9..b9136c69 100644 --- a/assets/index-bJPb1TF2.js +++ b/assets/index-B59v_s5U.js @@ -1,5 +1 @@ -var _r=Object.defineProperty;var Nr=(t,e,n)=>e in t?_r(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _=(t,e,n)=>(Nr(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function zn(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r{}};function Gt(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ut.prototype=Gt.prototype={constructor:Ut,on:function(t,e){var n=this._,r=br(t+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),We.hasOwnProperty(e)?{space:We[e],local:t}:t}function Lr(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===we&&e.documentElement.namespaceURI===we?e.createElement(t):e.createElementNS(n,t)}}function Mr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Cn(t){var e=ce(t);return(e.local?Mr:Lr)(e)}function zr(){}function Ee(t){return t==null?zr:function(){return this.querySelector(t)}}function Cr(t){typeof t!="function"&&(t=Ee(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=b&&(b=w+1);!(S=d[b])&&++b=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function ti(t){t||(t=ei);function e(g,h){return g&&h?t(g.__data__,h.__data__):!g-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;oe?1:t>=e?0:NaN}function ni(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ri(){return Array.from(this)}function ii(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?gi:typeof e=="function"?yi:mi)(t,e,n??"")):St(this.node(),t)}function St(t,e){return t.style.getPropertyValue(e)||Dn(t).getComputedStyle(t,null).getPropertyValue(e)}function wi(t){return function(){delete this[t]}}function xi(t,e){return function(){this[t]=e}}function _i(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ni(t,e){return arguments.length>1?this.each((e==null?wi:typeof e=="function"?_i:xi)(t,e)):this.node()[t]}function In(t){return t.trim().split(/^|\s+/)}function Pe(t){return t.classList||new $n(t)}function $n(t){this._node=t,this._names=In(t.getAttribute("class")||"")}$n.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Rn(t,e){for(var n=Pe(t),r=-1,i=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Ki(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n()=>t;function xe(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}xe.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ao(t){return!t.ctrlKey&&!t.button}function so(){return this.parentNode}function co(t,e){return e??{x:t.x,y:t.y}}function lo(){return navigator.maxTouchPoints||"ontouchstart"in this}function uo(){var t=ao,e=so,n=co,r=lo,i={},o=Gt("start","drag","end"),a=0,s,c,l,u,g=0;function h(m){m.on("mousedown.drag",f).filter(r).on("touchstart.drag",d).on("touchmove.drag",p,oo).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(m,S){if(!(u||!t.call(this,m,S))){var M=b(this,e.call(this,m,S),m,S,"mouse");M&&(et(m.view).on("mousemove.drag",x,Et).on("mouseup.drag",v,Et),On(m.view),fe(m),l=!1,s=m.clientX,c=m.clientY,M("start",m))}}function x(m){if(wt(m),!l){var S=m.clientX-s,M=m.clientY-c;l=S*S+M*M>g}i.mouse("drag",m)}function v(m){et(m.view).on("mousemove.drag mouseup.drag",null),Bn(m.view,l),wt(m),i.mouse("end",m)}function d(m,S){if(t.call(this,m,S)){var M=m.changedTouches,T=e.call(this,m,S),P=M.length,$,D;for($=0;$>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Xt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Xt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=fo.exec(t))?new j(e[1],e[2],e[3],1):(e=po.exec(t))?new j(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=go.exec(t))?Xt(e[1],e[2],e[3],e[4]):(e=mo.exec(t))?Xt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=yo.exec(t))?en(e[1],e[2]/100,e[3]/100,1):(e=vo.exec(t))?en(e[1],e[2]/100,e[3]/100,e[4]):je.hasOwnProperty(t)?Qe(je[t]):t==="transparent"?new j(NaN,NaN,NaN,0):null}function Qe(t){return new j(t>>16&255,t>>8&255,t&255,1)}function Xt(t,e,n,r){return r<=0&&(t=e=n=NaN),new j(t,e,n,r)}function _o(t){return t instanceof Ot||(t=It(t)),t?(t=t.rgb(),new j(t.r,t.g,t.b,t.opacity)):new j}function _e(t,e,n,r){return arguments.length===1?_o(t):new j(t,e,n,r??1)}function j(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}De(j,_e,Xn(Ot,{brighter(t){return t=t==null?Qt:Math.pow(Qt,t),new j(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Pt:Math.pow(Pt,t),new j(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new j(gt(this.r),gt(this.g),gt(this.b),Jt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Je,formatHex:Je,formatHex8:No,formatRgb:tn,toString:tn}));function Je(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}`}function No(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}${pt((isNaN(this.opacity)?1:this.opacity)*255)}`}function tn(){const t=Jt(this.opacity);return`${t===1?"rgb(":"rgba("}${gt(this.r)}, ${gt(this.g)}, ${gt(this.b)}${t===1?")":`, ${t})`}`}function Jt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function gt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function pt(t){return t=gt(t),(t<16?"0":"")+t.toString(16)}function en(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new nt(t,e,n,r)}function qn(t){if(t instanceof nt)return new nt(t.h,t.s,t.l,t.opacity);if(t instanceof Ot||(t=It(t)),!t)return new nt;if(t instanceof nt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(e===o?a=(n-r)/s+(n0&&c<1?0:a,new nt(a,s,c,t.opacity)}function So(t,e,n,r){return arguments.length===1?qn(t):new nt(t,e,n,r??1)}function nt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}De(nt,So,Xn(Ot,{brighter(t){return t=t==null?Qt:Math.pow(Qt,t),new nt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Pt:Math.pow(Pt,t),new nt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new j(de(t>=240?t-240:t+120,i,r),de(t,i,r),de(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new nt(nn(this.h),qt(this.s),qt(this.l),Jt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Jt(this.opacity);return`${t===1?"hsl(":"hsla("}${nn(this.h)}, ${qt(this.s)*100}%, ${qt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function nn(t){return t=(t||0)%360,t<0?t+360:t}function qt(t){return Math.max(0,Math.min(1,t||0))}function de(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Yn=t=>()=>t;function bo(t,e){return function(n){return t+n*e}}function ko(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function Lo(t){return(t=+t)==1?Vn:function(e,n){return n-e?ko(e,n,t):Yn(isNaN(e)?n:e)}}function Vn(t,e){var n=e-t;return n?bo(t,n):Yn(isNaN(t)?e:t)}const rn=function t(e){var n=Lo(e);function r(i,o){var a=n((i=_e(i)).r,(o=_e(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),l=Vn(i.opacity,o.opacity);return function(u){return i.r=a(u),i.g=s(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=t,r}(1);function ht(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pe=new RegExp(Ne.source,"g");function Mo(t){return function(){return t}}function zo(t){return function(e){return t(e)+""}}function Co(t,e){var n=Ne.lastIndex=pe.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(t=t+"",e=e+"";(r=Ne.exec(t))&&(i=pe.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:ht(r,i)})),n=pe.lastIndex;return n180?u+=360:u-l>180&&(l+=360),h.push({i:g.push(i(g)+"rotate(",null,r)-2,x:ht(l,u)})):u&&g.push(i(g)+"rotate("+u+r)}function s(l,u,g,h){l!==u?h.push({i:g.push(i(g)+"skewX(",null,r)-2,x:ht(l,u)}):u&&g.push(i(g)+"skewX("+u+r)}function c(l,u,g,h,f,x){if(l!==g||u!==h){var v=f.push(i(f)+"scale(",null,",",null,")");x.push({i:v-4,x:ht(l,g)},{i:v-2,x:ht(u,h)})}else(g!==1||h!==1)&&f.push(i(f)+"scale("+g+","+h+")")}return function(l,u){var g=[],h=[];return l=t(l),u=t(u),o(l.translateX,l.translateY,u.translateX,u.translateY,g,h),a(l.rotate,u.rotate,g,h),s(l.skewX,u.skewX,g,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,g,h),l=u=null,function(f){for(var x=-1,v=h.length,d;++x=0&&t._call.call(void 0,e),t=t._next;--bt}function sn(){yt=(ee=$t.now())+le,bt=zt=0;try{Go()}finally{bt=0,Oo(),yt=0}}function Ho(){var t=$t.now(),e=t-ee;e>jn&&(le-=e,ee=t)}function Oo(){for(var t,e=te,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:te=n);Ct=t,be(r)}function be(t){if(!bt){zt&&(zt=clearTimeout(zt));var e=t-yt;e>24?(t<1/0&&(zt=setTimeout(sn,t-$t.now()-le)),Lt&&(Lt=clearInterval(Lt))):(Lt||(ee=$t.now(),Lt=setInterval(Ho,jn)),bt=1,Kn(sn))}}function cn(t,e,n){var r=new ne;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Bo=Gt("start","end","cancel","interrupt"),Xo=[],Zn=0,ln=1,ke=2,Wt=3,un=4,Le=5,jt=6;function ue(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;qo(t,n,{name:e,index:r,group:i,on:Bo,tween:Xo,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:Zn})}function Re(t,e){var n=rt(t,e);if(n.state>Zn)throw new Error("too late; already scheduled");return n}function at(t,e){var n=rt(t,e);if(n.state>Wt)throw new Error("too late; already running");return n}function rt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function qo(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=$e(o,0,n.time);function o(l){n.state=ln,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var u,g,h,f;if(n.state!==ln)return c();for(u in r)if(f=r[u],f.name===n.name){if(f.state===Wt)return cn(a);f.state===un?(f.state=jt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+uke&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function xa(t,e,n){var r,i,o=wa(e)?Re:at;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function _a(t,e){var n=this._id;return arguments.length<2?rt(this.node(),n).on.on(t):this.each(xa(n,t,e))}function Na(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Sa(){return this.on("end.remove",Na(this._id))}function ba(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ee(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=(g=(s+l)/2))?s=g:l=g,(d=n>=(h=(c+u)/2))?c=h:u=h,i=o,!(o=o[p=d<<1|v]))return i[p]=a,t;if(f=+t._x.call(null,o.data),x=+t._y.call(null,o.data),e===f&&n===x)return a.next=o,i?i[p]=a:t._root=a,t;do i=i?i[p]=new Array(4):t._root=new Array(4),(v=e>=(g=(s+l)/2))?s=g:l=g,(d=n>=(h=(c+u)/2))?c=h:u=h;while((p=d<<1|v)===(w=(x>=h)<<1|f>=g));return i[w]=o,i[p]=a,t}function Qa(t){var e,n,r=t.length,i,o,a=new Array(r),s=new Array(r),c=1/0,l=1/0,u=-1/0,g=-1/0;for(n=0;nu&&(u=i),og&&(g=o));if(c>u||l>g)return this;for(this.cover(c,l).cover(u,g),n=0;nt||t>=i||r>e||e>=o;)switch(l=(eu||(s=x.y0)>g||(c=x.x1)=p)<<1|t>=d)&&(x=h[h.length-1],h[h.length-1]=h[h.length-1-v],h[h.length-1-v]=x)}else{var w=t-+this._x.call(null,f.data),b=e-+this._y.call(null,f.data),m=w*w+b*b;if(m=(h=(a+c)/2))?a=h:c=h,(v=g>=(f=(s+l)/2))?s=f:l=f,e=n,!(n=n[d=v<<1|x]))return this;if(!n.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(r=e,p=d)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):e?(o?e[d]=o:delete e[d],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[p]=n:this._root=n),this):(this._root=o,this)}function is(t){for(var e=0,n=t.length;eh.index){var R=f-P.x-P.vx,B=x-P.y-P.vy,O=R*R+B*B;Of+D||Mx+D||Tl.r&&(l.r=l[u].r)}function c(){if(e){var l,u=e.length,g;for(n=new Array(u),l=0;l[e(S,M,a),S])),m;for(d=0,s=new Array(p);d(t=(ms*t+ys)%dn)/dn}function ws(t){return t.x}function xs(t){return t.y}var _s=10,Ns=Math.PI*(3-Math.sqrt(5));function Ss(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,c=$e(g),l=Gt("tick","end"),u=vs();t==null&&(t=[]);function g(){h(),l.call("tick",e),n1?(d==null?s.delete(v):s.set(v,x(d)),e):s.get(v)},find:function(v,d,p){var w=0,b=t.length,m,S,M,T,P;for(p==null?p=1/0:p*=p,w=0;w1?(l.on(v,d),e):l.on(v)}}}function Be(){var t,e,n,r,i=Y(-30),o,a=1,s=1/0,c=.81;function l(f){var x,v=t.length,d=Ge(t,ws,xs).visitAfter(g);for(r=f,x=0;x=s)return;(f.data!==e||f.next)&&(p===0&&(p=dt(n),m+=p*p),w===0&&(w=dt(n),m+=w*w),m=0;)e+=n[r].value;t.value=e}function ks(){return this.eachAfter(bs)}function Ls(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this}function Ms(t,e){for(var n=this,r=[n],i,o,a=-1;n=r.pop();)if(t.call(e,n,++a,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function zs(t,e){for(var n=this,r=[n],i=[],o,a,s,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(a=0,s=o.length;a=0;)n+=r[i].value;e.value=n})}function As(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function Es(t){for(var e=this,n=Ps(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r}function Ps(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}function Ds(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function Is(){return Array.from(this)}function $s(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function Rs(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*Fs(){var t=this,e,n=[t],r,i,o;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(i=0,o=r.length;i=0;--s)i.push(o=a[s]=new Rt(a[s])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(ir)}function Gs(){return rr(this).eachBefore(Bs)}function Hs(t){return t.children}function Os(t){return Array.isArray(t)?t[1]:null}function Bs(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function ir(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Rt(t){this.data=t,this.depth=this.height=0,this.parent=null}Rt.prototype=rr.prototype={constructor:Rt,count:ks,each:Ls,eachAfter:zs,eachBefore:Ms,find:Cs,sum:Ts,sort:As,path:Es,ancestors:Ds,descendants:Is,leaves:$s,links:Rs,copy:Gs,[Symbol.iterator]:Fs};function ge(t){return t==null?null:Xs(t)}function Xs(t){if(typeof t!="function")throw new Error;return t}var qs={depth:-1},pn={},me={};function Ys(t){return t.id}function Vs(t){return t.parentId}function Me(){var t=Ys,e=Vs,n;function r(i){var o=Array.from(i),a=t,s=e,c,l,u,g,h,f,x,v,d=new Map;if(n!=null){const p=o.map((m,S)=>Us(n(m,S,i))),w=p.map(gn),b=new Set(p).add("");for(const m of w)b.has(m)||(b.add(m),p.push(m),w.push(gn(m)),o.push(me));a=(m,S)=>p[S],s=(m,S)=>w[S]}for(u=0,c=o.length;u=0&&(f=o[p],f.data===me);--p)f.data=null}if(g.parent=qs,g.eachBefore(function(p){p.depth=p.parent.depth+1,--c}).eachBefore(ir),g.parent=null,c>0)throw new Error("cycle");return g}return r.id=function(i){return arguments.length?(t=ge(i),r):t},r.parentId=function(i){return arguments.length?(e=ge(i),r):e},r.path=function(i){return arguments.length?(n=ge(i),r):n},r}function Us(t){t=`${t}`;let e=t.length;return ze(t,e-1)&&!ze(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function gn(t){let e=t.length;if(e<2)return"";for(;--e>1&&!ze(t,e););return t.slice(0,e)}function ze(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}const Vt=t=>()=>t;function Ws(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function lt(t,e,n){this.k=t,this.x=e,this.y=n}lt.prototype={constructor:lt,scale:function(t){return t===1?this:new lt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new lt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var he=new lt(1,0,0);or.prototype=lt.prototype;function or(t){for(;!t.__zoom;)if(!(t=t.parentNode))return he;return t.__zoom}function ye(t){t.stopImmediatePropagation()}function Mt(t){t.preventDefault(),t.stopImmediatePropagation()}function js(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ks(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function mn(){return this.__zoom||he}function Zs(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Qs(){return navigator.maxTouchPoints||"ontouchstart"in this}function Js(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function tc(){var t=js,e=Ks,n=Js,r=Zs,i=Qs,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Ro,l=Gt("start","zoom","end"),u,g,h,f=500,x=150,v=0,d=10;function p(y){y.property("__zoom",mn).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",$).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",R).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(y,k,N,L){var z=y.selection?y.selection():y;z.property("__zoom",mn),y!==z?S(y,k,N,L):z.interrupt().each(function(){M(this,arguments).event(L).start().zoom(null,typeof k=="function"?k.apply(this,arguments):k).end()})},p.scaleBy=function(y,k,N,L){p.scaleTo(y,function(){var z=this.__zoom.k,A=typeof k=="function"?k.apply(this,arguments):k;return z*A},N,L)},p.scaleTo=function(y,k,N,L){p.transform(y,function(){var z=e.apply(this,arguments),A=this.__zoom,E=N==null?m(z):typeof N=="function"?N.apply(this,arguments):N,I=A.invert(E),F=typeof k=="function"?k.apply(this,arguments):k;return n(b(w(A,F),E,I),z,a)},N,L)},p.translateBy=function(y,k,N,L){p.transform(y,function(){return n(this.__zoom.translate(typeof k=="function"?k.apply(this,arguments):k,typeof N=="function"?N.apply(this,arguments):N),e.apply(this,arguments),a)},null,L)},p.translateTo=function(y,k,N,L,z){p.transform(y,function(){var A=e.apply(this,arguments),E=this.__zoom,I=L==null?m(A):typeof L=="function"?L.apply(this,arguments):L;return n(he.translate(I[0],I[1]).scale(E.k).translate(typeof k=="function"?-k.apply(this,arguments):-k,typeof N=="function"?-N.apply(this,arguments):-N),A,a)},L,z)};function w(y,k){return k=Math.max(o[0],Math.min(o[1],k)),k===y.k?y:new lt(k,y.x,y.y)}function b(y,k,N){var L=k[0]-N[0]*y.k,z=k[1]-N[1]*y.k;return L===y.x&&z===y.y?y:new lt(y.k,L,z)}function m(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function S(y,k,N,L){y.on("start.zoom",function(){M(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(L).end()}).tween("zoom",function(){var z=this,A=arguments,E=M(z,A).event(L),I=e.apply(z,A),F=N==null?m(I):typeof N=="function"?N.apply(z,A):N,K=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),H=z.__zoom,U=typeof k=="function"?k.apply(z,A):k,Q=c(H.invert(F).concat(K/H.k),U.invert(F).concat(K/U.k));return function(W){if(W===1)W=U;else{var X=Q(W),kt=K/X[2];W=new lt(kt,F[0]-X[0]*kt,F[1]-X[1]*kt)}E.zoom(null,W)}})}function M(y,k,N){return!N&&y.__zooming||new T(y,k)}function T(y,k){this.that=y,this.args=k,this.active=0,this.sourceEvent=null,this.extent=e.apply(y,k),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,k){return this.mouse&&y!=="mouse"&&(this.mouse[1]=k.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=k.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=k.invert(this.touch1[0])),this.that.__zoom=k,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var k=et(this.that).datum();l.call(y,this.that,new Ws(y,{sourceEvent:this.sourceEvent,target:p,type:y,transform:this.that.__zoom,dispatch:l}),k)}};function P(y,...k){if(!t.apply(this,arguments))return;var N=M(this,k).event(y),L=this.__zoom,z=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),A=ct(y);if(N.wheel)(N.mouse[0][0]!==A[0]||N.mouse[0][1]!==A[1])&&(N.mouse[1]=L.invert(N.mouse[0]=A)),clearTimeout(N.wheel);else{if(L.k===z)return;N.mouse=[A,L.invert(A)],Kt(this),N.start()}Mt(y),N.wheel=setTimeout(E,x),N.zoom("mouse",n(b(w(L,z),N.mouse[0],N.mouse[1]),N.extent,a));function E(){N.wheel=null,N.end()}}function $(y,...k){if(h||!t.apply(this,arguments))return;var N=y.currentTarget,L=M(this,k,!0).event(y),z=et(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",K,!0),A=ct(y,N),E=y.clientX,I=y.clientY;On(y.view),ye(y),L.mouse=[A,this.__zoom.invert(A)],Kt(this),L.start();function F(H){if(Mt(H),!L.moved){var U=H.clientX-E,Q=H.clientY-I;L.moved=U*U+Q*Q>v}L.event(H).zoom("mouse",n(b(L.that.__zoom,L.mouse[0]=ct(H,N),L.mouse[1]),L.extent,a))}function K(H){z.on("mousemove.zoom mouseup.zoom",null),Bn(H.view,L.moved),Mt(H),L.event(H).end()}}function D(y,...k){if(t.apply(this,arguments)){var N=this.__zoom,L=ct(y.changedTouches?y.changedTouches[0]:y,this),z=N.invert(L),A=N.k*(y.shiftKey?.5:2),E=n(b(w(N,A),L,z),e.apply(this,k),a);Mt(y),s>0?et(this).transition().duration(s).call(S,E,L,y):et(this).call(p.transform,E,L,y)}}function R(y,...k){if(t.apply(this,arguments)){var N=y.touches,L=N.length,z=M(this,k,y.changedTouches.length===L).event(y),A,E,I,F;for(ye(y),E=0;E.5?"Mr. ":"Ms. ":"")+this.createWord(3+Math.floor(Math.random()*5),!0,!0)+" "+this.createWord(2+Math.floor(Math.random()*9),!0,!0)}createEmail(e){const n=typeof e>"u"?"domain.com":e;return this.createWord(3+Math.floor(Math.random()*5),!1,!0)+"."+this.createWord(2+Math.floor(Math.random()*9),!1,!0)+"@"+n}_jsUcfirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}}var ic=ar.default=rc;const sr=new ic;function ve(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function Tt(t,e){return Math.floor(Math.random()*(e-t+1)+t)}const oc=(t,e=1)=>zn(e).map(()=>ac(t)).reduce((n,r)=>{const i=n.nodes[Tt(n.nodes.length/2,n.nodes.length-1)],o=r.nodes[Tt(r.nodes.length/2,r.nodes.length-1)];return n.nodes.push(...r.nodes),n.links.push(...r.links),n.parents.push(...r.parents),i&&Math.random()>.5&&n.links.push({source:i.id,target:o.id,id:`${i.id}-${o.id}`}),n},{nodes:[],links:[],parents:[]}),ac=t=>{let e={id:ve(),name:yn()};const n=[e],r=zn(t).map(a=>(Math.random()>.75&&(e={id:ve(),name:yn()},n.push(e)),{isServer:a===0,name:sc(e.name),id:ve(),parent:e.id})),o=[...Ce([...r])].map(([a,s])=>({source:a.id,target:s.id,id:`${a.id}-${s.id}`}));return{nodes:r,links:o,parents:n}};function Ce(t,e=[]){let n=-1,r;for(;++n.25)){const i=Tt(1,5),o=Tt(1,5);e.push(...Ce([t[r],...t.splice(r+1,i)])),e[o]&&e.push(...Ce([t[r],...t.splice(r+1,o),...Math.random()>.75?[t[Tt(r,t.length-1)]]:[]]))}return e}const cr=" Corp.";function yn(){return sr.createFullName(!1).split(" ")[0]+cr}function sc(t){const e=t.replace(cr,"")+"Corp.com";return sr.createEmail(e)}class At{constructor(e){_(this,"id");_(this,"parent");_(this,"name");_(this,"level");_(this,"type");_(this,"linkSignature",[]);_(this,"baseLinks",[]);_(this,"parentLink");_(this,"isServer",!1);_(this,"start");_(this,"end");_(this,"removeClassName");_(this,"className");_(this,"shape");_(this,"x");_(this,"y");_(this,"fx");_(this,"fy");_(this,"vx");_(this,"vy");_(this,"index");_(this,"r");this.id=e.id,this.parent=e.parent,this.name=e.name,this.level=e.level,this.type=e.type,this.parentLink=e.parentLink,this.className=e.className,this.shape=e.shape,e.isServer&&(this.isServer=e.isServer),e.start&&(this.start=new Date(e.start)),e.end&&(this.end=new Date(e.end))}}class lr{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"parent");_(this,"type");_(this,"parentNode");_(this,"baseLinks",[]);this.source=e.source,this.target=e.target,this.id=e.id,this.parent=e.parent,this.type=e.type,this.parentNode=e.parentNode}}class cc{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"graphLinks",[]);this.source=e.source,this.target=e.target,this.id=e.id}}class lc{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"graphLinks",[]);_(this,"currentTimeState");_(this,"data");this.source=e.source,this.target=e.target,this.id=e.id,this.graphLinks=e.graphLinks,this.data=e.data}}function G(t){return t||0}const _t=(t,e,n)=>(t.has(e)||t.set(e,n),t.get(e)),J=()=>{};function uc(t){const e=window;e.Cypress&&(e.graph=t)}function vn(t){return[...new Set(t)].sort()}function hc(t,e=!0){const n=Object.assign(t);e&&(n.nodes=n.nodes.filter(d=>d.id==null||d.parent==null?(console.warn("A graphData node did not contain all required properties and is being removed",{errorNode:d}),!1):!0),n.links=n.links.filter(d=>d.source==null||d.source==null?(console.warn("A graphData link did not contain all required properties and is being removed",{errorLink:d}),!1):!0)),n.parents||(n.parents=[]);const r=new Map(n.parents.map(d=>[d.id,d])),i=new Map;n.nodes.forEach(d=>{const{className:p,name:w}=r.get(d.parent)||{};_t(i,d.parent,new At({...d,className:p,name:w,id:d.parent,parent:tt.rootNodeName,level:"super",type:"keyNode"}))});const o=new Map(n.nodes.map(d=>[d.id,new At({...d,level:"sub",type:"keyNode"})])),a=new Map;n.links.forEach(d=>{const{source:p,target:w}=d,b=[p,w].sort().join(tt.idDelimiter);_t(a,b,new cc({source:p,target:w,id:b}))}),a.forEach(d=>{const p=o.get(d.source),w=o.get(d.target);p.parent===w.parent?(p.linkSignature.push(w.id),w.linkSignature.push(p.id)):(p.linkSignature.push(w.parent),w.linkSignature.push(p.parent)),p.baseLinks.push(d.id),w.baseLinks.push(d.id)});const s=new Map;o.forEach(d=>{d.linkSignature=[d.parent,...vn(d.linkSignature),tt.groupNodeSuffix];const p=d.linkSignature.join(tt.idDelimiter);_t(s,p,new At({id:p,parent:d.parent,level:"group",type:"keyNode"})),d.parent=p});const c=[{id:tt.rootNodeName},...i.values(),...s.values(),...o.values()],l=Me().id(d=>d.id).parentId(d=>d.parent)(c),u=new Map(l.descendants().map(d=>[d.id,d])),g=new Map,h=new Map;a.forEach(d=>{var b,m,S,M,T,P,$,D,R,B,O,y,k,N,L,z,A,E,I,F,K,H,U,Q,W;const p=u.get(d.source),w=u.get(d.target);if(((b=p==null?void 0:p.parent)==null?void 0:b.id)===((m=w==null?void 0:w.parent)==null?void 0:m.id))console.warn((S=p==null?void 0:p.parent)==null?void 0:S.id);else if((M=p.parent)!=null&&M.parent&&((T=w.parent)!=null&&T.parent)&&(($=(P=p.parent)==null?void 0:P.parent)==null?void 0:$.id)===((R=(D=w.parent)==null?void 0:D.parent)==null?void 0:R.id)){const X=wn(p.parent,w.parent,h,d);vt(p,h,g,d,X),vt(w,h,g,d,X)}else if((O=(B=p.parent)==null?void 0:B.parent)!=null&&O.parent&&((k=(y=w.parent)==null?void 0:y.parent)!=null&&k.parent)&&((z=(L=(N=p.parent)==null?void 0:N.parent)==null?void 0:L.parent)==null?void 0:z.id)===((I=(E=(A=w.parent)==null?void 0:A.parent)==null?void 0:E.parent)==null?void 0:I.id)){const X=wn(p.parent.parent,w.parent.parent,h,d),kt=vt(p.parent,h,g,d,X),xr=vt(w.parent,h,g,d,X);vt(p,h,g,d,kt),vt(w,h,g,d,xr)}else console.warn((H=(K=(F=p.parent)==null?void 0:F.parent)==null?void 0:K.parent)==null?void 0:H.id,(W=(Q=(U=w.parent)==null?void 0:U.parent)==null?void 0:Q.parent)==null?void 0:W.id)}),a.forEach(d=>{d.graphLinks=vn(d.graphLinks)});const f=[{id:tt.rootLinkName},...h.values()];return{nodes:[{id:tt.rootNodeName},...i.values(),...s.values(),...o.values(),...g.values()],links:f,baseLinks:[...a.values()]}}function wn(t,e,n,r){var c;const i=t.id,o=e.id,a=t.parent.id,s=fc(i,o);return(c=_t(n,s,new lr({source:i,target:o,id:s,parent:tt.rootLinkName,type:"siblingLink",parentNode:a})))==null||c.baseLinks.push(r.id),r.graphLinks.push(s),s}function vt(t,e,n,r,i){var s,c;const o=[t.parent.id,i,tt.parentLinkNodeSuffix].join(tt.idDelimiter);(s=_t(n,o,new At({id:o,type:"parentLinkNode",parent:t.parent.id,level:t.parent.data.level,parentLink:i})))==null||s.baseLinks.push(r.id);const a=[t.id,o].join(tt.idDelimiter);return(c=_t(e,a,new lr({source:t.id,target:o,id:a,parent:i,type:"parentLink",parentNode:t.parent.id})))==null||c.baseLinks.push(r.id),r.graphLinks.push(a),a}function fc(t,e){return[t,e].sort().join(tt.idDelimiter)}const dc={idDelimiter:"/",parentLinkNodeSuffix:"linkNode",groupNodeSuffix:"groupNode",rootNodeName:"rootNode",rootLinkName:"rootLink"},tt=dc;class pc{constructor({graphData:e,onSelectionChange:n=J,onPreviewChange:r=J,onTimeChange:i=J,onDataChange:o=J,previouslyParsedGraphData:a}){_(this,"rootNode");_(this,"rootLink");_(this,"baseLinks",new Map);_(this,"allNodes",new Map);_(this,"allLinks",new Map);_(this,"onDataChange");_(this,"currentTime",0);_(this,"pastSet",new Set);_(this,"presentSet",new Set);_(this,"onTimeChange");_(this,"selectionSet",new Set);_(this,"previewSet",new Set);_(this,"onSelectionChange");_(this,"onPreviewChange");this.onSelectionChange=n,this.onPreviewChange=r,this.onTimeChange=i,this.onDataChange=o,this.updateGraphData(e,{previouslyParsedGraphData:a,mergeWithCurrentGraphData:a!=null,fireEvent:!1})}get parsedGraphData(){return{nodes:Array.from(this.allNodes.values()).map(e=>({...e.data,x:e.x,y:e.y})),links:Array.from(this.allLinks.values()).map(e=>e.data),baseLinks:Array.from(this.baseLinks.values()).map(e=>e.data)}}updateGraphData(e,n){const{mergeWithCurrentGraphData:r=!0,previouslyParsedGraphData:i,fireEvent:o=!0}=n||{},a=hc(e);if(r){const s=i!=null?new Map(i.nodes.map(c=>[c.id,c])):this.allNodes.size>0?this.allNodes:null;s!=null&&a.nodes.forEach(c=>{const l=s.get(c.id);l&&(c.x=l.x,c.y=l.y)})}this.stratifyGraph(a),o&&this.onDataChange()}stratifyGraph(e){const n=Object.assign(e);this.rootLink=Me().id(r=>r.id).parentId(r=>r.parent)(n.links),this.rootNode=Me().id(r=>r.id).parentId(r=>r.parent)(n.nodes),this.allLinks=new Map(this.rootLink.descendants().map(r=>[r.id,r])),this.allNodes=new Map(this.rootNode.descendants().map(r=>[r.id,r])),this.baseLinks=new Map(n.baseLinks.map(r=>[r.id,new lc({source:this.allNodes.get(r.source),target:this.allNodes.get(r.target),id:r.id,graphLinks:r.graphLinks.map(i=>this.allLinks.get(i)),data:r})])),this.allNodes.forEach(r=>{r.graphLinks=[],r.parent!=null&&(r.baseLinks=r.data.baseLinks.map(i=>this.baseLinks.get(i)),r.type=r.data.type,r.data.parentLink&&(r.parentLink=this.allLinks.get(r.data.parentLink)),r.x=r.data.x,r.y=r.data.y,r.fx=r.data.fx,r.fy=r.data.fy)}),this.allLinks.forEach(r=>{if(r.parent==null)return;r.source=this.allNodes.get(r.data.source),r.target=this.allNodes.get(r.data.target),r.baseLinks=r.data.baseLinks.map(o=>this.baseLinks.get(o)),r.type=r.data.type,this.allNodes.get(r.data.parentNode).graphLinks.push(r)})}get timeState(){return{currentTime:this.currentTime,pastNodeIds:xn(this.pastSet),presentNodeIds:xn(this.presentSet)}}setTimeState(e,n=!0){this.clearTime(!1);const{currentTime:r,pastNodeIds:i,presentNodeIds:o}=e;this.currentTime=r,this.pastSet=_n(i,this.allNodes),this.presentSet=_n(o,this.allNodes),this.allNodes.forEach(u=>u.data.isServer?void 0:u.currentTimeState="future"),[[this.pastSet,"past"],[this.presentSet,"present"]].forEach(([u,g])=>{u.forEach(h=>{let f=h;for(;f;)f.currentTimeState=g,f=f.parent})}),this.allLinks.forEach(u=>u.currentTimeState="future"),this.baseLinks.forEach(u=>u.currentTimeState=void 0);const s=new Set,c=new Set;this.baseLinks.forEach(u=>{u.currentTimeState=gc(u.source,u.target),u.currentTimeState==="past"&&s.add(u),u.currentTimeState==="present"&&c.add(u)}),[[s,"past"],[c,"present"]].forEach(([u,g])=>{u.forEach(h=>{h.graphLinks.forEach(f=>{f.currentTimeState=g})})}),n&&this.onTimeChange()}clearTime(e=!0){this.currentTime=0,this.pastSet.clear(),this.presentSet.clear(),this.allNodes.forEach(n=>n.currentTimeState=void 0),this.allLinks.forEach(n=>n.currentTimeState=void 0),this.baseLinks.forEach(n=>n.currentTimeState=void 0),e&&this.onTimeChange()}clearSet(e){const n=e==="preview"?this.previewSet:this.selectionSet,r=e==="preview"?"previewed":"selected",i=e==="preview"?"previewedFocus":"selectedFocus",o=e==="preview"?"previewedParent":"selectedParent";n.forEach(a=>{a[r]=void 0,a[i]=void 0,a[o]=void 0}),n.clear()}addToSet(e,n){const r=n==="preview"?this.previewSet:this.selectionSet,i=n==="preview"?"previewed":"selected",o=n==="preview"?"previewedFocus":"selectedFocus",a=n==="preview"?"previewedParent":"selectedParent";function s(g){let h=g.parent;for(;h;)h[a]=!0,r.add(h),h=h.parent}function c(g){if(!(g==null||g.parent==null))if(g.data.isServer){const h=g.ancestors().find(x=>x.type==="keyNode"&&x.depth===1)||g,f=h.leaves().find(x=>x.type==="keyNode")||g;[h,f].forEach(x=>{x[i]=!0,r.add(x)})}else g[i]=!0,r.add(g),s(g)}function l(g){g[i]=!0,r.add(g)}if(e.data.isServer){const g=e.ancestors().find(f=>f.type==="keyNode"&&f.depth===1)||e,h=g.leaves().find(f=>f.type==="keyNode")||e;g[o]=!0,c(g),e=h}e[o]=!0,c(e),e.baseLinks.length>0?e.baseLinks.forEach(g=>{g.graphLinks.forEach(h=>{l(h)}),c(g.source),c(g.target)}):e.graphLinks.filter(h=>h.type="parentLink").forEach(h=>{const f=h.parent;f&&f.parent!=null&&(l(f),c(f.target),c(f.source))})}selectNodes(e,n=!0){this.clearSelection(!1);for(let r=0;rArray.from(t).map(e=>e.id||""),_n=(t,e)=>new Set(t.map(n=>e.get(n)).filter(n=>n)),gc=(t,e)=>{const n=t.currentTimeState,r=e.currentTimeState;if(n===r)return n;if(n==="future"||r==="future")return"future";if(n==="past"||r==="past")return"past";if(n==="present"||r==="present")return"present"},ur=([t,e],n)=>{let r=t,i=e;if(!n)return{x:r,y:i,wasClamped:!1};if(n<0)return{x:0,y:0,wasClamped:!0};const o=Math.hypot(r,i);if(o>n){const s=Math.atan2(r,i);r=Math.sin(s)*n,i=Math.cos(s)*n}const a=o>n;return{x:r,y:i,wasClamped:a,xyRadius:o,radius:n}};function hr(t=30){let e,n;const r=typeof t!="function"?mc(+t):t;function i(a){for(let s=0,c=e.length;sr.type==="parentLinkNode"))||[]).forEach(r=>{const{source:i,target:o}=r.parentLink;let a=G(i.x)-G(o.x),s=G(i.y)-G(o.y);t.id===i.id&&(a*=-1,s*=-1);const[l,u]=dr(a,s,t.r||1);r.fx=l,r.fy=u})}function dr(t,e,n){const r=Math.atan2(t,e),i=Math.sin(r)*n,o=Math.cos(r)*n;return[i,o]}function yc(t,e,n,r,i=1,o="by"){const a=n-t,s=r-e,c=o==="to"?i:Math.hypot(a,s)-i,[l,u]=dr(a,s,c);return{source:{x:t,y:e},target:{x:t+l,y:e+u}}}const pr=t=>Math.PI*t*t,gr=t=>Math.sqrt(t/Math.PI),Nt=({d:t,zk:e=1,rk:n=1,zx:r=0,zy:i=0,tx:o=0,ty:a=0})=>`translate(${G(t.x)*n*e+r+o}, ${G(t.y)*n*e+i+a})`,Ft=t=>t.previewedFocus||t.selectedFocus||t.selectedParent||t.previewedParent||!1,mr=t=>t.selected||t.previewed||Ft(t),vc=t=>t.selected||t.selectedFocus||t.selectedParent||!1,wc=t=>t.previewed||t.previewedFocus||t.previewedParent||!1,Nn=t=>wc(t)?3:vc(t)?2:t.data instanceof At?1:0,Ye=(t,e)=>Nn(t)-Nn(e),it=(t,e,n)=>{var i,o;const r=n[e];t.data.removeClassName&&((i=r==null?void 0:r.classList)==null||i.remove(t.data.removeClassName)),t.data.className&&((o=r==null?void 0:r.classList)==null||o.add(t.data.className))},mt=t=>t.type!=="parentLinkNode"?t.data.id:null,xc="-label",yr=t=>mt(t)+xc;function Sn(t,e=0){return e=Math.pow(10,e),Math.round(t*e)/e}const _c="http://www.w3.org/2000/svg",Nc=t=>document.createElementNS(_c,t),C={graphRoot:"graphRoot",isZooming:"isZooming",transformWrapper:"transformWrapper",superGraph:"superGraph",groupGraph:"groupGraph",subGraph:"subGraph",superNode:"superNode",groupNode:"groupNode",subNode:"subNode",serverNode:"serverNode",computerNode:"computerNode",softwareNode:"softwareNode",superNodeCountLabel:"superNodeCountLabel",superNodeNameLabel:"superNodeNameLabel",subNodeNameLabel:"subNodeNameLabel",occludedLabel:"occludedLabel",hiddenLabel:"hiddenLabel",keyNode:"keyNode",siblingLink:"siblingLink",parentLinkNode:"parentLinkNode",parentLink:"parentLink",previewed:"previewed",previewedFocus:"previewedFocus",previewedParent:"previewedParent",selected:"selected",selectedFocus:"selectedFocus",selectedParent:"selectedParent",future:"future",present:"present",past:"past"};class Ve{constructor({rootNode:e,rootSelection:n,parentGraph:r,graphHandler:i}){_(this,"rootNode");_(this,"parentNode");_(this,"links");_(this,"nodes");_(this,"keyNodes");_(this,"parentLinkNodes");_(this,"simulation");_(this,"simulationForces",[]);_(this,"rootSelection");_(this,"rootGroupSelection");_(this,"childGraphRootSelection");_(this,"linkSelection");_(this,"nodeSelection");_(this,"labelSelection");_(this,"parentGraph");_(this,"childGraphs",[]);_(this,"graphHandler");_(this,"isHidden",!1);this.rootNode=e,this.parentNode=this.rootNode.parent||void 0,this.links=this.rootNode.graphLinks||[],this.nodes=this.rootNode.children||[],this.keyNodes=this.nodes.filter(o=>o.type==="keyNode")||[],this.parentLinkNodes=this.nodes.filter(o=>o.type==="parentLinkNode")||[],this.parentGraph=r,this.graphHandler=i,this.rootSelection=n}initialize(e=!1){this.initializeForces(),this.initializeSelection(),e&&this.hideLayout(),this.initializeSimulationLayout()}initializeForces(){this.simulation=Ss(this.nodes).on("tick",this.drawLayout.bind(this))}initializeSelection(){}initializeSimulationLayout(){this.useGraphForces(),this.simulation.alphaDecay(.001).alphaTarget(.7).tick(300).alphaTarget(0).alphaDecay(.1).restart().tick(500).stop(),this.drawLayout()}initializeChildGraphs(e){this.childGraphRootSelection&&e!=null&&(this.childGraphs=[],this.childGraphRootSelection.filter(n=>n.type==="keyNode").each((n,r,i)=>{var o;(o=this.childGraphs)==null||o.push(new e({rootNode:n,rootSelection:et(i[r]),parentGraph:this,graphHandler:this.graphHandler}))}))}callChildrenRecursively(e){var n;this[e](),(n=this.childGraphs)==null||n.forEach(r=>r.callChildrenRecursively(e))}useGraphForces(){for(let e=0;er.reheat(e))}cool(){var e;this.simulation.alphaTarget(0),(e=this.childGraphs)==null||e.forEach(n=>n.cool())}freeze(){var e;this.simulation.stop(),(e=this.childGraphs)==null||e.forEach(n=>n.freeze())}drawLayout(){}drawInteraction(){[this.rootSelection,this.rootGroupSelection,this.linkSelection,this.nodeSelection,this.labelSelection].forEach(e=>{e==null||e.classed(C.selected,n=>!!n.selected).classed(C.selectedFocus,n=>!!n.selectedFocus).classed(C.selectedParent,n=>!!n.selectedParent).classed(C.previewed,n=>!!n.previewed).classed(C.previewedFocus,n=>!!n.previewedFocus).classed(C.previewedParent,n=>!!n.previewedParent)})}drawTime(e=[]){const n=[C.present,C.past,C.future].join(" ");[this.nodeSelection,this.linkSelection,this.labelSelection,...e].forEach(r=>{r==null||r.classed(n,!1).filter(i=>!i.data.isServer).classed(C.past,i=>i.currentTimeState==="past").classed(C.present,i=>i.currentTimeState==="present").classed(C.future,i=>i.currentTimeState==="future")})}drawUpdateLabel(){}drawUpdateNodeVisual(){}hideLayout(){this.isHidden||this.rootGroupSelection.remove(),this.isHidden=!0}showLayout(){var e;this.isHidden&&((e=this.rootSelection.node())==null||e.appendChild(this.rootGroupSelection.node())),this.isHidden=!1}}function Sc(t,e=1,n=0,r=0){t=t<3?3:t,n=n*Math.PI/180;const i=2*Math.PI/t,o=[];for(let a=0;ai.join(",")).join(" ")}const bc={triangleUp:[3,180],triangleDown:[3,0],diamond:[4,90],square:[4,45],pentagonUp:[5,180],pentagonDown:[5,0],hexagonUp:[6,0],hexagonDown:[6,90]},bn={};function kc(t,e=1,n){const r=[t,e,n].join("-");let i=bn[r];if(i==null){const[o,a]=bc[t],s=Math.PI*e*e,c=1+o*.03,l=Lc(o,s)*c;i=vr(o,l,a,n),bn[r]=i}return i}function Lc(t,e=Math.PI){return Math.sqrt(e*2/(Math.sin(2*Math.PI/t)*t))}const oe=class oe extends Ve{constructor(e){super(e),super.initialize(!0)}initializeForces(){this.nodes.forEach(o=>o.r=o.type==="parentLinkNode"?1:oe.radius(o));const e=Be().strength(o=>o.type==="keyNode"?-4:0),n=Oe(this.links).strength(0).distance(this.rootNode.r*.3),r=hr(o=>o.type==="keyNode"?this.rootNode.r-2:0),i=!0;this.simulationForces=[{name:"positionParentLinkNodes",force:()=>fr(this.rootNode)},{name:"link",force:n,optional:i},{name:"charge",force:e,optional:i},{name:"x",force:Xe(0),optional:i},{name:"y",force:qe(0),optional:i},{name:"clamp",force:r}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").attr(C.subGraph,!0).attr("transform-origin","center").attr("cy-test","subGSelection").attr("id",mt),this.linkSelection=this.rootGroupSelection.selectAll("line").data(this.links).join("line").classed(C.siblingLink,e=>e.type==="siblingLink").classed(C.parentLink,e=>e.type==="parentLink").attr("cy-test","subLinkSelection").attr("id",mt),this.nodeSelection=this.rootGroupSelection.selectAll(".testing").data(this.nodes).join("g").classed("testing",!0).attr("cy-test","beaconsGraph").attr("id",mt).each(it).classed(C.parentLinkNode,e=>e.type==="parentLinkNode").classed(C.keyNode,e=>e.type==="keyNode").classed(C.subNode,!0).classed(C.softwareNode,!0).on("click",this.graphHandler.clickNode.bind(this.graphHandler)).on("mouseover",this.graphHandler.mouseOverNode.bind(this.graphHandler)),this.drawUpdateNodeVisual(),this.labelSelection=this.rootGroupSelection.append("g").attr("cy-test","selectedLabel").selectAll("text").data(this.nodes.filter(e=>e.type==="keyNode")).join("text").attr("id",yr).each(it).classed(C.subNodeNameLabel,!0).text(kn),super.initializeSelection()}drawUpdateNodeVisual(){var e;(e=this.labelSelection)==null||e.each(it),this.nodeSelection.each(it),this.nodeSelection.selectChildren().remove(),this.nodeSelection.append(n=>Nc(n.data.shape==="circle"||n.data.shape==null?"circle":"polygon")).attr("r",n=>n.r||0).attr("points",n=>n.data.shape&&n.data.shape!=="circle"?kc(n.data.shape,G(n.r)+1):null)}drawLayout(){var n;if(!this.parentNode)return;const{rk:e=1}=this.graphHandler.zoomTransform;this.linkSelection.attr("x1",r=>G(r.source.x)*e).attr("y1",r=>G(r.source.y)*e).attr("x2",r=>G(r.target.x)*e).attr("y2",r=>G(r.target.y)*e),this.nodeSelection.attr("transform",r=>Nt({d:r,rk:e})),(n=this.labelSelection)==null||n.attr("transform",r=>Nt({d:r,rk:e,tx:10,ty:4}))}drawInteraction(){var e;(e=this.labelSelection)==null||e.classed(C.hiddenLabel,n=>!mr(n)),Ft(this.parentNode)?(this.showLayout(),super.drawInteraction(),this.rootGroupSelection.selectChildren().sort(Ye)):this.hideLayout()}drawUpdateLabel(){var e;(e=this.labelSelection)==null||e.text(kn)}};_(oe,"radius",e=>4);let re=oe;const kn=t=>`– ${t.data.name||t.data.id}`,ae=class ae extends Ve{constructor(e){super(e),this.initialize(!0),this.initializeChildGraphs(re)}initializeForces(){this.nodes.forEach(s=>s.r=s.type==="keyNode"?ae.radius(s):1.5);const e=Be().strength(s=>s.type==="keyNode"?(s.graphLinks.length||1)*-2-1:0),n=Oe(this.links).strength(s=>s.source.graphLinks.length/100).distance(this.keyNodes.length<2?()=>this.rootNode.r:s=>this.rootNode.r/this.links.length+(s.source.r||1)),r=hr(s=>s.type==="keyNode"?s.parent.r-s.r-2:0),i=nr().strength(.5).radius(s=>s.type==="keyNode"?s.r+2:0),o=()=>fr(this.rootNode),a=!0;this.simulationForces=[{name:"positionParentLinkNodes",force:o},{name:"link",force:n,optional:a},{name:"charge",force:e,optional:a},{name:"x",force:Xe(0).strength(.05),optional:a},{name:"y",force:qe(0).strength(.05),optional:a},{name:"collide",force:i},{name:"clamp",force:r}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").classed(C.groupGraph,!0).attr("transform-origin","center"),this.linkSelection=this.rootGroupSelection.selectAll("line").data(this.links).join("line").classed(C.siblingLink,e=>e.type==="siblingLink").classed(C.parentLink,e=>e.type==="parentLink"),this.childGraphRootSelection=this.rootGroupSelection.selectAll("g").data(this.nodes).join("g").call(this.graphHandler.initializeDrag(this)),this.nodeSelection=this.childGraphRootSelection.append("g").append("circle").attr("r",e=>e.r||0).style("pointer-events","none").classed(C.parentLinkNode,e=>e.type==="parentLinkNode").classed(C.keyNode,e=>e.type==="keyNode").classed(C.groupNode,!0),super.initializeSelection()}drawLayout(){const{rk:e=1}=this.graphHandler.zoomTransform;this.linkSelection.each(n=>{var r,i,o,a,s;n.shortLink=yc(G((r=n.target)==null?void 0:r.x),G((i=n.target)==null?void 0:i.y),G((o=n.source)==null?void 0:o.x),G((a=n.source)==null?void 0:a.y),(s=n==null?void 0:n.source)==null?void 0:s.r)}).attr("x1",n=>n.shortLink.source.x*e).attr("y1",n=>n.shortLink.source.y*e).attr("x2",n=>n.shortLink.target.x*e).attr("y2",n=>n.shortLink.target.y*e),this.childGraphRootSelection.attr("transform",n=>Nt({d:n,rk:e})),this.nodeSelection.attr("r",n=>G(n.r)*(n.descendants?e:1))}drawInteraction(){Ft(this.rootNode)?(this.showLayout(),super.drawInteraction(),this.rootGroupSelection.selectChildren().sort(Ye)):this.hideLayout()}};_(ae,"radius",e=>{var i;const n=((i=e.children)==null?void 0:i.filter(o=>o.type==="keyNode"))||[];let r=0;for(let o=0;oa.r=a.data.isServer?10:ft.radius(a));const n=Be().strength(a=>-300*a.children.filter(s=>s.type==="parentLinkNode").length),r=Oe(this.links),i=nr().strength(.1).radius(a=>ft.radius(a)+4),o=!0;this.simulationForces=[{name:"link",force:r,optional:o},{name:"charge",force:n,optional:o},{name:"x",force:Xe(0),optional:o},{name:"y",force:qe(0),optional:o},{name:"collide",force:i}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").attr("id",mt).classed(C.superGraph,!0).attr("transform-origin","center"),this.graphSelection=this.rootGroupSelection.append("g"),this.linkSelection=this.graphSelection.selectAll("line").data(this.links).join("line").attr("id",mt).classed(C.parentLink,!0).classed(C.siblingLink,n=>n.type==="siblingLink"),this.positionSelection=this.graphSelection.selectAll("g").data(this.nodes).join("g").call(this.graphHandler.initializeDrag(this)),this.hostSelection=this.positionSelection.filter(n=>!n.data.isServer).append("g").append("circle").attr("r",n=>n.r||0).classed(C.computerNode,!0),this.serverSelection=this.positionSelection.filter(n=>n.data.isServer).append("g").append("polygon").attr("points",n=>vr(6,n.r||0)).classed(C.serverNode,!0),this.nodeSelection=this.positionSelection.selectChild().selectChild(),this.nodeSelection.attr("cy-test","graphNode").attr("id",mt).each(it).classed(C.parentLinkNode,n=>n.type==="parentLinkNode").classed(C.keyNode,n=>n.type==="keyNode").classed(C.superNode,!0).on("click",this.graphHandler.clickNode.bind(this.graphHandler)).on("mouseover",this.graphHandler.mouseOverNode.bind(this.graphHandler)),this.childGraphRootSelection=this.positionSelection.append("g").filter(n=>!n.data.isServer),this.labelSelection=this.rootGroupSelection.append("g").selectAll("text").data(this.nodes).join("text").attr("text-anchor","end").attr("cy-test","selectedLabel").attr("id",yr).each(it).classed(C.superNodeNameLabel,!0).classed(C.hiddenLabel,!0).text(Ln),this.countLabelSelection=this.rootGroupSelection.append("g").selectAll("text").data(this.nodes.filter(n=>n.leaves().filter(r=>r.type==="keyNode").length>1)).join("text").attr("text-anchor","middle").each(it).classed(C.superNodeCountLabel,!0).text(n=>n.leaves().filter(r=>r.type==="keyNode").length),super.initializeSelection()}drawUpdateNodeVisual(){var n;this.nodeSelection.each(it),(n=this.labelSelection)==null||n.each(it),this.countLabelSelection.each(it)}drawTime(){super.drawTime([this.countLabelSelection])}drawLayout(){var o;const{k:n,x:r,y:i}=this.graphHandler.zoomTransform;this.linkSelection.attr("x1",a=>G(a.source.x)*n+r).attr("y1",a=>G(a.source.y)*n+i).attr("x2",a=>G(a.target.x)*n+r).attr("y2",a=>G(a.target.y)*n+i),this.positionSelection.attr("transform",a=>Nt({d:a,zk:n,zx:r,zy:i})),(o=this.countLabelSelection)==null||o.attr("transform",a=>Nt({d:a,zk:n,zx:r,zy:i,ty:4})),this.drawDynamicLayout(),super.drawLayout()}drawDynamicLayout(){var a;const{k:n,x:r,y:i,rk:o}=this.graphHandler.zoomTransform;this.hostSelection.attr("r",s=>ft.shrinkRadius(s,o)),(a=this.labelSelection)==null||a.attr("transform",s=>{const c=(s.data.isServer?G(s.r):ft.shrinkRadius(s,o))*-1-4;return Nt({d:s,zk:n,zx:r,zy:i,ty:4,tx:c})})}drawInteraction(){var n,r;this.drawDynamicLayout(),(n=this.countLabelSelection)==null||n.classed(C.hiddenLabel,i=>Ft(i)),(r=this.labelSelection)==null||r.classed(C.hiddenLabel,i=>!mr(i)),super.drawInteraction(),this.graphSelection.selectChildren().sort(Ye)}drawUpdateLabel(){var n;(n=this.labelSelection)==null||n.text(Ln)}};_(ft,"radius",n=>{var o;const r=((o=n.children)==null?void 0:o.filter(a=>a.type==="keyNode"))||[];let i=0;for(let a=0;a{const i=G(n.r)*r;return Ft(n)?i:Math.max(i*.6,8)});let Te=ft;const Ln=t=>`${t.data.name||t.data.id} –`;function Mc({selection:t,prioritySort:e,className:n="occluded"}){const r=[];t.selectAll("text").classed(n,!1).each((o,a,s)=>{const c=s[a],l=c.getBoundingClientRect();r.push({node:c,d:o,domRect:l})});const i=[];return e&&r.sort(e),r.forEach(o=>{const a=i.some(s=>zc(o.domRect,s.domRect));et(o.node).classed(n,a),a||i.push(o)}),i}function zc(t,e){return!(t.x+t.width{var r,i,o,a;const n=["previewedFocus","previewed","previewedParent","selectedFocus","selected","selectedParent"];for(const s of n)if(t.d[s]!=e.d[s])return t.d[s]?-1:1;return t.d.depth!==e.d.depth?t.d.depth-e.d.depth:((r=t.d.children)==null?void 0:r.length)!==((i=e.d.children)==null?void 0:i.length)?(((o=t.d.children)==null?void 0:o.length)||0)-(((a=e.d.children)==null?void 0:a.length)||0):0};function Tc(t=40){const e=document.createElement("style");e.id="dotGridStyle",document.head.appendChild(e);function n(r){const i=Math.pow(2,Math.floor(Math.log2(r.k))),o=r.k/i*t,a=r.x%o,s=r.y%o,c=.3,l=(o-t)/t,u=c*l,g=`hsla(${Mn}, ${c}) 1px, transparent 0`,h=`hsla(${Mn}, ${u}) 1px, transparent 0`,f=Ac.map(w=>`radial-gradient(circle at ${w}, ${h})`).concat(`radial-gradient(${g})`).join(`, -`),x=`${o}px ${o}px`,v=`calc(50% + ${a}px)`,d=`calc(50% + ${s}px)`,p=[["--dot-color-hsl","0, 0%, 50%"],["background-size",x],["background-position-x",v],["background-position-y",d],["background-image",f]].map(([w,b])=>`${w}: ${b};`).join(` -`);e.innerHTML=`.${wr}{ -${p} -}`}return n}const wr="dotGrid",Mn="var(--dot-color-hsl)",Ac=["top left","top right","right","bottom right","bottom","bottom left","left"],se=class se{constructor({onSelectionChange:e=J,onPreviewChange:n=J,onTimeChange:r=J,onDataChange:i=J,graphData:o,element:a,previouslyParsedGraphData:s}){_(this,"graphData");_(this,"svg");_(this,"rootSelection");_(this,"dimensions",{width:0,height:0});_(this,"graphRoot");_(this,"onSelectionChange",J);_(this,"onPreviewChange",J);_(this,"onTimeChange",J);_(this,"onDataChange",J);_(this,"_onSelectionChange",(...e)=>{this.graphRoot.callChildrenRecursively("drawInteraction"),this.drawTextOcclusion(),this.onSelectionChange(...e)});_(this,"_onPreviewChange",(...e)=>{this.graphRoot.callChildrenRecursively("drawInteraction"),this.drawTextOcclusion(),this.onPreviewChange(...e)});_(this,"_onTimeChange",()=>{this.graphRoot.callChildrenRecursively("drawTime"),this.drawTextOcclusion(),this.onTimeChange()});_(this,"_onDataChange",()=>{this.updateGraphRoot(),this.onDataChange()});_(this,"zoom");_(this,"dragState",{});_(this,"forceMode","graph");this.onSelectionChange=e,this.onPreviewChange=n,this.onTimeChange=r,this.onDataChange=i,this.graphData=new pc({graphData:o,onSelectionChange:this._onSelectionChange,onPreviewChange:this._onPreviewChange,onTimeChange:this._onTimeChange,onDataChange:this._onDataChange,previouslyParsedGraphData:s}),this.svg=et(a).html("").classed([C.graphRoot,wr].join(" "),!0),this.resize(),this.svg.append("rect").on("mouseover",this.mouseOutNode.bind(this)).attr("width","100%").attr("height","100%").attr("x","-50%").attr("y","-50%").attr("fill","transparent"),this.rootSelection=this.svg.append("g"),this.initializeZoom(),this.updateGraphRoot(),uc(this),this.zoomToFit({duration:0})}updateGraphRoot(){this.graphRoot!=null&&this.rootSelection.selectChildren().remove(),this.graphRoot=new Te({rootNode:this.graphData.rootNode,rootSelection:this.rootSelection,graphHandler:this})}drawTextOcclusion(){Mc({selection:this.rootSelection,className:C.occludedLabel,prioritySort:Cc})}initializeZoom(){const e=Tc(),n=()=>{this.graphRoot.freeze(),this.graphRoot.callChildrenRecursively("drawLayout"),e(this.zoomTransform)},r=()=>{this.svg.classed(C.isZooming,!0)},i=()=>{this.svg.classed(C.isZooming,!1),this.drawTextOcclusion()};this.zoom=tc().extent([[0,0],[this.dimensions.width,this.dimensions.height]]).scaleExtent([1/2,10]).on("start",r).on("zoom",n).on("end",i),this.svg.call(this.zoom),e(this.zoomTransform)}get zoomTransform(){const e=or(this.svg.node());return e.rk=se.scaleRadius(e.k),e}zoomToFit({duration:e=750,boundingBox:n}={}){const{k:r,x:i,y:o}=this.zoomTransform,{height:a,width:s}=this.dimensions,c=n||this.rootSelection.node().getBBox(),{height:l,width:u}=c,g=c.x+u/2,h=c.y+l/2,f=Math.max(u/s,l/a),x=Math.min(r/f-.2,4),v=(i-g)/r,d=(o-h)/r;this.svg.transition().duration(e).call(this.zoom.transform,he.scale(x).translate(v,d))}zoomToSelection(){throw new Error("Not Implemented")}zoomIn(){this.svg.transition().call(this.zoom.scaleBy,1.3,[0,0])}zoomOut(){this.svg.transition().call(this.zoom.scaleBy,.7,[0,0])}initializeDrag(e){const n=o=>{o.active||(o.subject.fx=this.dragState.startX=o.subject.x,o.subject.fy=this.dragState.startY=o.subject.y)},r=o=>{this.dragState.isDragging||(this.dragState.isDragging=!0);const{k:a}=this.zoomTransform,{x:s,y:c}=o,{startX:l=0,startY:u=0}=this.dragState,g=s-l,h=c-u,f=g/a+l,x=h/a+u,{x:v,y:d}=ur([f,x],o.subject.parent.r-o.subject.r);o.subject.fx=v,o.subject.fy=d,e.reheat(Math.max(Math.abs(s),Math.abs(c))*1e-4)},i=o=>{o.active||(e.cool(),o.subject.fx=null,o.subject.fy=null,this.dragState={})};return uo().on("start",n).on("drag",r).on("end",i)}clickNode(e,n){n.selectedFocus?this.graphData.clearSelection():this.graphData.selectNodes([n])}mouseOverNode(e,n){this.dragState.isDragging||this.graphData.previewNode(n)}mouseOutNode(){this.dragState.isDragging||this.graphData.clearPreview()}resize(){const e=this.svg.node();this.dimensions={width:e.clientWidth,height:e.clientHeight};const{width:n,height:r}=this.dimensions;this.svg.attr("viewBox",[-n/2,-r/2,n,r].join(" "))}updateNodeName(e,n){const r=this.graphData.allNodes.get(e);r&&(r.data.name=n,this.graphRoot.callChildrenRecursively("drawUpdateLabel"))}updateNodeVisual({nodeId:e,className:n,shape:r}){const i=this.graphData.allNodes.get(e);i&&(n!=null&&(i.data.removeClassName=i.data.className,i.data.className=n),r&&(i.data.shape=r),this.graphRoot.callChildrenRecursively("drawUpdateNodeVisual"))}useForceMode(e){e==="simple"?(this.graphRoot.callChildrenRecursively("useSimpleForces"),this.forceMode="simple"):(this.graphRoot.callChildrenRecursively("useGraphForces"),this.forceMode="graph")}};_(se,"scaleRadius",e=>Math.min(e,(e-1)*.3+1));let Ae=se;const Ec=async()=>oc(50,5),Pc=async()=>{try{return await Ka("./private-test-data/parsedGraphData.json")}catch{return}},Dc=async t=>{const e=await Ec(),n=await Pc(),r=document.getElementById(t);window.graph=new Ae({graphData:e,element:r,previouslyParsedGraphData:n,onSelectionChange:i=>console.log(i)}),window.addEventListener("resize",()=>window.graph.resize()),console.log(window.graph)};Dc("app"); +var wr=Object.defineProperty;var xr=(t,e,n)=>e in t?wr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var _=(t,e,n)=>(xr(t,typeof e!="symbol"?e+"":e,n),n);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function Mn(t,e,n){t=+t,e=+e,n=(i=arguments.length)<2?(e=t,t=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(i);++r{}};function Gt(){for(var t=0,e=arguments.length,n={},r;t=0&&(r=n.slice(i+1),n=n.slice(0,i)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Ut.prototype=Gt.prototype={constructor:Ut,on:function(t,e){var n=this._,r=Nr(t+"",n),i,o=-1,a=r.length;if(arguments.length<2){for(;++o0)for(var n=new Array(i),r=0,i,o;r=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),We.hasOwnProperty(e)?{space:We[e],local:t}:t}function br(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===we&&e.documentElement.namespaceURI===we?e.createElement(t):e.createElementNS(n,t)}}function kr(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function Cn(t){var e=ce(t);return(e.local?kr:br)(e)}function Lr(){}function Ee(t){return t==null?Lr:function(){return this.querySelector(t)}}function Mr(t){typeof t!="function"&&(t=Ee(t));for(var e=this._groups,n=e.length,r=new Array(n),i=0;i=k&&(k=w+1);!(S=d[k])&&++k=0;)(a=r[i])&&(o&&a.compareDocumentPosition(o)^4&&o.parentNode.insertBefore(a,o),o=a);return this}function Qr(t){t||(t=Jr);function e(g,h){return g&&h?t(g.__data__,h.__data__):!g-!h}for(var n=this._groups,r=n.length,i=new Array(r),o=0;oe?1:t>=e?0:NaN}function ti(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function ei(){return Array.from(this)}function ni(){for(var t=this._groups,e=0,n=t.length;e1?this.each((e==null?di:typeof e=="function"?gi:pi)(t,e,n??"")):St(this.node(),t)}function St(t,e){return t.style.getPropertyValue(e)||Pn(t).getComputedStyle(t,null).getPropertyValue(e)}function yi(t){return function(){delete this[t]}}function vi(t,e){return function(){this[t]=e}}function wi(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function xi(t,e){return arguments.length>1?this.each((e==null?yi:typeof e=="function"?wi:vi)(t,e)):this.node()[t]}function Dn(t){return t.trim().split(/^|\s+/)}function Pe(t){return t.classList||new In(t)}function In(t){this._node=t,this._names=Dn(t.getAttribute("class")||"")}In.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function Rn(t,e){for(var n=Pe(t),r=-1,i=e.length;++r=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function Wi(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,i=e.length,o;n()=>t;function xe(t,{sourceEvent:e,subject:n,target:r,identifier:i,active:o,x:a,y:s,dx:c,dy:l,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:i,enumerable:!0,configurable:!0},active:{value:o,enumerable:!0,configurable:!0},x:{value:a,enumerable:!0,configurable:!0},y:{value:s,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:l,enumerable:!0,configurable:!0},_:{value:u}})}xe.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function io(t){return!t.ctrlKey&&!t.button}function oo(){return this.parentNode}function ao(t,e){return e??{x:t.x,y:t.y}}function so(){return navigator.maxTouchPoints||"ontouchstart"in this}function co(){var t=io,e=oo,n=ao,r=so,i={},o=Gt("start","drag","end"),a=0,s,c,l,u,g=0;function h(m){m.on("mousedown.drag",f).filter(r).on("touchstart.drag",d).on("touchmove.drag",p,ro).on("touchend.drag touchcancel.drag",w).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(m,S){if(!(u||!t.call(this,m,S))){var M=k(this,e.call(this,m,S),m,S,"mouse");M&&(et(m.view).on("mousemove.drag",x,Et).on("mouseup.drag",v,Et),Hn(m.view),fe(m),l=!1,s=m.clientX,c=m.clientY,M("start",m))}}function x(m){if(wt(m),!l){var S=m.clientX-s,M=m.clientY-c;l=S*S+M*M>g}i.mouse("drag",m)}function v(m){et(m.view).on("mousemove.drag mouseup.drag",null),On(m.view,l),wt(m),i.mouse("end",m)}function d(m,S){if(t.call(this,m,S)){var M=m.changedTouches,T=e.call(this,m,S),P=M.length,R,D;for(R=0;R>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Xt(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Xt(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=uo.exec(t))?new K(e[1],e[2],e[3],1):(e=ho.exec(t))?new K(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fo.exec(t))?Xt(e[1],e[2],e[3],e[4]):(e=po.exec(t))?Xt(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=go.exec(t))?en(e[1],e[2]/100,e[3]/100,1):(e=mo.exec(t))?en(e[1],e[2]/100,e[3]/100,e[4]):Ke.hasOwnProperty(t)?Qe(Ke[t]):t==="transparent"?new K(NaN,NaN,NaN,0):null}function Qe(t){return new K(t>>16&255,t>>8&255,t&255,1)}function Xt(t,e,n,r){return r<=0&&(t=e=n=NaN),new K(t,e,n,r)}function wo(t){return t instanceof Ot||(t=It(t)),t?(t=t.rgb(),new K(t.r,t.g,t.b,t.opacity)):new K}function _e(t,e,n,r){return arguments.length===1?wo(t):new K(t,e,n,r??1)}function K(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}De(K,_e,Bn(Ot,{brighter(t){return t=t==null?Qt:Math.pow(Qt,t),new K(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Pt:Math.pow(Pt,t),new K(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new K(gt(this.r),gt(this.g),gt(this.b),Jt(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Je,formatHex:Je,formatHex8:xo,formatRgb:tn,toString:tn}));function Je(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}`}function xo(){return`#${pt(this.r)}${pt(this.g)}${pt(this.b)}${pt((isNaN(this.opacity)?1:this.opacity)*255)}`}function tn(){const t=Jt(this.opacity);return`${t===1?"rgb(":"rgba("}${gt(this.r)}, ${gt(this.g)}, ${gt(this.b)}${t===1?")":`, ${t})`}`}function Jt(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function gt(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function pt(t){return t=gt(t),(t<16?"0":"")+t.toString(16)}function en(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new nt(t,e,n,r)}function Xn(t){if(t instanceof nt)return new nt(t.h,t.s,t.l,t.opacity);if(t instanceof Ot||(t=It(t)),!t)return new nt;if(t instanceof nt)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,i=Math.min(e,n,r),o=Math.max(e,n,r),a=NaN,s=o-i,c=(o+i)/2;return s?(e===o?a=(n-r)/s+(n0&&c<1?0:a,new nt(a,s,c,t.opacity)}function _o(t,e,n,r){return arguments.length===1?Xn(t):new nt(t,e,n,r??1)}function nt(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}De(nt,_o,Bn(Ot,{brighter(t){return t=t==null?Qt:Math.pow(Qt,t),new nt(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Pt:Math.pow(Pt,t),new nt(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,i=2*n-r;return new K(de(t>=240?t-240:t+120,i,r),de(t,i,r),de(t<120?t+240:t-120,i,r),this.opacity)},clamp(){return new nt(nn(this.h),qt(this.s),qt(this.l),Jt(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Jt(this.opacity);return`${t===1?"hsl(":"hsla("}${nn(this.h)}, ${qt(this.s)*100}%, ${qt(this.l)*100}%${t===1?")":`, ${t})`}`}}));function nn(t){return t=(t||0)%360,t<0?t+360:t}function qt(t){return Math.max(0,Math.min(1,t||0))}function de(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const qn=t=>()=>t;function No(t,e){return function(n){return t+n*e}}function So(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function bo(t){return(t=+t)==1?Vn:function(e,n){return n-e?So(e,n,t):qn(isNaN(e)?n:e)}}function Vn(t,e){var n=e-t;return n?No(t,n):qn(isNaN(t)?e:t)}const rn=function t(e){var n=bo(e);function r(i,o){var a=n((i=_e(i)).r,(o=_e(o)).r),s=n(i.g,o.g),c=n(i.b,o.b),l=Vn(i.opacity,o.opacity);return function(u){return i.r=a(u),i.g=s(u),i.b=c(u),i.opacity=l(u),i+""}}return r.gamma=t,r}(1);function ht(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}var Ne=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,pe=new RegExp(Ne.source,"g");function ko(t){return function(){return t}}function Lo(t){return function(e){return t(e)+""}}function Mo(t,e){var n=Ne.lastIndex=pe.lastIndex=0,r,i,o,a=-1,s=[],c=[];for(t=t+"",e=e+"";(r=Ne.exec(t))&&(i=pe.exec(e));)(o=i.index)>n&&(o=e.slice(n,o),s[a]?s[a]+=o:s[++a]=o),(r=r[0])===(i=i[0])?s[a]?s[a]+=i:s[++a]=i:(s[++a]=null,c.push({i:a,x:ht(r,i)})),n=pe.lastIndex;return n180?u+=360:u-l>180&&(l+=360),h.push({i:g.push(i(g)+"rotate(",null,r)-2,x:ht(l,u)})):u&&g.push(i(g)+"rotate("+u+r)}function s(l,u,g,h){l!==u?h.push({i:g.push(i(g)+"skewX(",null,r)-2,x:ht(l,u)}):u&&g.push(i(g)+"skewX("+u+r)}function c(l,u,g,h,f,x){if(l!==g||u!==h){var v=f.push(i(f)+"scale(",null,",",null,")");x.push({i:v-4,x:ht(l,g)},{i:v-2,x:ht(u,h)})}else(g!==1||h!==1)&&f.push(i(f)+"scale("+g+","+h+")")}return function(l,u){var g=[],h=[];return l=t(l),u=t(u),o(l.translateX,l.translateY,u.translateX,u.translateY,g,h),a(l.rotate,u.rotate,g,h),s(l.skewX,u.skewX,g,h),c(l.scaleX,l.scaleY,u.scaleX,u.scaleY,g,h),l=u=null,function(f){for(var x=-1,v=h.length,d;++x=0&&t._call.call(void 0,e),t=t._next;--bt}function sn(){yt=(ee=Rt.now())+le,bt=Ct=0;try{$o()}finally{bt=0,Go(),yt=0}}function Fo(){var t=Rt.now(),e=t-ee;e>Wn&&(le-=e,ee=t)}function Go(){for(var t,e=te,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:te=n);zt=t,be(r)}function be(t){if(!bt){Ct&&(Ct=clearTimeout(Ct));var e=t-yt;e>24?(t<1/0&&(Ct=setTimeout(sn,t-Rt.now()-le)),Lt&&(Lt=clearInterval(Lt))):(Lt||(ee=Rt.now(),Lt=setInterval(Fo,Wn)),bt=1,Kn(sn))}}function cn(t,e,n){var r=new ne;return e=e==null?0:+e,r.restart(i=>{r.stop(),t(i+e)},e,n),r}var Ho=Gt("start","end","cancel","interrupt"),Oo=[],jn=0,ln=1,ke=2,Wt=3,un=4,Le=5,Kt=6;function ue(t,e,n,r,i,o){var a=t.__transition;if(!a)t.__transition={};else if(n in a)return;Bo(t,n,{name:e,index:r,group:i,on:Ho,tween:Oo,time:o.time,delay:o.delay,duration:o.duration,ease:o.ease,timer:null,state:jn})}function $e(t,e){var n=rt(t,e);if(n.state>jn)throw new Error("too late; already scheduled");return n}function at(t,e){var n=rt(t,e);if(n.state>Wt)throw new Error("too late; already running");return n}function rt(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Bo(t,e,n){var r=t.__transition,i;r[e]=n,n.timer=Re(o,0,n.time);function o(l){n.state=ln,n.timer.restart(a,n.delay,n.time),n.delay<=l&&a(l-n.delay)}function a(l){var u,g,h,f;if(n.state!==ln)return c();for(u in r)if(f=r[u],f.name===n.name){if(f.state===Wt)return cn(a);f.state===un?(f.state=Kt,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+uke&&r.state=0&&(e=e.slice(0,n)),!e||e==="start"})}function va(t,e,n){var r,i,o=ya(e)?$e:at;return function(){var a=o(this,t),s=a.on;s!==r&&(i=(r=s).copy()).on(e,n),a.on=i}}function wa(t,e){var n=this._id;return arguments.length<2?rt(this.node(),n).on.on(t):this.each(va(n,t,e))}function xa(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function _a(){return this.on("end.remove",xa(this._id))}function Na(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Ee(t));for(var r=this._groups,i=r.length,o=new Array(i),a=0;a=(g=(s+l)/2))?s=g:l=g,(d=n>=(h=(c+u)/2))?c=h:u=h,i=o,!(o=o[p=d<<1|v]))return i[p]=a,t;if(f=+t._x.call(null,o.data),x=+t._y.call(null,o.data),e===f&&n===x)return a.next=o,i?i[p]=a:t._root=a,t;do i=i?i[p]=new Array(4):t._root=new Array(4),(v=e>=(g=(s+l)/2))?s=g:l=g,(d=n>=(h=(c+u)/2))?c=h:u=h;while((p=d<<1|v)===(w=(x>=h)<<1|f>=g));return i[w]=o,i[p]=a,t}function ja(t){var e,n,r=t.length,i,o,a=new Array(r),s=new Array(r),c=1/0,l=1/0,u=-1/0,g=-1/0;for(n=0;nu&&(u=i),og&&(g=o));if(c>u||l>g)return this;for(this.cover(c,l).cover(u,g),n=0;nt||t>=i||r>e||e>=o;)switch(l=(eu||(s=x.y0)>g||(c=x.x1)=p)<<1|t>=d)&&(x=h[h.length-1],h[h.length-1]=h[h.length-1-v],h[h.length-1-v]=x)}else{var w=t-+this._x.call(null,f.data),k=e-+this._y.call(null,f.data),m=w*w+k*k;if(m=(h=(a+c)/2))?a=h:c=h,(v=g>=(f=(s+l)/2))?s=f:l=f,e=n,!(n=n[d=v<<1|x]))return this;if(!n.length)break;(e[d+1&3]||e[d+2&3]||e[d+3&3])&&(r=e,p=d)}for(;n.data!==t;)if(i=n,!(n=n.next))return this;return(o=n.next)&&delete n.next,i?(o?i.next=o:delete i.next,this):e?(o?e[d]=o:delete e[d],(n=e[0]||e[1]||e[2]||e[3])&&n===(e[3]||e[2]||e[1]||e[0])&&!n.length&&(r?r[p]=n:this._root=n),this):(this._root=o,this)}function ns(t){for(var e=0,n=t.length;eh.index){var $=f-P.x-P.vx,B=x-P.y-P.vy,O=$*$+B*B;Of+D||Mx+D||Tl.r&&(l.r=l[u].r)}function c(){if(e){var l,u=e.length,g;for(n=new Array(u),l=0;l[e(S,M,a),S])),m;for(d=0,s=new Array(p);d(t=(ps*t+gs)%dn)/dn}function ys(t){return t.x}function vs(t){return t.y}var ws=10,xs=Math.PI*(3-Math.sqrt(5));function _s(t){var e,n=1,r=.001,i=1-Math.pow(r,1/300),o=0,a=.6,s=new Map,c=Re(g),l=Gt("tick","end"),u=ms();t==null&&(t=[]);function g(){h(),l.call("tick",e),n1?(d==null?s.delete(v):s.set(v,x(d)),e):s.get(v)},find:function(v,d,p){var w=0,k=t.length,m,S,M,T,P;for(p==null?p=1/0:p*=p,w=0;w1?(l.on(v,d),e):l.on(v)}}}function Be(){var t,e,n,r,i=V(-30),o,a=1,s=1/0,c=.81;function l(f){var x,v=t.length,d=Ge(t,ys,vs).visitAfter(g);for(r=f,x=0;x=s)return;(f.data!==e||f.next)&&(p===0&&(p=dt(n),m+=p*p),w===0&&(w=dt(n),m+=w*w),m=0;)e+=n[r].value;t.value=e}function Ss(){return this.eachAfter(Ns)}function bs(t,e){let n=-1;for(const r of this)t.call(e,r,++n,this);return this}function ks(t,e){for(var n=this,r=[n],i,o,a=-1;n=r.pop();)if(t.call(e,n,++a,this),i=n.children)for(o=i.length-1;o>=0;--o)r.push(i[o]);return this}function Ls(t,e){for(var n=this,r=[n],i=[],o,a,s,c=-1;n=r.pop();)if(i.push(n),o=n.children)for(a=0,s=o.length;a=0;)n+=r[i].value;e.value=n})}function zs(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}function Ts(t){for(var e=this,n=As(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var i=r.length;t!==n;)r.splice(i,0,t),t=t.parent;return r}function As(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),i=null;for(t=n.pop(),e=r.pop();t===e;)i=t,t=n.pop(),e=r.pop();return i}function Es(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}function Ps(){return Array.from(this)}function Ds(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}function Is(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}function*Rs(){var t=this,e,n=[t],r,i,o;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(i=0,o=r.length;i=0;--s)i.push(o=a[s]=new $t(a[s])),o.parent=r,o.depth=r.depth+1;return n.eachBefore(rr)}function $s(){return nr(this).eachBefore(Hs)}function Fs(t){return t.children}function Gs(t){return Array.isArray(t)?t[1]:null}function Hs(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function rr(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function $t(t){this.data=t,this.depth=this.height=0,this.parent=null}$t.prototype=nr.prototype={constructor:$t,count:Ss,each:bs,eachAfter:Ls,eachBefore:ks,find:Ms,sum:Cs,sort:zs,path:Ts,ancestors:Es,descendants:Ps,leaves:Ds,links:Is,copy:$s,[Symbol.iterator]:Rs};function ge(t){return t==null?null:Os(t)}function Os(t){if(typeof t!="function")throw new Error;return t}var Bs={depth:-1},pn={},me={};function Xs(t){return t.id}function qs(t){return t.parentId}function Me(){var t=Xs,e=qs,n;function r(i){var o=Array.from(i),a=t,s=e,c,l,u,g,h,f,x,v,d=new Map;if(n!=null){const p=o.map((m,S)=>Vs(n(m,S,i))),w=p.map(gn),k=new Set(p).add("");for(const m of w)k.has(m)||(k.add(m),p.push(m),w.push(gn(m)),o.push(me));a=(m,S)=>p[S],s=(m,S)=>w[S]}for(u=0,c=o.length;u=0&&(f=o[p],f.data===me);--p)f.data=null}if(g.parent=Bs,g.eachBefore(function(p){p.depth=p.parent.depth+1,--c}).eachBefore(rr),g.parent=null,c>0)throw new Error("cycle");return g}return r.id=function(i){return arguments.length?(t=ge(i),r):t},r.parentId=function(i){return arguments.length?(e=ge(i),r):e},r.path=function(i){return arguments.length?(n=ge(i),r):n},r}function Vs(t){t=`${t}`;let e=t.length;return Ce(t,e-1)&&!Ce(t,e-2)&&(t=t.slice(0,-1)),t[0]==="/"?t:`/${t}`}function gn(t){let e=t.length;if(e<2)return"";for(;--e>1&&!Ce(t,e););return t.slice(0,e)}function Ce(t,e){if(t[e]==="/"){let n=0;for(;e>0&&t[--e]==="\\";)++n;if(!(n&1))return!0}return!1}const Yt=t=>()=>t;function Ys(t,{sourceEvent:e,target:n,transform:r,dispatch:i}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:i}})}function lt(t,e,n){this.k=t,this.x=e,this.y=n}lt.prototype={constructor:lt,scale:function(t){return t===1?this:new lt(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new lt(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var he=new lt(1,0,0);ir.prototype=lt.prototype;function ir(t){for(;!t.__zoom;)if(!(t=t.parentNode))return he;return t.__zoom}function ye(t){t.stopImmediatePropagation()}function Mt(t){t.preventDefault(),t.stopImmediatePropagation()}function Us(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ws(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function mn(){return this.__zoom||he}function Ks(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function js(){return navigator.maxTouchPoints||"ontouchstart"in this}function Zs(t,e,n){var r=t.invertX(e[0][0])-n[0][0],i=t.invertX(e[1][0])-n[1][0],o=t.invertY(e[0][1])-n[0][1],a=t.invertY(e[1][1])-n[1][1];return t.translate(i>r?(r+i)/2:Math.min(0,r)||Math.max(0,i),a>o?(o+a)/2:Math.min(0,o)||Math.max(0,a))}function Qs(){var t=Us,e=Ws,n=Zs,r=Ks,i=js,o=[0,1/0],a=[[-1/0,-1/0],[1/0,1/0]],s=250,c=Io,l=Gt("start","zoom","end"),u,g,h,f=500,x=150,v=0,d=10;function p(y){y.property("__zoom",mn).on("wheel.zoom",P,{passive:!1}).on("mousedown.zoom",R).on("dblclick.zoom",D).filter(i).on("touchstart.zoom",$).on("touchmove.zoom",B).on("touchend.zoom touchcancel.zoom",O).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}p.transform=function(y,b,N,L){var C=y.selection?y.selection():y;C.property("__zoom",mn),y!==C?S(y,b,N,L):C.interrupt().each(function(){M(this,arguments).event(L).start().zoom(null,typeof b=="function"?b.apply(this,arguments):b).end()})},p.scaleBy=function(y,b,N,L){p.scaleTo(y,function(){var C=this.__zoom.k,A=typeof b=="function"?b.apply(this,arguments):b;return C*A},N,L)},p.scaleTo=function(y,b,N,L){p.transform(y,function(){var C=e.apply(this,arguments),A=this.__zoom,E=N==null?m(C):typeof N=="function"?N.apply(this,arguments):N,I=A.invert(E),F=typeof b=="function"?b.apply(this,arguments):b;return n(k(w(A,F),E,I),C,a)},N,L)},p.translateBy=function(y,b,N,L){p.transform(y,function(){return n(this.__zoom.translate(typeof b=="function"?b.apply(this,arguments):b,typeof N=="function"?N.apply(this,arguments):N),e.apply(this,arguments),a)},null,L)},p.translateTo=function(y,b,N,L,C){p.transform(y,function(){var A=e.apply(this,arguments),E=this.__zoom,I=L==null?m(A):typeof L=="function"?L.apply(this,arguments):L;return n(he.translate(I[0],I[1]).scale(E.k).translate(typeof b=="function"?-b.apply(this,arguments):-b,typeof N=="function"?-N.apply(this,arguments):-N),A,a)},L,C)};function w(y,b){return b=Math.max(o[0],Math.min(o[1],b)),b===y.k?y:new lt(b,y.x,y.y)}function k(y,b,N){var L=b[0]-N[0]*y.k,C=b[1]-N[1]*y.k;return L===y.x&&C===y.y?y:new lt(y.k,L,C)}function m(y){return[(+y[0][0]+ +y[1][0])/2,(+y[0][1]+ +y[1][1])/2]}function S(y,b,N,L){y.on("start.zoom",function(){M(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){M(this,arguments).event(L).end()}).tween("zoom",function(){var C=this,A=arguments,E=M(C,A).event(L),I=e.apply(C,A),F=N==null?m(I):typeof N=="function"?N.apply(C,A):N,j=Math.max(I[1][0]-I[0][0],I[1][1]-I[0][1]),H=C.__zoom,U=typeof b=="function"?b.apply(C,A):b,Q=c(H.invert(F).concat(j/H.k),U.invert(F).concat(j/U.k));return function(W){if(W===1)W=U;else{var X=Q(W),kt=j/X[2];W=new lt(kt,F[0]-X[0]*kt,F[1]-X[1]*kt)}E.zoom(null,W)}})}function M(y,b,N){return!N&&y.__zooming||new T(y,b)}function T(y,b){this.that=y,this.args=b,this.active=0,this.sourceEvent=null,this.extent=e.apply(y,b),this.taps=0}T.prototype={event:function(y){return y&&(this.sourceEvent=y),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(y,b){return this.mouse&&y!=="mouse"&&(this.mouse[1]=b.invert(this.mouse[0])),this.touch0&&y!=="touch"&&(this.touch0[1]=b.invert(this.touch0[0])),this.touch1&&y!=="touch"&&(this.touch1[1]=b.invert(this.touch1[0])),this.that.__zoom=b,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(y){var b=et(this.that).datum();l.call(y,this.that,new Ys(y,{sourceEvent:this.sourceEvent,target:p,type:y,transform:this.that.__zoom,dispatch:l}),b)}};function P(y,...b){if(!t.apply(this,arguments))return;var N=M(this,b).event(y),L=this.__zoom,C=Math.max(o[0],Math.min(o[1],L.k*Math.pow(2,r.apply(this,arguments)))),A=ct(y);if(N.wheel)(N.mouse[0][0]!==A[0]||N.mouse[0][1]!==A[1])&&(N.mouse[1]=L.invert(N.mouse[0]=A)),clearTimeout(N.wheel);else{if(L.k===C)return;N.mouse=[A,L.invert(A)],jt(this),N.start()}Mt(y),N.wheel=setTimeout(E,x),N.zoom("mouse",n(k(w(L,C),N.mouse[0],N.mouse[1]),N.extent,a));function E(){N.wheel=null,N.end()}}function R(y,...b){if(h||!t.apply(this,arguments))return;var N=y.currentTarget,L=M(this,b,!0).event(y),C=et(y.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",j,!0),A=ct(y,N),E=y.clientX,I=y.clientY;Hn(y.view),ye(y),L.mouse=[A,this.__zoom.invert(A)],jt(this),L.start();function F(H){if(Mt(H),!L.moved){var U=H.clientX-E,Q=H.clientY-I;L.moved=U*U+Q*Q>v}L.event(H).zoom("mouse",n(k(L.that.__zoom,L.mouse[0]=ct(H,N),L.mouse[1]),L.extent,a))}function j(H){C.on("mousemove.zoom mouseup.zoom",null),On(H.view,L.moved),Mt(H),L.event(H).end()}}function D(y,...b){if(t.apply(this,arguments)){var N=this.__zoom,L=ct(y.changedTouches?y.changedTouches[0]:y,this),C=N.invert(L),A=N.k*(y.shiftKey?.5:2),E=n(k(w(N,A),L,C),e.apply(this,b),a);Mt(y),s>0?et(this).transition().duration(s).call(S,E,L,y):et(this).call(p.transform,E,L,y)}}function $(y,...b){if(t.apply(this,arguments)){var N=y.touches,L=N.length,C=M(this,b,y.changedTouches.length===L).event(y),A,E,I,F;for(ye(y),E=0;E.5?"Mr. ":"Ms. ":"")+this.createWord(3+Math.floor(Math.random()*5),!0,!0)+" "+this.createWord(2+Math.floor(Math.random()*9),!0,!0)}createEmail(e){const n=typeof e>"u"?"domain.com":e;return this.createWord(3+Math.floor(Math.random()*5),!1,!0)+"."+this.createWord(2+Math.floor(Math.random()*9),!1,!0)+"@"+n}_jsUcfirst(e){return e.charAt(0).toUpperCase()+e.slice(1)}}var nc=or.default=ec;const ar=new nc;function ve(){return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}function Tt(t,e){return Math.floor(Math.random()*(e-t+1)+t)}const rc=(t,e=1)=>Mn(e).map(()=>ic(t)).reduce((n,r)=>{const i=n.nodes[Tt(n.nodes.length/2,n.nodes.length-1)],o=r.nodes[Tt(r.nodes.length/2,r.nodes.length-1)];return n.nodes.push(...r.nodes),n.links.push(...r.links),n.parents.push(...r.parents),i&&Math.random()>.5&&n.links.push({source:i.id,target:o.id,id:`${i.id}-${o.id}`}),n},{nodes:[],links:[],parents:[]}),ic=t=>{let e={id:ve(),name:yn()};const n=[e],r=Mn(t).map(a=>(Math.random()>.75&&(e={id:ve(),name:yn()},n.push(e)),{isServer:a===0,name:oc(e.name),id:ve(),parent:e.id})),o=[...ze([...r])].map(([a,s])=>({source:a.id,target:s.id,id:`${a.id}-${s.id}`}));return{nodes:r,links:o,parents:n}};function ze(t,e=[]){let n=-1,r;for(;++n.25)){const i=Tt(1,5),o=Tt(1,5);e.push(...ze([t[r],...t.splice(r+1,i)])),e[o]&&e.push(...ze([t[r],...t.splice(r+1,o),...Math.random()>.75?[t[Tt(r,t.length-1)]]:[]]))}return e}const sr=" Corp.";function yn(){return ar.createFullName(!1).split(" ")[0]+sr}function oc(t){const e=t.replace(sr,"")+"Corp.com";return ar.createEmail(e)}class At{constructor(e){_(this,"id");_(this,"parent");_(this,"name");_(this,"level");_(this,"type");_(this,"linkSignature",[]);_(this,"baseLinks",[]);_(this,"parentLink");_(this,"isServer",!1);_(this,"start");_(this,"end");_(this,"removeClassName");_(this,"className");_(this,"shape");_(this,"x");_(this,"y");_(this,"fx");_(this,"fy");_(this,"vx");_(this,"vy");_(this,"index");_(this,"r");this.id=e.id,this.parent=e.parent,this.name=e.name,this.level=e.level,this.type=e.type,this.parentLink=e.parentLink,this.className=e.className,this.shape=e.shape,e.isServer&&(this.isServer=e.isServer),e.start&&(this.start=new Date(e.start)),e.end&&(this.end=new Date(e.end))}}class cr{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"parent");_(this,"type");_(this,"parentNode");_(this,"baseLinks",[]);this.source=e.source,this.target=e.target,this.id=e.id,this.parent=e.parent,this.type=e.type,this.parentNode=e.parentNode}}class ac{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"graphLinks",[]);this.source=e.source,this.target=e.target,this.id=e.id}}class sc{constructor(e){_(this,"source");_(this,"target");_(this,"id");_(this,"graphLinks",[]);_(this,"currentTimeState");_(this,"data");this.source=e.source,this.target=e.target,this.id=e.id,this.graphLinks=e.graphLinks,this.data=e.data}}function G(t){return t||0}const _t=(t,e,n)=>(t.has(e)||t.set(e,n),t.get(e)),J=()=>{};function cc(t){const e=window;e.Cypress&&(e.graph=t)}function vn(t){return[...new Set(t)].sort()}function lc(t,e=!0){const n=Object.assign(t);e&&(n.nodes=n.nodes.filter(d=>d.id==null||d.parent==null?(console.warn("A graphData node did not contain all required properties and is being removed",{errorNode:d}),!1):!0),n.links=n.links.filter(d=>d.source==null||d.source==null?(console.warn("A graphData link did not contain all required properties and is being removed",{errorLink:d}),!1):!0)),n.parents||(n.parents=[]);const r=new Map(n.parents.map(d=>[d.id,d])),i=new Map;n.nodes.forEach(d=>{const{className:p,name:w}=r.get(d.parent)||{};_t(i,d.parent,new At({...d,className:p,name:w,id:d.parent,parent:tt.rootNodeName,level:"super",type:"keyNode"}))});const o=new Map(n.nodes.map(d=>[d.id,new At({...d,level:"sub",type:"keyNode"})])),a=new Map;n.links.forEach(d=>{const{source:p,target:w}=d,k=[p,w].sort().join(tt.idDelimiter);_t(a,k,new ac({source:p,target:w,id:k}))}),a.forEach(d=>{const p=o.get(d.source),w=o.get(d.target);p.parent===w.parent?(p.linkSignature.push(w.id),w.linkSignature.push(p.id)):(p.linkSignature.push(w.parent),w.linkSignature.push(p.parent)),p.baseLinks.push(d.id),w.baseLinks.push(d.id)});const s=new Map;o.forEach(d=>{d.linkSignature=[d.parent,...vn(d.linkSignature),tt.groupNodeSuffix];const p=d.linkSignature.join(tt.idDelimiter);_t(s,p,new At({id:p,parent:d.parent,level:"group",type:"keyNode"})),d.parent=p});const c=[{id:tt.rootNodeName},...i.values(),...s.values(),...o.values()],l=Me().id(d=>d.id).parentId(d=>d.parent)(c),u=new Map(l.descendants().map(d=>[d.id,d])),g=new Map,h=new Map;a.forEach(d=>{var k,m,S,M,T,P,R,D,$,B,O,y,b,N,L,C,A,E,I,F,j,H,U,Q,W;const p=u.get(d.source),w=u.get(d.target);if(((k=p==null?void 0:p.parent)==null?void 0:k.id)===((m=w==null?void 0:w.parent)==null?void 0:m.id))console.warn((S=p==null?void 0:p.parent)==null?void 0:S.id);else if((M=p.parent)!=null&&M.parent&&((T=w.parent)!=null&&T.parent)&&((R=(P=p.parent)==null?void 0:P.parent)==null?void 0:R.id)===(($=(D=w.parent)==null?void 0:D.parent)==null?void 0:$.id)){const X=wn(p.parent,w.parent,h,d);vt(p,h,g,d,X),vt(w,h,g,d,X)}else if((O=(B=p.parent)==null?void 0:B.parent)!=null&&O.parent&&((b=(y=w.parent)==null?void 0:y.parent)!=null&&b.parent)&&((C=(L=(N=p.parent)==null?void 0:N.parent)==null?void 0:L.parent)==null?void 0:C.id)===((I=(E=(A=w.parent)==null?void 0:A.parent)==null?void 0:E.parent)==null?void 0:I.id)){const X=wn(p.parent.parent,w.parent.parent,h,d),kt=vt(p.parent,h,g,d,X),vr=vt(w.parent,h,g,d,X);vt(p,h,g,d,kt),vt(w,h,g,d,vr)}else console.warn((H=(j=(F=p.parent)==null?void 0:F.parent)==null?void 0:j.parent)==null?void 0:H.id,(W=(Q=(U=w.parent)==null?void 0:U.parent)==null?void 0:Q.parent)==null?void 0:W.id)}),a.forEach(d=>{d.graphLinks=vn(d.graphLinks)});const f=[{id:tt.rootLinkName},...h.values()];return{nodes:[{id:tt.rootNodeName},...i.values(),...s.values(),...o.values(),...g.values()],links:f,baseLinks:[...a.values()]}}function wn(t,e,n,r){var c;const i=t.id,o=e.id,a=t.parent.id,s=uc(i,o);return(c=_t(n,s,new cr({source:i,target:o,id:s,parent:tt.rootLinkName,type:"siblingLink",parentNode:a})))==null||c.baseLinks.push(r.id),r.graphLinks.push(s),s}function vt(t,e,n,r,i){var s,c;const o=[t.parent.id,i,tt.parentLinkNodeSuffix].join(tt.idDelimiter);(s=_t(n,o,new At({id:o,type:"parentLinkNode",parent:t.parent.id,level:t.parent.data.level,parentLink:i})))==null||s.baseLinks.push(r.id);const a=[t.id,o].join(tt.idDelimiter);return(c=_t(e,a,new cr({source:t.id,target:o,id:a,parent:i,type:"parentLink",parentNode:t.parent.id})))==null||c.baseLinks.push(r.id),r.graphLinks.push(a),a}function uc(t,e){return[t,e].sort().join(tt.idDelimiter)}const hc={idDelimiter:"/",parentLinkNodeSuffix:"linkNode",groupNodeSuffix:"groupNode",rootNodeName:"rootNode",rootLinkName:"rootLink"},tt=hc;class fc{constructor({graphData:e,onSelectionChange:n=J,onPreviewChange:r=J,onTimeChange:i=J,onDataChange:o=J,previouslyParsedGraphData:a}){_(this,"rootNode");_(this,"rootLink");_(this,"baseLinks",new Map);_(this,"allNodes",new Map);_(this,"allLinks",new Map);_(this,"onDataChange");_(this,"currentTime",0);_(this,"pastSet",new Set);_(this,"presentSet",new Set);_(this,"onTimeChange");_(this,"selectionSet",new Set);_(this,"previewSet",new Set);_(this,"onSelectionChange");_(this,"onPreviewChange");this.onSelectionChange=n,this.onPreviewChange=r,this.onTimeChange=i,this.onDataChange=o,this.updateGraphData(e,{previouslyParsedGraphData:a,mergeWithCurrentGraphData:a!=null,fireEvent:!1})}get parsedGraphData(){return{nodes:Array.from(this.allNodes.values()).map(e=>({...e.data,x:e.x,y:e.y})),links:Array.from(this.allLinks.values()).map(e=>e.data),baseLinks:Array.from(this.baseLinks.values()).map(e=>e.data)}}updateGraphData(e,n){const{mergeWithCurrentGraphData:r=!0,previouslyParsedGraphData:i,fireEvent:o=!0}=n||{},a=lc(e);if(r){const s=i!=null?new Map(i.nodes.map(c=>[c.id,c])):this.allNodes.size>0?this.allNodes:null;s!=null&&a.nodes.forEach(c=>{const l=s.get(c.id);l&&(c.x=l.x,c.y=l.y)})}this.stratifyGraph(a),o&&this.onDataChange()}stratifyGraph(e){const n=Object.assign(e);this.rootLink=Me().id(r=>r.id).parentId(r=>r.parent)(n.links),this.rootNode=Me().id(r=>r.id).parentId(r=>r.parent)(n.nodes),this.allLinks=new Map(this.rootLink.descendants().map(r=>[r.id,r])),this.allNodes=new Map(this.rootNode.descendants().map(r=>[r.id,r])),this.baseLinks=new Map(n.baseLinks.map(r=>[r.id,new sc({source:this.allNodes.get(r.source),target:this.allNodes.get(r.target),id:r.id,graphLinks:r.graphLinks.map(i=>this.allLinks.get(i)),data:r})])),this.allNodes.forEach(r=>{r.graphLinks=[],r.parent!=null&&(r.baseLinks=r.data.baseLinks.map(i=>this.baseLinks.get(i)),r.type=r.data.type,r.data.parentLink&&(r.parentLink=this.allLinks.get(r.data.parentLink)),r.x=r.data.x,r.y=r.data.y,r.fx=r.data.fx,r.fy=r.data.fy)}),this.allLinks.forEach(r=>{if(r.parent==null)return;r.source=this.allNodes.get(r.data.source),r.target=this.allNodes.get(r.data.target),r.baseLinks=r.data.baseLinks.map(o=>this.baseLinks.get(o)),r.type=r.data.type,this.allNodes.get(r.data.parentNode).graphLinks.push(r)})}get timeState(){return{currentTime:this.currentTime,pastNodeIds:xn(this.pastSet),presentNodeIds:xn(this.presentSet)}}setTimeState(e,n=!0){this.clearTime(!1);const{currentTime:r,pastNodeIds:i,presentNodeIds:o}=e;this.currentTime=r,this.pastSet=_n(i,this.allNodes),this.presentSet=_n(o,this.allNodes),this.allNodes.forEach(u=>u.data.isServer?void 0:u.currentTimeState="future"),[[this.pastSet,"past"],[this.presentSet,"present"]].forEach(([u,g])=>{u.forEach(h=>{let f=h;for(;f;)f.currentTimeState=g,f=f.parent})}),this.allLinks.forEach(u=>u.currentTimeState="future"),this.baseLinks.forEach(u=>u.currentTimeState=void 0);const s=new Set,c=new Set;this.baseLinks.forEach(u=>{u.currentTimeState=dc(u.source,u.target),u.currentTimeState==="past"&&s.add(u),u.currentTimeState==="present"&&c.add(u)}),[[s,"past"],[c,"present"]].forEach(([u,g])=>{u.forEach(h=>{h.graphLinks.forEach(f=>{f.currentTimeState=g})})}),n&&this.onTimeChange()}clearTime(e=!0){this.currentTime=0,this.pastSet.clear(),this.presentSet.clear(),this.allNodes.forEach(n=>n.currentTimeState=void 0),this.allLinks.forEach(n=>n.currentTimeState=void 0),this.baseLinks.forEach(n=>n.currentTimeState=void 0),e&&this.onTimeChange()}clearSet(e){const n=e==="preview"?this.previewSet:this.selectionSet,r=e==="preview"?"previewed":"selected",i=e==="preview"?"previewedFocus":"selectedFocus",o=e==="preview"?"previewedParent":"selectedParent";n.forEach(a=>{a[r]=void 0,a[i]=void 0,a[o]=void 0}),n.clear()}addToSet(e,n){const r=n==="preview"?this.previewSet:this.selectionSet,i=n==="preview"?"previewed":"selected",o=n==="preview"?"previewedFocus":"selectedFocus",a=n==="preview"?"previewedParent":"selectedParent";function s(g){let h=g.parent;for(;h;)h[a]=!0,r.add(h),h=h.parent}function c(g){if(!(g==null||g.parent==null))if(g.data.isServer){const h=g.ancestors().find(x=>x.type==="keyNode"&&x.depth===1)||g,f=h.leaves().find(x=>x.type==="keyNode")||g;[h,f].forEach(x=>{x[i]=!0,r.add(x)})}else g[i]=!0,r.add(g),s(g)}function l(g){g[i]=!0,r.add(g)}if(e.data.isServer){const g=e.ancestors().find(f=>f.type==="keyNode"&&f.depth===1)||e,h=g.leaves().find(f=>f.type==="keyNode")||e;g[o]=!0,c(g),e=h}e[o]=!0,c(e),e.baseLinks.length>0?e.baseLinks.forEach(g=>{g.graphLinks.forEach(h=>{l(h)}),c(g.source),c(g.target)}):e.graphLinks.filter(h=>h.type="parentLink").forEach(h=>{const f=h.parent;f&&f.parent!=null&&(l(f),c(f.target),c(f.source))})}selectNodes(e,n=!0){this.clearSelection(!1);for(let r=0;rArray.from(t).map(e=>e.id||""),_n=(t,e)=>new Set(t.map(n=>e.get(n)).filter(n=>n)),dc=(t,e)=>{const n=t.currentTimeState,r=e.currentTimeState;if(n===r)return n;if(n==="future"||r==="future")return"future";if(n==="past"||r==="past")return"past";if(n==="present"||r==="present")return"present"},lr=([t,e],n)=>{let r=t,i=e;if(!n)return{x:r,y:i,wasClamped:!1};if(n<0)return{x:0,y:0,wasClamped:!0};const o=Math.hypot(r,i);if(o>n){const s=Math.atan2(r,i);r=Math.sin(s)*n,i=Math.cos(s)*n}const a=o>n;return{x:r,y:i,wasClamped:a,xyRadius:o,radius:n}};function ur(t=30){let e,n;const r=typeof t!="function"?pc(+t):t;function i(a){for(let s=0,c=e.length;sr.type==="parentLinkNode"))||[]).forEach(r=>{const{source:i,target:o}=r.parentLink;let a=G(i.x)-G(o.x),s=G(i.y)-G(o.y);t.id===i.id&&(a*=-1,s*=-1);const[l,u]=fr(a,s,t.r||1);r.fx=l,r.fy=u})}function fr(t,e,n){const r=Math.atan2(t,e),i=Math.sin(r)*n,o=Math.cos(r)*n;return[i,o]}function gc(t,e,n,r,i=1,o="by"){const a=n-t,s=r-e,c=o==="to"?i:Math.hypot(a,s)-i,[l,u]=fr(a,s,c);return{source:{x:t,y:e},target:{x:t+l,y:e+u}}}const dr=t=>Math.PI*t*t,pr=t=>Math.sqrt(t/Math.PI),Nt=({d:t,zk:e=1,rk:n=1,zx:r=0,zy:i=0,tx:o=0,ty:a=0})=>`translate(${G(t.x)*n*e+r+o}, ${G(t.y)*n*e+i+a})`,Ft=t=>t.previewedFocus||t.selectedFocus||t.selectedParent||t.previewedParent||!1,gr=t=>t.selected||t.previewed||Ft(t),mc=t=>t.selected||t.selectedFocus||t.selectedParent||!1,yc=t=>t.previewed||t.previewedFocus||t.previewedParent||!1,Nn=t=>yc(t)?3:mc(t)?2:t.data instanceof At?1:0,Ve=(t,e)=>Nn(t)-Nn(e),it=(t,e,n)=>{var i,o;const r=n[e];t.data.removeClassName&&((i=r==null?void 0:r.classList)==null||i.remove(t.data.removeClassName)),t.data.className&&((o=r==null?void 0:r.classList)==null||o.add(t.data.className))},mt=t=>t.type!=="parentLinkNode"?t.data.id:null,vc="-label",mr=t=>mt(t)+vc;function Sn(t,e=0){return e=Math.pow(10,e),Math.round(t*e)/e}const wc="http://www.w3.org/2000/svg",xc=t=>document.createElementNS(wc,t),z={graphRoot:"graphRoot",isZooming:"isZooming",transformWrapper:"transformWrapper",superGraph:"superGraph",groupGraph:"groupGraph",subGraph:"subGraph",superNode:"superNode",groupNode:"groupNode",subNode:"subNode",serverNode:"serverNode",computerNode:"computerNode",softwareNode:"softwareNode",superNodeCountLabel:"superNodeCountLabel",superNodeNameLabel:"superNodeNameLabel",subNodeNameLabel:"subNodeNameLabel",occludedLabel:"occludedLabel",hiddenLabel:"hiddenLabel",keyNode:"keyNode",siblingLink:"siblingLink",parentLinkNode:"parentLinkNode",parentLink:"parentLink",previewed:"previewed",previewedFocus:"previewedFocus",previewedParent:"previewedParent",selected:"selected",selectedFocus:"selectedFocus",selectedParent:"selectedParent",future:"future",present:"present",past:"past"};class Ye{constructor({rootNode:e,rootSelection:n,parentGraph:r,graphHandler:i}){_(this,"rootNode");_(this,"parentNode");_(this,"links");_(this,"nodes");_(this,"keyNodes");_(this,"parentLinkNodes");_(this,"simulation");_(this,"simulationForces",[]);_(this,"rootSelection");_(this,"rootGroupSelection");_(this,"childGraphRootSelection");_(this,"linkSelection");_(this,"nodeSelection");_(this,"labelSelection");_(this,"parentGraph");_(this,"childGraphs",[]);_(this,"graphHandler");_(this,"isHidden",!1);this.rootNode=e,this.parentNode=this.rootNode.parent||void 0,this.links=this.rootNode.graphLinks||[],this.nodes=this.rootNode.children||[],this.keyNodes=this.nodes.filter(o=>o.type==="keyNode")||[],this.parentLinkNodes=this.nodes.filter(o=>o.type==="parentLinkNode")||[],this.parentGraph=r,this.graphHandler=i,this.rootSelection=n}initialize(e=!1){this.initializeForces(),this.initializeSelection(),e&&this.hideLayout(),this.initializeSimulationLayout()}initializeForces(){this.simulation=_s(this.nodes).on("tick",this.drawLayout.bind(this))}initializeSelection(){}initializeSimulationLayout(){this.useGraphForces(),this.simulation.alphaDecay(.001).alphaTarget(.7).tick(300).alphaTarget(0).alphaDecay(.1).restart().tick(500).stop(),this.drawLayout()}initializeChildGraphs(e){this.childGraphRootSelection&&e!=null&&(this.childGraphs=[],this.childGraphRootSelection.filter(n=>n.type==="keyNode").each((n,r,i)=>{var o;(o=this.childGraphs)==null||o.push(new e({rootNode:n,rootSelection:et(i[r]),parentGraph:this,graphHandler:this.graphHandler}))}))}callChildrenRecursively(e){var n;this[e](),(n=this.childGraphs)==null||n.forEach(r=>r.callChildrenRecursively(e))}useGraphForces(){for(let e=0;er.reheat(e))}cool(){var e;this.simulation.alphaTarget(0),(e=this.childGraphs)==null||e.forEach(n=>n.cool())}freeze(){var e;this.simulation.stop(),(e=this.childGraphs)==null||e.forEach(n=>n.freeze())}drawLayout(){}drawInteraction(){[this.rootSelection,this.rootGroupSelection,this.linkSelection,this.nodeSelection,this.labelSelection].forEach(e=>{e==null||e.classed(z.selected,n=>!!n.selected).classed(z.selectedFocus,n=>!!n.selectedFocus).classed(z.selectedParent,n=>!!n.selectedParent).classed(z.previewed,n=>!!n.previewed).classed(z.previewedFocus,n=>!!n.previewedFocus).classed(z.previewedParent,n=>!!n.previewedParent)})}drawTime(e=[]){const n=[z.present,z.past,z.future].join(" ");[this.nodeSelection,this.linkSelection,this.labelSelection,...e].forEach(r=>{r==null||r.classed(n,!1).filter(i=>!i.data.isServer).classed(z.past,i=>i.currentTimeState==="past").classed(z.present,i=>i.currentTimeState==="present").classed(z.future,i=>i.currentTimeState==="future")})}drawUpdateLabel(){}drawUpdateNodeVisual(){}hideLayout(){this.isHidden||this.rootGroupSelection.remove(),this.isHidden=!0}showLayout(){var e;this.isHidden&&((e=this.rootSelection.node())==null||e.appendChild(this.rootGroupSelection.node())),this.isHidden=!1}}function _c(t,e=1,n=0,r=0){t=t<3?3:t,n=n*Math.PI/180;const i=2*Math.PI/t,o=[];for(let a=0;ai.join(",")).join(" ")}const Nc={triangleUp:[3,180],triangleDown:[3,0],diamond:[4,90],square:[4,45],pentagonUp:[5,180],pentagonDown:[5,0],hexagonUp:[6,0],hexagonDown:[6,90]},bn={};function Sc(t,e=1,n){const r=[t,e,n].join("-");let i=bn[r];if(i==null){const[o,a]=Nc[t],s=Math.PI*e*e,c=1+o*.03,l=bc(o,s)*c;i=yr(o,l,a,n),bn[r]=i}return i}function bc(t,e=Math.PI){return Math.sqrt(e*2/(Math.sin(2*Math.PI/t)*t))}const oe=class oe extends Ye{constructor(e){super(e),super.initialize(!0)}initializeForces(){this.nodes.forEach(o=>o.r=o.type==="parentLinkNode"?1:oe.radius(o));const e=Be().strength(o=>o.type==="keyNode"?-4:0),n=Oe(this.links).strength(0).distance(this.rootNode.r*.3),r=ur(o=>o.type==="keyNode"?this.rootNode.r-2:0),i=!0;this.simulationForces=[{name:"positionParentLinkNodes",force:()=>hr(this.rootNode)},{name:"link",force:n,optional:i},{name:"charge",force:e,optional:i},{name:"x",force:Xe(0),optional:i},{name:"y",force:qe(0),optional:i},{name:"clamp",force:r}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").attr(z.subGraph,!0).attr("transform-origin","center").attr("cy-test","subGSelection").attr("id",mt),this.linkSelection=this.rootGroupSelection.selectAll("line").data(this.links).join("line").classed(z.siblingLink,e=>e.type==="siblingLink").classed(z.parentLink,e=>e.type==="parentLink").attr("cy-test","subLinkSelection").attr("id",mt),this.nodeSelection=this.rootGroupSelection.selectAll(".testing").data(this.nodes).join("g").classed("testing",!0).attr("cy-test","beaconsGraph").attr("id",mt).each(it).classed(z.parentLinkNode,e=>e.type==="parentLinkNode").classed(z.keyNode,e=>e.type==="keyNode").classed(z.subNode,!0).classed(z.softwareNode,!0).on("click",this.graphHandler.clickNode.bind(this.graphHandler)).on("mouseover",this.graphHandler.mouseOverNode.bind(this.graphHandler)),this.drawUpdateNodeVisual(),this.labelSelection=this.rootGroupSelection.append("g").attr("cy-test","selectedLabel").selectAll("text").data(this.nodes.filter(e=>e.type==="keyNode")).join("text").attr("id",mr).each(it).classed(z.subNodeNameLabel,!0).text(kn),super.initializeSelection()}drawUpdateNodeVisual(){var e;(e=this.labelSelection)==null||e.each(it),this.nodeSelection.each(it),this.nodeSelection.selectChildren().remove(),this.nodeSelection.append(n=>xc(n.data.shape==="circle"||n.data.shape==null?"circle":"polygon")).attr("r",n=>n.r||0).attr("points",n=>n.data.shape&&n.data.shape!=="circle"?Sc(n.data.shape,G(n.r)+1):null)}drawLayout(){var n;if(!this.parentNode)return;const{rk:e=1}=this.graphHandler.zoomTransform;this.linkSelection.attr("x1",r=>G(r.source.x)*e).attr("y1",r=>G(r.source.y)*e).attr("x2",r=>G(r.target.x)*e).attr("y2",r=>G(r.target.y)*e),this.nodeSelection.attr("transform",r=>Nt({d:r,rk:e})),(n=this.labelSelection)==null||n.attr("transform",r=>Nt({d:r,rk:e,tx:10,ty:4}))}drawInteraction(){var e;(e=this.labelSelection)==null||e.classed(z.hiddenLabel,n=>!gr(n)),Ft(this.parentNode)?(this.showLayout(),super.drawInteraction(),this.rootGroupSelection.selectChildren().sort(Ve)):this.hideLayout()}drawUpdateLabel(){var e;(e=this.labelSelection)==null||e.text(kn)}};_(oe,"radius",e=>4);let re=oe;const kn=t=>`– ${t.data.name||t.data.id}`,ae=class ae extends Ye{constructor(e){super(e),this.initialize(!0),this.initializeChildGraphs(re)}initializeForces(){this.nodes.forEach(s=>s.r=s.type==="keyNode"?ae.radius(s):1.5);const e=Be().strength(s=>s.type==="keyNode"?(s.graphLinks.length||1)*-2-1:0),n=Oe(this.links).strength(s=>s.source.graphLinks.length/100).distance(this.keyNodes.length<2?()=>this.rootNode.r:s=>this.rootNode.r/this.links.length+(s.source.r||1)),r=ur(s=>s.type==="keyNode"?s.parent.r-s.r-2:0),i=er().strength(.5).radius(s=>s.type==="keyNode"?s.r+2:0),o=()=>hr(this.rootNode),a=!0;this.simulationForces=[{name:"positionParentLinkNodes",force:o},{name:"link",force:n,optional:a},{name:"charge",force:e,optional:a},{name:"x",force:Xe(0).strength(.05),optional:a},{name:"y",force:qe(0).strength(.05),optional:a},{name:"collide",force:i},{name:"clamp",force:r}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").classed(z.groupGraph,!0).attr("transform-origin","center"),this.linkSelection=this.rootGroupSelection.selectAll("line").data(this.links).join("line").classed(z.siblingLink,e=>e.type==="siblingLink").classed(z.parentLink,e=>e.type==="parentLink"),this.childGraphRootSelection=this.rootGroupSelection.selectAll("g").data(this.nodes).join("g").call(this.graphHandler.initializeDrag(this)),this.nodeSelection=this.childGraphRootSelection.append("g").append("circle").attr("r",e=>e.r||0).style("pointer-events","none").classed(z.parentLinkNode,e=>e.type==="parentLinkNode").classed(z.keyNode,e=>e.type==="keyNode").classed(z.groupNode,!0),super.initializeSelection()}drawLayout(){const{rk:e=1}=this.graphHandler.zoomTransform;this.linkSelection.each(n=>{var r,i,o,a,s;n.shortLink=gc(G((r=n.target)==null?void 0:r.x),G((i=n.target)==null?void 0:i.y),G((o=n.source)==null?void 0:o.x),G((a=n.source)==null?void 0:a.y),(s=n==null?void 0:n.source)==null?void 0:s.r)}).attr("x1",n=>n.shortLink.source.x*e).attr("y1",n=>n.shortLink.source.y*e).attr("x2",n=>n.shortLink.target.x*e).attr("y2",n=>n.shortLink.target.y*e),this.childGraphRootSelection.attr("transform",n=>Nt({d:n,rk:e})),this.nodeSelection.attr("r",n=>G(n.r)*(n.descendants?e:1))}drawInteraction(){Ft(this.rootNode)?(this.showLayout(),super.drawInteraction(),this.rootGroupSelection.selectChildren().sort(Ve)):this.hideLayout()}};_(ae,"radius",e=>{var i;const n=((i=e.children)==null?void 0:i.filter(o=>o.type==="keyNode"))||[];let r=0;for(let o=0;oa.r=a.data.isServer?10:ft.radius(a));const n=Be().strength(a=>-300*a.children.filter(s=>s.type==="parentLinkNode").length),r=Oe(this.links),i=er().strength(.1).radius(a=>ft.radius(a)+4),o=!0;this.simulationForces=[{name:"link",force:r,optional:o},{name:"charge",force:n,optional:o},{name:"x",force:Xe(0),optional:o},{name:"y",force:qe(0),optional:o},{name:"collide",force:i}],super.initializeForces()}initializeSelection(){this.rootGroupSelection=this.rootSelection.data([this.rootNode]).append("g").attr("id",mt).classed(z.superGraph,!0).attr("transform-origin","center"),this.graphSelection=this.rootGroupSelection.append("g"),this.linkSelection=this.graphSelection.selectAll("line").data(this.links).join("line").attr("id",mt).classed(z.parentLink,!0).classed(z.siblingLink,n=>n.type==="siblingLink"),this.positionSelection=this.graphSelection.selectAll("g").data(this.nodes).join("g").call(this.graphHandler.initializeDrag(this)),this.hostSelection=this.positionSelection.filter(n=>!n.data.isServer).append("g").append("circle").attr("r",n=>n.r||0).classed(z.computerNode,!0),this.serverSelection=this.positionSelection.filter(n=>n.data.isServer).append("g").append("polygon").attr("points",n=>yr(6,n.r||0)).classed(z.serverNode,!0),this.nodeSelection=this.positionSelection.selectChild().selectChild(),this.nodeSelection.attr("cy-test","graphNode").attr("id",mt).each(it).classed(z.parentLinkNode,n=>n.type==="parentLinkNode").classed(z.keyNode,n=>n.type==="keyNode").classed(z.superNode,!0).on("click",this.graphHandler.clickNode.bind(this.graphHandler)).on("mouseover",this.graphHandler.mouseOverNode.bind(this.graphHandler)),this.childGraphRootSelection=this.positionSelection.append("g").filter(n=>!n.data.isServer),this.labelSelection=this.rootGroupSelection.append("g").selectAll("text").data(this.nodes).join("text").attr("text-anchor","end").attr("cy-test","selectedLabel").attr("id",mr).each(it).classed(z.superNodeNameLabel,!0).classed(z.hiddenLabel,!0).text(Ln),this.countLabelSelection=this.rootGroupSelection.append("g").selectAll("text").data(this.nodes.filter(n=>n.leaves().filter(r=>r.type==="keyNode").length>1)).join("text").attr("text-anchor","middle").each(it).classed(z.superNodeCountLabel,!0).text(n=>n.leaves().filter(r=>r.type==="keyNode").length),super.initializeSelection()}drawUpdateNodeVisual(){var n;this.nodeSelection.each(it),(n=this.labelSelection)==null||n.each(it),this.countLabelSelection.each(it)}drawTime(){super.drawTime([this.countLabelSelection])}drawLayout(){var o;const{k:n,x:r,y:i}=this.graphHandler.zoomTransform;this.linkSelection.attr("x1",a=>G(a.source.x)*n+r).attr("y1",a=>G(a.source.y)*n+i).attr("x2",a=>G(a.target.x)*n+r).attr("y2",a=>G(a.target.y)*n+i),this.positionSelection.attr("transform",a=>Nt({d:a,zk:n,zx:r,zy:i})),(o=this.countLabelSelection)==null||o.attr("transform",a=>Nt({d:a,zk:n,zx:r,zy:i,ty:4})),this.drawDynamicLayout(),super.drawLayout()}drawDynamicLayout(){var a;const{k:n,x:r,y:i,rk:o}=this.graphHandler.zoomTransform;this.hostSelection.attr("r",s=>ft.shrinkRadius(s,o)),(a=this.labelSelection)==null||a.attr("transform",s=>{const c=(s.data.isServer?G(s.r):ft.shrinkRadius(s,o))*-1-4;return Nt({d:s,zk:n,zx:r,zy:i,ty:4,tx:c})})}drawInteraction(){var n,r;this.drawDynamicLayout(),(n=this.countLabelSelection)==null||n.classed(z.hiddenLabel,i=>Ft(i)),(r=this.labelSelection)==null||r.classed(z.hiddenLabel,i=>!gr(i)),super.drawInteraction(),this.graphSelection.selectChildren().sort(Ve)}drawUpdateLabel(){var n;(n=this.labelSelection)==null||n.text(Ln)}};_(ft,"radius",n=>{var o;const r=((o=n.children)==null?void 0:o.filter(a=>a.type==="keyNode"))||[];let i=0;for(let a=0;a{const i=G(n.r)*r;return Ft(n)?i:Math.max(i*.6,8)});let Te=ft;const Ln=t=>`${t.data.name||t.data.id} –`;function kc({selection:t,prioritySort:e,className:n="occluded"}){const r=[];t.selectAll("text").classed(n,!1).each((o,a,s)=>{const c=s[a],l=c.getBoundingClientRect();r.push({node:c,d:o,domRect:l})});const i=[];return e&&r.sort(e),r.forEach(o=>{const a=i.some(s=>Lc(o.domRect,s.domRect));et(o.node).classed(n,a),a||i.push(o)}),i}function Lc(t,e){return!(t.x+t.width{var r,i,o,a;const n=["previewedFocus","previewed","previewedParent","selectedFocus","selected","selectedParent"];for(const s of n)if(t.d[s]!=e.d[s])return t.d[s]?-1:1;return t.d.depth!==e.d.depth?t.d.depth-e.d.depth:((r=t.d.children)==null?void 0:r.length)!==((i=e.d.children)==null?void 0:i.length)?(((o=t.d.children)==null?void 0:o.length)||0)-(((a=e.d.children)==null?void 0:a.length)||0):0},Cc="dotGrid",se=class se{constructor({onSelectionChange:e=J,onPreviewChange:n=J,onTimeChange:r=J,onDataChange:i=J,graphData:o,element:a,previouslyParsedGraphData:s}){_(this,"graphData");_(this,"svg");_(this,"rootSelection");_(this,"dimensions",{width:0,height:0});_(this,"graphRoot");_(this,"onSelectionChange",J);_(this,"onPreviewChange",J);_(this,"onTimeChange",J);_(this,"onDataChange",J);_(this,"_onSelectionChange",(...e)=>{this.graphRoot.callChildrenRecursively("drawInteraction"),this.drawTextOcclusion(),this.onSelectionChange(...e)});_(this,"_onPreviewChange",(...e)=>{this.graphRoot.callChildrenRecursively("drawInteraction"),this.drawTextOcclusion(),this.onPreviewChange(...e)});_(this,"_onTimeChange",()=>{this.graphRoot.callChildrenRecursively("drawTime"),this.drawTextOcclusion(),this.onTimeChange()});_(this,"_onDataChange",()=>{this.updateGraphRoot(),this.onDataChange()});_(this,"zoom");_(this,"dragState",{});_(this,"forceMode","graph");this.onSelectionChange=e,this.onPreviewChange=n,this.onTimeChange=r,this.onDataChange=i,this.graphData=new fc({graphData:o,onSelectionChange:this._onSelectionChange,onPreviewChange:this._onPreviewChange,onTimeChange:this._onTimeChange,onDataChange:this._onDataChange,previouslyParsedGraphData:s}),this.svg=et(a).html("").classed([z.graphRoot,Cc].join(" "),!0),this.resize(),this.svg.append("rect").on("mouseover",this.mouseOutNode.bind(this)).attr("width","100%").attr("height","100%").attr("x","-50%").attr("y","-50%").attr("fill","transparent"),this.rootSelection=this.svg.append("g"),this.initializeZoom(),this.updateGraphRoot(),cc(this),this.zoomToFit({duration:0})}updateGraphRoot(){this.graphRoot!=null&&this.rootSelection.selectChildren().remove(),this.graphRoot=new Te({rootNode:this.graphData.rootNode,rootSelection:this.rootSelection,graphHandler:this})}drawTextOcclusion(){kc({selection:this.rootSelection,className:z.occludedLabel,prioritySort:Mc})}initializeZoom(){const e=()=>{this.graphRoot.freeze(),this.graphRoot.callChildrenRecursively("drawLayout")},n=()=>{this.svg.classed(z.isZooming,!0)},r=()=>{this.svg.classed(z.isZooming,!1),this.drawTextOcclusion()};this.zoom=Qs().extent([[0,0],[this.dimensions.width,this.dimensions.height]]).scaleExtent([1/2,10]).on("start",n).on("zoom",e).on("end",r),this.svg.call(this.zoom)}get zoomTransform(){const e=ir(this.svg.node());return e.rk=se.scaleRadius(e.k),e}zoomToFit({duration:e=750,boundingBox:n}={}){const{k:r,x:i,y:o}=this.zoomTransform,{height:a,width:s}=this.dimensions,c=n||this.rootSelection.node().getBBox(),{height:l,width:u}=c,g=c.x+u/2,h=c.y+l/2,f=Math.max(u/s,l/a),x=Math.min(r/f-.2,4),v=(i-g)/r,d=(o-h)/r;this.svg.transition().duration(e).call(this.zoom.transform,he.scale(x).translate(v,d))}zoomToSelection(){throw new Error("Not Implemented")}zoomIn(){this.svg.transition().call(this.zoom.scaleBy,1.3,[0,0])}zoomOut(){this.svg.transition().call(this.zoom.scaleBy,.7,[0,0])}initializeDrag(e){const n=o=>{o.active||(o.subject.fx=this.dragState.startX=o.subject.x,o.subject.fy=this.dragState.startY=o.subject.y)},r=o=>{this.dragState.isDragging||(this.dragState.isDragging=!0);const{k:a}=this.zoomTransform,{x:s,y:c}=o,{startX:l=0,startY:u=0}=this.dragState,g=s-l,h=c-u,f=g/a+l,x=h/a+u,{x:v,y:d}=lr([f,x],o.subject.parent.r-o.subject.r);o.subject.fx=v,o.subject.fy=d,e.reheat(Math.max(Math.abs(s),Math.abs(c))*1e-4)},i=o=>{o.active||(e.cool(),o.subject.fx=null,o.subject.fy=null,this.dragState={})};return co().on("start",n).on("drag",r).on("end",i)}clickNode(e,n){n.selectedFocus?this.graphData.clearSelection():this.graphData.selectNodes([n])}mouseOverNode(e,n){this.dragState.isDragging||this.graphData.previewNode(n)}mouseOutNode(){this.dragState.isDragging||this.graphData.clearPreview()}resize(){const e=this.svg.node();this.dimensions={width:e.clientWidth,height:e.clientHeight};const{width:n,height:r}=this.dimensions;this.svg.attr("viewBox",[-n/2,-r/2,n,r].join(" "))}updateNodeName(e,n){const r=this.graphData.allNodes.get(e);r&&(r.data.name=n,this.graphRoot.callChildrenRecursively("drawUpdateLabel"))}updateNodeVisual({nodeId:e,className:n,shape:r}){const i=this.graphData.allNodes.get(e);i&&(n!=null&&(i.data.removeClassName=i.data.className,i.data.className=n),r&&(i.data.shape=r),this.graphRoot.callChildrenRecursively("drawUpdateNodeVisual"))}useForceMode(e){e==="simple"?(this.graphRoot.callChildrenRecursively("useSimpleForces"),this.forceMode="simple"):(this.graphRoot.callChildrenRecursively("useGraphForces"),this.forceMode="graph")}};_(se,"scaleRadius",e=>Math.min(e,(e-1)*.3+1));let Ae=se;const zc=async()=>rc(50,5),Tc=async()=>{try{return await Wa("./private-test-data/parsedGraphData.json")}catch{return}},Ac=async t=>{const e=await zc(),n=await Tc(),r=document.getElementById(t);window.graph=new Ae({graphData:e,element:r,previouslyParsedGraphData:n,onSelectionChange:i=>console.log(i)}),window.addEventListener("resize",()=>window.graph.resize()),console.log(window.graph)};Ac("app"); diff --git a/index.html b/index.html index 7994f27e..2bf390a1 100644 --- a/index.html +++ b/index.html @@ -6,7 +6,7 @@ RedEye Graph - +