UNPKG

sigma

Version:

A JavaScript library dedicated to graph drawing.

1 lines 83.5 kB
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Sigma=e():t.Sigma=e()}(self,(function(){return(()=>{var t={796:t=>{t.exports=function(t,e){var r=e.length;if(0!==r){var i=t.length;t.length+=r;for(var o=0;o<r;o++)t[i+o]=e[o]}}},187:t=>{"use strict";var e,r="object"==typeof Reflect?Reflect:null,i=r&&"function"==typeof r.apply?r.apply:function(t,e,r){return Function.prototype.apply.call(t,e,r)};e=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:function(t){return Object.getOwnPropertyNames(t)};var o=Number.isNaN||function(t){return t!=t};function n(){n.init.call(this)}t.exports=n,t.exports.once=function(t,e){return new Promise((function(r,i){function o(r){t.removeListener(e,n),i(r)}function n(){"function"==typeof t.removeListener&&t.removeListener("error",o),r([].slice.call(arguments))}g(t,e,n,{once:!0}),"error"!==e&&function(t,e,r){"function"==typeof t.on&&g(t,"error",e,{once:!0})}(t,o)}))},n.EventEmitter=n,n.prototype._events=void 0,n.prototype._eventsCount=0,n.prototype._maxListeners=void 0;var a=10;function s(t){if("function"!=typeof t)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}function h(t){return void 0===t._maxListeners?n.defaultMaxListeners:t._maxListeners}function c(t,e,r,i){var o,n,a,c;if(s(r),void 0===(n=t._events)?(n=t._events=Object.create(null),t._eventsCount=0):(void 0!==n.newListener&&(t.emit("newListener",e,r.listener?r.listener:r),n=t._events),a=n[e]),void 0===a)a=n[e]=r,++t._eventsCount;else if("function"==typeof a?a=n[e]=i?[r,a]:[a,r]:i?a.unshift(r):a.push(r),(o=h(t))>0&&a.length>o&&!a.warned){a.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=a.length,c=l,console&&console.warn&&console.warn(c)}return t}function l(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function u(t,e,r){var i={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},o=l.bind(i);return o.listener=r,i.wrapFn=o,o}function d(t,e,r){var i=t._events;if(void 0===i)return[];var o=i[e];return void 0===o?[]:"function"==typeof o?r?[o.listener||o]:[o]:r?function(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}(o):p(o,o.length)}function f(t){var e=this._events;if(void 0!==e){var r=e[t];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(t,e){for(var r=new Array(e),i=0;i<e;++i)r[i]=t[i];return r}function g(t,e,r,i){if("function"==typeof t.on)i.once?t.once(e,r):t.on(e,r);else{if("function"!=typeof t.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t);t.addEventListener(e,(function o(n){i.once&&t.removeEventListener(e,o),r(n)}))}}Object.defineProperty(n,"defaultMaxListeners",{enumerable:!0,get:function(){return a},set:function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");a=t}}),n.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},n.prototype.setMaxListeners=function(t){if("number"!=typeof t||t<0||o(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this},n.prototype.getMaxListeners=function(){return h(this)},n.prototype.emit=function(t){for(var e=[],r=1;r<arguments.length;r++)e.push(arguments[r]);var o="error"===t,n=this._events;if(void 0!==n)o=o&&void 0===n.error;else if(!o)return!1;if(o){var a;if(e.length>0&&(a=e[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var h=n[t];if(void 0===h)return!1;if("function"==typeof h)i(h,this,e);else{var c=h.length,l=p(h,c);for(r=0;r<c;++r)i(l[r],this,e)}return!0},n.prototype.addListener=function(t,e){return c(this,t,e,!1)},n.prototype.on=n.prototype.addListener,n.prototype.prependListener=function(t,e){return c(this,t,e,!0)},n.prototype.once=function(t,e){return s(e),this.on(t,u(this,t,e)),this},n.prototype.prependOnceListener=function(t,e){return s(e),this.prependListener(t,u(this,t,e)),this},n.prototype.removeListener=function(t,e){var r,i,o,n,a;if(s(e),void 0===(i=this._events))return this;if(void 0===(r=i[t]))return this;if(r===e||r.listener===e)0==--this._eventsCount?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,r.listener||e));else if("function"!=typeof r){for(o=-1,n=r.length-1;n>=0;n--)if(r[n]===e||r[n].listener===e){a=r[n].listener,o=n;break}if(o<0)return this;0===o?r.shift():function(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}(r,o),1===r.length&&(i[t]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",t,a||e)}return this},n.prototype.off=n.prototype.removeListener,n.prototype.removeAllListeners=function(t){var e,r,i;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[t]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[t]),this;if(0===arguments.length){var o,n=Object.keys(r);for(i=0;i<n.length;++i)"removeListener"!==(o=n[i])&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(e=r[t]))this.removeListener(t,e);else if(void 0!==e)for(i=e.length-1;i>=0;i--)this.removeListener(t,e[i]);return this},n.prototype.listeners=function(t){return d(this,t,!0)},n.prototype.rawListeners=function(t){return d(this,t,!1)},n.listenerCount=function(t,e){return"function"==typeof t.listenerCount?t.listenerCount(e):f.call(t,e)},n.prototype.listenerCount=f,n.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},886:(t,e,r)=>{var i=r(868);function o(t,e){if(!i(t))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,o,n,a=[].concat(e),s={};for(n=0;n<a.length;n++)o=a[n],s[o]=[1/0,-1/0];return t.forEachNode((function(t,e){for(n=0;n<a.length;n++)o=a[n],(r=e[o])<s[o][0]&&(s[o][0]=r),r>s[o][1]&&(s[o][1]=r)})),"string"==typeof e?s[e]:s}var n=o;n.nodeExtent=o,n.edgeExtent=function(t,e){if(!i(t))throw new Error("graphology-metrics/extent: the given graph is not a valid graphology instance.");var r,o,n,a=[].concat(e),s={};for(n=0;n<a.length;n++)o=a[n],s[o]=[1/0,-1/0];return t.forEachEdge((function(t,e){for(n=0;n<a.length;n++)o=a[n],(r=e[o])<s[o][0]&&(s[o][0]=r),r>s[o][1]&&(s[o][1]=r)})),"string"==typeof e?s[e]:s},t.exports=n},868:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},186:t=>{t.exports=function(t){return null!==t&&"object"==typeof t&&"function"==typeof t.addUndirectedEdgeWithKey&&"function"==typeof t.dropNode&&"boolean"==typeof t.multi}},973:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="precision mediump float;\n\nvarying vec4 v_color;\n\nvoid main(void) {\n gl_FragColor = v_color;\n}\n"},912:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute float a_radius;\nattribute vec4 a_color;\nattribute vec3 a_barycentric;\n\nuniform mat3 u_matrix;\nuniform float u_scale;\nuniform float u_cameraRatio;\nuniform float u_viewportRatio;\nuniform float u_thicknessRatio;\n\nvarying vec4 v_color;\n\nconst float arrowHeadLengthThicknessRatio = 2.5;\nconst float arrowHeadWidthLengthRatio = 0.66;\nconst float minThickness = 0.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in screen space:\n float thickness = a_thickness * u_thicknessRatio * u_scale * u_viewportRatio / 2.0;\n thickness = max(thickness, minThickness * u_viewportRatio);\n\n float nodeRadius = a_radius * u_thicknessRatio * u_viewportRatio * u_cameraRatio;\n float arrowHeadLength = thickness * 2.0 * arrowHeadLengthThicknessRatio * u_cameraRatio;\n float arrowHeadHalfWidth = arrowHeadWidthLengthRatio * arrowHeadLength / 2.0;\n\n float da = a_barycentric.x;\n float db = a_barycentric.y;\n float dc = a_barycentric.z;\n\n vec2 delta = vec2(\n da * ((nodeRadius) * a_normal.y)\n + db * ((nodeRadius + arrowHeadLength) * a_normal.y + arrowHeadHalfWidth * a_normal.x)\n + dc * ((nodeRadius + arrowHeadLength) * a_normal.y - arrowHeadHalfWidth * a_normal.x),\n\n da * (-(nodeRadius) * a_normal.x)\n + db * (-(nodeRadius + arrowHeadLength) * a_normal.x + arrowHeadHalfWidth * a_normal.y)\n + dc * (-(nodeRadius + arrowHeadLength) * a_normal.x - arrowHeadHalfWidth * a_normal.y)\n );\n\n vec2 position = (u_matrix * vec3(a_position + delta, 1)).xy;\n\n gl_Position = vec4(position, 0, 1);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},620:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\nattribute float a_radius;\n\nuniform mat3 u_matrix;\nuniform float u_scale;\nuniform float u_cameraRatio;\nuniform float u_viewportRatio;\nuniform float u_thicknessRatio;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float arrowHeadLengthThicknessRatio = 2.5;\nconst float minThickness = 0.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in screen space:\n float thickness = a_thickness * u_thicknessRatio * u_scale * u_viewportRatio / 2.0;\n thickness = max(thickness, minThickness * u_viewportRatio);\n\n float direction = sign(a_radius);\n float nodeRadius = direction * a_radius * u_thicknessRatio * u_viewportRatio;\n float arrowHeadLength = thickness * 2.0 * arrowHeadLengthThicknessRatio;\n\n vec2 arrowHeadVector = vec2(-direction * a_normal.y, direction * a_normal.x);\n\n // Add normal vector to the position in screen space, but correct thickness first:\n vec2 position = a_position + a_normal * thickness * u_cameraRatio;\n // Add vector that corrects the arrow head length:\n position = position + arrowHeadVector * (arrowHeadLength + nodeRadius) * u_cameraRatio;\n // Apply camera\n position = (u_matrix * vec3(position, 1)).xy;\n\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},498:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="precision mediump float;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float feather = 0.001;\nconst vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n\nvoid main(void) {\n float dist = length(v_normal) * v_thickness;\n\n float t = smoothstep(\n v_thickness - feather,\n v_thickness,\n dist\n );\n\n gl_FragColor = mix(v_color, color0, t);\n}\n"},223:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="attribute vec2 a_position;\nattribute vec2 a_normal;\nattribute float a_thickness;\nattribute vec4 a_color;\n\nuniform mat3 u_matrix;\nuniform float u_scale;\nuniform float u_cameraRatio;\nuniform float u_viewportRatio;\nuniform float u_thicknessRatio;\n\nvarying vec4 v_color;\nvarying vec2 v_normal;\nvarying float v_thickness;\n\nconst float minThickness = 0.8;\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n // Computing thickness in screen space:\n float thickness = a_thickness * u_thicknessRatio * u_scale * u_viewportRatio / 2.0;\n thickness = max(thickness, minThickness * u_viewportRatio);\n\n // Add normal vector to the position in screen space, but correct thickness first:\n vec2 position = (u_matrix * vec3(a_position + a_normal * thickness * u_cameraRatio, 1)).xy;\n\n gl_Position = vec4(position, 0, 1);\n\n v_normal = a_normal;\n v_thickness = thickness;\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},262:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="precision mediump float;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float radius = 0.5;\n\nvoid main(void) {\n vec4 color0 = vec4(0.0, 0.0, 0.0, 0.0);\n vec2 m = gl_PointCoord - vec2(0.5, 0.5);\n float dist = radius - length(m);\n\n float t = 0.0;\n if (dist > v_border)\n t = 1.0;\n else if (dist > 0.0)\n t = dist / v_border;\n\n gl_FragColor = mix(color0, v_color, t);\n}\n"},106:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});const i="attribute vec2 a_position;\nattribute float a_size;\nattribute vec4 a_color;\n\nuniform float u_ratio;\nuniform float u_scale;\nuniform mat3 u_matrix;\n\nvarying vec4 v_color;\nvarying float v_border;\n\nconst float bias = 255.0 / 254.0;\n\nvoid main() {\n\n gl_Position = vec4(\n (u_matrix * vec3(a_position, 1)).xy,\n 0,\n 1\n );\n\n // Multiply the point size twice:\n // - x SCALING_RATIO to correct the canvas scaling\n // - x 2 to correct the formulae\n gl_PointSize = a_size * u_ratio * u_scale * 2.0;\n\n v_border = (1.0 / u_ratio) * (0.5 / a_size);\n\n // Extract the color:\n v_color = a_color;\n v_color.a *= bias;\n}\n"},764:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),n=this&&this.__assign||function(){return(n=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var o in e=arguments[r])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t}).apply(this,arguments)},a=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,o,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var h=r(187),c=r(751),l=s(r(358)),u=r(928),d=1.5,f=function(t){function e(){var e=t.call(this)||this;return e.x=.5,e.y=.5,e.angle=0,e.ratio=1,e.nextFrame=null,e.enabled=!0,e.previousState=e.getState(),e}return o(e,t),e.from=function(t){return(new e).setState(t)},e.prototype.enable=function(){return this.enabled=!0,this},e.prototype.disable=function(){return this.enabled=!1,this},e.prototype.getState=function(){return{x:this.x,y:this.y,angle:this.angle,ratio:this.ratio}},e.prototype.getPreviousState=function(){var t=this.previousState;return{x:t.x,y:t.y,angle:t.angle,ratio:t.ratio}},e.prototype.isAnimated=function(){return!!this.nextFrame},e.prototype.framedGraphToViewport=function(t,e){var r=Math.min(t.width,t.height),i=r/t.width,o=r/t.height,n=this.ratio/r,a=(e.x-this.x)/n,s=(this.y-e.y)/n;return{x:a*Math.cos(this.angle)-s*Math.sin(this.angle)+r/2/i,y:s*Math.cos(this.angle)+a*Math.sin(this.angle)+r/2/o}},e.prototype.viewportToFramedGraph=function(t,e){var r,i=Math.min(t.width,t.height),o=i/t.width,n=i/t.height,s=this.ratio/i,h=e.x-i/2/o,c=e.y-i/2/n;return h=(r=a([h*Math.cos(-this.angle)-c*Math.sin(-this.angle),c*Math.cos(-this.angle)+h*Math.sin(-this.angle)],2))[0],c=r[1],{x:h*s+this.x,y:-c*s+this.y}},e.prototype.viewRectangle=function(t){var e=0*t.width/8,r=0*t.height/8,i=this.viewportToFramedGraph(t,{x:0-e,y:0-r}),o=this.viewportToFramedGraph(t,{x:t.width+e,y:0-r}),n=this.viewportToFramedGraph(t,{x:0,y:t.height+r});return{x1:i.x,y1:i.y,x2:o.x,y2:o.y,height:o.y-n.y}},e.prototype.setState=function(t){return this.enabled?(this.previousState=this.getState(),t.x&&(this.x=t.x),t.y&&(this.y=t.y),t.angle&&(this.angle=t.angle),t.ratio&&(this.ratio=t.ratio),this.emit("updated",this.getState()),this):this},e.prototype.getViewportZoomedState=function(t,e,r){var i=r/this.ratio,o={x:e.width/2,y:e.height/2},a=this.viewportToFramedGraph(e,t),s=this.viewportToFramedGraph(e,o);return n(n({},this.getState()),{x:(a.x-s.x)*(1-i)+this.x,y:(a.y-s.y)*(1-i)+this.y,ratio:r})},e.prototype.animate=function(t,e,r){var i=this;if(this.enabled){var o=Object.assign({},c.ANIMATE_DEFAULTS,e),n="function"==typeof o.easing?o.easing:l.default[o.easing],a=Date.now(),s=this.getState(),h=function(){var e=(Date.now()-a)/o.duration;if(e>=1)return i.nextFrame=null,i.setState(t),void(i.animationCallback&&(i.animationCallback.call(null),i.animationCallback=void 0));var r=n(e),c={};t.x&&(c.x=s.x+(t.x-s.x)*r),t.y&&(c.y=s.y+(t.y-s.y)*r),t.angle&&(c.angle=s.angle+(t.angle-s.angle)*r),t.ratio&&(c.ratio=s.ratio+(t.ratio-s.ratio)*r),i.setState(c),i.nextFrame=u.requestFrame(h)};this.nextFrame?(u.cancelFrame(this.nextFrame),this.animationCallback&&this.animationCallback.call(null),this.nextFrame=u.requestFrame(h)):h(),this.animationCallback=r}},e.prototype.animatedZoom=function(t){if(t){if("number"==typeof t)return this.animate({ratio:this.ratio/t});this.animate({ratio:this.ratio/(t.factor||d)},t)}else this.animate({ratio:this.ratio/d})},e.prototype.animatedUnzoom=function(t){if(t){if("number"==typeof t)return this.animate({ratio:this.ratio*t});this.animate({ratio:this.ratio*(t.factor||d)},t)}else this.animate({ratio:this.ratio*d})},e.prototype.animatedReset=function(t){this.animate({x:.5,y:.5,ratio:1,angle:0},t)},e.prototype.copy=function(){return e.from(this.getState())},e}(h.EventEmitter);e.default=f},291:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.getWheelDelta=e.getTouchCoords=e.getTouchesArray=e.getMouseCoords=e.getPosition=e.getY=e.getX=void 0;var n=r(187);function a(t){if(void 0!==t.offsetX)return t.offsetX;if(void 0!==t.clientX)return t.clientX;throw new Error("Captor: could not extract x from event.")}function s(t){if(void 0!==t.offsetY)return t.offsetY;if(void 0!==t.clientY)return t.clientY;throw new Error("Captor: could not extract y from event.")}function h(t){return{x:a(t),y:s(t)}}function c(t){for(var e=[],r=0,i=Math.min(t.length,2);r<i;r++)e.push(t[r]);return e}e.getX=a,e.getY=s,e.getPosition=h,e.getMouseCoords=function(t){return{x:a(t),y:s(t),clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,shiftKey:t.shiftKey,preventDefault:t.preventDefault.bind(t),original:t}},e.getTouchesArray=c,e.getTouchCoords=function(t){return{touches:c(t.touches).map(h),ctrlKey:t.ctrlKey,metaKey:t.metaKey,altKey:t.altKey,shiftKey:t.shiftKey,preventDefault:t.preventDefault.bind(t),original:t}},e.getWheelDelta=function(t){if(void 0!==t.deltaY)return-3*t.deltaY/360;if(void 0!==t.detail)return t.detail/-9;throw new Error("Captor: could not extract delta from event.")};var l=function(t){function e(e,r){var i=t.call(this)||this;return i.container=e,i.camera=r,i}return o(e,t),e}(n.EventEmitter);e.default=l},269:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),n=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return a(e,t),e};Object.defineProperty(e,"__esModule",{value:!0});var h=s(r(291)),c=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.enabled=!0,i.draggedEvents=0,i.downStartTime=null,i.lastMouseX=null,i.lastMouseY=null,i.isMouseDown=!1,i.isMoving=!1,i.movingTimeout=null,i.startCameraState=null,i.clicks=0,i.doubleClickTimeout=null,i.currentWheelDirection=0,i.handleClick=i.handleClick.bind(i),i.handleRightClick=i.handleRightClick.bind(i),i.handleDown=i.handleDown.bind(i),i.handleUp=i.handleUp.bind(i),i.handleMove=i.handleMove.bind(i),i.handleWheel=i.handleWheel.bind(i),i.handleOut=i.handleOut.bind(i),e.addEventListener("click",i.handleClick,!1),e.addEventListener("contextmenu",i.handleRightClick,!1),e.addEventListener("mousedown",i.handleDown,!1),e.addEventListener("mousemove",i.handleMove,!1),e.addEventListener("wheel",i.handleWheel,!1),e.addEventListener("mouseout",i.handleOut,!1),document.addEventListener("mouseup",i.handleUp,!1),i}return o(e,t),e.prototype.kill=function(){var t=this.container;t.removeEventListener("click",this.handleClick),t.removeEventListener("contextmenu",this.handleRightClick),t.removeEventListener("mousedown",this.handleDown),t.removeEventListener("mousemove",this.handleMove),t.removeEventListener("wheel",this.handleWheel),t.removeEventListener("mouseout",this.handleOut),document.removeEventListener("mouseup",this.handleUp)},e.prototype.handleClick=function(t){var e=this;if(this.enabled){if(this.clicks++,2===this.clicks)return this.clicks=0,"number"==typeof this.doubleClickTimeout&&(clearTimeout(this.doubleClickTimeout),this.doubleClickTimeout=null),this.handleDoubleClick(t);setTimeout((function(){e.clicks=0,e.doubleClickTimeout=null}),300),this.draggedEvents<3&&this.emit("click",h.getMouseCoords(t))}},e.prototype.handleRightClick=function(t){this.enabled&&this.emit("rightClick",h.getMouseCoords(t))},e.prototype.handleDoubleClick=function(t){if(this.enabled){var e=this.camera.getState().ratio/2.2;return this.camera.animate(this.camera.getViewportZoomedState({x:h.getX(t),y:h.getY(t)},{width:this.container.offsetWidth,height:this.container.offsetHeight},e),{easing:"quadraticInOut",duration:200}),t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation(),!1}},e.prototype.handleDown=function(t){this.enabled&&(this.startCameraState=this.camera.getState(),this.lastMouseX=h.getX(t),this.lastMouseY=h.getY(t),this.draggedEvents=0,this.downStartTime=Date.now(),t.which,this.isMouseDown=!0,this.emit("mousedown",h.getMouseCoords(t)))},e.prototype.handleUp=function(t){var e=this;if(this.enabled&&this.isMouseDown){this.isMouseDown=!1,"number"==typeof this.movingTimeout&&(clearTimeout(this.movingTimeout),this.movingTimeout=null);var r=h.getX(t),i=h.getY(t),o=this.camera.getState(),n=this.camera.getPreviousState();this.isMoving?this.camera.animate({x:o.x+3*(o.x-n.x),y:o.y+3*(o.y-n.y)},{duration:200,easing:"quadraticOut"}):this.lastMouseX===r&&this.lastMouseY===i||this.camera.setState({x:o.x,y:o.y}),this.isMoving=!1,setTimeout((function(){return e.draggedEvents=0}),0),this.emit("mouseup",h.getMouseCoords(t))}},e.prototype.handleMove=function(t){var e=this;if(this.enabled){if(this.emit("mousemove",h.getMouseCoords(t)),this.isMouseDown){this.isMoving=!0,this.draggedEvents++,"number"==typeof this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){e.movingTimeout=null,e.isMoving=!1}),200);var r={width:this.container.offsetWidth,height:this.container.offsetHeight},i=h.getX(t),o=h.getY(t),n=this.camera.viewportToFramedGraph(r,{x:this.lastMouseX,y:this.lastMouseY}),a=this.camera.viewportToFramedGraph(r,{x:i,y:o}),s=n.x-a.x,c=n.y-a.y,l=this.camera.getState(),u=l.x+s,d=l.y+c;this.camera.setState({x:u,y:d}),this.lastMouseX=i,this.lastMouseY=o}return t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation(),!1}},e.prototype.handleWheel=function(t){var e=this;if(t.preventDefault?t.preventDefault():t.returnValue=!1,t.stopPropagation(),!this.enabled)return!1;var r=h.getWheelDelta(t);if(!r)return!1;var i=r>0?1/1.7:1.7,o=this.camera.getState().ratio*i,n=r>0?1:-1,a=Date.now();return this.currentWheelDirection===n&&this.lastWheelTriggerTime&&a-this.lastWheelTriggerTime<50||(this.camera.animate(this.camera.getViewportZoomedState({x:h.getX(t),y:h.getY(t)},{width:this.container.offsetWidth,height:this.container.offsetHeight},o),{easing:"quadraticOut",duration:250},(function(){e.currentWheelDirection=0})),this.currentWheelDirection=n,this.lastWheelTriggerTime=a),!1},e.prototype.handleOut=function(){},e}(h.default);e.default=c},508:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),n=this&&this.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r),Object.defineProperty(t,i,{enumerable:!0,get:function(){return e[r]}})}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),a=this&&this.__setModuleDefault||(Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e}),s=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)"default"!==r&&Object.prototype.hasOwnProperty.call(t,r)&&n(e,t,r);return a(e,t),e},h=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,o,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var l=s(r(291)),u=c(r(764)),d=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.enabled=!0,i.isMoving=!1,i.touchMode=0,i.handleStart=i.handleStart.bind(i),i.handleLeave=i.handleLeave.bind(i),i.handleMove=i.handleMove.bind(i),e.addEventListener("touchstart",i.handleStart,!1),e.addEventListener("touchend",i.handleLeave,!1),e.addEventListener("touchcancel",i.handleLeave,!1),e.addEventListener("touchmove",i.handleMove,!1),i}return o(e,t),e.prototype.kill=function(){var t=this.container;t.removeEventListener("touchstart",this.handleStart),t.removeEventListener("touchend",this.handleLeave),t.removeEventListener("touchcancel",this.handleLeave),t.removeEventListener("touchmove",this.handleMove)},e.prototype.getDimensions=function(){return{width:this.container.offsetWidth,height:this.container.offsetHeight}},e.prototype.dispatchRelatedMouseEvent=function(t,e,r,i){var o=r||l.getPosition(e.touches[0]),n=new MouseEvent(t,{clientX:o.x,clientY:o.y,altKey:e.altKey,ctrlKey:e.ctrlKey});(i||this.container).dispatchEvent(n)},e.prototype.handleStart=function(t){if(this.enabled){t.preventDefault(),1===t.touches.length&&this.dispatchRelatedMouseEvent("mousedown",t);var e=l.getTouchesArray(t.touches);if(this.isMoving=!0,this.touchMode=e.length,this.startCameraState=this.camera.getState(),this.startTouchesPositions=e.map(l.getPosition),this.lastTouchesPositions=this.startTouchesPositions,2===this.touchMode){var r=h(this.startTouchesPositions,2),i=r[0],o=i.x,n=i.y,a=r[1],s=a.x,c=a.y;this.startTouchesAngle=Math.atan2(c-n,s-o),this.startTouchesDistance=Math.sqrt(Math.pow(s-o,2)+Math.pow(c-n,2))}this.emit("touchdown",l.getTouchCoords(t))}},e.prototype.handleLeave=function(t){if(this.enabled){switch(t.preventDefault(),0===t.touches.length&&this.lastTouchesPositions&&this.lastTouchesPositions.length&&(this.dispatchRelatedMouseEvent("mouseup",t,this.lastTouchesPositions[0],document),this.dispatchRelatedMouseEvent("click",t,this.lastTouchesPositions[0])),this.movingTimeout&&(this.isMoving=!1,clearTimeout(this.movingTimeout)),this.touchMode){case 2:if(1===t.touches.length){this.handleStart(t),t.preventDefault();break}case 1:if(this.isMoving){var e=this.camera.getState(),r=this.camera.getPreviousState();this.camera.animate({x:e.x+3*(e.x-r.x),y:e.y+3*(e.y-r.y)},{duration:200,easing:"quadraticOut"})}this.isMoving=!1,this.touchMode=0}this.emit("touchup",l.getTouchCoords(t))}},e.prototype.handleMove=function(t){var e,r=this;if(this.enabled){t.preventDefault(),1===t.touches.length&&this.dispatchRelatedMouseEvent("mousemove",t);var i=this.startCameraState,o=l.getTouchesArray(t.touches).map(l.getPosition);switch(this.lastTouchesPositions=o,this.isMoving=!0,this.movingTimeout&&clearTimeout(this.movingTimeout),this.movingTimeout=window.setTimeout((function(){r.isMoving=!1}),200),this.touchMode){case 1:var n=this.camera.viewportToFramedGraph(this.getDimensions(),(this.startTouchesPositions||[])[0]),a=n.x,s=n.y,c=this.camera.viewportToFramedGraph(this.getDimensions(),o[0]),d=c.x,f=c.y;this.camera.setState({x:i.x+a-d,y:i.y+s-f});break;case 2:var p={},g=o[0],v=g.x,m=g.y,y=o[1],_=y.x,b=y.y,w=Math.atan2(b-m,_-v)-this.startTouchesAngle,x=Math.hypot(b-m,_-v)/this.startTouchesDistance;p.ratio=i.ratio/x,p.angle=i.angle+w;var L=this.getDimensions(),E=u.default.from(i).viewportToFramedGraph(L,(this.startTouchesPositions||[])[0]),A=Math.min(L.width,L.height),T=A/L.width,P=A/L.height,M=p.ratio/A;f=m-A/2/P,d=(e=h([(d=v-A/2/T)*Math.cos(-p.angle)-f*Math.sin(-p.angle),f*Math.cos(-p.angle)+d*Math.sin(-p.angle)],2))[0],f=e[1],p.x=E.x-d*M,p.y=E.y+f*M,this.camera.setState(p)}this.emit("touchmove",l.getTouchCoords(t))}},e}(l.default);e.default=d},730:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.edgeLabelsToDisplayFromNodes=e.labelsToDisplayFromGrid=void 0;var o=i(r(764)),n={width:250,height:175},a={width:400,height:300};e.labelsToDisplayFromGrid=function(t){var e=t.cache,r=t.camera,i=t.cell,s=t.dimensions,h=t.displayedLabels,c=t.fontSize,l=void 0===c?14:c,u=t.graph,d=t.renderedSizeThreshold,f=void 0===d?-1/0:d,p=t.visibleNodes,g=r.getState(),v=r.getPreviousState(),m=new o.default;m.setState(v);var y=Math.pow(g.ratio,.5),_=g.ratio<v.ratio,b=g.x!==v.x||g.y!==v.y,w=g.ratio>v.ratio,x=b&&!_&&!w&&g.ratio>=1,L=b&&h.size&&!_&&!w;if(w&&Math.trunc(100*g.ratio)%5!=0)return Array.from(h);if(x&&0!==h.size)return Array.from(h);if(_&&g.ratio>=1)return Array.from(h);var E=i||n;g.ratio>=1.3&&(E=a);for(var A=s.width%E.width,T=E.width+A/Math.floor(s.width/E.width),P=s.height%E.height,M=E.height+P/Math.floor(s.height/E.height),C=s.width+T,R=s.height+M,S=-T,O=-M,N=s.width+T/2,F=s.height+M/2,D=-T/2,k=-M/2,j=[],U={},I=-1/0,z=null,G=0,B=p.length;G<B;G++){var H=e[et=p[G]];if(!(H.hidden||H.size/y<f)){var Y=r.framedGraphToViewport(s,H);if(!(Y.x<S||Y.x>C||Y.y<O||Y.y>R)){if(H.size>I&&(I=H.size,z=et),L){var W=m.framedGraphToViewport(s,H);if(W.x>=D&&W.x<=N&&W.y>=k&&W.y<=F&&!h.has(et))continue}if(void 0===U[tt=Math.floor(Y.x/T)+"§"+Math.floor(Y.y/M)])U[tt]=et;else{var V=U[tt],q=e[V];if(h.size>0){var K=h.has(et),X=h.has(V);if(!K&&X)continue;if(K&&!X){U[tt]=et;continue}if((L||_)&&K&&X){j.push(et);continue}}var Q=!1;if(H.size>q.size)Q=!0;else if(H.size===q.size){var Z=u.degree(et),$=u.degree(V);(Z>$||Z===$&&et>V)&&(Q=!0)}Q&&(U[tt]=et)}}}}var J=j.some((function(t){return t===z}));for(var tt in U){var et;(et=U[tt])===z&&(J=!0),j.push(et)}!J&&z&&j.push(z);var rt,it,ot,nt,at,st,ht=new Set;for(G=0,B=j.length;G<B;G++){var ct=e[K=j[G]],lt=r.framedGraphToViewport(s,ct);if(!ht.has(K))for(var ut=G+1;ut<B;ut++){var dt=e[X=j[ut]],ft=r.framedGraphToViewport(s,dt);rt=lt.x,it=lt.y,ot=8*ct.label.length,nt=l,at=ft.x,st=ft.y,rt<at+8*dt.label.length&&rt+ot>at&&it<st+l&&it+nt>st&&(ct.size<dt.size?ht.add(K):ht.add(X))}}return j.filter((function(t){return!ht.has(t)}))},e.edgeLabelsToDisplayFromNodes=function(t){var e=t.nodeDataCache,r=t.edgeDataCache,i=t.graph,o=t.hoveredNode,n=t.highlightedNodes,a=t.displayedNodeLabels,s=new Set,h=Array.from(a),c=Array.from(n);o&&!n.has(o)&&c.push(o);for(var l=0;l<c.length;l++)for(var u=c[l],d=i.edges(u),f=0;f<d.length;f++){var p=d[f],g=i.extremities(p),v=e[g[0]],m=e[g[1]];r[p].hidden&&v.hidden&&m.hidden&&s.add(p)}for(l=0;l<h.length;l++)for(u=h[l],d=i.outboundEdges(u),f=0;f<d.length;f++)!r[d[f]].hidden&&a.has(i.opposite(u,d[f]))&&s.add(d[f]);return Array.from(s)}},134:function(t,e,r){"use strict";var i=this&&this.__read||function(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,o,n=r.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(i=n.next()).done;)a.push(i.value)}catch(t){o={error:t}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return a},o=this&&this.__spreadArray||function(t,e){for(var r=0,i=e.length,o=t.length;r<i;r++,o++)t[o]=e[r];return t},n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.rectangleCollidesWithQuad=e.squareCollidesWithQuad=e.getCircumscribedAlignedRectangle=e.isRectangleAligned=void 0;var a=n(r(796));function s(t){return t.x1===t.x2||t.y1===t.y2}function h(t){var e=Math.sqrt(Math.pow(t.x2-t.x1,2)+Math.pow(t.y2-t.y1,2)),r=(t.y1-t.y2)*t.height/e,i=(t.x2-t.x1)*t.height/e,o={x:t.x1,y:t.y1},n={x:t.x2,y:t.y2},a={x:t.x1+r,y:t.y1+i},s={x:t.x2+r,y:t.y2+i},h=Math.min(o.x,n.x,a.x,s.x),c=Math.max(o.x,n.x,a.x,s.x),l=Math.min(o.y,n.y,a.y,s.y);return{x1:h,y1:l,x2:c,y2:l,height:Math.max(o.y,n.y,a.y,s.y)-l}}function c(t,e,r,i,o,n,a){return t<i+n&&t+r>i&&e<o+a&&e+r>o}function l(t,e,r,i,o,n,a,s){return t<o+a&&t+r>o&&e<n+s&&e+i>n}function u(t,e,r,i,o,n){var a=t<r+o/2;return e<i+n/2?a?1:2:a?3:4}e.isRectangleAligned=s,e.getCircumscribedAlignedRectangle=h,e.squareCollidesWithQuad=c,e.rectangleCollidesWithQuad=l;var d=function(){function t(t){void 0===t&&(t={}),this.containers={},this.cache=null,this.lastRectangle=null;var e=Math.pow(4,5);this.data=new Float32Array((4*e-1)/3*4),t.boundaries?this.resize(t.boundaries):this.resize({x:0,y:0,width:1,height:1})}return t.prototype.add=function(t,e,r,i){return function(t,e,r,i,o,n,a){for(var s=o-a,h=n-a,l=2*a,u=0,d=0;;){if(u>=5)return r[d]=r[d]||[],void r[d].push(i);var f=4*d+4,p=4*d+8,g=4*d+12,v=4*d+16,m=c(s,h,l,e[f+0],e[f+1],e[f+2],e[f+3]),y=c(s,h,l,e[p+0],e[p+1],e[p+2],e[p+3]),_=c(s,h,l,e[g+0],e[g+1],e[g+2],e[g+3]),b=c(s,h,l,e[v+0],e[v+1],e[v+2],e[v+3]),w=[m,y,_,b].reduce((function(t,e){return e?t+1:t}),0);if(0===w)throw new Error("sigma/quadtree.insertNode: no collision (level: "+u+", key: "+i+", x: "+o+", y: "+n+", size: "+a+").");if(3===w)throw new Error("sigma/quadtree.insertNode: 3 impossible collisions (level: "+u+", key: "+i+", x: "+o+", y: "+n+", size: "+a+").");if(w>1)return r[d]=r[d]||[],void r[d].push(i);u++,m&&(d=f),y&&(d=p),_&&(d=g),b&&(d=v)}}(0,this.data,this.containers,t,e,r,i),this},t.prototype.resize=function(t){this.clear(),this.data[0]=t.x,this.data[1]=t.y,this.data[2]=t.width,this.data[3]=t.height,function(t,e){for(var r=[0,0];r.length;){var i=r.pop(),o=r.pop(),n=4*o+4,a=4*o+8,s=4*o+12,h=4*o+16,c=e[o+0],l=e[o+1],u=e[o+2]/2,d=e[o+3]/2;e[n+0]=c,e[n+1]=l,e[n+2]=u,e[n+3]=d,e[a+0]=c+u,e[a+1]=l,e[a+2]=u,e[a+3]=d,e[s+0]=c,e[s+1]=l+d,e[s+2]=u,e[s+3]=d,e[h+0]=c+u,e[h+1]=l+d,e[h+2]=u,e[h+3]=d,i<4&&(r.push(h,i+1),r.push(s,i+1),r.push(a,i+1),r.push(n,i+1))}}(0,this.data)},t.prototype.clear=function(){return this.containers={},this},t.prototype.point=function(t,e){var r=[],n=0,a=0;do{this.containers[n]&&r.push.apply(r,o([],i(this.containers[n]))),n=4*n+4*u(t,e,this.data[n+0],this.data[n+1],this.data[n+2],this.data[n+3]),a++}while(a<=5);return r},t.prototype.rectangle=function(t,e,r,i,o){var n=this.lastRectangle;return n&&t===n.x1&&r===n.x2&&e===n.y1&&i===n.y2&&o===n.height||(this.lastRectangle={x1:t,y1:e,x2:r,y2:i,height:o},s(this.lastRectangle)||(this.lastRectangle=h(this.lastRectangle)),this.cache=function(t,e,r,i,o,n,s){for(var h,c=[0,0],u=[];c.length;){var d=c.pop(),f=c.pop();if((h=r[f])&&a.default(u,h),!(d>=5)){var p=4*f+4,g=4*f+8,v=4*f+12,m=4*f+16,y=l(i,o,n,s,e[p+0],e[p+1],e[p+2],e[p+3]),_=l(i,o,n,s,e[g+0],e[g+1],e[g+2],e[g+3]),b=l(i,o,n,s,e[v+0],e[v+1],e[v+2],e[v+3]),w=l(i,o,n,s,e[m+0],e[m+1],e[m+2],e[m+3]);y&&c.push(p,d+1),_&&c.push(g,d+1),b&&c.push(v,d+1),w&&c.push(m,d+1)}}return u}(0,this.data,this.containers,t,e,Math.abs(t-r)||Math.abs(e-i),o)),this.cache},t}();e.default=d},607:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.Sigma=e.MouseCaptor=e.QuadTree=e.Camera=void 0;var o=i(r(764));e.Camera=o.default;var n=i(r(134));e.QuadTree=n.default;var a=i(r(269));e.MouseCaptor=a.default;var s=i(r(159));e.Sigma=s.default},942:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r,i,o){var n=o.edgeLabelSize,a=o.edgeLabelFont,s=o.edgeLabelWeight,h=e.label;t.fillStyle=e.color,t.font=s+" "+n+"px "+a;var c,l=t.measureText(h).width,u=(r.x+i.x)/2,d=(r.y+i.y)/2,f=i.x-r.x,p=i.y-r.y,g=Math.sqrt(f*f+p*p);c=f>0?p>0?Math.acos(f/g):Math.asin(p/g):p>0?Math.acos(f/g)+Math.PI:Math.asin(f/g)+Math.PI/2,t.save(),t.translate(u,d),t.rotate(c),t.fillText(h,-l/2,e.size/2+n),t.restore()}},61:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=i(r(52)),n=i(r(622));e.default=function(t,e,r){var i=r.labelSize,a=r.labelFont,s=r.labelWeight;t.font=s+" "+i+"px "+a,t.beginPath(),t.fillStyle="#fff",t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=8,t.shadowColor="#000";var h=t.measureText(e.label).width,c=Math.round(e.x-i/2-2),l=Math.round(e.y-i/2-2),u=Math.round(h+i/2+e.size+9),d=Math.round(i+4),f=Math.round(i/2+2);t.moveTo(c,l+f),t.moveTo(c,l+f),t.arcTo(c,l,c+f,l,f),t.lineTo(c+u,l),t.lineTo(c+u,l+d),t.lineTo(c+f,l+d),t.arcTo(c,l+d,c,l+d-f,f),t.lineTo(c,l+f),t.closePath(),t.fill(),t.shadowOffsetX=0,t.shadowOffsetY=0,t.shadowBlur=0,o.default(t,e),n.default(t,e,r)}},622:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(t,e,r){var i=r.labelSize,o=r.labelFont,n=r.labelWeight;t.fillStyle="#000",t.font=n+" "+i+"px "+o,t.fillText(e.label,e.x+e.size+3,e.y+i/3)}},52:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=2*Math.PI;e.default=function(t,e){t.fillStyle=e.color,t.beginPath(),t.arc(e.x,e.y,e.size,0,r,!0),t.closePath(),t.fill()}},195:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.createEdgeCompoundProgram=e.AbstractEdgeProgram=void 0;var n=function(t){function e(e,r,i,o,n){return t.call(this,e,r,i,o,n)||this}return o(e,t),e}(r(171).AbstractProgram);e.AbstractEdgeProgram=n,e.createEdgeCompoundProgram=function(t){return function(){function e(e){this.programs=t.map((function(t){return new t(e)}))}return e.prototype.bufferData=function(){this.programs.forEach((function(t){return t.bufferData()}))},e.prototype.allocate=function(t){this.programs.forEach((function(e){return e.allocate(t)}))},e.prototype.bind=function(){},e.prototype.computeIndices=function(){this.programs.forEach((function(t){return t.computeIndices()}))},e.prototype.render=function(t){this.programs.forEach((function(e){e.bind(),e.bufferData(),e.render(t)}))},e.prototype.process=function(t,e,r,i,o){this.programs.forEach((function(n){return n.process(t,e,r,i,o)}))},e}()}},909:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(e,"__esModule",{value:!0}),e.createNodeCompoundProgram=e.AbstractNodeProgram=void 0;var n=function(t){function e(e,r,i,o,n){var a=t.call(this,e,r,i,o,n)||this;a.positionLocation=e.getAttribLocation(a.program,"a_position"),a.sizeLocation=e.getAttribLocation(a.program,"a_size"),a.colorLocation=e.getAttribLocation(a.program,"a_color");var s=e.getUniformLocation(a.program,"u_matrix");if(null===s)throw new Error("AbstractNodeProgram: error while getting matrixLocation");a.matrixLocation=s;var h=e.getUniformLocation(a.program,"u_ratio");if(null===h)throw new Error("AbstractNodeProgram: error while getting ratioLocation");a.ratioLocation=h;var c=e.getUniformLocation(a.program,"u_scale");if(null===c)throw new Error("AbstractNodeProgram: error while getting scaleLocation");return a.scaleLocation=c,a}return o(e,t),e.prototype.bind=function(){var t=this.gl;t.enableVertexAttribArray(this.positionLocation),t.enableVertexAttribArray(this.sizeLocation),t.enableVertexAttribArray(this.colorLocation),t.vertexAttribPointer(this.positionLocation,2,t.FLOAT,!1,this.attributes*Float32Array.BYTES_PER_ELEMENT,0),t.vertexAttribPointer(this.sizeLocation,1,t.FLOAT,!1,this.attributes*Float32Array.BYTES_PER_ELEMENT,8),t.vertexAttribPointer(this.colorLocation,4,t.UNSIGNED_BYTE,!0,this.attributes*Float32Array.BYTES_PER_ELEMENT,12)},e}(r(171).AbstractProgram);e.AbstractNodeProgram=n,e.createNodeCompoundProgram=function(t){return function(){function e(e){this.programs=t.map((function(t){return new t(e)}))}return e.prototype.bufferData=function(){this.programs.forEach((function(t){return t.bufferData()}))},e.prototype.allocate=function(t){this.programs.forEach((function(e){return e.allocate(t)}))},e.prototype.bind=function(){},e.prototype.render=function(t){this.programs.forEach((function(e){return e.render(t)}))},e.prototype.process=function(t,e,r){this.programs.forEach((function(i){return i.process(t,e,r)}))},e}()}},171:(t,e,r)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.AbstractProgram=void 0;var i=r(706),o=function(){function t(t,e,r,o,n){this.array=new Float32Array,this.points=o,this.attributes=n,this.gl=t,this.vertexShaderSource=e,this.fragmentShaderSource=r;var a=t.createBuffer();if(null===a)throw new Error("AbstractProgram: error while creating the buffer");this.buffer=a,t.bindBuffer(t.ARRAY_BUFFER,this.buffer),this.vertexShader=i.loadVertexShader(t,this.vertexShaderSource),this.fragmentShader=i.loadFragmentShader(t,this.fragmentShaderSource),this.program=i.loadProgram(t,[this.vertexShader,this.fragmentShader])}return t.prototype.bufferData=function(){var t=this.gl;t.bufferData(t.ARRAY_BUFFER,this.array,t.DYNAMIC_DRAW)},t.prototype.allocate=function(t){this.array=new Float32Array(this.points*this.attributes*t)},t}();e.AbstractProgram=o},569:function(t,e,r){"use strict";var i=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var o=r(195),n=i(r(805)),a=i(r(483)),s=o.createEdgeCompoundProgram([a.default,n.default]);e.default=s},805:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(928),s=n(r(912)),h=n(r(973)),c=r(195),l=10,u=function(t){function e(e){var r=t.call(this,e,s.default,h.default,3,l)||this;r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.radiusLocation=e.getAttribLocation(r.program,"a_radius"),r.barycentricLocation=e.getAttribLocation(r.program,"a_barycentric");var i=e.getUniformLocation(r.program,"u_scale");if(null===i)throw new Error("EdgeArrowHeadProgram: error while getting scaleLocation");r.scaleLocation=i;var o=e.getUniformLocation(r.program,"u_matrix");if(null===o)throw new Error("EdgeArrowHeadProgram: error while getting matrixLocation");r.matrixLocation=o;var n=e.getUniformLocation(r.program,"u_cameraRatio");if(null===n)throw new Error("EdgeArrowHeadProgram: error while getting cameraRatioLocation");r.cameraRatioLocation=n;var a=e.getUniformLocation(r.program,"u_viewportRatio");if(null===a)throw new Error("EdgeArrowHeadProgram: error while getting viewportRatioLocation");r.viewportRatioLocation=a;var c=e.getUniformLocation(r.program,"u_thicknessRatio");if(null===c)throw new Error("EdgeArrowHeadProgram: error while getting thicknessRatioLocation");return r.thicknessRatioLocation=c,r.bind(),r}return o(e,t),e.prototype.bind=function(){var t=this.gl;t.enableVertexAttribArray(this.positionLocation),t.enableVertexAttribArray(this.normalLocation),t.enableVertexAttribArray(this.thicknessLocation),t.enableVertexAttribArray(this.radiusLocation),t.enableVertexAttribArray(this.colorLocation),t.enableVertexAttribArray(this.barycentricLocation),t.vertexAttribPointer(this.positionLocation,2,t.FLOAT,!1,l*Float32Array.BYTES_PER_ELEMENT,0),t.vertexAttribPointer(this.normalLocation,2,t.FLOAT,!1,l*Float32Array.BYTES_PER_ELEMENT,8),t.vertexAttribPointer(this.thicknessLocation,1,t.FLOAT,!1,l*Float32Array.BYTES_PER_ELEMENT,16),t.vertexAttribPointer(this.radiusLocation,1,t.FLOAT,!1,l*Float32Array.BYTES_PER_ELEMENT,20),t.vertexAttribPointer(this.colorLocation,4,t.UNSIGNED_BYTE,!0,l*Float32Array.BYTES_PER_ELEMENT,24),t.vertexAttribPointer(this.barycentricLocation,3,t.FLOAT,!1,l*Float32Array.BYTES_PER_ELEMENT,28)},e.prototype.computeIndices=function(){},e.prototype.process=function(t,e,r,i,o){if(i)for(var n=30*o,s=n+30;n<s;n++)this.array[n]=0;else{var h=r.size||1,c=e.size||1,l=t.x,u=t.y,d=e.x,f=e.y,p=a.floatColor(r.color),g=d-l,v=f-u,m=g*g+v*v,y=0,_=0;m&&(y=-v*(m=1/Math.sqrt(m)),_=g*m);var b=30*o,w=this.array;w[b++]=d,w[b++]=f,w[b++]=-y,w[b++]=-_,w[b++]=h,w[b++]=c,w[b++]=p,w[b++]=1,w[b++]=0,w[b++]=0,w[b++]=d,w[b++]=f,w[b++]=-y,w[b++]=-_,w[b++]=h,w[b++]=c,w[b++]=p,w[b++]=0,w[b++]=1,w[b++]=0,w[b++]=d,w[b++]=f,w[b++]=-y,w[b++]=-_,w[b++]=h,w[b++]=c,w[b++]=p,w[b++]=0,w[b++]=0,w[b]=1}},e.prototype.render=function(t){var e=this.gl,r=this.program;e.useProgram(r),e.uniform1f(this.scaleLocation,t.scalingRatio),e.uniformMatrix3fv(this.matrixLocation,!1,t.matrix),e.uniform1f(this.cameraRatioLocation,t.ratio),e.uniform1f(this.viewportRatioLocation,1/Math.min(t.width,t.height)),e.uniform1f(this.thicknessRatioLocation,1/Math.pow(t.ratio,t.edgesPowRatio)),e.drawArrays(e.TRIANGLES,0,this.array.length/l)},e}(c.AbstractEdgeProgram);e.default=u},483:function(t,e,r){"use strict";var i,o=this&&this.__extends||(i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)},function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}),n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});var a=r(195),s=r(928),h=n(r(620)),c=n(r(498)),l=function(t){function e(e){var r=t.call(this,e,h.default,c.default,4,7)||this,i=e.createBuffer();if(null===i)throw new Error("EdgeClampedProgram: error while getting resolutionLocation");r.indicesBuffer=i,r.positionLocation=e.getAttribLocation(r.program,"a_position"),r.colorLocation=e.getAttribLocation(r.program,"a_color"),r.normalLocation=e.getAttribLocation(r.program,"a_normal"),r.thicknessLocation=e.getAttribLocation(r.program,"a_thickness"),r.radiusLocation=e.getAttribLocation(r.program,"a_radius");var o=e.getUniformLocation(r.program,"u_scale");if(null===o)throw new Error("EdgeClampedProgram: error while getting scaleLocation");r.scaleLocation=o;var n=e.getUniformLocation(r.prog