qgraph
Version:
A Graph Manipulation and Visualization Library
12 lines • 98.9 kB
JavaScript
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("lodash")):"function"==typeof define&&define.amd?define("qgraph",["lodash"],e):"object"==typeof exports?exports.qgraph=e(require("lodash")):t.qgraph=e(t._)}("undefined"!=typeof window?window:this,function(__WEBPACK_EXTERNAL_MODULE__1__){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=6)}([function(t,e,n){"use strict";function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var i=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.x=e,this.y=n}var e,n,i;return e=t,(n=[{key:"clone",value:function(){return new t(this.x,this.y)}},{key:"distance",value:function(t){return Math.sqrt((this.x-t.x)*(this.x-t.x)+(this.y-t.y)*(this.y-t.y))}},{key:"translate",value:function(t){return this.x+=t.x,this.y+=t.y,this}},{key:"scale",value:function(t){return this.x*=t,this.y*=t,this}},{key:"getScaled",value:function(e){return new t(this.x*e,this.y*e)}},{key:"getTranslated",value:function(e){return new t(this.x+e.x,this.y+e.y)}},{key:"getDirection",value:function(e){var n=this.distance(e);return new t((e.x-this.x)/n,(e.y-this.y)/n)}},{key:"rotate",value:function(t){var e=Math.cos(t*Math.PI/180),n=Math.sin(t*Math.PI/180),r=this.x,i=this.y;return this.x=r*e-i*n,this.y=r*n+i*e,this}},{key:"getRotated",value:function(t){return this.clone().rotate(t)}},{key:"dotProduct",value:function(t){return this.x*t.x+this.y*t.y}},{key:"getMidPoint",value:function(e){return new t((this.x+e.x)/2,(this.y+e.y)/2)}},{key:"reverse",value:function(){return this.x=-this.x,this.y=-this.y,this}},{key:"equals",value:function(e){return!!(e&&e instanceof t)&&(this.x===e.x&&this.y===e.y)}},{key:"reflect",value:function(t,e){return e?this.x=2*t.x-this.x:this.y=2*t.y-this.y,this}},{key:"toString",value:function(){return this.x+","+this.y}}])&&r(e.prototype,n),i&&r(e,i),t}();i.W=new i(-1,0),i.N=new i(0,-1),i.S=new i(0,1),i.E=new i(1,0),i.NE=new i(1,-1),i.NW=new i(-1,-1),i.SE=new i(1,1),i.SW=new i(-1,1),e.a=i},function(t,e){t.exports=__WEBPACK_EXTERNAL_MODULE__1__},function(t,e,n){"use strict";n.d(e,"a",function(){return f});var r=n(1),i=n.n(r),o=n(0),a=n(5);function s(t){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return!e||"object"!==s(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var f=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,h(e).apply(this,arguments))}var n,r,s;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,a["a"]),n=e,s=[{key:"getPerimeter",value:function(t,n){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=t.x,a=t.y,s=n.x-i,l=n.y-a,u=Math.atan2(l,s),h=new o.a(0,0),c=Math.PI,f=Math.PI/2-u,p=Math.atan2(t.height,t.width);return u<-c+p||u>c-p?(h.x=t.left,h.y=a-t.width*Math.tan(u)/2):u<-p?(h.y=t.top,h.x=i-t.height*Math.tan(f)/2):u<p?(h.x=t.right,h.y=a+t.width*Math.tan(u)/2):(h.y=t.bottom,h.x=i+t.height*Math.tan(f)/2),r&&(u<-c+p||u>c-p?(h.x=t.left,h.y=a):u<-p?(h.y=t.top,h.x=i):u<p?(h.x=t.right,h.y=a):(h.y=t.bottom,h.x=i)),{point:h,direction:e.getDirection(t,h,r)}}},{key:"getBoundingRectangle",value:function(t,n){if(!t||0===t.length)return null;n=n||[0,0,0,0],i.a.isArray(n)||(n=[n,n,n,n]);for(var r=[t[0].x,t[0].y],o=[t[0].x,t[0].y],a=1;a<t.length;a++){var s=t[a];s.x<r[0]&&(r[0]=s.x),s.y<r[1]&&(r[1]=s.y),s.x>o[0]&&(o[0]=s.x),s.y>o[1]&&(o[1]=s.y)}r[0]=r[0]-n[0],r[1]=r[1]-n[1],o[0]=o[0]+n[2],o[1]=o[1]+n[3];var l=Math.abs(o[0]-r[0]),u=Math.abs(o[1]-r[1]);return new e(r[0]+l/2,r[1]+u/2,l,u)}},{key:"union",value:function(t){var n=null,r=null,o=-1/0,a=-1/0;return i.a.each(t,function(t){n=n||t.x,r=r||t.y,n=Math.min(n,t.x),r=Math.min(r,t.y),o=Math.max(o,t.right()),a=Math.max(a,t.bottom())}),new e(n=n||0,r=r||0,o-n,a-r)}},{key:"getDirection",value:function(t,e){var n;if(!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]))return new o.a(t.x,t.y).getDirection(new o.a(e.x,e.y));var r=Math.abs(t.left-e.x),i=o.a.W;return(n=Math.abs(t.top-e.y))<=r&&(r=n,i=o.a.N),(n=Math.abs(t.bottom-e.y))<=r&&(r=n,i=o.a.S),(n=Math.abs(t.right-e.x))<r&&(i=o.a.E),i}}],(r=[{key:"contains",value:function(t){var e=t.width||0,n=t.height||0,r=t.x-e/2,i=t.x+e/2,o=t.y-n/2,a=t.y+n/2;return i<=this.right&&r>=this.left&&o>=this.top&&a<=this.bottom}},{key:"distance",value:function(t){return this.contains(t)?0:t.x<this.left?t.y<this.top?t.distance(new o.a(this.left,this.top)):t.y<=this.bottom?this.left-t.x:t.distance(new o.a(this.left,this.bottom)):t.x<=this.right?t.y<=this.top?this.top-t.y:t.y-this.bottom:t.y<this.top?t.distance(new o.a(this.right,this.top)):t.y<=this.bottom?t.x-this.right:t.distance(new o.a(this.right,this.bottom))}},{key:"detectIntersection",value:function(t,e){var n=t.y===e.y,r=this.contains(t),i=this.contains(e);if(r&&i)return 4;if(!r&&!i){if(n&&t.y>=this.top&&t.y<=this.bottom){if(t.x<this.left&&e.x>this.right)return 0;if(t.x>this.right&&e.x<this.left)return 2}if(!n&&t.x>=this.left&&t.x<=this.right){if(t.y<this.top&&e.y>this.bottom)return 1;if(t.y>this.bottom&&e.y<this.top)return 3}return-1}var o=r?e:t;return n?o.x>this.right?2:0:o.y<this.top?1:3}},{key:"toString",value:function(){return"Rectangle:{x="+this.x+";y="+this.y+";width="+this.width+";height="+this.height+"}"}}])&&l(n.prototype,r),s&&l(n,s),e}()},function(module,__webpack_exports__,__webpack_require__){"use strict";var lodash__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(1),lodash__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__),_geometry_Point__WEBPACK_IMPORTED_MODULE_1__=__webpack_require__(0),_geometry_Rectangle__WEBPACK_IMPORTED_MODULE_2__=__webpack_require__(2);function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function _classCallCheck(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(t,e){return!e||"object"!==_typeof(e)&&"function"!=typeof e?_assertThisInitialized(t):e}function _assertThisInitialized(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _getPrototypeOf(t){return(_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&_setPrototypeOf(t,e)}function _setPrototypeOf(t,e){return(_setPrototypeOf=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var _debugging=[],_debugAll=!1,typeRegistry={},splice=Array.splice;__webpack_exports__.a={type:function(t,e,n){return typeRegistry[t]||(typeRegistry[t]=new Map),e?n?void typeRegistry[t].set(e,n):typeRegistry[t].get(e):typeRegistry[t]},createType:function(t,e,n){var r=e.name,i=this.type(t,r);if(!i){var o=e.extends?this.type(t,e.extends):null;!o&&n&&(o=n),i=o?function(t){function e(){return _classCallCheck(this,e),_possibleConstructorReturn(this,_getPrototypeOf(e).apply(this,arguments))}return _inherits(e,o),e}():function t(e){_classCallCheck(this,t),lodash__WEBPACK_IMPORTED_MODULE_0___default.a.assign(this,e)},delete e.name,delete e.extends,lodash__WEBPACK_IMPORTED_MODULE_0___default.a.assign(i.prototype,e),i.typeName=r,this.type(t,r,i),this.log("Utils","Utils.createType - "+t+"."+r)}return i},buildTypes:function(t,e,n){var r=this;if(this.log("Utils","Utils.buildTypes - "+e),!t&&n)return this.createType(e,n),void this.log("Utils","Utils.buildTypes end");if(n){var i=lodash__WEBPACK_IMPORTED_MODULE_0___default.a.remove(t,{name:n.name});i=i.length>0?i[0]:null,n=i?this.createType(e,lodash__WEBPACK_IMPORTED_MODULE_0___default.a.defaultsDeep(i,n)):this.createType(e,n)}lodash__WEBPACK_IMPORTED_MODULE_0___default.a.forEach(t,function(t){r.createType(e,t,n)}),this.log("Utils","Utils.buildTypes end")},extend:function(t,e,n,r){lodash__WEBPACK_IMPORTED_MODULE_0___default.a.extend(t,e,r);var i=function(){this.constructor=t};return i.prototype=e.prototype,t.prototype=new i,n&&lodash__WEBPACK_IMPORTED_MODULE_0___default.a.extend(t.prototype,n),t.superclass=e.prototype,t},initConfig:function(t,e){for(var n={},r=t.constructor,i=[r];r;)r.super?(r=r.super.constructor,splice.apply(i,[0,0,r])):r=null;for(var o=0;o<i.length;o++)(r=i[o]).DEFAULTS&&lodash__WEBPACK_IMPORTED_MODULE_0___default.a.assign(n,r.DEFAULTS);t.props=lodash__WEBPACK_IMPORTED_MODULE_0___default.a.assign(n,e),r.prototype.prop=function(t,e){if(!e)return this.props[t];this.props[t]=e}},getConstructor:function getConstructor(jsClass,defaultClass){return jsClass||(jsClass=defaultClass),lodash__WEBPACK_IMPORTED_MODULE_0___default.a.isString(jsClass)&&(jsClass=eval(jsClass)),jsClass},debug:function(t){t?_debugging.push(t):_debugAll=!0},log:function(t,e){var n=_debugAll;if(!_debugAll){n=!1;for(var r=0;r<_debugging.length;r++)_debugging[r]===t&&(n=!0)}if(n){for(;t.length<10;)t+=" ";t=t.substring(0,10)+" - ",console.info(t,e)}},getRelativePosition:function(t,e){var n=Math.abs(e.x)<=1?t.width*e.x:e.x,r=Math.abs(e.y)<=1?t.height*e.y:e.y;return this.offsetPosition([n,r],e)},offsetPosition:function(t,e){return[t[0]+e.width*e.anchorX+e.offsetX,t[1]+e.height*e.anchorY+e.offsetY]},unscale:function(t,e,n){return n instanceof _geometry_Rectangle__WEBPACK_IMPORTED_MODULE_2__.a?new _geometry_Rectangle__WEBPACK_IMPORTED_MODULE_2__.a(n.x*e+t[0],n.y*e+t[1],n.width*e,n.height*e):n instanceof _geometry_Point__WEBPACK_IMPORTED_MODULE_1__.a?new _geometry_Point__WEBPACK_IMPORTED_MODULE_1__.a(n.x*e+t[0],n.y*e+t[1]):[n[0]*e+t[0],n[1]*e+t[1]]},scale:function(t,e,n){return n instanceof _geometry_Rectangle__WEBPACK_IMPORTED_MODULE_2__.a?new _geometry_Rectangle__WEBPACK_IMPORTED_MODULE_2__.a((n.x-t[0])/e,(n.y-t[1])/e,n.width/e,n.height/e):n instanceof _geometry_Point__WEBPACK_IMPORTED_MODULE_1__.a?new _geometry_Point__WEBPACK_IMPORTED_MODULE_1__.a((n.x-t[0])/e,(n.y-t[1])/e):[(n[0]-t[0])/e,(n[1]-t[1])/e]},getProperty:function(t,e){return t?lodash__WEBPACK_IMPORTED_MODULE_0___default.a.has(t,e)?t[e]:t.prop&&lodash__WEBPACK_IMPORTED_MODULE_0___default.a.isFunction(t.prop)?t.prop(e):null:null}}},function(t,e,n){var r,i,o;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}
/*!
* Bean - copyright (c) Jacob Thornton 2011-2012
* https://github.com/fat/bean
* MIT license
*/
/*!
* Bean - copyright (c) Jacob Thornton 2011-2012
* https://github.com/fat/bean
* MIT license
*/
o=function(t,e){t=t||"bean",e=e||this;var n,r,i,o,s,l="undefined"!=typeof window?window:this,u=e[t],h=/[^\.]*(?=\..*)\.|.*/,c=/\..*/,f="addEventListener",p="undefined"!=typeof document?document:{},d="undefined"!=typeof navigator?navigator:{},g=p.documentElement||{},y=g[f],v=y?f:"attachEvent",m={},b=Array.prototype.slice,w=function(t,e){return t.split(e||" ")},x=function(t){return"string"==typeof t},_=function(t){return"function"==typeof t},k=function(t,e,n){for(n=0;n<e.length;n++)e[n]&&(t[e[n]]=1);return t}({},w("click dblclick mouseup mousedown contextmenu mousewheel mousemultiwheel DOMMouseScroll mouseover mouseout mousemove selectstart selectend keydown keypress keyup orientationchange focus blur change reset select submit load unload beforeunload resize move DOMContentLoaded readystatechange message error abort scroll "+(y?"show input invalid touchstart touchmove touchend touchcancel gesturestart gesturechange gestureend textinput readystatechange pageshow pagehide popstate hashchange offline online afterprint beforeprint dragstart dragenter dragover dragleave drag drop dragend loadstart progress suspend emptied stalled loadmetadata loadeddata canplay canplaythrough playing waiting seeking seeked ended durationchange timeupdate play pause ratechange volumechange cuechange checking noupdate downloading cached updateready obsolete ":""))),E=(o="compareDocumentPosition"in g?function(t,e){return e.compareDocumentPosition&&16==(16&e.compareDocumentPosition(t))}:"contains"in g?function(t,e){return(e=9===e.nodeType||e===window?g:e)!==t&&e.contains(t)}:function(t,e){for(;t=t.parentNode;)if(t===e)return 1;return 0},{mouseenter:{base:"mouseover",condition:s=function(t){var e=t.relatedTarget;return e?e!==this&&"xul"!==e.prefix&&!/document/.test(this.toString())&&!o(e,this):null==e}},mouseleave:{base:"mouseout",condition:s},mousewheel:{base:/Firefox/.test(d.userAgent)?"DOMMouseScroll":"mousewheel"}}),S=function(){var t=w("altKey attrChange attrName bubbles cancelable ctrlKey currentTarget detail eventPhase getModifierState isTrusted metaKey relatedNode relatedTarget shiftKey srcElement target timeStamp type view which propertyName"),e=t.concat(w("button buttons clientX clientY dataTransfer fromElement offsetX offsetY pageX pageY screenX screenY toElement")),n=e.concat(w("wheelDelta wheelDeltaX wheelDeltaY wheelDeltaZ axis")),r=t.concat(w("char charCode key keyCode keyIdentifier keyLocation location")),i=t.concat(w("data")),o=t.concat(w("touches targetTouches changedTouches scale rotation")),a=t.concat(w("data origin source")),s=t.concat(w("state")),u=/over|out/,h=[{reg:/key/i,fix:function(t,e){return e.keyCode=t.keyCode||t.which,r}},{reg:/click|mouse(?!(.*wheel|scroll))|menu|drag|drop/i,fix:function(t,n,r){return n.rightClick=3===t.which||2===t.button,n.pos={x:0,y:0},t.pageX||t.pageY?(n.clientX=t.pageX,n.clientY=t.pageY):(t.clientX||t.clientY)&&(n.clientX=t.clientX+p.body.scrollLeft+g.scrollLeft,n.clientY=t.clientY+p.body.scrollTop+g.scrollTop),u.test(r)&&(n.relatedTarget=t.relatedTarget||t[("mouseover"==r?"from":"to")+"Element"]),e}},{reg:/mouse.*(wheel|scroll)/i,fix:function(){return n}},{reg:/^text/i,fix:function(){return i}},{reg:/^touch|^gesture/i,fix:function(){return o}},{reg:/^message$/i,fix:function(){return a}},{reg:/^popstate$/i,fix:function(){return s}},{reg:/.*/,fix:function(){return t}}],c={},f=function(t,e,n){if(arguments.length&&(t=t||((e.ownerDocument||e.document||e).parentWindow||l).event,this.originalEvent=t,this.isNative=n,this.isBean=!0,t)){var r,i,o,a,s,u=t.type,f=t.target||t.srcElement;if(this.target=f&&3===f.nodeType?f.parentNode:f,n){if(!(s=c[u]))for(r=0,i=h.length;r<i;r++)if(h[r].reg.test(u)){c[u]=s=h[r].fix;break}for(r=(a=s(t,this,u)).length;r--;)!((o=a[r])in this)&&o in t&&(this[o]=t[o])}}};return f.prototype.preventDefault=function(){this.originalEvent.preventDefault?this.originalEvent.preventDefault():this.originalEvent.returnValue=!1},f.prototype.stopPropagation=function(){this.originalEvent.stopPropagation?this.originalEvent.stopPropagation():this.originalEvent.cancelBubble=!0},f.prototype.stop=function(){this.preventDefault(),this.stopPropagation(),this.stopped=!0},f.prototype.stopImmediatePropagation=function(){this.originalEvent.stopImmediatePropagation&&this.originalEvent.stopImmediatePropagation(),this.isImmediatePropagationStopped=function(){return!0}},f.prototype.isImmediatePropagationStopped=function(){return this.originalEvent.isImmediatePropagationStopped&&this.originalEvent.isImmediatePropagationStopped()},f.prototype.clone=function(t){var e=new f(this,this.element,this.isNative);return e.currentTarget=t,e},f}(),P=function(t,e){return y||e||t!==p&&t!==l?t:g},O=function(){var t=function(t,e,n,r){var i=function(n,i){return e.apply(t,r?b.call(i,n?0:1).concat(r):i)},o=function(n,r){return e.__beanDel?e.__beanDel.ft(n.target,t):r},a=n?function(t){var e=o(t,this);if(n.apply(e,arguments))return t&&(t.currentTarget=e),i(t,arguments)}:function(t){return e.__beanDel&&(t=t.clone(o(t))),i(t,arguments)};return a.__beanDel=e.__beanDel,a},e=function(e,n,r,i,o,a,s){var l,u=E[n];"unload"==n&&(r=R(L,e,n,r,i)),u&&(u.condition&&(r=t(e,r,u.condition,a)),n=u.base||n),this.isNative=l=k[n]&&!!e[v],this.customType=!y&&!l&&n,this.element=e,this.type=n,this.original=i,this.namespaces=o,this.eventType=y||l?n:"propertychange",this.target=P(e,l),this[v]=!!this.target[v],this.root=s,this.handler=t(e,r,null,a)};return e.prototype.inNamespaces=function(t){var e,n,r=0;if(!t)return!0;if(!this.namespaces)return!1;for(e=t.length;e--;)for(n=this.namespaces.length;n--;)t[e]==this.namespaces[n]&&r++;return t.length===r},e.prototype.matches=function(t,e,n){return!(this.element!==t||e&&this.original!==e||n&&this.handler!==n)},e}(),C=(r={},i=function t(e,n,i,o,a,s){var l=a?"r":"$";if(n&&"*"!=n){var u,h=0,c=r[l+n],f="*"==e;if(!c)return;for(u=c.length;h<u;h++)if((f||c[h].matches(e,i,o))&&!s(c[h],c,h,n))return}else for(var p in r)p.charAt(0)==l&&t(e,p.substr(1),i,o,a,s)},{has:function(t,e,n,i){var o,a=r[(i?"r":"$")+e];if(a)for(o=a.length;o--;)if(!a[o].root&&a[o].matches(t,n,null))return!0;return!1},get:function(t,e,n,r){var o=[];return i(t,e,n,null,r,function(t){return o.push(t)}),o},put:function(t){var e=!t.root&&!this.has(t.element,t.type,null,!1),n=(t.root?"r":"$")+t.type;return(r[n]||(r[n]=[])).push(t),e},del:function(t){i(t.element,t.type,null,t.handler,t.root,function(t,e,n){return e.splice(n,1),t.removed=!0,0===e.length&&delete r[(t.root?"r":"$")+t.type],!1})},entries:function(){var t,e=[];for(t in r)"$"==t.charAt(0)&&(e=e.concat(r[t]));return e}}),M=function(t){n=arguments.length?t:p.querySelectorAll?function(t,e){return e.querySelectorAll(t)}:function(){throw new Error("Bean: No selector engine installed")}},T=function(t,e){if(y||!e||!t||t.propertyName=="_on"+e){var n=C.get(this,e||t.type,null,!1),r=n.length,i=0;for(t=new S(t,this,!0),e&&(t.type=e);i<r&&!t.isImmediatePropagationStopped();i++)n[i].removed||n[i].handler.call(this,t)}},N=y?function(t,e,n){t[n?f:"removeEventListener"](e,T,!1)}:function(t,e,n,r){var i;n?(C.put(i=new O(t,r||e,function(e){T.call(t,e,r)},T,null,null,!0)),r&&null==t["_on"+r]&&(t["_on"+r]=0),i.target.attachEvent("on"+i.eventType,i.handler)):(i=C.get(t,r||e,T,!0)[0])&&(i.target.detachEvent("on"+i.eventType,i.handler),C.del(i))},R=function(t,e,n,r,i){return function(){r.apply(this,arguments),t(e,n,i)}},L=function(t,e,n,r){var i,o,a=e&&e.replace(c,""),s=C.get(t,a,null,!1),l={};for(i=0,o=s.length;i<o;i++)n&&s[i].original!==n||!s[i].inNamespaces(r)||(C.del(s[i]),!l[s[i].eventType]&&s[i][v]&&(l[s[i].eventType]={t:s[i].eventType,c:s[i].type}));for(i in l)C.has(t,l[i].t,null,!1)||N(t,l[i].t,!1,l[i].c)},D=y?function(t,e,n){var r=p.createEvent(t?"HTMLEvents":"UIEvents");r[t?"initEvent":"initUIEvent"](e,!0,!0,l,1),n.dispatchEvent(r)}:function(t,e,n){n=P(n,t),t?n.fireEvent("on"+e,p.createEventObject()):n["_on"+e]++},j=function t(e,n,r){var i,o,a,s,l=x(n);if(l&&n.indexOf(" ")>0){for(s=(n=w(n)).length;s--;)t(e,n[s],r);return e}if((o=l&&n.replace(c,""))&&E[o]&&(o=E[o].base),!n||l)(a=l&&n.replace(h,""))&&(a=w(a,".")),L(e,o,r,a);else if(_(n))L(e,null,n);else for(i in n)n.hasOwnProperty(i)&&t(e,i,n[i]);return e},I=function t(e,r,i,o){var s,l,u,f,p,d,g;if(void 0!==i||"object"!=a(r)){for(_(i)?(p=b.call(arguments,3),o=s=i):(s=o,p=b.call(arguments,4),o=function(t,e){var r=function(e,r){for(var i,o=x(t)?n(t,r):t;e&&e!==r;e=e.parentNode)for(i=o.length;i--;)if(o[i]===e)return e},i=function(t){var n=r(t.target,this);n&&e.apply(n,arguments)};return i.__beanDel={ft:r,selector:t},i}(i,s)),u=w(r),this===m&&(o=R(j,e,r,o,s)),f=u.length;f--;)g=C.put(d=new O(e,u[f].replace(c,""),o,s,w(u[f].replace(h,""),"."),p,!1)),d[v]&&g&&N(e,d.eventType,!0,d.customType);return e}for(l in r)r.hasOwnProperty(l)&&t.call(this,e,l,r[l])},A={on:I,add:function(t,e,n,r){return I.apply(null,x(n)?[t,n,e,r].concat(arguments.length>3?b.call(arguments,5):[]):b.call(arguments))},one:function(){return I.apply(m,arguments)},off:j,remove:j,clone:function(t,e,n){for(var r,i,o=C.get(e,n,null,!1),a=o.length,s=0;s<a;s++)o[s].original&&(r=[t,o[s].type],(i=o[s].handler.__beanDel)&&r.push(i.selector),r.push(o[s].original),I.apply(null,r));return t},fire:function(t,e,n){var r,i,o,a,s,l=w(e);for(r=l.length;r--;)if(e=l[r].replace(c,""),(a=l[r].replace(h,""))&&(a=w(a,".")),a||n||!t[v])for(s=C.get(t,e,null,!1),n=[!1].concat(n),i=0,o=s.length;i<o;i++)s[i].inNamespaces(a)&&s[i].handler.apply(t,n);else D(k[e],e,t);return t},Event:S,setSelectorEngine:M,noConflict:function(){return e[t]=u,this}};if(l.attachEvent){l.attachEvent("onunload",function t(){var e,n=C.entries();for(e in n)n[e].type&&"unload"!==n[e].type&&j(n[e].element,n[e].type);l.detachEvent("onunload",t),l.CollectGarbage&&l.CollectGarbage()})}return M(),A},t.exports?t.exports=o():void 0===(i="function"==typeof(r=o)?r.call(e,n,e,t):r)||(t.exports=i)},function(t,e,n){"use strict";var r=n(1),i=n.n(r),o=n(0),a=n(2);function s(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var l={},u=function(){function t(e,n,r,o,a){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.x=e,this.y=n,this.width=r,this.height=o,i.a.defaults(this,a,{x:0,y:0,width:0,height:0})}var e,n,r;return e=t,r=[{key:"getShape",value:function(t){return l[t]}},{key:"addShape",value:function(t,e){l[t]=e}},{key:"removeShape",value:function(t){delete l[t]}}],(n=[{key:"contains",value:function(t){return!1}},{key:"getRegularPoints",value:function(t){return null}},{key:"getPerimeter",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.constructor.getPerimeter(this,t,e)}},{key:"render",value:function(t){return i.a.template(t.getTemplate(this.name,this))(this)}},{key:"top",get:function(){return this.y-this.height/2}},{key:"bottom",get:function(){return this.y+this.height/2}},{key:"left",get:function(){return this.x-this.width/2}},{key:"right",get:function(){return this.x+this.width/2}},{key:"center",get:function(){return new o.a(this.x,this.y)}},{key:"bounds",get:function(){return new a.a(this.x,this.y,this.width,this.height)}}])&&s(e.prototype,n),r&&s(e,r),t}();e.a=u},function(t,e,n){"use strict";n.r(e);var r={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(t){var e,n,i,o,a,s,l,u="",h=0;for(t=r._utf8_encode(t);h<t.length;)o=(e=t.charCodeAt(h++))>>2,a=(3&e)<<4|(n=t.charCodeAt(h++))>>4,s=(15&n)<<2|(i=t.charCodeAt(h++))>>6,l=63&i,isNaN(n)?s=l=64:isNaN(i)&&(l=64),u=u+this._keyStr.charAt(o)+this._keyStr.charAt(a)+this._keyStr.charAt(s)+this._keyStr.charAt(l);return u},decode:function(t){var e,n,i,o,a,s,l="",u=0;for(t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<t.length;)e=this._keyStr.indexOf(t.charAt(u++))<<2|(o=this._keyStr.indexOf(t.charAt(u++)))>>4,n=(15&o)<<4|(a=this._keyStr.indexOf(t.charAt(u++)))>>2,i=(3&a)<<6|(s=this._keyStr.indexOf(t.charAt(u++))),l+=String.fromCharCode(e),64!=a&&(l+=String.fromCharCode(n)),64!=s&&(l+=String.fromCharCode(i));return l=r._utf8_decode(l)},_utf8_encode:function(t){t=t.replace(/\r\n/g,"\n");for(var e="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e+=String.fromCharCode(r):r>127&&r<2048?(e+=String.fromCharCode(r>>6|192),e+=String.fromCharCode(63&r|128)):(e+=String.fromCharCode(r>>12|224),e+=String.fromCharCode(r>>6&63|128),e+=String.fromCharCode(63&r|128))}return e},_utf8_decode:function(t){for(var e="",n=0,r=c1=c2=0;n<t.length;)(r=t.charCodeAt(n))<128?(e+=String.fromCharCode(r),n++):r>191&&r<224?(c2=t.charCodeAt(n+1),e+=String.fromCharCode((31&r)<<6|63&c2),n+=2):(c2=t.charCodeAt(n+1),c3=t.charCodeAt(n+2),e+=String.fromCharCode((15&r)<<12|(63&c2)<<6|63&c3),n+=3);return e}},i=r,o={},a={get:function(t,e){return this.getCache(e)[t]},set:function(t,e,n){this.getCache(n)[t]=e},contains:function(t,e){return t in this.getCache(e)},remove:function(t,e){delete this.getCache(e)[t]},clear:function(t){t?o[t]&&(o[t]={}):o={}},getCache:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default";return o[t]||(o[t]={}),o[t]}},s=n(3),l=n(1),u=n.n(l),h=function(){return"undefined"!=typeof window&&window.navigator&&"undefined"!=typeof navigator},c={isIE:function(){if(!h())return!1;var t=window.navigator.userAgent,e=t.indexOf("MSIE");return e>0?parseInt(t.substring(e+5,t.indexOf(".",e))):navigator.userAgent.match(/Trident\/7\./)?11:!!navigator.userAgent.match(/Edge\//)&&"Edge"}(),isFireFox:"undefined"!=typeof InstallTrigger,isChrome:function(){if(!h()||navigator.userAgent.indexOf("Edge")>=0)return!1;var t=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./);return!!t&&parseInt(t[2],10)}(),isMac:!!h()&&navigator.platform.toUpperCase().indexOf("MAC")>=0,isWindows:!!h()&&navigator.appVersion.indexOf("Windows")>=0,isLinux:!!h()&&navigator.appVersion.indexOf("Linux")>=0,createElement:function(t,e,n,r){var i=document.createElement(t);return this.setElement(i,e,n),r&&(i.innerHTML=r),i},createElementByString:function(t){return this.createElement("div",null,null,t).childNodes},setElement:function(t,e,n){e&&u.a.forEach(e,function(e,n){t.setAttribute(n,e)}),n&&u.a.forEach(n,function(e,n){t.style[n]=e})},testElement:function(t,e){return t&&1===t.nodeType&&(!e||e(t))},getAncestorBy:function(t,e){for(;null!==(t=t.parentNode);)if(this.testElement(t,e))return t;return null},getPosition:function(t,e){e||(e=document.body);var n=t.getBoundingClientRect(),r=e.getBoundingClientRect();return[n.left-r.left,n.top-r.top]},getCenterPosition:function(t,e){e||(e=document.body);var n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=n.right-n.left,o=n.bottom-n.top;return[n.left-r.left+i/2,n.top-r.top+o/2]},move:function(t,e,n){e&&(t.style.left=e+"px"),n&&(t.style.top=n+"px")},getSize:function(t){return[parseInt(t.style.offsetWidth,10),parseInt(t.style.offsetHeight,10)]},resize:function(t,e,n){e&&(t.style.width=e+"px"),n&&(t.style.height=n+"px")},preloadImages:function(t){this.preloadImages.list||(this.preloadImages.list=[]),this.preloadImages.loaded||(this.preloadImages.loaded={});for(var e,n=this.preloadImages.list,r=this,i=0;i<t.length;i++)(e=new Image).onload=function(){var t=n.indexOf(this);-1!==t&&(r.preloadImages.loaded[this.name]={width:this.width,height:this.height},n.splice(t,1))},n.push(e),e.src=t[i],e.name=t[i]},getImageInfo:function(t){return this.preloadImages.loaded?this.preloadImages.loaded[t]:null},downloadFile:function(t,e){if(e){var n=e.match(/^data:([^;,]*)/)[1];if(t.indexOf(".")<0)if(n||(n="text/plain"),"text/plain"===n)t+=".txt";else{var r=n.split("/")[1];r.indexOf("+")>0&&(r=r.split("+")[0]),t=t+"."+r}if(this.isIE){var i=e.indexOf(";base64")>=0;e=i?atob(e.replace("data:"+n+";base64,","")):decodeURI(e.replace("data:"+n+",","")),e=this.GetBlob(e,n),navigator.msSaveBlob(e,t)}else{var o=this.createElement("a",{href:e,download:t},{display:"none"});document.body.appendChild(o),o.click(),o.parentNode.removeChild(o)}}},GetBlob:function(t,e,n){e=e||"",n=n||512;for(var r=[],i=0;i<t.length;i+=n){for(var o=t.slice(i,i+n),a=new Array(o.length),s=0;s<o.length;s++)a[s]=o.charCodeAt(s);var l=new Uint8Array(a);r.push(l)}return new Blob(r,{type:e})},openImage:function(t,e){if(h()){var n=window.open("","_blank","toolbar=yes, scrollbars=yes, resizable=yes, width=500, height=500").document,r=n.createElement("img");this.setElement(r,{src:e,name:t}),n.body.appendChild(r)}},eventFromInput:function(t){var e=t.target.tagName;return"INPUT"===e||"TEXTAREA"===e||"SELECT"===e},waitForElement:function(t){return new Promise(function(e){var n=document.getElementById(t);if(n)return e(n);var r=setInterval(function(){var n=document.getElementById(t);if(n)return clearInterval(r),e(n)},200)})}};function f(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var p=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.buffer=[],e&&this.buffer.push(e)}var e,n,r;return e=t,(n=[{key:"append",value:function(t){return u.a.isString(t)?this.buffer.push(t):u.a.isArray(t)?this.buffer=this.buffer.concat(t):this.buffer.push(""+t),this}},{key:"prepend",value:function(t){return u.a.isString(t)?this.buffer.splice(0,0,t):u.a.isArray(t)?this.buffer=t.concat(this.buffer):this.buffer.splice(0,0,""+t),this}},{key:"clear",value:function(){this.buffer=[]}},{key:"removeLast",value:function(){return this.buffer.pop(),this}},{key:"toString",value:function(t){return t||(t=""),this.buffer.join(t)}}])&&f(e.prototype,n),r&&f(e,r),t}(),d=n(0);function g(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var y=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.start=e,this.end=n}var e,n,r;return e=t,r=[{key:"intersection",value:function(t,e,n,r,i,o,a,s){var l=(s-o)*(n-t)-(a-i)*(r-e),u=((a-i)*(e-o)-(s-o)*(t-i))/l,h=((n-t)*(e-o)-(r-e)*(t-i))/l;if(u>=0&&u<=1&&h>=0&&h<=1){var c=t+u*(n-t),f=e+u*(r-e);return new d.a(c,f)}return null}}],(n=[{key:"length",value:function(){return this.start.distance(this.end)}},{key:"distance",value:function(t){var e=this.start.distance(t);if(0===e)return 0;var n=this.length(),r=new d.a((this.end.x-this.start.x)/n,(this.end.y-this.start.y)/n).dotProduct(new d.a(t.x/e,t.y/e));return e*Math.sqrt(1-r*r)}},{key:"toString",value:function(){return"Line:{start="+this.start+";end="+this.end+"}"}}])&&g(e.prototype,n),r&&g(e,r),t}(),v=n(5),m=n(2);function b(t){return(b="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function w(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function x(t,e){return!e||"object"!==b(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function k(t){return(k=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){return(E=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var S=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),x(this,k(e).apply(this,arguments))}var n,r,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&E(t,e)}(e,v["a"]),n=e,i=[{key:"getPerimeter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.width/2,i=t.height/2,o=t.x,a=t.y,s=e.x,l=e.y,u=parseInt(s-o),h=parseInt(l-a);if(0===u&&0!==h)return new d.a(o,a+i*h/Math.abs(h));if(0===u&&0===h)return new d.a(s,l);var c=h/u,f=a-c*o,p=r*r*c*c+i*i,g=-2*o*p,y=r*r*c*c*o*o+i*i*o*o-r*r*i*i,v=Math.sqrt(g*g-4*p*y),b=(-g+v)/(2*p),w=(-g-v)/(2*p),x=c*b+f,_=c*w+f,k=0,E=0;Math.sqrt(Math.pow(b-s,2)+Math.pow(x-l,2))<Math.sqrt(Math.pow(w-s,2)+Math.pow(_-l,2))?(k=b,E=x):(k=w,E=_);var S=new d.a(k,E),P=m.a.getDirection(t,S,n);if(n){if(-1===P.x)return{point:new d.a(o-r,a),direction:P};if(1===P.x)return{point:new d.a(o+r,a),direction:P};if(-1===P.y)return{point:new d.a(o,a-i),direction:P};if(1===P.y)return{point:new d.a(o,a+i),direction:P}}return{point:S,direction:P}}}],(r=[{key:"toString",value:function(){return"Ellipse:{x="+this.x+";y="+this.y+";width="+this.width+";height="+this.height+"}"}}])&&w(n.prototype,r),i&&w(n,i),e}();function P(t){return(P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function O(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function C(t,e){return!e||"object"!==P(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function M(t){return(M=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function T(t,e){return(T=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}var N=function(t){function e(){return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),C(this,M(e).apply(this,arguments))}var n,r,i;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&T(t,e)}(e,v["a"]),n=e,i=[{key:"getPerimeter",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t.width,i=t.height,o=t.x,a=t.y,s=o-r/2,l=a-i/2,u=e.x,h=e.y;if(o===u)return a>h?{point:new d.a(o,l),direction:d.a.S}:{point:new d.a(o,l+i),direction:d.a.N};if(a===h)return o>u?{point:new d.a(s,a),direction:d.a.E}:{point:new d.a(s+r,a),direction:d.a.W};var c,f,p=o,g=a;return n&&(u>=s&&u<=s+r?p=u:h>=l&&h<=l+i&&(g=h)),u<o?h<a?(c=y.intersection(u,h,p,g,o,l,s,a),f=d.a.S):(c=y.intersection(u,h,p,g,o,l+i,s,a),f=d.a.N):h<a?(c=y.intersection(u,h,p,g,o,l,s+r,a),f=d.a.E):(c=y.intersection(u,h,p,g,o,l+i,s+r,a),f=d.a.W),{point:c,direction:f}}}],(r=[{key:"toString",value:function(){return"Rhombus:{x="+this.x+";y="+this.y+";width="+this.width+";height="+this.height+"}"}}])&&O(n.prototype,r),i&&O(n,i),e}();function R(t){return(R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function L(t,e){return!e||"object"!==R(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function D(t){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function j(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&I(t,e)}function I(t,e){return(I=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function A(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function B(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function U(t,e,n){return e&&B(t.prototype,e),n&&B(t,n),t}var $={type:"direct",showGauge:!0,orthogonal:!1},F={width:0,height:0,anchorX:0,anchorY:0,offsetX:0,offsetY:0},z={},W=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;A(this,t),this.start=e[0].point,this.end=e[1].point,this.startNormal=e[0].direction,this.endNormal=e[1].direction,this.startMarker=r,this.endMarker=i,Object.assign(this,n)}return U(t,[{key:"render",value:function(t){return t.renderLink(this)}},{key:"getRelativePosition",value:function(t){u.a.isNumber(t)&&(t={x:t});var e=(t=u.a.defaults(t,F)).x,n=this.length;Math.abs(e)<=1&&(e*=n),e<0&&(e=n+e),e>n&&(e=n);for(var r,i,o,a=this.points,l=0;l<a.length-1;l++){if(e<=(r=a[l].distance(a[l+1]))){o=(i=a[l].clone()).getDirection(a[l+1]),i.translate(o.getScaled(e));break}e-=r}return i||(i=a[a.length-1]),s.a.offsetPosition([i.x,i.y],t)}},{key:"toString",value:function(){return"Link"}},{key:"points",get:function(){return null}},{key:"controlPts",get:function(){return null}},{key:"length",get:function(){var t,e=this.points,n=0;for(t=0;t<e.length-1;t++)n+=e[t].distance(e[t+1]);return n}}],[{key:"getLink",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;e=u.a.defaultsDeep(e,$);var i=z[e.type];return i?new i(t,e,n,r):(console.log("link type not supported: "+e.type),null)}}]),t}(),K=function(t){function e(){return A(this,e),L(this,D(e).apply(this,arguments))}return j(e,W),U(e,[{key:"points",get:function(){return[this.start,this.end]}}]),e}(),H=function(t){function e(){return A(this,e),L(this,D(e).apply(this,arguments))}return j(e,W),U(e,[{key:"getRelativePosition",value:function(t){u.a.isNumber(t)&&(t={x:t});var e=(t=u.a.defaults(t,F)).x,n=this.length;Math.abs(e)>1&&(e/=n),e<0&&e++,e>1&&e--;var r=this.points,i=this.controlPts,o=r[0],a=i[1][0],l=i[1][1],h=r[1],c=[(1-e)*(1-e)*(1-e)*o.x+3*e*(1-e)*(1-e)*a.x+3*e*e*(1-e)*l.x+e*e*e*h.x,(1-e)*(1-e)*(1-e)*o.y+3*e*(1-e)*(1-e)*a.y+3*e*e*(1-e)*l.y+e*e*e*h.y];return s.a.offsetPosition([c.x,c.y],t)}},{key:"points",get:function(){return[this.start,this.end]}},{key:"controlPts",get:function(){var t=this.points[0],e=this.points[1],n=[];return n[0]=null,n[1]=[],0===this.startNormal.x?n[1][0]=new d.a(t.x,(t.y+e.y)/2):n[1][0]=new d.a((t.x+e.x)/2,t.y),0===this.endNormal.x?n[1][1]=new d.a(e.x,(t.y+e.y)/2):n[1][1]=new d.a((t.x+e.x)/2,e.y),n}}]),e}(),V=function(t){function e(){return A(this,e),L(this,D(e).apply(this,arguments))}return j(e,W),U(e,[{key:"points",get:function(){var t=Port.getBounds(edge,!0),e=Port.getBounds(edge,!1),n=e.right()<t.x,r=t.right()<e.x,i=[],o=n?t.x:t.x+t.width,a=t.getCenterY();i.push(new d.a(o,a));var s=r?e.x:e.x+e.width,l=e.getCenterY(),u=this.segment,h=n?-u:u,c=new d.a(o+h,a);h=r?-u:u;var f=new d.a(s+h,l);if(n===r){var p=n?Math.min(o,s)-u:Math.max(o,s)+u;i.push(new d.a(p,a)),i.push(new d.a(p,l))}else if(c.x<f.x===n){var g=a+(l-a)/2;i.push(c),i.push(new d.a(c.x,g)),i.push(new d.a(f.x,g)),i.push(f)}else i.push(c),i.push(f);return i.push(new d.a(s,l)),i}}]),e}(),G=function(t){function e(t,n,r,i){return A(this,e),n=u.a.defaults(n,{MIN_BUFFER:10,autoRoute:!1,randomNoise:0,step:1,maxChannelWidth:100}),L(this,D(e).call(this,t,n,r,i))}return j(e,W),U(e,[{key:"autoRoute",value:function(t,e,n,r,i){var o,a,s,l,u,h,c,f,p,g;l=n[i],o=(p=t[t.length-2]).y<l.y?1:p.y>l.y+l.height?3:p.x<l.x?0:2,g=(c=_getChannel(e,i,n,o)).horizontal?(c.right-c.left)/2:(c.bottom-c.top)/2;for(var y=0;y<t.length-1;y++)if((t[y+1].x!==t[y].x||t[y+1].y!==t[y].y)&&(u=_getFirstIntersection(t,y,n,r,i))){switch(h=u[0],o=u[1],l=n[h],c=_getChannel(e,h,n,o),o){case 0:case 2:p=new d.a((c.right+c.left)/2,t[y].y),a=_getRouteTendency(t,y,p,l,o)<0?1:3,f=_getChannel(e,h,n,a),s=y>1&&t[y-2].y===t[y-1].y&&t[y-1].y>f.top&&t[y-1].y<f.bottom?t[y-1].y-p.y:y<t.length-3&&t[y+2].y===t[y+3].y&&t[y+2].y>f.top&&t[y+2].y<f.bottom?t[y+2].y-p.y:(f.bottom+f.top)/2-p.y,0===o&&p.x<=t[y].x||2===o&&p.x>=t[y].x?p=null:y>0&&(_hasIntersection([new d.a(t[y].x,t[y].y),new d.a(t[y].x,t[y].y+s),new d.a(p.x,p.y+s)],n)||(p=null));break;case 1:case 3:p=new d.a(t[y].x,(c.bottom+c.top)/2),a=_getRouteTendency(t,y,p,l,o)<0?0:2,f=_getChannel(e,h,n,a),s=y>1&&t[y-2].x===t[y-1].x&&t[y-1].x>f.left&&t[y-1].x<f.right?t[y-1].x-p.x:y<t.length-3&&t[y+2].x===t[y+3].x&&t[y+2].x>f.left&&t[y+2].x<f.right?t[y+2].x-p.x:(f.right+f.left)/2-p.x,1===o&&p.y<=t[y].y||3===o&&p.y>=t[y].y?p=null:y>0&&(_hasIntersection([new d.a(t[y].x,t[y].y),new d.a(t[y].x+s,t[y].y),new d.a(p.x+s,p.y)],n)||(p=null));break;case 4:continue}if(y>20)return;!p||p.x===t[y].x&&p.y===t[y].y?_moveSegment(t,y,s,0,g):(t.splice(y+1,0,p),_moveSegment(t,y+1,s,0,g),y++)}}},{key:"_getRouteTendency",value:function(t,e,n,r,i){var o,a;switch(i){case 0:case 2:a="y";break;case 1:case 3:a="x"}return 0===(o=_getRouteDirection(n,t[t.length-1])[a])&&0===(o=-_getRouteDirection(t[0],t[t.length-1])[a])&&(o=n[a]<r.getCenter()[a]?-1:1),o}},{key:"_getChannel",value:function(t,e,n,r){var i,o,a,s,l,u,h,c=this.maxChannelWidth,f=n[e],p={};switch(r){case 0:for(o=f.getLeft(),p.right=o.x,p.horizontal=!1,a=0;a<n.length;a++)a!==e&&((h=n[a].getRight().x)>=o.x||(!p.left||p.left<h)&&(p.left=h));for(p.left||(p.left=t.getLeft().x,p.right-p.left>c&&(p.left=p.right-c)),a=0;a<n.length;a++)a!==e&&(u=(i=n[a]).getBottom().y,l=i.getTop().y,u<o.y&&i.getRight()>p.left&&i.getLeft()<p.right&&(!p.top||p.top<u)&&(p.top=u),l>o.y&&i.getRight()>p.left&&i.getLeft()<p.right&&(!p.bottom||p.bottom>l)&&(p.bottom=l));p.top||(p.top=t.getTop().y),p.bottom||(p.bottom=t.getBottom().y);break;case 1:for(o=f.getTop(),p.horizontal=!0,p.bottom=o.y,a=0;a<n.length;a++)a!==e&&((u=n[a].getBottom().y)>=o.y||(!p.top||p.top<u)&&(p.top=u));for(p.top||(p.top=t.getTop().y,p.bottom-p.top>c&&(p.top=p.bottom-c)),a=0;a<n.length;a++)a!==e&&(s=(i=n[a]).getLeft().x,(h=i.getRight().x)<o.x&&i.getBottom()>p.top&&i.getTop()<p.bottom&&(!p.left||p.left<h)&&(p.left=h),s>o.x&&i.getBottom()>p.top&&i.getTop()<p.bottom&&(!p.right||p.right>s)&&(p.right=s));p.left||(p.left=t.getLeft().x),p.right||(p.right=t.getRight().x);break;case 2:for(o=f.getRight(),p.horizontal=!1,p.left=o.x,a=0;a<n.length;a++)a!==e&&((s=n[a].getLeft().x)<=o.x||(!p.right||p.right>s)&&(p.right=s));for(p.right||(p.right=t.getRight().x,p.right-p.left>c&&(p.right=p.left+c)),a=0;a<n.length;a++)a!==e&&(u=(i=n[a]).getBottom().y,l=i.getTop().y,u<o.y&&i.getRight()>p.left&&i.getLeft()<p.right&&(!p.top||p.top<u)&&(p.top=u),l>o.y&&i.getRight()>p.left&&i.getLeft()<p.right&&(!p.bottom||p.bottom>l)&&(p.bottom=l));p.top||(p.top=t.getTop().y),p.bottom||(p.bottom=t.getBottom().y);break;case 3:for(o=f.getBottom(),p.horizontal=!0,p.top=o.y,a=0;a<n.length;a++)a!==e&&((i=n[a]).getTop().y<=o.y||(!p.bottom||p.bottom>i.getTop().y)&&(p.bottom=i.getTop().y));for(p.bottom||(p.bottom=t.getBottom().y,p.bottom-p.top>c&&(p.bottom=p.top+c)),a=0;a<n.length;a++)a!==e&&(s=(i=n[a]).getLeft().x,(h=i.getRight().x)<o.x&&i.getBottom()>p.top&&i.getTop()<p.bottom&&(!p.left||p.left<h)&&(p.left=h),s>o.x&&i.getBottom()>p.top&&i.getTop()<p.bottom&&(!p.right||p.right>s)&&(p.right=s));p.left||(p.left=t.getLeft().x),p.right||(p.right=t.getRight().x)}return p}},{key:"_moveSegment",value:function(t,e,n,r,i){var o,a,s;return 0===e?(o=t[0].getDirection(t[1]),r||(r=this.MIN_BUFFER),a=Math.min(r,t[0].distance(t[1])/2),s=t[0].getTranslated(o.scale(a)),t.splice(1,0,s),void this._moveSegment(t,e+1,n)):e===t.length-2?(o=t[t.length-1].getDirection(t[t.length-2]),i||(i=this.MIN_BUFFER),a=Math.min(i,t[t.length-1].distance(t[t.length-2])/2),s=t[t.length-1].getTranslated(o.scale(a)),t.splice(t.length-1,0,s),void this._moveSegment(t,e,n)):void(t[e].y===t[e+1].y?(e>0&&t[e-1].y===t[e].y&&(t.splice(e+1,0,t[e].clone()),e++),e<t.length-2&&t[e+1].y===t[e+2].y&&t.splice(e+1,0,t[e+1].clone()),t[e].y+=n,t[e+1].y+=n):(e>0&&t[e-1].x===t[e].x&&(t.splice(e+1,0,t[e].clone()),e++),e<t.length-2&&t[e+1].x===t[e+2].x&&t.splice(e+1,0,t[e+1].clone()),t[e].x+=n,t[e+1].x+=n))}},{key:"_moveSegment2",value:function(t,e,n,r,i){t[e].y===t[e+1].y?(e>0&&t[e-1].y===t[e].y&&(t.splice(e+1,0,t[e].clone()),e++),e<t.length-2&&t[e+1].y===t[e+2].y&&t.splice(e+1,0,t[e+1].clone()),(e>0&&t[e].y+n===t[e-1].y||e<t.length-2&&t[e+1].y+n===t[e+2].y)&&(n*=.75),t[e].y+=n,t[e+1].y+=n):(e>0&&t[e-1].x===t[e].x&&(t.splice(e+1,0,t[e].clone()),e++),e<t.length-2&&t[e+1].x===t[e+2].x&&t.splice(e+1,0,t[e+1].clone()),(e>0&&t[e].x+n===t[e-1].x||e<t.length-2&&t[e+1].x+n===t[e+2].x)&&(n*=.75),t[e].x+=n,t[e+1].x+=n)}},{key:"points",get:function(){var t=e.route(this.start,this.end,this.startNormal,this.endNormal,this.MIN_BUFFER);if(this.autoRoute){this._mergeSegments(t);for(var n,r,i,o=[],a=edge.source.getCommonAncestor(edge.target),s=a.getDescendants(),l=0,u=0;u<s.length;u++)(n=s[u]).excludeFromRouting(edge)||n.isAncestor(edge.source)||n.isAncestor(edge.target)||(n===edge.source&&(r=l),n===edge.target&&(i=l),o.push(n.getBounds(document)),l++);o.length>1&&this.autoRoute(t,a.getBounds(document),o,r,i)}if(e._mergeSegments(t),this.randomNoise&&t.length>3)for(var h=1;h<2;h++){var c=this.randomNoise/this.step,f=Math.floor(Math.random()*c*2-c+1)*this.step;if(this.randomNoise&&4==t.length){var p=(0!=this.startNormal.x&&this.startNormal.x!=this.endNormal.x?this.randomNoise<=Math.abs(t[1].x-t[0].x-this.startNormal.x*this.MIN_BUFFER)?this.randomNoise:Math.abs(t[1].x-t[0].x-this.startNormal.x*this.MIN_BUFFER):0!=this.startNormal.y&&this.startNormal.y!=this.endNormal.y?this.randomNoise<=Math.abs(t[1].y-t[0].y-this.startNormal.y*this.MIN_BUFFER)?this.randomNoise:Math.abs(t[1].y-t[0].y-this.startNormal.y*this.MIN_BUFFER):this.randomNoise)/this.step,d=void 0;d=this.startNormal.x!==this.endNormal.x||this.startNormal.y!==this.endNormal.y?Math.floor(Math.random()*p*2-p+1)*this.step:Math.sign(0!==this.startNormal.x?this.startNormal.x:this.startNormal.y)*Math.floor(Math.random()*p+1)*this.step,this._moveSegment2(t,1,d,1,1)}if(this.randomNoise&&t.length>4)for(var g=1;g<t.length-2;g++)c=this.randomNoise/this.step,f=1==g?Math.sign(0!==this.startNormal.x?this.startNormal.x:this.startNormal.y)*Math.floor(Math.random()*c+1)*this.step:g==t.length-3?Math.sign(0!==this.endNormal.x?this.endNormal.x:this.endNormal.y)*Math.floor(Math.random()*c+1)*this.step:Math.floor(Math.random()*c*2-c+1)*this.step,this._moveSegment2(t,g,f,1,1)}return t}}],[{key:"route",value:function(t,e,n,r,i){var o,a,s,l=new d.a(t.x+n.x*i,t.y+n.y*i),u=new d.a(e.x+r.x*i,e.y+r.y*i);(o=0!==n.x?(u.x-l.x)/n.x>0?n:new d.a(0,u.y>=l.y?1:-1):(u.y-l.y)/n.y>0?n:new d.a(u.x>=l.x?1:-1,0),a=0!==r.x?(l.x-u.x)/r.x>0?r:new d.a(0,l.y>=u.y?1:-1):(l.y-u.y)/r.y>0?r:new d.a(l.x>=u.x?1:-1,0),0===o.dotProduct(a))?s=[t,l,0===o.x?new d.a(l.x,u.y):new d.a(u.x,l.y),u,e]:s=o.dotProduct(a)<0?0===o.x?[t,l,new d.a(l.x,(t.y+e.y)/2),new d.a(u.x,(t.y+e.y)/2),u,e]:[t,l,new d.a((t.x+e.x)/2,l.y),new d.a((t.x+e.x)/2,u.y),u,e]:[t,l,new d.a(l.x+o.x*i,l.y+o.y*i),new d.a(u.x+a.x*i,u.y+a.y*i),u,e];var h=[];h[0]=s[0];for(var c=1;c<s.length-1;c++)s[c].x===s[c-1].x&&s[c].x===s[c+1].x||s[c].y===s[c-1].y&&s[c].y===s[c+1].y||h.push(s[c]);return h.push(s[s.length-1]),h}},{key:"_hasIntersection",value:function(t,e){for(var n=0;n<t.length-1;n++)for(var r=0;r<e.length;r++)if(e[r].detectIntersection(t[n],t[n+1])>=0)return!0;return!1}},{key:"_getFirstIntersection",value:function(t,e,n,r,i){for(var o,a,s=null,l=null,u=0;u<n.length;u++)0===e&&u===r||e===t.length-2&&u===i||(a=(o=n[u]).detectIntersection(t[e],t[e+1]))>=0&&(null==s?(s=u,l=a):n[s].distance(t[e])>o.distance(t[e])&&(s=u,l=a));return null!=s?[s,l]:null}},{key:"_getRouteDirection",value:function(t,e){return t.x===e.x?t.y<e.y?d.a.S:d.a.N:t.y===e.y?t.x<e.x?d.a.E:d.a.W:t.x<e.x?t.y<e.y?d.a.SE:d.a.NE:t.y<e.y?d.a.SW:d.a.NW}},{key:"_mergeSegments",value:function(t){for(var e=t[t.length-1].y===t[t.length-2].y,n=t.length-2;n>=1;n--)t[n].y===t[n-1].y===e||t[n].equals(t[n-1])?t.splice(n,1):e=!e}}]),e}();z.direct=K,z.bezier=H,z.entityRelations=V,z.manhattan=G;var X=W,q=n(4),Y=n.n(q);function Z(t,e,n,r,i){var o=new p;return t&&o.append("CTRL"),e&&o.append("ALT"),n&&o.append("SHIFT"),r&&o.append("META"),i&&o.append(i),o.toString(".")}function J(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}var Q={stopPropagation:!1},tt="undefined"!=typeof window?window:{addEventHandler:function(){}},et="undefined"!=typeof document?document:{},nt=function(){function t(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[0,1/0],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.root=e,this.rootNS=e.getAttribute("ns")||"root",this.zoomScale=r,Object.assign(this,Q,i),this.scale=1,this.listeners={},this.dragging=!1,this.handler=function(t){n.handleEvent(t)},this.started=!1,this.enterStack=[]}var e,n,r;return e=t,r=[{key:"match",value:function(t,e){return e instanceof RegExp?t.match(e):t===e}},{key:"mouse",value:function(t,e){e.changedTouches&&(e=e.changedTouche