aframe-forcegraph-component
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -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(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"},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],this.data.forceLayout=r.forceSimulation().force("link",r.forceLink()).force("charge",r.forceManyBody()).force("center",r.forceCenter()).stop()},remove:function(){this.data.tooltipEl.remove()},update:function(t){function e(){(l++>o.cooldownTicks||new Date-f>o.cooldownTime)&&o.forceLayout.stop(),o.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}),o.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()})}function n(t,e,n){if(e){var r=["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],i=t.filter(function(t){return!t[n]}),o={};i.forEach(function(t){o[t[e]]=null}),Object.keys(o).forEach(function(t,e){o[t]=e}),i.forEach(function(t){t[n]=parseInt(r[o[t[e]]%r.length].slice(1),16)})}}var r=this,o=this.data,a=AFRAME.utils.diff(o,t);"jsonUrl"in a&&o.jsonUrl&&i.get(o.jsonUrl).then(function(t,e){o.nodes=e.nodes,o.links=e.links,r.update(o)}),n(o.nodes,o.autoColorBy,o.colorField),o.links.forEach(function(t){t.source=t[o.linkSourceField],t.target=t[o.linkTargetField],t.id=[t.source,t.target].join(" > ")});var s=this.el.object3D;s.children.forEach(s.remove),o.nodes.forEach(function(t){var e=new THREE.MeshLambertMaterial({color:t[o.colorField]||16777130,transparent:!0});e.opacity=.75;var n=new THREE.Mesh(new THREE.SphereGeometry(Math.cbrt(t[o.valField]||1)*o.nodeRelSize,8,8),e);n.name=t[o.nameField],s.add(t.__sphere=n)});var u=new THREE.LineBasicMaterial({color:15790320,transparent:!0});u.opacity=o.lineOpacity,o.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)],s.add(t.__line=e)}),o.forceLayout.stop().alpha(1).numDimensions(o.numDimensions).nodes(o.nodes).force("link").id(function(t){return t[o.idField]}).links(o.links);for(var c=0;c<o.warmupTicks;c++)o.forceLayout.tick();var l=0,f=new Date;o.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&&s())}function s(){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 u(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 u(t,e)),1!==d.length||y||i(s)},u.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,s,u,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[s=+a]))return r[s]=l,t;if(o=+t._x.call(null,c.data),e===o)return l.next=c,r?r[s]=l:t._root=l,t;do r=r?r[s]=new Array(2):t._root=new Array(2),(a=e>=(i=(f+h)/2))?f=i:h=i;while((s=+a)===(u=+(o>=i)));return r[u]=c,r[s]=l,t}function n(t){var n,r,i=t.length,o=new Array(i),a=1/0,s=-(1/0);for(n=0;n<i;++n)isNaN(r=+this._x.call(null,t[n]))||(o[n]=r,r<a&&(a=r),r>s&&(s=r));for(s<a&&(a=this._x0,s=this._x1),this.cover(a).cover(s),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 s(t){for(var e={data:t.data},n=e;t=t.next;)n=n.next={data:t.data};return e}var u=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,s=this._x0,u=this._x1,c=[],l=this._root;for(l&&c.push(new h(l,s,u)),null==e?e=1/0:(s=t-e,u=t+e);o=c.pop();)if(!(!(l=o.node)||(r=o.x0)>u||(i=o.x1)<s))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,s=t-p,u=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,s,u,c,l=this._root,f=this._x0,h=this._x1;if(!l)return this;if(l.length)for(;;){if((s=o>=(a=(f+h)/2))?f=a:h=a,e=l,!(l=l[u=+s]))return this;if(!l.length)break;e[u+1&1]&&(n=e,c=u)}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[u]=i:delete e[u],(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 s=(r+i)/2;(n=a[1])&&o.push(new h(n,s,i)),(n=a[0])&&o.push(new h(n,r,s))}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,s=e.x1,u=(a+s)/2;(o=i[0])&&n.push(new h(o,a,u)),(o=i[1])&&n.push(new h(o,u,s))}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=s(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]=s(e));return n},w.add=u,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 s(t){return t.x+t.vx}function u(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,s=0,u=0,c=0;for(r=0;r<a;++r)o=i[r],s+=o.x||0,u+=o.y||0,c+=o.z||0;for(s=s/a-t,u=u/a-e,c=c/a-n,r=0;r<a;++r)o=i[r],s&&(o.x-=s),u&&(o.y-=u),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 s=[e,n,r,i,o,a],u=s[0],c=s[1],l=s[2],h=s[f],d=s[f+1],T=s[f+2],N=t.data,b=t.r,z=w+b;if(!N)return u>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,M=f>2?g-N.z-N.vz:0,k=A*A+E*E+M*M;k<z*z&&(0===A&&(A=_(),k+=A*A),f>1&&0===E&&(E=_(),k+=E*E),f>2&&0===M&&(M=_(),k+=M*M),k=(z-(k=Math.sqrt(k)))/k*p,y.vx+=(A*=k)*(z=(b*=b)/(m+b)),f>1&&(y.vy+=(E*=k)*z),f>2&&(y.vz+=(M*=k)*z),N.vx-=A*(z=1-z),f>1&&(N.vy-=E*z),f>2&&(N.vz-=M*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,s):2===f?n.quadtree(l,s,u):3===f?r.octree(l,s,u,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-u[f])/c*e*s[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]);s=new Array(l),o(),u=new Array(l),a()}}function o(){if(c)for(var e=0,n=t.length;e<n;++e)s[e]=+x(t[e],e,t)}function a(){if(c)for(var e=0,n=t.length;e<n;++e)u[e]=+g(t[e],e,t)}var s,u,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 s(){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 u(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=[]),s(),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(u),c):l},nodes:function(e){return arguments.length?(t=e,s(),v.each(u),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,u(e)),c):v.get(t)},find:function(){var e,n,r,i,o,a,s=Array.prototype.slice.call(arguments),u=s.shift()||0,c=(l>1?s.shift():null)||0,f=(l>2?s.shift():null)||0,h=s.shift()||1/0,p=0,d=t.length;for(h*=h,p=0;p<d;++p)o=t[p],e=u-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=s.length,y=(1===u?e.binarytree(s,h):2===u?n.quadtree(s,h,p):3===u?r.octree(s,h,p,d):null).visitAfter(o);for(l=t,i=0;i<f;++i)c=s[i],y.visit(a)}function i(){if(s){var t,e,n=s.length;for(f=new Array(n),t=0;t<n;++t)e=s[t],f[e.index]=+y(e,t,s)}}function o(t){var e,n,r,i,o,a,s=0;if(t.length){for(r=i=o=a=0;a<4;++a)(e=t[a])&&(n=e.value)&&(s+=n,r+=n*(e.x||0),i+=n*(e.y||0),o+=n*(e.z||0));t.x=r/s,u>1&&(t.y=i/s),u>2&&(t.z=o/s)}else{e=t,e.x=e.data.x,u>1&&(e.y=e.data.y),u>2&&(e.z=e.data.z);do s+=f[e.data.index];while(e=e.next)}t.value=s}function a(t,e,n,r,i){if(!t.value)return!0;var o=[n,r,i][u-1],a=t.x-c.x,s=u>1?t.y-c.y:0,h=u>2?t.z-c.z:0,p=o-e,d=a*a+s*s+h*h;if(p*p/w<d)return d<g&&(0===a&&(a=_(),d+=a*a),u>1&&0===s&&(s=_(),d+=s*s),u>2&&0===h&&(h=_(),d+=h*h),d<x&&(d=Math.sqrt(x*d)),c.vx+=a*t.value*l/d,u>1&&(c.vy+=s*t.value*l/d),u>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),u>1&&0===s&&(s=_(),d+=s*s),u>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,u>1&&(c.vy+=s*p),u>2&&(c.vz+=h*p));while(t=t.next)}}var s,u,c,l,f,y=v(-30),x=1,g=1/0,w=.81;return t.initialize=function(t,e){s=t,u=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},M=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=M,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 s in t)r.set(s,t[s]);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 s(){}function u(t,e){var n=new s;if(t instanceof s)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!=u?u(e):null!=s?e.sort(s):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!=u&&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 s,u,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 s=t,c},rollup:function(t){return u=t,c}}},f=n.prototype;s.prototype=u.prototype={constructor:s,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=u,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._,s=r(t+"",a),u=-1,c=s.length;{if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++u<c;)if(n=(t=s[u]).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(;++u<c;)if((n=(t=s[u]).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,s,u,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(s=+t._x.call(null,p.data),u=+t._y.call(null,p.data),e===s&&n===u)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=(u>=a)<<1|s>=o));return i[h]=p,i[f]=d,t}function n(t){var n,r,i,o,a=t.length,s=new Array(a),u=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))||(s[r]=i,u[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,s[r],u[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 s(null==e?i:e,null==n?o:n,NaN,NaN,NaN,NaN);return null==t?r:r.addAll(t)}function s(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 u(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,s,u=i-n,c=this._root;switch(s=(e<(r+o)/2)<<1|t<(n+i)/2){case 0:do a=new Array(4),a[s]=c,c=a;while(u*=2,i=n+u,o=r+u,t>i||e>o);break;case 1:do a=new Array(4),a[s]=c,c=a;while(u*=2,n=i-u,o=r+u,n>t||e>o);break;case 2:do a=new Array(4),a[s]=c,c=a;while(u*=2,i=n+u,r=o-u,t>i||r>e);break;case 3:do a=new Array(4),a[s]=c,c=a;while(u*=2,n=i-u,r=o-u,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,s,u,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);u=y.pop();)if(!(!(v=u.node)||(i=u.x0)>h||(o=u.y0)>d||(a=u.x1)<l||(s=u.y1)<f))if(v.length){var _=(i+a)/2,x=(o+s)/2;y.push(new p(v[3],_,x,a,s),new p(v[2],i,x,_,s),new p(v[1],_,o,a,x),new p(v[0],i,o,_,x)),(c=(e>=x)<<1|t>=_)&&(u=y[y.length-1],y[y.length-1]=y[y.length-1-c],y[y.length-1-c]=u)}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,s,u,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>=(s=(d+v)/2))?d=s:v=s,(l=a>=(u=(y+_)/2))?y=u:_=u,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,s=[],u=this._root;for(u&&s.push(new p(u,this._x0,this._y0,this._x1,this._y1));e=s.pop();)if(!t(u=e.node,r=e.x0,i=e.y0,o=e.x1,a=e.y1)&&u.length){var c=(r+o)/2,l=(i+a)/2;(n=u[3])&&s.push(new p(n,c,l,o,a)),(n=u[2])&&s.push(new p(n,r,l,c,a)),(n=u[1])&&s.push(new p(n,c,i,o,l)),(n=u[0])&&s.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,s=e.y0,u=e.x1,c=e.y1,l=(a+u)/2,f=(s+c)/2;(o=i[0])&&n.push(new p(o,a,s,l,f)),(o=i[1])&&n.push(new p(o,l,s,u,f)),(o=i[2])&&n.push(new p(o,a,f,l,c)),(o=i[3])&&n.push(new p(o,l,f,u,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=s.prototype;T.copy=function(){var t,e,n=new s(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=u(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]=u(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,u(),_=0}}function s(){var t=g.now(),e=t-v;e>y&&(x-=e,v=t)}function u(){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(s,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,s,u,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>=(s=(w+N)/2))?w=s:N=s,(d=r>=(u=(m+b)/2))?m=u:b=u,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>=(s=(w+N)/2))?w=s:N=s,(d=r>=(u=(m+b)/2))?m=u:b=u;while((y=d<<2|p<<1|h)===(v=(f>=u)<<2|(l>=s)<<1|c>=a));return o[v]=_,o[y]=x,t}function n(t){var n,r,i,o,a,s=t.length,u=new Array(s),c=new Array(s),l=new Array(s),f=1/0,h=1/0,p=1/0,d=-(1/0),y=-(1/0),v=-(1/0);for(r=0;r<s;++r)isNaN(i=+this._x.call(null,n=t[r]))||isNaN(o=+this._y.call(null,n))||isNaN(a=+this._z.call(null,n))||(u[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<s;++r)e(this,u[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 s(t,e,n,r){var s=new u(null==e?i:e,null==n?o:n,null==r?a:r,NaN,NaN,NaN,NaN,NaN,NaN);return null==t?s:s.addAll(t)}function u(t,e,n,r,i,o,a,s,u){this._x=t,this._y=e,this._z=n,this._x0=r,this._y0=i,this._z0=o,this._x1=a,this._y1=s,this._z1=u,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,s=this._y1,u=this._z1;if(isNaN(r))a=(r=Math.floor(t))+1,s=(i=Math.floor(e))+1,u=(o=Math.floor(n))+1;else{if(!(r>t||t>a||i>e||e>s||o>n||n>u))return this;var c,l,f=a-r,h=this._root;switch(l=(n<(o+u)/2)<<2|(e<(i+s)/2)<<1|t<(r+a)/2){case 0:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,s=i+f,u=o+f,t>a||e>s||n>u);break;case 1:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,s=i+f,u=o+f,r>t||e>s||n>u);break;case 2:do c=new Array(8),c[l]=h,h=c;while(f*=2, | ||
a=r+f,i=s-f,u=o+f,t>a||i>e||n>u);break;case 3:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,i=s-f,u=o+f,r>t||i>e||n>u);break;case 4:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,s=i+f,o=u-f,t>a||e>s||o>n);break;case 5:do c=new Array(8),c[l]=h,h=c;while(f*=2,r=a-f,s=i+f,o=u-f,r>t||e>s||o>n);break;case 6:do c=new Array(8),c[l]=h,h=c;while(f*=2,a=r+f,i=s-f,o=u-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=s-f,o=u-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=s,this._z1=u,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,s,u,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||(s=f.z0)>g||(u=f.x1)<p||(c=f.y1)<y||(l=f.z1)<v))if(m.length){var T=(o+u)/2,N=(a+c)/2,b=(s+l)/2;w.push(new d(m[7],T,N,b,u,c,l),new d(m[6],o,N,b,T,c,l),new d(m[5],T,a,b,u,N,l),new d(m[4],o,a,b,T,N,l),new d(m[3],T,N,s,u,c,b),new d(m[2],o,N,s,T,c,b),new d(m[1],T,a,s,u,N,b),new d(m[0],o,a,s,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),M=z*z+A*A+E*E;if(M<r){var k=Math.sqrt(r=M);p=t-k,y=e-k,v=n-k,_=t+k,x=e+k,g=n+k,i=m.data}}return i},v=function(t){if(isNaN(o=+this._x.call(null,t))||isNaN(a=+this._y.call(null,t))||isNaN(s=+this._z.call(null,t)))return this;var e,n,r,i,o,a,s,u,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>=(u=(_+w)/2))?_=u:w=u,(h=a>=(c=(x+m)/2))?x=c:m=c,(p=s>=(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,s,u,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,s=e.y1,u=e.z1)&&l.length){var f=(r+a)/2,h=(i+s)/2,p=(o+u)/2;(n=l[7])&&c.push(new d(n,f,h,p,a,s,u)),(n=l[6])&&c.push(new d(n,r,h,p,f,s,u)),(n=l[5])&&c.push(new d(n,f,i,p,a,h,u)),(n=l[4])&&c.push(new d(n,r,i,p,f,h,u)),(n=l[3])&&c.push(new d(n,f,h,o,a,s,p)),(n=l[2])&&c.push(new d(n,r,h,o,f,s,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,s=e.y0,u=e.z0,c=e.x1,l=e.y1,f=e.z1,h=(a+c)/2,p=(s+l)/2,y=(u+f)/2;(o=i[0])&&n.push(new d(o,a,s,u,h,p,y)),(o=i[1])&&n.push(new d(o,h,s,u,c,p,y)),(o=i[2])&&n.push(new d(o,a,p,u,h,l,y)),(o=i[3])&&n.push(new d(o,h,p,u,c,l,y)),(o=i[4])&&n.push(new d(o,a,s,y,h,p,f)),(o=i[5])&&n.push(new d(o,h,s,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=s.prototype=u.prototype;b.copy=function(){var t,e,n=new u(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=s,Object.defineProperty(t,"__esModule",{value:!0})})},function(t,e,n){var r,i;/** | ||
* @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 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,s;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(s in r)r.hasOwnProperty(s)&&(t?n(t+"["+s+"]",r[s],i,e):n(s,r[s],i,e));else if(t)e(i,t,r);else for(s in r)e(i,s,r[s]);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,s=[],u=[],c=function(t,e){return null==n&&null!=t&&(n=t,s=e,u.length&&o(function(){for(var t=0;t<u.length;t++)u[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,s||[])):f(n,s)}catch(t){f(!1,[t])}};return null!=n?o(h):u.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",s=null,u=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={},M={text:"*/*",xml:"text/xml",json:"application/json",post:"application/x-www-form-urlencoded",document:"text/html"},k={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&&(--u,j=!1),z=!0)},e.send=function(){if(!j){if(u==s)return void c.push(e);if(z)return void(c.length&&c.shift().send());if(++u,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=R):w=setTimeout(R,d.timeout):b&&(g.ontimeout=function(){}),"auto"!=d.responseType&&"overrideMimeType"in g&&g.overrideMimeType(M[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){--u;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(M.json)>-1?"json":n.indexOf(M.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]))},R=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 F=function(t,e,n){return e+n.toUpperCase()};for(m in d.headers)E[m.replace(/(^|-)([^-])/g,F)]=d.headers[m]}return"Content-Type"in E||"GET"==n||d.dataType in M&&M[d.dataType]&&(E["Content-Type"]=M[d.dataType]),E.Accept||(E.Accept=d.responseType in k?k[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,s,u,c){var l=++o;return++r,n.push(h(t,e.base+a,s,u,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 s in t)s in e||(e[s]=t[s]);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 s=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 u}};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 s(){p=function(t){e.nextTick(function(){a(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 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)?s():u()?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))}]); |
65
index.js
@@ -16,6 +16,8 @@ /* global AFRAME */ | ||
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'}, | ||
@@ -52,5 +54,2 @@ valField: {type: 'string', default: 'val'}, | ||
.stop(); | ||
this.data.nodes = []; | ||
this.data.links = []; | ||
}, | ||
@@ -68,32 +67,5 @@ | ||
if ('jsonUrl' in diff || 'colorField' in diff || 'autoColorBy' in diff || 'linkSourceField' in diff || 'linkTargetField' in diff) { | ||
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; | ||
@@ -106,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 | ||
@@ -179,2 +161,21 @@ var el3d = this.el.object3D; | ||
} | ||
// | ||
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); | ||
}); | ||
} | ||
}, | ||
@@ -181,0 +182,0 @@ |
{ | ||
"name": "aframe-forcegraph-component", | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"description": "A 3D Force-Directed Graph component for A-Frame.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -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 too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1156209
83
3819