vmes-flowable
Version:
ceshibao
2 lines • 457 kB
JavaScript
/*! jeeplus工作流设计器 | Copyright (c) 2020| jeeplus.org/license */
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).BpmnJS=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e,t){return e(t={exports:{}},t.exports),t.exports}var n=t((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));var i=function(e,t){return e(t={exports:{}},t.exports),t.exports}((function(e){var t=e.exports=function(e,n){if(n||(n=16),void 0===e&&(e=128),e<=0)return"0";for(var i=Math.log(Math.pow(2,e))/Math.log(n),r=2;i===1/0;r*=2)i=Math.log(Math.pow(2,e/r))/Math.log(n)*r;var o=i-Math.floor(i),a="";for(r=0;r<Math.floor(i);r++){a=Math.floor(Math.random()*n).toString(n)+a}if(o){var s=Math.pow(n,o);a=Math.floor(Math.random()*s).toString(n)+a}var c=parseInt(a,n);return c!==1/0&&c>=Math.pow(2,e)?t(e,n):a};t.rack=function(e,n,i){var r=function(r){var a=0;do{if(a++>10){if(!i)throw new Error("too many ID collisions, use more bits");e+=i}var s=t(e,n)}while(Object.hasOwnProperty.call(o,s));return o[s]=r,s},o=r.hats={};return r.get=function(e){return r.hats[e]},r.set=function(e,t){return r.hats[e]=t,r},r.bits=e||128,r.base=n||16,r}}));function r(e){if(!(this instanceof r))return new r(e);e=e||[128,36,1],this._seed=e.length?i.rack(e[0],e[1],e[2]):e}function o(e){return Array.prototype.concat.apply([],e)}r.prototype.next=function(e){return this._seed(e||!0)},r.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},r.prototype.claim=function(e,t){this._seed.set(e,t||!0)},r.prototype.assigned=function(e){return this._seed.get(e)||!1},r.prototype.unclaim=function(e){delete this._seed.hats[e]},r.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var a=Object.prototype.toString,s=Object.prototype.hasOwnProperty;function c(e){return void 0===e}function p(e){return void 0!==e}function u(e){return null==e}function l(e){return"[object Array]"===a.call(e)}function h(e){return"[object Object]"===a.call(e)}function d(e){return"[object Number]"===a.call(e)}function f(e){var t=a.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function m(e){return"[object String]"===a.call(e)}function y(e,t){return s.call(e,t)}function v(e,t){var n;return t=N(t),x(e,(function(e,i){if(t(e,i))return n=e,!1})),n}function g(e,t){var n=[];return x(e,(function(e,i){t(e,i)&&n.push(e)})),n}function x(e,t){var n;if(!c(e)){var i=l(e)?j:O;for(var r in e)if(y(e,r)&&!1===t(n=e[r],i(r)))return n}}function b(e,t){return c(e)?[]:(function(e){if(!l(e))throw new Error("must supply array")}(e),t=N(t),e.filter((function(e,n){return!t(e,n)})))}function _(e,t,n){return x(e,(function(e,i){n=t(n,e,i)})),n}function w(e,t){return!!_(e,(function(e,n,i){return e&&t(n,i)}),!0)}function E(e,t){return!!v(e,t)}function S(e,t){var n=[];return x(e,(function(e,i){n.push(t(e,i))})),n}function C(e){return e&&Object.keys(e)||[]}function R(e){return C(e).length}function T(e){return S(e,(function(e){return e}))}function A(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=D(t),x(e,(function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)})),n}function P(e){e=D(e);for(var t={},n=arguments.length,i=new Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];x(i,(function(n){return A(n,e,t)}));var o=S(t,(function(e,t){return e[0]}));return o}var k=P;function M(e,t){t=D(t);var n=[];return x(e,(function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++){if(r<n[a].d)return void n.splice(a,0,o)}n.push(o)})),S(n,(function(e){return e.v}))}function B(e){return function(t){return w(e,(function(e,n){return t[n]===e}))}}function D(e){return f(e)?e:function(t){return t[e]}}function N(e){return f(e)?e:function(t){return t===e}}function O(e){return e}function j(e){return Number(e)}function L(e,t){var n,i,r,o;function a(){var a=Date.now(),c=o+t-a;if(c>0)return s(c);e.apply(r,i),n=o=i=r=void 0}function s(e){n=setTimeout(a,e)}return function(){o=Date.now();for(var e=arguments.length,a=new Array(e),c=0;c<e;c++)a[c]=arguments[c];i=a,r=this,n||s(t)}}function I(e,t){return e.bind(t)}function z(){return(z=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function F(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return z.apply(void 0,[e].concat(n))}function $(e,t){var n={},i=Object(e);return x(t,(function(t){t in i&&(n[t]=e[t])})),n}function H(e,t){var n={};return x(Object(e),(function(e,i){-1===t.indexOf(i)&&(n[i]=e)})),n}function G(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var W=[].indexOf,V=function(e,t){if(W)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},U=/\s+/,q=Object.prototype.toString;function K(e){return new Y(e)}function Y(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function X(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}Y.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~V(t,e)||t.push(e),this.el.className=t.join(" "),this},Y.prototype.remove=function(e){if("[object RegExp]"==q.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=V(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},Y.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Y.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Y.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(U);return""===e[0]&&e.shift(),e},Y.prototype.has=Y.prototype.contains=function(e){return this.list?this.list.contains(e):!!~V(this.array(),e)};var Z="undefined"!=typeof Element?Element.prototype:{},Q=Z.matches||Z.matchesSelector||Z.webkitMatchesSelector||Z.mozMatchesSelector||Z.msMatchesSelector||Z.oMatchesSelector,J=function(e,t){if(!e||1!==e.nodeType)return!1;if(Q)return Q.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};function ee(e,t,n){for(var i=n?e:e.parentNode;i&&i.nodeType!==document.DOCUMENT_NODE&&i.nodeType!==document.DOCUMENT_FRAGMENT_NODE;){if(J(i,t))return i;i=i.parentNode}return J(i,t)?i:null}var te=window.addEventListener?"addEventListener":"attachEvent",ne=window.removeEventListener?"removeEventListener":"detachEvent",ie="addEventListener"!==te?"on":"",re={bind:function(e,t,n,i){return e[te](ie+t,n,i||!1),n},unbind:function(e,t,n,i){return e[ne](ie+t,n,i||!1),n}},oe=["focus","blur"];var ae,se={bind:function(e,t,n,i,r){return-1!==oe.indexOf(n)&&(r=!0),re.bind(e,n,(function(n){var r=n.target||n.srcElement;n.delegateTarget=ee(r,t,!0),n.delegateTarget&&i.call(e,n)}),r)},unbind:function(e,t,n,i){return-1!==oe.indexOf(t)&&(i=!0),re.unbind(e,t,n,i)}},ce=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){return(r=t.createElement("html")).innerHTML=e,r.removeChild(r.lastChild)}var r,o=ue[i]||ue._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},pe=!1;"undefined"!=typeof document&&((ae=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',pe=!ae.getElementsByTagName("link").length,ae=void 0);var ue={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:pe?[1,"X<div>","</div>"]:[0,"",""]};function le(e,t){return(t=t||document).querySelector(e)}function he(e,t){return(t=t||document).querySelectorAll(e)}function de(e){e.parentNode&&e.parentNode.removeChild(e)}function fe(e,t){return t.appendChild(function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}(e,t))}function me(e,t){return fe(t,e),e}ue.td=ue.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],ue.option=ue.optgroup=[1,'<select multiple="multiple">',"</select>"],ue.thead=ue.tbody=ue.colgroup=ue.caption=ue.tfoot=[1,"<table>","</table>"],ue.polyline=ue.ellipse=ue.polygon=ue.circle=ue.text=ue.line=ue.path=ue.rect=ue.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var ye={"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":2,"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":2,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function ve(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ye[i];r?(2===r&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function ge(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return ye[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);ve(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)ve(e,i,t[i])}(e,t);return e}function xe(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1}var be=/\s+/,_e=Object.prototype.toString;function we(e){return void 0!==e}function Ee(e){return new Se(e)}function Se(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Ce(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Re(e){for(var t;t=e.firstChild;)Ce(t);return e}function Te(e){return e.cloneNode(!0)}Se.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~xe(t,e)||t.push(e),we(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Se.prototype.remove=function(e){if("[object RegExp]"===_e.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=xe(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Se.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Se.prototype.toggle=function(e,t){return this.list?(we(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(we(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Se.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(be);return""===e[0]&&e.shift(),e},Se.prototype.has=Se.prototype.contains=function(e){return this.list?this.list.contains(e):!!~xe(this.array(),e)};var Ae="http://www.w3.org/2000/svg",Pe='<svg xmlns="'+Ae+'"';function ke(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Ae)&&(e=Pe+e.substring(4)):(e=Pe+">"+e+"</svg>",t=!0);var n=function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e);if(!t)return n;for(var i=document.createDocumentFragment(),r=n.firstChild;r.firstChild;)i.appendChild(r.firstChild);return i}function Me(e,t){var n;return"<"===e.charAt(0)?(n=ke(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Ae,e),t&&ge(n,t),n}var Be=Me("svg");function De(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function Ne(e){return e?Be.createSVGTransformFromMatrix(e):Be.createSVGTransform()}var Oe=/([&<>]{1})/g,je=/([\n\r"]{1})/g,Le={"&":"&","<":"<",">":">",'"':"'"};function Ie(e,t){return e.replace(t,(function(e,t){return Le[t]||t}))}function ze(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Ie(e.textContent,Oe));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n<i;++n)o=r.item(n),t.push(" ",o.name,'="',Ie(o.value,je),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)ze(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Ie(e.nodeValue,Oe),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function Fe(e,t){var n=ke(t);if(Re(e),t){(function(e){return"#document-fragment"===e.nodeName})(n)||(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)fe(r[o],e)}}function $e(e,t){if(void 0!==t){try{Fe(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)ze(t,n),t=t.nextSibling;return n.join("")}(e)}function He(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ge(e,t){var n=e.transform.baseVal;return t&&(Array.isArray(t)||(t=[t]),function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(He(e,i))}(n,t)),n.consolidate()}var We=/^class /;function Ve(e){return"[object Array]"===Object.prototype.toString.call(e)}function Ue(){var e=Array.prototype.slice.call(arguments);1===e.length&&Ve(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var qe=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Ke=/^function\s*[^(]*\(\s*([^)]*)\)/m,Ye=/\/\*([^*]*)\*\//m;function Xe(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return We.test(e.toString())}(e)?qe:Ke);return t&&t[1]&&t[1].split(",").map((function(e){return(t=e.match(Ye))?t[1].trim():e.trim()}))||[]}function Ze(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}var Qe="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function Je(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function et(e,t){t=t||{get:function(e,t){if(n.push(e),!1===t)return null;throw a('No provider for "'+e+'"!')}};var n=[],i=this._providers=Object.create(t._providers||null),r=this._instances=Object.create(null),o=r.injector=this,a=function(e){var t=n.join(" -> ");return n.length=0,new Error(t?e+" (Resolving: "+t+")":e)},s=function e(o,s){if(!i[o]&&-1!==o.indexOf(".")){for(var c=o.split("."),p=e(c.shift());c.length;)p=p[c.shift()];return p}if(tt(r,o))return r[o];if(tt(i,o)){if(-1!==n.indexOf(o))throw n.push(o),a("Cannot resolve circular dependency!");return n.push(o),r[o]=i[o][0](i[o][1]),n.pop(),r[o]}return t.get(o,s)},c=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!Ve(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Ue(e.slice())}var n=e.$inject||Xe(e),i=n.map((function(e){return tt(t,e)?t[e]:s(e)}));return{fn:e,dependencies:i}},p=function(e){var t=c(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(Je(n))))},u=function(e,t,n){var i=c(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(Je(r)))},l=function(e){return Ue((function(t){return e.get(t)}))},h={factory:u,type:p,value:function(e){return e}};e.forEach((function(e){function t(e,t){return"value"!==e&&Ve(t)&&(t=Ue(t.slice())),t}if(e instanceof Ze)e.forEach((function(e){var n=e[0],r=e[1],o=e[2];i[n]=[h[r],t(r,o),r]}));else if("object"===(void 0===e?"undefined":Qe(e)))if(e.__exports__){var n=Object.keys(e).reduce((function(t,n){return"__"!==n.substring(0,2)&&(t[n]=e[n]),t}),Object.create(null)),r=new et((e.__modules__||[]).concat([n]),o),a=Ue((function(e){return r.get(e)}));e.__exports__.forEach((function(e){i[e]=[a,e,"private",r]}))}else Object.keys(e).forEach((function(n){if("private"!==e[n][2]){var r=e[n][0],o=e[n][1];i[n]=[h[r],t(r,o),r]}else i[n]=e[n]}))})),this.get=s,this.invoke=u,this.instantiate=p,this.createChild=function(e,t){if(t&&t.length){var n,r,a,s,c=Object.create(null),p=Object.create(null),u=[],h=[],d=[];for(var f in i)n=i[f],-1!==t.indexOf(f)&&("private"===n[2]?-1===(r=u.indexOf(n[3]))?(a=n[3].createChild([],t),s=l(a),u.push(n[3]),h.push(a),d.push(s),c[f]=[s,f,"private",a]):c[f]=[d[r],f,"private",h[r]]:c[f]=[n[2],n[1]],p[f]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach((function(e){-1!==n[1].$scope.indexOf(e)&&(c[f]=[n[2],n[1]],p[e]=!0)}));t.forEach((function(e){if(!p[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')})),e.unshift(c)}return new et(e,o)}}function tt(e,t){return Object.hasOwnProperty.call(e,t)}function nt(e,t){var n=this;t=t||1e3,e.on(["render.shape","render.connection"],t,(function(e,t){var i=e.type,r=t.element,o=t.gfx;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r):n.drawConnection(o,r)})),e.on(["render.getShapePath","render.getConnectionPath"],t,(function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)}))}function it(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function rt(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function ot(e,t){var n=Me("polyline");return ge(n,{points:rt(e)}),t&&ge(n,t),n}function at(e){return g(e,(function(t){return!v(e,(function(e){return e!==t&&function e(t,n){if(!n)return;if(t===n)return n;if(!t.parent)return;return e(t.parent,n)}(t,e)}))}))}function st(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function ct(e,t,n){n=n||0,l(e)||(e=[e]),x(e,(function(e,i){var r=t(e,i,n);l(r)&&r.length&&ct(r,t,n+1)}))}function pt(e,t){return function(e,t,n){var i=[],r=[];return ct(e,(function(e,o,a){st(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&st(r,s,t))return s})),i}(e,!t,-1)}function ut(e,t){var n,i,r,o;return t=!!t,l(e)||(e=[e]),x(e,(function(e){var a=e;e.waypoints&&!t&&(a=ut(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,u=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+u>r||void 0===r)&&(r=s+u),(c+p>o||void 0===o)&&(o=c+p)})),{x:n,y:i,height:o-i,width:r-n}}function lt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ht(e){return!(!e||!e.isFrame)}function dt(e,t){return F({},e||{},t||{})}nt.prototype.canRender=function(){},nt.prototype.drawShape=function(){},nt.prototype.drawConnection=function(){},nt.prototype.getShapePath=function(){},nt.prototype.getConnectionPath=function(){};function ft(e,t){nt.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2}),this.FRAME_STYLE=t.style(["no-fill"],{stroke:"fuchsia",strokeDasharray:4,strokeWidth:2})}n(ft,nt),ft.prototype.canRender=function(){return!0},ft.prototype.drawShape=function(e,t){var n=Me("rect");return ge(n,{x:0,y:0,width:t.width||0,height:t.height||0}),ht(t)?ge(n,this.FRAME_STYLE):ge(n,this.SHAPE_STYLE),me(e,n),n},ft.prototype.drawConnection=function(e,t){var n=ot(t.waypoints,this.CONNECTION_STYLE);return me(e,n),n},ft.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return it([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},ft.prototype.getConnectionPath=function(e){var t,n,i=e.waypoints,r=[];for(t=0;n=i[t];t++)n=n.original||n,r.push([0===t?"M":"L",n.x,n.y]);return it(r)},ft.$inject=["eventBus","styles"];var mt={__init__:["defaultRenderer"],defaultRenderer:["type",ft],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){return F(this.style(t,n),{class:e})},this.style=function(t,n){l(t)||n||(n=t,t=[]);var i=_(t,(function(t,n){return F(t,e[n]||{})}),{});return n?F(i,n):i},this.computeStyle=function(e,n,i){return l(n)||(i=n,n=[]),t.style(n||[],F({},i,e||{}))}}]};function yt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function vt(e,t,n){if(e&&t){"number"!=typeof n&&(n=-1);var i=e.indexOf(t);if(-1!==i){if(i===n)return;if(-1===n)return;e.splice(i,1)}-1!==n?e.splice(n,0,t):e.push(t)}}function gt(e,t){return e&&t?e.indexOf(t):-1}function xt(e,t){return Math.round(e*t)/t}function bt(e){return d(e)?e+"px":e}function _t(e,t,n){var i=Me("g");Ee(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var wt={shape:["x","y","width","height"],connection:["waypoints"]};function Et(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function St(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Et.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Et.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=F({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),F(n.style,{position:"relative",overflow:"hidden",width:bt(e.width),height:bt(e.height)}),t.appendChild(n),n}(e),i=this._svg=Me("svg");ge(i,{width:"100%",height:"100%"}),me(n,i);var r=this._viewport=_t(i,"viewport");this._layers={},!1!==e.deferUpdate&&(this._viewboxChanged=L(I(this._viewboxChanged,this),300)),t.on("diagram.init",(function(){t.fire("canvas.init",{svg:i,viewport:r})}),this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],(function(){delete this._cachedViewbox}),this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Et.prototype._destroy=function(e){this._eventBus.fire("canvas.destroy",{svg:this._svg,viewport:this._viewport});var t=this._container.parentNode;t&&t.removeChild(this._container),delete this._svg,delete this._container,delete this._layers,delete this._rootElement,delete this._viewport},Et.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach((function(t){var n=lt(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)})),delete this._cachedViewbox},Et.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Et.prototype.getLayer=function(e,t){if(!e)throw new Error("must specify a name");var n=this._layers[e];if(n||(n=this._layers[e]=this._createLayer(e,t)),void 0!==t&&n.index!==t)throw new Error("layer <"+e+"> already created at index <"+t+">");return n.group},Et.prototype._createLayer=function(e,t){t||(t=0);var n=_(this._layers,(function(e,n){return t>=n.index&&e++,e}),0);return{group:_t(this._viewport,"layer-"+e,n),index:t}},Et.prototype.getContainer=function(){return this._container},Et.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(x([i.gfx,i.secondaryGfx],(function(e){e&&(n?Ee(e).add(t):Ee(e).remove(t))})),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Et.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Et.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Et.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Ee(this.getGraphics(e)).has(t)},Et.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Et.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Et.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e,e},Et.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=wt[e];if(!w(n,(function(e){return void 0!==t[e]})))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Et.prototype._setParent=function(e,t,n){vt(t.children,e,n),e.parent=t},Et.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},Et.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Et.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Et.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),yt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Et.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Et.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Et.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Et.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Et.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Et.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s=this._viewport,c=this.getSize();return e?(this._changeViewbox((function(){r=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(r).translate(-e.x,-e.y);Ge(s,t)})),e):(t=this.getDefaultLayer().getBBox(),n=(i=Ge(s))?i.matrix:function(e,t,n,i,r,o){var a=Be.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return De(a,e);case 6:return De(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=xt(n.a,1e3),o=xt(-n.e||0,1e3),a=xt(-n.f||0,1e3),e=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:t.width,height:t.height,x:t.x,y:t.y},outer:c})},Et.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox((function(){e=F({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),St(t,n)})),{x:n.e,y:n.f}},Et.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox((function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)})),xt(i.a,1e3)):this.viewbox(e).scale;var n,i},Et.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Et.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),u=(i=s.getCTM()).a;return t?(n=F(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/u*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),St(this._viewport,o),o},Et.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Et.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},Et.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Ct="data-element-id";function Rt(e){this._elements={},this._eventBus=e}Rt.$inject=["eventBus"],Rt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ge(t,Ct,i),n&&ge(n,Ct,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Rt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ge(i.gfx,Ct,""),i.secondaryGfx&&ge(i.secondaryGfx,Ct,""),delete t[n])},Rt.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Rt.prototype.get=function(e){var t;t="string"==typeof e?e:e&&ge(e,Ct);var n=this._elements[t];return n&&n.element},Rt.prototype.filter=function(e){var t=[];return this.forEach((function(n,i){e(n,i)&&t.push(n)})),t},Rt.prototype.find=function(e){for(var t=this._elements,n=Object.keys(t),i=0;i<n.length;i++){var r=t[n[i]],o=r.element;if(e(o,r.gfx))return o}},Rt.prototype.getAll=function(){return this.filter((function(e){return e}))},Rt.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach((function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)}))},Rt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Rt.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var Tt={extend:function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,n){var o=this.indexOf(e);if(void 0===n){if(-1!==o)return;n=this.length}-1!==o&&this.splice(o,1),this.splice(n,0,e),-1===o&&t.set(e,r,i)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function At(e,t,n){var i=Tt.extend(n[t.name]||[],e,t,n);Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:i}),i.length&&i.forEach((function(i){e.set(i,t.inverse,n)}))}function Pt(e,t){if(!(this instanceof Pt))return new Pt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Pt.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?At(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{configurable:t.configurable,enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},Pt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Tt.isExtended(n)||At(this,t,e),n},Pt.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Pt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Pt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var kt=Pt,Mt=Tt;kt.Collection=Mt;var Bt=new kt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Dt=new kt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Nt=new kt({name:"attachers",collection:!0},{name:"host"}),Ot=new kt({name:"outgoing",collection:!0},{name:"source"}),jt=new kt({name:"incoming",collection:!0},{name:"target"});function Lt(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Bt.bind(this,"parent"),Dt.bind(this,"labels"),Ot.bind(this,"outgoing"),jt.bind(this,"incoming")}function It(){Lt.call(this),Bt.bind(this,"children"),Nt.bind(this,"host"),Nt.bind(this,"attachers")}function zt(){It.call(this)}function Ft(){It.call(this),Dt.bind(this,"labelTarget")}function $t(){Lt.call(this),Ot.bind(this,"source"),jt.bind(this,"target")}n(It,Lt),n(zt,It),n(Ft,It),n($t,Lt);var Ht={connection:$t,shape:It,label:Ft,root:zt};function Gt(){this._uid=12}Gt.prototype.createRoot=function(e){return this.create("root",e)},Gt.prototype.createLabel=function(e){return this.create("label",e)},Gt.prototype.createShape=function(e){return this.create("shape",e)},Gt.prototype.createConnection=function(e){return this.create("connection",e)},Gt.prototype.create=function(e,t){return(t=F({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Ht[e];if(!n)throw new Error("unknown type: <"+e+">");return F(new n,t)}(e,t)};var Wt=Array.prototype.slice;function Vt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Ut(){}function qt(e){return e.childNodes[0]}function Kt(e,t,n,i,r){var o=Ne();o.setTranslate(t,n);var a=Ne();a.setRotate(i||0,0,0);var s=Ne();s.setScale(r||1,r||1),Ge(e,[o,a,s])}function Yt(e,t,n){var i=Ne();i.setTranslate(t,n),Ge(e,i)}function Xt(e,t){var n=Ne();n.setRotate(t,0,0),Ge(e,n)}function Zt(e,t){this._eventBus=e,this._elementRegistry=t}function Qt(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}Vt.prototype.on=function(e,t,n,i){if(e=l(e)?e:[e],f(t)&&(i=n,n=t,t=1e3),!d(t))throw new Error("priority must be a number");var r=n;i&&((r=I(n,i)).__fn=n.__fn||n);var o=this;e.forEach((function(e){o._addListener(e,{priority:t,callback:r,next:null})}))},Vt.prototype.once=function(e,t,n,i){var r=this;if(f(t)&&(i=n,n=t,t=1e3),!d(t))throw new Error("priority must be a number");function o(){var t=n.apply(i,arguments);return r.off(e,o),t}o.__fn=n,this.on(e,t,o)},Vt.prototype.off=function(e,t){e=l(e)?e:[e];var n=this;e.forEach((function(e){n._removeListener(e,t)}))},Vt.prototype.createEvent=function(e){var t=new Ut;return t.init(e),t},Vt.prototype.fire=function(e,t){var n,i,r,o;if(o=Wt.call(arguments),"object"==typeof e&&(e=(t=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Ut?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},Vt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Vt.prototype._destroy=function(){this._listeners={}},Vt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Vt.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},Vt.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority<t.priority)return t.next=i,void(n?n.next=t:this._setListeners(e,t));n=i,i=i.next}n.next=t}else this._setListeners(e,t)},Vt.prototype._getListeners=function(e){return this._listeners[e]},Vt.prototype._setListeners=function(e,t){this._listeners[e]=t},Vt.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(;o;)n=o.next,(r=o.callback)!==t&&r.__fn!==t||(i?i.next=n:this._setListeners(e,n)),i=o,o=n;else this._setListeners(e,null)},Ut.prototype.stopPropagation=function(){this.cancelBubble=!0},Ut.prototype.preventDefault=function(){this.defaultPrevented=!0},Ut.prototype.init=function(e){F(this,e||{})},Zt.$inject=["eventBus","elementRegistry"],Zt.prototype._getChildrenContainer=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Ee(t=Me("g")).add("djs-children"),me(n.parentNode,t)):t=n,t},Zt.prototype._clear=function(e){var t=qt(e);return X(t),t},Zt.prototype._createContainer=function(e,t,n,i){var r=Me("g");Ee(r).add("djs-group"),void 0!==n?Qt(r,t,t.childNodes[n]):me(t,r);var o=Me("g");Ee(o).add("djs-element"),Ee(o).add("djs-"+e),i&&Ee(o).add("djs-frame"),me(r,o);var a=Me("g");return Ee(a).add("djs-visual"),me(o,a),o},Zt.prototype.create=function(e,t,n){var i=this._getChildrenContainer(t.parent);return this._createContainer(e,i,n,ht(t))},Zt.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;x(_(e,(function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e}),{}),(function(e){var i=e.children;if(i){var r=t._getChildrenContainer(e);x(i.slice().reverse(),(function(e){Qt(n.getGraphics(e).parentNode,r)}))}}))},Zt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Zt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Zt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Zt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Zt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Yt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?ge(n,"display","none"):ge(n,"display","block")}},Zt.prototype.remove=function(e){Ce(this._elementRegistry.getGraphics(e).parentNode)};var Jt={__depends__:[mt],__init__:["canvas"],canvas:["type",Et],elementRegistry:["type",Rt],elementFactory:["type",Gt],eventBus:["type",Vt],graphicsFactory:["type",Zt]};function en(e){var t=[],n=[];function i(e){return t.indexOf(e)>=0}e.forEach((function e(r){i(r)||((r.__depends__||[]).forEach(e),i(r)||(!function(e){t.push(e)}(r),(r.__init__||[]).forEach((function(e){n.push(e)}))))}));var r=new et(t);return n.forEach((function(e){try{r["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}})),r}function tn(e,t){this.injector=t=t||function(e){return en([{config:["value",e=e||{}]},Jt].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function nn(){}function rn(e,t){this.model=e,this.properties=t}tn.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},tn.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},nn.prototype.get=function(e){return this.$model.properties.get(this,e)},nn.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},rn.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(nn.prototype);x(e.properties,(function(e){e.isMany||void 0===e.default||(i[e.name]=e.default)})),n.defineModel(i,t),n.defineDescriptor(i,e);var r=e.ns.name;function o(e){n.define(this,"$type",{value:r,enumerable:!0}),n.define(this,"$attrs",{value:{}}),n.define(this,"$parent",{writable:!0}),x(e,I((function(e,t){this.set(t,e)}),this))}return o.prototype=i,o.hasType=i.$instanceOf=this.model.hasType,n.defineModel(o,t),n.defineDescriptor(o,e),o};var on={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},an={String:function(e){return e},Boolean:function(e){return"true"===e},Integer:function(e){return parseInt(e,10)},Real:function(e){return parseFloat(e,10)}};function sn(e,t){var n=an[e];return n?n(t):t}function cn(e){return!!on[e]}function pn(e){return!!an[e]}function un(e,t){var n,i,r=e.split(/:/);if(1===r.length)n=e,i=t;else{if(2!==r.length)throw new Error("expected <prefix:localName> or <localName>, got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function ln(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function hn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,x(e,I(this.registerPackage,this))}function dn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function fn(e){this.model=e}function mn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function yn(e){this.properties=new fn(this),this.factory=new rn(this,this.properties),this.registry=new hn(e,this.properties),this.typeCache={}}ln.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},ln.prototype.addProperty=function(e,t,n){"boolean"==typeof t&&(n=t,t=void 0),this.addNamedProperty(e,!1!==n);var i=this.properties;void 0!==t?i.splice(t,0,e):i.push(e)},ln.prototype.replaceProperty=function(e,t,n){var i=e.ns,r=this.properties,o=this.propertiesByName,a=e.name!==t.name;if(e.isId){if(!t.isId)throw new Error("property <"+t.ns.name+"> must be id property to refine <"+e.ns.name+">");this.setIdProperty(t,!1)}if(e.isBody){if(!t.isBody)throw new Error("property <"+t.ns.name+"> must be body property to refine <"+e.ns.name+">");this.setBodyProperty(t,!1)}var s=r.indexOf(e);if(-1===s)throw new Error("property <"+i.name+"> not found in property list");r.splice(s,1),this.addProperty(t,n?void 0:s,a),o[i.name]=o[i.localName]=t},ln.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=un(r[0],i),a=un(r[1],o.prefix).name,s=this.propertiesByName[a];if(!s)throw new Error("refined property <"+a+"> not found");this.replaceProperty(s,e,n),delete e.redefines},ln.prototype.addNamedProperty=function(e,t){var n=e.ns,i=this.propertiesByName;t&&(this.assertNotDefined(e,n.name),this.assertNotDefined(e,n.localName)),i[n.name]=i[n.localName]=e},ln.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},ln.prototype.setBodyProperty=function(e,t){if(t&&this.bodyProperty)throw new Error("body property defined multiple times (<"+this.bodyProperty.ns.name+">, <"+e.ns.name+">)");this.bodyProperty=e},ln.prototype.setIdProperty=function(e,t){if(t&&this.idProperty)throw new Error("id property defined multiple times (<"+this.idProperty.ns.name+">, <"+e.ns.name+">)");this.idProperty=e},ln.prototype.assertNotDefined=function(e,t){var n=e.name,i=this.propertiesByName[n];if(i)throw new Error("property <"+n+"> already defined; override of <"+i.definedBy.ns.name+"#"+i.ns.name+"> by <"+e.definedBy.ns.name+"#"+e.ns.name+"> not allowed without redefines")},ln.prototype.hasProperty=function(e){return this.propertiesByName[e]},ln.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(x(e.properties,I((function(n){n=F({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))}),this)),i.push(e),n[r]=e)},hn.prototype.getPackage=function(e){return this.packageMap[e]},hn.prototype.getPackages=function(){return this.packages},hn.prototype.registerPackage=function(e){e=F({},e);var t=this.packageMap;dn(t,e,"prefix"),dn(t,e,"uri"),x(e.types,I((function(t){this.registerType(t,e)}),this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},hn.prototype.registerType=function(e,t){var n=un((e=F({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:F(e.meta||{})})).name,t.prefix),i=n.name,r={};x(e.properties,I((function(e){var t=un(e.name,n.prefix),i=t.name;cn(e.type)||(e.type=un(e.type,t.prefix).name),F(e,{ns:t,name:i}),r[i]=e}),this)),F(e,{ns:n,name:i,propertiesByName:r}),x(e.extends,I((function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)}),this)),this.definePackage(e,t),this.typeMap[i]=e},hn.prototype.mapTypes=function(e,t,n){var i=cn(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=un(n,cn(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");x(i.superClass,n?o:a),t(i,!n),x(i.traits,o)},hn.prototype.getEffectiveDescriptor=function(e){var t=un(e),n=new ln(t);this.mapTypes(t,(function(e,t){n.addTrait(e,t)}));var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},hn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},fn.prototype.set=function(e,t,n){var i=this.model.getPropertyDescriptor(e,t),r=i&&i.name;void 0===n?i?delete e[r]:delete e.$attrs[t]:i?r in e?e[r]=n:mn(e,i,n):e.$attrs[t]=n},fn.prototype.get=function(e,t){var n=this.model.getPropertyDescriptor(e,t);if(!n)return e.$attrs[t];var i=n.name;return!e[i]&&n.isMany&&mn(e,n,[]),e[i]},fn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},fn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},fn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},yn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},yn.prototype.getType=function(e){var t=this.typeCache,n=m(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},yn.prototype.createAny=function(e,t,n){var i=un(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),x(n,(function(e,t){h(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e})),r},yn.prototype.getPackage=function(e){return this.registry.getPackage(e)},yn.prototype.getPackages=function(){return this.registry.getPackages()},yn.prototype.getElementDescriptor=function(e){return e.$descriptor},yn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},yn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},yn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var vn=String.fromCharCode,gn=Object.prototype.hasOwnProperty,xn=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,bn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function _n(e,t,n,i){return i?gn.call(bn,i)?bn[i]:"&"+i+";":vn(t||parseInt(n,16))}function wn(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(xn,_n):e}Object.keys(bn).forEach((function(e){bn[e.toUpperCase()]=bn[e]}));function En(e){return new Error(e)}function Sn(e){return"missing namespace for prefix <"+e+">"}function Cn(e){return{get:e,enumerable:!0}}function Rn(e){var t,n={};for(t in e)n[t]=e[t];return n}function Tn(e){return e+"$uri"}function An(){return{line:0,column:0}}function Pn(e){throw e}function kn(e){if(!this)return new kn(e);var t,n,i,r,o,a,s,c,p,u=e&&e.proxy,l=Pn,h=An,d=!1,f=!1,m=null,y=!1;function v(e){e instanceof Error||(e=En(e)),m=e,l(e,h)}function g(e){o&&(e instanceof Error||(e=En(e)),o(e,h))}this.on=function(e,p){if("function"!=typeof p)throw En("required args <name, cb>");switch(e){case"openTag":n=p;break;case"text":t=p;break;case"closeTag":i=p;break;case"error":l=p;break;case"warn":o=p;break;case"cdata":r=p;break;case"attention":c=p;break;case"question":s=p;break;case"comment":a=p;break;default:throw En("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw En("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n["http://www.w3.org/2001/XMLSchema-instance"]="xsi",f=!0,p=n,this},this.parse=function(e){if("string"!=typeof e)throw En("required args <xml=string>");return m=null,function(e){var o,l,m,x,b,_,w,E,S,C,R,T=f?[]:null,A=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Tn(n)]=t;return i}(p):null,P=[],k=0,M=!1,B=!1,D=0,N=0,O="",j=0;function L(){if(null!==R)return R;var e,t,n,i,r,o,a,s,c,u,l,h=f&&A.xmlns,m=f&&d?[]:null,y=j,v=O,x=v.length,b={},_={};e:for(;y<x;y++)if(c=!1,!(32===(u=v.charCodeAt(y))||u<14&&u>8)){for((u<65||u>122||u>90&&u<97)&&95!==u&&58!==u&&(g("illegal first char attribute name"),c=!0),l=y+1;l<x;l++)if(!((u=v.charCodeAt(l))>96&&u<123||u>64&&u<91||u>47&&u<59||46===u||45===u||95===u)){if(32===u||u<14&&u>8){g("missing attribute value"),y=l;continue e}if(61===u)break;g("illegal attribute name char"),c=!0}if("xmlns:xmlns"===(s=v.substring(y,l))&&(g("illegal declaration of xmlns"),c=!0),34===(u=v.charCodeAt(l+1)))-1===(l=v.indexOf('"',y=l+2))&&-1!==(l=v.indexOf("'",y))&&(g("attribute value quote missmatch"),c=!0);else if(39===u)-1===(l=v.indexOf("'",y=l+2))&&-1!==(l=v.indexOf('"',y))&&(g("attribute value quote missmatch"),c=!0);else for(g("missing attribute value