Comparing version 2.0.0-alpha8 to 2.0.0-alpha9
@@ -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()}("undefined"!=typeof self?self:this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var i=r[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=function(e){function t(){return n(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function n(e){return"function"==typeof e}function i(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!i(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,i,s,h,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var u=new Error('Uncaught, unspecified "error" event. ('+t+")");throw u.context=t,u}if(r=this._events[e],a(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),l=r.slice(),i=l.length,h=0;h<i;h++)l[h].apply(this,s);return!0},r.prototype.addListener=function(e,t){var i;if(!n(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,n(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(i=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&i>0&&this._events[e].length>i&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),i||(i=!0,t.apply(this,arguments))}if(!n(t))throw TypeError("listener must be a function");var i=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,i,a,s;if(!n(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,i=-1,r===t||n(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(s=a;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){i=s;break}if(i<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;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=this._events[e],n(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?n(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(n(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function n(e){if(void 0!==s[e])return s[e];var t=0,r=0,n=0;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),r=parseInt(e.charAt(2)+e.charAt(2),16),n=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(4),16),n=parseInt(e.charAt(5)+e.charAt(6),16));else if(h.test(e)){var i=e.match(l);t=+i[1],r=+i[2],n=+i[3]}var o=256*t*256+256*r+n;return s[e]=o,o}function i(e,t){var r=e.angle,n=e.ratio,i=e.x,o=e.y,s=t.width,h=t.height,l=(0,a.identity)(),u=(0,a.scale)((0,a.identity)(),1/n),c=(0,a.rotate)((0,a.identity)(),-r),f=(0,a.translate)((0,a.identity)(),-i,-o),d=(0,a.translate)((0,a.identity)(),s/2,h/2);return(0,a.multiply)(l,u),(0,a.multiply)(l,c),(0,a.multiply)(l,f),l=(0,a.multiply)(d,l)}function o(e,t,r,n){var i=n||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,i),i}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=n,t.matrixFromCamera=i,t.extractPixel=o;var a=r(19),s={},h=/^\s*rgba?\s*\(/,l=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(1),h=r(13),l=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(h),u=r(4),c={easing:"quadraticInOut",duration:150},f=function(e){function t(e){n(this,t),e=e||{};var r=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.x=0,r.y=0,r.angle=0,r.ratio=1,r.width=e.width||0,r.height=e.height||0,r.nextFrame=null,r.enabled=!0,r}return o(t,e),a(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:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"abstractDisplayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle);return{x:(e*r-t*n)*this.ratio,y:(t*r+e*n)*this.ratio}}},{key:"displayToGraph",value:function(e,t){var r=Math.cos(this.angle),n=Math.sin(this.angle),i=this.width/2-(this.x*r+this.y*n)/this.ratio,o=this.height/2-(this.y*r-this.x*n)/this.ratio,a=e-i,s=t-o;return{x:(a*r-s*n)*this.ratio,y:(s*r+a*n)*this.ratio}}},{key:"graphToDisplay",value:function(e,t){var r=Math.cos(this.angle)/this.ratio,n=Math.sin(this.angle)/this.ratio;return{x:e*r+t*n+(this.width/2-this.x*r-this.y*n),y:t*r-e*n+(this.height/2-this.y*r+this.x*n)}}},{key:"viewRectangle",value:function(){var e=this.abstractDisplayToGraph(this.width,0),t=this.abstractDisplayToGraph(0,this.height),r=this.abstractDisplayToGraph(this.width/2,this.height/2),n=this.abstractDisplayToGraph(this.width/4,0).x,i=this.abstractDisplayToGraph(0,this.height/4,0).y;return{x1:this.x-r.x-n,y1:this.y-r.y-i,x2:this.x-r.x+n+e.x,y2:this.y-r.y-i+e.y,height:Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y+2*i,2))}}},{key:"setState",value:function(e){return this.enabled?("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:"resize",value:function(e){return this.enabled?("width"in e&&(this.width=e.width),"height"in e&&(this.height=e.height),this.emit("resized",this.getDimensions()),this):this}},{key:"animate",value:function(e,t,r){var n=this;if(!this.enabled)return this;t=(0,u.assign)({},c,t);var i="function"==typeof t.easing?t.easing:l[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var o=Date.now(),a=this.getState(),s=function s(){var h=(Date.now()-o)/t.duration;if(h>=1)return n.nextFrame=null,n.setState(e),void("function"==typeof r&&r());var l=i(h),u={};"x"in e&&(u.x=a.x+(e.x-a.x)*l),"y"in e&&(u.y=a.y+(e.y-a.y)*l),"angle"in e&&(u.angle=a.angle+(e.angle-a.angle)*l),"ratio"in e&&(u.ratio=a.ratio+(e.ratio-a.ratio)*l),n.setState(u),n.nextFrame=requestAnimationFrame(s)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(s)):s()}},{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:0,y:0,ratio:1,angle:0},e)}}]),t}(s.EventEmitter);t.default=f},function(e,t,r){"use strict";function n(e){e=e||{};for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];for(var i=0,o=r.length;i<o;i++)if(r[i])for(var a in r[i])e[a]=r[i][a];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=n},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t,r,n){return e===r||t===n}function o(e,t,r,n,i,o,a){return e<n+o&&e+r>n&&t<i+a&&t+r>i}function a(e,t,r,n,i,o,a,s){return e<i+a&&e+r>i&&t<o+s&&t+n>o}function s(e,t,r,n,i,o){var a=r+i/2,s=n+o/2,h=t<s,l=e<a;return h?l?y:b:l?_:x}function h(e,t){for(var r=[0,0];r.length;){var n=r.pop(),i=r.pop(),o=4*i+f,a=4*i+2*f,s=4*i+3*f,h=4*i+4*f,l=t[i+v],u=t[i+g],c=t[i+p],d=t[i+m],y=c/2,b=d/2;t[o+v]=l,t[o+g]=u,t[o+p]=y,t[o+m]=b,t[a+v]=l+y,t[a+g]=u,t[a+p]=y,t[a+m]=b,t[s+v]=l,t[s+g]=u+b,t[s+p]=y,t[s+m]=b,t[h+v]=l+y,t[h+g]=u+b,t[h+p]=y,t[h+m]=b,n<e-1&&(r.push(h,n+1),r.push(s,n+1),r.push(a,n+1),r.push(o,n+1))}}function l(e,t,r,n,i,a,s){for(var h=i-s,l=a-s,u=2*s,c=0,d=0;;){if(c>=e)return r[d]=r[d]||[],void r[d].push(n);var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=o(h,l,u,t[y+v],t[y+g],t[y+p],t[y+m]),E=o(h,l,u,t[b+v],t[b+g],t[b+p],t[b+m]),O=o(h,l,u,t[_+v],t[_+g],t[_+p],t[_+m]),P=o(h,l,u,t[x+v],t[x+g],t[x+p],t[x+m]),A=w+E+O+P;if(0===A)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(3===A)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+n+", x: "+i+", y: "+a+", size: "+s+").");if(A>1)return r[d]=r[d]||[],void r[d].push(n);c++,w&&(d=y),E&&(d=b),O&&(d=_),P&&(d=x)}}function u(e,t,r,n,i,o,s){for(var h=[0,0],l=[],u=void 0;h.length;){var c=h.pop(),d=h.pop();if(u=r[d],u&&l.push.apply(l,u),!(c>=e)){var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=a(n,i,o,s,t[y+v],t[y+g],t[y+p],t[y+m]),E=a(n,i,o,s,t[b+v],t[b+g],t[b+p],t[b+m]),O=a(n,i,o,s,t[_+v],t[_+g],t[_+p],t[_+m]),P=a(n,i,o,s,t[x+v],t[x+g],t[x+p],t[x+m]);w&&h.push(y,c+1),E&&h.push(b,c+1),O&&h.push(_,c+1),P&&h.push(x,c+1)}}return l}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),f=4,d=5,v=0,g=1,p=2,m=3,y=1,b=2,_=3,x=4,w=function(){function e(t){n(this,e),t=t||{};var r=Math.pow(4,d);this.data=new Float32Array(f*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries&&this.resize(t.boundaries),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,n){return l(d,this.data,this.containers,e,t,r,n),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[g]=e.y,this.data[p]=e.width,this.data[m]=e.height,h(d,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var r=[],n=0,i=0;do{this.containers[n]&&r.push.apply(r,this.containers[n]);n=4*n+s(e,t,this.data[n+v],this.data[n+g],this.data[n+p],this.data[n+m])*f,i++}while(i<=d);return r}},{key:"rectangle",value:function(e,t,r,n,o){var a=this.lastRectangle;if(a&&e===a.x1&&r===a.x2&&t===a.y1&&n===a.y2&&o===a.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:r,y2:n,height:o},!i(e,t,r,n))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var s=u(d,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-n),o);return this.cache=s,this.cache}}]),e}();t.default=w},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),s=r(14),h=function(e){return e&&e.__esModule?e:{default:e}}(s),l=r(15),u=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return o.container=e,o.camera=r,o.enabled=!0,o.hasDragged=!1,o.downStartTime=null,o.startMouseX=null,o.startMouseY=null,o.isMouseDown=!1,o.isMoving=!1,o.movingTimeout=null,o.startCameraState=null,o.lastCameraState=null,o.clicks=0,o.doubleClickTimeout=null,o.wheelLock=!1,o.handleClick=o.handleClick.bind(o),o.handleDown=o.handleDown.bind(o),o.handleUp=o.handleUp.bind(o),o.handleMove=o.handleMove.bind(o),o.handleWheel=o.handleWheel.bind(o),o.handleOut=o.handleOut.bind(o),e.addEventListener("click",o.handleClick,!1),e.addEventListener("mousedown",o.handleDown,!1),e.addEventListener("mousemove",o.handleMove,!1),e.addEventListener("DOMMouseScroll",o.handleWheel,!1),e.addEventListener("mousewheel",o.handleWheel,!1),e.addEventListener("mouseout",o.handleOut,!1),document.addEventListener("mouseup",o.handleUp,!1),o}return o(t,e),a(t,[{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(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.emit("click",(0,l.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,l.getCenter)(e),r=this.camera.getState(),n=this.camera.abstractDisplayToGraph((0,l.getX)(e)-t.x,(0,l.getY)(e)-t.y);return this.camera.animate({x:n.x*(1-1/2.2)+r.x,y:n.y*(1-1/2.2)+r.y,ratio:1/2.2*r.ratio},{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.startMouseX=(0,l.getX)(e),this.startMouseY=(0,l.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,l.getMouseCoords)(e)))}},{key:"handleUp",value:function(e){if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var t=(0,l.getX)(e),r=(0,l.getY)(e),n=this.camera.getState();this.isMoving?this.camera.animate({x:n.x+3*(n.x-this.lastCameraState.x),y:n.y+3*(n.y-this.lastCameraState.y)},{duration:200,easing:"quadraticOut"}):this.startMouseX===t&&this.startMouseY===r||this.camera.setState({x:n.x,y:n.y}),this.isMoving=!1,this.hasDragged=!1,this.emit("mouseup",(0,l.getMouseCoords)(e))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,l.getMouseCoords)(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 r=this.camera.abstractDisplayToGraph((0,l.getX)(e)-this.startMouseX,(0,l.getY)(e)-this.startMouseY),n=this.startCameraState.x-r.x,i=this.startCameraState.y-r.y,o=this.camera.getState();o.x===n&&o.y===i||(this.lastCameraState=o,this.camera.setState({x:n,y: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 r=(0,l.getWheelDelta)(e);if(!r)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var n=r>0?1/1.7:1.7,i=this.camera.getState(),o=n*i.ratio,a=(0,l.getCenter)(e),s=this.camera.abstractDisplayToGraph((0,l.getX)(e)-a.x,(0,l.getY)(e)-a.y);return this.camera.animate({x:s.x*(1-n)+i.x,y:s.y*(1-n)+i.y,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(h.default);t.default=u},function(e,t,r){"use strict";function n(e,t){var r=document.createElement(e);if(!t)return r;for(var n in t)if("style"===n)for(var i in t[n])r.style[i]=t[n][i];else r.setAttribute(n,t[n]);return r}function i(){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 o(e,t){e=e||{};var r=e.mode||a.mode,n=e.height||1,i=e.width||1,o=t.maxX,s=t.maxY,h=t.minX,l=t.minY,u=(o+h)/2,c=(s+l)/2,f="outside"===r?Math.max(i/Math.max(o-h,1),n/Math.max(s-l,1)):Math.min(i/Math.max(o-h,1),n/Math.max(s-l,1)),d=function(e){return{x:(e.x-u)*f,y:(e.y-c)*f}};return d.inverse=function(e){return{x:e.x/f+u,y:e.y/f+c}},d}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=n,t.getPixelRatio=i,t.createRescalingFunction=o;var a={mode:"inside",margin:0}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),o=r(18),a=function(){function e(t,r,i){n(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=i,this.load(t)}return i(e,[{key:"load",value:function(e){return this.vertexShader=(0,o.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,o.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,o.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=a},function(e,t,r){"use strict";function n(e,t){e.fillStyle="#000",e.font="14px arial",e.fillText(t.label,t.x+t.size+3,t.y+14/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var i=r(11),o=n(i),a=r(0),s=n(a),h=r(3),l=n(h),u=r(5),c=n(u),f=r(6),d=n(f),v=r(16),g=n(v),p={Sigma:o.default,Renderer:s.default,Camera:l.default,QuadTree:c.default,MouseCaptor:d.default,WebGLRenderer:g.default};for(var m in p)o.default[m]=p[m];e.exports=o.default},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),a=r(12),s=n(a),h=r(0),l=n(h),u=function(){function e(t,r){if(i(this,e),!(0,s.default)(t))throw new Error("Sigma.constructor: given graph is not an instance of a graphology implementation.");if(!(r instanceof l.default))throw new Error("Sigma.constructor: given renderer is not an instance of a sigma Renderer.");this.graph=t,this.renderer=r,this.renderer.bind(this),this.state={},this.nodeStates=null,this.edgeStates=null,this.renderer.render()}return o(e,[{key:"getGraph",value:function(){return this.graph}},{key:"getNodeData",value:function(e){return this.graph.getNodeAttributes(e)}},{key:"getEdgeData",value:function(e){return this.graph.getEdgeAttributes(e)}},{key:"getGraphExtent",value:function(){for(var e=this.graph,t=e.nodes(),r=e.edges(),n=-1/0,i=-1/0,o=1/0,a=1/0,s=-1/0,h=-1/0,l=0,u=t.length;l<u;l++){var c=t[l],f=this.getNodeData(c),d=f.size||1;f.x>n&&(n=f.x),f.y>i&&(i=f.y),f.x<o&&(o=f.x),f.y<a&&(a=f.y),d>s&&(s=d)}for(var v=0,g=r.length;v<g;v++){var p=r[v],m=this.getEdgeData(p),y=m.size||1;y>h&&(h=y)}return{maxX:n,maxY:i,minX:o,minY:a,maxNodeSize:s,maxEdgeSize:h}}}]),e}();t.default=u},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNodes&&"boolean"==typeof e.multi}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.linear=function(e){return e},t.quadraticIn=function(e){return e*e},t.quadraticOut=function(e){return e*(2-e)},t.quadraticInOut=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},t.cubicIn=function(e){return e*e*e},t.cubicOut=function(e){return--e*e*e+1},t.cubicInOut=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},function(e,t,r){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=function(e){function t(e,r){n(this,t);var o=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.container=e,o.camera=r,o}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";function n(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 i(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 o(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.")}function a(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.")}function s(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:(0,u.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function h(e){return{x:n(e),y:i(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function l(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.")}Object.defineProperty(t,"__esModule",{value:!0}),t.getX=n,t.getY=i,t.getWidth=o,t.getHeight=a,t.getCenter=s,t.getMouseCoords=h,t.getWheelDelta=l;var u=r(7)},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(0),l=n(h),u=r(3),c=n(u),f=r(6),d=n(f),v=r(5),g=n(v),p=r(17),m=n(p),y=r(22),b=n(y),_=r(9),x=n(_),w=r(25),E=n(w),O=r(4),P=r(7),A=r(2),M=(0,P.getPixelRatio)(),T=(0,P.getPixelRatio)(),L={hideEdgesOnMove:!1,hideLabelsOnMove:!1},k=function(e){function t(e,r){i(this,t);var n=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r=r||{},n.settings=(0,O.assign)({},L,r),!(e instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");n.sigma=null,n.captors={},n.container=e,n.elements={},n.contexts={},n.listeners={},n.quadtree=new g.default,n.nodeOrder={},n.nodeDataCache={},n.edgeOrder={},n.rescalingFunction=null,n.width=0,n.height=0,n.highlightedNodes=new Set,n.hoveredNode=null,n.wasRenderedInThisFrame=!1,n.renderFrame=null,n.renderHighlightedNodesFrame=null,n.needToProcess=!1,n.needToSoftProcess=!1,n.createContext("edges"),n.createContext("nodes"),n.createContext("labels",!1),n.createContext("hovers",!1),n.createContext("mouse",!1);var a=n.contexts.nodes;return a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),a=n.contexts.edges,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),n.nodePrograms={def:new m.default(n.contexts.nodes)},n.edgePrograms={def:new b.default(n.contexts.edges)},n.resize(),n.camera=new c.default({width:n.width,height:n.height}),n.bindCameraHandlers(),n.captors={mouse:new d.default(n.elements.mouse,n.camera)},n.bindEventHandlers(),n}return a(t,e),s(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,P.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var n={preserveDrawingBuffer:!0,antialias:!1},i=void 0;return t?(i=r.getContext("webgl",n))||(i=r.getContext("experimental-webgl",n)):i=r.getContext("2d",n),this.contexts[e]=i,this}},{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,r,n,i){return e>r-i&&e<r+i&&t>n-i&&t<n+i&&Math.sqrt(Math.pow(e-r,2)+Math.pow(t-n,2))<i},r=function(t,r){var n=e.camera.displayToGraph(t,r);return e.quadtree.point(n.x,n.y)};return this.listeners.handleMove=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/i;if(t(n.x,n.y,u.x,u.y,c))return e.hoveredNode=h,e.emit("overNode",{node:h}),e.scheduleHighlightedNodesRender()}if(e.hoveredNode){var f=e.nodeDataCache[e.hoveredNode],d=e.camera.graphToDisplay(f.x,f.y),v=f.size/i;if(!t(n.x,n.y,d.x,d.y,v))return e.hoveredNode=null,e.emit("outNode",{node:e.hoveredNode}),e.scheduleHighlightedNodesRender()}},this.listeners.handleDown=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/i;if(t(n.x,n.y,u.x,u.y,c))return e.emit("downNode",{node:h})}},this.listeners.handleClick=function(n){for(var i=Math.pow(e.camera.getState().ratio,.5),o=r(n.x,n.y),a=0,s=o.length;a<s;a++){var h=o[a],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/i;if(t(n.x,n.y,u.x,u.y,c))return e.emit("clickNode",{node:h})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("mousedown",this.listeners.handleDown),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.sigma.getGraph();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.sigma.getGraph(),r=this.sigma.getGraphExtent();this.rescalingFunction=(0,P.createRescalingFunction)({width:this.width,height:this.height},r);var n=this.rescalingFunction({x:r.minX,y:r.minY}),i=this.rescalingFunction({x:r.maxX,y:r.maxY});this.quadtree.resize({x:n.x,y:n.y,width:i.x-n.x,height:i.y-n.y});var o=this.nodePrograms.def;e||(o.allocate(t.order),this.nodeOrder={});for(var a=t.nodes(),s=0,h=a.length;s<h;s++){var l=a[s];this.nodeOrder[l]=s;var u=this.sigma.getNodeData(l),c=this.rescalingFunction(u),f=(0,O.assign)({},u,c);this.quadtree.add(l,f.x,f.y,f.size),this.nodeDataCache[l]=f,o.process(f,s)}o.bufferData();var d=this.edgePrograms.def;e||(d.allocate(t.size),this.edgeOrder={});for(var v=t.edges(),g=0,p=v.length;g<p;g++){var m=v[g];this.edgeOrder[m]=g;var y=this.sigma.getEdgeData(m),b=t.extremities(m),_=this.nodeDataCache[b[0]],x=this.nodeDataCache[b[1]];d.process(_,x,y,g)}return e||"function"!=typeof d.computeIndices||(this.edgeIndicesArray=d.computeIndices()),d.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.sigma.getNodeData(e);return t.process(r,this.nodeOrder[e]),this}},{key:"processEdge",value:function(e){var t=this.sigma.getGraph(),r=this.edgePrograms.def,n=this.sigma.getEdgeData(e),i=t.extremities(e),o=this.sigma.getNodeData(i[0]),a=this.sigma.getNodeData(i[1]);return r.process(o,a,n,this.edgeOrder[e]),this}},{key:"bind",value:function(e){return this.sigma=e,this.bindGraphHandlers(),this.process(),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var r=this.width,n=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),r===this.width&&n===this.height)return this;this.camera&&this.camera.resize({width:this.width,height:this.height});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*M+"px"),this.elements[a].setAttribute("height",this.height*M+"px"),1!==M&&s.scale(M,M)):(this.elements[a].setAttribute("width",this.width*T+"px"),this.elements[a].setAttribute("height",this.height*T+"px")),s.viewport&&s.viewport(0,0,this.width*T,this.height*T)}return this}},{key:"clear",value:function(){var e=this.contexts.nodes;return e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.edges,e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.labels,e.clearRect(0,0,this.width,this.height),e=this.contexts.hovers,e.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1);var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t=this.camera.getState(),r=(0,A.matrixFromCamera)(t,{width:this.width,height:this.height}),n=void 0;if(n=this.nodePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,scalingRatio:T}),this.settings.hideEdgesOnMove&&e||(n=this.edgePrograms.def,n.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,edgesPowRatio:.5,scalingRatio:T})),this.settings.hideLabelsOnMove&&e)return this;var i=void 0;if(t.ratio>=1)i=this.sigma.getGraph().nodes();else{var o=this.camera.viewRectangle();i=this.quadtree.rectangle(o.x1,o.y1,o.x2,o.y2,o.height)}for(var a=this.contexts.labels,s=Math.pow(t.ratio,.5),h=0,l=i.length;h<l;h++){var u=this.nodeDataCache[i[h]],c=this.camera.graphToDisplay(u.x,u.y),f=c.x,d=c.y,v=u.size/s;v<8||(0,x.default)(a,{label:u.label,size:v,x:f,y:d})}return this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,r=Math.pow(t.getState().ratio,.5),n=this.contexts.hovers;n.clearRect(0,0,this.width,this.height);var i=function(i){var o=e.nodeDataCache[i],a=t.graphToDisplay(o.x,o.y),s=a.x,h=a.y,l=o.size/r;(0,E.default)(n,{label:o.label,color:o.color,size:l,x:s,y:h})};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:"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}}]),t}(l.default);t.default=k},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(8),l=n(h),u=r(2),c=r(20),f=n(c),d=r(21),v=n(d),g=4,p=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer);var n=r.program;return r.positionLocation=e.getAttribLocation(n,"a_position"),r.sizeLocation=e.getAttribLocation(n,"a_size"),r.colorLocation=e.getAttribLocation(n,"a_color"),r.resolutionLocation=e.getUniformLocation(n,"u_resolution"),r.matrixLocation=e.getUniformLocation(n,"u_matrix"),r.ratioLocation=e.getUniformLocation(n,"u_ratio"),r.scaleLocation=e.getUniformLocation(n,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.sizeLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*g*e)}},{key:"process",value:function(e,t){var r=(0,u.floatColor)(e.color),n=1*t*g,i=this.array;i[n++]=e.x,i[n++]=e.y,i[n++]=e.size,i[n]=r}},{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,r=this.program;t.useProgram(r),t.uniform2f(this.resolutionLocation,e.width,e.height),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/g)}}]),t}(l.default);t.default=p},function(e,t,r){"use strict";function n(e,t,r){var n="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,i=t.createShader(n);if(t.shaderSource(i,r),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"+o+"\n"+r)}return i}function i(e,t){var r=e.createProgram(),n=void 0,i=void 0;for(n=0,i=t.length;n<i;n++)e.attachShader(r,t[n]);if(e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.deleteProgram(r),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return r}Object.defineProperty(t,"__esModule",{value:!0}),t.loadProgram=i;var o=n.bind(null,"VERTEX"),a=n.bind(null,"FRAGMENT");t.loadVertexShader=o,t.loadFragmentShader=a},function(e,t,r){"use strict";function n(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function i(e,t){return e[0]=t,e[4]=t,e}function o(e,t){var r=Math.sin(t),n=Math.cos(t);return e[0]=n,e[1]=r,e[3]=-r,e[4]=n,e}function a(e,t,r){return e[6]=t,e[7]=r,e}function s(e,t){var r=e[0],n=e[1],i=e[2],o=e[3],a=e[4],s=e[5],h=e[6],l=e[7],u=e[8],c=t[0],f=t[1],d=t[2],v=t[3],g=t[4],p=t[5],m=t[6],y=t[7],b=t[8];return e[0]=c*r+f*o+d*h,e[1]=c*n+f*a+d*l,e[2]=c*i+f*s+d*u,e[3]=v*r+g*o+p*h,e[4]=v*n+g*a+p*l,e[5]=v*i+g*s+p*u,e[6]=m*r+y*o+b*h,e[7]=m*n+y*a+b*l,e[8]=m*i+y*s+b*u,e}Object.defineProperty(t,"__esModule",{value:!0}),t.identity=n,t.scale=i,t.rotate=o,t.translate=a,t.multiply=s},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 color;\nvarying float border;\n\nvoid main() {\n\n gl_Position = vec4(\n ((u_matrix * vec3(a_position, 1)).xy /\n u_resolution * 2.0 - 1.0) * vec2(1, -1),\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 border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n float c = a_color;\n color.b = mod(c, 256.0); c = floor(c / 256.0);\n color.g = mod(c, 256.0); c = floor(c / 256.0);\n color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;\n color.a = 1.0;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 color;\nvarying float 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 > border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / border;\n\n gl_FragColor = mix(color0, color, t);\n}\n"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),t}}(),h=r(8),l=n(h),u=r(2),c=r(23),f=n(c),d=r(24),v=n(d),g=6,p=function(e){function t(e){i(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.indicesArray=null,r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer),r.indicesBuffer=e.createBuffer(),e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,r.indicesBuffer),r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.resolutionLocation=e.getUniformLocation(r.program,"u_resolution"),r.ratioLocation=e.getUniformLocation(r.program,"u_ratio"),r.matrixLocation=e.getUniformLocation(r.program,"u_matrix"),r.scaleLocation=e.getUniformLocation(r.program,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.normalLocation),e.enableVertexAttribArray(r.thicknessLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.normalLocation,2,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.thicknessLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,16),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,g*Float32Array.BYTES_PER_ELEMENT,20);var n=e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!n,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(4*g*e)}},{key:"process",value:function(e,t,r,n){if(e.hidden||t.hidden||r.hidden)for(var i=y+4*g;y<i;y++)b[y]=0;var o=r.size||1,a=e.x,s=e.y,h=t.x,l=t.y,c=(0,u.floatColor)(r.color),f=h-a,d=l-s,v=f*f+d*d,p=0,m=0;v&&(v=1/Math.sqrt(v),p=-d*v,m=f*v);var y=4*g*n,b=this.array;b[y++]=a,b[y++]=s,b[y++]=p,b[y++]=m,b[y++]=o,b[y++]=c,b[y++]=a,b[y++]=s,b[y++]=-p,b[y++]=-m,b[y++]=o,b[y++]=c,b[y++]=h,b[y++]=l,b[y++]=p,b[y++]=m,b[y++]=o,b[y++]=c,b[y++]=h,b[y++]=l,b[y++]=-p,b[y++]=-m,b[y++]=o,b[y]=c}},{key:"computeIndices",value:function(){for(var e=this.array.length/g,t=e+e/2,r=new this.IndicesArray(t),n=0,i=0;n<t;n+=4)r[i++]=n,r[i++]=n+1,r[i++]=n+2,r[i++]=n+2,r[i++]=n+1,r[i++]=n+3;this.indicesArray=r}},{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,r=this.program;t.useProgram(r),t.uniform2f(this.resolutionLocation,e.width,e.height),t.uniform1f(this.ratioLocation,e.ratio/Math.pow(e.ratio,e.edgesPowRatio)),t.uniformMatrix3fv(this.matrixLocation,!1,e.matrix),t.uniform1f(this.scaleLocation,e.ratio),t.drawElements(t.TRIANGLES,this.indicesArray.length,this.indicesType,0)}}]),t}(l.default);t.default=p},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float 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 feather = 0.5;\n\nvoid main() {\n\n v_thickness = a_thickness * u_ratio / 2.0 + feather;\n\n // Scale from [[-1 1] [-1 1]] to the container:\n vec2 delta = vec2(a_normal * v_thickness);\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal + vec2(sign(a_normal.x) * feather, sign(a_normal.y) * feather);\n // v_thickness = max(1.0, length(delta) / u_scale);\n v_thickness = max(0.5, v_thickness / u_scale);\n\n // Extract the color:\n float c = a_color;\n v_color.b = mod(c, 256.0); c = floor(c / 256.0);\n v_color.g = mod(c, 256.0); c = floor(c / 256.0);\n v_color.r = mod(c, 256.0); c = floor(c / 256.0); v_color /= 255.0;\n v_color.a = 1.0;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\n// Note: twice the one defined in the vertex shader\nconst float feather = 1.0;\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 + feather / 1.5,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function i(e,t){e.font="14px arial",e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var r=e.measureText(t.label).width,n=Math.round(t.x-7-2),i=Math.round(t.y-7-2),o=Math.round(r+7+t.size+9),s=Math.round(18),l=Math.round(9);e.moveTo(n,i+l),e.moveTo(n,i+l),e.arcTo(n,i,n+l,i,l),e.lineTo(n+o,i),e.lineTo(n+o,i+s),e.lineTo(n+l,i+s),e.arcTo(n,i+s,n,i+s-l,l),e.lineTo(n,i+l),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,h.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var o=r(26),a=n(o),s=r(9),h=n(s)},function(e,t,r){"use strict";function n(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,i,!0),e.closePath(),e.fill()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var i=2*Math.PI}])}); | ||
!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()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(r[i])return r[i].exports;var n=r[i]={i:i,l:!1,exports:{}};return e[i].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,i){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=10)}([function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=function(e){function t(){return i(this,t),n(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(e){return"function"==typeof e}function n(e){return"number"==typeof e}function o(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!n(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,r,n,s,h,u;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(r=this._events[e],a(r))return!1;if(i(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:s=Array.prototype.slice.call(arguments,1),r.apply(this,s)}else if(o(r))for(s=Array.prototype.slice.call(arguments,1),u=r.slice(),n=u.length,h=0;h<n;h++)u[h].apply(this,s);return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(n=a(this._maxListeners)?r.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(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},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function r(){this.removeListener(e,r),n||(n=!0,t.apply(this,arguments))}if(!i(t))throw TypeError("listener must be a function");var n=!1;return r.listener=t,this.on(e,r),this},r.prototype.removeListener=function(e,t){var r,n,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(r=this._events[e],a=r.length,n=-1,r===t||i(r.listener)&&r.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(r)){for(s=a;s-- >0;)if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}if(n<0)return this;1===r.length?(r.length=0,delete this._events[e]):r.splice(n,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,r;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=this._events[e],i(r))this.removeListener(e,r);else if(r)for(;r.length;)this.removeListener(e,r[r.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){return this._events&&this._events[e]?i(this._events[e])?[this._events[e]]:this._events[e].slice():[]},r.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(i(t))return 1;if(t)return t.length}return 0},r.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,r){"use strict";function i(e){if(void 0!==s[e])return s[e];var t=0,r=0,i=0;if("#"===e[0])4===e.length?(t=parseInt(e.charAt(1)+e.charAt(1),16),r=parseInt(e.charAt(2)+e.charAt(2),16),i=parseInt(e.charAt(3)+e.charAt(3),16)):(t=parseInt(e.charAt(1)+e.charAt(2),16),r=parseInt(e.charAt(3)+e.charAt(4),16),i=parseInt(e.charAt(5)+e.charAt(6),16));else if(h.test(e)){var n=e.match(u);t=+n[1],r=+n[2],i=+n[3]}var o=256*t*256+256*r+i;return s[e]=o,o}function n(e,t){var r=e.angle,i=e.ratio,n=e.x,o=e.y,s=t.width,h=t.height,u=(0,a.identity)(),l=(0,a.scale)((0,a.identity)(),1/i),c=(0,a.rotate)((0,a.identity)(),-r),f=(0,a.translate)((0,a.identity)(),-n,-o),d=(0,a.translate)((0,a.identity)(),s/2,h/2);return(0,a.multiply)(u,l),(0,a.multiply)(u,c),(0,a.multiply)(u,f),u=(0,a.multiply)(d,u)}function o(e,t,r,i){var n=i||new Uint8Array(4);return e.readPixels(t,r,1,1,e.RGBA,e.UNSIGNED_BYTE,n),n}Object.defineProperty(t,"__esModule",{value:!0}),t.floatColor=i,t.matrixFromCamera=n,t.extractPixel=o;var a=r(19),s={},h=/^\s*rgba?\s*\(/,u=/^\s*rgba?\s*\(\s*([0-9]*)\s*,\s*([0-9]*)\s*,\s*([0-9]*)\s*(,.*)?\)\s*$/},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(1),h=r(13),u=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}(h),l=r(4),c={easing:"quadraticInOut",duration:150},f=function(e){function t(e){i(this,t),e=e||{};var r=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return r.x=0,r.y=0,r.angle=0,r.ratio=1,r.width=e.width||0,r.height=e.height||0,r.nextFrame=null,r.previousState=r.getState(),r.enabled=!0,r}return o(t,e),a(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:"getDimensions",value:function(){return{width:this.width,height:this.height}}},{key:"isAnimated",value:function(){return!!this.nextFrame}},{key:"abstractDisplayToGraph",value:function(e,t){var r=Math.cos(this.angle),i=Math.sin(this.angle);return{x:(e*r-t*i)*this.ratio,y:(t*r+e*i)*this.ratio}}},{key:"displayToGraph",value:function(e,t){var r=Math.cos(this.angle),i=Math.sin(this.angle),n=this.width/2-(this.x*r+this.y*i)/this.ratio,o=this.height/2-(this.y*r-this.x*i)/this.ratio,a=e-n,s=t-o;return{x:(a*r-s*i)*this.ratio,y:(s*r+a*i)*this.ratio}}},{key:"graphToDisplay",value:function(e,t){var r=Math.cos(this.angle)/this.ratio,i=Math.sin(this.angle)/this.ratio;return{x:e*r+t*i+(this.width/2-this.x*r-this.y*i),y:t*r-e*i+(this.height/2-this.y*r+this.x*i)}}},{key:"viewRectangle",value:function(){var e=this.abstractDisplayToGraph(this.width,0),t=this.abstractDisplayToGraph(0,this.height),r=this.abstractDisplayToGraph(this.width/2,this.height/2),i=this.abstractDisplayToGraph(this.width/4,0).x,n=this.abstractDisplayToGraph(0,this.height/4,0).y;return{x1:this.x-r.x-i,y1:this.y-r.y-n,x2:this.x-r.x+i+e.x,y2:this.y-r.y-n+e.y,height:Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y+2*n,2))}}},{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:"resize",value:function(e){return this.enabled?("width"in e&&(this.width=e.width),"height"in e&&(this.height=e.height),this.emit("resized",this.getDimensions()),this):this}},{key:"animate",value:function(e,t,r){var i=this;if(!this.enabled)return this;t=(0,l.assign)({},c,t);var n="function"==typeof t.easing?t.easing:u[t.easing];this.nextFrame&&cancelAnimationFrame(this.nextFrame);var o=Date.now(),a=this.getState(),s=function s(){var h=(Date.now()-o)/t.duration;if(h>=1)return i.nextFrame=null,i.setState(e),void("function"==typeof r&&r());var u=n(h),l={};"x"in e&&(l.x=a.x+(e.x-a.x)*u),"y"in e&&(l.y=a.y+(e.y-a.y)*u),"angle"in e&&(l.angle=a.angle+(e.angle-a.angle)*u),"ratio"in e&&(l.ratio=a.ratio+(e.ratio-a.ratio)*u),i.setState(l),i.nextFrame=requestAnimationFrame(s)};this.nextFrame?(cancelAnimationFrame(this.nextFrame),this.nextFrame=requestAnimationFrame(s)):s()}},{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:0,y:0,ratio:1,angle:0},e)}}]),t}(s.EventEmitter);t.default=f},function(e,t,r){"use strict";function i(e){e=e||{};for(var t=arguments.length,r=Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];for(var n=0,o=r.length;n<o;n++)if(r[n])for(var a in r[n])e[a]=r[n][a];return e}Object.defineProperty(t,"__esModule",{value:!0}),t.assign=i},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t,r,i){return e===r||t===i}function o(e,t,r,i,n,o,a){return e<i+o&&e+r>i&&t<n+a&&t+r>n}function a(e,t,r,i,n,o,a,s){return e<n+a&&e+r>n&&t<o+s&&t+i>o}function s(e,t,r,i,n,o){var a=r+n/2,s=i+o/2,h=t<s,u=e<a;return h?u?y:b:u?_:x}function h(e,t){for(var r=[0,0];r.length;){var i=r.pop(),n=r.pop(),o=4*n+f,a=4*n+2*f,s=4*n+3*f,h=4*n+4*f,u=t[n+v],l=t[n+p],c=t[n+g],d=t[n+m],y=c/2,b=d/2;t[o+v]=u,t[o+p]=l,t[o+g]=y,t[o+m]=b,t[a+v]=u+y,t[a+p]=l,t[a+g]=y,t[a+m]=b,t[s+v]=u,t[s+p]=l+b,t[s+g]=y,t[s+m]=b,t[h+v]=u+y,t[h+p]=l+b,t[h+g]=y,t[h+m]=b,i<e-1&&(r.push(h,i+1),r.push(s,i+1),r.push(a,i+1),r.push(o,i+1))}}function u(e,t,r,i,n,a,s){for(var h=n-s,u=a-s,l=2*s,c=0,d=0;;){if(c>=e)return r[d]=r[d]||[],void r[d].push(i);var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=o(h,u,l,t[y+v],t[y+p],t[y+g],t[y+m]),E=o(h,u,l,t[b+v],t[b+p],t[b+g],t[b+m]),A=o(h,u,l,t[_+v],t[_+p],t[_+g],t[_+m]),P=o(h,u,l,t[x+v],t[x+p],t[x+g],t[x+m]),M=w+E+A+P;if(0===M)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(3===M)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(M>1)return r[d]=r[d]||[],void r[d].push(i);c++,w&&(d=y),E&&(d=b),A&&(d=_),P&&(d=x)}}function l(e,t,r,i,n,o,s){for(var h=[0,0],u=[],l=void 0;h.length;){var c=h.pop(),d=h.pop();if(l=r[d],l&&u.push.apply(u,l),!(c>=e)){var y=4*d+f,b=4*d+2*f,_=4*d+3*f,x=4*d+4*f,w=a(i,n,o,s,t[y+v],t[y+p],t[y+g],t[y+m]),E=a(i,n,o,s,t[b+v],t[b+p],t[b+g],t[b+m]),A=a(i,n,o,s,t[_+v],t[_+p],t[_+g],t[_+m]),P=a(i,n,o,s,t[x+v],t[x+p],t[x+g],t[x+m]);w&&h.push(y,c+1),E&&h.push(b,c+1),A&&h.push(_,c+1),P&&h.push(x,c+1)}}return u}Object.defineProperty(t,"__esModule",{value:!0});var c=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),f=4,d=5,v=0,p=1,g=2,m=3,y=1,b=2,_=3,x=4,w=function(){function e(t){i(this,e),t=t||{};var r=Math.pow(4,d);this.data=new Float32Array(f*((4*r-1)/3)),this.containers={},this.cache=null,this.lastRectangle=null,t.boundaries&&this.resize(t.boundaries),"function"==typeof t.filter&&(this.nodeFilter=t.filter)}return c(e,[{key:"add",value:function(e,t,r,i){return u(d,this.data,this.containers,e,t,r,i),this}},{key:"resize",value:function(e){this.clear(),this.data[v]=e.x,this.data[p]=e.y,this.data[g]=e.width,this.data[m]=e.height,h(d,this.data)}},{key:"clear",value:function(){return this.containers={},this}},{key:"point",value:function(e,t){var r=[],i=0,n=0;do{this.containers[i]&&r.push.apply(r,this.containers[i]);i=4*i+s(e,t,this.data[i+v],this.data[i+p],this.data[i+g],this.data[i+m])*f,n++}while(n<=d);return r}},{key:"rectangle",value:function(e,t,r,i,o){var a=this.lastRectangle;if(a&&e===a.x1&&r===a.x2&&t===a.y1&&i===a.y2&&o===a.height)return this.cache;if(this.lastRectangle={x1:e,y1:t,x2:r,y2:i,height:o},!n(e,t,r,i))throw new Error("sigma/quadtree.rectangle: shifted view is not yet implemented.");var s=l(d,this.data,this.containers,e,t,Math.abs(e-r)||Math.abs(t-i),o);return this.cache=s,this.cache}}]),e}();t.default=w},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),s=r(14),h=function(e){return e&&e.__esModule?e:{default:e}}(s),u=r(15),l=function(e){function t(e,r){i(this,t);var o=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,r));return o.container=e,o.camera=r,o.enabled=!0,o.hasDragged=!1,o.downStartTime=null,o.startMouseX=null,o.startMouseY=null,o.isMouseDown=!1,o.isMoving=!1,o.movingTimeout=null,o.startCameraState=null,o.lastCameraState=null,o.clicks=0,o.doubleClickTimeout=null,o.wheelLock=!1,o.handleClick=o.handleClick.bind(o),o.handleDown=o.handleDown.bind(o),o.handleUp=o.handleUp.bind(o),o.handleMove=o.handleMove.bind(o),o.handleWheel=o.handleWheel.bind(o),o.handleOut=o.handleOut.bind(o),e.addEventListener("click",o.handleClick,!1),e.addEventListener("mousedown",o.handleDown,!1),e.addEventListener("mousemove",o.handleMove,!1),e.addEventListener("DOMMouseScroll",o.handleWheel,!1),e.addEventListener("mousewheel",o.handleWheel,!1),e.addEventListener("mouseout",o.handleOut,!1),document.addEventListener("mouseup",o.handleUp,!1),o}return o(t,e),a(t,[{key:"handleClick",value:function(e){var t=this;if(this.enabled){if(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.emit("click",(0,u.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,u.getCenter)(e),r=this.camera.getState(),i=this.camera.abstractDisplayToGraph((0,u.getX)(e)-t.x,(0,u.getY)(e)-t.y);return this.camera.animate({x:i.x*(1-1/2.2)+r.x,y:i.y*(1-1/2.2)+r.y,ratio:1/2.2*r.ratio},{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.startMouseX=(0,u.getX)(e),this.startMouseY=(0,u.getY)(e),this.hasDragged=!1,this.downStartTime=Date.now(),e.which,this.isMouseDown=!0,this.emit("mousedown",(0,u.getMouseCoords)(e)))}},{key:"handleUp",value:function(e){if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,this.movingTimeout&&(this.movingTimeout=null,clearTimeout(this.movingTimeout));var t=(0,u.getX)(e),r=(0,u.getY)(e),i=this.camera.getState();this.isMoving?this.camera.animate({x:i.x+3*(i.x-this.lastCameraState.x),y:i.y+3*(i.y-this.lastCameraState.y)},{duration:200,easing:"quadraticOut"}):this.startMouseX===t&&this.startMouseY===r||this.camera.setState({x:i.x,y:i.y}),this.isMoving=!1,this.hasDragged=!1,this.emit("mouseup",(0,u.getMouseCoords)(e))}}},{key:"handleMove",value:function(e){var t=this;if(this.enabled){if(this.emit("mousemove",(0,u.getMouseCoords)(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 r=this.camera.abstractDisplayToGraph((0,u.getX)(e)-this.startMouseX,(0,u.getY)(e)-this.startMouseY),i=this.startCameraState.x-r.x,n=this.startCameraState.y-r.y,o=this.camera.getState();o.x===i&&o.y===n||(this.lastCameraState=o,this.camera.setState({x:i,y:n}))}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 r=(0,u.getWheelDelta)(e);if(!r)return!1;if(this.wheelLock)return!1;this.wheelLock=!0;var i=r>0?1/1.7:1.7,n=this.camera.getState(),o=i*n.ratio,a=(0,u.getCenter)(e),s=this.camera.abstractDisplayToGraph((0,u.getX)(e)-a.x,(0,u.getY)(e)-a.y);return this.camera.animate({x:s.x*(1-i)+n.x,y:s.y*(1-i)+n.y,ratio:o},{easing:"linear",duration:200},function(){return t.wheelLock=!1}),!1}},{key:"handleOut",value:function(){}}]),t}(h.default);t.default=l},function(e,t,r){"use strict";function i(e,t){var r=document.createElement(e);if(!t)return r;for(var i in t)if("style"===i)for(var n in t[i])r.style[n]=t[i][n];else r.setAttribute(i,t[i]);return r}function n(){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 o(e,t){e=e||{};var r=e.mode||a.mode,i=e.height||1,n=e.width||1,o=t.maxX,s=t.maxY,h=t.minX,u=t.minY,l=(o+h)/2,c=(s+u)/2,f="outside"===r?Math.max(n/Math.max(o-h,1),i/Math.max(s-u,1)):Math.min(n/Math.max(o-h,1),i/Math.max(s-u,1)),d=function(e){return{x:(e.x-l)*f,y:(e.y-c)*f}};return d.inverse=function(e){return{x:e.x/f+l,y:e.y/f+c}},d}Object.defineProperty(t,"__esModule",{value:!0}),t.createElement=i,t.getPixelRatio=n,t.createRescalingFunction=o;var a={mode:"inside",margin:0}},function(e,t,r){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,r=Array(e.length);t<e.length;t++)r[t]=e[t];return r}return Array.from(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e){return function(){function t(r){n(this,t),this.programs=e.map(function(e){return new e(r)})}return a(t,[{key:"allocate",value:function(e){this.programs.forEach(function(t){return t.allocate(e)})}},{key:"process",value:function(){var e=arguments;this.programs.forEach(function(t){return t.process.apply(t,i(e))})}},{key:"computeIndices",value:function(){this.programs.forEach(function(e){"function"==typeof e.computeIndices&&e.computeIndices()})}},{key:"bufferData",value:function(){this.programs.forEach(function(e){return e.bufferData()})}},{key:"render",value:function(){var e=arguments;this.programs.forEach(function(t){t.bind(),t.bufferData(),t.render.apply(t,i(e))})}}]),t}()}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}();t.createCompoundProgram=o;var s=r(18),h=function(){function e(t,r,i){n(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=i,this.load(t)}return a(e,[{key:"load",value:function(e){return this.vertexShader=(0,s.loadVertexShader)(e,this.vertexShaderSource),this.fragmentShader=(0,s.loadFragmentShader)(e,this.fragmentShaderSource),this.program=(0,s.loadProgram)(e,[this.vertexShader,this.fragmentShader]),this.program}}]),e}();t.default=h},function(e,t,r){"use strict";function i(e,t){e.fillStyle="#000",e.font="14px arial",e.fillText(t.label,t.x+t.size+3,t.y+14/3)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}var n=r(11),o=i(n),a=r(0),s=i(a),h=r(3),u=i(h),l=r(5),c=i(l),f=r(6),d=i(f),v=r(16),p=i(v),g={Sigma:o.default,Renderer:s.default,Camera:u.default,QuadTree:c.default,MouseCaptor:d.default,WebGLRenderer:p.default};for(var m in g)o.default[m]=g[m];e.exports=o.default},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),a=r(12),s=i(a),h=r(0),u=i(h),l=function(){function e(t,r){if(n(this,e),!(0,s.default)(t))throw new Error("Sigma.constructor: given graph is not an instance of a graphology implementation.");if(!(r instanceof u.default))throw new Error("Sigma.constructor: given renderer is not an instance of a sigma Renderer.");this.graph=t,this.renderer=r,this.renderer.bind(this),this.state={},this.nodeStates=null,this.edgeStates=null,this.renderer.render()}return o(e,[{key:"getGraph",value:function(){return this.graph}},{key:"getNodeData",value:function(e){return this.graph.getNodeAttributes(e)}},{key:"getEdgeData",value:function(e){return this.graph.getEdgeAttributes(e)}},{key:"getGraphExtent",value:function(){for(var e=this.graph,t=e.nodes(),r=e.edges(),i=-1/0,n=-1/0,o=1/0,a=1/0,s=-1/0,h=-1/0,u=0,l=t.length;u<l;u++){var c=t[u],f=this.getNodeData(c),d=f.size||1;f.x>i&&(i=f.x),f.y>n&&(n=f.y),f.x<o&&(o=f.x),f.y<a&&(a=f.y),d>s&&(s=d)}for(var v=0,p=r.length;v<p;v++){var g=r[v],m=this.getEdgeData(g),y=m.size||1;y>h&&(h=y)}return{maxX:i,maxY:n,minX:o,minY:a,maxNodeSize:s,maxEdgeSize:h}}}]),e}();t.default=l},function(e,t){e.exports=function(e){return null!==e&&"object"==typeof e&&"function"==typeof e.addUndirectedEdgeWithKey&&"function"==typeof e.dropNodes&&"boolean"==typeof e.multi}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.linear=function(e){return e},t.quadraticIn=function(e){return e*e},t.quadraticOut=function(e){return e*(2-e)},t.quadraticInOut=function(e){return(e*=2)<1?.5*e*e:-.5*(--e*(e-2)-1)},t.cubicIn=function(e){return e*e*e},t.cubicOut=function(e){return--e*e*e+1},t.cubicInOut=function(e){return(e*=2)<1?.5*e*e*e:.5*((e-=2)*e*e+2)}},function(e,t,r){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var a=r(1),s=function(e){function t(e,r){i(this,t);var o=n(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));return o.container=e,o.camera=r,o}return o(t,e),t}(a.EventEmitter);t.default=s},function(e,t,r){"use strict";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 n(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 o(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.")}function a(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.")}function s(e){var t=-1!==e.target.namespaceURI.indexOf("svg")?1:(0,l.getPixelRatio)();return{x:o(e)/(2*t),y:a(e)/(2*t)}}function h(e){return{x:i(e),y:n(e),clientX:e.clientX,clientY:e.clientY,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,shiftKey:e.shiftKey}}function u(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.")}Object.defineProperty(t,"__esModule",{value:!0}),t.getX=i,t.getY=n,t.getWidth=o,t.getHeight=a,t.getCenter=s,t.getMouseCoords=h,t.getWheelDelta=u;var l=r(7)},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(0),u=i(h),l=r(3),c=i(l),f=r(6),d=i(f),v=r(5),p=i(v),g=r(17),m=i(g),y=r(22),b=i(y),_=r(9),x=i(_),w=r(25),E=i(w),A=r(4),P=r(7),M=r(2),O=r(27),T=(0,P.getPixelRatio)(),L=(0,P.getPixelRatio)(),S={hideEdgesOnMove:!1,hideLabelsOnMove:!1},k=function(e){function t(e,r){n(this,t);var i=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this));if(r=r||{},i.settings=(0,A.assign)({},S,r),!(e instanceof HTMLElement))throw new Error("sigma/renderers/webgl: container should be an html element.");i.sigma=null,i.captors={},i.container=e,i.elements={},i.contexts={},i.listeners={},i.quadtree=new p.default,i.nodeOrder={},i.nodeDataCache={},i.edgeOrder={},i.rescalingFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.previousVisibleNodes=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 a=i.contexts.nodes;return a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),a=i.contexts.edges,a.blendFunc(a.ONE,a.ONE_MINUS_SRC_ALPHA),a.enable(a.BLEND),i.nodePrograms={def:new m.default(i.contexts.nodes)},i.edgePrograms={def:new b.default(i.contexts.edges)},i.resize(),i.camera=new c.default({width:i.width,height:i.height}),i.bindCameraHandlers(),i.captors={mouse:new d.default(i.elements.mouse,i.camera)},i.bindEventHandlers(),i}return a(t,e),s(t,[{key:"createContext",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=(0,P.createElement)("canvas",{class:"sigma-"+e,style:{position:"absolute"}});this.elements[e]=r,this.container.appendChild(r);var i={preserveDrawingBuffer:!0,antialias:!1},n=void 0;return t?(n=r.getContext("webgl",i))||(n=r.getContext("experimental-webgl",i)):n=r.getContext("2d",i),this.contexts[e]=n,this}},{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,r,i,n){return e>r-n&&e<r+n&&t>i-n&&t<i+n&&Math.sqrt(Math.pow(e-r,2)+Math.pow(t-i,2))<n},r=function(t,r){var i=e.camera.displayToGraph(t,r);return e.quadtree.point(i.x,i.y)};return this.listeners.handleMove=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/n;if(t(i.x,i.y,l.x,l.y,c))return e.hoveredNode=h,e.emit("overNode",{node:h}),e.scheduleHighlightedNodesRender()}if(e.hoveredNode){var f=e.nodeDataCache[e.hoveredNode],d=e.camera.graphToDisplay(f.x,f.y),v=f.size/n;if(!t(i.x,i.y,d.x,d.y,v))return e.hoveredNode=null,e.emit("outNode",{node:e.hoveredNode}),e.scheduleHighlightedNodesRender()}},this.listeners.handleDown=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/n;if(t(i.x,i.y,l.x,l.y,c))return e.emit("downNode",{node:h})}},this.listeners.handleClick=function(i){for(var n=Math.pow(e.camera.getState().ratio,.5),o=r(i.x,i.y),a=0,s=o.length;a<s;a++){var h=o[a],u=e.nodeDataCache[h],l=e.camera.graphToDisplay(u.x,u.y),c=u.size/n;if(t(i.x,i.y,l.x,l.y,c))return e.emit("clickNode",{node:h})}return e.emit("clickStage")},this.captors.mouse.on("mousemove",this.listeners.handleMove),this.captors.mouse.on("mousedown",this.listeners.handleDown),this.captors.mouse.on("click",this.listeners.handleClick),this}},{key:"bindGraphHandlers",value:function(){var e=this,t=this.sigma.getGraph();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.sigma.getGraph(),r=this.sigma.getGraphExtent();this.rescalingFunction=(0,P.createRescalingFunction)({width:this.width,height:this.height},r);var i=this.rescalingFunction({x:r.minX,y:r.minY}),n=this.rescalingFunction({x:r.maxX,y:r.maxY});this.quadtree.resize({x:i.x,y:i.y,width:n.x-i.x,height:n.y-i.y});var o=this.nodePrograms.def;e||(o.allocate(t.order),this.nodeOrder={});for(var a=t.nodes(),s=0,h=a.length;s<h;s++){var u=a[s];this.nodeOrder[u]=s;var l=this.sigma.getNodeData(u),c=this.rescalingFunction(l),f=(0,A.assign)({},l,c);this.quadtree.add(u,f.x,f.y,f.size),this.nodeDataCache[u]=f,o.process(f,s)}o.bufferData();var d=this.edgePrograms.def;e||(d.allocate(t.size),this.edgeOrder={});for(var v=t.edges(),p=0,g=v.length;p<g;p++){var m=v[p];this.edgeOrder[m]=p;var y=this.sigma.getEdgeData(m),b=t.extremities(m),_=this.nodeDataCache[b[0]],x=this.nodeDataCache[b[1]];d.process(_,x,y,p)}return e||"function"!=typeof d.computeIndices||(this.edgeIndicesArray=d.computeIndices()),d.bufferData(),this}},{key:"processNode",value:function(e){var t=this.nodePrograms.def,r=this.sigma.getNodeData(e);return t.process(r,this.nodeOrder[e]),this}},{key:"processEdge",value:function(e){var t=this.sigma.getGraph(),r=this.edgePrograms.def,i=this.sigma.getEdgeData(e),n=t.extremities(e),o=this.sigma.getNodeData(n[0]),a=this.sigma.getNodeData(n[1]);return r.process(o,a,i,this.edgeOrder[e]),this}},{key:"bind",value:function(e){return this.sigma=e,this.bindGraphHandlers(),this.process(),this}},{key:"getCamera",value:function(){return this.camera}},{key:"getMouseCaptor",value:function(){return this.captors.mouse}},{key:"resize",value:function(e,t){var r=this.width,i=this.height;if(arguments.length>1?(this.width=e,this.height=t):(this.width=this.container.offsetWidth,this.height=this.container.offsetHeight),r===this.width&&i===this.height)return this;this.camera&&this.camera.resize({width:this.width,height:this.height});for(var n in this.elements){var o=this.elements[n];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*T+"px"),this.elements[a].setAttribute("height",this.height*T+"px"),1!==T&&s.scale(T,T)):(this.elements[a].setAttribute("width",this.width*L+"px"),this.elements[a].setAttribute("height",this.height*L+"px")),s.viewport&&s.viewport(0,0,this.width*L,this.height*L)}return this}},{key:"clear",value:function(){var e=this.contexts.nodes;return e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.edges,e.clear(e.COLOR_BUFFER_BIT),e=this.contexts.labels,e.clearRect(0,0,this.width,this.height),e=this.contexts.hovers,e.clearRect(0,0,this.width,this.height),this}},{key:"render",value:function(){this.renderFrame&&(cancelAnimationFrame(this.renderFrame),this.renderFrame=null,this.needToProcess=!1,this.needToSoftProcess=!1);var e=this.camera.isAnimated()||this.captors.mouse.isMoving||this.captors.mouse.hasDragged||this.captors.mouse.wheelLock;this.resize(),this.clear();var t=this.camera.getState(),r=(0,M.matrixFromCamera)(t,{width:this.width,height:this.height}),i=void 0;if(i=this.nodePrograms.def,i.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,scalingRatio:L}),this.settings.hideEdgesOnMove&&e||(i=this.edgePrograms.def,i.render({matrix:r,width:this.width,height:this.height,ratio:t.ratio,nodesPowRatio:.5,edgesPowRatio:.5,scalingRatio:L})),this.settings.hideLabelsOnMove&&e)return this;var n=void 0;if(t.ratio>=1)n=this.sigma.getGraph().nodes();else{var o=this.camera.viewRectangle();n=this.quadtree.rectangle(o.x1,o.y1,o.x2,o.y2,o.height)}for(var a=(0,O.labelsToDisplayFromGrid)({cache:this.nodeDataCache,camera:this.camera,displayedLabels:this.displayedLabels,previousVisibleNodes:this.previousVisibleNodes,visibleNodes:n}),s=this.contexts.labels,h=Math.pow(t.ratio,.5),u=0,l=a.length;u<l;u++){var c=this.nodeDataCache[a[u]],f=this.camera.graphToDisplay(c.x,c.y),d=f.x,v=f.y,p=c.size/h;(0,x.default)(s,{label:c.label,size:p,x:d,y:v})}return this.previousVisibleNodes=new Set(n),this.displayedLabels=new Set(a),this.renderHighlightedNodes(),this}},{key:"renderHighlightedNodes",value:function(){var e=this,t=this.camera,r=Math.pow(t.getState().ratio,.5),i=this.contexts.hovers;i.clearRect(0,0,this.width,this.height);var n=function(n){var o=e.nodeDataCache[n],a=t.graphToDisplay(o.x,o.y),s=a.x,h=a.y,u=o.size/r;(0,E.default)(i,{label:o.label,color:o.color,size:u,x:s,y:h})};this.hoveredNode&&n(this.hoveredNode),this.highlightedNodes.forEach(n)}},{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:"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}}]),t}(u.default);t.default=k},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(8),u=i(h),l=r(2),c=r(20),f=i(c),d=r(21),v=i(d),p=4,g=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.buffer=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,r.buffer);var i=r.program;return r.positionLocation=e.getAttribLocation(i,"a_position"),r.sizeLocation=e.getAttribLocation(i,"a_size"),r.colorLocation=e.getAttribLocation(i,"a_color"),r.resolutionLocation=e.getUniformLocation(i,"u_resolution"),r.matrixLocation=e.getUniformLocation(i,"u_matrix"),r.ratioLocation=e.getUniformLocation(i,"u_ratio"),r.scaleLocation=e.getUniformLocation(i,"u_scale"),e.enableVertexAttribArray(r.positionLocation),e.enableVertexAttribArray(r.sizeLocation),e.enableVertexAttribArray(r.colorLocation),e.vertexAttribPointer(r.positionLocation,2,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,0),e.vertexAttribPointer(r.sizeLocation,1,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,8),e.vertexAttribPointer(r.colorLocation,1,e.FLOAT,!1,p*Float32Array.BYTES_PER_ELEMENT,12),r}return a(t,e),s(t,[{key:"allocate",value:function(e){this.array=new Float32Array(1*p*e)}},{key:"process",value:function(e,t){var r=(0,l.floatColor)(e.color),i=1*t*p,n=this.array;n[i++]=e.x,n[i++]=e.y,n[i++]=e.size,n[i]=r}},{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,r=this.program;t.useProgram(r),t.uniform2f(this.resolutionLocation,e.width,e.height),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/p)}}]),t}(u.default);t.default=g},function(e,t,r){"use strict";function i(e,t,r){var i="VERTEX"===e?t.VERTEX_SHADER:t.FRAGMENT_SHADER,n=t.createShader(i);if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS)){var o=t.getShaderInfoLog(n);throw t.deleteShader(n),new Error("sigma/renderers/weblg/shaders/utils.loadShader: error while compiling the shader:\n"+o+"\n"+r)}return n}function n(e,t){var r=e.createProgram(),i=void 0,n=void 0;for(i=0,n=t.length;i<n;i++)e.attachShader(r,t[i]);if(e.linkProgram(r),!e.getProgramParameter(r,e.LINK_STATUS))throw e.deleteProgram(r),new Error("sigma/renderers/weblg/shaders/utils.loadProgram: error while linking the program.");return r}Object.defineProperty(t,"__esModule",{value:!0}),t.loadProgram=n;var o=i.bind(null,"VERTEX"),a=i.bind(null,"FRAGMENT");t.loadVertexShader=o,t.loadFragmentShader=a},function(e,t,r){"use strict";function i(){return Float32Array.of(1,0,0,0,1,0,0,0,1)}function n(e,t){return e[0]=t,e[4]=t,e}function o(e,t){var r=Math.sin(t),i=Math.cos(t);return e[0]=i,e[1]=r,e[3]=-r,e[4]=i,e}function a(e,t,r){return e[6]=t,e[7]=r,e}function s(e,t){var r=e[0],i=e[1],n=e[2],o=e[3],a=e[4],s=e[5],h=e[6],u=e[7],l=e[8],c=t[0],f=t[1],d=t[2],v=t[3],p=t[4],g=t[5],m=t[6],y=t[7],b=t[8];return e[0]=c*r+f*o+d*h,e[1]=c*i+f*a+d*u,e[2]=c*n+f*s+d*l,e[3]=v*r+p*o+g*h,e[4]=v*i+p*a+g*u,e[5]=v*n+p*s+g*l,e[6]=m*r+y*o+b*h,e[7]=m*i+y*a+b*u,e[8]=m*n+y*s+b*l,e}Object.defineProperty(t,"__esModule",{value:!0}),t.identity=i,t.scale=n,t.rotate=o,t.translate=a,t.multiply=s},function(e,t){e.exports="attribute vec2 a_position;\nattribute float a_size;\nattribute float a_color;\n\nuniform vec2 u_resolution;\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 color;\nvarying float border;\n\nvoid main() {\n\n gl_Position = vec4(\n ((u_matrix * vec3(a_position, 1)).xy /\n u_resolution * 2.0 - 1.0) * vec2(1, -1),\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 border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n float c = a_color;\n color.b = mod(c, 256.0); c = floor(c / 256.0);\n color.g = mod(c, 256.0); c = floor(c / 256.0);\n color.r = mod(c, 256.0); c = floor(c / 256.0); color /= 255.0;\n color.a = 1.0;\n}\n"},function(e,t){e.exports="precision mediump float;\n\nvarying vec4 color;\nvarying float 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 > border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / border;\n\n gl_FragColor = mix(color0, color, t);\n}\n"},function(e,t,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),h=r(8),u=i(h),l=r(2),c=r(23),f=i(c),d=r(24),v=i(d),p=function(e){function t(e){n(this,t);var r=o(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,f.default,v.default));r.gl=e,r.array=null,r.indicesArray=null,r.buffer=e.createBuffer(),r.indicesBuffer=e.createBuffer(),r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.resolutionLocation=e.getUniformLocation(r.program,"u_resolution"),r.ratioLocation=e.getUniformLocation(r.program,"u_ratio"),r.matrixLocation=e.getUniformLocation(r.program,"u_matrix"),r.scaleLocation=e.getUniformLocation(r.program,"u_scale"),r.bind();var i=e.getExtension("OES_element_index_uint");return r.canUse32BitsIndices=!!i,r.IndicesArray=r.canUse32BitsIndices?Uint32Array:Uint16Array,r.indicesType=r.canUse32BitsIndices?e.UNSIGNED_INT:e.UNSIGNED_SHORT,r}return a(t,e),s(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,1,e.FLOAT,!1,6*Float32Array.BYTES_PER_ELEMENT,20)}},{key:"allocate",value:function(e){this.array=new Float32Array(24*e)}},{key:"process",value:function(e,t,r,i){if(e.hidden||t.hidden||r.hidden)for(var n=m+24;m<n;m++)this.array[m]=0;var o=r.size||1,a=e.x,s=e.y,h=t.x,u=t.y,c=(0,l.floatColor)(r.color),f=h-a,d=u-s,v=f*f+d*d,p=0,g=0;v&&(v=1/Math.sqrt(v),p=-d*v,g=f*v);var m=24*i,y=this.array;y[m++]=a,y[m++]=s,y[m++]=p,y[m++]=g,y[m++]=o,y[m++]=c,y[m++]=a,y[m++]=s,y[m++]=-p,y[m++]=-g,y[m++]=o,y[m++]=c,y[m++]=h,y[m++]=u,y[m++]=p,y[m++]=g,y[m++]=o,y[m++]=c,y[m++]=h,y[m++]=u,y[m++]=-p,y[m++]=-g,y[m++]=o,y[m]=c}},{key:"computeIndices",value:function(){for(var e=this.array.length/6,t=e+e/2,r=new this.IndicesArray(t),i=0,n=0;i<t;i+=4)r[n++]=i,r[n++]=i+1,r[n++]=i+2,r[n++]=i+2,r[n++]=i+1,r[n++]=i+3;this.indicesArray=r}},{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,r=this.program;t.useProgram(r),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}(u.default);t.default=p},function(e,t){e.exports="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float 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 feather = 0.5;\n\nvoid main() {\n\n float pow_ratio = 1.0 / pow(u_ratio, 0.5);\n float thickness = (a_thickness + feather) / 2.0 / pow_ratio / u_scale;\n\n // Scale from [[-1 1] [-1 1]] to the container:\n vec2 delta = vec2(a_normal * thickness);\n\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n position = (position / u_resolution * 2.0 - 1.0) * vec2(1, -1);\n\n // Applying\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness / u_ratio;\n\n // Extract the color:\n float c = a_color;\n v_color.b = mod(c, 256.0); c = floor(c / 256.0);\n v_color.g = mod(c, 256.0); c = floor(c / 256.0);\n v_color.r = mod(c, 256.0); c = floor(c / 256.0); v_color /= 255.0;\n v_color.a = 1.0;\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 = 0.5 / 2.0;\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,r){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function n(e,t){e.font="14px arial",e.beginPath(),e.fillStyle="#fff",e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=8,e.shadowColor="#000";var r=e.measureText(t.label).width,i=Math.round(t.x-7-2),n=Math.round(t.y-7-2),o=Math.round(r+7+t.size+9),s=Math.round(18),u=Math.round(9);e.moveTo(i,n+u),e.moveTo(i,n+u),e.arcTo(i,n,i+u,n,u),e.lineTo(i+o,n),e.lineTo(i+o,n+s),e.lineTo(i+u,n+s),e.arcTo(i,n+s,i,n+s-u,u),e.lineTo(i,n+u),e.closePath(),e.fill(),e.shadowOffsetX=0,e.shadowOffsetY=0,e.shadowBlur=0,(0,a.default)(e,t),(0,h.default)(e,t)}Object.defineProperty(t,"__esModule",{value:!0}),t.default=n;var o=r(26),a=i(o),s=r(9),h=i(s)},function(e,t,r){"use strict";function i(e,t){e.fillStyle=t.color,e.beginPath(),e.arc(t.x,t.y,t.size,0,n,!0),e.closePath(),e.fill()}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var n=2*Math.PI},function(e,t,r){"use strict";var i={width:200,height:150},n={width:400,height:300};t.labelsToDisplayFromGrid=function(e){var t=e.cache,r=e.camera,o=e.displayedLabels,a=e.previousVisibleNodes,s=e.visibleNodes,h=r.getState(),u=r.getPreviousState(),l=r.getDimensions(),c=h.ratio<u.ratio,f=h.x!==u.x||h.y!==u.x,d=h.ratio>u.ratio,v=!c&&!d&&h.ratio>=1;if(d&&Math.trunc(10*h.ratio)%3!=0)return Array.from(o);if(v&&0!==o.size)return Array.from(o);for(var p=h.ratio>=1.3?n:i,g=l.width%p.width,m=p.width+g/Math.floor(l.width/p.width),y=l.height%p.height,b=p.height+y/Math.floor(l.height/p.height),_={},x=new Set,w=[],E=0,A=s.length;E<A;E++){var P=s[E],M=t[P];if(!f||c||d||o.has(P)||!a.has(P)){var O=r.graphToDisplay(M.x,M.y),T=Math.floor(O.x/m),L=Math.floor(O.y/b),S=T+";"+L;if((c||f&&!d)&&o.has(P))x.add(S),w.push(P);else if(!x.has(S))if(void 0===_[S])_[S]=P;else{var k=_[S],D=t[k];(M.size>D.size||M.size===D.size&&P>k)&&(_[S]=P)}}}for(var R in _)w.push(_[R]);return w}}])}); |
@@ -73,2 +73,3 @@ 'use strict'; | ||
_this.nextFrame = null; | ||
_this.previousState = _this.getState(); | ||
_this.enabled = true; | ||
@@ -123,2 +124,21 @@ return _this; | ||
/** | ||
* Method used to retrieve the camera's previous state. | ||
* | ||
* @return {object} | ||
*/ | ||
}, { | ||
key: 'getPreviousState', | ||
value: function getPreviousState() { | ||
var state = this.previousState; | ||
return { | ||
x: state.x, | ||
y: state.y, | ||
angle: state.angle, | ||
ratio: state.ratio | ||
}; | ||
} | ||
/** | ||
* Method used to retrieve the camera's dimensions. | ||
@@ -262,2 +282,5 @@ * | ||
// Keeping track of last state | ||
this.previousState = this.getState(); | ||
if ('x' in state) this.x = state.x; | ||
@@ -264,0 +287,0 @@ |
{ | ||
"name": "sigma", | ||
"version": "2.0.0-alpha8", | ||
"version": "2.0.0-alpha9", | ||
"description": "A JavaScript library dedicated to graph drawing.", | ||
@@ -16,6 +16,6 @@ "homepage": "http://sigmajs.org", | ||
"prepublish": "npm run test && npm run dist && npm run build", | ||
"test": "mocha --compilers js:babel-core/register ./test/endpoint.js" | ||
"test": "mocha --require babel-core/register ./test/endpoint.js" | ||
}, | ||
"sigma": { | ||
"clean": "camera.js captor.js easings.js endpoint.js quadtree.js renderer.js sigma.js utils.js captors renderers" | ||
"clean": "camera.js captor.js easings.js endpoint.js quadtree.js renderer.js sigma.js utils.js captors heuristics renderers" | ||
}, | ||
@@ -41,8 +41,9 @@ "repository": { | ||
"babel-core": "^6.14.0", | ||
"babel-loader": "^7.0.0", | ||
"babel-loader": "^7.1.3", | ||
"babel-preset-es2015": "^6.14.0", | ||
"chroma-js": "^1.3.3", | ||
"eslint": "^4.0.0", | ||
"chroma-js": "^1.3.6", | ||
"eslint": "^4.18.1", | ||
"faker": "^4.1.0", | ||
"graphology": "^0.11.0", | ||
"glob": "^7.1.2", | ||
"graphology": "^0.11.1", | ||
"graphology-generators": "^0.7.0", | ||
@@ -53,3 +54,3 @@ "graphology-gexf": "^0.3.1", | ||
"html-webpack-plugin": "^2.22.0", | ||
"mocha": "^4.0.1", | ||
"mocha": "^5.0.1", | ||
"raw-loader": "^0.5.1", | ||
@@ -59,3 +60,3 @@ "rimraf": "^2.6.1", | ||
"webpack-dev-server": "^2.4.5", | ||
"worker-loader": "^1.1.0" | ||
"worker-loader": "^1.1.1" | ||
}, | ||
@@ -79,5 +80,5 @@ "keywords": [ | ||
"dependencies": { | ||
"events": "^1.1.1", | ||
"events": "^2.0.0", | ||
"graphology-utils": "^1.1.1" | ||
} | ||
} |
@@ -47,2 +47,4 @@ 'use strict'; | ||
var _labels = require('../../heuristics/labels'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -123,2 +125,4 @@ | ||
_this.highlightedNodes = new Set(); | ||
_this.previousVisibleNodes = new Set(); | ||
_this.displayedLabels = new Set(); | ||
_this.hoveredNode = null; | ||
@@ -747,2 +751,3 @@ _this.wasRenderedInThisFrame = false; | ||
ratio: cameraState.ratio, | ||
nodesPowRatio: 0.5, | ||
edgesPowRatio: 0.5, | ||
@@ -771,2 +776,11 @@ scalingRatio: WEBGL_OVERSAMPLING_RATIO | ||
// Selecting labels to draw | ||
var labelsToDisplay = (0, _labels.labelsToDisplayFromGrid)({ | ||
cache: this.nodeDataCache, | ||
camera: this.camera, | ||
displayedLabels: this.displayedLabels, | ||
previousVisibleNodes: this.previousVisibleNodes, | ||
visibleNodes: visibleNodes | ||
}); | ||
// Drawing labels | ||
@@ -778,4 +792,4 @@ // TODO: POW RATIO is currently default 0.5 and harcoded | ||
for (var i = 0, l = visibleNodes.length; i < l; i++) { | ||
var data = this.nodeDataCache[visibleNodes[i]]; | ||
for (var i = 0, l = labelsToDisplay.length; i < l; i++) { | ||
var data = this.nodeDataCache[labelsToDisplay[i]]; | ||
@@ -792,3 +806,4 @@ var _camera$graphToDispla = this.camera.graphToDisplay(data.x, data.y), | ||
// TODO: this is the label threshold hardcoded | ||
if (size < 8) continue; | ||
// if (size < 8) | ||
// continue; | ||
@@ -803,2 +818,6 @@ (0, _label2.default)(context, { | ||
// Caching visible nodes and displayed labels | ||
this.previousVisibleNodes = new Set(visibleNodes); | ||
this.displayedLabels = new Set(labelsToDisplay); | ||
// Rendering highlighted nodes | ||
@@ -805,0 +824,0 @@ this.renderHighlightedNodes(); |
@@ -30,4 +30,4 @@ 'use strict'; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** | ||
* Sigma.js WebGL Renderer Node Program | ||
* ===================================== | ||
* Sigma.js WebGL Renderer Fast Edge Program | ||
* ========================================== | ||
* | ||
@@ -39,4 +39,4 @@ * Program rendering edges using GL_LINES which is presumably very fast but | ||
// WARNING: this code is deprecated. It needs to be re-adapted to work | ||
// correctly to new APIs. | ||
var POINTS = 2, | ||
ATTRIBUTES = 3; | ||
@@ -49,15 +49,19 @@ var EdgeFastProgram = function (_Program) { | ||
// Initializing buffers | ||
// Binding context | ||
var _this = _possibleConstructorReturn(this, (EdgeFastProgram.__proto__ || Object.getPrototypeOf(EdgeFastProgram)).call(this, gl, _edgeFastVert2.default, _edgeFastFrag2.default)); | ||
_this.gl = gl; | ||
// Array data | ||
_this.array = null; | ||
// Initializing buffers | ||
_this.buffer = gl.createBuffer(); | ||
gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer); | ||
var program = _this.program; | ||
// Locations | ||
_this.colorLocation = gl.getAttribLocation(program, 'a_color'); | ||
_this.positionLocation = gl.getAttribLocation(program, 'a_position'); | ||
_this.resolutionLocation = gl.getUniformLocation(program, 'u_resolution'); | ||
_this.matrixLocation = gl.getUniformLocation(program, 'u_matrix'); | ||
_this.positionLocation = gl.getAttribLocation(_this.program, 'a_position'); | ||
_this.colorLocation = gl.getAttribLocation(_this.program, 'a_color'); | ||
_this.resolutionLocation = gl.getUniformLocation(_this.program, 'u_resolution'); | ||
_this.matrixLocation = gl.getUniformLocation(_this.program, 'u_matrix'); | ||
@@ -68,4 +72,4 @@ // Bindings | ||
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, EdgeFastProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0); | ||
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, EdgeFastProgram.ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0); | ||
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
return _this; | ||
@@ -75,7 +79,14 @@ } | ||
_createClass(EdgeFastProgram, [{ | ||
key: 'allocate', | ||
value: function allocate(capacity) { | ||
this.array = new Float32Array(POINTS * ATTRIBUTES * capacity); | ||
} | ||
}, { | ||
key: 'process', | ||
value: function process(array, sourceData, targetData, data, i) { | ||
value: function process(sourceData, targetData, data, offset) { | ||
var array = this.array; | ||
if (sourceData.hidden || targetData.hidden || data.hidden) { | ||
for (var l = i + EdgeFastProgram.POINTS * EdgeFastProgram.ATTRIBUTES; i < l; i++) { | ||
for (var l = i + POINTS * ATTRIBUTES; i < l; i++) { | ||
array[i] = 0; | ||
@@ -85,4 +96,3 @@ } | ||
var thickness = data.size || 1, | ||
x1 = sourceData.x, | ||
var x1 = sourceData.x, | ||
y1 = sourceData.y, | ||
@@ -93,2 +103,5 @@ x2 = targetData.x, | ||
var i = POINTS * ATTRIBUTES * offset; | ||
// First point | ||
array[i++] = x1; | ||
@@ -98,23 +111,30 @@ array[i++] = y1; | ||
// Second point | ||
array[i++] = x2; | ||
array[i++] = y2; | ||
array[i++] = color; | ||
array[i] = color; | ||
} | ||
}, { | ||
key: 'bufferData', | ||
value: function bufferData(gl, array) { | ||
gl.bufferData(gl.ARRAY_BUFFER, array, gl.DYNAMIC_DRAW); | ||
value: function bufferData() { | ||
var gl = this.gl; | ||
// Vertices data | ||
gl.bufferData(gl.ARRAY_BUFFER, this.array, gl.DYNAMIC_DRAW); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render(gl, array, params) { | ||
value: function render(params) { | ||
var gl = this.gl; | ||
var program = this.program; | ||
gl.useProgram(program); | ||
// Binding uniforms | ||
gl.uniform2f(this.resolutionLocation, params.width, params.height); | ||
gl.uniformMatrix3fv(this.matrixLocation, false, params.matrix); | ||
// TODO: use gl line thickness | ||
gl.lineWidth(3); | ||
gl.drawArrays(gl.LINES, 0, array.length / EdgeFastProgram.ATTRIBUTES); | ||
// Drawing: | ||
gl.drawArrays(gl.LINES, 0, this.array.length / ATTRIBUTES); | ||
} | ||
@@ -126,6 +146,2 @@ }]); | ||
exports.default = EdgeFastProgram; | ||
EdgeFastProgram.POINTS = 2; | ||
EdgeFastProgram.ATTRIBUTES = 3; | ||
exports.default = EdgeFastProgram; |
@@ -30,3 +30,3 @@ 'use strict'; | ||
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /** | ||
* Sigma.js WebGL Renderer Node Program | ||
* Sigma.js WebGL Renderer Edge Program | ||
* ===================================== | ||
@@ -68,6 +68,3 @@ * | ||
_this.buffer = gl.createBuffer(); | ||
gl.bindBuffer(gl.ARRAY_BUFFER, _this.buffer); | ||
_this.indicesBuffer = gl.createBuffer(); | ||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, _this.indicesBuffer); | ||
@@ -84,13 +81,4 @@ // Locations | ||
// Bindings | ||
gl.enableVertexAttribArray(_this.positionLocation); | ||
gl.enableVertexAttribArray(_this.normalLocation); | ||
gl.enableVertexAttribArray(_this.thicknessLocation); | ||
gl.enableVertexAttribArray(_this.colorLocation); | ||
_this.bind(); | ||
gl.vertexAttribPointer(_this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0); | ||
gl.vertexAttribPointer(_this.normalLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
gl.vertexAttribPointer(_this.thicknessLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16); | ||
gl.vertexAttribPointer(_this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20); | ||
// Enabling the OES_element_index_uint extension | ||
@@ -109,2 +97,21 @@ // NOTE: on older GPUs, this means that really large graphs won't | ||
_createClass(EdgeProgram, [{ | ||
key: 'bind', | ||
value: function bind() { | ||
var gl = this.gl; | ||
gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer); | ||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer); | ||
// Bindings | ||
gl.enableVertexAttribArray(this.positionLocation); | ||
gl.enableVertexAttribArray(this.normalLocation); | ||
gl.enableVertexAttribArray(this.thicknessLocation); | ||
gl.enableVertexAttribArray(this.colorLocation); | ||
gl.vertexAttribPointer(this.positionLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 0); | ||
gl.vertexAttribPointer(this.normalLocation, 2, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 8); | ||
gl.vertexAttribPointer(this.thicknessLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 16); | ||
gl.vertexAttribPointer(this.colorLocation, 1, gl.FLOAT, false, ATTRIBUTES * Float32Array.BYTES_PER_ELEMENT, 20); | ||
} | ||
}, { | ||
key: 'allocate', | ||
@@ -120,3 +127,3 @@ value: function allocate(capacity) { | ||
for (var l = i + POINTS * ATTRIBUTES; i < l; i++) { | ||
array[i] = 0; | ||
this.array[i] = 0; | ||
} | ||
@@ -223,8 +230,11 @@ } | ||
// Binding uniforms | ||
// TODO: precise the uniform names | ||
gl.uniform2f(this.resolutionLocation, params.width, params.height); | ||
gl.uniform1f(this.ratioLocation, params.ratio / Math.pow(params.ratio, params.edgesPowRatio)); | ||
gl.uniform1f(this.ratioLocation, | ||
// 1 / Math.pow(params.ratio, params.edgesPowRatio) | ||
params.ratio); | ||
gl.uniformMatrix3fv(this.matrixLocation, false, params.matrix); | ||
gl.uniform1f(this.scaleLocation, params.ratio); | ||
gl.uniform1f(this.scaleLocation, params.scalingRatio); | ||
@@ -231,0 +241,0 @@ // Drawing: |
@@ -15,4 +15,8 @@ 'use strict'; | ||
exports.createCompoundProgram = createCompoundProgram; | ||
var _utils = require('../shaders/utils'); | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -58,2 +62,68 @@ | ||
exports.default = Program; | ||
/** | ||
* Helper function combining two or more programs into a single compound one. | ||
* Note that this is more a quick & easy way to combine program than a really | ||
* performant option. More performant programs can be written entirely. | ||
* | ||
* @param {array} programClasses - Program classes to combine. | ||
* @return {function} | ||
*/ | ||
exports.default = Program; | ||
function createCompoundProgram(programClasses) { | ||
return function () { | ||
function CompoundProgram(gl) { | ||
_classCallCheck(this, CompoundProgram); | ||
this.programs = programClasses.map(function (ProgramClass) { | ||
return new ProgramClass(gl); | ||
}); | ||
} | ||
_createClass(CompoundProgram, [{ | ||
key: 'allocate', | ||
value: function allocate(capacity) { | ||
this.programs.forEach(function (program) { | ||
return program.allocate(capacity); | ||
}); | ||
} | ||
}, { | ||
key: 'process', | ||
value: function process() { | ||
var args = arguments; | ||
this.programs.forEach(function (program) { | ||
return program.process.apply(program, _toConsumableArray(args)); | ||
}); | ||
} | ||
}, { | ||
key: 'computeIndices', | ||
value: function computeIndices() { | ||
this.programs.forEach(function (program) { | ||
if (typeof program.computeIndices === 'function') program.computeIndices(); | ||
}); | ||
} | ||
}, { | ||
key: 'bufferData', | ||
value: function bufferData() { | ||
this.programs.forEach(function (program) { | ||
return program.bufferData(); | ||
}); | ||
} | ||
}, { | ||
key: 'render', | ||
value: function render() { | ||
var args = arguments; | ||
this.programs.forEach(function (program) { | ||
program.bind(); | ||
program.bufferData(); | ||
program.render.apply(program, _toConsumableArray(args)); | ||
}); | ||
} | ||
}]); | ||
return CompoundProgram; | ||
}(); | ||
} |
@@ -1,14 +0,14 @@ | ||
var path = require('path'); | ||
var path = require('path'), | ||
glob = require('glob'); | ||
var shaders = glob.sync(path.join(__dirname, 'src', 'renderers', 'webgl', 'shaders', '*.glsl')); | ||
var entry = {}; | ||
shaders.forEach(function(p) { | ||
entry[path.basename(p, '.glsl')] = p; | ||
}); | ||
module.exports = { | ||
entry: { | ||
'node.vert': './src/renderers/webgl/shaders/node.vert.glsl', | ||
'node.fast.vert': './src/renderers/webgl/shaders/node.fast.vert.glsl', | ||
'edge.vert': './src/renderers/webgl/shaders/edge.vert.glsl', | ||
'edge.fast.vert': './src/renderers/webgl/shaders/edge.fast.vert.glsl', | ||
'node.frag': './src/renderers/webgl/shaders/node.frag.glsl', | ||
'node.fast.frag': './src/renderers/webgl/shaders/node.fast.frag.glsl', | ||
'edge.frag': './src/renderers/webgl/shaders/edge.frag.glsl', | ||
'edge.fast.frag': './src/renderers/webgl/shaders/edge.fast.frag.glsl' | ||
}, | ||
entry: entry, | ||
output: { | ||
@@ -15,0 +15,0 @@ path: path.join(__dirname, 'renderers', 'webgl', 'shaders'), |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
455992
50
7012
21
+ Addedevents@2.1.0(transitive)
- Removedevents@1.1.1(transitive)
Updatedevents@^2.0.0