Comparing version 2.0.0-alpha7-labelgrid to 2.0.0-alpha8
@@ -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(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,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(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),l=r.slice(),n=l.length,h=0;h<n;h++)l[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,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),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){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.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),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?("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,u.assign)({},c,t);var n="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 i.nextFrame=null,i.setState(e),void("function"==typeof r&&r());var l=n(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),i.setState(u),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){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(l);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,l=(0,a.identity)(),u=(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)(l,u),(0,a.multiply)(l,c),(0,a.multiply)(l,f),l=(0,a.multiply)(d,l)}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(20),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 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,l=e<a;return h?l?y:b:l?_: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,l=t[n+v],u=t[n+g],c=t[n+p],d=t[n+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,i<e-1&&(r.push(h,i+1),r.push(s,i+1),r.push(a,i+1),r.push(o,i+1))}}function l(e,t,r,i,n,a,s){for(var h=n-s,l=a-s,u=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,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]),M=o(h,l,u,t[_+v],t[_+g],t[_+p],t[_+m]),O=o(h,l,u,t[x+v],t[x+g],t[x+p],t[x+m]),P=w+E+M+O;if(0===P)throw new Error("sigma/quadtree.insertNode: no collision (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(3===P)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+c+", key: "+i+", x: "+n+", y: "+a+", size: "+s+").");if(P>1)return r[d]=r[d]||[],void r[d].push(i);c++,w&&(d=y),E&&(d=b),M&&(d=_),O&&(d=x)}}function u(e,t,r,i,n,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(i,n,o,s,t[y+v],t[y+g],t[y+p],t[y+m]),E=a(i,n,o,s,t[b+v],t[b+g],t[b+p],t[b+m]),M=a(i,n,o,s,t[_+v],t[_+g],t[_+p],t[_+m]),O=a(i,n,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),M&&h.push(_,c+1),O&&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 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,g=1,p=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 l(d,this.data,this.containers,e,t,r,i),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=[],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+g],this.data[i+p],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=u(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),l=r(15),u=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,l.getMouseCoords)(e))}}},{key:"handleDoubleClick",value:function(e){if(this.enabled){var t=(0,l.getCenter)(e),r=this.camera.getState(),i=this.camera.abstractDisplayToGraph((0,l.getX)(e)-t.x,(0,l.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,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),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,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),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,l.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,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-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=u},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,l=t.minY,u=(o+h)/2,c=(s+l)/2,f="outside"===r?Math.max(n/Math.max(o-h,1),i/Math.max(s-l,1)):Math.min(n/Math.max(o-h,1),i/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=i,t.getPixelRatio=n,t.createRescalingFunction=o;var a={mode:"inside",margin:0}},function(e,t,r){"use strict";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 n=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}}(),o=r(19),a=function(){function e(t,r,n){i(this,e),this.vertexShaderSource=r,this.fragmentShaderSource=n,this.load(t)}return n(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 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(2),l=i(h),u=r(5),c=i(u),f=r(6),d=i(f),v=r(16),g=i(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 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),l=i(h),u=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 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(),i=-1/0,n=-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>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,g=r.length;v<g;v++){var p=r[v],m=this.getEdgeData(p),y=m.size||1;y>h&&(h=y)}return{maxX:i,maxY:n,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 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,u.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 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=i,t.getY=n,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 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),l=i(h),u=r(2),c=i(u),f=r(6),d=i(f),v=r(5),g=i(v),p=r(17),m=r(18),y=i(m),b=r(23),_=i(b),x=r(9),w=i(x),E=r(26),M=i(E),O=r(4),P=r(7),T=r(3),A=(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,O.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 g.default,i.nodeOrder={},i.nodeDataCache={},i.edgeOrder={},i.rescalingFunction=null,i.width=0,i.height=0,i.highlightedNodes=new Set,i.visibleNodes=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 y.default(i.contexts.nodes)},i.edgePrograms={def:new _.default(i.contexts.edges)},i.resize(),i.camera=new c.default({width:i.width,height:i.height}),i.lastCameraState=i.camera.getState(),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=r.getContext(t?"webgl":"2d",i);return 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],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.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/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],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.y,u.x,u.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],l=e.nodeDataCache[h],u=e.camera.graphToDisplay(l.x,l.y),c=l.size/n;if(t(i.x,i.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 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 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,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*A+"px"),this.elements[a].setAttribute("height",this.height*A+"px"),1!==A&&s.scale(A,A)):(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,T.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,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)}var a=(0,p.getLabelsToDisplay)(this.camera,this.lastCameraState,this.nodeDataCache,this.nodeOrder,n,this.visibleNodes,this.displayedLabels);this.displayedLabels=new Set(a),this.visibleNodes=new Set(n);for(var s=this.contexts.labels,h=Math.pow(t.ratio,.5),l=0,u=a.length;l<u;l++){var c=this.nodeDataCache[a[l]],f=this.camera.graphToDisplay(c.x,c.y),d=f.x,v=f.y,g=c.size/h;(0,w.default)(s,{label:c.label,size:g,x:d,y:v})}return this.renderHighlightedNodes(),this.lastCameraState=t,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,l=o.size/r;(0,M.default)(i,{label:o.label,color:o.color,size:l,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}(l.default);t.default=k},function(e,t,r){"use strict";var i=r(2),n=function(e){return e&&e.__esModule?e:{default:e}}(i),o={width:200,height:150},a={width:400,height:300};t.getLabelsToDisplay=function(e,t,r,i,s,h,l,u){var c=e.getState(),f=e.getDimensions(),d=new n.default(f);d.setState({ratio:c.ratio});var v=c.ratio<t.ratio,g=c.x!==t.x||c.y!==t.x,p=c.ratio>t.ratio,m=!v&&!p&&c.ratio>=1,y=c.ratio>=1.3?a:o;if(m&&0!==l.size)return Array.from(l);for(var b=f.width%y.width,_=y.width+b/Math.floor(f.width/y.width),x=(f.height,y.height+b/Math.floor(f.height/y.height)),w={},E=new Set,M=v||g&&!p?Array.from(l):[],O=0,P=s.length;O<P;O++){var T=s[O],A=r[T];if(!g||v||p||l.has(T)||!h.has(T)){var L=e.graphToDisplay(A.x,A.y),S=(d.graphToDisplay(A.x,A.y),Math.floor(L.x/_)%_),k=Math.floor(L.y/x)%x,D=S+";"+k,R=w[D];if(p&&E.has(D)){if(!l.has(T))continue;var C=r[R[0]];if(A.size>C.size&&(R[0]=T),A.size===C.size){i[T]<i[R[0]]&&(R[0]=T)}}else void 0===R&&(R=[],w[D]=R),l.has(T)&&E.add(D),R.push(T)}}for(var F in w){var N=w[F];if(!(v||g&&!p)||!E.has(F)){N.sort(function(e,t){var n=r[e],o=r[t];if(n.size<o.size)return 1;if(n.size>o.size)return-1;var a=i[e],s=i[t];return a<s?1:a>s?-1:0});for(var j=0,z=N.length;j<1&&j<z;){var U=N[j];M.push(U),j++}}}return M}},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),l=i(h),u=r(3),c=r(21),f=i(c),d=r(22),v=i(d),g=4,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.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,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),i=1*t*g,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/g)}}]),t}(l.default);t.default=p},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],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*i+f*a+d*l,e[2]=c*n+f*s+d*u,e[3]=v*r+g*o+p*h,e[4]=v*i+g*a+p*l,e[5]=v*n+g*s+p*u,e[6]=m*r+y*o+b*h,e[7]=m*i+y*a+b*l,e[8]=m*n+y*s+b*u,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),l=i(h),u=r(3),c=r(24),f=i(c),d=r(25),v=i(d),g=6,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(),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 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:"allocate",value:function(e){this.array=new Float32Array(4*g*e)}},{key:"process",value:function(e,t,r,i){if(e.hidden||t.hidden||r.hidden)for(var n=y+4*g;y<n;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*i,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),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/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 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),l=Math.round(9);e.moveTo(i,n+l),e.moveTo(i,n+l),e.arcTo(i,n,i+l,n,l),e.lineTo(i+o,n),e.lineTo(i+o,n+s),e.lineTo(i+l,n+s),e.arcTo(i,n+s,i,n+s-l,l),e.lineTo(i,n+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=n;var o=r(27),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){"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}])}); |
{ | ||
"name": "sigma", | ||
"version": "2.0.0-alpha7-labelgrid", | ||
"version": "2.0.0-alpha8", | ||
"description": "A JavaScript library dedicated to graph drawing.", | ||
@@ -5,0 +5,0 @@ "homepage": "http://sigmajs.org", |
@@ -33,4 +33,2 @@ 'use strict'; | ||
// TODO: frustum seems to return too much nodes | ||
// NOTE: this is basically a MX-CIF Quadtree at this point | ||
@@ -37,0 +35,0 @@ // NOTE: need to explore R-Trees for edges |
@@ -25,4 +25,2 @@ 'use strict'; | ||
var _labels = require('../../heuristics/labels'); | ||
var _node = require('./programs/node.fast'); | ||
@@ -125,4 +123,2 @@ | ||
_this.highlightedNodes = new Set(); | ||
_this.visibleNodes = new Set(); | ||
_this.displayedLabels = new Set(); | ||
_this.hoveredNode = null; | ||
@@ -169,3 +165,2 @@ _this.wasRenderedInThisFrame = false; | ||
}); | ||
_this.lastCameraState = _this.camera.getState(); | ||
@@ -220,4 +215,13 @@ // Binding camera events | ||
var context = element.getContext(webgl ? 'webgl' : '2d', contextOptions); | ||
var context = void 0; | ||
if (webgl) { | ||
context = element.getContext('webgl', contextOptions); | ||
// Edge, I am looking right at you... | ||
if (!context) context = element.getContext('experimental-webgl', contextOptions); | ||
} else { | ||
context = element.getContext('2d', contextOptions); | ||
} | ||
this.contexts[id] = context; | ||
@@ -768,7 +772,2 @@ | ||
var worthyLabels = (0, _labels.getLabelsToDisplay)(this.camera, this.lastCameraState, this.nodeDataCache, this.nodeOrder, visibleNodes, this.visibleNodes, this.displayedLabels); | ||
this.displayedLabels = new Set(worthyLabels); | ||
this.visibleNodes = new Set(visibleNodes); | ||
// Drawing labels | ||
@@ -780,4 +779,4 @@ // TODO: POW RATIO is currently default 0.5 and harcoded | ||
for (var i = 0, l = worthyLabels.length; i < l; i++) { | ||
var data = this.nodeDataCache[worthyLabels[i]]; | ||
for (var i = 0, l = visibleNodes.length; i < l; i++) { | ||
var data = this.nodeDataCache[visibleNodes[i]]; | ||
@@ -794,4 +793,3 @@ 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; | ||
@@ -809,5 +807,2 @@ (0, _label2.default)(context, { | ||
// Storing last camera state | ||
this.lastCameraState = cameraState; | ||
return this; | ||
@@ -814,0 +809,0 @@ } |
@@ -80,3 +80,4 @@ 'use strict'; | ||
var x1 = sourceData.x, | ||
var thickness = data.size || 1, | ||
x1 = sourceData.x, | ||
y1 = sourceData.y, | ||
@@ -83,0 +84,0 @@ x2 = targetData.x, |
Sorry, the diff of this file is too big to display
389152
39
6108