diagram-minimap.umd.prod.js 35 KB

1234567
  1. !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).DiagramJSMinimap=e()}(this,(function(){"use strict";function t(t,e){return e.forEach((function(e){e&&"string"!=typeof e&&!Array.isArray(e)&&Object.keys(e).forEach((function(n){if("default"!==n&&!(n in t)){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}}))})),Object.freeze(t)}function e(t,e,n){return 2==arguments.length?t.getAttribute(e):null===n?t.removeAttribute(e):(t.setAttribute(e,n),t)}const n=Object.prototype.toString;function i(t){return new r(t)}function r(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}r.prototype.add=function(t){return this.list.add(t),this},r.prototype.remove=function(t){return"[object RegExp]"==n.call(t)?this.removeMatching(t):(this.list.remove(t),this)},r.prototype.removeMatching=function(t){const e=this.array();for(let n=0;n<e.length;n++)t.test(e[n])&&this.remove(e[n]);return this},r.prototype.toggle=function(t,e){return void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this},r.prototype.array=function(){return Array.from(this.list)},r.prototype.has=r.prototype.contains=function(t){return this.list.contains(t)};var o,s,a,h={};function c(){o=window.addEventListener?"addEventListener":"attachEvent",s=window.removeEventListener?"removeEventListener":"detachEvent",a="addEventListener"!==o?"on":""}var u,l=t({__proto__:null,bind:h.bind=function(t,e,n,i){return o||c(),t[o](a+e,n,i||!1),n},unbind:h.unbind=function(t,e,n,i){return s||c(),t[s](a+e,n,i||!1),n},default:h},[h]);function p(t,e){return(e=e||document).querySelector(t)}function f(t,e){return function(t,e){e.appendChild(function(t,e){if(t.ownerDocument!==e.ownerDocument)try{return e.ownerDocument.importNode(t,!0)}catch(t){}return t}(t,e))}(e,t),t}"undefined"!=typeof document&&((u=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',u.getElementsByTagName("link").length,u=void 0);var d=2,v={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":d,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":d,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function g(t,e,n){var i=e.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=v[i];r?(r===d&&"number"==typeof n&&(n=String(n)+"px"),t.style[i]=n):t.setAttributeNS(null,e,n)}function m(t,e,n){if("string"==typeof e){if(void 0===n)return function(t,e){return v[e]?t.style[e]:t.getAttributeNS(null,e)}(t,e);g(t,e,n)}else!function(t,e){var n,i,r=Object.keys(e);for(n=0;i=r[n];n++)g(t,i,e[i])}(t,e);return t}const y=Object.prototype.toString;function _(t){if(!t||!t.nodeType)throw new Error("A DOM element reference is required");this.el=t,this.list=t.classList}function w(t){var e=t.parentNode;return e&&e.removeChild(t),t}_.prototype.add=function(t){return this.list.add(t),this},_.prototype.remove=function(t){return"[object RegExp]"==y.call(t)?this.removeMatching(t):(this.list.remove(t),this)},_.prototype.removeMatching=function(t){const e=this.array();for(let n=0;n<e.length;n++)t.test(e[n])&&this.remove(e[n]);return this},_.prototype.toggle=function(t,e){return void 0!==e?e!==this.list.toggle(t,e)&&this.list.toggle(t):this.list.toggle(t),this},_.prototype.array=function(){return Array.from(this.list)},_.prototype.has=_.prototype.contains=function(t){return this.list.contains(t)};var T={svg:"http://www.w3.org/2000/svg"},E='<svg xmlns="'+T.svg+'"';function x(t){var e=!1;"<svg"===t.substring(0,4)?-1===t.indexOf(T.svg)&&(t=E+t.substring(4)):(t=E+">"+t+"</svg>",e=!0);var n=function(t){var e;return(e=new DOMParser).async=!1,e.parseFromString(t,"text/xml")}(t);if(!e)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function b(t,e){var n;return"<"===t.charAt(0)?(n=x(t).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(T.svg,t),e&&m(n,e),n}const C=Object.prototype.toString,R=Object.prototype.hasOwnProperty;function D(t,e){return R.call(t,e)}function M(t,e){let n,i;if(void 0===t)return;const r=function(t){return"[object Array]"===C.call(t)}(t)?O:P;for(let o in t)if(D(t,o)&&(n=t[o],i=e(n,r(o)),!1===i))return n}function A(t,e){return!!function(t,e,n){return M(t,(function(t,i){n=e(n,t,i)})),n}(t,(function(t,n,i){return t&&e(n,i)}),!0)}function P(t){return t}function O(t){return Number(t)}function I(t,...e){return Object.assign(t,...e)}var S={};
  2. /*! Hammer.JS - v2.0.7 - 2016-04-22
  3. * http://hammerjs.github.io/
  4. *
  5. * Copyright (c) 2016 Jorik Tangelder;
  6. * Licensed under the MIT license */
  7. !function(t){!function(e,n,i,r){var o,s=["","webkit","Moz","MS","ms","o"],a=n.createElement("div"),h="function",c=Math.round,u=Math.abs,l=Date.now;function p(t,e,n){return setTimeout(_(t,n),e)}function f(t,e,n){return!!Array.isArray(t)&&(d(t,n[e],n),!0)}function d(t,e,n){var i;if(t)if(t.forEach)t.forEach(e,n);else if(t.length!==r)for(i=0;i<t.length;)e.call(n,t[i],i,t),i++;else for(i in t)t.hasOwnProperty(i)&&e.call(n,t[i],i,t)}function v(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}o="function"!=typeof Object.assign?function(t){if(t===r||null===t)throw new TypeError("Cannot convert undefined or null to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&null!==i)for(var o in i)i.hasOwnProperty(o)&&(e[o]=i[o])}return e}:Object.assign;var g=v((function(t,e,n){for(var i=Object.keys(e),o=0;o<i.length;)(!n||n&&t[i[o]]===r)&&(t[i[o]]=e[i[o]]),o++;return t}),"extend","Use `assign`."),m=v((function(t,e){return g(t,e,!0)}),"merge","Use `assign`.");function y(t,e,n){var i,r=e.prototype;(i=t.prototype=Object.create(r)).constructor=t,i._super=r,n&&o(i,n)}function _(t,e){return function(){return t.apply(e,arguments)}}function w(t,e){return typeof t==h?t.apply(e&&e[0]||r,e):t}function T(t,e){return t===r?e:t}function E(t,e,n){d(R(e),(function(e){t.addEventListener(e,n,!1)}))}function x(t,e,n){d(R(e),(function(e){t.removeEventListener(e,n,!1)}))}function b(t,e){for(;t;){if(t==e)return!0;t=t.parentNode}return!1}function C(t,e){return t.indexOf(e)>-1}function R(t){return t.trim().split(/\s+/g)}function D(t,e,n){if(t.indexOf&&!n)return t.indexOf(e);for(var i=0;i<t.length;){if(n&&t[i][n]==e||!n&&t[i]===e)return i;i++}return-1}function M(t){return Array.prototype.slice.call(t,0)}function A(t,e,n){for(var i=[],r=[],o=0;o<t.length;){var s=e?t[o][e]:t[o];D(r,s)<0&&i.push(t[o]),r[o]=s,o++}return n&&(i=e?i.sort((function(t,n){return t[e]>n[e]})):i.sort()),i}function P(t,e){for(var n,i,o=e[0].toUpperCase()+e.slice(1),a=0;a<s.length;){if((i=(n=s[a])?n+o:e)in t)return i;a++}return r}var O=1;function I(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var S="ontouchstart"in e,N=P(e,"PointerEvent")!==r,z=S&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),j="touch",k="mouse",Y=25,X=1,V=2,F=4,L=8,B=1,q=2,W=4,H=8,G=16,U=q|W,Z=H|G,$=U|Z,J=["x","y"],K=["clientX","clientY"];function Q(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){w(t.options.enable,[t])&&n.handler(e)},this.init()}function tt(t,e,n){var i=n.pointers.length,o=n.changedPointers.length,s=e&X&&i-o==0,a=e&(F|L)&&i-o==0;n.isFirst=!!s,n.isFinal=!!a,s&&(t.session={}),n.eventType=e,function(t,e){var n=t.session,i=e.pointers,o=i.length;n.firstInput||(n.firstInput=et(e));o>1&&!n.firstMultiple?n.firstMultiple=et(e):1===o&&(n.firstMultiple=!1);var s=n.firstInput,a=n.firstMultiple,h=a?a.center:s.center,c=e.center=nt(i);e.timeStamp=l(),e.deltaTime=e.timeStamp-s.timeStamp,e.angle=st(h,c),e.distance=ot(h,c),function(t,e){var n=e.center,i=t.offsetDelta||{},r=t.prevDelta||{},o=t.prevInput||{};e.eventType!==X&&o.eventType!==F||(r=t.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=t.offsetDelta={x:n.x,y:n.y});e.deltaX=r.x+(n.x-i.x),e.deltaY=r.y+(n.y-i.y)}(n,e),e.offsetDirection=rt(e.deltaX,e.deltaY);var p=it(e.deltaTime,e.deltaX,e.deltaY);e.overallVelocityX=p.x,e.overallVelocityY=p.y,e.overallVelocity=u(p.x)>u(p.y)?p.x:p.y,e.scale=a?(f=a.pointers,d=i,ot(d[0],d[1],K)/ot(f[0],f[1],K)):1,e.rotation=a?function(t,e){return st(e[1],e[0],K)+st(t[1],t[0],K)}(a.pointers,i):0,e.maxPointers=n.prevInput?e.pointers.length>n.prevInput.maxPointers?e.pointers.length:n.prevInput.maxPointers:e.pointers.length,function(t,e){var n,i,o,s,a=t.lastInterval||e,h=e.timeStamp-a.timeStamp;if(e.eventType!=L&&(h>Y||a.velocity===r)){var c=e.deltaX-a.deltaX,l=e.deltaY-a.deltaY,p=it(h,c,l);i=p.x,o=p.y,n=u(p.x)>u(p.y)?p.x:p.y,s=rt(c,l),t.lastInterval=e}else n=a.velocity,i=a.velocityX,o=a.velocityY,s=a.direction;e.velocity=n,e.velocityX=i,e.velocityY=o,e.direction=s}(n,e);var f,d;var v=t.element;b(e.srcEvent.target,v)&&(v=e.srcEvent.target);e.target=v}(t,n),t.emit("hammer.input",n),t.recognize(n),t.session.prevInput=n}function et(t){for(var e=[],n=0;n<t.pointers.length;)e[n]={clientX:c(t.pointers[n].clientX),clientY:c(t.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:e,center:nt(e),deltaX:t.deltaX,deltaY:t.deltaY}}function nt(t){var e=t.length;if(1===e)return{x:c(t[0].clientX),y:c(t[0].clientY)};for(var n=0,i=0,r=0;r<e;)n+=t[r].clientX,i+=t[r].clientY,r++;return{x:c(n/e),y:c(i/e)}}function it(t,e,n){return{x:e/t||0,y:n/t||0}}function rt(t,e){return t===e?B:u(t)>=u(e)?t<0?q:W:e<0?H:G}function ot(t,e,n){n||(n=J);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return Math.sqrt(i*i+r*r)}function st(t,e,n){n||(n=J);var i=e[n[0]]-t[n[0]],r=e[n[1]]-t[n[1]];return 180*Math.atan2(r,i)/Math.PI}Q.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(I(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&x(this.element,this.evEl,this.domHandler),this.evTarget&&x(this.target,this.evTarget,this.domHandler),this.evWin&&x(I(this.element),this.evWin,this.domHandler)}};var at={mousedown:X,mousemove:V,mouseup:F},ht="mousedown",ct="mousemove mouseup";function ut(){this.evEl=ht,this.evWin=ct,this.pressed=!1,Q.apply(this,arguments)}y(ut,Q,{handler:function(t){var e=at[t.type];e&X&&0===t.button&&(this.pressed=!0),e&V&&1!==t.which&&(e=F),this.pressed&&(e&F&&(this.pressed=!1),this.callback(this.manager,e,{pointers:[t],changedPointers:[t],pointerType:k,srcEvent:t}))}});var lt={pointerdown:X,pointermove:V,pointerup:F,pointercancel:L,pointerout:L},pt={2:j,3:"pen",4:k,5:"kinect"},ft="pointerdown",dt="pointermove pointerup pointercancel";function vt(){this.evEl=ft,this.evWin=dt,Q.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}e.MSPointerEvent&&!e.PointerEvent&&(ft="MSPointerDown",dt="MSPointerMove MSPointerUp MSPointerCancel"),y(vt,Q,{handler:function(t){var e=this.store,n=!1,i=t.type.toLowerCase().replace("ms",""),r=lt[i],o=pt[t.pointerType]||t.pointerType,s=o==j,a=D(e,t.pointerId,"pointerId");r&X&&(0===t.button||s)?a<0&&(e.push(t),a=e.length-1):r&(F|L)&&(n=!0),a<0||(e[a]=t,this.callback(this.manager,r,{pointers:e,changedPointers:[t],pointerType:o,srcEvent:t}),n&&e.splice(a,1))}});var gt={touchstart:X,touchmove:V,touchend:F,touchcancel:L},mt="touchstart",yt="touchstart touchmove touchend touchcancel";function _t(){this.evTarget=mt,this.evWin=yt,this.started=!1,Q.apply(this,arguments)}function wt(t,e){var n=M(t.touches),i=M(t.changedTouches);return e&(F|L)&&(n=A(n.concat(i),"identifier",!0)),[n,i]}y(_t,Q,{handler:function(t){var e=gt[t.type];if(e===X&&(this.started=!0),this.started){var n=wt.call(this,t,e);e&(F|L)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:t})}}});var Tt={touchstart:X,touchmove:V,touchend:F,touchcancel:L},Et="touchstart touchmove touchend touchcancel";function xt(){this.evTarget=Et,this.targetIds={},Q.apply(this,arguments)}function bt(t,e){var n=M(t.touches),i=this.targetIds;if(e&(X|V)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,s=M(t.changedTouches),a=[],h=this.target;if(o=n.filter((function(t){return b(t.target,h)})),e===X)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;for(r=0;r<s.length;)i[s[r].identifier]&&a.push(s[r]),e&(F|L)&&delete i[s[r].identifier],r++;return a.length?[A(o.concat(a),"identifier",!0),a]:void 0}y(xt,Q,{handler:function(t){var e=Tt[t.type],n=bt.call(this,t,e);n&&this.callback(this.manager,e,{pointers:n[0],changedPointers:n[1],pointerType:j,srcEvent:t})}});var Ct=2500,Rt=25;function Dt(){Q.apply(this,arguments);var t=_(this.handler,this);this.touch=new xt(this.manager,t),this.mouse=new ut(this.manager,t),this.primaryTouch=null,this.lastTouches=[]}function Mt(t,e){t&X?(this.primaryTouch=e.changedPointers[0].identifier,At.call(this,e)):t&(F|L)&&At.call(this,e)}function At(t){var e=t.changedPointers[0];if(e.identifier===this.primaryTouch){var n={x:e.clientX,y:e.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout((function(){var t=i.indexOf(n);t>-1&&i.splice(t,1)}),Ct)}}function Pt(t){for(var e=t.srcEvent.clientX,n=t.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(e-r.x),s=Math.abs(n-r.y);if(o<=Rt&&s<=Rt)return!0}return!1}y(Dt,Q,{handler:function(t,e,n){var i=n.pointerType==j,r=n.pointerType==k;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)Mt.call(this,e,n);else if(r&&Pt.call(this,n))return;this.callback(t,e,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ot=P(a.style,"touchAction"),It=Ot!==r,St="compute",Nt="auto",zt="manipulation",jt="none",kt="pan-x",Yt="pan-y",Xt=function(){if(!It)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach((function(i){t[i]=!n||e.CSS.supports("touch-action",i)})),t}();function Vt(t,e){this.manager=t,this.set(e)}Vt.prototype={set:function(t){t==St&&(t=this.compute()),It&&this.manager.element.style&&Xt[t]&&(this.manager.element.style[Ot]=t),this.actions=t.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return d(this.manager.recognizers,(function(e){w(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))})),function(t){if(C(t,jt))return jt;var e=C(t,kt),n=C(t,Yt);if(e&&n)return jt;if(e||n)return e?kt:Yt;if(C(t,zt))return zt;return Nt}(t.join(" "))},preventDefaults:function(t){var e=t.srcEvent,n=t.offsetDirection;if(this.manager.session.prevented)e.preventDefault();else{var i=this.actions,r=C(i,jt)&&!Xt[jt],o=C(i,Yt)&&!Xt[Yt],s=C(i,kt)&&!Xt[kt];if(r){var a=1===t.pointers.length,h=t.distance<2,c=t.deltaTime<250;if(a&&h&&c)return}if(!s||!o)return r||o&&n&U||s&&n&Z?this.preventSrc(e):void 0}},preventSrc:function(t){this.manager.session.prevented=!0,t.preventDefault()}};var Ft=1,Lt=2,Bt=4,qt=8,Wt=qt,Ht=16,Gt=32;function Ut(t){this.options=o({},this.defaults,t||{}),this.id=O++,this.manager=null,this.options.enable=T(this.options.enable,!0),this.state=Ft,this.simultaneous={},this.requireFail=[]}function Zt(t){return t&Ht?"cancel":t&qt?"end":t&Bt?"move":t&Lt?"start":""}function $t(t){return t==G?"down":t==H?"up":t==q?"left":t==W?"right":""}function Jt(t,e){var n=e.manager;return n?n.get(t):t}function Kt(){Ut.apply(this,arguments)}function Qt(){Kt.apply(this,arguments),this.pX=null,this.pY=null}function te(){Kt.apply(this,arguments)}function ee(){Ut.apply(this,arguments),this._timer=null,this._input=null}function ne(){Kt.apply(this,arguments)}function ie(){Kt.apply(this,arguments)}function re(){Ut.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function oe(t,e){return(e=e||{}).recognizers=T(e.recognizers,oe.defaults.preset),new se(t,e)}Ut.prototype={defaults:{},set:function(t){return o(this.options,t),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(t){if(f(t,"recognizeWith",this))return this;var e=this.simultaneous;return e[(t=Jt(t,this)).id]||(e[t.id]=t,t.recognizeWith(this)),this},dropRecognizeWith:function(t){return f(t,"dropRecognizeWith",this)||(t=Jt(t,this),delete this.simultaneous[t.id]),this},requireFailure:function(t){if(f(t,"requireFailure",this))return this;var e=this.requireFail;return-1===D(e,t=Jt(t,this))&&(e.push(t),t.requireFailure(this)),this},dropRequireFailure:function(t){if(f(t,"dropRequireFailure",this))return this;t=Jt(t,this);var e=D(this.requireFail,t);return e>-1&&this.requireFail.splice(e,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(t){return!!this.simultaneous[t.id]},emit:function(t){var e=this,n=this.state;function i(n){e.manager.emit(n,t)}n<qt&&i(e.options.event+Zt(n)),i(e.options.event),t.additionalEvent&&i(t.additionalEvent),n>=qt&&i(e.options.event+Zt(n))},tryEmit:function(t){if(this.canEmit())return this.emit(t);this.state=Gt},canEmit:function(){for(var t=0;t<this.requireFail.length;){if(!(this.requireFail[t].state&(Gt|Ft)))return!1;t++}return!0},recognize:function(t){var e=o({},t);if(!w(this.options.enable,[this,e]))return this.reset(),void(this.state=Gt);this.state&(Wt|Ht|Gt)&&(this.state=Ft),this.state=this.process(e),this.state&(Lt|Bt|qt|Ht)&&this.tryEmit(e)},process:function(t){},getTouchAction:function(){},reset:function(){}},y(Kt,Ut,{defaults:{pointers:1},attrTest:function(t){var e=this.options.pointers;return 0===e||t.pointers.length===e},process:function(t){var e=this.state,n=t.eventType,i=e&(Lt|Bt),r=this.attrTest(t);return i&&(n&L||!r)?e|Ht:i||r?n&F?e|qt:e&Lt?e|Bt:Lt:Gt}}),y(Qt,Kt,{defaults:{event:"pan",threshold:10,pointers:1,direction:$},getTouchAction:function(){var t=this.options.direction,e=[];return t&U&&e.push(Yt),t&Z&&e.push(kt),e},directionTest:function(t){var e=this.options,n=!0,i=t.distance,r=t.direction,o=t.deltaX,s=t.deltaY;return r&e.direction||(e.direction&U?(r=0===o?B:o<0?q:W,n=o!=this.pX,i=Math.abs(t.deltaX)):(r=0===s?B:s<0?H:G,n=s!=this.pY,i=Math.abs(t.deltaY))),t.direction=r,n&&i>e.threshold&&r&e.direction},attrTest:function(t){return Kt.prototype.attrTest.call(this,t)&&(this.state&Lt||!(this.state&Lt)&&this.directionTest(t))},emit:function(t){this.pX=t.deltaX,this.pY=t.deltaY;var e=$t(t.direction);e&&(t.additionalEvent=this.options.event+e),this._super.emit.call(this,t)}}),y(te,Kt,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[jt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.scale-1)>this.options.threshold||this.state&Lt)},emit:function(t){if(1!==t.scale){var e=t.scale<1?"in":"out";t.additionalEvent=this.options.event+e}this._super.emit.call(this,t)}}),y(ee,Ut,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Nt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime>e.time;if(this._input=t,!i||!n||t.eventType&(F|L)&&!r)this.reset();else if(t.eventType&X)this.reset(),this._timer=p((function(){this.state=Wt,this.tryEmit()}),e.time,this);else if(t.eventType&F)return Wt;return Gt},reset:function(){clearTimeout(this._timer)},emit:function(t){this.state===Wt&&(t&&t.eventType&F?this.manager.emit(this.options.event+"up",t):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),y(ne,Kt,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[jt]},attrTest:function(t){return this._super.attrTest.call(this,t)&&(Math.abs(t.rotation)>this.options.threshold||this.state&Lt)}}),y(ie,Kt,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:U|Z,pointers:1},getTouchAction:function(){return Qt.prototype.getTouchAction.call(this)},attrTest:function(t){var e,n=this.options.direction;return n&(U|Z)?e=t.overallVelocity:n&U?e=t.overallVelocityX:n&Z&&(e=t.overallVelocityY),this._super.attrTest.call(this,t)&&n&t.offsetDirection&&t.distance>this.options.threshold&&t.maxPointers==this.options.pointers&&u(e)>this.options.velocity&&t.eventType&F},emit:function(t){var e=$t(t.offsetDirection);e&&this.manager.emit(this.options.event+e,t),this.manager.emit(this.options.event,t)}}),y(re,Ut,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[zt]},process:function(t){var e=this.options,n=t.pointers.length===e.pointers,i=t.distance<e.threshold,r=t.deltaTime<e.time;if(this.reset(),t.eventType&X&&0===this.count)return this.failTimeout();if(i&&r&&n){if(t.eventType!=F)return this.failTimeout();var o=!this.pTime||t.timeStamp-this.pTime<e.interval,s=!this.pCenter||ot(this.pCenter,t.center)<e.posThreshold;if(this.pTime=t.timeStamp,this.pCenter=t.center,s&&o?this.count+=1:this.count=1,this._input=t,0===this.count%e.taps)return this.hasRequireFailures()?(this._timer=p((function(){this.state=Wt,this.tryEmit()}),e.interval,this),Lt):Wt}return Gt},failTimeout:function(){return this._timer=p((function(){this.state=Gt}),this.options.interval,this),Gt},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Wt&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),oe.VERSION="2.0.7",oe.defaults={domEvents:!1,touchAction:St,enable:!0,inputTarget:null,inputClass:null,preset:[[ne,{enable:!1}],[te,{enable:!1},["rotate"]],[ie,{direction:U}],[Qt,{direction:U},["swipe"]],[re],[re,{event:"doubletap",taps:2},["tap"]],[ee]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function se(t,e){var n;this.options=o({},oe.defaults,e||{}),this.options.inputTarget=this.options.inputTarget||t,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=t,this.input=new((n=this).options.inputClass||(N?vt:z?xt:S?Dt:ut))(n,tt),this.touchAction=new Vt(this,this.options.touchAction),ae(this,!0),d(this.options.recognizers,(function(t){var e=this.add(new t[0](t[1]));t[2]&&e.recognizeWith(t[2]),t[3]&&e.requireFailure(t[3])}),this)}function ae(t,e){var n,i=t.element;i.style&&(d(t.options.cssProps,(function(r,o){n=P(i.style,o),e?(t.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=t.oldCssProps[n]||""})),e||(t.oldCssProps={}))}se.prototype={set:function(t){return o(this.options,t),t.touchAction&&this.touchAction.update(),t.inputTarget&&(this.input.destroy(),this.input.target=t.inputTarget,this.input.init()),this},stop:function(t){this.session.stopped=t?2:1},recognize:function(t){var e=this.session;if(!e.stopped){var n;this.touchAction.preventDefaults(t);var i=this.recognizers,r=e.curRecognizer;(!r||r&&r.state&Wt)&&(r=e.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===e.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(t),!r&&n.state&(Lt|Bt|qt)&&(r=e.curRecognizer=n),o++}},get:function(t){if(t instanceof Ut)return t;for(var e=this.recognizers,n=0;n<e.length;n++)if(e[n].options.event==t)return e[n];return null},add:function(t){if(f(t,"add",this))return this;var e=this.get(t.options.event);return e&&this.remove(e),this.recognizers.push(t),t.manager=this,this.touchAction.update(),t},remove:function(t){if(f(t,"remove",this))return this;if(t=this.get(t)){var e=this.recognizers,n=D(e,t);-1!==n&&(e.splice(n,1),this.touchAction.update())}return this},on:function(t,e){if(t!==r&&e!==r){var n=this.handlers;return d(R(t),(function(t){n[t]=n[t]||[],n[t].push(e)})),this}},off:function(t,e){if(t!==r){var n=this.handlers;return d(R(t),(function(t){e?n[t]&&n[t].splice(D(n[t],e),1):delete n[t]})),this}},emit:function(t,e){this.options.domEvents&&function(t,e){var i=n.createEvent("Event");i.initEvent(t,!0,!0),i.gesture=e,e.target.dispatchEvent(i)}(t,e);var i=this.handlers[t]&&this.handlers[t].slice();if(i&&i.length){e.type=t,e.preventDefault=function(){e.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](e),r++}},destroy:function(){this.element&&ae(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},o(oe,{INPUT_START:X,INPUT_MOVE:V,INPUT_END:F,INPUT_CANCEL:L,STATE_POSSIBLE:Ft,STATE_BEGAN:Lt,STATE_CHANGED:Bt,STATE_ENDED:qt,STATE_RECOGNIZED:Wt,STATE_CANCELLED:Ht,STATE_FAILED:Gt,DIRECTION_NONE:B,DIRECTION_LEFT:q,DIRECTION_RIGHT:W,DIRECTION_UP:H,DIRECTION_DOWN:G,DIRECTION_HORIZONTAL:U,DIRECTION_VERTICAL:Z,DIRECTION_ALL:$,Manager:se,Input:Q,TouchAction:Vt,TouchInput:xt,MouseInput:ut,PointerEventInput:vt,TouchMouseInput:Dt,SingleTouchInput:_t,Recognizer:Ut,AttrRecognizer:Kt,Tap:re,Pan:Qt,Swipe:ie,Pinch:te,Rotate:ne,Press:ee,on:E,off:x,each:d,merge:m,extend:g,assign:o,inherit:y,bindFn:_,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=oe,t.exports?t.exports=oe:e.Hammer=oe}(window,document)}({get exports(){return S},set exports(t){S=t}});var N=S;function z(t){return CSS.escape(t)}var j={min:.2,max:4},k=10,Y=.1,X=250;function V(t,e,n,i,r){var o=this;this._canvas=i,this._elementRegistry=r,this._eventBus=n,this._injector=e,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._init();var s=new N.Manager(document);s.add(new N.Pan),s.on("panmove",p),s.on("panend",f);var a=new N.Manager(this._svg);a.add(new N.Pan),a.on("panstart",u(!0)),a.add(new N.Tap),a.on("tap",(function(t){c($(t))}));var h=new N.Manager(this._viewportDom);function c(t){o._state._svgClientRect&&!W(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),L(F({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function u(t){return function(e){var n=$(e);o._state._svgClientRect&&!W(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t&&c(n);var r=F({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),s=i.viewbox(),a=function(t,e){var n={x:e.x+e.width/2,y:e.y+e.height/2};return{x:t.x-n.x,y:t.y-n.y}}(r,s),h=o._viewportDom.getBoundingClientRect(),u={x:n.x-h.left+1,y:n.y-h.top+1};I(o._state,{cachedViewbox:s,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:a,offsetViewportDom:u,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),l.bind(document,"mousemove",p),l.bind(document,"mouseup",f)}}function p(t){var e=$(t);if(o._state.isDragging){o._state._svgClientRect&&!W(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;I(o._viewportDom.style,{top:e.y-n.y-r.top+"px",left:e.x-n.x-r.left+"px"});var s=G(r,{top:e.y-n.y-r.top,left:e.x-n.x-r.left,width:i.width,height:i.height});I(o._overlay.style,{clipPath:s});var a=F({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);L({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function f(t){var e=$(t);o._state.isDragging&&(o._state.initialDragPosition.x===e.x&&o._state.initialDragPosition.y===e.y&&c(t),o._update(),I(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),l.unbind(document,"mousemove",p),l.unbind(document,"mouseup",f))}h.add(new N.Pan),h.on("panstart",u(!1)),this.toggle(t&&t.open||!1),l.bind(this._viewportDom,"mousedown",u(!1)),l.bind(this._svg,"mousedown",u(!0)),l.bind(this._parent,"wheel",(function(t){if(t.preventDefault(),t.stopPropagation(),t.ctrlKey&&(o._state._svgClientRect&&!W(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e=t,n=o._state._svgClientRect,e.x>n.left&&e.x<n.left+n.width&&e.y>n.top&&e.y<n.top+n.height)){var e,n,r,s,a,h,c=0===t.deltaMode?.02:.32,u=Math.sqrt(Math.pow(t.deltaY,2)+Math.pow(t.deltaX,2))*H(t.deltaY)*-c;if(o._state.zoomDelta+=u,Math.abs(o._state.zoomDelta)>Y){var l=u>0?1:-1,p=Math.log(i.zoom())/Math.log(10),f=(r=j,s=2*k,a=Math.log(r.min)/Math.log(10),h=Math.log(r.max)/Math.log(10),(Math.abs(a)+Math.abs(h))/s),d=Math.round(p/f)*f;d+=f*l;var v=Math.pow(10,d);i.zoom(function(t,e){return Math.max(t.min,Math.min(t.max,e))}(j,v),g),o._state.zoomDelta=0;var g=F({x:t.clientX-o._state._svgClientRect.left,y:t.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);L(g,o._canvas),o._update()}}})),l.bind(this._toggle,"click",(function(t){t.preventDefault(),t.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(t){var e=t.element;o._addElement(e),o._update()})),n.on(["shape.removed","connection.removed"],(function(t){var e=t.element;o._removeElement(e),o._update()})),n.on("elements.changed",X,(function(t){t.elements.forEach((function(t){o._updateElement(t)})),o._update()})),n.on("element.updateId",(function(t){var e=t.element,n=t.newId;o._updateElementId(e,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(t){o._clear(),(t.element||t.plane.rootElement).children.forEach((function(t){o._addElement(t)})),o._update()}))}function F(t,e,n){var i=e.getBoundingClientRect(),r=function(t,e){var n=t.width/t.height,i=I({},{x:t.x,y:t.y,width:t.width,height:t.height});if(n>e){var r=i.width*(1/e);I(i,{y:i.y-(r-i.height)/2,height:r})}else if(n<e){var o=i.height*e;I(i,{x:i.x-(o-i.width)/2,width:o})}return i}(n,i.width/i.height);return{x:B(t.x,0,i.width,r.x,r.x+r.width),y:B(t.y,0,i.height,r.y,r.y+r.height)}}function L(t,e){var n=e.viewbox(),i=n.width,r=n.height;e.viewbox({x:t.x-i/2,y:t.y-r/2,width:i,height:r})}function B(t,e,n,i,r){return(t-e)*(r-i)/(n-e)+i}function q(t,e,n){var i=function(t){var e=p(".children",t);e||f(t,e=b("g",{class:"children"}));return e}(e),r=[].slice.call(i.childNodes)[n];r?e.insertBefore(t,r.nextSibling):e.appendChild(t)}function W(t){return 0===t.width&&0===t.height}V.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],V.prototype._init=function(){var t=this._canvas.getContainer(),e=this._parent=document.createElement("div");i(e).add("djs-minimap"),t.appendChild(e);var n=this._toggle=document.createElement("div");i(n).add("toggle"),e.appendChild(n);var r=this._map=document.createElement("div");i(r).add("map"),e.appendChild(r);var o=this._svg=b("svg");m(o,{width:"100%",height:"100%"}),f(r,o),f(o,this._elementsGroup=b("g"));var s=this._viewportGroup=b("g");f(o,s);var a,h=this._viewport=b("rect");(a=h,new _(a)).add("viewport"),f(s,h),l.bind(e,"mousedown",(function(t){t.stopPropagation()}));var c=this._viewportDom=document.createElement("div");i(c).add("viewport-dom"),this._parent.appendChild(c);var u=this._overlay=document.createElement("div");i(u).add("overlay"),this._parent.appendChild(u)},V.prototype._update=function(){var t=this._canvas.viewbox(),e=t.inner,n=t.outer;if(Z(t)){var i,r,o,s,a=n.width-e.width,h=n.height-e.height;e.width<n.width?(i=e.x-a/2,o=n.width,e.x+e.width<n.width&&(i=Math.min(0,e.x))):(i=e.x,o=e.width),e.height<n.height?(r=e.y-h/2,s=n.height,e.y+e.height<n.height&&(r=Math.min(0,e.y))):(r=e.y,s=e.height),i-=50,r-=50,o+=100,s+=100,this._lastViewbox={x:i,y:r,width:o,height:s},m(this._svg,{viewBox:i+", "+r+", "+o+", "+s}),m(this._viewport,{x:t.x,y:t.y,width:t.width,height:t.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),u=this._viewport.getBoundingClientRect(),l={top:u.top-c.top,left:u.left-c.left,width:u.width,height:u.height};I(this._viewportDom.style,{top:l.top+"px",left:l.left+"px",width:l.width+"px",height:l.height+"px"});var p=G(c,l);I(this._overlay.style,{clipPath:p})}},V.prototype.open=function(){I(this._state,{isOpen:!0}),i(this._parent).add("open");var t=this._injector.get("translate",!1)||function(t){return t};e(this._toggle,"title",t("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},V.prototype.close=function(){I(this._state,{isOpen:!1}),i(this._parent).remove("open");var t=this._injector.get("translate",!1)||function(t){return t};e(this._toggle,"title",t("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},V.prototype.toggle=function(t){var e=this.isOpen();void 0===t&&(t=!e),t!=e&&(t?this.open():this.close())},V.prototype.isOpen=function(){return this._state.isOpen},V.prototype._updateElement=function(t){try{void 0!==t.parent&&null!==t.parent&&(this._removeElement(t),this._addElement(t))}catch(t){console.warn("Minimap#_updateElement errored",t)}},V.prototype._updateElementId=function(t,e){try{var n=p("#"+z(t.id),this._elementsGroup);n&&(n.id=e)}catch(t){console.warn("Minimap#_updateElementId errored",t)}},V.prototype.isOnActivePlane=function(t){var e=this._canvas;return e.findRoot?e.findRoot(t)===e.getRootElement():!e.findPlane||e.findPlane(t)===e.getActivePlane()},V.prototype._addElement=function(t){var e=this;if(this._removeElement(t),this.isOnActivePlane(t)){var n,i,r,o=this._createElement(t),s=p("#"+z(t.parent.id),this._elementsGroup);if(o){var a=function(t,e){var n=p(".djs-children",e.parentNode);if(!n)return;var i=[].slice.call(n.childNodes),r=-1;return i.forEach((function(e,n){p(".djs-element",e)===t&&(r=n)})),r}(this._elementRegistry.getGraphics(t),this._elementRegistry.getGraphics(t.parent));return"undefined"!==a&&s?s.childNodes.length>a?q(o,s,a):q(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(t){return t.waypoints}(t)?(i=t.x,r=t.y,s&&(i-=(n=t.parent).x,r-=n.y),m(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=t.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),m(o,{transform:"translate("+i+" "+r+")"})),t.children&&t.children.length&&t.children.forEach((function(t){e._addElement(t)})),o}}},V.prototype._removeElement=function(t){var e=this._svg.getElementById(t.id);e&&w(e)},V.prototype._createElement=function(t){var e,n=this._elementRegistry.getGraphics(t);if(n&&(e=function(t){return t.childNodes[0]}(n),e)){var i=function(t){return t.cloneNode(!0)}(e);return m(i,{id:t.id}),i}},V.prototype._clear=function(){!function(t){for(var e;e=t.firstChild;)w(e)}(this._elementsGroup)};var H=Math.sign||function(t){return t>=0?1:-1};function G(t,e){return"polygon("+[U(e.left,e.top),U(e.left+e.width,e.top),U(e.left+e.width,e.top+e.height),U(e.left,e.top+e.height),U(e.left,t.height),U(t.width,t.height),U(t.width,0),U(0,0),U(0,t.height),U(e.left,t.height)].join(", ")+")"}function U(t,e){return t+"px "+e+"px"}function Z(t){return A(t,(function(t){return e=t,"[object Object]"===C.call(e)?Z(t):function(t){return"[object Number]"===C.call(t)}(t)&&isFinite(t);var e}))}function $(t){return t.center?t.center:{x:t.clientX,y:t.clientY}}return{__init__:["minimap"],minimap:["type",V]}}));