Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aframe-forcegraph-component

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-forcegraph-component - npm Package Compare versions

Comparing version 1.2.2 to 1.3.0-ngraph

yarn.lock

8

dist/aframe-forcegraph-component.min.js

@@ -1,6 +0,6 @@

!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");var r=n(3),i=n(11);AFRAME.registerComponent("forcegraph",{schema:{jsonUrl:{type:"string"},numDimensions:{type:"number",default:3},nodeRelSize:{type:"number",default:4},lineOpacity:{type:"number",default:.2},autoColorBy:{type:"string",default:""},idField:{type:"string",default:"id"},valField:{type:"string",default:"val"},nameField:{type:"string",default:"name"},colorField:{type:"string",default:"color"},linkSourceField:{type:"string",default:"source"},linkTargetField:{type:"string",default:"target"},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1/0},cooldownTime:{type:"int",default:15e3}},init:function(){this.data.tooltipEl=document.createElement("a-text"),document.querySelector("a-entity[camera], a-camera").appendChild(this.data.tooltipEl),this.data.tooltipEl.setAttribute("position","0 -0.7 -1"),this.data.tooltipEl.setAttribute("width",2),this.data.tooltipEl.setAttribute("align","center"),this.data.tooltipEl.setAttribute("color","lavender"),this.data.tooltipEl.setAttribute("value",""),this.cameraObj=document.querySelector("[camera], a-camera").object3D.children.filter(function(t){return"PerspectiveCamera"===t.type})[0],this.data.forceLayout=r.forceSimulation().force("link",r.forceLink()).force("charge",r.forceManyBody()).force("center",r.forceCenter()).stop(),this.data.nodes=[],this.data.links=[]},remove:function(){this.data.tooltipEl.remove()},update:function(t){function e(){(c++>r.cooldownTicks||new Date-l>r.cooldownTime)&&r.forceLayout.stop(),r.nodes.forEach(function(t){var e=t.__sphere;e.position.x=t.x,e.position.y=t.y||0,e.position.z=t.z||0}),r.links.forEach(function(t){var e=t.__line;e.geometry.vertices=[new THREE.Vector3(t.source.x,t.source.y||0,t.source.z||0),new THREE.Vector3(t.target.x,t.target.y||0,t.target.z||0)],e.geometry.verticesNeedUpdate=!0,e.geometry.computeBoundingSphere()})}var n=this,r=this.data,o=AFRAME.utils.diff(r,t);("jsonUrl"in o||"colorField"in o||"autoColorBy"in o||"linkSourceField"in o||"linkTargetField"in o)&&i.get(r.jsonUrl).then(function(t,e){if(r.autoColorBy){var i=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],o={};e.nodes.filter(function(t){return!t[r.colorField]}).map(function(t){return t[r.autoColorBy]}).forEach(function(t){o[t]=null}),Object.keys(o).forEach(function(t,e){o[t]=e}),e.nodes.filter(function(t){return!t[r.colorField]}).forEach(function(t){t[r.colorField]=parseInt(i[o[t[r.autoColorBy]]%i.length].slice(1),16)})}e.links.forEach(function(t){t.source=t[r.linkSourceField],t.target=t[r.linkTargetField],t.id=[t.source,t.target].join(" > ")}),r.nodes=e.nodes,r.links=e.links,n.update(r)});var a=this.el.object3D;a.children.forEach(a.remove),r.nodes.forEach(function(t){var e=new THREE.MeshLambertMaterial({color:t[r.colorField]||16777130,transparent:!0});e.opacity=.75;var n=new THREE.Mesh(new THREE.SphereGeometry(Math.cbrt(t[r.valField]||1)*r.nodeRelSize,8,8),e);n.name=t[r.nameField],a.add(t.__sphere=n)});var u=new THREE.LineBasicMaterial({color:15790320,transparent:!0});u.opacity=r.lineOpacity,r.links.forEach(function(t){var e=new THREE.Line(new THREE.Geometry,u);e.geometry.vertices=[new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)],a.add(t.__line=e)}),r.forceLayout.stop().alpha(1).numDimensions(r.numDimensions).nodes(r.nodes).force("link").id(function(t){return t[r.idField]}).links(r.links);for(var s=0;s<r.warmupTicks;s++)r.forceLayout.tick();var c=0,l=new Date;r.forceLayout.on("tick",e).restart()},tick:function(t,e){var n=new THREE.Raycaster;n.setFromCamera(new THREE.Vector2(0,0),this.cameraObj);var r=n.intersectObjects(this.el.object3D.children).filter(function(t){return t.object.name});this.data.tooltipEl.setAttribute("value",r.length?r[0].object.name:"")}})},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function o(t){if(f===clearTimeout)return clearTimeout(t);if((f===r||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(t);try{return f(t)}catch(e){try{return f.call(null,t)}catch(e){return f.call(this,t)}}}function a(){y&&p&&(y=!1,p.length?d=p.concat(d):v=-1,d.length&&u())}function u(){if(!y){var t=i(a);y=!0;for(var e=d.length;e;){for(p=d,d=[];++v<e;)p&&p[v].run();v=-1,e=d.length}p=null,y=!1,o(t)}}function s(t,e){this.fun=t,this.array=e}function c(){}var l,f,h=t.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:n}catch(t){l=n}try{f="function"==typeof clearTimeout?clearTimeout:r}catch(t){f=r}}();var p,d=[],y=!1,v=-1;h.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new s(t,e)),1!==d.length||y||i(u)},s.prototype.run=function(){this.fun.apply(null,this.array)},h.title="browser",h.browser=!0,h.env={},h.argv=[],h.version="",h.versions={},h.on=c,h.addListener=c,h.once=c,h.off=c,h.removeListener=c,h.removeAllListeners=c,h.emit=c,h.prependListener=c,h.prependOnceListener=c,h.listeners=function(t){return[]},h.binding=function(t){throw new Error("process.binding is not supported")},h.cwd=function(){return"/"},h.chdir=function(t){throw new Error("process.chdir is not supported")},h.umask=function(){return 0}},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(t,e,n){if(isNaN(e))return t;var r,i,o,a,u,s,c=t._root,l={data:n},f=t._x0,h=t._x1;if(!c)return t._root=l,t;for(;c.length;)if((a=e>=(i=(f+h)/2))?f=i:h=i,r=c,!(c=c[u=+a]))return r[u]=l,t;if(o=+t._x.call(null,c.data),e===o)return l.next=c,r?r[u]=l:t._root=l,t;do r=r?r[u]=new Array(2):t._root=new Array(2),(a=e>=(i=(f+h)/2))?f=i:h=i;while((u=+a)===(s=+(o>=i)));return r[s]=c,r[u]=l,t}function n(t){var n,r,i=t.length,o=new Array(i),a=1/0,u=-(1/0);for(n=0;n<i;++n)isNaN(r=+this._x.call(null,t[n]))||(o[n]=r,r<a&&(a=r),r>u&&(u=r));for(u<a&&(a=this._x0,u=this._x1),this.cover(a).cover(u),n=0;n<i;++n)e(this,o[n],t[n]);return this}function r(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function i(t){return t[0]}function o(t,e){var n=new a(null==e?i:e,NaN,NaN);return null==t?n:n.addAll(t)}function a(t,e,n){this._x=t,this._x0=e,this._x1=n,this._root=void 0}function u(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var s=function(t){var n=+this._x.call(null,t);return e(this.cover(n),n,t)},c=function(t){if(isNaN(t=+t))return this;var e=this._x0,n=this._x1;if(isNaN(e))n=(e=Math.floor(t))+1;else{if(!(e>t||t>n))return this;var r,i,o=n-e,a=this._root;switch(i=+(t<(e+n)/2)){case 0:do r=new Array(2),r[i]=a,a=r;while(o*=2,n=e+o,t>n);break;case 1:do r=new Array(2),r[i]=a,a=r;while(o*=2,e=n-o,e>t)}this._root&&this._root.length&&(this._root=a)}return this._x0=e,this._x1=n,this},l=function(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t},f=function(t){return arguments.length?this.cover(+t[0][0]).cover(+t[1][0]):isNaN(this._x0)?void 0:[[this._x0],[this._x1]]},h=function(t,e,n){this.node=t,this.x0=e,this.x1=n},p=function(t,e){var n,r,i,o,a,u=this._x0,s=this._x1,c=[],l=this._root;for(l&&c.push(new h(l,u,s)),null==e?e=1/0:(u=t-e,s=t+e);o=c.pop();)if(!(!(l=o.node)||(r=o.x0)>s||(i=o.x1)<u))if(l.length){var f=(r+i)/2;c.push(new h(l[1],f,i),new h(l[0],r,f)),(a=+(t>=f))&&(o=c[c.length-1],c[c.length-1]=c[c.length-1-a],c[c.length-1-a]=o)}else{var p=t-+this._x.call(null,l.data);p<e&&(e=p,u=t-p,s=t+p,n=l.data)}return n},d=function(t){if(isNaN(o=+this._x.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,l=this._root,f=this._x0,h=this._x1;if(!l)return this;if(l.length)for(;;){if((u=o>=(a=(f+h)/2))?f=a:h=a,e=l,!(l=l[s=+u]))return this;if(!l.length)break;e[s+1&1]&&(n=e,c=s)}for(;l.data!==t;)if(r=l,!(l=l.next))return this;return(i=l.next)&&delete l.next,r?(i?r.next=i:delete r.next,this):e?(i?e[s]=i:delete e[s],(l=e[0]||e[1])&&l===(e[1]||e[0])&&!l.length&&(n?n[c]=l:this._root=l),this):(this._root=i,this)},y=function(){return this._root},v=function(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t},_=function(t){var e,n,r,i,o=[],a=this._root;for(a&&o.push(new h(a,this._x0,this._x1));e=o.pop();)if(!t(a=e.node,r=e.x0,i=e.x1)&&a.length){var u=(r+i)/2;(n=a[1])&&o.push(new h(n,u,i)),(n=a[0])&&o.push(new h(n,r,u))}return this},x=function(t){var e,n=[],r=[];for(this._root&&n.push(new h(this._root,this._x0,this._x1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.x1,s=(a+u)/2;(o=i[0])&&n.push(new h(o,a,s)),(o=i[1])&&n.push(new h(o,s,u))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.x1);return this},g=function(t){return arguments.length?(this._x=t,this):this._x},w=o.prototype=a.prototype;w.copy=function(){var t,e,n=new a(this._x,this._x0,this._x1),r=this._root;if(!r)return n;if(!r.length)return n._root=u(r),n;for(t=[{source:r,target:n._root=new Array(2)}];r=t.pop();)for(var i=0;i<2;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(2)}):r.target[i]=u(e));return n},w.add=s,w.addAll=n,w.cover=c,w.data=l,w.extent=f,w.find=p,w.remove=d,w.removeAll=r,w.root=y,w.size=v,w.visit=_,w.visitAfter=x,w.x=g,t.binarytree=o,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,r){r(e,n(2),n(6),n(8),n(4),n(5),n(7))}(this,function(t,e,n,r,i,o,a){"use strict";function u(t){return t.x+t.vx}function s(t){return t.y+t.vy}function c(t){return t.z+t.vz}function l(t){return t.index}function f(t,e){var n=t.get(e);if(!n)throw new Error("missing: "+e);return n}function h(t){return t.x}function p(t){return t.y}function d(t){return t.z}var y=function(t,e,n){function r(){var r,o,a=i.length,u=0,s=0,c=0;for(r=0;r<a;++r)o=i[r],u+=o.x||0,s+=o.y||0,c+=o.z||0;for(u=u/a-t,s=s/a-e,c=c/a-n,r=0;r<a;++r)o=i[r],u&&(o.x-=u),s&&(o.y-=s),c&&(o.z-=c)}var i;return null==t&&(t=0),null==e&&(e=0),null==n&&(n=0),r.initialize=function(t){i=t},r.x=function(e){return arguments.length?(t=+e,r):t},r.y=function(t){return arguments.length?(e=+t,r):e},r.z=function(t){return arguments.length?(n=+t,r):n},r},v=function(t){return function(){return t}},_=function(){return 1e-6*(Math.random()-.5)},x=function(t){function i(){function t(t,e,n,r,i,o,a){var u=[e,n,r,i,o,a],s=u[0],c=u[1],l=u[2],h=u[f],d=u[f+1],T=u[f+2],N=t.data,b=t.r,z=w+b;if(!N)return s>v+z||h<v-z||f>1&&(c>x+z||d<x-z)||f>2&&(l>g+z||T<g-z);if(N.index>y.index){var A=v-N.x-N.vx,E=f>1?x-N.y-N.vy:0,k=f>2?g-N.z-N.vz:0,M=A*A+E*E+k*k;M<z*z&&(0===A&&(A=_(),M+=A*A),f>1&&0===E&&(E=_(),M+=E*E),f>2&&0===k&&(k=_(),M+=k*k),M=(z-(M=Math.sqrt(M)))/M*p,y.vx+=(A*=M)*(z=(b*=b)/(m+b)),f>1&&(y.vy+=(E*=M)*z),f>2&&(y.vz+=(k*=M)*z),N.vx-=A*(z=1-z),f>1&&(N.vy-=E*z),f>2&&(N.vz-=k*z))}}for(var i,a,y,v,x,g,w,m,T=l.length,N=0;N<d;++N)for(a=(1===f?e.binarytree(l,u):2===f?n.quadtree(l,u,s):3===f?r.octree(l,u,s,c):null).visitAfter(o),i=0;i<T;++i)y=l[i],w=h[y.index],m=w*w,v=y.x+y.vx,f>1&&(x=y.y+y.vy),f>2&&(g=y.z+y.vz),a.visit(t)}function o(t){if(t.data)return t.r=h[t.data.index];for(var e=t.r=0;e<Math.pow(2,f);++e)t[e]&&t[e].r>t.r&&(t.r=t[e].r)}function a(){if(l){var e,n,r=l.length;for(h=new Array(r),e=0;e<r;++e)n=l[e],h[n.index]=+t(n,e,l)}}var l,f,h,p=1,d=1;return"function"!=typeof t&&(t=v(null==t?1:+t)),i.initialize=function(t,e){l=t,f=e,a()},i.iterations=function(t){return arguments.length?(d=+t,i):d},i.strength=function(t){return arguments.length?(p=+t,i):p},i.radius=function(e){return arguments.length?(t="function"==typeof e?e:v(+e),a(),i):t},i},g=function(t){function e(t){return 1/Math.min(p[t.source.index],p[t.target.index])}function n(e){for(var n=0,r=t.length;n<w;++n)for(var i,o,a,c,l,f=0,p=0,y=0,v=0;f<r;++f)i=t[f],o=i.source,a=i.target,p=a.x+a.vx-o.x-o.vx||_(),h>1&&(y=a.y+a.vy-o.y-o.vy||_()),h>2&&(v=a.z+a.vz-o.z-o.vz||_()),c=Math.sqrt(p*p+y*y+v*v),c=(c-s[f])/c*e*u[f],p*=c,y*=c,v*=c,a.vx-=p*(l=d[f]),h>1&&(a.vy-=y*l),h>2&&(a.vz-=v*l),o.vx+=p*(l=1-l),h>1&&(o.vy+=y*l),h>2&&(o.vz+=v*l)}function r(){if(c){var e,n,r=c.length,l=t.length,h=i.map(c,y);for(e=0,p=new Array(r);e<l;++e)n=t[e],n.index=e,"object"!=typeof n.source&&(n.source=f(h,n.source)),"object"!=typeof n.target&&(n.target=f(h,n.target)),p[n.source.index]=(p[n.source.index]||0)+1,p[n.target.index]=(p[n.target.index]||0)+1;for(e=0,d=new Array(l);e<l;++e)n=t[e],d[e]=p[n.source.index]/(p[n.source.index]+p[n.target.index]);u=new Array(l),o(),s=new Array(l),a()}}function o(){if(c)for(var e=0,n=t.length;e<n;++e)u[e]=+x(t[e],e,t)}function a(){if(c)for(var e=0,n=t.length;e<n;++e)s[e]=+g(t[e],e,t)}var u,s,c,h,p,d,y=l,x=e,g=v(30),w=1;return null==t&&(t=[]),n.initialize=function(t,e){c=t,h=e,r()},n.links=function(e){return arguments.length?(t=e,r(),n):t},n.id=function(t){return arguments.length?(y=t,n):y},n.iterations=function(t){return arguments.length?(w=+t,n):w},n.strength=function(t){return arguments.length?(x="function"==typeof t?t:v(+t),o(),n):x},n.distance=function(t){return arguments.length?(g="function"==typeof t?t:v(+t),a(),n):g},n},w=3,m=10,T=Math.PI*(3-Math.sqrt(5)),N=Math.PI/24,b=function(t,e){function n(){r(),x.call("tick",c),f<h&&(_.stop(),x.call("end",c))}function r(){var e,n,r=t.length;for(f+=(d-f)*p,v.each(function(t){t(f)}),e=0;e<r;++e)n=t[e],null==n.fx?n.x+=n.vx*=y:(n.x=n.fx,n.vx=0),l>1&&(null==n.fy?n.y+=n.vy*=y:(n.y=n.fy,n.vy=0)),l>2&&(null==n.fz?n.z+=n.vz*=y:(n.z=n.fz,n.vz=0))}function u(){for(var e,n=0,r=t.length;n<r;++n){if(e=t[n],e.index=n,isNaN(e.x)||l>1&&isNaN(e.y)||l>2&&isNaN(e.z)){var i=m*(l>2?Math.cbrt(n):l>1?Math.sqrt(n):n),o=n*T,a=n*N;e.x=i*(l>1?Math.cos(o):1),l>1&&(e.y=i*Math.sin(o)),l>2&&(e.z=i*Math.sin(a))}(isNaN(e.vx)||l>1&&isNaN(e.vy)||l>2&&isNaN(e.vz))&&(e.vx=0,l>1&&(e.vy=0),l>2&&(e.vz=0))}}function s(e){return e.initialize&&e.initialize(t,l),e}e=e||2;var c,l=Math.min(w,Math.max(1,Math.round(e))),f=1,h=.001,p=1-Math.pow(h,1/300),d=0,y=.6,v=i.map(),_=a.timer(n),x=o.dispatch("tick","end");return null==t&&(t=[]),u(),c={tick:r,restart:function(){return _.restart(n),c},stop:function(){return _.stop(),c},numDimensions:function(t){return arguments.length?(l=Math.min(w,Math.max(1,Math.round(t))),v.each(s),c):l},nodes:function(e){return arguments.length?(t=e,u(),v.each(s),c):t},alpha:function(t){return arguments.length?(f=+t,c):f},alphaMin:function(t){return arguments.length?(h=+t,c):h},alphaDecay:function(t){return arguments.length?(p=+t,c):+p},alphaTarget:function(t){return arguments.length?(d=+t,c):d},velocityDecay:function(t){return arguments.length?(y=1-t,c):1-y},force:function(t,e){return arguments.length>1?(null==e?v.remove(t):v.set(t,s(e)),c):v.get(t)},find:function(){var e,n,r,i,o,a,u=Array.prototype.slice.call(arguments),s=u.shift()||0,c=(l>1?u.shift():null)||0,f=(l>2?u.shift():null)||0,h=u.shift()||1/0,p=0,d=t.length;for(h*=h,p=0;p<d;++p)o=t[p],e=s-o.x,n=c-(o.y||0),r=f-(o.z||0),i=e*e+n*n+r*r,i<h&&(a=o,h=i);return a},on:function(t,e){return arguments.length>1?(x.on(t,e),c):x.on(t)}}},z=function(){function t(t){var i,f=u.length,y=(1===s?e.binarytree(u,h):2===s?n.quadtree(u,h,p):3===s?r.octree(u,h,p,d):null).visitAfter(o);for(l=t,i=0;i<f;++i)c=u[i],y.visit(a)}function i(){if(u){var t,e,n=u.length;for(f=new Array(n),t=0;t<n;++t)e=u[t],f[e.index]=+y(e,t,u)}}function o(t){var e,n,r,i,o,a,u=0;if(t.length){for(r=i=o=a=0;a<4;++a)(e=t[a])&&(n=e.value)&&(u+=n,r+=n*(e.x||0),i+=n*(e.y||0),o+=n*(e.z||0));t.x=r/u,s>1&&(t.y=i/u),s>2&&(t.z=o/u)}else{e=t,e.x=e.data.x,s>1&&(e.y=e.data.y),s>2&&(e.z=e.data.z);do u+=f[e.data.index];while(e=e.next)}t.value=u}function a(t,e,n,r,i){if(!t.value)return!0;var o=[n,r,i][s-1],a=t.x-c.x,u=s>1?t.y-c.y:0,h=s>2?t.z-c.z:0,p=o-e,d=a*a+u*u+h*h;if(p*p/w<d)return d<g&&(0===a&&(a=_(),d+=a*a),s>1&&0===u&&(u=_(),d+=u*u),s>2&&0===h&&(h=_(),d+=h*h),d<x&&(d=Math.sqrt(x*d)),c.vx+=a*t.value*l/d,s>1&&(c.vy+=u*t.value*l/d),s>2&&(c.vz+=h*t.value*l/d)),!0;if(!(t.length||d>=g)){(t.data!==c||t.next)&&(0===a&&(a=_(),d+=a*a),s>1&&0===u&&(u=_(),d+=u*u),s>2&&0===h&&(h=_(),d+=h*h),d<x&&(d=Math.sqrt(x*d)));do t.data!==c&&(p=f[t.data.index]*l/d,c.vx+=a*p,s>1&&(c.vy+=u*p),s>2&&(c.vz+=h*p));while(t=t.next)}}var u,s,c,l,f,y=v(-30),x=1,g=1/0,w=.81;return t.initialize=function(t,e){u=t,s=e,i()},t.strength=function(e){return arguments.length?(y="function"==typeof e?e:v(+e),i(),t):y},t.distanceMin=function(e){return arguments.length?(x=e*e,t):Math.sqrt(x)},t.distanceMax=function(e){return arguments.length?(g=e*e,t):Math.sqrt(g)},t.theta=function(e){return arguments.length?(w=e*e,t):Math.sqrt(w)},t},A=function(t){function e(t){for(var e,n=0,a=r.length;n<a;++n)e=r[n],e.vx+=(o[n]-e.x)*i[n]*t}function n(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)i[e]=isNaN(o[e]=+t(r[e],e,r))?0:+a(r[e],e,r)}}var r,i,o,a=v(.1);return"function"!=typeof t&&(t=v(null==t?0:+t)),e.initialize=function(t){r=t,n()},e.strength=function(t){return arguments.length?(a="function"==typeof t?t:v(+t),n(),e):a},e.x=function(r){return arguments.length?(t="function"==typeof r?r:v(+r),n(),e):t},e},E=function(t){function e(t){for(var e,n=0,a=r.length;n<a;++n)e=r[n],e.vy+=(o[n]-e.y)*i[n]*t}function n(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)i[e]=isNaN(o[e]=+t(r[e],e,r))?0:+a(r[e],e,r)}}var r,i,o,a=v(.1);return"function"!=typeof t&&(t=v(null==t?0:+t)),e.initialize=function(t){r=t,n()},e.strength=function(t){return arguments.length?(a="function"==typeof t?t:v(+t),n(),e):a},e.y=function(r){return arguments.length?(t="function"==typeof r?r:v(+r),n(),e):t},e},k=function(t){function e(t){for(var e,n=0,a=r.length;n<a;++n)e=r[n],e.vz+=(o[n]-e.z)*i[n]*t}function n(){if(r){var e,n=r.length;for(i=new Array(n),o=new Array(n),e=0;e<n;++e)i[e]=isNaN(o[e]=+t(r[e],e,r))?0:+a(r[e],e,r)}}var r,i,o,a=v(.1);return"function"!=typeof t&&(t=v(null==t?0:+t)),e.initialize=function(t){r=t,n()},e.strength=function(t){return arguments.length?(a="function"==typeof t?t:v(+t),n(),e):a},e.z=function(r){return arguments.length?(t="function"==typeof r?r:v(+r),n(),e):t},e};t.forceCenter=y,t.forceCollide=x,t.forceLink=g,t.forceManyBody=z,t.forceSimulation=b,t.forceX=A,t.forceY=E,t.forceZ=k,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){}function n(t,n){var r=new e;if(t instanceof e)t.each(function(t,e){r.set(e,t)});else if(Array.isArray(t)){var i,o=-1,a=t.length;if(null==n)for(;++o<a;)r.set(o,t[o]);else for(;++o<a;)r.set(n(i=t[o],o,t),i)}else if(t)for(var u in t)r.set(u,t[u]);return r}function r(){return{}}function i(t,e,n){t[e]=n}function o(){return n()}function a(t,e,n){t.set(e,n)}function u(){}function s(t,e){var n=new u;if(t instanceof u)t.each(function(t){n.add(t)});else if(t){var r=-1,i=t.length;if(null==e)for(;++r<i;)n.add(t[r]);else for(;++r<i;)n.add(e(t[r],r,t))}return n}var c="$";e.prototype=n.prototype={constructor:e,has:function(t){return c+t in this},get:function(t){return this[c+t]},set:function(t,e){return this[c+t]=e,this},remove:function(t){var e=c+t;return e in this&&delete this[e]},clear:function(){for(var t in this)t[0]===c&&delete this[t]},keys:function(){var t=[];for(var e in this)e[0]===c&&t.push(e.slice(1));return t},values:function(){var t=[];for(var e in this)e[0]===c&&t.push(this[e]);return t},entries:function(){var t=[];for(var e in this)e[0]===c&&t.push({key:e.slice(1),value:this[e]});return t},size:function(){var t=0;for(var e in this)e[0]===c&&++t;return t},empty:function(){for(var t in this)if(t[0]===c)return!1;return!0},each:function(t){for(var e in this)e[0]===c&&t(this[e],e.slice(1),this)}};var l=function(){function t(e,r,i,o){if(r>=l.length)return null!=s?s(e):null!=u?e.sort(u):e;for(var a,c,f,h=-1,p=e.length,d=l[r++],y=n(),v=i();++h<p;)(f=y.get(a=d(c=e[h])+""))?f.push(c):y.set(a,[c]);return y.each(function(e,n){o(v,n,t(e,r,i,o))}),v}function e(t,n){if(++n>l.length)return t;var r,i=f[n-1];return null!=s&&n>=l.length?r=t.entries():(r=[],t.each(function(t,i){r.push({key:i,values:e(t,n)})})),null!=i?r.sort(function(t,e){return i(t.key,e.key)}):r}var u,s,c,l=[],f=[];return c={object:function(e){return t(e,0,r,i)},map:function(e){return t(e,0,o,a)},entries:function(n){return e(t(n,0,o,a),0)},key:function(t){return l.push(t),c},sortKeys:function(t){return f[l.length-1]=t,c},sortValues:function(t){return u=t,c},rollup:function(t){return s=t,c}}},f=n.prototype;u.prototype=s.prototype={constructor:u,has:f.has,add:function(t){return t+="",this[c+t]=t,this},remove:f.remove,clear:f.clear,values:f.keys,size:f.size,empty:f.empty,each:f.each};var h=function(t){var e=[];for(var n in t)e.push(n);return e},p=function(t){var e=[];for(var n in t)e.push(t[n]);return e},d=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e};t.nest=l,t.set=s,t.map=n,t.keys=h,t.values=p,t.entries=d,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){for(var t,e=0,r=arguments.length,i={};e<r;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new n(i)}function n(t){this._=t}function r(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",r=t.indexOf(".");if(r>=0&&(n=t.slice(r+1),t=t.slice(0,r)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}function i(t,e){for(var n,r=0,i=t.length;r<i;++r)if((n=t[r]).name===e)return n.value}function o(t,e,n){for(var r=0,i=t.length;r<i;++r)if(t[r].name===e){t[r]=a,t=t.slice(0,r).concat(t.slice(r+1));break}return null!=n&&t.push({name:e,value:n}),t}var a={value:function(){}};n.prototype=e.prototype={constructor:n,on:function(t,e){var n,a=this._,u=r(t+"",a),s=-1,c=u.length;{if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++s<c;)if(n=(t=u[s]).type)a[n]=o(a[n],t.name,e);else if(null==e)for(n in a)a[n]=o(a[n],t.name,null);return this}for(;++s<c;)if((n=(t=u[s]).type)&&(n=i(a[n],t.name)))return n}},copy:function(){var t={},e=this._;for(var r in e)t[r]=e[r].slice();return new n(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,r,i=new Array(n),o=0;o<n;++o)i[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(r=this._[t],o=0,n=r.length;o<n;++o)r[o].value.apply(e,i)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],i=0,o=r.length;i<o;++i)r[i].value.apply(e,n)}},t.dispatch=e,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(t,e,n,r){if(isNaN(e)||isNaN(n))return t;var i,o,a,u,s,c,l,f,h,p=t._root,d={data:r},y=t._x0,v=t._y0,_=t._x1,x=t._y1;if(!p)return t._root=d,t;for(;p.length;)if((c=e>=(o=(y+_)/2))?y=o:_=o,(l=n>=(a=(v+x)/2))?v=a:x=a,i=p,!(p=p[f=l<<1|c]))return i[f]=d,t;if(u=+t._x.call(null,p.data),s=+t._y.call(null,p.data),e===u&&n===s)return d.next=p,i?i[f]=d:t._root=d,t;do i=i?i[f]=new Array(4):t._root=new Array(4),(c=e>=(o=(y+_)/2))?y=o:_=o,(l=n>=(a=(v+x)/2))?v=a:x=a;while((f=l<<1|c)===(h=(s>=a)<<1|u>=o));return i[h]=p,i[f]=d,t}function n(t){var n,r,i,o,a=t.length,u=new Array(a),s=new Array(a),c=1/0,l=1/0,f=-(1/0),h=-(1/0);for(r=0;r<a;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(o=+this._y.call(null,n))||(u[r]=i,s[r]=o,i<c&&(c=i),i>f&&(f=i),o<l&&(l=o),o>h&&(h=o));for(f<c&&(c=this._x0,f=this._x1),h<l&&(l=this._y0,h=this._y1),this.cover(c,l).cover(f,h),r=0;r<a;++r)e(this,u[r],s[r],t[r]);return this}function r(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function i(t){return t[0]}function o(t){return t[1]}function a(t,e,n){var r=new u(null==e?i:e,null==n?o:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function u(t,e,n,r,i,o){this._x=t,this._y=e,this._x0=n,this._y0=r,this._x1=i,this._y1=o,this._root=void 0}function s(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var c=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t);return e(this.cover(n,r),n,r,t)},l=function(t,e){if(isNaN(t=+t)||isNaN(e=+e))return this;var n=this._x0,r=this._y0,i=this._x1,o=this._y1;if(isNaN(n))i=(n=Math.floor(t))+1,o=(r=Math.floor(e))+1;else{if(!(n>t||t>i||r>e||e>o))return this;var a,u,s=i-n,c=this._root;switch(u=(e<(r+o)/2)<<1|t<(n+i)/2){case 0:do a=new Array(4),a[u]=c,c=a;while(s*=2,i=n+s,o=r+s,t>i||e>o);break;case 1:do a=new Array(4),a[u]=c,c=a;while(s*=2,n=i-s,o=r+s,n>t||e>o);break;case 2:do a=new Array(4),a[u]=c,c=a;while(s*=2,i=n+s,r=o-s,t>i||r>e);break;case 3:do a=new Array(4),a[u]=c,c=a;while(s*=2,n=i-s,r=o-s,n>t||r>e)}this._root&&this._root.length&&(this._root=c)}return this._x0=n,this._y0=r,this._x1=i,this._y1=o,this},f=function(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t},h=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1]).cover(+t[1][0],+t[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]},p=function(t,e,n,r,i){this.node=t,this.x0=e,this.y0=n,this.x1=r,this.y1=i},d=function(t,e,n){var r,i,o,a,u,s,c,l=this._x0,f=this._y0,h=this._x1,d=this._y1,y=[],v=this._root;for(v&&y.push(new p(v,l,f,h,d)),null==n?n=1/0:(l=t-n,f=e-n,h=t+n,d=e+n,n*=n);s=y.pop();)if(!(!(v=s.node)||(i=s.x0)>h||(o=s.y0)>d||(a=s.x1)<l||(u=s.y1)<f))if(v.length){var _=(i+a)/2,x=(o+u)/2;y.push(new p(v[3],_,x,a,u),new p(v[2],i,x,_,u),new p(v[1],_,o,a,x),new p(v[0],i,o,_,x)),(c=(e>=x)<<1|t>=_)&&(s=y[y.length-1],y[y.length-1]=y[y.length-1-c],y[y.length-1-c]=s)}else{var g=t-+this._x.call(null,v.data),w=e-+this._y.call(null,v.data),m=g*g+w*w;if(m<n){var T=Math.sqrt(n=m);l=t-T,f=e-T,h=t+T,d=e+T,r=v.data}}return r},y=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,l,f,h,p=this._root,d=this._x0,y=this._y0,v=this._x1,_=this._y1;if(!p)return this;if(p.length)for(;;){if((c=o>=(u=(d+v)/2))?d=u:v=u,(l=a>=(s=(y+_)/2))?y=s:_=s,e=p,!(p=p[f=l<<1|c]))return this;if(!p.length)break;(e[f+1&3]||e[f+2&3]||e[f+3&3])&&(n=e,h=f)}for(;p.data!==t;)if(r=p,!(p=p.next))return this;return(i=p.next)&&delete p.next,r?(i?r.next=i:delete r.next,this):e?(i?e[f]=i:delete e[f],(p=e[0]||e[1]||e[2]||e[3])&&p===(e[3]||e[2]||e[1]||e[0])&&!p.length&&(n?n[h]=p:this._root=p),this):(this._root=i,this)},v=function(){return this._root},_=function(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t},x=function(t){var e,n,r,i,o,a,u=[],s=this._root;for(s&&u.push(new p(s,this._x0,this._y0,this._x1,this._y1));e=u.pop();)if(!t(s=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&s.length){var c=(r+o)/2,l=(i+a)/2;(n=s[3])&&u.push(new p(n,c,l,o,a)),(n=s[2])&&u.push(new p(n,r,l,c,a)),(n=s[1])&&u.push(new p(n,c,i,o,l)),(n=s[0])&&u.push(new p(n,r,i,c,l))}return this},g=function(t){var e,n=[],r=[];for(this._root&&n.push(new p(this._root,this._x0,this._y0,this._x1,this._y1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.x1,c=e.y1,l=(a+s)/2,f=(u+c)/2;(o=i[0])&&n.push(new p(o,a,u,l,f)),(o=i[1])&&n.push(new p(o,l,u,s,f)),(o=i[2])&&n.push(new p(o,a,f,l,c)),(o=i[3])&&n.push(new p(o,l,f,s,c))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.x1,e.y1);return this},w=function(t){return arguments.length?(this._x=t,this):this._x},m=function(t){return arguments.length?(this._y=t,this):this._y},T=a.prototype=u.prototype;T.copy=function(){var t,e,n=new u(this._x,this._y,this._x0,this._y0,this._x1,this._y1),r=this._root;if(!r)return n;if(!r.length)return n._root=s(r),n;for(t=[{source:r,target:n._root=new Array(4)}];r=t.pop();)for(var i=0;i<4;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(4)}):r.target[i]=s(e));return n},T.add=c,T.addAll=n,T.cover=l,T.data=f,T.extent=h,T.find=d,T.remove=y,T.removeAll=r,T.root=v,T.size=_,T.visit=x,T.visitAfter=g,T.x=w,T.y=m,t.quadtree=a,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(){return _||(w(n),_=g.now()+x)}function n(){_=0}function r(){this._call=this._time=this._next=null}function i(t,e,n){var i=new r;return i.restart(t,e,n),i}function o(){e(),++h;for(var t,n=l;n;)(t=_-n._time)>=0&&n._call.call(null,t),n=n._next;--h}function a(){_=(v=g.now())+x,h=p=0;try{o()}finally{h=0,s(),_=0}}function u(){var t=g.now(),e=t-v;e>y&&(x-=e,v=t)}function s(){for(var t,e,n=l,r=1/0;n;)n._call?(r>n._time&&(r=n._time),t=n,n=n._next):(e=n._next,n._next=null,n=t?t._next=e:l=e);f=t,c(r)}function c(t){if(!h){p&&(p=clearTimeout(p));var e=t-_;e>24?(t<1/0&&(p=setTimeout(a,e)),d&&(d=clearInterval(d))):(d||(v=_,d=setInterval(u,y)),h=1,w(a))}}var l,f,h=0,p=0,d=0,y=1e3,v=0,_=0,x=0,g="object"==typeof performance&&performance.now?performance:Date,w="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){setTimeout(t,17)};r.prototype=i.prototype={constructor:r,restart:function(t,n,r){if("function"!=typeof t)throw new TypeError("callback is not a function");r=(null==r?e():+r)+(null==n?0:+n),this._next||f===this||(f?f._next=this:l=this,f=this),this._call=t,this._time=r,c()},stop:function(){this._call&&(this._call=null,this._time=1/0,c())}};var m=function(t,e,n){var i=new r;return e=null==e?0:+e,i.restart(function(n){i.stop(),t(n+e)},e,n),i},T=function(t,n,i){var o=new r,a=n;return null==n?(o.restart(t,n,i),o):(n=+n,i=null==i?e():+i,o.restart(function e(r){r+=a,o.restart(e,a+=n,i),t(r)},n,i),o)};t.now=e,t.timer=i,t.timerFlush=o,t.timeout=m,t.interval=T,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){!function(t,n){n(e)}(this,function(t){"use strict";function e(t,e,n,r,i){if(isNaN(e)||isNaN(n)||isNaN(r))return t;var o,a,u,s,c,l,f,h,p,d,y,v,_=t._root,x={data:i},g=t._x0,w=t._y0,m=t._z0,T=t._x1,N=t._y1,b=t._z1;if(!_)return t._root=x,t;for(;_.length;)if((h=e>=(a=(g+T)/2))?g=a:T=a,(p=n>=(u=(w+N)/2))?w=u:N=u,(d=r>=(s=(m+b)/2))?m=s:b=s,o=_,!(_=_[y=d<<2|p<<1|h]))return o[y]=x,t;if(c=+t._x.call(null,_.data),l=+t._y.call(null,_.data),f=+t._z.call(null,_.data),e===c&&n===l&&r===f)return x.next=_,o?o[y]=x:t._root=x,t;do o=o?o[y]=new Array(8):t._root=new Array(8),(h=e>=(a=(g+T)/2))?g=a:T=a,(p=n>=(u=(w+N)/2))?w=u:N=u,(d=r>=(s=(m+b)/2))?m=s:b=s;while((y=d<<2|p<<1|h)===(v=(f>=s)<<2|(l>=u)<<1|c>=a));return o[v]=_,o[y]=x,t}function n(t){var n,r,i,o,a,u=t.length,s=new Array(u),c=new Array(u),l=new Array(u),f=1/0,h=1/0,p=1/0,d=-(1/0),y=-(1/0),v=-(1/0);for(r=0;r<u;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(o=+this._y.call(null,n))||isNaN(a=+this._z.call(null,n))||(s[r]=i,c[r]=o,l[r]=a,i<f&&(f=i),i>d&&(d=i),o<h&&(h=o),o>y&&(y=o),a<p&&(p=a),a>v&&(v=a));for(d<f&&(f=this._x0,d=this._x1),y<h&&(h=this._y0,y=this._y1),v<p&&(p=this._z0,v=this._z1),this.cover(f,h,p).cover(d,y,v),r=0;r<u;++r)e(this,s[r],c[r],l[r],t[r]);return this}function r(t){for(var e=0,n=t.length;e<n;++e)this.remove(t[e]);return this}function i(t){return t[0]}function o(t){return t[1]}function a(t){return t[2]}function u(t,e,n,r){var u=new s(null==e?i:e,null==n?o:n,null==r?a:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?u:u.addAll(t)}function s(t,e,n,r,i,o,a,u,s){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=u,this._z1=s,this._root=void 0}function c(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var l=function(t){var n=+this._x.call(null,t),r=+this._y.call(null,t),i=+this._z.call(null,t);return e(this.cover(n,r,i),n,r,i,t)},f=function(t,e,n){if(isNaN(t=+t)||isNaN(e=+e)||isNaN(n=+n))return this;var r=this._x0,i=this._y0,o=this._z0,a=this._x1,u=this._y1,s=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,u=(i=Math.floor(e))+1,s=(o=Math.floor(n))+1;else{if(!(r>t||t>a||i>e||e>u||o>n||n>s))return this;var c,l,f=a-r,h=this._root;switch(l=(n<(o+s)/2)<<2|(e<(i+u)/2)<<1|t<(r+a)/2){case 0:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,u=i+f,s=o+f,t>a||e>u||n>s);break;
case 1:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,u=i+f,s=o+f,r>t||e>u||n>s);break;case 2:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,i=u-f,s=o+f,t>a||i>e||n>s);break;case 3:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,i=u-f,s=o+f,r>t||i>e||n>s);break;case 4:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,u=i+f,o=s-f,t>a||e>u||o>n);break;case 5:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,u=i+f,o=s-f,r>t||e>u||o>n);break;case 6:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,i=u-f,o=s-f,t>a||i>e||o>n);break;case 7:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,i=u-f,o=s-f,r>t||i>e||o>n)}this._root&&this._root.length&&(this._root=h)}return this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=u,this._z1=s,this},h=function(){var t=[];return this.visit(function(e){if(!e.length)do t.push(e.data);while(e=e.next)}),t},p=function(t){return arguments.length?this.cover(+t[0][0],+t[0][1],+t[0][2]).cover(+t[1][0],+t[1][1],+t[1][2]):isNaN(this._x0)?void 0:[[this._x0,this._y0,this._z0],[this._x1,this._y1,this._z1]]},d=function(t,e,n,r,i,o,a){this.node=t,this.x0=e,this.y0=n,this.z0=r,this.x1=i,this.y1=o,this.z1=a},y=function(t,e,n,r){var i,o,a,u,s,c,l,f,h,p=this._x0,y=this._y0,v=this._z0,_=this._x1,x=this._y1,g=this._z1,w=[],m=this._root;for(m&&w.push(new d(m,p,y,v,_,x,g)),null==r?r=1/0:(p=t-r,y=e-r,v=n-r,_=t+r,x=e+r,g=n+r,r*=r);f=w.pop();)if(!(!(m=f.node)||(o=f.x0)>_||(a=f.y0)>x||(u=f.z0)>g||(s=f.x1)<p||(c=f.y1)<y||(l=f.z1)<v))if(m.length){var T=(o+s)/2,N=(a+c)/2,b=(u+l)/2;w.push(new d(m[7],T,N,b,s,c,l),new d(m[6],o,N,b,T,c,l),new d(m[5],T,a,b,s,N,l),new d(m[4],o,a,b,T,N,l),new d(m[3],T,N,u,s,c,b),new d(m[2],o,N,u,T,c,b),new d(m[1],T,a,u,s,N,b),new d(m[0],o,a,u,T,N,b)),(h=(n>=b)<<2|(e>=N)<<1|t>=T)&&(f=w[w.length-1],w[w.length-1]=w[w.length-1-h],w[w.length-1-h]=f)}else{var z=t-+this._x.call(null,m.data),A=e-+this._y.call(null,m.data),E=n-+this._z.call(null,m.data),k=z*z+A*A+E*E;if(k<r){var M=Math.sqrt(r=k);p=t-M,y=e-M,v=n-M,_=t+M,x=e+M,g=n+M,i=m.data}}return i},v=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(u=+this._z.call(null,t)))return this;var e,n,r,i,o,a,u,s,c,l,f,h,p,d,y,v=this._root,_=this._x0,x=this._y0,g=this._z0,w=this._x1,m=this._y1,T=this._z1;if(!v)return this;if(v.length)for(;;){if((f=o>=(s=(_+w)/2))?_=s:w=s,(h=a>=(c=(x+m)/2))?x=c:m=c,(p=u>=(l=(g+T)/2))?g=l:T=l,e=v,!(v=v[d=p<<2|h<<1|f]))return this;if(!v.length)break;(e[d+1&7]||e[d+2&7]||e[d+3&7]||e[d+4&7]||e[d+5&7]||e[d+6&7]||e[d+7&7])&&(n=e,y=d)}for(;v.data!==t;)if(r=v,!(v=v.next))return this;return(i=v.next)&&delete v.next,r?(i?r.next=i:delete r.next,this):e?(i?e[d]=i:delete e[d],(v=e[0]||e[1]||e[2]||e[3]||e[4]||e[5]||e[6]||e[7])&&v===(e[7]||e[6]||e[5]||e[4]||e[3]||e[2]||e[1]||e[0])&&!v.length&&(n?n[y]=v:this._root=v),this):(this._root=i,this)},_=function(){return this._root},x=function(){var t=0;return this.visit(function(e){if(!e.length)do++t;while(e=e.next)}),t},g=function(t){var e,n,r,i,o,a,u,s,c=[],l=this._root;for(l&&c.push(new d(l,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=c.pop();)if(!t(l=e.node,r=e.x0,i=e.y0,o=e.z0,a=e.x1,u=e.y1,s=e.z1)&&l.length){var f=(r+a)/2,h=(i+u)/2,p=(o+s)/2;(n=l[7])&&c.push(new d(n,f,h,p,a,u,s)),(n=l[6])&&c.push(new d(n,r,h,p,f,u,s)),(n=l[5])&&c.push(new d(n,f,i,p,a,h,s)),(n=l[4])&&c.push(new d(n,r,i,p,f,h,s)),(n=l[3])&&c.push(new d(n,f,h,o,a,u,p)),(n=l[2])&&c.push(new d(n,r,h,o,f,u,p)),(n=l[1])&&c.push(new d(n,f,i,o,a,h,p)),(n=l[0])&&c.push(new d(n,r,i,o,f,h,p))}return this},w=function(t){var e,n=[],r=[];for(this._root&&n.push(new d(this._root,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1));e=n.pop();){var i=e.node;if(i.length){var o,a=e.x0,u=e.y0,s=e.z0,c=e.x1,l=e.y1,f=e.z1,h=(a+c)/2,p=(u+l)/2,y=(s+f)/2;(o=i[0])&&n.push(new d(o,a,u,s,h,p,y)),(o=i[1])&&n.push(new d(o,h,u,s,c,p,y)),(o=i[2])&&n.push(new d(o,a,p,s,h,l,y)),(o=i[3])&&n.push(new d(o,h,p,s,c,l,y)),(o=i[4])&&n.push(new d(o,a,u,y,h,p,f)),(o=i[5])&&n.push(new d(o,h,u,y,c,p,f)),(o=i[6])&&n.push(new d(o,a,p,y,h,l,f)),(o=i[7])&&n.push(new d(o,h,p,y,c,l,f))}r.push(e)}for(;e=r.pop();)t(e.node,e.x0,e.y0,e.z0,e.x1,e.y1,e.z1);return this},m=function(t){return arguments.length?(this._x=t,this):this._x},T=function(t){return arguments.length?(this._y=t,this):this._y},N=function(t){return arguments.length?(this._z=t,this):this._z},b=u.prototype=s.prototype;b.copy=function(){var t,e,n=new s(this._x,this._y,this._z,this._x0,this._y0,this._z0,this._x1,this._y1,this._z1),r=this._root;if(!r)return n;if(!r.length)return n._root=c(r),n;for(t=[{source:r,target:n._root=new Array(8)}];r=t.pop();)for(var i=0;i<8;++i)(e=r.source[i])&&(e.length?t.push({source:e,target:r.target[i]=new Array(8)}):r.target[i]=c(e));return n},b.add=l,b.addAll=n,b.cover=f,b.data=h,b.extent=p,b.find=y,b.remove=v,b.removeAll=r,b.root=_,b.size=x,b.visit=g,b.visitAfter=w,b.x=m,b.y=T,b.z=N,t.octree=u,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){var r,i;/**
!function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){if("undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");var o={graph:n(47),forcelayout:n(13),forcelayout3d:n(25)},r=n(51);AFRAME.registerComponent("forcegraph",{schema:{jsonUrl:{type:"string"},nodes:{parse:JSON.parse,default:"[]"},links:{parse:JSON.parse,default:"[]"},numDimensions:{type:"number",default:3},nodeRelSize:{type:"number",default:4},lineOpacity:{type:"number",default:.2},autoColorBy:{type:"string"},idField:{type:"string",default:"id"},valField:{type:"string",default:"val"},nameField:{type:"string",default:"name"},colorField:{type:"string",default:"color"},linkSourceField:{type:"string",default:"source"},linkTargetField:{type:"string",default:"target"},warmupTicks:{type:"int",default:0},cooldownTicks:{type:"int",default:1/0},cooldownTime:{type:"int",default:15e3}},init:function(){this.data.tooltipEl=document.createElement("a-text"),document.querySelector("a-entity[camera], a-camera").appendChild(this.data.tooltipEl),this.data.tooltipEl.setAttribute("position","0 -0.7 -1"),this.data.tooltipEl.setAttribute("width",2),this.data.tooltipEl.setAttribute("align","center"),this.data.tooltipEl.setAttribute("color","lavender"),this.data.tooltipEl.setAttribute("value",""),this.cameraObj=document.querySelector("[camera], a-camera").object3D.children.filter(function(t){return"PerspectiveCamera"===t.type})[0]},remove:function(){this.data.tooltipEl.remove()},update:function(t){function e(){(d++>s.cooldownTicks||new Date-h>s.cooldownTime)&&(this.onFrame=null),p.step(),s.nodes.forEach(function(t){var e=t.__sphere,n=p.getNodePosition(t[s.idField]);e.position.x=n.x,e.position.y=n.y||0,e.position.z=n.z||0}),s.links.forEach(function(t){var e=t.__line,n=p.getLinkPosition(c.getLink(t.source,t.target).id);e.geometry.vertices=[new THREE.Vector3(n.from.x,n.from.y||0,n.from.z||0),new THREE.Vector3(n.to.x,n.to.y||0,n.to.z||0)],e.geometry.verticesNeedUpdate=!0,e.geometry.computeBoundingSphere()})}function n(t,e,n){if(e){var o=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],r=t.filter(function(t){return!t[n]}),i={};r.forEach(function(t){i[t[e]]=null}),Object.keys(i).forEach(function(t,e){i[t]=e}),r.forEach(function(t){t[n]=parseInt(o[i[t[e]]%o.length].slice(1),16)})}}var i=this,s=this.data,a=AFRAME.utils.diff(s,t);this.onFrame=null,"jsonUrl"in a&&s.jsonUrl&&r.get(s.jsonUrl).then(function(t,e){s.nodes=e.nodes,s.links=e.links,i.update(s)}),n(s.nodes,s.autoColorBy,s.colorField),s.links.forEach(function(t){t.source=t[s.linkSourceField],t.target=t[s.linkTargetField],t.id=[t.source,t.target].join(" > ")});var u=this.el.object3D;u.children.forEach(u.remove),s.nodes.forEach(function(t){var e=new THREE.MeshLambertMaterial({color:t[s.colorField]||16777130,transparent:!0});e.opacity=.75;var n=new THREE.Mesh(new THREE.SphereGeometry(Math.cbrt(t[s.valField]||1)*s.nodeRelSize,8,8),e);n.name=t[s.nameField],u.add(t.__sphere=n)});var f=new THREE.LineBasicMaterial({color:15790320,transparent:!0});f.opacity=s.lineOpacity,s.links.forEach(function(t){var e=new THREE.Line(new THREE.Geometry,f);e.geometry.vertices=[new THREE.Vector3(0,0,0),new THREE.Vector3(0,0,0)],u.add(t.__line=e)});var c=o.graph();s.nodes.forEach(function(t){c.addNode(t[s.idField])}),s.links.forEach(function(t){c.addLink(t.source,t.target)});for(var p=o["forcelayout"+(2===s.numDimensions?"":"3d")](c),l=0;l<s.warmupTicks;l++)p.step();var d=0,h=new Date;this.onFrame=e},tick:function(t,e){var n=new THREE.Raycaster;n.setFromCamera(new THREE.Vector2(0,0),this.cameraObj);var o=n.intersectObjects(this.el.object3D.children).filter(function(t){return t.object.name});this.data.tooltipEl.setAttribute("value",o.length?o[0].object.name:""),this.onFrame&&this.onFrame()}})},function(t,e){function n(t,e){var o;if(t||(t={}),e)for(o in e)if(e.hasOwnProperty(o)){var r=t.hasOwnProperty(o),i=typeof e[o],s=!r||typeof t[o]!==i;s?t[o]=e[o]:"object"===i&&(t[o]=n(t[o],e[o]))}return t}t.exports=n},function(t,e){function n(t){var e="number"==typeof t?t:+new Date,n=function(){return e=e+2127912214+(e<<12)&4294967295,e=4294967295&(3345072700^e^e>>>19),e=e+374761393+(e<<5)&4294967295,e=4294967295&(e+3550635116^e<<9),e=e+4251993797+(e<<3)&4294967295,e=4294967295&(3042594569^e^e>>>16),(268435455&e)/268435456};return{next:function(t){return Math.floor(n()*t)},nextDouble:function(){return n()}}}function o(t,e){var o=e||n();if("function"!=typeof o.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var n,r,i;for(n=t.length-1;n>0;--n)r=o.next(n+1),i=t[r],t[r]=t[n],t[n]=i,e(i);t.length&&e(t[0])},shuffle:function(){var e,n,r;for(e=t.length-1;e>0;--e)n=o.next(e+1),r=t[n],t[n]=t[e],t[e]=r;return t}}}t.exports={random:n,randomIterator:o}},function(t,e){function n(t,e,n){var r="[object Array]"===Object.prototype.toString.call(n);if(r)for(var i=0;i<n.length;++i)o(t,e,n[i]);else for(var s in t)o(t,e,s)}function o(t,e,n){if(t.hasOwnProperty(n)){if("function"==typeof e[n])return;e[n]=function(o){return void 0!==o?(t[n]=o,e):t[n]}}}t.exports=n},function(t,e){function n(t,e,n){var r="[object Array]"===Object.prototype.toString.call(n);if(r)for(var i=0;i<n.length;++i)o(t,e,n[i]);else for(var s in t)o(t,e,s)}function o(t,e,n){if(t.hasOwnProperty(n)){if("function"==typeof e[n])return;e[n]=function(o){return void 0!==o?(t[n]=o,e):t[n]}}}t.exports=n},function(t,e){function n(t,e){var o;if(t||(t={}),e)for(o in e)if(e.hasOwnProperty(o)){var r=t.hasOwnProperty(o),i=typeof e[o],s=!r||typeof t[o]!==i;s?t[o]=e[o]:"object"===i&&(t[o]=n(t[o],e[o]))}return t}t.exports=n},function(t,e){function n(t){var e="number"==typeof t?t:+new Date,n=function(){return e=e+2127912214+(e<<12)&4294967295,e=4294967295&(3345072700^e^e>>>19),e=e+374761393+(e<<5)&4294967295,e=4294967295&(e+3550635116^e<<9),e=e+4251993797+(e<<3)&4294967295,e=4294967295&(3042594569^e^e>>>16),(268435455&e)/268435456};return{next:function(t){return Math.floor(n()*t)},nextDouble:function(){return n()}}}function o(t,e){var o=e||n();if("function"!=typeof o.next)throw new Error("customRandom does not match expected API: next() function is missing");return{forEach:function(e){var n,r,i;for(n=t.length-1;n>0;--n)r=o.next(n+1),i=t[r],t[r]=t[n],t[n]=i,e(i);t.length&&e(t[0])},shuffle:function(){var e,n,r;for(e=t.length-1;e>0;--e)n=o.next(e+1),r=t[n],t[n]=t[e],t[e]=r;return t}}}t.exports={random:n,randomIterator:o}},function(t,e){function n(t){var e=Object.create(null);return{on:function(n,o,r){if("function"!=typeof o)throw new Error("callback is expected to be a function");var i=e[n];return i||(i=e[n]=[]),i.push({callback:o,ctx:r}),t},off:function(n,o){var r="undefined"==typeof n;if(r)return e=Object.create(null),t;if(e[n]){var i="function"!=typeof o;if(i)delete e[n];else for(var s=e[n],a=0;a<s.length;++a)s[a].callback===o&&s.splice(a,1)}return t},fire:function(n){var o=e[n];if(!o)return t;var r;arguments.length>1&&(r=Array.prototype.splice.call(arguments,1));for(var i=0;i<o.length;++i){var s=o[i];s.callback.apply(s.ctx,r)}return t}}}function o(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(t.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}t.exports=function(t){o(t);var e=n(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,n){function o(t){function e(){var t,e=d.length;if(e)for(y.insertBodies(d);e--;)t=d[e],t.isPinned||(t.force.reset(),y.updateBodyForce(t),g.update(t));for(e=h.length;e--;)m.update(h[e])}var o=n(18),r=n(4),i=n(5),s=n(7);t=i(t,{springLength:30,springCoeff:8e-4,gravity:-1.2,theta:.8,dragCoeff:.02,timeStep:20});var a=t.createQuadTree||n(21),u=t.createBounds||n(14),f=t.createDragForce||n(16),c=t.createSpringForce||n(19),p=t.integrator||n(17),l=t.createBody||n(15),d=[],h=[],y=a(t),v=u(d,t),m=c(t),g=f(t),x=0,b={bodies:d,quadTree:y,springs:h,settings:t,step:function(){e();var n=p(d,t.timeStep);return v.update(),n},addBody:function(t){if(!t)throw new Error("Body is required");return d.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=l(t);return d.push(e),e},removeBody:function(t){if(t){var e=d.indexOf(t);if(!(e<0))return d.splice(e,1),0===d.length&&v.reset(),!0}},addSpring:function(t,e,n,r,i){if(!t||!e)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var s=new o(t,e,n,i>=0?i:-1,r);return h.push(s),s},getTotalMovement:function(){return x},removeSpring:function(t){if(t){var e=h.indexOf(t);return e>-1?(h.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return v.getBestNewPosition(t)},getBBox:function(){return v.box},gravity:function(e){return void 0!==e?(t.gravity=e,y.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,y.options({theta:e}),this):t.theta}};return r(t,b),s(b),b}t.exports=o},function(t,e){function n(t){var e=Object.create(null);return{on:function(n,o,r){if("function"!=typeof o)throw new Error("callback is expected to be a function");var i=e[n];return i||(i=e[n]=[]),i.push({callback:o,ctx:r}),t},off:function(n,o){var r="undefined"==typeof n;if(r)return e=Object.create(null),t;if(e[n]){var i="function"!=typeof o;if(i)delete e[n];else for(var s=e[n],a=0;a<s.length;++a)s[a].callback===o&&s.splice(a,1)}return t},fire:function(n){var o=e[n];if(!o)return t;var r;arguments.length>1&&(r=Array.prototype.splice.call(arguments,1));for(var i=0;i<o.length;++i){var s=o[i];s.callback.apply(s.ctx,r)}return t}}}function o(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(t.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}t.exports=function(t){o(t);var e=n(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,n){function o(t){function e(){var t,e=d.length;if(e)for(y.insertBodies(d);e--;)t=d[e],t.isPinned||(t.force.reset(),y.updateBodyForce(t),g.update(t));for(e=h.length;e--;)m.update(h[e])}var o=n(37),r=n(3),i=n(1),s=n(9);t=i(t,{springLength:30,springCoeff:8e-4,gravity:-1.2,theta:.8,dragCoeff:.02,timeStep:20,stableThreshold:.009});var a=t.createQuadTree||n(39),u=t.createBounds||n(33),f=t.createDragForce||n(35),c=t.createSpringForce||n(38),p=t.integrator||n(36),l=t.createBody||n(34),d=[],h=[],y=a(t),v=u(d,t),m=c(t),g=f(t),x=0,b=!1,w={bodies:d,springs:h,settings:t,step:function(){e(),x=p(d,t.timeStep),v.update();var n=x<t.stableThreshold;return b!==n&&w.fire("stable",n),b=n,n},addBody:function(t){if(!t)throw new Error("Body is required");return d.push(t),t},addBodyAt:function(t){if(!t)throw new Error("Body position is required");var e=l(t);return d.push(e),e},removeBody:function(t){if(t){var e=d.indexOf(t);if(!(e<0))return d.splice(e,1),0===d.length&&v.reset(),!0}},addSpring:function(t,e,n,r,i){if(!t||!e)throw new Error("Cannot add null spring to force simulator");"number"!=typeof n&&(n=-1);var s=new o(t,e,n,i>=0?i:-1,r);return h.push(s),s},getTotalMovement:function(){return x},removeSpring:function(t){if(t){var e=h.indexOf(t);return e>-1?(h.splice(e,1),!0):void 0}},getBestNewBodyPosition:function(t){return v.getBestNewPosition(t)},getBBox:function(){return v.box},gravity:function(e){return void 0!==e?(t.gravity=e,y.options({gravity:e}),this):t.gravity},theta:function(e){return void 0!==e?(t.theta=e,y.options({theta:e}),this):t.theta}};return r(t,w),s(w),w}t.exports=o},function(t,e){function n(t,e){this.pos=new o(t,e),this.prevPos=new o(t,e),this.force=new o,this.velocity=new o,this.mass=1}function o(t,e){t&&"number"!=typeof t?(this.x="number"==typeof t.x?t.x:0,this.y="number"==typeof t.y?t.y:0):(this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0)}function r(t,e,n){this.pos=new i(t,e,n),this.prevPos=new i(t,e,n),this.force=new i,this.velocity=new i,this.mass=1}function i(t,e,n){t&&"number"!=typeof t?(this.x="number"==typeof t.x?t.x:0,this.y="number"==typeof t.y?t.y:0,this.z="number"==typeof t.z?t.z:0):(this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,this.z="number"==typeof n?n:0)}t.exports={Body:n,Vector2d:o,Body3d:r,Vector3d:i},n.prototype.setPosition=function(t,e){this.prevPos.x=this.pos.x=t,this.prevPos.y=this.pos.y=e},o.prototype.reset=function(){this.x=this.y=0},r.prototype.setPosition=function(t,e,n){this.prevPos.x=this.pos.x=t,this.prevPos.y=this.pos.y=e,this.prevPos.z=this.pos.z=n},i.prototype.reset=function(){this.x=this.y=this.z=0}},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function r(t){if(c===setTimeout)return setTimeout(t,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function i(t){if(p===clearTimeout)return clearTimeout(t);if((p===o||!p)&&clearTimeout)return p=clearTimeout,clearTimeout(t);try{return p(t)}catch(e){try{return p.call(null,t)}catch(e){return p.call(this,t)}}}function s(){y&&d&&(y=!1,d.length?h=d.concat(h):v=-1,h.length&&a())}function a(){if(!y){var t=r(s);y=!0;for(var e=h.length;e;){for(d=h,h=[];++v<e;)d&&d[v].run();v=-1,e=h.length}d=null,y=!1,i(t)}}function u(t,e){this.fun=t,this.array=e}function f(){}var c,p,l=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(t){c=n}try{p="function"==typeof clearTimeout?clearTimeout:o}catch(t){p=o}}();var d,h=[],y=!1,v=-1;l.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];h.push(new u(t,e)),1!==h.length||y||r(a)},u.prototype.run=function(){this.fun.apply(null,this.array)},l.title="browser",l.browser=!0,l.env={},l.argv=[],l.version="",l.versions={},l.on=f,l.addListener=f,l.once=f,l.off=f,l.removeListener=f,l.removeAllListeners=f,l.emit=f,l.prependListener=f,l.prependOnceListener=f,l.listeners=function(t){return[]},l.binding=function(t){throw new Error("process.binding is not supported")},l.cwd=function(){return"/"},l.chdir=function(t){throw new Error("process.chdir is not supported")},l.umask=function(){return 0}},function(t,e,n){function o(t,e){function o(t){Object.keys(q).forEach(function(e){t(q[e],e)})}function s(e,n){var o;if(void 0===n)o="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,n);if(!r)return;o=r.id}return T[o]}function a(t){return q[t]}function u(){t.on("changed",c)}function f(t){I.fire("stable",t)}function c(e){for(var n=0;n<e.length;++n){var o=e[n];"add"===o.changeType?(o.node&&l(o.node.id),o.link&&h(o.link)):"remove"===o.changeType&&(o.node&&d(o.node),o.link&&y(o.link))}k=t.getNodesCount()}function p(){k=0,t.forEachNode(function(t){l(t.id),k+=1}),t.forEachLink(h)}function l(e){var n=q[e];if(!n){var o=t.getNode(e);if(!o)throw new Error("initBody() was called with unknown node id");var r=o.position;if(!r){var i=v(o);r=E.getBestNewBodyPosition(i)}n=E.addBodyAt(r),n.id=e,q[e]=n,m(e),g(o)&&(n.isPinned=!0)}}function d(t){var e=t.id,n=q[e];n&&(q[e]=null,delete q[e],E.removeBody(n))}function h(t){m(t.fromId),m(t.toId);var e=q[t.fromId],n=q[t.toId],o=E.addSpring(e,n,t.length);M(t,o),T[t.id]=o}function y(e){var n=T[e.id];if(n){var o=t.getNode(e.fromId),r=t.getNode(e.toId);o&&m(o.id),r&&m(r.id),delete T[e.id],E.removeSpring(n)}}function v(t){var e=[];if(!t.links)return e;for(var n=Math.min(t.links.length,2),o=0;o<n;++o){var r=t.links[o],i=r.fromId!==t.id?q[r.fromId]:q[r.toId];i&&i.pos&&e.push(i)}return e}function m(t){var e=q[t];e.mass=b(t)}function g(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}function x(t){var e=q[t];return e||(l(t),e=q[t]),e}function b(e){var n=t.getLinks(e);return n?1+n.length/3:1}if(!t)throw new Error("Graph structure cannot be undefined");var w=n(8),E=w(e),q=Object.create(null),T={},k=0,M=E.settings.springTransform||r;p(),u();var P=!1,I={step:function(){if(0===k)return!0;var t=E.step();I.lastMove=t,I.fire("step");var e=t/k,n=e<=.01;return P!==n&&(P=n,f(n)),n},getNodePosition:function(t){return x(t).pos},setNodePosition:function(t){var e=x(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=T[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return E.getBBox()},forEachBody:o,pinNode:function(t,e){var n=x(t.id);n.isPinned=!!e},isNodePinned:function(t){return x(t.id).isPinned},dispose:function(){t.off("changed",c),I.fire("disposed")},getBody:a,getSpring:s,simulator:E,graph:t,lastMove:0};return i(I),I}function r(){}t.exports=o,t.exports.simulator=n(8);var i=n(7)},function(t,e,n){t.exports=function(t,e){function o(){var e=t.length;if(0!==e){for(var n=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MIN_VALUE,s=Number.MIN_VALUE;e--;){var a=t[e];a.isPinned?(a.pos.x=a.prevPos.x,a.pos.y=a.prevPos.y):(a.prevPos.x=a.pos.x,a.prevPos.y=a.pos.y),a.pos.x<n&&(n=a.pos.x),a.pos.x>r&&(r=a.pos.x),a.pos.y<o&&(o=a.pos.y),a.pos.y>s&&(s=a.pos.y)}i.x1=n,i.x2=r,i.y1=o,i.y2=s}}var r=n(6).random(42),i={x1:0,y1:0,x2:0,y2:0};return{box:i,update:o,reset:function(){i.x1=i.y1=0,i.x2=i.y2=0},getBestNewPosition:function(t){var n=i,o=0,s=0;if(t.length){for(var a=0;a<t.length;++a)o+=t[a].pos.x,s+=t[a].pos.y;o/=t.length,s/=t.length}else o=(n.x1+n.x2)/2,s=(n.y1+n.y2)/2;var u=e.springLength;return{x:o+r.next(u)-u/2,y:s+r.next(u)-u/2}}}}},function(t,e,n){var o=n(20);t.exports=function(t){return new o.Body(t)}},function(t,e,n){t.exports=function(t){var e=n(5),o=n(4);t=e(t,{dragCoeff:.02});var r={update:function(e){e.force.x-=t.dragCoeff*e.velocity.x,e.force.y-=t.dragCoeff*e.velocity.y}};return o(t,r,["dragCoeff"]),r}},function(t,e){function n(t,e){var n,o=0,r=0,i=0,s=0,a=t.length;if(0===a)return 0;for(n=0;n<a;++n){var u=t[n],f=e/u.mass;u.velocity.x+=f*u.force.x,u.velocity.y+=f*u.force.y;var c=u.velocity.x,p=u.velocity.y,l=Math.sqrt(c*c+p*p);l>1&&(u.velocity.x=c/l,u.velocity.y=p/l),o=e*u.velocity.x,i=e*u.velocity.y,u.pos.x+=o,u.pos.y+=i,r+=Math.abs(o),s+=Math.abs(i)}return(r*r+s*s)/a}t.exports=n},function(t,e){function n(t,e,n,o,r){this.from=t,this.to=e,this.length=n,this.coeff=o,this.weight="number"==typeof r?r:1}t.exports=n},function(t,e,n){t.exports=function(t){var e=n(5),o=n(6).random(42),r=n(4);t=e(t,{springCoeff:2e-4,springLength:80});var i={update:function(e){var n=e.from,r=e.to,i=e.length<0?t.springLength:e.length,s=r.pos.x-n.pos.x,a=r.pos.y-n.pos.y,u=Math.sqrt(s*s+a*a);0===u&&(s=(o.nextDouble()-.5)/50,a=(o.nextDouble()-.5)/50,u=Math.sqrt(s*s+a*a));var f=u-i,c=(!e.coeff||e.coeff<0?t.springCoeff:e.coeff)*f/u*e.weight;n.force.x+=c*s,n.force.y+=c*a,r.force.x-=c*s,r.force.y-=c*a}};return r(t,i,["springCoeff","springLength"]),i}},function(t,e){function n(t,e){this.pos=new o(t,e),this.prevPos=new o(t,e),this.force=new o,this.velocity=new o,this.mass=1}function o(t,e){t&&"number"!=typeof t?(this.x="number"==typeof t.x?t.x:0,this.y="number"==typeof t.y?t.y:0):(this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0)}function r(t,e,n){this.pos=new i(t,e,n),this.prevPos=new i(t,e,n),this.force=new i,this.velocity=new i,this.mass=1}function i(t,e,n){t&&"number"!=typeof t?(this.x="number"==typeof t.x?t.x:0,this.y="number"==typeof t.y?t.y:0,this.z="number"==typeof t.z?t.z:0):(this.x="number"==typeof t?t:0,this.y="number"==typeof e?e:0,this.z="number"==typeof n?n:0)}t.exports={Body:n,Vector2d:o,Body3d:r,Vector3d:i},n.prototype.setPosition=function(t,e){this.prevPos.x=this.pos.x=t,this.prevPos.y=this.pos.y=e},o.prototype.reset=function(){this.x=this.y=0},r.prototype.setPosition=function(t,e,n){this.prevPos.x=this.pos.x=t,this.prevPos.y=this.pos.y=e,this.prevPos.z=this.pos.z=n},i.prototype.reset=function(){this.x=this.y=this.z=0}},function(t,e,n){function o(t,e){return 0===e?t.quad0:1===e?t.quad1:2===e?t.quad2:3===e?t.quad3:null}function r(t,e,n){0===e?t.quad0=n:1===e?t.quad1=n:2===e?t.quad2=n:3===e&&(t.quad3=n)}t.exports=function(t){function e(){var t=v[m];return t?(t.quad0=null,t.quad1=null,t.quad2=null,t.quad3=null,t.body=null,t.mass=t.massX=t.massY=0,t.left=t.right=t.top=t.bottom=0):(t=new f,v[m]=t),++m,t}function i(t){var e,n,o,r,i=d,s=0,a=0,f=1,c=0,p=1;for(i[0]=g;f;){var h=i[c],v=h.body;f-=1,c+=1;var m=v!==t;v&&m?(n=v.pos.x-t.pos.x,o=v.pos.y-t.pos.y,r=Math.sqrt(n*n+o*o),0===r&&(n=(u.nextDouble()-.5)/50,o=(u.nextDouble()-.5)/50,r=Math.sqrt(n*n+o*o)),e=l*v.mass*t.mass/(r*r*r),s+=e*n,a+=e*o):m&&(n=h.massX/h.mass-t.pos.x,o=h.massY/h.mass-t.pos.y,r=Math.sqrt(n*n+o*o),0===r&&(n=(u.nextDouble()-.5)/50,o=(u.nextDouble()-.5)/50,r=Math.sqrt(n*n+o*o)),(h.right-h.left)/r<y?(e=l*h.mass*t.mass/(r*r*r),s+=e*n,a+=e*o):(h.quad0&&(i[p]=h.quad0,f+=1,p+=1),h.quad1&&(i[p]=h.quad1,f+=1,p+=1),h.quad2&&(i[p]=h.quad2,f+=1,p+=1),h.quad3&&(i[p]=h.quad3,f+=1,p+=1)))}t.force.x+=s,t.force.y+=a}function s(t){var n,o=Number.MAX_VALUE,r=Number.MAX_VALUE,i=Number.MIN_VALUE,s=Number.MIN_VALUE,u=t.length;for(n=u;n--;){var f=t[n].pos.x,c=t[n].pos.y;f<o&&(o=f),f>i&&(i=f),c<r&&(r=c),c>s&&(s=c)}var p=i-o,l=s-r;for(p>l?s=r+p:i=o+l,m=0,g=e(),g.left=o,g.right=i,g.top=r,g.bottom=s,n=u-1,n>=0&&(g.body=t[n]);n--;)a(t[n],g)}function a(t){for(h.reset(),h.push(g,t);!h.isEmpty();){var n=h.pop(),i=n.node,s=n.body;if(i.body){var a=i.body;if(i.body=null,p(a.pos,s.pos)){var f=3;do{var c=u.nextDouble(),l=(i.right-i.left)*c,d=(i.bottom-i.top)*c;a.pos.x=i.left+l,a.pos.y=i.top+d,f-=1}while(f>0&&p(a.pos,s.pos));if(0===f&&p(a.pos,s.pos))return}h.push(i,a),h.push(i,s)}else{var y=s.pos.x,v=s.pos.y;i.mass=i.mass+s.mass,i.massX=i.massX+s.mass*y,i.massY=i.massY+s.mass*v;var m=0,x=i.left,b=(i.right+x)/2,w=i.top,E=(i.bottom+w)/2;y>b&&(m+=1,x=b,b=i.right),v>E&&(m+=2,w=E,E=i.bottom);var q=o(i,m);q?h.push(q,s):(q=e(),q.left=x,q.top=w,q.right=b,q.bottom=E,q.body=s,r(i,m,q))}}}t=t||{},t.gravity="number"==typeof t.gravity?t.gravity:-1,t.theta="number"==typeof t.theta?t.theta:.8;var u=n(6).random(1984),f=n(24),c=n(22),p=n(23),l=t.gravity,d=[],h=new c,y=t.theta,v=[],m=0,g=e();return{insertBodies:s,getRoot:function(){return g},updateBodyForce:i,options:function(t){return t?("number"==typeof t.gravity&&(l=t.gravity),"number"==typeof t.theta&&(y=t.theta),this):{gravity:l,theta:y}}}}},function(t,e){function n(){this.stack=[],this.popIdx=0}function o(t,e){this.node=t,this.body=e}t.exports=n,n.prototype={isEmpty:function(){return 0===this.popIdx},push:function(t,e){var n=this.stack[this.popIdx];n?(n.node=t,n.body=e):this.stack[this.popIdx]=new o(t,e),++this.popIdx},pop:function(){if(this.popIdx>0)return this.stack[--this.popIdx]},reset:function(){this.popIdx=0}}},function(t,e){t.exports=function(t,e){var n=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);return n<1e-8&&o<1e-8}},function(t,e){t.exports=function(){this.body=null,this.quad0=null,this.quad1=null,this.quad2=null,this.quad3=null,this.mass=0,this.massX=0,this.massY=0,this.left=0,this.top=0,this.bottom=0,this.right=0}},function(t,e,n){function o(t,e){var i=n(1);return e=i(e,{createQuadTree:n(43),createBounds:n(26),createDragForce:n(28),createSpringForce:n(30),integrator:r(e),createBody:n(27)}),o.get2dLayout(t,e)}function r(t){return n(t&&"verlet"===t.integrator?31:29)}t.exports=o,o.get2dLayout=n(32)},function(t,e,n){t.exports=function(t,e){function o(){var e=t.length;if(0!==e){for(var n=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MAX_VALUE,s=Number.MIN_VALUE,a=Number.MIN_VALUE,u=Number.MIN_VALUE;e--;){var f=t[e];f.isPinned?(f.pos.x=f.prevPos.x,f.pos.y=f.prevPos.y,f.pos.z=f.prevPos.z):(f.prevPos.x=f.pos.x,f.prevPos.y=f.pos.y,f.prevPos.z=f.pos.z),f.pos.x<n&&(n=f.pos.x),f.pos.x>s&&(s=f.pos.x),f.pos.y<o&&(o=f.pos.y),f.pos.y>a&&(a=f.pos.y),f.pos.z<r&&(r=f.pos.z),f.pos.z>u&&(u=f.pos.z)}i.x1=n,i.x2=s,i.y1=o,i.y2=a,i.z1=r,i.z2=u}}var r=n(2).random(42),i={x1:0,y1:0,z1:0,x2:0,y2:0,z2:0};return{box:i,update:o,reset:function(){i.x1=i.y1=0,i.x2=i.y2=0,i.z1=i.z2=0},getBestNewPosition:function(t){var n=i,o=0,s=0,a=0;if(t.length){for(var u=0;u<t.length;++u)o+=t[u].pos.x,s+=t[u].pos.y,a+=t[u].pos.z;o/=t.length,s/=t.length,a/=t.length}else o=(n.x1+n.x2)/2,s=(n.y1+n.y2)/2,a=(n.z1+n.z2)/2;var f=e.springLength;return{x:o+r.next(f)-f/2,y:s+r.next(f)-f/2,z:a+r.next(f)-f/2}}}}},function(t,e,n){var o=n(11);t.exports=function(t){return new o.Body3d(t)}},function(t,e,n){t.exports=function(t){var e=n(1),o=n(3);t=e(t,{dragCoeff:.02});var r={update:function(e){e.force.x-=t.dragCoeff*e.velocity.x,e.force.y-=t.dragCoeff*e.velocity.y,e.force.z-=t.dragCoeff*e.velocity.z}};return o(t,r,["dragCoeff"]),r}},function(t,e){function n(t,e){var n,o=0,r=0,i=0,s=0,a=0,u=0,f=t.length;for(n=0;n<f;++n){var c=t[n],p=e/c.mass;c.velocity.x+=p*c.force.x,c.velocity.y+=p*c.force.y,c.velocity.z+=p*c.force.z;var l=c.velocity.x,d=c.velocity.y,h=c.velocity.z,y=Math.sqrt(l*l+d*d+h*h);y>1&&(c.velocity.x=l/y,c.velocity.y=d/y,c.velocity.z=h/y),o=e*c.velocity.x,i=e*c.velocity.y,a=e*c.velocity.z,c.pos.x+=o,c.pos.y+=i,c.pos.z+=a,r+=Math.abs(o),s+=Math.abs(i),u+=Math.abs(a)}return(r*r+s*s+u*u)/t.length}t.exports=n},function(t,e,n){t.exports=function(t){var e=n(1),o=n(2).random(42),r=n(3);t=e(t,{springCoeff:2e-4,springLength:80});var i={update:function(e){var n=e.from,r=e.to,i=e.length<0?t.springLength:e.length,s=r.pos.x-n.pos.x,a=r.pos.y-n.pos.y,u=r.pos.z-n.pos.z,f=Math.sqrt(s*s+a*a+u*u);0===f&&(s=(o.nextDouble()-.5)/50,a=(o.nextDouble()-.5)/50,u=(o.nextDouble()-.5)/50,f=Math.sqrt(s*s+a*a+u*u));var c=f-i,p=(!e.coeff||e.coeff<0?t.springCoeff:e.coeff)*c/f*e.weight;n.force.x+=p*s,n.force.y+=p*a,n.force.z+=p*u,r.force.x-=p*s,r.force.y-=p*a,r.force.z-=p*u}};return r(t,i,["springCoeff","springLength"]),i}},function(t,e){function n(t,e){var n,o=0,r=0,i=0,s=t.length;for(n=0;n<s;++n){var a=t[n],u=e*e/a.mass;a.pos.x=2*a.pos.x-a.prevPos.x+a.force.x*u,a.pos.y=2*a.pos.y-a.prevPos.y+a.force.y*u,a.pos.z=2*a.pos.z-a.prevPos.z+a.force.z*u,o+=Math.abs(a.pos.x-a.prevPos.x),r+=Math.abs(a.pos.y-a.prevPos.y),i+=Math.abs(a.pos.z-a.prevPos.z)}return(o*o+r*r+i*i)/t.length}t.exports=n},function(t,e,n){function o(t,e){function o(e,n){var o;if(void 0===n)o="object"!=typeof e?e:e.id;else{var r=t.hasLink(e,n);if(!r)return;o=r.id}return q[o]}function s(t){return E[t]}function a(){t.on("changed",f),w.on("stable",u)}function u(t){k.fire("stable",t)}function f(t){for(var e=0;e<t.length;++e){var n=t[e];"add"===n.changeType?(n.node&&p(n.node.id),n.link&&d(n.link)):"remove"===n.changeType&&(n.node&&l(n.node),n.link&&h(n.link))}}function c(){t.forEachNode(function(t){p(t.id)}),t.forEachLink(d)}function p(e){var n=E[e];if(!n){var o=t.getNode(e);if(!o)throw new Error("initBody() was called with unknown node id");var r=o.position;if(!r){var i=y(o);r=w.getBestNewBodyPosition(i)}n=w.addBodyAt(r),E[e]=n,v(e),m(o)&&(n.isPinned=!0)}}function l(t){var e=t.id,n=E[e];n&&(E[e]=null,delete E[e],w.removeBody(n))}function d(t){v(t.fromId),v(t.toId);var e=E[t.fromId],n=E[t.toId],o=w.addSpring(e,n,t.length);T(t,o),q[t.id]=o}function h(e){var n=q[e.id];if(n){var o=t.getNode(e.fromId),r=t.getNode(e.toId);o&&v(o.id),r&&v(r.id),delete q[e.id],w.removeSpring(n)}}function y(t){var e=[];if(!t.links)return e;for(var n=Math.min(t.links.length,2),o=0;o<n;++o){var r=t.links[o],i=r.fromId!==t.id?E[r.fromId]:E[r.toId];i&&i.pos&&e.push(i)}return e}function v(t){var e=E[t];e.mass=x(t)}function m(t){return t&&(t.isPinned||t.data&&t.data.isPinned)}function g(t){var e=E[t];return e||(p(t),e=E[t]),e}function x(e){var n=t.getLinks(e);return n?1+n.length/3:1}if(!t)throw new Error("Graph structure cannot be undefined");var b=n(10),w=b(e),E="function"==typeof Object.create?Object.create(null):{},q={},T=w.settings.springTransform||r;c(),a();var k={step:function(){return w.step()},getNodePosition:function(t){return g(t).pos},setNodePosition:function(t){var e=g(t);e.setPosition.apply(e,Array.prototype.slice.call(arguments,1))},getLinkPosition:function(t){var e=q[t];if(e)return{from:e.from.pos,to:e.to.pos}},getGraphRect:function(){return w.getBBox()},pinNode:function(t,e){var n=g(t.id);n.isPinned=!!e},isNodePinned:function(t){return g(t.id).isPinned},dispose:function(){t.off("changed",f),w.off("stable",u)},getBody:s,getSpring:o,simulator:w};return i(k),k}function r(){}t.exports=o,t.exports.simulator=n(10);var i=n(9)},function(t,e,n){t.exports=function(t,e){function o(){var e=t.length;if(0!==e){for(var n=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MIN_VALUE,s=Number.MIN_VALUE;e--;){var a=t[e];a.isPinned?(a.pos.x=a.prevPos.x,a.pos.y=a.prevPos.y):(a.prevPos.x=a.pos.x,a.prevPos.y=a.pos.y),a.pos.x<n&&(n=a.pos.x),a.pos.x>r&&(r=a.pos.x),a.pos.y<o&&(o=a.pos.y),a.pos.y>s&&(s=a.pos.y)}i.x1=n,i.x2=r,i.y1=o,i.y2=s}}var r=n(2).random(42),i={x1:0,y1:0,x2:0,y2:0};return{box:i,update:o,reset:function(){i.x1=i.y1=0,i.x2=i.y2=0},getBestNewPosition:function(t){var n=i,o=0,s=0;if(t.length){for(var a=0;a<t.length;++a)o+=t[a].pos.x,s+=t[a].pos.y;o/=t.length,s/=t.length}else o=(n.x1+n.x2)/2,s=(n.y1+n.y2)/2;var u=e.springLength;return{x:o+r.next(u)-u/2,y:s+r.next(u)-u/2}}}}},function(t,e,n){var o=n(11);t.exports=function(t){return new o.Body(t)}},function(t,e,n){t.exports=function(t){var e=n(1),o=n(3);t=e(t,{dragCoeff:.02});var r={update:function(e){e.force.x-=t.dragCoeff*e.velocity.x,e.force.y-=t.dragCoeff*e.velocity.y}};return o(t,r,["dragCoeff"]),r}},function(t,e){function n(t,e){var n,o=0,r=0,i=0,s=0,a=t.length;if(0===a)return 0;for(n=0;n<a;++n){var u=t[n],f=e/u.mass;u.velocity.x+=f*u.force.x,u.velocity.y+=f*u.force.y;var c=u.velocity.x,p=u.velocity.y,l=Math.sqrt(c*c+p*p);l>1&&(u.velocity.x=c/l,u.velocity.y=p/l),o=e*u.velocity.x,i=e*u.velocity.y,u.pos.x+=o,u.pos.y+=i,r+=Math.abs(o),s+=Math.abs(i)}return(r*r+s*s)/a}t.exports=n},function(t,e){function n(t,e,n,o,r){this.from=t,this.to=e,this.length=n,this.coeff=o,this.weight="number"==typeof r?r:1}t.exports=n},function(t,e,n){t.exports=function(t){var e=n(1),o=n(2).random(42),r=n(3);t=e(t,{springCoeff:2e-4,springLength:80});var i={update:function(e){var n=e.from,r=e.to,i=e.length<0?t.springLength:e.length,s=r.pos.x-n.pos.x,a=r.pos.y-n.pos.y,u=Math.sqrt(s*s+a*a);0===u&&(s=(o.nextDouble()-.5)/50,a=(o.nextDouble()-.5)/50,u=Math.sqrt(s*s+a*a));var f=u-i,c=(!e.coeff||e.coeff<0?t.springCoeff:e.coeff)*f/u*e.weight;n.force.x+=c*s,n.force.y+=c*a,r.force.x-=c*s,r.force.y-=c*a}};return r(t,i,["springCoeff","springLength"]),i}},function(t,e,n){function o(t,e){return 0===e?t.quad0:1===e?t.quad1:2===e?t.quad2:3===e?t.quad3:null}function r(t,e,n){0===e?t.quad0=n:1===e?t.quad1=n:2===e?t.quad2=n:3===e&&(t.quad3=n)}t.exports=function(t){t=t||{},t.gravity="number"==typeof t.gravity?t.gravity:-1,t.theta="number"==typeof t.theta?t.theta:.8;var e=n(2).random(1984),i=n(42),s=n(40),a=n(41),u=t.gravity,f=[],c=new s,p=t.theta,l=[],d=0,h=function(){var t=l[d];return t?(t.quad0=null,t.quad1=null,t.quad2=null,t.quad3=null,t.body=null,t.mass=t.massX=t.massY=0,t.left=t.right=t.top=t.bottom=0):(t=new i,l[d]=t),++d,t},y=h(),v=function(t){for(c.reset(),c.push(y,t);!c.isEmpty();){var n=c.pop(),i=n.node,s=n.body;if(i.body){var u=i.body;if(i.body=null,a(u.pos,s.pos)){var f=3;do{var p=e.nextDouble(),l=(i.right-i.left)*p,d=(i.bottom-i.top)*p;u.pos.x=i.left+l,u.pos.y=i.top+d,f-=1}while(f>0&&a(u.pos,s.pos));if(0===f&&a(u.pos,s.pos))return}c.push(i,u),c.push(i,s)}else{var v=s.pos.x,m=s.pos.y;i.mass=i.mass+s.mass,i.massX=i.massX+s.mass*v,i.massY=i.massY+s.mass*m;var g=0,x=i.left,b=(i.right+x)/2,w=i.top,E=(i.bottom+w)/2;if(v>b){g+=1;var q=x;x=b,b+=b-q}if(m>E){g+=2;var T=w;w=E,E+=E-T}var k=o(i,g);k?c.push(k,s):(k=h(),k.left=x,k.top=w,k.right=b,k.bottom=E,k.body=s,r(i,g,k))}}},m=function(t){var n,o,r,i,s=f,a=0,c=0,l=1,d=0,h=1;for(s[0]=y;l;){var v=s[d],m=v.body;l-=1,d+=1;var g=m!==t;m&&g?(o=m.pos.x-t.pos.x,r=m.pos.y-t.pos.y,i=Math.sqrt(o*o+r*r),0===i&&(o=(e.nextDouble()-.5)/50,r=(e.nextDouble()-.5)/50,i=Math.sqrt(o*o+r*r)),n=u*m.mass*t.mass/(i*i*i),a+=n*o,c+=n*r):g&&(o=v.massX/v.mass-t.pos.x,r=v.massY/v.mass-t.pos.y,i=Math.sqrt(o*o+r*r),0===i&&(o=(e.nextDouble()-.5)/50,
r=(e.nextDouble()-.5)/50,i=Math.sqrt(o*o+r*r)),(v.right-v.left)/i<p?(n=u*v.mass*t.mass/(i*i*i),a+=n*o,c+=n*r):(v.quad0&&(s[h]=v.quad0,l+=1,h+=1),v.quad1&&(s[h]=v.quad1,l+=1,h+=1),v.quad2&&(s[h]=v.quad2,l+=1,h+=1),v.quad3&&(s[h]=v.quad3,l+=1,h+=1)))}t.force.x+=a,t.force.y+=c},g=function(t){var e,n=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MIN_VALUE,i=Number.MIN_VALUE,s=t.length;for(e=s;e--;){var a=t[e].pos.x,u=t[e].pos.y;a<n&&(n=a),a>r&&(r=a),u<o&&(o=u),u>i&&(i=u)}var f=r-n,c=i-o;for(f>c?i=o+f:r=n+c,d=0,y=h(),y.left=n,y.right=r,y.top=o,y.bottom=i,e=s-1,e>0&&(y.body=t[e]);e--;)v(t[e],y)};return{insertBodies:g,updateBodyForce:m,options:function(t){return t?("number"==typeof t.gravity&&(u=t.gravity),"number"==typeof t.theta&&(p=t.theta),this):{gravity:u,theta:p}}}}},function(t,e){function n(){this.stack=[],this.popIdx=0}function o(t,e){this.node=t,this.body=e}t.exports=n,n.prototype={isEmpty:function(){return 0===this.popIdx},push:function(t,e){var n=this.stack[this.popIdx];n?(n.node=t,n.body=e):this.stack[this.popIdx]=new o(t,e),++this.popIdx},pop:function(){if(this.popIdx>0)return this.stack[--this.popIdx]},reset:function(){this.popIdx=0}}},function(t,e){t.exports=function(t,e){var n=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y);return n<1e-8&&o<1e-8}},function(t,e){t.exports=function(){this.body=null,this.quad0=null,this.quad1=null,this.quad2=null,this.quad3=null,this.mass=0,this.massX=0,this.massY=0,this.left=0,this.top=0,this.bottom=0,this.right=0}},function(t,e,n){function o(t,e){return 0===e?t.quad0:1===e?t.quad1:2===e?t.quad2:3===e?t.quad3:4===e?t.quad4:5===e?t.quad5:6===e?t.quad6:7===e?t.quad7:null}function r(t,e,n){0===e?t.quad0=n:1===e?t.quad1=n:2===e?t.quad2=n:3===e?t.quad3=n:4===e?t.quad4=n:5===e?t.quad5=n:6===e?t.quad6=n:7===e&&(t.quad7=n)}t.exports=function(t){t=t||{},t.gravity="number"==typeof t.gravity?t.gravity:-1,t.theta="number"==typeof t.theta?t.theta:.8;var e=n(2).random(1984),i=n(46),s=n(44),a=n(45),u=t.gravity,f=[],c=new s,p=t.theta,l=[],d=0,h=function(){var t=l[d];return t?(t.quad0=null,t.quad4=null,t.quad1=null,t.quad5=null,t.quad2=null,t.quad6=null,t.quad3=null,t.quad7=null,t.body=null,t.mass=t.massX=t.massY=t.massZ=0,t.left=t.right=t.top=t.bottom=t.front=t.back=0):(t=new i,l[d]=t),++d,t},y=h(),v=function(t){for(c.reset(),c.push(y,t);!c.isEmpty();){var n=c.pop(),i=n.node,s=n.body;if(i.body){var u=i.body;if(i.body=null,a(u.pos,s.pos)){var f=3;do{var p=e.nextDouble(),l=(i.right-i.left)*p,d=(i.bottom-i.top)*p,v=(i.front-i.back)*p;u.pos.x=i.left+l,u.pos.y=i.top+d,u.pos.z=i.back+v,f-=1}while(f>0&&a(u.pos,s.pos));if(0===f&&a(u.pos,s.pos))return}c.push(i,u),c.push(i,s)}else{var m=s.pos.x,g=s.pos.y,x=s.pos.z;i.mass+=s.mass,i.massX+=s.mass*m,i.massY+=s.mass*g,i.massZ+=s.mass*x;var b=0,w=i.left,E=(i.right+w)/2,q=i.top,T=(i.bottom+q)/2,k=i.back,M=(i.front+k)/2;if(m>E){b+=1;var P=w;w=E,E+=E-P}if(g>T){b+=2;var I=q;q=T,T+=T-I}if(x>M){b+=4;var L=k;k=M,M=k+(k-L)}var N=o(i,b);N?c.push(N,s):(N=h(),N.left=w,N.top=q,N.right=E,N.bottom=T,N.back=k,N.front=M,N.body=s,r(i,b,N))}}},m=function(t){var n,o,r,i,s,a=f,c=0,l=0,d=0,h=1,v=0,m=1;for(a[0]=y;h;){var g=a[v],x=g.body;h-=1,v+=1;var b=x!==t;x&&b?(o=x.pos.x-t.pos.x,r=x.pos.y-t.pos.y,i=x.pos.z-t.pos.z,s=Math.sqrt(o*o+r*r+i*i),0===s&&(o=(e.nextDouble()-.5)/50,r=(e.nextDouble()-.5)/50,i=(e.nextDouble()-.5)/50,s=Math.sqrt(o*o+r*r+i*i)),n=u*x.mass*t.mass/(s*s*s),c+=n*o,l+=n*r,d+=n*i):b&&(o=g.massX/g.mass-t.pos.x,r=g.massY/g.mass-t.pos.y,i=g.massZ/g.mass-t.pos.z,s=Math.sqrt(o*o+r*r+i*i),0===s&&(o=(e.nextDouble()-.5)/50,r=(e.nextDouble()-.5)/50,i=(e.nextDouble()-.5)/50,s=Math.sqrt(o*o+r*r+i*i)),(g.right-g.left)/s<p?(n=u*g.mass*t.mass/(s*s*s),c+=n*o,l+=n*r,d+=n*i):(g.quad0&&(a[m]=g.quad0,h+=1,m+=1),g.quad1&&(a[m]=g.quad1,h+=1,m+=1),g.quad2&&(a[m]=g.quad2,h+=1,m+=1),g.quad3&&(a[m]=g.quad3,h+=1,m+=1),g.quad4&&(a[m]=g.quad4,h+=1,m+=1),g.quad5&&(a[m]=g.quad5,h+=1,m+=1),g.quad6&&(a[m]=g.quad6,h+=1,m+=1),g.quad7&&(a[m]=g.quad7,h+=1,m+=1)))}t.force.x+=c,t.force.y+=l,t.force.z+=d},g=function(t){var e,n=Number.MAX_VALUE,o=Number.MAX_VALUE,r=Number.MAX_VALUE,i=Number.MIN_VALUE,s=Number.MIN_VALUE,a=Number.MIN_VALUE,u=t.length;for(e=u;e--;){var f=t[e].pos,c=f.x,p=f.y,l=f.z;c<n&&(n=c),c>i&&(i=c),p<o&&(o=p),p>s&&(s=p),l<r&&(r=l),l>a&&(a=l)}var m=Math.max(i-n,Math.max(s-o,a-r));for(i=n+m,s=o+m,a=r+m,d=0,y=h(),y.left=n,y.right=i,y.top=o,y.bottom=s,y.back=r,y.front=a,e=u-1,e>0&&(y.body=t[e]);e--;)v(t[e],y)};return{insertBodies:g,updateBodyForce:m,options:function(t){return t?("number"==typeof t.gravity&&(u=t.gravity),"number"==typeof t.theta&&(p=t.theta),this):{gravity:u,theta:p}}}}},function(t,e){function n(){this.stack=[],this.popIdx=0}function o(t,e){this.node=t,this.body=e}t.exports=n,n.prototype={isEmpty:function(){return 0===this.popIdx},push:function(t,e){var n=this.stack[this.popIdx];n?(n.node=t,n.body=e):this.stack[this.popIdx]=new o(t,e),++this.popIdx},pop:function(){if(this.popIdx>0)return this.stack[--this.popIdx]},reset:function(){this.popIdx=0}}},function(t,e){t.exports=function(t,e){var n=Math.abs(t.x-e.x),o=Math.abs(t.y-e.y),r=Math.abs(t.z-e.z);return n<1e-8&&o<1e-8&&r<1e-8}},function(t,e){t.exports=function(){this.body=null,this.quad0=null,this.quad1=null,this.quad2=null,this.quad3=null,this.quad4=null,this.quad5=null,this.quad6=null,this.quad7=null,this.mass=0,this.massX=0,this.massY=0,this.massZ=0,this.left=0,this.top=0,this.bottom=0,this.right=0,this.front=0,this.back=0}},function(t,e,n){function o(t){function e(){function t(){return X.beginUpdate=F=k,X.endUpdate=U=M,_=n,S=o,X.on=e,e.apply(X,arguments)}var e=X.on;X.on=t}function n(t,e){D.push({link:t,changeType:e})}function o(t,e){D.push({node:t,changeType:e})}function u(t,e){if(void 0===t)throw new Error("Invalid node identifier");F();var n=p(t);return n?S(n,"update"):(n=new i(t),j++,S(n,"add")),n.data=e,N[t]=n,U(),n}function p(t){return N[t]}function l(t){var e=p(t);if(!e)return!1;if(F(),e.links)for(;e.links.length;){var n=e.links[0];m(n)}return delete N[t],j--,S(e,"remove"),U(),!0}function d(t,e,n){F();var o=p(t)||u(t),r=p(e)||u(e),i=O(t,e,n);return A.push(i),s(o,i),t!==e&&s(r,i),_(i,"add"),U(),i}function h(t,e,n){var o=f(t,e);return new a(t,e,n,o)}function y(t,e,n){var o=f(t,e),r=B.hasOwnProperty(o);if(r||g(t,e)){r||(B[o]=0);var i="@"+ ++B[o];o=f(t+i,e+i)}return new a(t,e,n,o)}function v(t){var e=p(t);return e?e.links:null}function m(t){if(!t)return!1;var e=r(t,A);if(e<0)return!1;F(),A.splice(e,1);var n=p(t.fromId),o=p(t.toId);return n&&(e=r(t,n.links),e>=0&&n.links.splice(e,1)),o&&(e=r(t,o.links),e>=0&&o.links.splice(e,1)),_(t,"remove"),U(),!0}function g(t,e){var n,o=p(t);if(!o||!o.links)return null;for(n=0;n<o.links.length;++n){var r=o.links[n];if(r.fromId===t&&r.toId===e)return r}return null}function x(){F(),C(function(t){l(t.id)}),U()}function b(t){var e,n;if("function"==typeof t)for(e=0,n=A.length;e<n;++e)t(A[e])}function w(t,e,n){var o=p(t);if(o&&o.links&&"function"==typeof e)return n?q(o.links,t,e):E(o.links,t,e)}function E(t,e,n){for(var o,r=0;r<t.length;++r){var i=t[r],s=i.fromId===e?i.toId:i.fromId;if(o=n(N[s],i))return!0}}function q(t,e,n){for(var o,r=0;r<t.length;++r){var i=t[r];if(i.fromId===e&&(o=n(N[i.toId],i)))return!0}}function T(){}function k(){z+=1}function M(){z-=1,0===z&&D.length>0&&(X.fire("changed",D),D.length=0)}function P(){return Object.keys?I:L}function I(t){if("function"==typeof t)for(var e=Object.keys(N),n=0;n<e.length;++n)if(t(N[e[n]]))return!0}function L(t){if("function"==typeof t){var e;for(e in N)if(t(N[e]))return!0}}t=t||{},void 0===t.uniqueLinkId&&(t.uniqueLinkId=!0);var N="function"==typeof Object.create?Object.create(null):{},A=[],B={},j=0,z=0,C=P(),O=t.uniqueLinkId?y:h,D=[],_=T,S=T,F=T,U=T,X={addNode:u,addLink:d,removeLink:m,removeNode:l,getNode:p,getNodesCount:function(){return j},getLinksCount:function(){return A.length},getLinks:v,forEachNode:C,forEachLinkedNode:w,forEachLink:b,beginUpdate:F,endUpdate:U,clear:x,hasLink:g,getLink:g};return c(X),e(),X}function r(t,e){if(!e)return-1;if(e.indexOf)return e.indexOf(t);var n,o=e.length;for(n=0;n<o;n+=1)if(e[n]===t)return n;return-1}function i(t){this.id=t,this.links=null,this.data=null}function s(t,e){t.links?t.links.push(e):t.links=[e]}function a(t,e,n,o){this.fromId=t,this.toId=e,this.data=n,this.id=o}function u(t){var e,n,o,r=0;if(0==t.length)return r;for(e=0,o=t.length;e<o;e++)n=t.charCodeAt(e),r=(r<<5)-r+n,r|=0;return r}function f(t,e){return u(t.toString()+"👉 "+e.toString())}t.exports=o;var c=n(48)},function(t,e){function n(t){var e=Object.create(null);return{on:function(n,o,r){if("function"!=typeof o)throw new Error("callback is expected to be a function");var i=e[n];return i||(i=e[n]=[]),i.push({callback:o,ctx:r}),t},off:function(n,o){var r="undefined"==typeof n;if(r)return e=Object.create(null),t;if(e[n]){var i="function"!=typeof o;if(i)delete e[n];else for(var s=e[n],a=0;a<s.length;++a)s[a].callback===o&&s.splice(a,1)}return t},fire:function(n){var o=e[n];if(!o)return t;var r;arguments.length>1&&(r=Array.prototype.splice.call(arguments,1));for(var i=0;i<o.length;++i){var s=o[i];s.callback.apply(s.ctx,r)}return t}}}function o(t){if(!t)throw new Error("Eventify cannot use falsy object as events subject");for(var e=["on","fire","off"],n=0;n<e.length;++n)if(t.hasOwnProperty(e[n]))throw new Error("Subject cannot be eventified, since it already has property '"+e[n]+"'")}t.exports=function(t){o(t);var e=n(t);return t.on=e.on,t.off=e.off,t.fire=e.fire,t}},function(t,e,n){var o,r;/**
* @preserve jquery-param (c) 2015 KNOWLEDGECODE | MIT
*/
!function(n){"use strict";var o=function(t){var e=function(t,e,n){n="function"==typeof n?n():null===n?"":void 0===n?"":n,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(n)},n=function(t,r,i){var o,a,u;if("[object Array]"===Object.prototype.toString.call(r))for(o=0,a=r.length;o<a;o++)n(t+"["+("object"==typeof r[o]?o:"")+"]",r[o],i);else if(r&&"[object Object]"===r.toString())for(u in r)r.hasOwnProperty(u)&&(t?n(t+"["+u+"]",r[u],i,e):n(u,r[u],i,e));else if(t)e(i,t,r);else for(u in r)e(i,u,r[u]);return i};return n("",t,[]).join("&").replace(/%20/g,"+")};"object"==typeof t&&"object"==typeof t.exports?t.exports=o:(r=[],i=function(){return o}.apply(e,r),!(void 0!==i&&(t.exports=i)))}(this)},function(t,e,n){(function(t,e,n){!function(t){function r(t){return"function"==typeof t}function i(t){return"object"==typeof t}function o(t){"undefined"!=typeof e?e(t):"undefined"!=typeof n&&n.nextTick?n.nextTick(t):setTimeout(t,0)}var a;t[0][t[1]]=function t(e){var n,u=[],s=[],c=function(t,e){return null==n&&null!=t&&(n=t,u=e,s.length&&o(function(){for(var t=0;t<s.length;t++)s[t]()})),n};return c.then=function(c,l){var f=t(e),h=function(){function t(e){var n,o=0;try{if(e&&(i(e)||r(e))&&r(n=e.then)){if(e===f)throw new TypeError;n.call(e,function(){o++||t.apply(a,arguments)},function(t){o++||f(!1,[t])})}else f(!0,arguments)}catch(t){o++||f(!1,[t])}}try{var e=n?c:l;r(e)?t(e.apply(a,u||[])):f(n,u)}catch(t){f(!1,[t])}};return null!=n?o(h):s.push(h),f},e&&(c=e(c)),c}}([t,"exports"])}).call(e,n(12)(t),n(13).setImmediate,n(1))},function(t,e,n){/*! qwest 4.4.5 (https://github.com/pyrsmk/qwest) */
t.exports=function(){var t="undefined"!=typeof window?window:self,e=n(10),r=n(9),i={},o="json",a="post",u=null,s=0,c=[],l=t.XMLHttpRequest?function(){return new t.XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},f=""===l().responseType,h=function(n,h,p,d,y){n=n.toUpperCase(),p=p||null,d=d||{};for(var v in i)if(!(v in d))if("object"==typeof i[v]&&"object"==typeof d[v])for(var _ in i[v])d[v][_]=i[v][_];else d[v]=i[v];var x,g,w,m,T,N=!1,b=!1,z=!1,A=0,E={},k={text:"*/*",xml:"text/xml",json:"application/json",post:"application/x-www-form-urlencoded",document:"text/html"},M={text:"*/*",xml:"application/xml; q=1.0, text/xml; q=0.8, */*; q=0.1",json:"application/json; q=1.0, text/*; q=0.8, */*; q=0.1"},j=!1,O=e(function(e){return e.abort=function(){z||(g&&4!=g.readyState&&g.abort(),j&&(--s,j=!1),z=!0)},e.send=function(){if(!j){if(s==u)return void c.push(e);if(z)return void(c.length&&c.shift().send());if(++s,j=!0,g=l(),x&&("withCredentials"in g||!t.XDomainRequest||(g=new XDomainRequest,b=!0,"GET"!=n&&"POST"!=n&&(n="POST"))),b?g.open(n,h):(g.open(n,h,d.async,d.user,d.password),f&&d.async&&(g.withCredentials=d.withCredentials)),!b)for(var r in E)E[r]&&g.setRequestHeader(r,E[r]);if(f&&"auto"!=d.responseType)try{g.responseType=d.responseType,N=g.responseType==d.responseType}catch(t){}f||b?(g.onload=C,g.onerror=q,b&&(g.onprogress=function(){})):g.onreadystatechange=function(){4==g.readyState&&C()},d.async?"timeout"in g?(g.timeout=d.timeout,g.ontimeout=F):w=setTimeout(F,d.timeout):b&&(g.ontimeout=function(){}),"auto"!=d.responseType&&"overrideMimeType"in g&&g.overrideMimeType(k[d.responseType]),y&&y(g),b?setTimeout(function(){g.send("GET"!=n?p:null)},0):g.send("GET"!=n?p:null)}},e}),C=function(){var e;if(j=!1,clearTimeout(w),c.length&&c.shift().send(),!z){--s;try{if(N){if("response"in g&&null===g.response)throw"The request response is empty";T=g.response}else{if(e=d.responseType,"auto"==e)if(b)e=o;else{var n=g.getResponseHeader("Content-Type")||"";e=n.indexOf(k.json)>-1?"json":n.indexOf(k.xml)>-1?"xml":"text"}switch(e){case"json":if(g.responseText.length)try{T="JSON"in t?JSON.parse(g.responseText):new Function("return ("+g.responseText+")")()}catch(t){throw"Error while parsing JSON body : "+t}break;case"xml":try{t.DOMParser?T=(new DOMParser).parseFromString(g.responseText,"text/xml"):(T=new ActiveXObject("Microsoft.XMLDOM"),T.async="false",T.loadXML(g.responseText))}catch(t){T=void 0}if(!T||!T.documentElement||T.getElementsByTagName("parsererror").length)throw"Invalid XML";break;default:T=g.responseText}}if("status"in g&&!/^2|1223/.test(g.status))throw g.status+" ("+g.statusText+")";O(!0,[g,T])}catch(t){O(!1,[t,g,T])}}},q=function(t){z||(t="string"==typeof t?t:"Connection aborted",O.abort(),O(!1,[new Error(t),g,null]))},F=function(){z||(d.attempts&&++A==d.attempts?q("Timeout ("+h+")"):(g.abort(),j=!1,O.send()))};if(d.async=!("async"in d)||!!d.async,d.cache="cache"in d&&!!d.cache,d.dataType="dataType"in d?d.dataType.toLowerCase():a,d.responseType="responseType"in d?d.responseType.toLowerCase():"auto",d.user=d.user||"",d.password=d.password||"",d.withCredentials=!!d.withCredentials,d.timeout="timeout"in d?parseInt(d.timeout,10):3e4,d.attempts="attempts"in d?parseInt(d.attempts,10):1,m=h.match(/\/\/(.+?)\//),x=m&&!!m[1]&&m[1]!=location.host,"ArrayBuffer"in t&&p instanceof ArrayBuffer?d.dataType="arraybuffer":"Blob"in t&&p instanceof Blob?d.dataType="blob":"Document"in t&&p instanceof Document?d.dataType="document":"FormData"in t&&p instanceof FormData&&(d.dataType="formdata"),null!==p)switch(d.dataType){case"json":p=JSON.stringify(p);break;case"post":p=r(p)}if(d.headers){var R=function(t,e,n){return e+n.toUpperCase()};for(m in d.headers)E[m.replace(/(^|-)([^-])/g,R)]=d.headers[m]}return"Content-Type"in E||"GET"==n||d.dataType in k&&k[d.dataType]&&(E["Content-Type"]=k[d.dataType]),E.Accept||(E.Accept=d.responseType in M?M[d.responseType]:"*/*"),x||"X-Requested-With"in E||(E["X-Requested-With"]="XMLHttpRequest"),d.cache||"Cache-Control"in E||(E["Cache-Control"]="no-cache"),"GET"==n&&p&&"string"==typeof p&&(h+=(/\?/.test(h)?"&":"?")+p),d.async&&O.send(),O},p=function(t){var n=[],r=0,i=[];return e(function(e){var o=-1,a=function(t){return function(a,u,s,c){var l=++o;return++r,n.push(h(t,e.base+a,u,s,c).then(function(t,n){i[l]=arguments,--r||e(!0,1==i.length?i[0]:[i])},function(){e(!1,arguments)})),e}};e.get=a("GET"),e.post=a("POST"),e.put=a("PUT"),e.delete=a("DELETE"),e.catch=function(t){return e.then(null,t)},e.complete=function(t){var n=function(){t()};return e.then(n,n)},e.map=function(t,e,n,r,i){return a(t.toUpperCase()).call(this,e,n,r,i)};for(var u in t)u in e||(e[u]=t[u]);return e.send=function(){for(var t=0,r=n.length;t<r;++t)n[t].send();return e},e.abort=function(){for(var t=0,r=n.length;t<r;++t)n[t].abort();return e},e})},d={base:"",get:function(){return p(d).get.apply(this,arguments)},post:function(){return p(d).post.apply(this,arguments)},put:function(){return p(d).put.apply(this,arguments)},delete:function(){return p(d).delete.apply(this,arguments)},map:function(){return p(d).map.apply(this,arguments)},xhr2:f,limit:function(t){return u=t,d},setDefaultOptions:function(t){return i=t,d},setDefaultXdrResponseType:function(t){return o=t.toLowerCase(),d},setDefaultDataType:function(t){return a=t.toLowerCase(),d},getOpenRequests:function(){return s}};return d}()},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){function r(t,e){this._id=t,this._clearFn=e}var i=Function.prototype.apply;e.setTimeout=function(){return new r(i.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new r(i.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(14),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return y[d]=r,p(d),d++}function i(t){delete y[t]}function o(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function a(t){if(v)setTimeout(a,0,t);else{var e=y[t];if(e){v=!0;try{o(e)}finally{i(t),v=!1}}}}function u(){p=function(t){e.nextTick(function(){a(t)})}}function s(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}function c(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),p=function(n){t.postMessage(e+n,"*")}}function l(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;a(e)},p=function(e){t.port2.postMessage(e)}}function f(){var t=_.documentElement;p=function(e){var n=_.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}function h(){p=function(t){setTimeout(a,0,t)}}if(!t.setImmediate){var p,d=1,y={},v=!1,_=t.document,x=Object.getPrototypeOf&&Object.getPrototypeOf(t);x=x&&x.setTimeout?x:t,"[object process]"==={}.toString.call(t.process)?u():s()?c():t.MessageChannel?l():_&&"onreadystatechange"in _.createElement("script")?f():h(),x.setImmediate=r,x.clearImmediate=i}}("undefined"==typeof self?"undefined"==typeof t?this:t:self)}).call(e,function(){return this}(),n(1))}]);
!function(n){"use strict";var i=function(t){var e=function(t,e,n){n="function"==typeof n?n():null===n?"":void 0===n?"":n,t[t.length]=encodeURIComponent(e)+"="+encodeURIComponent(n)},n=function(t,o,r){var i,s,a;if("[object Array]"===Object.prototype.toString.call(o))for(i=0,s=o.length;i<s;i++)n(t+"["+("object"==typeof o[i]?i:"")+"]",o[i],r);else if(o&&"[object Object]"===o.toString())for(a in o)o.hasOwnProperty(a)&&(t?n(t+"["+a+"]",o[a],r,e):n(a,o[a],r,e));else if(t)e(r,t,o);else for(a in o)e(r,a,o[a]);return r};return n("",t,[]).join("&").replace(/%20/g,"+")};"object"==typeof t&&"object"==typeof t.exports?t.exports=i:(o=[],r=function(){return i}.apply(e,o),!(void 0!==r&&(t.exports=r)))}(this)},function(t,e,n){(function(t,e,n){!function(t){function o(t){return"function"==typeof t}function r(t){return"object"==typeof t}function i(t){"undefined"!=typeof e?e(t):"undefined"!=typeof n&&n.nextTick?n.nextTick(t):setTimeout(t,0)}var s;t[0][t[1]]=function t(e){var n,a=[],u=[],f=function(t,e){return null==n&&null!=t&&(n=t,a=e,u.length&&i(function(){for(var t=0;t<u.length;t++)u[t]()})),n};return f.then=function(f,c){var p=t(e),l=function(){function t(e){var n,i=0;try{if(e&&(r(e)||o(e))&&o(n=e.then)){if(e===p)throw new TypeError;n.call(e,function(){i++||t.apply(s,arguments)},function(t){i++||p(!1,[t])})}else p(!0,arguments)}catch(t){i++||p(!1,[t])}}try{var e=n?f:c;o(e)?t(e.apply(s,a||[])):p(n,a)}catch(t){p(!1,[t])}};return null!=n?i(l):u.push(l),p},e&&(f=e(f)),f}}([t,"exports"])}).call(e,n(52)(t),n(53).setImmediate,n(12))},function(t,e,n){/*! qwest 4.4.5 (https://github.com/pyrsmk/qwest) */
t.exports=function(){var t="undefined"!=typeof window?window:self,e=n(50),o=n(49),r={},i="json",s="post",a=null,u=0,f=[],c=t.XMLHttpRequest?function(){return new t.XMLHttpRequest}:function(){return new ActiveXObject("Microsoft.XMLHTTP")},p=""===c().responseType,l=function(n,l,d,h,y){n=n.toUpperCase(),d=d||null,h=h||{};for(var v in r)if(!(v in h))if("object"==typeof r[v]&&"object"==typeof h[v])for(var m in r[v])h[v][m]=r[v][m];else h[v]=r[v];var g,x,b,w,E,q=!1,T=!1,k=!1,M=0,P={},I={text:"*/*",xml:"text/xml",json:"application/json",post:"application/x-www-form-urlencoded",document:"text/html"},L={text:"*/*",xml:"application/xml; q=1.0, text/xml; q=0.8, */*; q=0.1",json:"application/json; q=1.0, text/*; q=0.8, */*; q=0.1"},N=!1,A=e(function(e){return e.abort=function(){k||(x&&4!=x.readyState&&x.abort(),N&&(--u,N=!1),k=!0)},e.send=function(){if(!N){if(u==a)return void f.push(e);if(k)return void(f.length&&f.shift().send());if(++u,N=!0,x=c(),g&&("withCredentials"in x||!t.XDomainRequest||(x=new XDomainRequest,T=!0,"GET"!=n&&"POST"!=n&&(n="POST"))),T?x.open(n,l):(x.open(n,l,h.async,h.user,h.password),p&&h.async&&(x.withCredentials=h.withCredentials)),!T)for(var o in P)P[o]&&x.setRequestHeader(o,P[o]);if(p&&"auto"!=h.responseType)try{x.responseType=h.responseType,q=x.responseType==h.responseType}catch(t){}p||T?(x.onload=B,x.onerror=j,T&&(x.onprogress=function(){})):x.onreadystatechange=function(){4==x.readyState&&B()},h.async?"timeout"in x?(x.timeout=h.timeout,x.ontimeout=z):b=setTimeout(z,h.timeout):T&&(x.ontimeout=function(){}),"auto"!=h.responseType&&"overrideMimeType"in x&&x.overrideMimeType(I[h.responseType]),y&&y(x),T?setTimeout(function(){x.send("GET"!=n?d:null)},0):x.send("GET"!=n?d:null)}},e}),B=function(){var e;if(N=!1,clearTimeout(b),f.length&&f.shift().send(),!k){--u;try{if(q){if("response"in x&&null===x.response)throw"The request response is empty";E=x.response}else{if(e=h.responseType,"auto"==e)if(T)e=i;else{var n=x.getResponseHeader("Content-Type")||"";e=n.indexOf(I.json)>-1?"json":n.indexOf(I.xml)>-1?"xml":"text"}switch(e){case"json":if(x.responseText.length)try{E="JSON"in t?JSON.parse(x.responseText):new Function("return ("+x.responseText+")")()}catch(t){throw"Error while parsing JSON body : "+t}break;case"xml":try{t.DOMParser?E=(new DOMParser).parseFromString(x.responseText,"text/xml"):(E=new ActiveXObject("Microsoft.XMLDOM"),E.async="false",E.loadXML(x.responseText))}catch(t){E=void 0}if(!E||!E.documentElement||E.getElementsByTagName("parsererror").length)throw"Invalid XML";break;default:E=x.responseText}}if("status"in x&&!/^2|1223/.test(x.status))throw x.status+" ("+x.statusText+")";A(!0,[x,E])}catch(t){A(!1,[t,x,E])}}},j=function(t){k||(t="string"==typeof t?t:"Connection aborted",A.abort(),A(!1,[new Error(t),x,null]))},z=function(){k||(h.attempts&&++M==h.attempts?j("Timeout ("+l+")"):(x.abort(),N=!1,A.send()))};if(h.async=!("async"in h)||!!h.async,h.cache="cache"in h&&!!h.cache,h.dataType="dataType"in h?h.dataType.toLowerCase():s,h.responseType="responseType"in h?h.responseType.toLowerCase():"auto",h.user=h.user||"",h.password=h.password||"",h.withCredentials=!!h.withCredentials,h.timeout="timeout"in h?parseInt(h.timeout,10):3e4,h.attempts="attempts"in h?parseInt(h.attempts,10):1,w=l.match(/\/\/(.+?)\//),g=w&&!!w[1]&&w[1]!=location.host,"ArrayBuffer"in t&&d instanceof ArrayBuffer?h.dataType="arraybuffer":"Blob"in t&&d instanceof Blob?h.dataType="blob":"Document"in t&&d instanceof Document?h.dataType="document":"FormData"in t&&d instanceof FormData&&(h.dataType="formdata"),null!==d)switch(h.dataType){case"json":d=JSON.stringify(d);break;case"post":d=o(d)}if(h.headers){var C=function(t,e,n){return e+n.toUpperCase()};for(w in h.headers)P[w.replace(/(^|-)([^-])/g,C)]=h.headers[w]}return"Content-Type"in P||"GET"==n||h.dataType in I&&I[h.dataType]&&(P["Content-Type"]=I[h.dataType]),P.Accept||(P.Accept=h.responseType in L?L[h.responseType]:"*/*"),g||"X-Requested-With"in P||(P["X-Requested-With"]="XMLHttpRequest"),h.cache||"Cache-Control"in P||(P["Cache-Control"]="no-cache"),"GET"==n&&d&&"string"==typeof d&&(l+=(/\?/.test(l)?"&":"?")+d),h.async&&A.send(),A},d=function(t){var n=[],o=0,r=[];return e(function(e){var i=-1,s=function(t){return function(s,a,u,f){var c=++i;return++o,n.push(l(t,e.base+s,a,u,f).then(function(t,n){r[c]=arguments,--o||e(!0,1==r.length?r[0]:[r])},function(){e(!1,arguments)})),e}};e.get=s("GET"),e.post=s("POST"),e.put=s("PUT"),e.delete=s("DELETE"),e.catch=function(t){return e.then(null,t)},e.complete=function(t){var n=function(){t()};return e.then(n,n)},e.map=function(t,e,n,o,r){return s(t.toUpperCase()).call(this,e,n,o,r)};for(var a in t)a in e||(e[a]=t[a]);return e.send=function(){for(var t=0,o=n.length;t<o;++t)n[t].send();return e},e.abort=function(){for(var t=0,o=n.length;t<o;++t)n[t].abort();return e},e})},h={base:"",get:function(){return d(h).get.apply(this,arguments)},post:function(){return d(h).post.apply(this,arguments)},put:function(){return d(h).put.apply(this,arguments)},delete:function(){return d(h).delete.apply(this,arguments)},map:function(){return d(h).map.apply(this,arguments)},xhr2:p,limit:function(t){return a=t,h},setDefaultOptions:function(t){return r=t,h},setDefaultXdrResponseType:function(t){return i=t.toLowerCase(),h},setDefaultDataType:function(t){return s=t.toLowerCase(),h},getOpenRequests:function(){return u}};return h}()},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){function o(t,e){this._id=t,this._clearFn=e}var r=Function.prototype.apply;e.setTimeout=function(){return new o(r.call(setTimeout,window,arguments),clearTimeout)},e.setInterval=function(){return new o(r.call(setInterval,window,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(window,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(54),e.setImmediate=setImmediate,e.clearImmediate=clearImmediate},function(t,e,n){(function(t,e){!function(t,n){"use strict";function o(t){"function"!=typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var o={callback:t,args:e};return y[h]=o,d(h),h++}function r(t){delete y[t]}function i(t){var e=t.callback,o=t.args;switch(o.length){case 0:e();break;case 1:e(o[0]);break;case 2:e(o[0],o[1]);break;case 3:e(o[0],o[1],o[2]);break;default:e.apply(n,o)}}function s(t){if(v)setTimeout(s,0,t);else{var e=y[t];if(e){v=!0;try{i(e)}finally{r(t),v=!1}}}}function a(){d=function(t){e.nextTick(function(){s(t)})}}function u(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}function f(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"==typeof n.data&&0===n.data.indexOf(e)&&s(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),d=function(n){t.postMessage(e+n,"*")}}function c(){var t=new MessageChannel;t.port1.onmessage=function(t){var e=t.data;s(e)},d=function(e){t.port2.postMessage(e)}}function p(){var t=m.documentElement;d=function(e){var n=m.createElement("script");n.onreadystatechange=function(){s(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}function l(){d=function(t){setTimeout(s,0,t)}}if(!t.setImmediate){var d,h=1,y={},v=!1,m=t.document,g=Object.getPrototypeOf&&Object.getPrototypeOf(t);g=g&&g.setTimeout?g:t,"[object process]"==={}.toString.call(t.process)?a():u()?f():t.MessageChannel?c():m&&"onreadystatechange"in m.createElement("script")?p():l(),g.setImmediate=o,g.clearImmediate=r}}("undefined"==typeof self?"undefined"==typeof t?this:t:self)}).call(e,function(){return this}(),n(12))}]);

@@ -7,3 +7,7 @@ /* global AFRAME */

var d3 = require('d3-force-3d'),
var ngraph = {
graph: require('ngraph.graph'),
forcelayout: require('ngraph.forcelayout'),
forcelayout3d: require('ngraph.forcelayout3d')
},
qwest = require('qwest');

@@ -17,6 +21,8 @@

jsonUrl: {type: 'string'},
nodes: {parse: JSON.parse, default: '[]'},
links: {parse: JSON.parse, default: '[]'},
numDimensions: {type: 'number', default: 3},
nodeRelSize: {type: 'number', default: 4}, // volume per val unit
lineOpacity: {type: 'number', default: 0.2},
autoColorBy: {type: 'string', default: ''}, // color nodes with the same field equally
autoColorBy: {type: 'string'}, // color nodes with the same field equally
idField: {type: 'string', default: 'id'},

@@ -46,12 +52,2 @@ valField: {type: 'string', default: 'val'},

.filter(function(child) { return child.type === 'PerspectiveCamera' })[0];
// Add force-directed layout
this.data.forceLayout = d3.forceSimulation()
.force('link', d3.forceLink())
.force('charge', d3.forceManyBody())
.force('center', d3.forceCenter())
.stop();
this.data.nodes = [];
this.data.links = [];
},

@@ -69,32 +65,7 @@

if ('jsonUrl' in diff || 'colorField' in diff || 'autoColorBy' in diff || 'linkSourceField' in diff || 'linkTargetField' in diff) {
this.onFrame = null; // Pause simulation
if ('jsonUrl' in diff && elData.jsonUrl) {
// (Re-)load data
qwest.get(elData.jsonUrl).then(function(_, json) {
// auto add color
if (elData.autoColorBy) {
// Color brewer paired set
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928'];
var nodeGroups = {};
json.nodes
.filter(function(node) { return !node[elData.colorField]})
.map(function(node) { return node[elData.autoColorBy] })
.forEach(function(group) { nodeGroups[group] = null });
Object.keys(nodeGroups).forEach(function(group, idx) { nodeGroups[group] = idx });
json.nodes
.filter(function(node) { return !node[elData.colorField] })
.forEach(function(node) {
node[elData.colorField] = parseInt(colors[nodeGroups[node[elData.autoColorBy]] % colors.length].slice(1), 16);
});
}
// parse links
json.links.forEach(function(link) {
link.source = link[elData.linkSourceField];
link.target = link[elData.linkTargetField];
link.id = [link.source, link.target].join(' > ');
});
elData.nodes = json.nodes;

@@ -107,2 +78,12 @@ elData.links = json.links;

// Auto add color to uncolored nodes
autoColorNodes(elData.nodes, elData.autoColorBy, elData.colorField);
// parse links
elData.links.forEach(function(link) {
link.source = link[elData.linkSourceField];
link.target = link[elData.linkTargetField];
link.id = [link.source, link.target].join(' > ');
});
// Add children entities

@@ -136,17 +117,13 @@ var el3d = this.el.object3D;

// Feed data to force-directed layout
elData.forceLayout
.stop()
.alpha(1)// re-heat the simulation
.numDimensions(elData.numDimensions)
.nodes(elData.nodes)
.force('link')
.id(function(d) { return d[elData.idField] })
.links(elData.links);
// Add force-directed layout
var graph = ngraph.graph();
elData.nodes.forEach(function(node) { graph.addNode(node[elData.idField]); });
elData.links.forEach(function(link) { graph.addLink(link.source, link.target); });
var layout = ngraph['forcelayout' + (elData.numDimensions === 2 ? '' : '3d')](graph);
for (var i=0; i<elData.warmupTicks; i++) { elData.forceLayout.tick(); } // Initial ticks before starting to render
for (var i=0; i<elData.warmupTicks; i++) { layout.step(); } // Initial ticks before starting to render
var cntTicks = 0;
var startTickTime = new Date();
elData.forceLayout.on('tick', layoutTick).restart();
this.onFrame = layoutTick;

@@ -157,11 +134,14 @@ //

if (cntTicks++ > elData.cooldownTicks || (new Date()) - startTickTime > elData.cooldownTime) {
elData.forceLayout.stop(); // Stop ticking graph
this.onFrame = null; // Stop ticking graph
}
layout.step(); // Tick it
// Update nodes position
elData.nodes.forEach(function(node) {
var sphere = node.__sphere;
sphere.position.x = node.x;
sphere.position.y = node.y || 0;
sphere.position.z = node.z || 0;
var sphere = node.__sphere,
pos = layout.getNodePosition(node[elData.idField]);
sphere.position.x = pos.x;
sphere.position.y = pos.y || 0;
sphere.position.z = pos.z || 0;
});

@@ -171,7 +151,8 @@

elData.links.forEach(function(link) {
var line = link.__line;
var line = link.__line,
pos = layout.getLinkPosition(graph.getLink(link.source, link.target).id);
line.geometry.vertices = [
new THREE.Vector3(link.source.x, link.source.y || 0, link.source.z || 0),
new THREE.Vector3(link.target.x, link.target.y || 0, link.target.z || 0)
new THREE.Vector3(pos.from.x, pos.from.y || 0, pos.from.z || 0),
new THREE.Vector3(pos.to.x, pos.to.y || 0, pos.to.z || 0)
];

@@ -183,2 +164,21 @@

}
//
function autoColorNodes(nodes, colorBy, colorField) {
if (!colorBy) return;
// Color brewer paired set
var colors = ['#a6cee3','#1f78b4','#b2df8a','#33a02c','#fb9a99','#e31a1c','#fdbf6f','#ff7f00','#cab2d6','#6a3d9a','#ffff99','#b15928'];
var uncoloredNodes = nodes.filter(function(node) { return !node[colorField]}),
nodeGroups = {};
uncoloredNodes.forEach(function(node) { nodeGroups[node[colorBy]] = null });
Object.keys(nodeGroups).forEach(function(group, idx) { nodeGroups[group] = idx });
uncoloredNodes.forEach(function(node) {
node[colorField] = parseInt(colors[nodeGroups[node[colorBy]] % colors.length].slice(1), 16);
});
}
},

@@ -199,3 +199,6 @@

this.data.tooltipEl.setAttribute('value', intersects.length ? intersects[0].object.name : '' );
// Run onFrame ticker
if (this.onFrame) this.onFrame();
}
});
{
"name": "aframe-forcegraph-component",
"version": "1.2.2",
"version": "1.3.0-ngraph",
"description": "A 3D Force-Directed Graph component for A-Frame.",

@@ -44,6 +44,9 @@ "main": "index.js",

"homepage": "https://github.com/vasturiano/aframe-forcegraph-component#readme",
"publishConfig": {
"tag": "ngraph"
},
"dependencies": {
"d3-binarytree": "^0.1",
"d3-force-3d": "^1.0",
"d3-octree": "^0.1",
"ngraph.forcelayout": "~0.1.2",
"ngraph.forcelayout3d": "~0.0.16",
"ngraph.graph": "~0.0.12",
"qwest": "^4.4"

@@ -50,0 +53,0 @@ },

@@ -21,3 +21,5 @@ ## aframe-forcegraph-component

| ------------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------- |
| json-url | URL of JSON file containing graph data. Should contain an object with two list properties: *nodes* and *links* | |
| json-url | URL of JSON file to load graph data directly from. Will override content of the *nodes* and *links* component properties so either use one or the other. JSON should contain an object with two list properties: *nodes* and *links* | |
| nodes | List of node objects. *Example*: [{"id": 1, "name": "first"}, {"id": 2, "name": "second"}] | [] |
| links | List of link objects. *Example*: [{"source": 1, "target": 2}] | [] |
| num-dimensions | Number of dimensions to run the force simulation on (1, 2 or 3) | 3 |

@@ -24,0 +26,0 @@ | node-rel-size | Node sphere volume per val unit | 4 |

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc