Comparing version 2.0.0-alpha20 to 2.0.0-alpha21
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";n.d(t,"d",function(){return i}),n.d(t,"e",function(){return o}),n.d(t,"a",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"c",function(){return c});var r=n(2);function i(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function o(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function a(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:Object(r.c)();return{x:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}(e)/(2*t),y:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}(e)/(2*t)}}function s(e){return{x:i(e),y:o(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function c(e){if(void 0!==e.wheelDelta)return e.wheelDelta/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"linear",function(){return o}),n.d(r,"quadraticIn",function(){return a}),n.d(r,"quadraticOut",function(){return s}),n.d(r,"quadraticInOut",function(){return c}),n.d(r,"cubicIn",function(){return u}),n.d(r,"cubicOut",function(){return h}),n.d(r,"cubicInOut",function(){return l});var i=n(3),o=function(e){return e},a=function(e){return e*e},s=function(e){return e*(2-e)},c=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},u=function(e){return e*e*e},h=function(e){return--e*e*e+1},l=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},f=n(5);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return b});var y={easing:"quadraticInOut",duration:150},b=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=v(this,m(t).call(this))).x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.previousState=e.getState(),e.enabled=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,i["EventEmitter"]),function(e,t,n){t&&p(e.prototype,t),n&&p(e,n)}(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:(t-this.x+this.ratio/2/i)*(r/this.ratio),y:(this.y-n+this.ratio/2/o)*(r/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:this.ratio/r*t+this.x-this.ratio/2/i,y:-(this.ratio/r*n-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*e.width/8,n=0*e.height/8,r=this.viewportToGraph(e,0-t,0-n),i=this.viewportToGraph(e,e.width+t,0-n),o=this.viewportToGraph(e,0,e.height+n);return{x1:r.x,y1:r.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"animate",value:function(e,t,n){var i=this;if(!this.enabled)return this;var o="function"==typeof(t=Object(f.a)({},y,t)).easing?t.easing:r[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var a=Date.now(),s=this.getState(),c=function r(){var c=(Date.now()-a)/t.duration;if(c>=1)return i.nextFrame=null,i.setState(e),void("function"==typeof n&&n());var u=o(c),h={};"x"in e&&(h.x=s.x+(e.x-s.x)*u),"y"in e&&(h.y=s.y+(e.y-s.y)*u),"angle"in e&&(h.angle=s.angle+(e.angle-s.angle)*u),"ratio"in e&&(h.ratio=s.ratio+(e.ratio-s.ratio)*u),i.setState(h),i.nextFrame=requestAnimationFrame(r)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(c)):c()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}}]),t}()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){var n=document.createElement(e);if(!t)return n;for(var r in t)if("style"===r)for(var i in t[r])n.style[i]=t[r][i];else n.setAttribute(r,t[r]);return n}function o(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function a(e){var t,n=r(e.x,2),i=n[0],o=n[1],a=r(e.y,2),s=a[0],c=a[1],u=Math.max(o-i,c-s);0===u&&(u=1);var h=(o+i)/2,l=(c+s)/2;return(t=function(e){return{x:.5+(e.x-h)/u,y:.5+(e.y-l)/u}}).applyTo=function(e){e.x=.5+(e.x-h)/u,e.y=.5+(e.y-l)/u},t.inverse=function(e){return{x:h+u*(e.x-.5),y:l+u*(e.y-.5)}},t.ratio=u,t}n.d(t,"a",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return a})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(u=n.slice()).length,c=0;c<a;c++)u[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(1),i=n(10),o=n(0);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l=function(t){function n(e,t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?h(e):t}(this,c(n).call(this,e,t))).container=e,r.camera=t,r.enabled=!0,r.hasDragged=!1,r.downStartTime=null,r.lastMouseX=null,r.lastMouseY=null,r.isMouseDown=!1,r.isMoving=!1,r.movingTimeout=null,r.startCameraState=null,r.lastCameraState=null,r.clicks=0,r.doubleClickTimeout=null,r.wheelLock=!1,r.handleClick=r.handleClick.bind(h(h(r))),r.handleDown=r.handleDown.bind(h(h(r))),r.handleUp=r.handleUp.bind(h(h(r))),r.handleMove=r.handleMove.bind(h(h(r))),r.handleWheel=r.handleWheel.bind(h(h(r))),r.handleOut=r.handleOut.bind(h(h(r))),e.addEventListener("click",r.handleClick,!1),e.addEventListener("mousedown",r.handleDown,!1),e.addEventListener("mousemove",r.handleMove,!1),e.addEventListener("DOMMouseScroll",r.handleWheel,!1),e.addEventListener("mousewheel",r.handleWheel,!1),e.addEventListener("mouseout",r.handleOut,!1),document.addEventListener("mouseup",r.handleUp,!1),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(n,i["a"]),function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.hasDragged||this.emit("click",Object(o.b)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=Object(o.a)(e),n=this.camera.getState(),i=n.ratio/2.2,a={width:this.container.offsetWidth,height:this.container.offsetHeight},s=Object(o.d)(e),c=Object(o.e)(e),u=new r.a;u.ratio=i,u.x=n.x,u.y=n.y;var h=this.camera.viewportToGraph(a,s,c),l=this.camera.viewportToGraph(a,t.x,t.y),f=u.viewportToGraph(a,s,c),d=u.viewportToGraph(a,t.x,t.y),p=f.x-d.x-h.x+l.x,v=f.y-d.y-h.y+l.y;return this.camera.animate({x:n.x-p,y:n.y-v,ratio:i},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.lastMouseX=Object(o.d)(e),this.lastMouseY=Object(o.e)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",Object(o.b)(e)))}},{key:"handleUp",value:function(t){var n=this;if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var r=Object(o.d)(t),i=Object(o.e)(t),a=this.camera.getState(),s=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:a.x+3*(a.x-s.x),y:a.y+3*(a.y-s.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===i||this.camera.setState({x:a.x,y:a.y}),this.isMoving=!1,e(function(){return n.hasDragged=!1}),this.emit("mouseup",Object(o.b)(t))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",Object(o.b)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var n={width:this.container.offsetWidth,height:this.container.offsetHeight},r=Object(o.d)(e),i=Object(o.e)(e),a=this.camera.viewportToGraph(n,this.lastMouseX,this.lastMouseY),s=this.camera.viewportToGraph(n,r,i),c=a.x-s.x,u=a.y-s.y,h=this.camera.getState(),l=h.x+c,f=h.y+u;this.camera.setState({x:l,y:f}),this.lastMouseX=r,this.lastMouseY=i}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!this.enabled)return!1;var n=Object(o.c)(e);if(!n)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=n>0?1/1.7:1.7,a=this.camera.getState(),s=i*a.ratio,c=Object(o.a)(e),u={width:this.container.offsetWidth,height:this.container.offsetHeight},h=Object(o.d)(e),l=Object(o.e)(e),f=new r.a;f.ratio=s,f.x=a.x,f.y=a.y;var d=this.camera.viewportToGraph(u,h,l),p=this.camera.viewportToGraph(u,c.x,c.y),v=f.viewportToGraph(u,h,l),m=f.viewportToGraph(u,c.x,c.y),g=v.x-m.x-d.x+p.x,y=v.y-m.y-d.y+p.y;return this.camera.animate({x:a.x-g,y:a.y-y,ratio:s},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),n}()}).call(this,n(15).setImmediate)},function(e,t,n){"use strict";function r(e){e=e||{};for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,o=n.length;i<o;i++)if(n[i])for(var a in n[i])e[a]=n[i][a];return e}n.d(t,"a",function(){return r})},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},function(e,t,n){var r=n(6);function i(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.nodes(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getNodeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f}var o=i;o.nodeExtent=i,o.edgeExtent=function(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.edges(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getEdgeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f},e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e,t){var n=e.length,r=t.length;if(0!==r){e.length+=t.length;for(var i=0;i<r;i++)e[n+i]=t[i]}}},function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,a(t).call(this))).container=e,r.camera=n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}()},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n // gl_FragColor = mix(color0, v_color, t);\n gl_FragColor = mix(color0, v_color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float min_thickness = 1.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness * pow_ratio / u_scale;\n\n // Min thickness for AA\n thickness = max(min_thickness, thickness);\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 2.6;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(16),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,o={},a=!1,s=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&h(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){h(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){h(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(h,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return o[i]=a,r(i),i++},c.clearImmediate=u}function u(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{u(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(8),n(17))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var e=s(f);h=!0;for(var t=u.length;t;){for(c=u,u=[];++l<t;)c&&c[l].run();l=-1,t=u.length}c=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,a(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}(),u=n(1),h=n(9),l=n.n(h);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=4,p=5,v=0,m=1,g=2,y=3,b=1,w=2,x=3,_=4;function E(e,t,n,r,i,o,a){return e<r+o&&e+n>r&&t<i+a&&t+n>i}function T(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function S(e,t,n,r,i,o){var a=e<n+i/2;return t<r+o/2?a?b:w:a?x:_}var A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=t||{};var n=Math.pow(4,p);this.data=new Float32Array(d*((4*n-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(e,[{key:"add",value:function(e,t,n,r){return function(e,t,n,r,i,o,a){for(var s=i-a,c=o-a,u=2*a,h=0,l=0;;){if(h>=e)return n[l]=n[l]||[],void n[l].push(r);var f=4*l+d,p=4*l+2*d,b=4*l+3*d,w=4*l+4*d,x=E(s,c,u,t[f+v],t[f+m],t[f+g],t[f+y]),_=E(s,c,u,t[p+v],t[p+m],t[p+g],t[p+y]),T=E(s,c,u,t[b+v],t[b+m],t[b+g],t[b+y]),S=E(s,c,u,t[w+v],t[w+m],t[w+g],t[w+y]),A=x+_+T+S;if(0===A)throw new Error("sigma/quadtree.insertNode: no collision (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(3===A)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(A>1)return n[l]=n[l]||[],void n[l].push(r);h++,x&&(l=f),_&&(l=p),T&&(l=b),S&&(l=w)}}(p,this.data,this.containers,e,t,n,r),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[m]=e.y,this.data[g]=e.width,this.data[y]=e.height,function(e,t){for(var n=[0,0];n.length;){var r=n.pop(),i=n.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,c=4*i+4*d,u=t[i+v],h=t[i+m],l=t[i+g]/2,f=t[i+y]/2;t[o+v]=u,t[o+m]=h,t[o+g]=l,t[o+y]=f,t[a+v]=u+l,t[a+m]=h,t[a+g]=l,t[a+y]=f,t[s+v]=u,t[s+m]=h+f,t[s+g]=l,t[s+y]=f,t[c+v]=u+l,t[c+m]=h+f,t[c+g]=l,t[c+y]=f,r<e-1&&(n.push(c,r+1),n.push(s,r+1),n.push(a,r+1),n.push(o,r+1))}}(p,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var n=[],r=0,i=0;do{this.containers[r]&&n.push.apply(n,this.containers[r]),r=4*r+S(e,t,this.data[r+v],this.data[r+m],this.data[r+g],this.data[r+y])*d,i++}while(i<=p);return n}},{key:"rectangle",value:function(e,t,n,r,i){var o=this.lastRectangle;if(o&&e===o.x1&&n===o.x2&&t===o.y1&&r===o.y2&&i===o.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:n,y2:r,height:i},!function(e,t,n,r){return e===n||t===r}(e,t,n,r))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var a=function(e,t,n,r,i,o,a){for(var s,c=[0,0],u=[];c.length;){var h=c.pop(),f=c.pop();if((s=n[f])&&l()(u,s),!(h>=e)){var p=4*f+d,b=4*f+2*d,w=4*f+3*d,x=4*f+4*d,_=T(r,i,o,a,t[p+v],t[p+m],t[p+g],t[p+y]),E=T(r,i,o,a,t[b+v],t[b+m],t[b+g],t[b+y]),S=T(r,i,o,a,t[w+v],t[w+m],t[w+g],t[w+y]),A=T(r,i,o,a,t[x+v],t[x+m],t[x+g],t[x+y]);_&&c.push(p,h+1),E&&c.push(b,h+1),S&&c.push(w,h+1),A&&c.push(x,h+1)}}return u}(p,this.data,this.containers,e,t,Math.abs(e-n)||Math.abs(t-r),i);return this.cache=a,this.cache}}]),e}(),L=n(4),O=n(7),k=n(6),P=n.n(k);function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function j(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var R=function(){function e(t,n){M(this,e),this.index=t,this.x=0,this.y=0,this.size=2,this.color=n.defaultNodeColor,this.hidden=!1,this.label=""}return j(e,[{key:"assign",value:function(e){"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden),"label"in e&&(this.label=e.label)}}]),e}(),F=function(){function e(t,n){M(this,e),this.index=t,this.size=1,this.color=n.defaultEdgeColor,this.hidden=!1}return j(e,[{key:"assign",value:function(e){"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden)}}]),e}();function N(e,t,n){var r="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return i}var D=N.bind(null,"VERTEX"),z=N.bind(null,"FRAGMENT");function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),e}var Y=function(){function e(t,n,r){I(this,e),this.vertexShaderSource=n,this.fragmentShaderSource=r,this.load(t)}return G(e,[{key:"load",value:function(e){return this.vertexShader=D(e,this.vertexShaderSource),this.fragmentShader=z(e,this.fragmentShaderSource),this.program=function(e,t){var n,r,i=e.createProgram();for(n=0,r=t.length;n<r;n++)e.attachShader(i,t[n]);if(e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw e.deleteProgram(i),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return i}(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();function H(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function V(e,t,n){return e[0]=t,e[4]=arguments.length>2?n:t,e}function B(e,t){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],h=e[8],l=t[0],f=t[1],d=t[2],p=t[3],v=t[4],m=t[5],g=t[6],y=t[7],b=t[8];return e[0]=l*n+f*o+d*c,e[1]=l*r+f*a+d*u,e[2]=l*i+f*s+d*h,e[3]=p*n+v*o+m*c,e[4]=p*r+v*a+m*u,e[5]=p*i+v*s+m*h,e[6]=g*n+y*o+b*c,e[7]=g*r+y*a+b*u,e[8]=g*i+y*s+b*h,e}var X={},q=new Int8Array(4),W=new Int32Array(q.buffer,0,1),K=new Float32Array(q.buffer,0,1),$=/^\s*rgba?\s*\(/,Q=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Z(e){if(void 0!==X[e])return X[e];var t=0,n=0,r=0,i=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16));else if($.test(e)){var o=e.match(Q);t=+o[1],n=+o[2],r=+o[3],o[4]&&(i=+o[4])}var a=4278190079&((i=255*i|0)<<24|r<<16|n<<8|t);W[0]=a;var s=K[0];return X[e]=s,s}function J(e,t){var n=e.angle,r=e.ratio,i=e.x,o=e.y,a=t.width,s=t.height,c=H(),u=Math.min(a,s),h=function(e,t,n){return e[6]=t,e[7]=n,e}(H(),-i,-o),l=V(H(),1/r),f=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}(H(),-n);return B(c,V(H(),u/a*2,u/s*2)),B(c,f),B(c,l),B(c,h),c}var ee=n(11),te=n.n(ee),ne=n(12),re=n.n(ne);function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=4,he=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ae(this,se(t).call(this,e,te.a,re.a))).gl=e,n.array=null,n.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.buffer);var r=n.program;return n.positionLocation=e.getAttribLocation(r,"a_position"),n.sizeLocation=e.getAttribLocation(r,"a_size"),n.colorLocation=e.getAttribLocation(r,"a_color"),n.matrixLocation=e.getUniformLocation(r,"u_matrix"),n.ratioLocation=e.getUniformLocation(r,"u_ratio"),n.scaleLocation=e.getUniformLocation(r,"u_scale"),e.enableVertexAttribArray(n.positionLocation),e.enableVertexAttribArray(n.sizeLocation),e.enableVertexAttribArray(n.colorLocation),e.vertexAttribPointer(n.positionLocation,2,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(n.sizeLocation,1,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(n.colorLocation,4,e.UNSIGNED_BYTE,!0,ue*Float32Array.BYTES_PER_ELEMENT,12),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(t,Y),function(e,t,n){t&&oe(e.prototype,t),n&&oe(e,n)}(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*ue*e)}},{key:"process",value:function(e,t){var n=Z(e.color),r=1*t*ue,i=this.array;if(e.hidden)return i[r++]=0,i[r++]=0,i[r++]=0,void(i[r++]=0);i[r++]=e.x,i[r++]=e.y,i[r++]=e.size,i[r]=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform1f(this.ratioLocation,1/Math.pow(e.ratio,e.nodesPowRatio)),t.uniform1f(this.scaleLocation,e.scalingRatio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.drawArrays(t.POINTS,0,this.array.length/ue)}}]),t}(),le=n(13),fe=n.n(le),de=n(14),pe=n.n(de);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return!t||"object"!==ve(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ge(this,ye(t).call(this,e,fe.a,pe.a))).gl=e,n.array=null,n.indicesArray=null,n.buffer=e.createBuffer(),n.indicesBuffer=e.createBuffer(),n.positionLocation=e.getAttribLocation(n.program,"a_position"),n.normalLocation=e.getAttribLocation(n.program,"a_normal"),n.thicknessLocation=e.getAttribLocation(n.program,"a_thickness"),n.colorLocation=e.getAttribLocation(n.program,"a_color"),n.resolutionLocation=e.getUniformLocation(n.program,"u_resolution"),n.ratioLocation=e.getUniformLocation(n.program,"u_ratio"),n.matrixLocation=e.getUniformLocation(n.program,"u_matrix"),n.scaleLocation=e.getUniformLocation(n.program,"u_scale"),n.bind(),n.canUse32BitsIndices=function(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||!!e.getExtension("OES_element_index_uint")}(e),n.IndicesArray=n.canUse32BitsIndices?Uint32Array:Uint16Array,n.indicesType=n.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}(t,Y),function(e,t,n){t&&me(e.prototype,t),n&&me(e,n)}(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,4,e.UNSIGNED_BYTE,!0,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,n,r){if(e.hidden||t.hidden||n.hidden)for(var i=24*r,o=i+24;i<o;i++)this.array[i]=0;else{var a=n.size||1,s=e.x,c=e.y,u=t.x,h=t.y,l=Z(n.color),f=u-s,d=h-c,p=f*f+d*d,v=0,m=0;p&&(v=-d*(p=1/Math.sqrt(p)),m=f*p);var g=24*r,y=this.array;y[g++]=s,y[g++]=c,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=s,y[g++]=c,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g]=l}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,n=new this.IndicesArray(t),r=0,i=0;r<e;r+=4)n[i++]=r,n[i++]=r+1,n[i++]=r+2,n[i++]=r+2,n[i++]=r+1,n[i++]=r+3;this.indicesArray=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indicesArray,e.STATIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}();function xe(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.fillStyle="#000",e.font="".concat(o," ").concat(r,"px ").concat(i),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}var _e=2*Math.PI;function Ee(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(r,"px ").concat(i),e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var a=e.measureText(t.label).width,s=Math.round(t.x-r/2-2),c=Math.round(t.y-r/2-2),u=Math.round(a+r/2+t.size+9),h=Math.round(r+4),l=Math.round(r/2+2);e.moveTo(s,c+l),e.moveTo(s,c+l),e.arcTo(s,c,s+l,c,l),e.lineTo(s+u,c),e.lineTo(s+u,c+h),e.lineTo(s+l,c+h),e.arcTo(s,c+h,s,c+h-l,l),e.lineTo(s,c+l),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,function(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,_e,!0),e.closePath(),e.fill()}(e,t),xe(e,t,n)}var Te=n(5),Se=n(2),Ae={width:250,height:175},Le={width:400,height:300};function Oe(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function ke(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:r>i?1:0})}function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Re(e,t){return(Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fe=Object(Se.c)(),Ne=Object(Se.c)(),De={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,defaultNodeColor:"#999",defaultEdgeColor:"#ccc",labelFont:"Arial",labelSize:14,labelWeight:"normal",nodeReducer:null,edgeReducer:null,zIndex:!1},ze=function(e){function t(e,n,r){var i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=Ce(this,je(t).call(this)),r=r||{},i.settings=Object(Te.a)({},De,r),!P()(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(n instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.graph=e,i.captors={},i.container=n,i.elements={},i.contexts={},i.listeners={},i.quadtree=new A,i.nodeDataCache={},i.edgeDataCache={},i.nodeExtent=null,i.edgeExtent=null,i.initializeCache(),i.normalizationFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.displayedLabels=new Set,i.hoveredNode=null,i.wasRenderedInThisFrame=!1,i.renderFrame=null,i.renderHighlightedNodesFrame=null,i.needToProcess=!1,i.needToSoftProcess=!1,i.createContext("edges"),i.createContext("nodes"),i.createContext("labels",!1),i.createContext("hovers",!1),i.createContext("mouse",!1);var o=i.contexts.nodes;return o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),(o=i.contexts.edges).blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),i.nodePrograms={def:new he(i.contexts.nodes)},i.edgePrograms={def:new we(i.contexts.edges)},i.resize(),i.camera=new u.a({width:i.width,height:i.height}),i.bindCameraHandlers(),i.captors={mouse:new L.a(i.elements.mouse,i.camera)},i.bindEventHandlers(),i.bindGraphHandlers(),i.process(),i.render(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,c),function(e,t,n){t&&Me(e.prototype,t),n&&Me(e,n)}(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Object(Se.a)("canvas",{class:"sigma-".concat(e),style:{position:"absolute"}});this.elements[e]=n,this.container.appendChild(n);var r,i={preserveDrawingBuffer:!1,antialias:!1};return t?((r=n.getContext("webgl2",i))||(r=n.getContext("webgl",i)),r||(r=n.getContext("experimental-webgl",i))):r=n.getContext("2d",i),this.contexts[e]=r,this}},{key:"initializeCache",value:function(){for(var e=this.graph,t=e.nodes(),n=0,r=t.length;n<r;n++)this.nodeDataCache[t[n]]=new R(n,this.settings);for(var i=e.edges(),o=0,a=i.length;o<a;o++)this.edgeDataCache[i[o]]=new F(o,this.settings)}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,n,r,i){return e>n-i&&e<n+i&&t>r-i&&t<r+i&&Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2))<i},n=function(t,n){var r=e.camera.viewportToGraph(e,t,n);return e.quadtree.point(r.x,1-r.y)};return this.listeners.handleMove=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=1/0,s=null,c=0,u=o.length;c<u;c++){var h=o[c],l=e.nodeDataCache[h],f=e.camera.graphToViewport(e,l.x,l.y),d=l.size/i;if(t(r.x,r.y,f.x,f.y,d)){var p=Math.sqrt(Math.pow(r.x-f.x,2)+Math.pow(r.y-f.y,2));p<a&&(a=p,s=h)}}if(s&&e.hoveredNode!==s)return e.hoveredNode=s,e.emit("enterNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var v=e.nodeDataCache[e.hoveredNode],m=e.camera.graphToViewport(e,v.x,v.y),g=v.size/i;if(!t(r.x,r.y,m.x,m.y,g)){var y=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",{node:y}),e.scheduleHighlightedNodesRender()}}},this.listeners.handleClick=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=0,s=o.length;a<s;a++){var c=o[a],u=e.nodeDataCache[c],h=e.camera.graphToViewport(e,u.x,u.y),l=u.size/i;if(t(r.x,r.y,h.x,h.y,l))return e.emit("clickNode",{node:c})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph;return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},t.on("nodeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.graph,n=this.settings;this.quadtree.clear();var r=["x","y"];this.settings.zIndex&&(r.push("z"),this.edgeExtent=Object(O.edgeExtent)(t,["z"])),this.nodeExtent=Object(O.nodeExtent)(t,r),this.normalizationFunction=Object(Se.b)(this.nodeExtent);var i=this.nodePrograms.def;e||i.allocate(t.order);var o=t.nodes();this.settings.zIndex&&(o=ke(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},o));for(var a=0,s=o.length;a<s;a++){var c=o[a],u=t.getNodeAttributes(c),h=this.nodeDataCache[c];n.nodeReducer&&(u=n.nodeReducer(c,u)),h.assign(u),this.normalizationFunction.applyTo(h),this.quadtree.add(c,h.x,1-h.y,h.size/this.width),i.process(h,a),h.index=a}i.bufferData();var l=this.edgePrograms.def;e||l.allocate(t.size);var f=t.edges();this.settings.zIndex&&(f=ke(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var d=0,p=f.length;d<p;d++){var v=f[d],m=t.getEdgeAttributes(v),g=this.edgeDataCache[v];n.edgeReducer&&(m=n.edgeReducer(v,m)),g.assign(m);var y=t.extremities(v),b=this.nodeDataCache[y[0]],w=this.nodeDataCache[y[1]];l.process(b,w,g,d),g.index=d}return e||"function"!=typeof l.computeIndices||l.computeIndices(),l.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,n=this.graph.getNodeAttributes(e);return t.process(n,this.nodeDataCache[e].index),this}},{key:"processEdge",value:function(e){var t=this.graph,n=this.edgePrograms.def,r=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return n.process(o,a,r,this.edgeDataCache[e].index),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var n=this.width,r=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),0===this.width)throw new Error("sigma/renderers/webgl: container has no width.");if(0===this.height)throw new Error("sigma/renderers/webgl: container has no height.");if(n===this.width&&r===this.height)return this;for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*Fe+"px"),this.elements[a].setAttribute("height",this.height*Fe+"px"),1!==Fe&&s.scale(Fe,Fe)):(this.elements[a].setAttribute("width",this.width*Ne+"px"),this.elements[a].setAttribute("height",this.height*Ne+"px")),s.viewport&&s.viewport(0,0,this.width*Ne,this.height*Ne)}return this}},{key:"clear",value:function(){return this.contexts.labels.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),!this.graph.order)return this;var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t,n=this.camera.getState(),r=J(n,{width:this.width,height:this.height});if(this.nodePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,scalingRatio:Ne}),this.settings.hideEdgesOnMove&&e||this.edgePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:Ne}),this.settings.hideLabelsOnMove&&e)return this;if(n.ratio>=1)t=this.graph.nodes();else{var i=this.camera.viewRectangle(this);t=this.quadtree.rectangle(i.x1,1-i.y1,i.x2,1-i.y2,i.height)}if(!this.settings.renderLabels)return this;for(var o=function(e){var t=e.cache,n=e.camera,r=e.displayedLabels,i=e.visibleNodes,o=e.dimensions,a=e.graph,s=n.getState(),c=n.getPreviousState(),h=new u.a;h.setState(c);var l=s.x===c.x&&s.y===c.y&&s.ratio===c.ratio,f=s.ratio<c.ratio,d=s.x!==c.x||s.y!==c.y,p=s.ratio>c.ratio,v=!f&&!p&&s.ratio>=1,m=d&&r.size&&!f&&!p;if(p&&Math.trunc(100*s.ratio)%5!=0)return Array.from(r);if((v||l)&&0!==r.size)return Array.from(r);if(f&&s.ratio>=1)return Array.from(r);for(var g=s.ratio>=1.3?Le:Ae,y=o.width%g.width,b=g.width+y/Math.floor(o.width/g.width),w=o.height%g.height,x=g.height+w/Math.floor(o.height/g.height),_=o.width+b,E=o.height+x,T=-b,S=-x,A=o.width+b/2,L=o.height+x/2,O=-b/2,k=-x/2,P=[],M={},C=-1/0,j=null,R=0,F=i.length;R<F;R++){var N=i[R],D=t[N],z=n.graphToViewport(o,D.x,D.y);if(!(z.x<T||z.x>_||z.y<S||z.y>E)){if(D.size>C&&(C=D.size,j=N),m){var I=h.graphToViewport(o,D.x,D.y);if(I.x>=O&&I.x<=A&&I.y>=k&&I.y<=L&&!r.has(N))continue}var U=Math.floor(z.x/b),G=Math.floor(z.y/x),Y="".concat(U,"§").concat(G);if(void 0===M[Y])M[Y]=N;else{var H=M[Y],V=t[H];if(r.size>0){var B=r.has(N),X=r.has(H);if(!B&&X)continue;if(B&&!X){M[Y]=N;continue}if((m||f)&&B&&X){P.push(N);continue}}var q=!1;if(D.size>V.size)q=!0;else if(D.size===V.size){var W=a.degree(N),K=a.degree(H);W>K?q=!0:W===K&&N>H&&(q=!0)}q&&(M[Y]=N)}}}var $=P.some(function(e){return e===j});for(var Q in M){var Z=M[Q];Z===j&&($=!0),P.push(Z)}!$&&j&&P.push(j);for(var J=new Set,ee=0,te=P.length;ee<te;ee++){var ne=P[ee],re=t[ne],ie=n.graphToViewport(o,re.x,re.y);if(!J.has(ne))for(var oe=ee+1;oe<te;oe++){var ae=P[oe],se=t[ae],ce=n.graphToViewport(o,se.x,se.y);Oe(ie.x,ie.y,8*re.label.length,14,ce.x,ce.y,8*se.label.length,14)&&(re.size<se.size?J.add(ne):J.add(ae))}}return P.filter(function(e){return!J.has(e)})}({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,visibleNodes:t,dimensions:this,graph:this.graph}),a=this.contexts.labels,s=Math.pow(n.ratio,.5),c=0,h=o.length;c<h;c++){var l=this.nodeDataCache[o[c]],f=this.camera.graphToViewport(this,l.x,l.y),d=f.x,p=f.y,v=l.size/s;xe(a,{label:l.label,size:v,x:d,y:p},this.settings)}return this.displayedLabels=new Set(o),this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,n=Math.pow(t.getState().ratio,.5),r=this.contexts.hovers;r.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToViewport(e,o.x,o.y),s=a.x,c=a.y,u=o.size/n;Ee(r,{label:o.label,color:o.color,size:u,x:s,y:c},e.settings)};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"refresh",value:function(){return this.needToSoftProcess=!0,this.scheduleRender(),this}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeDataCache=null,this.edgeDataCache=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null,this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}();n.d(t,"Renderer",function(){return c}),n.d(t,"Camera",function(){return u.a}),n.d(t,"QuadTree",function(){return A}),n.d(t,"MouseCaptor",function(){return L.a}),n.d(t,"WebGLRenderer",function(){return ze})}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";n.d(t,"d",function(){return i}),n.d(t,"e",function(){return o}),n.d(t,"a",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"c",function(){return c});var r=n(2);function i(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function o(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function a(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:Object(r.c)();return{x:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}(e)/(2*t),y:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}(e)/(2*t)}}function s(e){return{x:i(e),y:o(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function c(e){if(void 0!==e.wheelDelta)return e.wheelDelta/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"linear",function(){return o}),n.d(r,"quadraticIn",function(){return a}),n.d(r,"quadraticOut",function(){return s}),n.d(r,"quadraticInOut",function(){return c}),n.d(r,"cubicIn",function(){return u}),n.d(r,"cubicOut",function(){return h}),n.d(r,"cubicInOut",function(){return l});var i=n(3),o=function(e){return e},a=function(e){return e*e},s=function(e){return e*(2-e)},c=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},u=function(e){return e*e*e},h=function(e){return--e*e*e+1},l=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},f=n(5);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return b});var y={easing:"quadraticInOut",duration:150},b=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=v(this,m(t).call(this))).x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.previousState=e.getState(),e.enabled=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,i["EventEmitter"]),function(e,t,n){t&&p(e.prototype,t),n&&p(e,n)}(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:(t-this.x+this.ratio/2/i)*(r/this.ratio),y:(this.y-n+this.ratio/2/o)*(r/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:this.ratio/r*t+this.x-this.ratio/2/i,y:-(this.ratio/r*n-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*e.width/8,n=0*e.height/8,r=this.viewportToGraph(e,0-t,0-n),i=this.viewportToGraph(e,e.width+t,0-n),o=this.viewportToGraph(e,0,e.height+n);return{x1:r.x,y1:r.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"animate",value:function(e,t,n){var i=this;if(!this.enabled)return this;var o="function"==typeof(t=Object(f.a)({},y,t)).easing?t.easing:r[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var a=Date.now(),s=this.getState(),c=function r(){var c=(Date.now()-a)/t.duration;if(c>=1)return i.nextFrame=null,i.setState(e),void("function"==typeof n&&n());var u=o(c),h={};"x"in e&&(h.x=s.x+(e.x-s.x)*u),"y"in e&&(h.y=s.y+(e.y-s.y)*u),"angle"in e&&(h.angle=s.angle+(e.angle-s.angle)*u),"ratio"in e&&(h.ratio=s.ratio+(e.ratio-s.ratio)*u),i.setState(h),i.nextFrame=requestAnimationFrame(r)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(c)):c()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}}]),t}()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){var n=document.createElement(e);if(!t)return n;for(var r in t)if("style"===r)for(var i in t[r])n.style[i]=t[r][i];else n.setAttribute(r,t[r]);return n}function o(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function a(e){var t,n=r(e.x,2),i=n[0],o=n[1],a=r(e.y,2),s=a[0],c=a[1],u=Math.max(o-i,c-s);0===u&&(u=1);var h=(o+i)/2,l=(c+s)/2;return(t=function(e){return{x:.5+(e.x-h)/u,y:.5+(e.y-l)/u}}).applyTo=function(e){e.x=.5+(e.x-h)/u,e.y=.5+(e.y-l)/u},t.inverse=function(e){return{x:h+u*(e.x-.5),y:l+u*(e.y-.5)}},t.ratio=u,t}n.d(t,"a",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return a})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(u=n.slice()).length,c=0;c<a;c++)u[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(1),i=n(10),o=n(0);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l=function(t){function n(e,t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?h(e):t}(this,c(n).call(this,e,t))).container=e,r.camera=t,r.enabled=!0,r.hasDragged=!1,r.downStartTime=null,r.lastMouseX=null,r.lastMouseY=null,r.isMouseDown=!1,r.isMoving=!1,r.movingTimeout=null,r.startCameraState=null,r.lastCameraState=null,r.clicks=0,r.doubleClickTimeout=null,r.wheelLock=!1,r.handleClick=r.handleClick.bind(h(h(r))),r.handleDown=r.handleDown.bind(h(h(r))),r.handleUp=r.handleUp.bind(h(h(r))),r.handleMove=r.handleMove.bind(h(h(r))),r.handleWheel=r.handleWheel.bind(h(h(r))),r.handleOut=r.handleOut.bind(h(h(r))),e.addEventListener("click",r.handleClick,!1),e.addEventListener("mousedown",r.handleDown,!1),e.addEventListener("mousemove",r.handleMove,!1),e.addEventListener("DOMMouseScroll",r.handleWheel,!1),e.addEventListener("mousewheel",r.handleWheel,!1),e.addEventListener("mouseout",r.handleOut,!1),document.addEventListener("mouseup",r.handleUp,!1),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(n,i["a"]),function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.hasDragged||this.emit("click",Object(o.b)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=Object(o.a)(e),n=this.camera.getState(),i=n.ratio/2.2,a={width:this.container.offsetWidth,height:this.container.offsetHeight},s=Object(o.d)(e),c=Object(o.e)(e),u=new r.a;u.ratio=i,u.x=n.x,u.y=n.y;var h=this.camera.viewportToGraph(a,s,c),l=this.camera.viewportToGraph(a,t.x,t.y),f=u.viewportToGraph(a,s,c),d=u.viewportToGraph(a,t.x,t.y),p=f.x-d.x-h.x+l.x,v=f.y-d.y-h.y+l.y;return this.camera.animate({x:n.x-p,y:n.y-v,ratio:i},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.lastMouseX=Object(o.d)(e),this.lastMouseY=Object(o.e)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",Object(o.b)(e)))}},{key:"handleUp",value:function(t){var n=this;if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var r=Object(o.d)(t),i=Object(o.e)(t),a=this.camera.getState(),s=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:a.x+3*(a.x-s.x),y:a.y+3*(a.y-s.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===i||this.camera.setState({x:a.x,y:a.y}),this.isMoving=!1,e(function(){return n.hasDragged=!1}),this.emit("mouseup",Object(o.b)(t))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",Object(o.b)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var n={width:this.container.offsetWidth,height:this.container.offsetHeight},r=Object(o.d)(e),i=Object(o.e)(e),a=this.camera.viewportToGraph(n,this.lastMouseX,this.lastMouseY),s=this.camera.viewportToGraph(n,r,i),c=a.x-s.x,u=a.y-s.y,h=this.camera.getState(),l=h.x+c,f=h.y+u;this.camera.setState({x:l,y:f}),this.lastMouseX=r,this.lastMouseY=i}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!this.enabled)return!1;var n=Object(o.c)(e);if(!n)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=n>0?1/1.7:1.7,a=this.camera.getState(),s=i*a.ratio,c=Object(o.a)(e),u={width:this.container.offsetWidth,height:this.container.offsetHeight},h=Object(o.d)(e),l=Object(o.e)(e),f=new r.a;f.ratio=s,f.x=a.x,f.y=a.y;var d=this.camera.viewportToGraph(u,h,l),p=this.camera.viewportToGraph(u,c.x,c.y),v=f.viewportToGraph(u,h,l),m=f.viewportToGraph(u,c.x,c.y),g=v.x-m.x-d.x+p.x,y=v.y-m.y-d.y+p.y;return this.camera.animate({x:a.x-g,y:a.y-y,ratio:s},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),n}()}).call(this,n(15).setImmediate)},function(e,t,n){"use strict";function r(e){e=e||{};for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,o=n.length;i<o;i++)if(n[i])for(var a in n[i])e[a]=n[i][a];return e}n.d(t,"a",function(){return r})},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},function(e,t,n){var r=n(6);function i(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.nodes(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getNodeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f}var o=i;o.nodeExtent=i,o.edgeExtent=function(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.edges(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getEdgeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f},e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e,t){var n=e.length,r=t.length;if(0!==r){e.length+=t.length;for(var i=0;i<r;i++)e[n+i]=t[i]}}},function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,a(t).call(this))).container=e,r.camera=n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}()},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n // gl_FragColor = mix(color0, v_color, t);\n gl_FragColor = mix(color0, v_color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float min_thickness = 1.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness * pow_ratio / u_scale;\n\n // Min thickness for AA\n thickness = max(min_thickness, thickness);\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 2.6;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(16),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,o={},a=!1,s=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&h(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){h(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){h(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(h,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return o[i]=a,r(i),i++},c.clearImmediate=u}function u(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{u(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(8),n(17))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var e=s(f);h=!0;for(var t=u.length;t;){for(c=u,u=[];++l<t;)c&&c[l].run();l=-1,t=u.length}c=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,a(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}(),u=n(1),h=n(9),l=n.n(h);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=4,p=5,v=0,m=1,g=2,y=3,b=1,w=2,x=3,_=4;function E(e,t,n,r,i,o,a){return e<r+o&&e+n>r&&t<i+a&&t+n>i}function T(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function S(e,t,n,r,i,o){var a=e<n+i/2;return t<r+o/2?a?b:w:a?x:_}var A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=t||{};var n=Math.pow(4,p);this.data=new Float32Array(d*((4*n-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(e,[{key:"add",value:function(e,t,n,r){return function(e,t,n,r,i,o,a){for(var s=i-a,c=o-a,u=2*a,h=0,l=0;;){if(h>=e)return n[l]=n[l]||[],void n[l].push(r);var f=4*l+d,p=4*l+2*d,b=4*l+3*d,w=4*l+4*d,x=E(s,c,u,t[f+v],t[f+m],t[f+g],t[f+y]),_=E(s,c,u,t[p+v],t[p+m],t[p+g],t[p+y]),T=E(s,c,u,t[b+v],t[b+m],t[b+g],t[b+y]),S=E(s,c,u,t[w+v],t[w+m],t[w+g],t[w+y]),A=x+_+T+S;if(0===A)throw new Error("sigma/quadtree.insertNode: no collision (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(3===A)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(A>1)return n[l]=n[l]||[],void n[l].push(r);h++,x&&(l=f),_&&(l=p),T&&(l=b),S&&(l=w)}}(p,this.data,this.containers,e,t,n,r),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[m]=e.y,this.data[g]=e.width,this.data[y]=e.height,function(e,t){for(var n=[0,0];n.length;){var r=n.pop(),i=n.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,c=4*i+4*d,u=t[i+v],h=t[i+m],l=t[i+g]/2,f=t[i+y]/2;t[o+v]=u,t[o+m]=h,t[o+g]=l,t[o+y]=f,t[a+v]=u+l,t[a+m]=h,t[a+g]=l,t[a+y]=f,t[s+v]=u,t[s+m]=h+f,t[s+g]=l,t[s+y]=f,t[c+v]=u+l,t[c+m]=h+f,t[c+g]=l,t[c+y]=f,r<e-1&&(n.push(c,r+1),n.push(s,r+1),n.push(a,r+1),n.push(o,r+1))}}(p,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var n=[],r=0,i=0;do{this.containers[r]&&n.push.apply(n,this.containers[r]),r=4*r+S(e,t,this.data[r+v],this.data[r+m],this.data[r+g],this.data[r+y])*d,i++}while(i<=p);return n}},{key:"rectangle",value:function(e,t,n,r,i){var o=this.lastRectangle;if(o&&e===o.x1&&n===o.x2&&t===o.y1&&r===o.y2&&i===o.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:n,y2:r,height:i},!function(e,t,n,r){return e===n||t===r}(e,t,n,r))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var a=function(e,t,n,r,i,o,a){for(var s,c=[0,0],u=[];c.length;){var h=c.pop(),f=c.pop();if((s=n[f])&&l()(u,s),!(h>=e)){var p=4*f+d,b=4*f+2*d,w=4*f+3*d,x=4*f+4*d,_=T(r,i,o,a,t[p+v],t[p+m],t[p+g],t[p+y]),E=T(r,i,o,a,t[b+v],t[b+m],t[b+g],t[b+y]),S=T(r,i,o,a,t[w+v],t[w+m],t[w+g],t[w+y]),A=T(r,i,o,a,t[x+v],t[x+m],t[x+g],t[x+y]);_&&c.push(p,h+1),E&&c.push(b,h+1),S&&c.push(w,h+1),A&&c.push(x,h+1)}}return u}(p,this.data,this.containers,e,t,Math.abs(e-n)||Math.abs(t-r),i);return this.cache=a,this.cache}}]),e}(),L=n(4),O=n(7),k=n(6),P=n.n(k);function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function j(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var R=function(){function e(t,n){M(this,e),this.index=t,this.x=0,this.y=0,this.size=2,this.color=n.defaultNodeColor,this.hidden=!1,this.label=""}return j(e,[{key:"assign",value:function(e){"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden),"label"in e&&(this.label=e.label)}}]),e}(),N=function(){function e(t,n){M(this,e),this.index=t,this.size=1,this.color=n.defaultEdgeColor,this.hidden=!1}return j(e,[{key:"assign",value:function(e){"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden)}}]),e}();function F(e,t,n){var r="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/webgl/shaders/utils.loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return i}var D=F.bind(null,"VERTEX"),z=F.bind(null,"FRAGMENT");function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),e}var Y=function(){function e(t,n,r){I(this,e),this.vertexShaderSource=n,this.fragmentShaderSource=r,this.load(t)}return G(e,[{key:"load",value:function(e){return this.vertexShader=D(e,this.vertexShaderSource),this.fragmentShader=z(e,this.fragmentShaderSource),this.program=function(e,t){var n,r,i=e.createProgram();for(n=0,r=t.length;n<r;n++)e.attachShader(i,t[n]);if(e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw e.deleteProgram(i),new Error("sigma/renderers/webgl/shaders/utils.loadProgram: error while linking the program.");return i}(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();function H(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function V(e,t,n){return e[0]=t,e[4]=arguments.length>2?n:t,e}function B(e,t){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],h=e[8],l=t[0],f=t[1],d=t[2],p=t[3],v=t[4],m=t[5],g=t[6],y=t[7],b=t[8];return e[0]=l*n+f*o+d*c,e[1]=l*r+f*a+d*u,e[2]=l*i+f*s+d*h,e[3]=p*n+v*o+m*c,e[4]=p*r+v*a+m*u,e[5]=p*i+v*s+m*h,e[6]=g*n+y*o+b*c,e[7]=g*r+y*a+b*u,e[8]=g*i+y*s+b*h,e}var X={},q=new Int8Array(4),W=new Int32Array(q.buffer,0,1),K=new Float32Array(q.buffer,0,1),$=/^\s*rgba?\s*\(/,Q=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Z(e){if(void 0!==X[e])return X[e];var t=0,n=0,r=0,i=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16));else if($.test(e)){var o=e.match(Q);t=+o[1],n=+o[2],r=+o[3],o[4]&&(i=+o[4])}var a=4278190079&((i=255*i|0)<<24|r<<16|n<<8|t);W[0]=a;var s=K[0];return X[e]=s,s}function J(e,t){var n=e.angle,r=e.ratio,i=e.x,o=e.y,a=t.width,s=t.height,c=H(),u=Math.min(a,s),h=function(e,t,n){return e[6]=t,e[7]=n,e}(H(),-i,-o),l=V(H(),1/r),f=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}(H(),-n);return B(c,V(H(),u/a*2,u/s*2)),B(c,f),B(c,l),B(c,h),c}var ee=n(11),te=n.n(ee),ne=n(12),re=n.n(ne);function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=4,he=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ae(this,se(t).call(this,e,te.a,re.a))).gl=e,n.array=null,n.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.buffer);var r=n.program;return n.positionLocation=e.getAttribLocation(r,"a_position"),n.sizeLocation=e.getAttribLocation(r,"a_size"),n.colorLocation=e.getAttribLocation(r,"a_color"),n.matrixLocation=e.getUniformLocation(r,"u_matrix"),n.ratioLocation=e.getUniformLocation(r,"u_ratio"),n.scaleLocation=e.getUniformLocation(r,"u_scale"),e.enableVertexAttribArray(n.positionLocation),e.enableVertexAttribArray(n.sizeLocation),e.enableVertexAttribArray(n.colorLocation),e.vertexAttribPointer(n.positionLocation,2,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(n.sizeLocation,1,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(n.colorLocation,4,e.UNSIGNED_BYTE,!0,ue*Float32Array.BYTES_PER_ELEMENT,12),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(t,Y),function(e,t,n){t&&oe(e.prototype,t),n&&oe(e,n)}(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*ue*e)}},{key:"process",value:function(e,t){var n=Z(e.color),r=1*t*ue,i=this.array;if(e.hidden)return i[r++]=0,i[r++]=0,i[r++]=0,void(i[r++]=0);i[r++]=e.x,i[r++]=e.y,i[r++]=e.size,i[r]=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform1f(this.ratioLocation,1/Math.pow(e.ratio,e.nodesPowRatio)),t.uniform1f(this.scaleLocation,e.scalingRatio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.drawArrays(t.POINTS,0,this.array.length/ue)}}]),t}(),le=n(13),fe=n.n(le),de=n(14),pe=n.n(de);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return!t||"object"!==ve(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ge(this,ye(t).call(this,e,fe.a,pe.a))).gl=e,n.array=null,n.indicesArray=null,n.buffer=e.createBuffer(),n.indicesBuffer=e.createBuffer(),n.positionLocation=e.getAttribLocation(n.program,"a_position"),n.normalLocation=e.getAttribLocation(n.program,"a_normal"),n.thicknessLocation=e.getAttribLocation(n.program,"a_thickness"),n.colorLocation=e.getAttribLocation(n.program,"a_color"),n.resolutionLocation=e.getUniformLocation(n.program,"u_resolution"),n.ratioLocation=e.getUniformLocation(n.program,"u_ratio"),n.matrixLocation=e.getUniformLocation(n.program,"u_matrix"),n.scaleLocation=e.getUniformLocation(n.program,"u_scale"),n.bind(),n.canUse32BitsIndices=function(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||!!e.getExtension("OES_element_index_uint")}(e),n.IndicesArray=n.canUse32BitsIndices?Uint32Array:Uint16Array,n.indicesType=n.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}(t,Y),function(e,t,n){t&&me(e.prototype,t),n&&me(e,n)}(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,4,e.UNSIGNED_BYTE,!0,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,n,r){if(e.hidden||t.hidden||n.hidden)for(var i=24*r,o=i+24;i<o;i++)this.array[i]=0;else{var a=n.size||1,s=e.x,c=e.y,u=t.x,h=t.y,l=Z(n.color),f=u-s,d=h-c,p=f*f+d*d,v=0,m=0;p&&(v=-d*(p=1/Math.sqrt(p)),m=f*p);var g=24*r,y=this.array;y[g++]=s,y[g++]=c,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=s,y[g++]=c,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g]=l}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,n=new this.IndicesArray(t),r=0,i=0;r<e;r+=4)n[i++]=r,n[i++]=r+1,n[i++]=r+2,n[i++]=r+2,n[i++]=r+1,n[i++]=r+3;this.indicesArray=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indicesArray,e.STATIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}();function xe(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.fillStyle="#000",e.font="".concat(o," ").concat(r,"px ").concat(i),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}var _e=2*Math.PI;function Ee(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(r,"px ").concat(i),e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var a=e.measureText(t.label).width,s=Math.round(t.x-r/2-2),c=Math.round(t.y-r/2-2),u=Math.round(a+r/2+t.size+9),h=Math.round(r+4),l=Math.round(r/2+2);e.moveTo(s,c+l),e.moveTo(s,c+l),e.arcTo(s,c,s+l,c,l),e.lineTo(s+u,c),e.lineTo(s+u,c+h),e.lineTo(s+l,c+h),e.arcTo(s,c+h,s,c+h-l,l),e.lineTo(s,c+l),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,function(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,_e,!0),e.closePath(),e.fill()}(e,t),xe(e,t,n)}var Te=n(5),Se=n(2),Ae={width:250,height:175},Le={width:400,height:300};function Oe(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function ke(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:r>i?1:0})}function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Re(e,t){return(Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ne=Object(Se.c)(),Fe=Object(Se.c)(),De={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,defaultNodeColor:"#999",defaultEdgeColor:"#ccc",labelFont:"Arial",labelSize:14,labelWeight:"normal",nodeReducer:null,edgeReducer:null,zIndex:!1},ze=function(e){function t(e,n,r){var i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=Ce(this,je(t).call(this)),r=r||{},i.settings=Object(Te.a)({},De,r),!P()(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(n instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.graph=e,i.captors={},i.container=n,i.elements={},i.contexts={},i.listeners={},i.quadtree=new A,i.nodeDataCache={},i.edgeDataCache={},i.nodeExtent=null,i.edgeExtent=null,i.initializeCache(),i.normalizationFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.displayedLabels=new Set,i.hoveredNode=null,i.wasRenderedInThisFrame=!1,i.renderFrame=null,i.renderHighlightedNodesFrame=null,i.needToProcess=!1,i.needToSoftProcess=!1,i.createContext("edges"),i.createContext("nodes"),i.createContext("labels",!1),i.createContext("hovers",!1),i.createContext("mouse",!1);var o=i.contexts.nodes;return o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),(o=i.contexts.edges).blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),i.nodePrograms={def:new he(i.contexts.nodes)},i.edgePrograms={def:new we(i.contexts.edges)},i.resize(),i.camera=new u.a({width:i.width,height:i.height}),i.bindCameraHandlers(),i.captors={mouse:new L.a(i.elements.mouse,i.camera)},i.bindEventHandlers(),i.bindGraphHandlers(),i.process(),i.render(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,c),function(e,t,n){t&&Me(e.prototype,t),n&&Me(e,n)}(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Object(Se.a)("canvas",{class:"sigma-".concat(e),style:{position:"absolute"}});this.elements[e]=n,this.container.appendChild(n);var r,i={preserveDrawingBuffer:!1,antialias:!1};return t?((r=n.getContext("webgl2",i))||(r=n.getContext("webgl",i)),r||(r=n.getContext("experimental-webgl",i))):r=n.getContext("2d",i),this.contexts[e]=r,this}},{key:"initializeCache",value:function(){for(var e=this.graph,t=e.nodes(),n=0,r=t.length;n<r;n++)this.nodeDataCache[t[n]]=new R(n,this.settings);for(var i=e.edges(),o=0,a=i.length;o<a;o++)this.edgeDataCache[i[o]]=new N(o,this.settings)}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,n,r,i){return e>n-i&&e<n+i&&t>r-i&&t<r+i&&Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2))<i},n=function(t,n){var r=e.camera.viewportToGraph(e,t,n);return e.quadtree.point(r.x,1-r.y)};return this.listeners.handleMove=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=1/0,s=null,c=0,u=o.length;c<u;c++){var h=o[c],l=e.nodeDataCache[h],f=e.camera.graphToViewport(e,l.x,l.y),d=l.size/i;if(t(r.x,r.y,f.x,f.y,d)){var p=Math.sqrt(Math.pow(r.x-f.x,2)+Math.pow(r.y-f.y,2));p<a&&(a=p,s=h)}}if(s&&e.hoveredNode!==s)return e.hoveredNode=s,e.emit("enterNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var v=e.nodeDataCache[e.hoveredNode],m=e.camera.graphToViewport(e,v.x,v.y),g=v.size/i;if(!t(r.x,r.y,m.x,m.y,g)){var y=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",{node:y}),e.scheduleHighlightedNodesRender()}}},this.listeners.handleClick=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=0,s=o.length;a<s;a++){var c=o[a],u=e.nodeDataCache[c],h=e.camera.graphToViewport(e,u.x,u.y),l=u.size/i;if(t(r.x,r.y,h.x,h.y,l))return e.emit("clickNode",{node:c})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph;return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},this.listeners.addNodeGraphUpdate=function(n){e.nodeDataCache[n.key]=new R(t.order-1,e.settings),e.listeners.graphUpdate()},this.listeners.addEdgeGraphUpdate=function(n){e.edgeDataCache[n.key]=new N(t.size-1,e.settings),e.listeners.graphUpdate()},t.on("nodeAdded",this.listeners.addNodeGraphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.addEdgeGraphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.graph,n=this.settings;this.quadtree.clear();var r=["x","y"];this.settings.zIndex&&(r.push("z"),this.edgeExtent=Object(O.edgeExtent)(t,["z"])),this.nodeExtent=Object(O.nodeExtent)(t,r),this.normalizationFunction=Object(Se.b)(this.nodeExtent);var i=this.nodePrograms.def;e||i.allocate(t.order);var o=t.nodes();this.settings.zIndex&&(o=ke(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},o));for(var a=0,s=o.length;a<s;a++){var c=o[a],u=t.getNodeAttributes(c),h=this.nodeDataCache[c];n.nodeReducer&&(u=n.nodeReducer(c,u)),h.assign(u),this.normalizationFunction.applyTo(h),this.quadtree.add(c,h.x,1-h.y,h.size/this.width),i.process(h,a),h.index=a}i.bufferData();var l=this.edgePrograms.def;e||l.allocate(t.size);var f=t.edges();this.settings.zIndex&&(f=ke(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var d=0,p=f.length;d<p;d++){var v=f[d],m=t.getEdgeAttributes(v),g=this.edgeDataCache[v];n.edgeReducer&&(m=n.edgeReducer(v,m)),g.assign(m);var y=t.extremities(v),b=this.nodeDataCache[y[0]],w=this.nodeDataCache[y[1]];l.process(b,w,g,d),g.index=d}return e||"function"!=typeof l.computeIndices||l.computeIndices(),l.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,n=this.graph.getNodeAttributes(e);return t.process(n,this.nodeDataCache[e].index),this}},{key:"processEdge",value:function(e){var t=this.graph,n=this.edgePrograms.def,r=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return n.process(o,a,r,this.edgeDataCache[e].index),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var n=this.width,r=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),0===this.width)throw new Error("sigma/renderers/webgl: container has no width.");if(0===this.height)throw new Error("sigma/renderers/webgl: container has no height.");if(n===this.width&&r===this.height)return this;for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*Ne+"px"),this.elements[a].setAttribute("height",this.height*Ne+"px"),1!==Ne&&s.scale(Ne,Ne)):(this.elements[a].setAttribute("width",this.width*Fe+"px"),this.elements[a].setAttribute("height",this.height*Fe+"px")),s.viewport&&s.viewport(0,0,this.width*Fe,this.height*Fe)}return this}},{key:"clear",value:function(){return this.contexts.labels.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),!this.graph.order)return this;var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t,n=this.camera.getState(),r=J(n,{width:this.width,height:this.height});if(this.nodePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,scalingRatio:Fe}),this.settings.hideEdgesOnMove&&e||this.edgePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:Fe}),this.settings.hideLabelsOnMove&&e)return this;if(n.ratio>=1)t=this.graph.nodes();else{var i=this.camera.viewRectangle(this);t=this.quadtree.rectangle(i.x1,1-i.y1,i.x2,1-i.y2,i.height)}if(!this.settings.renderLabels)return this;for(var o=function(e){var t=e.cache,n=e.camera,r=e.displayedLabels,i=e.visibleNodes,o=e.dimensions,a=e.graph,s=n.getState(),c=n.getPreviousState(),h=new u.a;h.setState(c);var l=s.x===c.x&&s.y===c.y&&s.ratio===c.ratio,f=s.ratio<c.ratio,d=s.x!==c.x||s.y!==c.y,p=s.ratio>c.ratio,v=!f&&!p&&s.ratio>=1,m=d&&r.size&&!f&&!p;if(p&&Math.trunc(100*s.ratio)%5!=0)return Array.from(r);if((v||l)&&0!==r.size)return Array.from(r);if(f&&s.ratio>=1)return Array.from(r);for(var g=s.ratio>=1.3?Le:Ae,y=o.width%g.width,b=g.width+y/Math.floor(o.width/g.width),w=o.height%g.height,x=g.height+w/Math.floor(o.height/g.height),_=o.width+b,E=o.height+x,T=-b,S=-x,A=o.width+b/2,L=o.height+x/2,O=-b/2,k=-x/2,P=[],M={},C=-1/0,j=null,R=0,N=i.length;R<N;R++){var F=i[R],D=t[F],z=n.graphToViewport(o,D.x,D.y);if(!(z.x<T||z.x>_||z.y<S||z.y>E)){if(D.size>C&&(C=D.size,j=F),m){var I=h.graphToViewport(o,D.x,D.y);if(I.x>=O&&I.x<=A&&I.y>=k&&I.y<=L&&!r.has(F))continue}var U=Math.floor(z.x/b),G=Math.floor(z.y/x),Y="".concat(U,"§").concat(G);if(void 0===M[Y])M[Y]=F;else{var H=M[Y],V=t[H];if(r.size>0){var B=r.has(F),X=r.has(H);if(!B&&X)continue;if(B&&!X){M[Y]=F;continue}if((m||f)&&B&&X){P.push(F);continue}}var q=!1;if(D.size>V.size)q=!0;else if(D.size===V.size){var W=a.degree(F),K=a.degree(H);W>K?q=!0:W===K&&F>H&&(q=!0)}q&&(M[Y]=F)}}}var $=P.some(function(e){return e===j});for(var Q in M){var Z=M[Q];Z===j&&($=!0),P.push(Z)}!$&&j&&P.push(j);for(var J=new Set,ee=0,te=P.length;ee<te;ee++){var ne=P[ee],re=t[ne],ie=n.graphToViewport(o,re.x,re.y);if(!J.has(ne))for(var oe=ee+1;oe<te;oe++){var ae=P[oe],se=t[ae],ce=n.graphToViewport(o,se.x,se.y);Oe(ie.x,ie.y,8*re.label.length,14,ce.x,ce.y,8*se.label.length,14)&&(re.size<se.size?J.add(ne):J.add(ae))}}return P.filter(function(e){return!J.has(e)})}({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,visibleNodes:t,dimensions:this,graph:this.graph}),a=this.contexts.labels,s=Math.pow(n.ratio,.5),c=0,h=o.length;c<h;c++){var l=this.nodeDataCache[o[c]],f=this.camera.graphToViewport(this,l.x,l.y),d=f.x,p=f.y,v=l.size/s;xe(a,{label:l.label,size:v,x:d,y:p},this.settings)}return this.displayedLabels=new Set(o),this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,n=Math.pow(t.getState().ratio,.5),r=this.contexts.hovers;r.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToViewport(e,o.x,o.y),s=a.x,c=a.y,u=o.size/n;Ee(r,{label:o.label,color:o.color,size:u,x:s,y:c},e.settings)};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"refresh",value:function(){return this.needToSoftProcess=!0,this.scheduleRender(),this}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.addEdgeGraphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeDataCache=null,this.edgeDataCache=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null,this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}();n.d(t,"Renderer",function(){return c}),n.d(t,"Camera",function(){return u.a}),n.d(t,"QuadTree",function(){return A}),n.d(t,"MouseCaptor",function(){return L.a}),n.d(t,"WebGLRenderer",function(){return ze})}])}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";n.d(t,"d",function(){return i}),n.d(t,"e",function(){return o}),n.d(t,"a",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"c",function(){return c});var r=n(2);function i(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function o(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function a(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:Object(r.c)();return{x:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}(e)/(2*t),y:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}(e)/(2*t)}}function s(e){return{x:i(e),y:o(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function c(e){if(void 0!==e.wheelDelta)return e.wheelDelta/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"linear",function(){return o}),n.d(r,"quadraticIn",function(){return a}),n.d(r,"quadraticOut",function(){return s}),n.d(r,"quadraticInOut",function(){return c}),n.d(r,"cubicIn",function(){return u}),n.d(r,"cubicOut",function(){return h}),n.d(r,"cubicInOut",function(){return l});var i=n(3),o=function(e){return e},a=function(e){return e*e},s=function(e){return e*(2-e)},c=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},u=function(e){return e*e*e},h=function(e){return--e*e*e+1},l=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},f=n(5);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return b});var y={easing:"quadraticInOut",duration:150},b=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=v(this,m(t).call(this))).x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.previousState=e.getState(),e.enabled=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,i["EventEmitter"]),function(e,t,n){t&&p(e.prototype,t),n&&p(e,n)}(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:(t-this.x+this.ratio/2/i)*(r/this.ratio),y:(this.y-n+this.ratio/2/o)*(r/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:this.ratio/r*t+this.x-this.ratio/2/i,y:-(this.ratio/r*n-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*e.width/8,n=0*e.height/8,r=this.viewportToGraph(e,0-t,0-n),i=this.viewportToGraph(e,e.width+t,0-n),o=this.viewportToGraph(e,0,e.height+n);return{x1:r.x,y1:r.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"animate",value:function(e,t,n){var i=this;if(!this.enabled)return this;var o="function"==typeof(t=Object(f.a)({},y,t)).easing?t.easing:r[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var a=Date.now(),s=this.getState(),c=function r(){var c=(Date.now()-a)/t.duration;if(c>=1)return i.nextFrame=null,i.setState(e),void("function"==typeof n&&n());var u=o(c),h={};"x"in e&&(h.x=s.x+(e.x-s.x)*u),"y"in e&&(h.y=s.y+(e.y-s.y)*u),"angle"in e&&(h.angle=s.angle+(e.angle-s.angle)*u),"ratio"in e&&(h.ratio=s.ratio+(e.ratio-s.ratio)*u),i.setState(h),i.nextFrame=requestAnimationFrame(r)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(c)):c()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}}]),t}()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){var n=document.createElement(e);if(!t)return n;for(var r in t)if("style"===r)for(var i in t[r])n.style[i]=t[r][i];else n.setAttribute(r,t[r]);return n}function o(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function a(e){var t,n=r(e.x,2),i=n[0],o=n[1],a=r(e.y,2),s=a[0],c=a[1],u=Math.max(o-i,c-s);0===u&&(u=1);var h=(o+i)/2,l=(c+s)/2;return(t=function(e){return{x:.5+(e.x-h)/u,y:.5+(e.y-l)/u}}).applyTo=function(e){e.x=.5+(e.x-h)/u,e.y=.5+(e.y-l)/u},t.inverse=function(e){return{x:h+u*(e.x-.5),y:l+u*(e.y-.5)}},t.ratio=u,t}n.d(t,"a",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return a})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(u=n.slice()).length,c=0;c<a;c++)u[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(1),i=n(10),o=n(0);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l=function(t){function n(e,t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?h(e):t}(this,c(n).call(this,e,t))).container=e,r.camera=t,r.enabled=!0,r.hasDragged=!1,r.downStartTime=null,r.lastMouseX=null,r.lastMouseY=null,r.isMouseDown=!1,r.isMoving=!1,r.movingTimeout=null,r.startCameraState=null,r.lastCameraState=null,r.clicks=0,r.doubleClickTimeout=null,r.wheelLock=!1,r.handleClick=r.handleClick.bind(h(h(r))),r.handleDown=r.handleDown.bind(h(h(r))),r.handleUp=r.handleUp.bind(h(h(r))),r.handleMove=r.handleMove.bind(h(h(r))),r.handleWheel=r.handleWheel.bind(h(h(r))),r.handleOut=r.handleOut.bind(h(h(r))),e.addEventListener("click",r.handleClick,!1),e.addEventListener("mousedown",r.handleDown,!1),e.addEventListener("mousemove",r.handleMove,!1),e.addEventListener("DOMMouseScroll",r.handleWheel,!1),e.addEventListener("mousewheel",r.handleWheel,!1),e.addEventListener("mouseout",r.handleOut,!1),document.addEventListener("mouseup",r.handleUp,!1),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(n,i["a"]),function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.hasDragged||this.emit("click",Object(o.b)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=Object(o.a)(e),n=this.camera.getState(),i=n.ratio/2.2,a={width:this.container.offsetWidth,height:this.container.offsetHeight},s=Object(o.d)(e),c=Object(o.e)(e),u=new r.a;u.ratio=i,u.x=n.x,u.y=n.y;var h=this.camera.viewportToGraph(a,s,c),l=this.camera.viewportToGraph(a,t.x,t.y),f=u.viewportToGraph(a,s,c),d=u.viewportToGraph(a,t.x,t.y),p=f.x-d.x-h.x+l.x,v=f.y-d.y-h.y+l.y;return this.camera.animate({x:n.x-p,y:n.y-v,ratio:i},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.lastMouseX=Object(o.d)(e),this.lastMouseY=Object(o.e)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",Object(o.b)(e)))}},{key:"handleUp",value:function(t){var n=this;if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var r=Object(o.d)(t),i=Object(o.e)(t),a=this.camera.getState(),s=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:a.x+3*(a.x-s.x),y:a.y+3*(a.y-s.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===i||this.camera.setState({x:a.x,y:a.y}),this.isMoving=!1,e(function(){return n.hasDragged=!1}),this.emit("mouseup",Object(o.b)(t))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",Object(o.b)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var n={width:this.container.offsetWidth,height:this.container.offsetHeight},r=Object(o.d)(e),i=Object(o.e)(e),a=this.camera.viewportToGraph(n,this.lastMouseX,this.lastMouseY),s=this.camera.viewportToGraph(n,r,i),c=a.x-s.x,u=a.y-s.y,h=this.camera.getState(),l=h.x+c,f=h.y+u;this.camera.setState({x:l,y:f}),this.lastMouseX=r,this.lastMouseY=i}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!this.enabled)return!1;var n=Object(o.c)(e);if(!n)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=n>0?1/1.7:1.7,a=this.camera.getState(),s=i*a.ratio,c=Object(o.a)(e),u={width:this.container.offsetWidth,height:this.container.offsetHeight},h=Object(o.d)(e),l=Object(o.e)(e),f=new r.a;f.ratio=s,f.x=a.x,f.y=a.y;var d=this.camera.viewportToGraph(u,h,l),p=this.camera.viewportToGraph(u,c.x,c.y),v=f.viewportToGraph(u,h,l),m=f.viewportToGraph(u,c.x,c.y),g=v.x-m.x-d.x+p.x,y=v.y-m.y-d.y+p.y;return this.camera.animate({x:a.x-g,y:a.y-y,ratio:s},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),n}()}).call(this,n(15).setImmediate)},function(e,t,n){"use strict";function r(e){e=e||{};for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,o=n.length;i<o;i++)if(n[i])for(var a in n[i])e[a]=n[i][a];return e}n.d(t,"a",function(){return r})},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},function(e,t,n){var r=n(6);function i(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.nodes(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getNodeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f}var o=i;o.nodeExtent=i,o.edgeExtent=function(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.edges(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getEdgeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f},e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e,t){var n=e.length,r=t.length;if(0!==r){e.length+=t.length;for(var i=0;i<r;i++)e[n+i]=t[i]}}},function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,a(t).call(this))).container=e,r.camera=n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}()},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n // gl_FragColor = mix(color0, v_color, t);\n gl_FragColor = mix(color0, v_color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float min_thickness = 1.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness * pow_ratio / u_scale;\n\n // Min thickness for AA\n thickness = max(min_thickness, thickness);\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 2.6;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(16),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,o={},a=!1,s=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&h(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){h(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){h(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(h,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return o[i]=a,r(i),i++},c.clearImmediate=u}function u(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{u(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(8),n(17))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var e=s(f);h=!0;for(var t=u.length;t;){for(c=u,u=[];++l<t;)c&&c[l].run();l=-1,t=u.length}c=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,a(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}(),u=n(1),h=n(9),l=n.n(h);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=4,p=5,v=0,m=1,g=2,y=3,b=1,w=2,x=3,_=4;function E(e,t,n,r,i,o,a){return e<r+o&&e+n>r&&t<i+a&&t+n>i}function T(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function S(e,t,n,r,i,o){var a=e<n+i/2;return t<r+o/2?a?b:w:a?x:_}var A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=t||{};var n=Math.pow(4,p);this.data=new Float32Array(d*((4*n-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(e,[{key:"add",value:function(e,t,n,r){return function(e,t,n,r,i,o,a){for(var s=i-a,c=o-a,u=2*a,h=0,l=0;;){if(h>=e)return n[l]=n[l]||[],void n[l].push(r);var f=4*l+d,p=4*l+2*d,b=4*l+3*d,w=4*l+4*d,x=E(s,c,u,t[f+v],t[f+m],t[f+g],t[f+y]),_=E(s,c,u,t[p+v],t[p+m],t[p+g],t[p+y]),T=E(s,c,u,t[b+v],t[b+m],t[b+g],t[b+y]),S=E(s,c,u,t[w+v],t[w+m],t[w+g],t[w+y]),A=x+_+T+S;if(0===A)throw new Error("sigma/quadtree.insertNode: no collision (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(3===A)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(A>1)return n[l]=n[l]||[],void n[l].push(r);h++,x&&(l=f),_&&(l=p),T&&(l=b),S&&(l=w)}}(p,this.data,this.containers,e,t,n,r),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[m]=e.y,this.data[g]=e.width,this.data[y]=e.height,function(e,t){for(var n=[0,0];n.length;){var r=n.pop(),i=n.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,c=4*i+4*d,u=t[i+v],h=t[i+m],l=t[i+g]/2,f=t[i+y]/2;t[o+v]=u,t[o+m]=h,t[o+g]=l,t[o+y]=f,t[a+v]=u+l,t[a+m]=h,t[a+g]=l,t[a+y]=f,t[s+v]=u,t[s+m]=h+f,t[s+g]=l,t[s+y]=f,t[c+v]=u+l,t[c+m]=h+f,t[c+g]=l,t[c+y]=f,r<e-1&&(n.push(c,r+1),n.push(s,r+1),n.push(a,r+1),n.push(o,r+1))}}(p,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var n=[],r=0,i=0;do{this.containers[r]&&n.push.apply(n,this.containers[r]),r=4*r+S(e,t,this.data[r+v],this.data[r+m],this.data[r+g],this.data[r+y])*d,i++}while(i<=p);return n}},{key:"rectangle",value:function(e,t,n,r,i){var o=this.lastRectangle;if(o&&e===o.x1&&n===o.x2&&t===o.y1&&r===o.y2&&i===o.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:n,y2:r,height:i},!function(e,t,n,r){return e===n||t===r}(e,t,n,r))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var a=function(e,t,n,r,i,o,a){for(var s,c=[0,0],u=[];c.length;){var h=c.pop(),f=c.pop();if((s=n[f])&&l()(u,s),!(h>=e)){var p=4*f+d,b=4*f+2*d,w=4*f+3*d,x=4*f+4*d,_=T(r,i,o,a,t[p+v],t[p+m],t[p+g],t[p+y]),E=T(r,i,o,a,t[b+v],t[b+m],t[b+g],t[b+y]),S=T(r,i,o,a,t[w+v],t[w+m],t[w+g],t[w+y]),A=T(r,i,o,a,t[x+v],t[x+m],t[x+g],t[x+y]);_&&c.push(p,h+1),E&&c.push(b,h+1),S&&c.push(w,h+1),A&&c.push(x,h+1)}}return u}(p,this.data,this.containers,e,t,Math.abs(e-n)||Math.abs(t-r),i);return this.cache=a,this.cache}}]),e}(),L=n(4),O=n(7),k=n(6),P=n.n(k);function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function j(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var R=function(){function e(t,n){M(this,e),this.index=t,this.x=0,this.y=0,this.size=2,this.color=n.defaultNodeColor,this.hidden=!1,this.label=""}return j(e,[{key:"assign",value:function(e){"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden),"label"in e&&(this.label=e.label)}}]),e}(),F=function(){function e(t,n){M(this,e),this.index=t,this.size=1,this.color=n.defaultEdgeColor,this.hidden=!1}return j(e,[{key:"assign",value:function(e){"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden)}}]),e}();function N(e,t,n){var r="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return i}var D=N.bind(null,"VERTEX"),z=N.bind(null,"FRAGMENT");function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),e}var Y=function(){function e(t,n,r){I(this,e),this.vertexShaderSource=n,this.fragmentShaderSource=r,this.load(t)}return G(e,[{key:"load",value:function(e){return this.vertexShader=D(e,this.vertexShaderSource),this.fragmentShader=z(e,this.fragmentShaderSource),this.program=function(e,t){var n,r,i=e.createProgram();for(n=0,r=t.length;n<r;n++)e.attachShader(i,t[n]);if(e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw e.deleteProgram(i),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return i}(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();function H(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function V(e,t,n){return e[0]=t,e[4]=arguments.length>2?n:t,e}function B(e,t){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],h=e[8],l=t[0],f=t[1],d=t[2],p=t[3],v=t[4],m=t[5],g=t[6],y=t[7],b=t[8];return e[0]=l*n+f*o+d*c,e[1]=l*r+f*a+d*u,e[2]=l*i+f*s+d*h,e[3]=p*n+v*o+m*c,e[4]=p*r+v*a+m*u,e[5]=p*i+v*s+m*h,e[6]=g*n+y*o+b*c,e[7]=g*r+y*a+b*u,e[8]=g*i+y*s+b*h,e}var X={},q=new Int8Array(4),W=new Int32Array(q.buffer,0,1),K=new Float32Array(q.buffer,0,1),$=/^\s*rgba?\s*\(/,Q=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Z(e){if(void 0!==X[e])return X[e];var t=0,n=0,r=0,i=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16));else if($.test(e)){var o=e.match(Q);t=+o[1],n=+o[2],r=+o[3],o[4]&&(i=+o[4])}var a=4278190079&((i=255*i|0)<<24|r<<16|n<<8|t);W[0]=a;var s=K[0];return X[e]=s,s}function J(e,t){var n=e.angle,r=e.ratio,i=e.x,o=e.y,a=t.width,s=t.height,c=H(),u=Math.min(a,s),h=function(e,t,n){return e[6]=t,e[7]=n,e}(H(),-i,-o),l=V(H(),1/r),f=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}(H(),-n);return B(c,V(H(),u/a*2,u/s*2)),B(c,f),B(c,l),B(c,h),c}var ee=n(11),te=n.n(ee),ne=n(12),re=n.n(ne);function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=4,he=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ae(this,se(t).call(this,e,te.a,re.a))).gl=e,n.array=null,n.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.buffer);var r=n.program;return n.positionLocation=e.getAttribLocation(r,"a_position"),n.sizeLocation=e.getAttribLocation(r,"a_size"),n.colorLocation=e.getAttribLocation(r,"a_color"),n.matrixLocation=e.getUniformLocation(r,"u_matrix"),n.ratioLocation=e.getUniformLocation(r,"u_ratio"),n.scaleLocation=e.getUniformLocation(r,"u_scale"),e.enableVertexAttribArray(n.positionLocation),e.enableVertexAttribArray(n.sizeLocation),e.enableVertexAttribArray(n.colorLocation),e.vertexAttribPointer(n.positionLocation,2,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(n.sizeLocation,1,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(n.colorLocation,4,e.UNSIGNED_BYTE,!0,ue*Float32Array.BYTES_PER_ELEMENT,12),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(t,Y),function(e,t,n){t&&oe(e.prototype,t),n&&oe(e,n)}(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*ue*e)}},{key:"process",value:function(e,t){var n=Z(e.color),r=1*t*ue,i=this.array;if(e.hidden)return i[r++]=0,i[r++]=0,i[r++]=0,void(i[r++]=0);i[r++]=e.x,i[r++]=e.y,i[r++]=e.size,i[r]=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform1f(this.ratioLocation,1/Math.pow(e.ratio,e.nodesPowRatio)),t.uniform1f(this.scaleLocation,e.scalingRatio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.drawArrays(t.POINTS,0,this.array.length/ue)}}]),t}(),le=n(13),fe=n.n(le),de=n(14),pe=n.n(de);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return!t||"object"!==ve(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ge(this,ye(t).call(this,e,fe.a,pe.a))).gl=e,n.array=null,n.indicesArray=null,n.buffer=e.createBuffer(),n.indicesBuffer=e.createBuffer(),n.positionLocation=e.getAttribLocation(n.program,"a_position"),n.normalLocation=e.getAttribLocation(n.program,"a_normal"),n.thicknessLocation=e.getAttribLocation(n.program,"a_thickness"),n.colorLocation=e.getAttribLocation(n.program,"a_color"),n.resolutionLocation=e.getUniformLocation(n.program,"u_resolution"),n.ratioLocation=e.getUniformLocation(n.program,"u_ratio"),n.matrixLocation=e.getUniformLocation(n.program,"u_matrix"),n.scaleLocation=e.getUniformLocation(n.program,"u_scale"),n.bind(),n.canUse32BitsIndices=function(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||!!e.getExtension("OES_element_index_uint")}(e),n.IndicesArray=n.canUse32BitsIndices?Uint32Array:Uint16Array,n.indicesType=n.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}(t,Y),function(e,t,n){t&&me(e.prototype,t),n&&me(e,n)}(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,4,e.UNSIGNED_BYTE,!0,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,n,r){if(e.hidden||t.hidden||n.hidden)for(var i=24*r,o=i+24;i<o;i++)this.array[i]=0;else{var a=n.size||1,s=e.x,c=e.y,u=t.x,h=t.y,l=Z(n.color),f=u-s,d=h-c,p=f*f+d*d,v=0,m=0;p&&(v=-d*(p=1/Math.sqrt(p)),m=f*p);var g=24*r,y=this.array;y[g++]=s,y[g++]=c,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=s,y[g++]=c,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g]=l}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,n=new this.IndicesArray(t),r=0,i=0;r<e;r+=4)n[i++]=r,n[i++]=r+1,n[i++]=r+2,n[i++]=r+2,n[i++]=r+1,n[i++]=r+3;this.indicesArray=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indicesArray,e.STATIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}();function xe(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.fillStyle="#000",e.font="".concat(o," ").concat(r,"px ").concat(i),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}var _e=2*Math.PI;function Ee(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(r,"px ").concat(i),e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var a=e.measureText(t.label).width,s=Math.round(t.x-r/2-2),c=Math.round(t.y-r/2-2),u=Math.round(a+r/2+t.size+9),h=Math.round(r+4),l=Math.round(r/2+2);e.moveTo(s,c+l),e.moveTo(s,c+l),e.arcTo(s,c,s+l,c,l),e.lineTo(s+u,c),e.lineTo(s+u,c+h),e.lineTo(s+l,c+h),e.arcTo(s,c+h,s,c+h-l,l),e.lineTo(s,c+l),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,function(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,_e,!0),e.closePath(),e.fill()}(e,t),xe(e,t,n)}var Te=n(5),Se=n(2),Ae={width:250,height:175},Le={width:400,height:300};function Oe(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function ke(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:r>i?1:0})}function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Re(e,t){return(Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Fe=Object(Se.c)(),Ne=Object(Se.c)(),De={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,defaultNodeColor:"#999",defaultEdgeColor:"#ccc",labelFont:"Arial",labelSize:14,labelWeight:"normal",nodeReducer:null,edgeReducer:null,zIndex:!1},ze=function(e){function t(e,n,r){var i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=Ce(this,je(t).call(this)),r=r||{},i.settings=Object(Te.a)({},De,r),!P()(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(n instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.graph=e,i.captors={},i.container=n,i.elements={},i.contexts={},i.listeners={},i.quadtree=new A,i.nodeDataCache={},i.edgeDataCache={},i.nodeExtent=null,i.edgeExtent=null,i.initializeCache(),i.normalizationFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.displayedLabels=new Set,i.hoveredNode=null,i.wasRenderedInThisFrame=!1,i.renderFrame=null,i.renderHighlightedNodesFrame=null,i.needToProcess=!1,i.needToSoftProcess=!1,i.createContext("edges"),i.createContext("nodes"),i.createContext("labels",!1),i.createContext("hovers",!1),i.createContext("mouse",!1);var o=i.contexts.nodes;return o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),(o=i.contexts.edges).blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),i.nodePrograms={def:new he(i.contexts.nodes)},i.edgePrograms={def:new we(i.contexts.edges)},i.resize(),i.camera=new u.a({width:i.width,height:i.height}),i.bindCameraHandlers(),i.captors={mouse:new L.a(i.elements.mouse,i.camera)},i.bindEventHandlers(),i.bindGraphHandlers(),i.process(),i.render(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,c),function(e,t,n){t&&Me(e.prototype,t),n&&Me(e,n)}(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Object(Se.a)("canvas",{class:"sigma-".concat(e),style:{position:"absolute"}});this.elements[e]=n,this.container.appendChild(n);var r,i={preserveDrawingBuffer:!1,antialias:!1};return t?((r=n.getContext("webgl2",i))||(r=n.getContext("webgl",i)),r||(r=n.getContext("experimental-webgl",i))):r=n.getContext("2d",i),this.contexts[e]=r,this}},{key:"initializeCache",value:function(){for(var e=this.graph,t=e.nodes(),n=0,r=t.length;n<r;n++)this.nodeDataCache[t[n]]=new R(n,this.settings);for(var i=e.edges(),o=0,a=i.length;o<a;o++)this.edgeDataCache[i[o]]=new F(o,this.settings)}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,n,r,i){return e>n-i&&e<n+i&&t>r-i&&t<r+i&&Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2))<i},n=function(t,n){var r=e.camera.viewportToGraph(e,t,n);return e.quadtree.point(r.x,1-r.y)};return this.listeners.handleMove=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=1/0,s=null,c=0,u=o.length;c<u;c++){var h=o[c],l=e.nodeDataCache[h],f=e.camera.graphToViewport(e,l.x,l.y),d=l.size/i;if(t(r.x,r.y,f.x,f.y,d)){var p=Math.sqrt(Math.pow(r.x-f.x,2)+Math.pow(r.y-f.y,2));p<a&&(a=p,s=h)}}if(s&&e.hoveredNode!==s)return e.hoveredNode=s,e.emit("enterNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var v=e.nodeDataCache[e.hoveredNode],m=e.camera.graphToViewport(e,v.x,v.y),g=v.size/i;if(!t(r.x,r.y,m.x,m.y,g)){var y=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",{node:y}),e.scheduleHighlightedNodesRender()}}},this.listeners.handleClick=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=0,s=o.length;a<s;a++){var c=o[a],u=e.nodeDataCache[c],h=e.camera.graphToViewport(e,u.x,u.y),l=u.size/i;if(t(r.x,r.y,h.x,h.y,l))return e.emit("clickNode",{node:c})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph;return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},t.on("nodeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.graphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.graph,n=this.settings;this.quadtree.clear();var r=["x","y"];this.settings.zIndex&&(r.push("z"),this.edgeExtent=Object(O.edgeExtent)(t,["z"])),this.nodeExtent=Object(O.nodeExtent)(t,r),this.normalizationFunction=Object(Se.b)(this.nodeExtent);var i=this.nodePrograms.def;e||i.allocate(t.order);var o=t.nodes();this.settings.zIndex&&(o=ke(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},o));for(var a=0,s=o.length;a<s;a++){var c=o[a],u=t.getNodeAttributes(c),h=this.nodeDataCache[c];n.nodeReducer&&(u=n.nodeReducer(c,u)),h.assign(u),this.normalizationFunction.applyTo(h),this.quadtree.add(c,h.x,1-h.y,h.size/this.width),i.process(h,a),h.index=a}i.bufferData();var l=this.edgePrograms.def;e||l.allocate(t.size);var f=t.edges();this.settings.zIndex&&(f=ke(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var d=0,p=f.length;d<p;d++){var v=f[d],m=t.getEdgeAttributes(v),g=this.edgeDataCache[v];n.edgeReducer&&(m=n.edgeReducer(v,m)),g.assign(m);var y=t.extremities(v),b=this.nodeDataCache[y[0]],w=this.nodeDataCache[y[1]];l.process(b,w,g,d),g.index=d}return e||"function"!=typeof l.computeIndices||l.computeIndices(),l.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,n=this.graph.getNodeAttributes(e);return t.process(n,this.nodeDataCache[e].index),this}},{key:"processEdge",value:function(e){var t=this.graph,n=this.edgePrograms.def,r=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return n.process(o,a,r,this.edgeDataCache[e].index),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var n=this.width,r=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),0===this.width)throw new Error("sigma/renderers/webgl: container has no width.");if(0===this.height)throw new Error("sigma/renderers/webgl: container has no height.");if(n===this.width&&r===this.height)return this;for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*Fe+"px"),this.elements[a].setAttribute("height",this.height*Fe+"px"),1!==Fe&&s.scale(Fe,Fe)):(this.elements[a].setAttribute("width",this.width*Ne+"px"),this.elements[a].setAttribute("height",this.height*Ne+"px")),s.viewport&&s.viewport(0,0,this.width*Ne,this.height*Ne)}return this}},{key:"clear",value:function(){return this.contexts.labels.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),!this.graph.order)return this;var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t,n=this.camera.getState(),r=J(n,{width:this.width,height:this.height});if(this.nodePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,scalingRatio:Ne}),this.settings.hideEdgesOnMove&&e||this.edgePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:Ne}),this.settings.hideLabelsOnMove&&e)return this;if(n.ratio>=1)t=this.graph.nodes();else{var i=this.camera.viewRectangle(this);t=this.quadtree.rectangle(i.x1,1-i.y1,i.x2,1-i.y2,i.height)}if(!this.settings.renderLabels)return this;for(var o=function(e){var t=e.cache,n=e.camera,r=e.displayedLabels,i=e.visibleNodes,o=e.dimensions,a=e.graph,s=n.getState(),c=n.getPreviousState(),h=new u.a;h.setState(c);var l=s.x===c.x&&s.y===c.y&&s.ratio===c.ratio,f=s.ratio<c.ratio,d=s.x!==c.x||s.y!==c.y,p=s.ratio>c.ratio,v=!f&&!p&&s.ratio>=1,m=d&&r.size&&!f&&!p;if(p&&Math.trunc(100*s.ratio)%5!=0)return Array.from(r);if((v||l)&&0!==r.size)return Array.from(r);if(f&&s.ratio>=1)return Array.from(r);for(var g=s.ratio>=1.3?Le:Ae,y=o.width%g.width,b=g.width+y/Math.floor(o.width/g.width),w=o.height%g.height,x=g.height+w/Math.floor(o.height/g.height),_=o.width+b,E=o.height+x,T=-b,S=-x,A=o.width+b/2,L=o.height+x/2,O=-b/2,k=-x/2,P=[],M={},C=-1/0,j=null,R=0,F=i.length;R<F;R++){var N=i[R],D=t[N],z=n.graphToViewport(o,D.x,D.y);if(!(z.x<T||z.x>_||z.y<S||z.y>E)){if(D.size>C&&(C=D.size,j=N),m){var I=h.graphToViewport(o,D.x,D.y);if(I.x>=O&&I.x<=A&&I.y>=k&&I.y<=L&&!r.has(N))continue}var U=Math.floor(z.x/b),G=Math.floor(z.y/x),Y="".concat(U,"§").concat(G);if(void 0===M[Y])M[Y]=N;else{var H=M[Y],V=t[H];if(r.size>0){var B=r.has(N),X=r.has(H);if(!B&&X)continue;if(B&&!X){M[Y]=N;continue}if((m||f)&&B&&X){P.push(N);continue}}var q=!1;if(D.size>V.size)q=!0;else if(D.size===V.size){var W=a.degree(N),K=a.degree(H);W>K?q=!0:W===K&&N>H&&(q=!0)}q&&(M[Y]=N)}}}var $=P.some(function(e){return e===j});for(var Q in M){var Z=M[Q];Z===j&&($=!0),P.push(Z)}!$&&j&&P.push(j);for(var J=new Set,ee=0,te=P.length;ee<te;ee++){var ne=P[ee],re=t[ne],ie=n.graphToViewport(o,re.x,re.y);if(!J.has(ne))for(var oe=ee+1;oe<te;oe++){var ae=P[oe],se=t[ae],ce=n.graphToViewport(o,se.x,se.y);Oe(ie.x,ie.y,8*re.label.length,14,ce.x,ce.y,8*se.label.length,14)&&(re.size<se.size?J.add(ne):J.add(ae))}}return P.filter(function(e){return!J.has(e)})}({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,visibleNodes:t,dimensions:this,graph:this.graph}),a=this.contexts.labels,s=Math.pow(n.ratio,.5),c=0,h=o.length;c<h;c++){var l=this.nodeDataCache[o[c]],f=this.camera.graphToViewport(this,l.x,l.y),d=f.x,p=f.y,v=l.size/s;xe(a,{label:l.label,size:v,x:d,y:p},this.settings)}return this.displayedLabels=new Set(o),this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,n=Math.pow(t.getState().ratio,.5),r=this.contexts.hovers;r.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToViewport(e,o.x,o.y),s=a.x,c=a.y,u=o.size/n;Ee(r,{label:o.label,color:o.color,size:u,x:s,y:c},e.settings)};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"refresh",value:function(){return this.needToSoftProcess=!0,this.scheduleRender(),this}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.graphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeDataCache=null,this.edgeDataCache=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null,this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}();n.d(t,"Renderer",function(){return c}),n.d(t,"Camera",function(){return u.a}),n.d(t,"QuadTree",function(){return A}),n.d(t,"MouseCaptor",function(){return L.a}),n.d(t,"WebGLRenderer",function(){return ze})}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Sigma=t():e.Sigma=t()}(window,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=18)}([function(e,t,n){"use strict";n.d(t,"d",function(){return i}),n.d(t,"e",function(){return o}),n.d(t,"a",function(){return a}),n.d(t,"b",function(){return s}),n.d(t,"c",function(){return c});var r=n(2);function i(e){if(void 0!==e.offsetX)return e.offsetX;if(void 0!==e.layerX)return e.layerX;if(void 0!==e.clientX)return e.clientX;throw new Error("sigma/captors/utils.getX: could not extract x from event.")}function o(e){if(void 0!==e.offsetY)return e.offsetY;if(void 0!==e.layerY)return e.layerY;if(void 0!==e.clientY)return e.clientY;throw new Error("sigma/captors/utils.getY: could not extract y from event.")}function a(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:Object(r.c)();return{x:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.width:e.target.width;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getWidth: could not extract width from event.")}(e)/(2*t),y:function(e){var t=e.target.ownerSVGElement?e.target.ownerSVGElement.height:e.target.height;if("number"==typeof t)return t;if(void 0!==t&&void 0!==t.baseVal)return t.baseVal.value;throw new Error("sigma/captors/utils.getHeight: could not extract height from event.")}(e)/(2*t)}}function s(e){return{x:i(e),y:o(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function c(e){if(void 0!==e.wheelDelta)return e.wheelDelta/360;if(void 0!==e.detail)return e.detail/-9;throw new Error("sigma/captors/utils.getDelta: could not extract delta from event.")}},function(e,t,n){"use strict";var r={};n.r(r),n.d(r,"linear",function(){return o}),n.d(r,"quadraticIn",function(){return a}),n.d(r,"quadraticOut",function(){return s}),n.d(r,"quadraticInOut",function(){return c}),n.d(r,"cubicIn",function(){return u}),n.d(r,"cubicOut",function(){return h}),n.d(r,"cubicInOut",function(){return l});var i=n(3),o=function(e){return e},a=function(e){return e*e},s=function(e){return e*(2-e)},c=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},u=function(e){return e*e*e},h=function(e){return--e*e*e+1},l=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)},f=n(5);function d(e){return(d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function p(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function v(e,t){return!t||"object"!==d(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function m(e){return(m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function g(e,t){return(g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}n.d(t,"a",function(){return b});var y={easing:"quadraticInOut",duration:150},b=function(e){function t(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(e=v(this,m(t).call(this))).x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.previousState=e.getState(),e.enabled=!0,e}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}(t,i["EventEmitter"]),function(e,t,n){t&&p(e.prototype,t),n&&p(e,n)}(t,[{key:"enable",value:function(){return this.enabled=!0,this}},{key:"disable",value:function(){return this.enabled=!1,this}},{key:"getState",value:function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}}},{key:"getPreviousState",value:function(){var e=this.previousState;return{x:e.x,y:e.y,angle:e.angle,ratio:e.ratio}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"graphToViewport",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:(t-this.x+this.ratio/2/i)*(r/this.ratio),y:(this.y-n+this.ratio/2/o)*(r/this.ratio)}}},{key:"viewportToGraph",value:function(e,t,n){var r=Math.min(e.width,e.height),i=r/e.width,o=r/e.height;return{x:this.ratio/r*t+this.x-this.ratio/2/i,y:-(this.ratio/r*n-this.y-this.ratio/2/o)}}},{key:"viewRectangle",value:function(e){var t=0*e.width/8,n=0*e.height/8,r=this.viewportToGraph(e,0-t,0-n),i=this.viewportToGraph(e,e.width+t,0-n),o=this.viewportToGraph(e,0,e.height+n);return{x1:r.x,y1:r.y,x2:i.x,y2:i.y,height:i.y-o.y}}},{key:"setState",value:function(e){return this.enabled?(this.previousState=this.getState(),"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"angle"in e&&(this.angle=e.angle),"ratio"in e&&(this.ratio=e.ratio),this.emit("updated",this.getState()),this):this}},{key:"animate",value:function(e,t,n){var i=this;if(!this.enabled)return this;var o="function"==typeof(t=Object(f.a)({},y,t)).easing?t.easing:r[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var a=Date.now(),s=this.getState(),c=function r(){var c=(Date.now()-a)/t.duration;if(c>=1)return i.nextFrame=null,i.setState(e),void("function"==typeof n&&n());var u=o(c),h={};"x"in e&&(h.x=s.x+(e.x-s.x)*u),"y"in e&&(h.y=s.y+(e.y-s.y)*u),"angle"in e&&(h.angle=s.angle+(e.angle-s.angle)*u),"ratio"in e&&(h.ratio=s.ratio+(e.ratio-s.ratio)*u),i.setState(h),i.nextFrame=requestAnimationFrame(r)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(c)):c()}},{key:"animatedZoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio/e}):this.animate({ratio:this.ratio/(e.factor||1.5)},e):this.animate({ratio:this.ratio/1.5})}},{key:"animatedUnzoom",value:function(e){return e?"number"==typeof e?this.animate({ratio:this.ratio*e}):this.animate({ratio:this.ratio*(e.factor||1.5)},e):this.animate({ratio:1.5*this.ratio})}},{key:"animatedReset",value:function(e){return this.animate({x:.5,y:.5,ratio:1,angle:0},e)}}]),t}()},function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(r=(a=s.next()).done)&&(n.push(a.value),!t||n.length!==t);r=!0);}catch(e){i=!0,o=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function i(e,t){var n=document.createElement(e);if(!t)return n;for(var r in t)if("style"===r)for(var i in t[r])n.style[i]=t[r][i];else n.setAttribute(r,t[r]);return n}function o(){var e=window.screen;return void 0!==e.deviceXDPI&&void 0!==e.logicalXDPI&&e.deviceXDPI>e.logicalXDPI?e.systemXDPI/e.logicalXDPI:void 0!==window.devicePixelRatio?window.devicePixelRatio:1}function a(e){var t,n=r(e.x,2),i=n[0],o=n[1],a=r(e.y,2),s=a[0],c=a[1],u=Math.max(o-i,c-s);0===u&&(u=1);var h=(o+i)/2,l=(c+s)/2;return(t=function(e){return{x:.5+(e.x-h)/u,y:.5+(e.y-l)/u}}).applyTo=function(e){e.x=.5+(e.x-h)/u,e.y=.5+(e.y-l)/u},t.inverse=function(e){return{x:h+u*(e.x-.5),y:l+u*(e.y-.5)}},t.ratio=u,t}n.d(t,"a",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"b",function(){return a})},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function i(e){return"object"==typeof e&&null!==e}function o(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!function(e){return"number"==typeof e}(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,a,s,c,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||i(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var h=new Error('Uncaught, unspecified "error" event. ('+t+")");throw h.context=t,h}if(o(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(i(n))for(s=Array.prototype.slice.call(arguments,1),a=(u=n.slice()).length,c=0;c<a;c++)u[c].apply(this,s);return!0},n.prototype.addListener=function(e,t){var a;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?i(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,i(this._events[e])&&!this._events[e].warned&&(a=o(this._maxListeners)?n.defaultMaxListeners:this._maxListeners)&&a>0&&this._events[e].length>a&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},n.prototype.removeListener=function(e,t){var n,o,a,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(a=(n=this._events[e]).length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(i(n)){for(s=a;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";(function(e){n.d(t,"a",function(){return l});var r=n(1),i=n(10),o=n(0);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}var l=function(t){function n(e,t){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),(r=function(e,t){return!t||"object"!==a(t)&&"function"!=typeof t?h(e):t}(this,c(n).call(this,e,t))).container=e,r.camera=t,r.enabled=!0,r.hasDragged=!1,r.downStartTime=null,r.lastMouseX=null,r.lastMouseY=null,r.isMouseDown=!1,r.isMoving=!1,r.movingTimeout=null,r.startCameraState=null,r.lastCameraState=null,r.clicks=0,r.doubleClickTimeout=null,r.wheelLock=!1,r.handleClick=r.handleClick.bind(h(h(r))),r.handleDown=r.handleDown.bind(h(h(r))),r.handleUp=r.handleUp.bind(h(h(r))),r.handleMove=r.handleMove.bind(h(h(r))),r.handleWheel=r.handleWheel.bind(h(h(r))),r.handleOut=r.handleOut.bind(h(h(r))),e.addEventListener("click",r.handleClick,!1),e.addEventListener("mousedown",r.handleDown,!1),e.addEventListener("mousemove",r.handleMove,!1),e.addEventListener("DOMMouseScroll",r.handleWheel,!1),e.addEventListener("mousewheel",r.handleWheel,!1),e.addEventListener("mouseout",r.handleOut,!1),document.addEventListener("mouseup",r.handleUp,!1),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(n,i["a"]),function(e,t,n){t&&s(e.prototype,t),n&&s(e,n)}(n,[{key:"kill",value:function(){var e=this.container;e.removeEventListener("click",this.handleClick),e.removeEventListener("mousedown",this.handleDown),e.removeEventListener("mousemove",this.handleMove),e.removeEventListener("DOMMouseScroll",this.handleWheel),e.removeEventListener("mousewheel",this.handleWheel),e.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)}},{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null,this.handleDoubleClick(e);setTimeout(function(){t.clicks=0,t.doubleClickTimeout=null},300),this.hasDragged||this.emit("click",Object(o.b)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=Object(o.a)(e),n=this.camera.getState(),i=n.ratio/2.2,a={width:this.container.offsetWidth,height:this.container.offsetHeight},s=Object(o.d)(e),c=Object(o.e)(e),u=new r.a;u.ratio=i,u.x=n.x,u.y=n.y;var h=this.camera.viewportToGraph(a,s,c),l=this.camera.viewportToGraph(a,t.x,t.y),f=u.viewportToGraph(a,s,c),d=u.viewportToGraph(a,t.x,t.y),p=f.x-d.x-h.x+l.x,v=f.y-d.y-h.y+l.y;return this.camera.animate({x:n.x-p,y:n.y-v,ratio:i},{easing:"quadraticInOut",duration:200}),e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleDown",value:function(e){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastCameraState=this.startCameraState,this.lastMouseX=Object(o.d)(e),this.lastMouseY=Object(o.e)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",Object(o.b)(e)))}},{key:"handleUp",value:function(t){var n=this;if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var r=Object(o.d)(t),i=Object(o.e)(t),a=this.camera.getState(),s=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:a.x+3*(a.x-s.x),y:a.y+3*(a.y-s.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===i||this.camera.setState({x:a.x,y:a.y}),this.isMoving=!1,e(function(){return n.hasDragged=!1}),this.emit("mouseup",Object(o.b)(t))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",Object(o.b)(e)),this.isMouseDown){this.isMoving=!0,this.hasDragged=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=setTimeout(function(){t.movingTimeout=null,t.isMoving=!1},200);var n={width:this.container.offsetWidth,height:this.container.offsetHeight},r=Object(o.d)(e),i=Object(o.e)(e),a=this.camera.viewportToGraph(n,this.lastMouseX,this.lastMouseY),s=this.camera.viewportToGraph(n,r,i),c=a.x-s.x,u=a.y-s.y,h=this.camera.getState(),l=h.x+c,f=h.y+u;this.camera.setState({x:l,y:f}),this.lastMouseX=r,this.lastMouseY=i}return e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!1}}},{key:"handleWheel",value:function(e){var t=this;if(e.preventDefault?e.preventDefault():e.returnValue=!1,e.stopPropagation(),!this.enabled)return!1;var n=Object(o.c)(e);if(!n)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=n>0?1/1.7:1.7,a=this.camera.getState(),s=i*a.ratio,c=Object(o.a)(e),u={width:this.container.offsetWidth,height:this.container.offsetHeight},h=Object(o.d)(e),l=Object(o.e)(e),f=new r.a;f.ratio=s,f.x=a.x,f.y=a.y;var d=this.camera.viewportToGraph(u,h,l),p=this.camera.viewportToGraph(u,c.x,c.y),v=f.viewportToGraph(u,h,l),m=f.viewportToGraph(u,c.x,c.y),g=v.x-m.x-d.x+p.x,y=v.y-m.y-d.y+p.y;return this.camera.animate({x:a.x-g,y:a.y-y,ratio:s},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),n}()}).call(this,n(15).setImmediate)},function(e,t,n){"use strict";function r(e){e=e||{};for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];for(var i=0,o=n.length;i<o;i++)if(n[i])for(var a in n[i])e[a]=n[i][a];return e}n.d(t,"a",function(){return r})},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNode&&"boolean"==typeof e.multi}},function(e,t,n){var r=n(6);function i(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.nodes(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getNodeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f}var o=i;o.nodeExtent=i,o.edgeExtent=function(e,t){if(!r(e))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var n,i,o,a,s,c,u,h=[].concat(t),l=e.edges(),f={};for(s=0;s<h.length;s++)f[a=h[s]]=[1/0,-1/0];for(c=0,u=l.length;c<u;c++)for(n=l[c],i=e.getEdgeAttributes(n),s=0;s<h.length;s++)(o=i[a=h[s]])<f[a][0]&&(f[a][0]=o),o>f[a][1]&&(f[a][1]=o);return"string"==typeof t?f[t]:f},e.exports=o},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){e.exports=function(e,t){var n=e.length,r=t.length;if(0!==r){e.length+=t.length;for(var i=0;i<r;i++)e[n+i]=t[i]}}},function(e,t,n){"use strict";n.d(t,"a",function(){return c});var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(e,n){var r;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(r=o(this,a(t).call(this))).container=e,r.camera=n,r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}()},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n // gl_FragColor = mix(color0, v_color, t);\n gl_FragColor = mix(color0, v_color, t);\n}\n"},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform mat3 u_matrix;\nuniform float u_scale;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float min_thickness = 1.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in pixels\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = a_thickness * pow_ratio / u_scale;\n\n // Min thickness for AA\n thickness = max(min_thickness, thickness);\n\n // Computing delta relative to viewport\n vec2 delta = (a_normal * thickness) / u_resolution;\n\n vec2 position = (u_matrix * vec3(a_position, 1)).xy;\n position += delta;\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 2.6;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function o(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new o(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new o(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},o.prototype.unref=o.prototype.ref=function(){},o.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout(function(){e._onTimeout&&e._onTimeout()},t))},n(16),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e,n){"use strict";if(!e.setImmediate){var r,i=1,o={},a=!1,s=e.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(e);c=c&&c.setTimeout?c:e,"[object process]"==={}.toString.call(e.process)?r=function(e){t.nextTick(function(){h(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?function(){var t="setImmediate$"+Math.random()+"$",n=function(n){n.source===e&&"string"==typeof n.data&&0===n.data.indexOf(t)&&h(+n.data.slice(t.length))};e.addEventListener?e.addEventListener("message",n,!1):e.attachEvent("onmessage",n),r=function(n){e.postMessage(t+n,"*")}}():e.MessageChannel?function(){var e=new MessageChannel;e.port1.onmessage=function(e){h(e.data)},r=function(t){e.port2.postMessage(t)}}():s&&"onreadystatechange"in s.createElement("script")?function(){var e=s.documentElement;r=function(t){var n=s.createElement("script");n.onreadystatechange=function(){h(t),n.onreadystatechange=null,e.removeChild(n),n=null},e.appendChild(n)}}():r=function(e){setTimeout(h,0,e)},c.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),n=0;n<t.length;n++)t[n]=arguments[n+1];var a={callback:e,args:t};return o[i]=a,r(i),i++},c.clearImmediate=u}function u(e){delete o[e]}function h(e){if(a)setTimeout(h,0,e);else{var t=o[e];if(t){a=!0;try{!function(e){var t=e.callback,r=e.args;switch(r.length){case 0:t();break;case 1:t(r[0]);break;case 2:t(r[0],r[1]);break;case 3:t(r[0],r[1],r[2]);break;default:t.apply(n,r)}}(t)}finally{u(e),a=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(8),n(17))},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function s(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,u=[],h=!1,l=-1;function f(){h&&c&&(h=!1,c.length?u=c.concat(u):l=-1,u.length&&d())}function d(){if(!h){var e=s(f);h=!0;for(var t=u.length;t;){for(c=u,u=[];++l<t;)c&&c[l].run();l=-1,t=u.length}c=null,h=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function p(e,t){this.fun=e,this.array=t}function v(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];u.push(new p(e,t)),1!==u.length||h||s(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=v,i.addListener=v,i.once=v,i.off=v,i.removeListener=v,i.removeAllListeners=v,i.emit=v,i.prependListener=v,i.prependOnceListener=v,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t,n){"use strict";n.r(t);var r=n(3);function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){return!t||"object"!==i(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function s(e,t){return(s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var c=function(e){function t(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),o(this,a(t).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&s(e,t)}(t,r["EventEmitter"]),t}(),u=n(1),h=n(9),l=n.n(h);function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var d=4,p=5,v=0,m=1,g=2,y=3,b=1,w=2,x=3,_=4;function E(e,t,n,r,i,o,a){return e<r+o&&e+n>r&&t<i+a&&t+n>i}function T(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function S(e,t,n,r,i,o){var a=e<n+i/2;return t<r+o/2?a?b:w:a?x:_}var A=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=t||{};var n=Math.pow(4,p);this.data=new Float32Array(d*((4*n-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1}),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return function(e,t,n){t&&f(e.prototype,t),n&&f(e,n)}(e,[{key:"add",value:function(e,t,n,r){return function(e,t,n,r,i,o,a){for(var s=i-a,c=o-a,u=2*a,h=0,l=0;;){if(h>=e)return n[l]=n[l]||[],void n[l].push(r);var f=4*l+d,p=4*l+2*d,b=4*l+3*d,w=4*l+4*d,x=E(s,c,u,t[f+v],t[f+m],t[f+g],t[f+y]),_=E(s,c,u,t[p+v],t[p+m],t[p+g],t[p+y]),T=E(s,c,u,t[b+v],t[b+m],t[b+g],t[b+y]),S=E(s,c,u,t[w+v],t[w+m],t[w+g],t[w+y]),A=x+_+T+S;if(0===A)throw new Error("sigma/quadtree.insertNode: no collision (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(3===A)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: ".concat(h,", key: ").concat(r,", x: ").concat(i,", y: ").concat(o,", size: ").concat(a,")."));if(A>1)return n[l]=n[l]||[],void n[l].push(r);h++,x&&(l=f),_&&(l=p),T&&(l=b),S&&(l=w)}}(p,this.data,this.containers,e,t,n,r),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[m]=e.y,this.data[g]=e.width,this.data[y]=e.height,function(e,t){for(var n=[0,0];n.length;){var r=n.pop(),i=n.pop(),o=4*i+d,a=4*i+2*d,s=4*i+3*d,c=4*i+4*d,u=t[i+v],h=t[i+m],l=t[i+g]/2,f=t[i+y]/2;t[o+v]=u,t[o+m]=h,t[o+g]=l,t[o+y]=f,t[a+v]=u+l,t[a+m]=h,t[a+g]=l,t[a+y]=f,t[s+v]=u,t[s+m]=h+f,t[s+g]=l,t[s+y]=f,t[c+v]=u+l,t[c+m]=h+f,t[c+g]=l,t[c+y]=f,r<e-1&&(n.push(c,r+1),n.push(s,r+1),n.push(a,r+1),n.push(o,r+1))}}(p,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var n=[],r=0,i=0;do{this.containers[r]&&n.push.apply(n,this.containers[r]),r=4*r+S(e,t,this.data[r+v],this.data[r+m],this.data[r+g],this.data[r+y])*d,i++}while(i<=p);return n}},{key:"rectangle",value:function(e,t,n,r,i){var o=this.lastRectangle;if(o&&e===o.x1&&n===o.x2&&t===o.y1&&r===o.y2&&i===o.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:n,y2:r,height:i},!function(e,t,n,r){return e===n||t===r}(e,t,n,r))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var a=function(e,t,n,r,i,o,a){for(var s,c=[0,0],u=[];c.length;){var h=c.pop(),f=c.pop();if((s=n[f])&&l()(u,s),!(h>=e)){var p=4*f+d,b=4*f+2*d,w=4*f+3*d,x=4*f+4*d,_=T(r,i,o,a,t[p+v],t[p+m],t[p+g],t[p+y]),E=T(r,i,o,a,t[b+v],t[b+m],t[b+g],t[b+y]),S=T(r,i,o,a,t[w+v],t[w+m],t[w+g],t[w+y]),A=T(r,i,o,a,t[x+v],t[x+m],t[x+g],t[x+y]);_&&c.push(p,h+1),E&&c.push(b,h+1),S&&c.push(w,h+1),A&&c.push(x,h+1)}}return u}(p,this.data,this.containers,e,t,Math.abs(e-n)||Math.abs(t-r),i);return this.cache=a,this.cache}}]),e}(),L=n(4),O=n(7),k=n(6),P=n.n(k);function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function C(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function j(e,t,n){return t&&C(e.prototype,t),n&&C(e,n),e}var R=function(){function e(t,n){M(this,e),this.index=t,this.x=0,this.y=0,this.size=2,this.color=n.defaultNodeColor,this.hidden=!1,this.label=""}return j(e,[{key:"assign",value:function(e){"x"in e&&(this.x=e.x),"y"in e&&(this.y=e.y),"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden),"label"in e&&(this.label=e.label)}}]),e}(),N=function(){function e(t,n){M(this,e),this.index=t,this.size=1,this.color=n.defaultEdgeColor,this.hidden=!1}return j(e,[{key:"assign",value:function(e){"size"in e&&(this.size=e.size),"color"in e&&(this.color=e.color),"hidden"in e&&(this.hidden=e.hidden)}}]),e}();function F(e,t,n){var r="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(r);if(t.shaderSource(i,n),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error("sigma/renderers/webgl/shaders/utils.loadShader: error while compiling the shader:\n".concat(o,"\n").concat(n))}return i}var D=F.bind(null,"VERTEX"),z=F.bind(null,"FRAGMENT");function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function U(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function G(e,t,n){return t&&U(e.prototype,t),n&&U(e,n),e}var Y=function(){function e(t,n,r){I(this,e),this.vertexShaderSource=n,this.fragmentShaderSource=r,this.load(t)}return G(e,[{key:"load",value:function(e){return this.vertexShader=D(e,this.vertexShaderSource),this.fragmentShader=z(e,this.fragmentShaderSource),this.program=function(e,t){var n,r,i=e.createProgram();for(n=0,r=t.length;n<r;n++)e.attachShader(i,t[n]);if(e.linkProgram(i),!e.getProgramParameter(i,e.LINK_STATUS))throw e.deleteProgram(i),new Error("sigma/renderers/webgl/shaders/utils.loadProgram: error while linking the program.");return i}(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();function H(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function V(e,t,n){return e[0]=t,e[4]=arguments.length>2?n:t,e}function B(e,t){var n=e[0],r=e[1],i=e[2],o=e[3],a=e[4],s=e[5],c=e[6],u=e[7],h=e[8],l=t[0],f=t[1],d=t[2],p=t[3],v=t[4],m=t[5],g=t[6],y=t[7],b=t[8];return e[0]=l*n+f*o+d*c,e[1]=l*r+f*a+d*u,e[2]=l*i+f*s+d*h,e[3]=p*n+v*o+m*c,e[4]=p*r+v*a+m*u,e[5]=p*i+v*s+m*h,e[6]=g*n+y*o+b*c,e[7]=g*r+y*a+b*u,e[8]=g*i+y*s+b*h,e}var X={},q=new Int8Array(4),W=new Int32Array(q.buffer,0,1),K=new Float32Array(q.buffer,0,1),$=/^\s*rgba?\s*\(/,Q=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)(?:\s*,\s*(.*)?)?\)\s*$/;function Z(e){if(void 0!==X[e])return X[e];var t=0,n=0,r=0,i=1;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),n=parseInt(e.charAt(2)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(4),16),r=parseInt(e.charAt(5)+e.charAt(6),16));else if($.test(e)){var o=e.match(Q);t=+o[1],n=+o[2],r=+o[3],o[4]&&(i=+o[4])}var a=4278190079&((i=255*i|0)<<24|r<<16|n<<8|t);W[0]=a;var s=K[0];return X[e]=s,s}function J(e,t){var n=e.angle,r=e.ratio,i=e.x,o=e.y,a=t.width,s=t.height,c=H(),u=Math.min(a,s),h=function(e,t,n){return e[6]=t,e[7]=n,e}(H(),-i,-o),l=V(H(),1/r),f=function(e,t){var n=Math.sin(t),r=Math.cos(t);return e[0]=r,e[1]=n,e[3]=-n,e[4]=r,e}(H(),-n);return B(c,V(H(),u/a*2,u/s*2)),B(c,f),B(c,l),B(c,h),c}var ee=n(11),te=n.n(ee),ne=n(12),re=n.n(ne);function ie(e){return(ie="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function oe(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ae(e,t){return!t||"object"!==ie(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function se(e){return(se=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function ce(e,t){return(ce=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var ue=4,he=function(e){function t(e){var n;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ae(this,se(t).call(this,e,te.a,re.a))).gl=e,n.array=null,n.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,n.buffer);var r=n.program;return n.positionLocation=e.getAttribLocation(r,"a_position"),n.sizeLocation=e.getAttribLocation(r,"a_size"),n.colorLocation=e.getAttribLocation(r,"a_color"),n.matrixLocation=e.getUniformLocation(r,"u_matrix"),n.ratioLocation=e.getUniformLocation(r,"u_ratio"),n.scaleLocation=e.getUniformLocation(r,"u_scale"),e.enableVertexAttribArray(n.positionLocation),e.enableVertexAttribArray(n.sizeLocation),e.enableVertexAttribArray(n.colorLocation),e.vertexAttribPointer(n.positionLocation,2,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(n.sizeLocation,1,e.FLOAT,!1,ue*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(n.colorLocation,4,e.UNSIGNED_BYTE,!0,ue*Float32Array.BYTES_PER_ELEMENT,12),n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&ce(e,t)}(t,Y),function(e,t,n){t&&oe(e.prototype,t),n&&oe(e,n)}(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*ue*e)}},{key:"process",value:function(e,t){var n=Z(e.color),r=1*t*ue,i=this.array;if(e.hidden)return i[r++]=0,i[r++]=0,i[r++]=0,void(i[r++]=0);i[r++]=e.x,i[r++]=e.y,i[r++]=e.size,i[r]=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform1f(this.ratioLocation,1/Math.pow(e.ratio,e.nodesPowRatio)),t.uniform1f(this.scaleLocation,e.scalingRatio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.drawArrays(t.POINTS,0,this.array.length/ue)}}]),t}(),le=n(13),fe=n.n(le),de=n(14),pe=n.n(de);function ve(e){return(ve="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function ge(e,t){return!t||"object"!==ve(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function ye(e){return(ye=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function be(e,t){return(be=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var we=function(e){function t(e){var n;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=ge(this,ye(t).call(this,e,fe.a,pe.a))).gl=e,n.array=null,n.indicesArray=null,n.buffer=e.createBuffer(),n.indicesBuffer=e.createBuffer(),n.positionLocation=e.getAttribLocation(n.program,"a_position"),n.normalLocation=e.getAttribLocation(n.program,"a_normal"),n.thicknessLocation=e.getAttribLocation(n.program,"a_thickness"),n.colorLocation=e.getAttribLocation(n.program,"a_color"),n.resolutionLocation=e.getUniformLocation(n.program,"u_resolution"),n.ratioLocation=e.getUniformLocation(n.program,"u_ratio"),n.matrixLocation=e.getUniformLocation(n.program,"u_matrix"),n.scaleLocation=e.getUniformLocation(n.program,"u_scale"),n.bind(),n.canUse32BitsIndices=function(e){return"undefined"!=typeof WebGL2RenderingContext&&e instanceof WebGL2RenderingContext||!!e.getExtension("OES_element_index_uint")}(e),n.IndicesArray=n.canUse32BitsIndices?Uint32Array:Uint16Array,n.indicesType=n.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,n}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&be(e,t)}(t,Y),function(e,t,n){t&&me(e.prototype,t),n&&me(e,n)}(t,[{key:"bind",value:function(){var e=this.gl;e.bindBuffer(e.ARRAY_BUFFER,this.buffer),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,this.indicesBuffer),e.enableVertexAttribArray(this.positionLocation),e.enableVertexAttribArray(this.normalLocation),e.enableVertexAttribArray(this.thicknessLocation),e.enableVertexAttribArray(this.colorLocation),e.vertexAttribPointer(this.positionLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(this.normalLocation,2,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(this.thicknessLocation,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(this.colorLocation,4,e.UNSIGNED_BYTE,!0,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,n,r){if(e.hidden||t.hidden||n.hidden)for(var i=24*r,o=i+24;i<o;i++)this.array[i]=0;else{var a=n.size||1,s=e.x,c=e.y,u=t.x,h=t.y,l=Z(n.color),f=u-s,d=h-c,p=f*f+d*d,v=0,m=0;p&&(v=-d*(p=1/Math.sqrt(p)),m=f*p);var g=24*r,y=this.array;y[g++]=s,y[g++]=c,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=s,y[g++]=c,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=v,y[g++]=m,y[g++]=a,y[g++]=l,y[g++]=u,y[g++]=h,y[g++]=-v,y[g++]=-m,y[g++]=a,y[g]=l}}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,n=new this.IndicesArray(t),r=0,i=0;r<e;r+=4)n[i++]=r,n[i++]=r+1,n[i++]=r+2,n[i++]=r+2,n[i++]=r+1,n[i++]=r+3;this.indicesArray=n}},{key:"bufferData",value:function(){var e=this.gl;e.bufferData(e.ARRAY_BUFFER,this.array,e.DYNAMIC_DRAW),e.bufferData(e.ELEMENT_ARRAY_BUFFER,this.indicesArray,e.STATIC_DRAW)}},{key:"render",value:function(e){var t=this.gl,n=this.program;t.useProgram(n),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.scalingRatio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}();function xe(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.fillStyle="#000",e.font="".concat(o," ").concat(r,"px ").concat(i),e.fillText(t.label,t.x+t.size+3,t.y+r/3)}var _e=2*Math.PI;function Ee(e,t,n){var r=n.labelSize,i=n.labelFont,o=n.labelWeight;e.font="".concat(o," ").concat(r,"px ").concat(i),e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var a=e.measureText(t.label).width,s=Math.round(t.x-r/2-2),c=Math.round(t.y-r/2-2),u=Math.round(a+r/2+t.size+9),h=Math.round(r+4),l=Math.round(r/2+2);e.moveTo(s,c+l),e.moveTo(s,c+l),e.arcTo(s,c,s+l,c,l),e.lineTo(s+u,c),e.lineTo(s+u,c+h),e.lineTo(s+l,c+h),e.arcTo(s,c+h,s,c+h-l,l),e.lineTo(s,c+l),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,function(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,_e,!0),e.closePath(),e.fill()}(e,t),xe(e,t,n)}var Te=n(5),Se=n(2),Ae={width:250,height:175},Le={width:400,height:300};function Oe(e,t,n,r,i,o,a,s){return e<i+a&&e+n>i&&t<o+s&&t+r>o}function ke(e,t,n){return n.sort(function(e,n){var r=t(e)||0,i=t(n)||0;return r<i?-1:r>i?1:0})}function Pe(e){return(Pe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function Me(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function Ce(e,t){return!t||"object"!==Pe(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function je(e){return(je=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function Re(e,t){return(Re=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var Ne=Object(Se.c)(),Fe=Object(Se.c)(),De={hideEdgesOnMove:!1,hideLabelsOnMove:!1,renderLabels:!0,defaultNodeColor:"#999",defaultEdgeColor:"#ccc",labelFont:"Arial",labelSize:14,labelWeight:"normal",nodeReducer:null,edgeReducer:null,zIndex:!1},ze=function(e){function t(e,n,r){var i;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),i=Ce(this,je(t).call(this)),r=r||{},i.settings=Object(Te.a)({},De,r),!P()(e))throw new Error("sigma/renderers/webgl: invalid graph instance.");if(!(n instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.graph=e,i.captors={},i.container=n,i.elements={},i.contexts={},i.listeners={},i.quadtree=new A,i.nodeDataCache={},i.edgeDataCache={},i.nodeExtent=null,i.edgeExtent=null,i.initializeCache(),i.normalizationFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.displayedLabels=new Set,i.hoveredNode=null,i.wasRenderedInThisFrame=!1,i.renderFrame=null,i.renderHighlightedNodesFrame=null,i.needToProcess=!1,i.needToSoftProcess=!1,i.createContext("edges"),i.createContext("nodes"),i.createContext("labels",!1),i.createContext("hovers",!1),i.createContext("mouse",!1);var o=i.contexts.nodes;return o.blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),(o=i.contexts.edges).blendFunc(o.ONE,o.ONE_MINUS_SRC_ALPHA),o.enable(o.BLEND),i.nodePrograms={def:new he(i.contexts.nodes)},i.edgePrograms={def:new we(i.contexts.edges)},i.resize(),i.camera=new u.a({width:i.width,height:i.height}),i.bindCameraHandlers(),i.captors={mouse:new L.a(i.elements.mouse,i.camera)},i.bindEventHandlers(),i.bindGraphHandlers(),i.process(),i.render(),i}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&Re(e,t)}(t,c),function(e,t,n){t&&Me(e.prototype,t),n&&Me(e,n)}(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=Object(Se.a)("canvas",{class:"sigma-".concat(e),style:{position:"absolute"}});this.elements[e]=n,this.container.appendChild(n);var r,i={preserveDrawingBuffer:!1,antialias:!1};return t?((r=n.getContext("webgl2",i))||(r=n.getContext("webgl",i)),r||(r=n.getContext("experimental-webgl",i))):r=n.getContext("2d",i),this.contexts[e]=r,this}},{key:"initializeCache",value:function(){for(var e=this.graph,t=e.nodes(),n=0,r=t.length;n<r;n++)this.nodeDataCache[t[n]]=new R(n,this.settings);for(var i=e.edges(),o=0,a=i.length;o<a;o++)this.edgeDataCache[i[o]]=new N(o,this.settings)}},{key:"bindCameraHandlers",value:function(){var e=this;return this.listeners.camera=function(){e.scheduleRender()},this.camera.on("updated",this.listeners.camera),this}},{key:"bindEventHandlers",value:function(){var e=this;this.listeners.handleResize=function(){e.needToSoftProcess=!0,e.scheduleRender()},window.addEventListener("resize",this.listeners.handleResize);var t=function(e,t,n,r,i){return e>n-i&&e<n+i&&t>r-i&&t<r+i&&Math.sqrt(Math.pow(e-n,2)+Math.pow(t-r,2))<i},n=function(t,n){var r=e.camera.viewportToGraph(e,t,n);return e.quadtree.point(r.x,1-r.y)};return this.listeners.handleMove=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=1/0,s=null,c=0,u=o.length;c<u;c++){var h=o[c],l=e.nodeDataCache[h],f=e.camera.graphToViewport(e,l.x,l.y),d=l.size/i;if(t(r.x,r.y,f.x,f.y,d)){var p=Math.sqrt(Math.pow(r.x-f.x,2)+Math.pow(r.y-f.y,2));p<a&&(a=p,s=h)}}if(s&&e.hoveredNode!==s)return e.hoveredNode=s,e.emit("enterNode",{node:s}),e.scheduleHighlightedNodesRender();if(e.hoveredNode){var v=e.nodeDataCache[e.hoveredNode],m=e.camera.graphToViewport(e,v.x,v.y),g=v.size/i;if(!t(r.x,r.y,m.x,m.y,g)){var y=e.hoveredNode;return e.hoveredNode=null,e.emit("leaveNode",{node:y}),e.scheduleHighlightedNodesRender()}}},this.listeners.handleClick=function(r){for(var i=Math.pow(e.camera.getState().ratio,.5),o=n(r.x,r.y),a=0,s=o.length;a<s;a++){var c=o[a],u=e.nodeDataCache[c],h=e.camera.graphToViewport(e,u.x,u.y),l=u.size/i;if(t(r.x,r.y,h.x,h.y,l))return e.emit("clickNode",{node:c})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.graph;return this.listeners.graphUpdate=function(){e.needToProcess=!0,e.scheduleRender()},this.listeners.softGraphUpdate=function(){e.needToSoftProcess=!0,e.scheduleRender()},this.listeners.addNodeGraphUpdate=function(n){e.nodeDataCache[n.key]=new R(t.order-1,e.settings),e.listeners.graphUpdate()},this.listeners.addEdgeGraphUpdate=function(n){e.edgeDataCache[n.key]=new N(t.size-1,e.settings),e.listeners.graphUpdate()},t.on("nodeAdded",this.listeners.addNodeGraphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("nodeAttributesUpdated",this.listeners.softGraphUpdate),t.on("edgeAdded",this.listeners.addEdgeGraphUpdate),t.on("nodeDropped",this.listeners.graphUpdate),t.on("edgeAttributesUpdated",this.listeners.softGraphUpdate),t.on("cleared",this.listeners.graphUpdate),this}},{key:"process",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.graph,n=this.settings;this.quadtree.clear();var r=["x","y"];this.settings.zIndex&&(r.push("z"),this.edgeExtent=Object(O.edgeExtent)(t,["z"])),this.nodeExtent=Object(O.nodeExtent)(t,r),this.normalizationFunction=Object(Se.b)(this.nodeExtent);var i=this.nodePrograms.def;e||i.allocate(t.order);var o=t.nodes();this.settings.zIndex&&(o=ke(this.edgeExtent.z,function(e){return t.getNodeAttribute(e,"z")},o));for(var a=0,s=o.length;a<s;a++){var c=o[a],u=t.getNodeAttributes(c),h=this.nodeDataCache[c];n.nodeReducer&&(u=n.nodeReducer(c,u)),h.assign(u),this.normalizationFunction.applyTo(h),this.quadtree.add(c,h.x,1-h.y,h.size/this.width),i.process(h,a),h.index=a}i.bufferData();var l=this.edgePrograms.def;e||l.allocate(t.size);var f=t.edges();this.settings.zIndex&&(f=ke(this.edgeExtent.z,function(e){return t.getEdgeAttribute(e,"z")},f));for(var d=0,p=f.length;d<p;d++){var v=f[d],m=t.getEdgeAttributes(v),g=this.edgeDataCache[v];n.edgeReducer&&(m=n.edgeReducer(v,m)),g.assign(m);var y=t.extremities(v),b=this.nodeDataCache[y[0]],w=this.nodeDataCache[y[1]];l.process(b,w,g,d),g.index=d}return e||"function"!=typeof l.computeIndices||l.computeIndices(),l.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,n=this.graph.getNodeAttributes(e);return t.process(n,this.nodeDataCache[e].index),this}},{key:"processEdge",value:function(e){var t=this.graph,n=this.edgePrograms.def,r=t.getEdgeAttributes(e),i=t.extremities(e),o=t.getNodeAttributes(i[0]),a=t.getNodeAttributes(i[1]);return n.process(o,a,r,this.edgeDataCache[e].index),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var n=this.width,r=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),0===this.width)throw new Error("sigma/renderers/webgl: container has no width.");if(0===this.height)throw new Error("sigma/renderers/webgl: container has no height.");if(n===this.width&&r===this.height)return this;for(var i in this.elements){var o=this.elements[i];o.style.width=this.width+"px",o.style.height=this.height+"px"}for(var a in this.contexts){var s=this.contexts[a];s.scale?(this.elements[a].setAttribute("width",this.width*Ne+"px"),this.elements[a].setAttribute("height",this.height*Ne+"px"),1!==Ne&&s.scale(Ne,Ne)):(this.elements[a].setAttribute("width",this.width*Fe+"px"),this.elements[a].setAttribute("height",this.height*Fe+"px")),s.viewport&&s.viewport(0,0,this.width*Fe,this.height*Fe)}return this}},{key:"clear",value:function(){return this.contexts.labels.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){if(this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1),!this.graph.order)return this;var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t,n=this.camera.getState(),r=J(n,{width:this.width,height:this.height});if(this.nodePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,scalingRatio:Fe}),this.settings.hideEdgesOnMove&&e||this.edgePrograms.def.render({matrix:r,width:this.width,height:this.height,ratio:n.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:Fe}),this.settings.hideLabelsOnMove&&e)return this;if(n.ratio>=1)t=this.graph.nodes();else{var i=this.camera.viewRectangle(this);t=this.quadtree.rectangle(i.x1,1-i.y1,i.x2,1-i.y2,i.height)}if(!this.settings.renderLabels)return this;for(var o=function(e){var t=e.cache,n=e.camera,r=e.displayedLabels,i=e.visibleNodes,o=e.dimensions,a=e.graph,s=n.getState(),c=n.getPreviousState(),h=new u.a;h.setState(c);var l=s.x===c.x&&s.y===c.y&&s.ratio===c.ratio,f=s.ratio<c.ratio,d=s.x!==c.x||s.y!==c.y,p=s.ratio>c.ratio,v=!f&&!p&&s.ratio>=1,m=d&&r.size&&!f&&!p;if(p&&Math.trunc(100*s.ratio)%5!=0)return Array.from(r);if((v||l)&&0!==r.size)return Array.from(r);if(f&&s.ratio>=1)return Array.from(r);for(var g=s.ratio>=1.3?Le:Ae,y=o.width%g.width,b=g.width+y/Math.floor(o.width/g.width),w=o.height%g.height,x=g.height+w/Math.floor(o.height/g.height),_=o.width+b,E=o.height+x,T=-b,S=-x,A=o.width+b/2,L=o.height+x/2,O=-b/2,k=-x/2,P=[],M={},C=-1/0,j=null,R=0,N=i.length;R<N;R++){var F=i[R],D=t[F],z=n.graphToViewport(o,D.x,D.y);if(!(z.x<T||z.x>_||z.y<S||z.y>E)){if(D.size>C&&(C=D.size,j=F),m){var I=h.graphToViewport(o,D.x,D.y);if(I.x>=O&&I.x<=A&&I.y>=k&&I.y<=L&&!r.has(F))continue}var U=Math.floor(z.x/b),G=Math.floor(z.y/x),Y="".concat(U,"§").concat(G);if(void 0===M[Y])M[Y]=F;else{var H=M[Y],V=t[H];if(r.size>0){var B=r.has(F),X=r.has(H);if(!B&&X)continue;if(B&&!X){M[Y]=F;continue}if((m||f)&&B&&X){P.push(F);continue}}var q=!1;if(D.size>V.size)q=!0;else if(D.size===V.size){var W=a.degree(F),K=a.degree(H);W>K?q=!0:W===K&&F>H&&(q=!0)}q&&(M[Y]=F)}}}var $=P.some(function(e){return e===j});for(var Q in M){var Z=M[Q];Z===j&&($=!0),P.push(Z)}!$&&j&&P.push(j);for(var J=new Set,ee=0,te=P.length;ee<te;ee++){var ne=P[ee],re=t[ne],ie=n.graphToViewport(o,re.x,re.y);if(!J.has(ne))for(var oe=ee+1;oe<te;oe++){var ae=P[oe],se=t[ae],ce=n.graphToViewport(o,se.x,se.y);Oe(ie.x,ie.y,8*re.label.length,14,ce.x,ce.y,8*se.label.length,14)&&(re.size<se.size?J.add(ne):J.add(ae))}}return P.filter(function(e){return!J.has(e)})}({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,visibleNodes:t,dimensions:this,graph:this.graph}),a=this.contexts.labels,s=Math.pow(n.ratio,.5),c=0,h=o.length;c<h;c++){var l=this.nodeDataCache[o[c]],f=this.camera.graphToViewport(this,l.x,l.y),d=f.x,p=f.y,v=l.size/s;xe(a,{label:l.label,size:v,x:d,y:p},this.settings)}return this.displayedLabels=new Set(o),this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,n=Math.pow(t.getState().ratio,.5),r=this.contexts.hovers;r.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToViewport(e,o.x,o.y),s=a.x,c=a.y,u=o.size/n;Ee(r,{label:o.label,color:o.color,size:u,x:s,y:c},e.settings)};this.hoveredNode&&i(this.hoveredNode),this.highlightedNodes.forEach(i)}},{key:"scheduleRender",value:function(){var e=this;if(this.renderFrame)return this;this.renderFrame=requestAnimationFrame(function(){(e.needToProcess||e.needToSoftProcess)&&e.process(e.needToSoftProcess),e.renderFrame=null,e.needToProcess=!1,e.needToSoftProcess=!1,e.render()})}},{key:"scheduleHighlightedNodesRender",value:function(){var e=this;if(this.renderHighlightedNodesFrame||this.renderFrame)return this;this.renderHighlightedNodesFrame=requestAnimationFrame(function(){e.renderHighlightedNodesFrame=null,e.renderHighlightedNodes()})}},{key:"refresh",value:function(){return this.needToSoftProcess=!0,this.scheduleRender(),this}},{key:"highlightNode",value:function(e){return this.highlightedNodes.add(e),this.scheduleHighlightedNodesRender(),this}},{key:"unhighlightNode",value:function(e){return this.highlightedNodes.delete(e),this.scheduleHighlightedNodesRender(),this}},{key:"kill",value:function(){var e=this.graph;this.camera.removeListener("updated",this.listeners.camera),window.removeEventListener("resize",this.listeners.handleResize),this.captors.mouse.kill(),e.removeListener("nodeAdded",this.listeners.addNodeGraphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("nodeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("edgeAdded",this.listeners.addEdgeGraphUpdate),e.removeListener("nodeDropped",this.listeners.graphUpdate),e.removeListener("edgeAttributesUpdated",this.listeners.softGraphUpdate),e.removeListener("cleared",this.listeners.graphUpdate),this.quadtree=null,this.nodeDataCache=null,this.edgeDataCache=null,this.highlightedNodes=null,this.previousVisibleNodes=null,this.displayedLabels=null,this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null),this.renderHighlightedNodesFrame&&(cancelAnimationFrame(this.renderHighlightedNodesFrame),this.renderHighlightedNodesFrame=null);for(var t=this.container;t.firstChild;)t.removeChild(t.firstChild)}}]),t}();n.d(t,"Renderer",function(){return c}),n.d(t,"Camera",function(){return u.a}),n.d(t,"QuadTree",function(){return A}),n.d(t,"MouseCaptor",function(){return L.a}),n.d(t,"WebGLRenderer",function(){return ze})}])}); |
{ | ||
"name": "sigma", | ||
"version": "2.0.0-alpha20", | ||
"version": "2.0.0-alpha21", | ||
"description": "A JavaScript library dedicated to graph drawing.", | ||
@@ -65,2 +65,3 @@ "homepage": "http://sigmajs.org", | ||
"mocha": "^5.0.5", | ||
"pandemonium": "^1.4.1", | ||
"raw-loader": "^0.5.1", | ||
@@ -67,0 +68,0 @@ "rimraf": "^2.6.1", |
@@ -422,3 +422,18 @@ "use strict"; | ||
_this4.scheduleRender(); | ||
}; // TODO: bind this on composed state events | ||
}; | ||
this.listeners.addNodeGraphUpdate = function (e) { | ||
// Adding entry to cache | ||
_this4.nodeDataCache[e.key] = new _displayData2.NodeDisplayData(graph.order - 1, _this4.settings); | ||
_this4.listeners.graphUpdate(); | ||
}; | ||
this.listeners.addEdgeGraphUpdate = function (e) { | ||
// Adding entry to cache | ||
_this4.edgeDataCache[e.key] = new _displayData2.EdgeDisplayData(graph.size - 1, _this4.settings); | ||
_this4.listeners.graphUpdate(); | ||
}; // TODO: clean cache on drop! | ||
// TODO: bind this on composed state events | ||
// TODO: it could be possible to update only specific node etc. by holding | ||
@@ -428,6 +443,6 @@ // a fixed-size pool of updated items | ||
graph.on('nodeAdded', this.listeners.graphUpdate); | ||
graph.on('nodeAdded', this.listeners.addNodeGraphUpdate); | ||
graph.on('nodeDropped', this.listeners.graphUpdate); | ||
graph.on('nodeAttributesUpdated', this.listeners.softGraphUpdate); | ||
graph.on('edgeAdded', this.listeners.graphUpdate); | ||
graph.on('edgeAdded', this.listeners.addEdgeGraphUpdate); | ||
graph.on('nodeDropped', this.listeners.graphUpdate); | ||
@@ -909,6 +924,6 @@ graph.on('edgeAttributesUpdated', this.listeners.softGraphUpdate); | ||
graph.removeListener('nodeAdded', this.listeners.graphUpdate); | ||
graph.removeListener('nodeAdded', this.listeners.addNodeGraphUpdate); | ||
graph.removeListener('nodeDropped', this.listeners.graphUpdate); | ||
graph.removeListener('nodeAttributesUpdated', this.listeners.softGraphUpdate); | ||
graph.removeListener('edgeAdded', this.listeners.graphUpdate); | ||
graph.removeListener('edgeAdded', this.listeners.addEdgeGraphUpdate); | ||
graph.removeListener('nodeDropped', this.listeners.graphUpdate); | ||
@@ -915,0 +930,0 @@ graph.removeListener('edgeAttributesUpdated', this.listeners.softGraphUpdate); |
@@ -79,3 +79,3 @@ "use strict"; | ||
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
gl.vertexAttribPointer(_this.colorLocation, 4, gl.UNSIGNED_BYTE, true, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
gl.vertexAttribPointer(_this.coordLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 12); | ||
@@ -82,0 +82,0 @@ return _this; |
@@ -33,3 +33,3 @@ "use strict"; | ||
gl.deleteShader(shader); | ||
throw new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n".concat(infoLog, "\n").concat(source)); | ||
throw new Error("sigma/renderers/webgl/shaders/utils.loadShader: error while compiling the shader:\n".concat(infoLog, "\n").concat(source)); | ||
} | ||
@@ -62,3 +62,3 @@ | ||
gl.deleteProgram(program); | ||
throw new Error('sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.'); | ||
throw new Error('sigma/renderers/webgl/shaders/utils.loadProgram: error while linking the program.'); | ||
} | ||
@@ -65,0 +65,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
823513
3837
0
29