UNPKG

461 kBJavaScriptView Raw
1/*! bpmn-js - bpmn-modeler v5.0.2 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2!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){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,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 l(e){return"[object Array]"===a.call(e)}function u(e){return"[object Object]"===a.call(e)}function h(e){return"[object Number]"===a.call(e)}function d(e){var t=a.call(e);return"[object Function]"===t||"[object AsyncFunction]"===t||"[object GeneratorFunction]"===t||"[object AsyncGeneratorFunction]"===t||"[object Proxy]"===t}function f(e){return"[object String]"===a.call(e)}function m(e,t){return s.call(e,t)}function y(e,t){var n;return t=D(t),g(e,function(e,i){if(t(e,i))return n=e,!1}),n}function v(e,t){var n=[];return g(e,function(e,i){t(e,i)&&n.push(e)}),n}function g(e,t){var n;if(!c(e)){var i=l(e)?N:B;for(var r in e)if(m(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=D(t),e.filter(function(e,n){return!t(e,n)}))}function x(e,t,n){return g(e,function(e,i){n=t(n,e,i)}),n}function _(e,t){return!!x(e,function(e,n,i){return e&&t(n,i)},!0)}function E(e,t){return!!y(e,t)}function w(e,t){var n=[];return g(e,function(e,i){n.push(t(e,i))}),n}function S(e){return e&&Object.keys(e)||[]}function C(e){return w(e,function(e){return e})}function T(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=M(t),g(e,function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)}),n}function R(e){e=M(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];return g(i,function(n){return T(n,e,t)}),w(t,function(e,t){return e[0]})}var A=R;function k(e,t){t=M(t);var n=[];return g(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)}),w(n,function(e){return e.v})}function P(e){return function(t){return _(e,function(e,n){return t[n]===e})}}function M(e){return d(e)?e:function(t){return t[e]}}function D(e){return d(e)?e:function(t){return t===e}}function B(e){return e}function N(e){return Number(e)}function O(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 j(e,t){return e.bind(t)}function L(){return(L=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 I(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 L.apply(void 0,[e].concat(n))}function z(e,t){var n={},i=Object(e);return g(t,function(t){t in i&&(n[t]=e[t])}),n}function F(e,t){var n={};return g(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n}function $(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var H=[].indexOf,G=function(e,t){if(H)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},W=/\s+/,V=Object.prototype.toString;function U(e){return new q(e)}function q(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function K(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}q.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~G(t,e)||t.push(e),this.el.className=t.join(" "),this},q.prototype.remove=function(e){if("[object RegExp]"==V.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=G(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},q.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},q.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)},q.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(W);return""===e[0]&&e.shift(),e},q.prototype.has=q.prototype.contains=function(e){return this.list?this.list.contains(e):!!~G(this.array(),e)};var Y=Element.prototype,X=Y.matchesSelector||Y.webkitMatchesSelector||Y.mozMatchesSelector||Y.msMatchesSelector||Y.oMatchesSelector,Z=function(e,t){if(X)return X.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var Q,J=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(Z(i,t))return i;i=i.parentNode}},ee=window.addEventListener?"addEventListener":"attachEvent",te=window.removeEventListener?"removeEventListener":"detachEvent",ne="addEventListener"!==ee?"on":"",ie={bind:function(e,t,n,i){return e[ee](ne+t,n,i||!1),n},unbind:function(e,t,n,i){return e[te](ne+t,n,i||!1),n}},re=["focus","blur"],oe={bind:function(e,t,n,i,r){return-1!==re.indexOf(n)&&(r=!0),ie.bind(e,n,function(n){var r=n.target||n.srcElement;n.delegateTarget=J(r,t,!0),n.delegateTarget&&i.call(e,n)},r)},unbind:function(e,t,n,i){-1!==re.indexOf(t)&&(i=!0),ie.unbind(e,t,n,i)}},ae=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){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=ce[i]||ce._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},se=!1;"undefined"!=typeof document&&((Q=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',se=!Q.getElementsByTagName("link").length,Q=void 0);var ce={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:se?[1,"X<div>","</div>"]:[0,"",""]};ce.td=ce.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],ce.option=ce.optgroup=[1,'<select multiple="multiple">',"</select>"],ce.thead=ce.tbody=ce.colgroup=ce.caption=ce.tfoot=[1,"<table>","</table>"],ce.polyline=ce.ellipse=ce.polygon=ce.circle=ce.text=ce.line=ce.path=ce.rect=ce.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var pe="undefined"!=typeof Element?Element.prototype:{},le=pe.matches||pe.matchesSelector||pe.webkitMatchesSelector||pe.mozMatchesSelector||pe.msMatchesSelector||pe.oMatchesSelector,ue=function(e,t){if(!e||1!==e.nodeType)return!1;if(le)return le.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 he(e,t){return(t=t||document).querySelector(e)}function de(e,t){return(t=t||document).querySelectorAll(e)}function fe(e){e.parentNode&&e.parentNode.removeChild(e)}function me(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 ye(e,t){return me(t,e),e}var ve=2,ge={"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":ve,"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":ve,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function be(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=ge[i];r?(r===ve&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function xe(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return ge[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);be(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)be(e,i,t[i])}(e,t);return e}function _e(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 Ee=/\s+/,we=Object.prototype.toString;function Se(e){return void 0!==e}function Ce(e){return new Te(e)}function Te(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Re(e){var t=e.parentNode;return t&&t.removeChild(e),e}function Ae(e){for(var t;t=e.firstChild;)Re(t);return e}function ke(e){return e.cloneNode(!0)}Te.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~_e(t,e)||t.push(e),Se(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Te.prototype.remove=function(e){if("[object RegExp]"===we.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=_e(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Te.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},Te.prototype.toggle=function(e,t){return this.list?(Se(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Se(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Te.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Ee);return""===e[0]&&e.shift(),e},Te.prototype.has=Te.prototype.contains=function(e){return this.list?this.list.contains(e):!!~_e(this.array(),e)};var Pe={svg:"http://www.w3.org/2000/svg"},Me='<svg xmlns="'+Pe.svg+'"';function De(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Pe.svg)&&(e=Me+e.substring(4)):(e=Me+">"+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 Be(e,t){var n;return"<"===e.charAt(0)?(n=De(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(Pe.svg,e),t&&xe(n,t),n}var Ne=Be("svg");function Oe(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function je(e){return e?Ne.createSVGTransformFromMatrix(e):Ne.createSVGTransform()}var Le=/([&<>]{1})/g,Ie=/([\n\r"]{1})/g,ze={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function Fe(e,t){return e.replace(t,function(e,t){return ze[t]||t})}function $e(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(Fe(e.textContent,Le));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,'="',Fe(o.value,Ie),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)$e(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",Fe(e.nodeValue,Le),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function He(e,t){var n=De(t);if(Ae(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++)me(r[o],e)}}function Ge(e,t){if(void 0!==t){try{He(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)$e(t,n),t=t.nextSibling;return n.join("")}(e)}function We(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ve(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(We(e,i))}(n,t)),n.consolidate()}var Ue=/^class /;function qe(e){return"[object Array]"===Object.prototype.toString.call(e)}function Ke(){var e=Array.prototype.slice.call(arguments);1===e.length&&qe(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Ye=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Xe=/^function\s*[^(]*\(\s*([^)]*)\)/m,Ze=/\/\*([^*]*)\*\//m;function Qe(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return Ue.test(e.toString())}(e)?Ye:Xe);return t&&t[1]&&t[1].split(",").map(function(e){return(t=e.match(Ze))?t[1].trim():e.trim()})||[]}var Je="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 et(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 tt(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(nt(r,o))return r[o];if(nt(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(!qe(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Ke(e.slice())}var n=e.$inject||Qe(e),i=n.map(function(e){return nt(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(et(n))))},l=function(e,t,n){var i=c(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(et(r)))},u=function(e){return Ke(function(t){return e.get(t)})},h={factory:l,type:p,value:function(e){return e}};e.forEach(function(e){function t(e,t){return"value"!==e&&qe(t)&&(t=Ke(t.slice())),t}if(e instanceof function(){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)}})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":Je(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 tt((e.__modules__||[]).concat([n]),o),a=Ke(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=l,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),l=[],h=[],d=[];for(var f in i)n=i[f],-1!==t.indexOf(f)&&("private"===n[2]?-1===(r=l.indexOf(n[3]))?(a=n[3].createChild([],t),s=u(a),l.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 tt(e,o)}}function nt(e,t){return Object.hasOwnProperty.call(e,t)}var it=1e3;function rt(e,t){var n=this;t=t||it,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 ot(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function at(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function st(e,t){var n=Be("polyline");return xe(n,{points:at(e)}),t&&xe(n,t),n}function ct(e){return v(e,function(t){return!y(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 pt(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function lt(e,t,n){n=n||0,l(e)||(e=[e]),g(e,function(e,i){var r=t(e,i,n);l(r)&&r.length&&lt(r,t,n+1)})}function ut(e,t){return function(e,t,n){var i=[],r=[];return lt(e,function(e,o,a){pt(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&pt(r,s,t))return s}),i}(e,!t,-1)}function ht(e,t){var n,i,r,o;return t=!!t,l(e)||(e=[e]),g(e,function(e){var a=e;e.waypoints&&!t&&(a=ht(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)}),{x:n,y:i,height:o-i,width:r-n}}function dt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function ft(e){return!(!e||!e.isFrame)}function mt(e,t){return I({},e||{},t||{})}rt.prototype.canRender=function(){},rt.prototype.drawShape=function(){},rt.prototype.drawConnection=function(){},rt.prototype.getShapePath=function(){},rt.prototype.getConnectionPath=function(){};var yt=1;function vt(e,t){rt.call(this,e,yt),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(vt,rt),vt.prototype.canRender=function(){return!0},vt.prototype.drawShape=function(e,t){var n=Be("rect");return xe(n,{x:0,y:0,width:t.width||0,height:t.height||0}),ft(t)?xe(n,this.FRAME_STYLE):xe(n,this.SHAPE_STYLE),ye(e,n),n},vt.prototype.drawConnection=function(e,t){var n=st(t.waypoints,this.CONNECTION_STYLE);return ye(e,n),n},vt.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return ot([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},vt.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 ot(r)},vt.$inject=["eventBus","styles"];var gt={__init__:["defaultRenderer"],defaultRenderer:["type",vt],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 I(this.style(t,n),{class:e})},this.style=function(t,n){l(t)||n||(n=t,t=[]);var i=x(t,function(t,n){return I(t,e[n]||{})},{});return n?I(i,n):i},this.computeStyle=function(e,n,i){return l(n)||(i=n,n=[]),t.style(n||[],I({},i,e||{}))}}]};function bt(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function xt(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 _t(e,t){return e&&t?e.indexOf(t):-1}function Et(e,t){return Math.round(e*t)/t}function wt(e){return h(e)?e+"px":e}function St(e,t,n){var i=Be("g");Ce(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var Ct={shape:["x","y","width","height"],connection:["waypoints"]};function Tt(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function Rt(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Tt.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],Tt.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=I({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),I(n.style,{position:"relative",overflow:"hidden",width:wt(e.width),height:wt(e.height)}),t.appendChild(n),n}(e),i=this._svg=Be("svg");xe(i,{width:"100%",height:"100%"}),ye(n,i);var r=this._viewport=St(i,"viewport");this._layers={},!1!==e.deferUpdate&&(this._viewboxChanged=O(j(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)},Tt.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},Tt.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach(function(t){var n=dt(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)}),delete this._cachedViewbox},Tt.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Tt.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},Tt.prototype._createLayer=function(e,t){t||(t=0);var n=x(this._layers,function(e,n){return t>=n.index&&e++,e},0);return{group:St(this._viewport,"layer-"+e,n),index:t}},Tt.prototype.getContainer=function(){return this._container},Tt.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(g([i.gfx,i.secondaryGfx],function(e){e&&(n?Ce(e).add(t):Ce(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Tt.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Tt.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Tt.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Ce(this.getGraphics(e)).has(t)},Tt.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Tt.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Tt.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},Tt.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=Ct[e];if(!_(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Tt.prototype._setParent=function(e,t,n){xt(t.children,e,n),e.parent=t},Tt.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},Tt.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Tt.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Tt.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),bt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Tt.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Tt.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Tt.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Tt.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Tt.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Tt.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);Ve(s,t)}),e):(t=this.getDefaultLayer().getBBox(),n=(i=Ve(s))?i.matrix:function(e,t,n,i,r,o){var a=Ne.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Oe(a,e);case 6:return Oe(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=Et(n.a,1e3),o=Et(-n.e||0,1e3),a=Et(-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})},Tt.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=I({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Rt(t,n)}),{x:n.e,y:n.f}},Tt.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)}),Et(i.a,1e3)):this.viewbox(e).scale;var n,i},Tt.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},Tt.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=I(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),Rt(this._viewport,o),o},Tt.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Tt.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}},Tt.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var At="data-element-id";function kt(e){this._elements={},this._eventBus=e}kt.$inject=["eventBus"],kt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),xe(t,At,i),n&&xe(n,At,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},kt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(xe(i.gfx,At,""),i.secondaryGfx&&xe(i.secondaryGfx,At,""),delete t[n])},kt.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)},kt.prototype.get=function(e){var t;t="string"==typeof e?e:e&&xe(e,At);var n=this._elements[t];return n&&n.element},kt.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},kt.prototype.getAll=function(){return this.filter(function(e){return e})},kt.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)})},kt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},kt.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 Pt={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 Mt(e,t,n){var i=Pt.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 Dt(e,t){if(!(this instanceof Dt))return new Dt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}Dt.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?Mt(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)},Dt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Pt.isExtended(n)||Mt(this,t,e),n},Dt.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},Dt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},Dt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Bt=Dt,Nt=Pt;Bt.Collection=Nt;var Ot=new Bt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),jt=new Bt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Lt=new Bt({name:"attachers",collection:!0},{name:"host"}),It=new Bt({name:"outgoing",collection:!0},{name:"source"}),zt=new Bt({name:"incoming",collection:!0},{name:"target"});function Ft(){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)}}),Ot.bind(this,"parent"),jt.bind(this,"labels"),It.bind(this,"outgoing"),zt.bind(this,"incoming")}function $t(){Ft.call(this),Ot.bind(this,"children"),Lt.bind(this,"host"),Lt.bind(this,"attachers")}function Ht(){$t.call(this)}function Gt(){$t.call(this),jt.bind(this,"labelTarget")}function Wt(){Ft.call(this),It.bind(this,"source"),zt.bind(this,"target")}n($t,Ft),n(Ht,$t),n(Gt,$t),n(Wt,Ft);var Vt={connection:Wt,shape:$t,label:Gt,root:Ht};function Ut(){this._uid=12}Ut.prototype.createRoot=function(e){return this.create("root",e)},Ut.prototype.createLabel=function(e){return this.create("label",e)},Ut.prototype.createShape=function(e){return this.create("shape",e)},Ut.prototype.createConnection=function(e){return this.create("connection",e)},Ut.prototype.create=function(e,t){return(t=I({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Vt[e];if(!n)throw new Error("unknown type: <"+e+">");return I(new n,t)}(e,t)};var qt=Array.prototype.slice;function Kt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Yt(){}function Xt(e){return e.childNodes[0]}function Zt(e,t,n,i,r){var o=je();o.setTranslate(t,n);var a=je();a.setRotate(i,0,0);var s=je();s.setScale(r||1,r||1),Ve(e,[o,a,s])}function Qt(e,t,n){var i=je();i.setTranslate(t,n),Ve(e,i)}function Jt(e,t){var n=je();n.setRotate(t,0,0),Ve(e,n)}function en(e,t){this._eventBus=e,this._elementRegistry=t}function tn(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}Kt.prototype.on=function(e,t,n,i){if(e=l(e)?e:[e],d(t)&&(i=n,n=t,t=1e3),!h(t))throw new Error("priority must be a number");var r=n;i&&((r=j(n,i)).__fn=n.__fn||n);var o=this;e.forEach(function(e){o._addListener(e,{priority:t,callback:r,next:null})})},Kt.prototype.once=function(e,t,n,i){var r=this;if(d(t)&&(i=n,n=t,t=1e3),!h(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)},Kt.prototype.off=function(e,t){e=l(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},Kt.prototype.createEvent=function(e){var t=new Yt;return t.init(e),t},Kt.prototype.fire=function(e,t){var n,i,r,o;if(o=qt.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Yt?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}},Kt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},Kt.prototype._destroy=function(){this._listeners={}},Kt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},Kt.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},Kt.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)},Kt.prototype._getListeners=function(e){return this._listeners[e]},Kt.prototype._setListeners=function(e,t){this._listeners[e]=t},Kt.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)},Yt.prototype.stopPropagation=function(){this.cancelBubble=!0},Yt.prototype.preventDefault=function(){this.defaultPrevented=!0},Yt.prototype.init=function(e){I(this,e||{})},en.$inject=["eventBus","elementRegistry"],en.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=function(e){return e.parentNode.childNodes[1]}(n))||(Ce(t=Be("g")).add("djs-children"),ye(n.parentNode,t)):t=n,t},en.prototype._clear=function(e){var t=Xt(e);return K(t),t},en.prototype._createContainer=function(e,t,n,i){var r=Be("g");Ce(r).add("djs-group"),void 0!==n?tn(r,t,t.childNodes[n]):ye(t,r);var o=Be("g");Ce(o).add("djs-element"),Ce(o).add("djs-"+e),i&&Ce(o).add("djs-frame"),ye(r,o);var a=Be("g");return Ce(a).add("djs-visual"),ye(o,a),o},en.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n,ft(t))},en.prototype.updateContainments=function(e){var t=this,n=this._elementRegistry;g(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._getChildren(e);g(i.slice().reverse(),function(e){tn(n.getGraphics(e).parentNode,r)})}})},en.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},en.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},en.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},en.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},en.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Qt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?xe(n,"display","none"):xe(n,"display","block")}},en.prototype.remove=function(e){Re(this._elementRegistry.getGraphics(e).parentNode)};var nn={__depends__:[gt],__init__:["canvas"],canvas:["type",Tt],elementRegistry:["type",kt],elementFactory:["type",Ut],eventBus:["type",Kt],graphicsFactory:["type",en]};function rn(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 tt(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 on(e,t){this.injector=t=t||function(e){return rn([{config:["value",e=e||{}]},nn].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}function an(){}function sn(e,t){this.model=e,this.properties=t}on.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},on.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")},an.prototype.get=function(e){return this.$model.properties.get(this,e)},an.prototype.set=function(e,t){this.$model.properties.set(this,e,t)},sn.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(an.prototype);g(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}),g(e,j(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 cn={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},pn={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 ln(e,t){var n=pn[e];return n?n(t):t}function un(e){return!!cn[e]}function hn(e){return!!pn[e]}function dn(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 fn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,g(e,j(this.registerPackage,this))}function yn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function vn(e){this.model=e}function gn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function bn(e){this.properties=new vn(this),this.factory=new sn(this,this.properties),this.registry=new mn(e,this.properties),this.typeCache={}}fn.prototype.build=function(){return z(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},fn.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)},fn.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},fn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=dn(r[0],i),a=dn(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},fn.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},fn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},fn.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},fn.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},fn.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")},fn.prototype.hasProperty=function(e){return this.propertiesByName[e]},fn.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(g(e.properties,j(function(n){n=I({},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)},mn.prototype.getPackage=function(e){return this.packageMap[e]},mn.prototype.getPackages=function(){return this.packages},mn.prototype.registerPackage=function(e){e=I({},e);var t=this.packageMap;yn(t,e,"prefix"),yn(t,e,"uri"),g(e.types,j(function(t){this.registerType(t,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},mn.prototype.registerType=function(e,t){var n=dn((e=I({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:I(e.meta||{})})).name,t.prefix),i=n.name,r={};g(e.properties,j(function(e){var t=dn(e.name,n.prefix),i=t.name;un(e.type)||(e.type=dn(e.type,t.prefix).name),I(e,{ns:t,name:i}),r[i]=e},this)),I(e,{ns:n,name:i,propertiesByName:r}),g(e.extends,j(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},mn.prototype.mapTypes=function(e,t,n){var i=un(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=dn(n,un(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");g(i.superClass,n?o:a),t(i,!n),g(i.traits,o)},mn.prototype.getEffectiveDescriptor=function(e){var t=dn(e),n=new fn(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},mn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},vn.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:gn(e,i,n):e.$attrs[t]=n},vn.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&&gn(e,n,[]),e[i]},vn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},vn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},vn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},bn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},bn.prototype.getType=function(e){var t=this.typeCache,n=f(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},bn.prototype.createAny=function(e,t,n){var i=dn(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}),g(n,function(e,t){u(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},bn.prototype.getPackage=function(e){return this.registry.getPackage(e)},bn.prototype.getPackages=function(){return this.registry.getPackages()},bn.prototype.getElementDescriptor=function(e){return e.$descriptor},bn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},bn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},bn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var xn=String.fromCharCode,_n=Object.prototype.hasOwnProperty,En=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,wn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Sn(e,t,n,i){return i?_n.call(wn,i)?wn[i]:"&"+i+";":xn(t||parseInt(n,16))}function Cn(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(En,Sn):e}Object.keys(wn).forEach(function(e){wn[e.toUpperCase()]=wn[e]});var Tn="http://www.w3.org/2001/XMLSchema-instance",Rn="xsi",An="xsi:type",kn="non-whitespace outside of root node";function Pn(e){return new Error(e)}function Mn(e){return"missing namespace for prefix <"+e+">"}function Dn(e){return{get:e,enumerable:!0}}function Bn(e){var t,n={};for(t in e)n[t]=e[t];return n}function Nn(e){return e+"$uri"}function On(){return{line:0,column:0}}function jn(e){throw e}function Ln(e){if(!this)return new Ln(e);var t,n,i,r,o,a,s,c,p,l=e&&e.proxy,u=jn,h=On,d=!1,f=!1,m=null,y=!1;function v(e){e instanceof Error||(e=Pn(e)),m=e,u(e,h)}function g(e){o&&(e instanceof Error||(e=Pn(e)),o(e,h))}this.on=function(e,p){if("function"!=typeof p)throw Pn("required args <name, cb>");switch(e){case"openTag":n=p;break;case"text":t=p;break;case"closeTag":i=p;break;case"error":u=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 Pn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Pn("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[Tn]=Rn,f=!0,p=n,this},this.parse=function(e){if("string"!=typeof e)throw Pn("required args <xml=string>");return m=null,function(e){var o,u,m,b,x,_,E,w,S,C,T=f?[]:null,R=f?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Nn(n)]=t;return i}(p):null,A=[],k=0,P=!1,M=!1,D=0,B=0,N="",O=0;function j(){if(null!==C)return C;var e,t,n,i,r,o,a,s,c,l,u,h=f&&R.xmlns,m=f&&d?[]:null,y=O,v=N,b=v.length,x={},_={};e:for(;y<b;y++)if(c=!1,!(32===(l=v.charCodeAt(y))||l<14&&l>8)){for((l<65||l>122||l>90&&l<97)&&95!==l&&58!==l&&(g("illegal first char attribute name"),c=!0),u=y+1;u<b;u++)if(!((l=v.charCodeAt(u))>96&&l<123||l>64&&l<91||l>47&&l<59||46===l||45===l||95===l)){if(32===l||l<14&&l>8){g("missing attribute value"),y=u;continue e}if(61===l)break;g("illegal attribute name char"),c=!0}if("xmlns:xmlns"===(s=v.substring(y,u))&&(g("illegal declaration of xmlns"),c=!0),34===(l=v.charCodeAt(u+1)))-1===(u=v.indexOf('"',y=u+2))&&-1!==(u=v.indexOf("'",y))&&(g("attribute value quote missmatch"),c=!0);else if(39===l)-1===(u=v.indexOf("'",y=u+2))&&-1!==(u=v.indexOf('"',y))&&(g("attribute value quote missmatch"),c=!0);else for(g("missing attribute value quotes"),c=!0,u+=1;u<b&&!(32===(l=v.charCodeAt(u+1))||l<14&&l>8);u++);for(-1===u&&(g("missing closing quotes"),u=b,c=!0),c||(o=v.substring(y,u)),y=u;u+1<b&&!(32===(l=v.charCodeAt(u+1))||l<14&&l>8);u++)y===u&&(g("illegal character after attribute end"),c=!0);if(y=u+1,!c)if(s in _)g("attribute <"+s+"> already defined");else if(_[s]=!0,f)if(d){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Cn(o),t=Nn(r),!(a=p[e])){if("xmlns"===r||t in R&&R[t]!==e)do{a="ns"+k++}while(void 0!==R[a]);else a=r;p[e]=a}R[r]!==a&&(i||(R=Bn(R),i=!0),R[r]=a,"xmlns"===r&&(R[Nn(a)]=e,h=a),R[t]=e),x[s]=o;continue}m.push(s,o)}else-1!==(l=s.indexOf(":"))?(n=R[s.substring(0,l)])?((s=h===n?s.substr(l+1):n+s.substr(l))===An&&(-1!==(l=o.indexOf(":"))?(n=o.substring(0,l),n=R[n]||n,o=n+o.substring(l)):o=h+":"+o),x[s]=o):g(Mn(s.substring(0,l))):x[s]=o;else x[s]=o}if(d)for(y=0,b=m.length;y<b;y++){if(s=m[y++],o=m[y],-1!==(l=s.indexOf(":"))){if(!(n=R[s.substring(0,l)])){g(Mn(s.substring(0,l)));continue}(s=h===n?s.substr(l+1):n+s.substr(l))===An&&(-1!==(l=o.indexOf(":"))?(n=o.substring(0,l),n=R[n]||n,o=n+o.substring(l)):o=h+":"+o)}x[s]=o}return C=x}h=function(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=B;D>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>D);)r+=1,a=s;return-1==D?(o=s,n=e.substring(B)):0===B?(console.log(D-a),n=e.substring(B,D)):(o=D-a,n=-1==B?e.substring(D):e.substring(D,B+1)),{data:n,line:r,column:o}},l&&(S=Object.create({},{name:Dn(function(){return E}),originalName:Dn(function(){return w}),attrs:Dn(j),ns:Dn(function(){return R})}));for(;-1!==B;){if(-1===(D=60===e.charCodeAt(B)?B:e.indexOf("<",B)))return A.length?v("unexpected end of file"):0===B?v("missing start tag"):void(B<e.length&&e.substring(B).trim()&&g(kn));if(B!==D)if(A.length){if(t&&(t(e.substring(B,D),Cn,h),y))return}else if(e.substring(B,D).trim()&&(g(kn),y))return;if(33!==(x=e.charCodeAt(D+1)))if(63!==x){if(-1==(B=e.indexOf(">",D+1)))return v("unclosed tag");if(C={},47===x){if(P=!1,M=!0,!A.length)return v("missing open tag");if(u=E=A.pop(),b=D+2+u.length,e.substring(D+2,b)!==u)return v("closing tag mismatch");for(;b<B;b++)if(!(32===(x=e.charCodeAt(b))||x>8&&x<14))return v("close tag")}else{if(47===e.charCodeAt(B-1)?(u=E=e.substring(D+1,B-1),P=!0,M=!0):(u=E=e.substring(D+1,B),P=!0,M=!1),!(x>96&&x<123||x>64&&x<91||95===x||58===x))return v("illegal first char nodeName");for(b=1,m=u.length;b<m;b++)if(!((x=u.charCodeAt(b))>96&&x<123||x>64&&x<91||x>47&&x<59||45===x||95===x||46==x)){if(32===x||x<14&&x>8){E=u.substring(0,b),C=null;break}return v("invalid nodeName")}M||A.push(E)}if(f){if(o=R,P&&(M||T.push(o),null===C&&(d=-1!==u.indexOf("xmlns",b))&&(O=b,N=u,j(),d=!1)),w=E,-1!==(x=E.indexOf(":"))){if(!(_=R[E.substring(0,x)]))return v("missing namespace on <"+w+">");E=E.substr(x+1)}else _=R.xmlns;_&&(E=_+":"+E)}if(P&&(O=b,N=u,n&&(l?n(S,Cn,M,h):n(E,j,Cn,M,h),y)))return;if(M){if(i&&(i(l?S:E,Cn,P,h),y))return;f&&(R=P?o:T.pop())}B+=1}else{if(-1===(B=e.indexOf("?>",D)))return v("unclosed question");if(s&&(s(e.substring(D,B+2),h),y))return;B+=2}else{if(91===(x=e.charCodeAt(D+2))&&"CDATA["===e.substr(D+3,6)){if(-1===(B=e.indexOf("]]>",D)))return v("unclosed cdata");if(r&&(r(e.substring(D+9,B),h),y))return;B+=3;continue}if(45===x&&45===e.charCodeAt(D+3)){if(-1===(B=e.indexOf("--\x3e",D)))return v("unclosed comment");if(a&&(a(e.substring(D+4,B),Cn,h),y))return;B+=3;continue}if(-1===(B=e.indexOf(">",D+1)))return v("unclosed tag");if(c&&(c(e.substring(D,B+1),Cn,h),y))return;B+=1}}}(e),h=On,y=!1,m},this.stop=function(){y=!0}}function In(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var zn={xsi:"http://www.w3.org/2001/XMLSchema-instance"},Fn="xsi:type";function $n(e){return e.xml&&e.xml.serialize}function Hn(e){return $n(e)===Fn}function Gn(e,t){return In(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Wn(e){return new Error(e)}function Vn(e){return e.$descriptor}function Un(e){I(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Wn("expected element");var t,n=this.elementsById,i=Vn(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Wn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function qn(){}function Kn(){}function Yn(){}function Xn(e,t){this.property=e,this.context=t}function Zn(e,t){this.element=t,this.propertyDesc=e}function Qn(){}function Jn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ei(e,t,n){Jn.call(this,e,t,n)}function ti(e,t,n){this.model=e,this.context=n}function ni(e){e instanceof bn&&(e={model:e}),I(this,{lax:!1},e)}qn.prototype.handleEnd=function(){},qn.prototype.handleText=function(){},qn.prototype.handleNode=function(){},Kn.prototype=Object.create(qn.prototype),Kn.prototype.handleNode=function(){return this},Yn.prototype=Object.create(qn.prototype),Yn.prototype.handleText=function(e){this.body=(this.body||"")+e},Xn.prototype=Object.create(Yn.prototype),Xn.prototype.handleNode=function(e){if(this.element)throw Wn("expected no sub nodes");return this.element=this.createReference(e),this},Xn.prototype.handleEnd=function(){this.element.id=this.body},Xn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Zn.prototype=Object.create(Yn.prototype),Zn.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=ln(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Qn.prototype=Object.create(Yn.prototype),Qn.prototype.handleNode=function(e){var t=this,n=this.element;return n?t=this.handleChild(e):(n=this.element=this.createElement(e),this.context.addElement(n)),t},Jn.prototype=Object.create(Qn.prototype),Jn.prototype.addReference=function(e){this.context.addReference(e)},Jn.prototype.handleText=function(e){if(!Vn(this.element).bodyProperty)throw Wn("unexpected body text <"+e+">");Yn.prototype.handleText.call(this,e)},Jn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Vn(t).bodyProperty;n&&void 0!==e&&(e=ln(n.type,e),t.set(n.name,e))},Jn.prototype.createElement=function(e){var t,n=e.attributes,i=this.type,r=Vn(i),o=this.context,a=new i({}),s=this.model;return g(n,function(e,n){var i=r.propertiesByName[n];i&&i.isReference?i.isMany?g(e.split(" "),function(e){o.addReference({element:a,property:i.ns.name,id:e})}):o.addReference({element:a,property:i.ns.name,id:e}):(i?e=ln(i.type,e):"xmlns"!==n&&(t=dn(n,r.ns.prefix),s.getPackage(t.prefix)&&o.addWarning({message:"unknown attribute <"+n+">",element:a,property:n,value:e})),a.set(n,e))}),a},Jn.prototype.getPropertyForNode=function(e){var t,n,i=dn(e.name),r=this.type,o=this.model,a=Vn(r),s=i.name,c=a.propertiesByName[s];if(c)return Hn(c)&&(t=e.attributes[Fn])?(t=function(e,t){var n=dn(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,o),I({},c,{effectiveType:Vn(n=o.getType(t)).name})):c;var p=o.getPackage(i.prefix);if(p){if(t=Gn(i,p),n=o.getType(t),c=y(a.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return I({},c,{effectiveType:Vn(n).name})}else if(c=y(a.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return c;throw Wn("unrecognized element <"+i.name+">")},Jn.prototype.toString=function(){return"ElementDescriptor["+Vn(this.type).name+"]"},Jn.prototype.valueHandler=function(e,t){return new Zn(e,t)},Jn.prototype.referenceHandler=function(e){return new Xn(e,this.context)},Jn.prototype.handler=function(e){return"Element"===e?new ti(this.model,e,this.context):new Jn(this.model,e,this.context)},Jn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,hn(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(I(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},ei.prototype=Object.create(Jn.prototype),ei.prototype.createElement=function(e){var t=e.name,n=dn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Gn(n,o)||t;if(!r.hasType(a))throw Wn("unexpected element <"+e.originalName+">");return Jn.prototype.createElement.call(this,e)},ti.prototype=Object.create(Qn.prototype),ti.prototype.createElement=function(e){var t=e.name,n=dn(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},ti.prototype.handleChild=function(e){var t=new ti(this.model,"Element",this.context).handleNode(e),n=this.element,i=t.element;return void 0!==i&&((n.$children=n.$children||[]).push(i),i.$parent=n),t},ti.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ni.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Jn?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new Un(I({},t,{rootHandler:i})),s=new Ln({proxy:!0}),c=function(){var e=[];return Object.defineProperty(e,"peek",{value:function(){return this[this.length-1]}}),e}();function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),!0;throw Wn(c)}function l(e,t){return p(e,t,!0)}i.context=a,c.push(i);var u=/^<\?xml /i,h=/ encoding="([^"]+)"/i,d=/^utf-8$/i;function f(e,t){try{c.peek().handleText(e)}catch(e){l(e,t)}}var m=r.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(m).on("openTag",function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,n){var i=t(r[n]);return e[n]=i,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){p(e,t,o)&&c.push(new Kn)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)}).on("question",function(e){if(u.test(e)){var t=h.exec(e),n=t&&t[1];n&&!d.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",f).on("text",function(e,t,n){!function(e,t){(e=e.trim())&&f(e,t)}(t(e),n)}).on("error",p).on("warn",l),setTimeout(function(){var t;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=Vn(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}()}catch(e){t=e}var r=i.element;t||r||(t=Wn("failed to parse document as <"+i.type.$descriptor.name+">")),n(t,t?void 0:r,a)},0)},ni.prototype.handler=function(e){return new ei(this.model,e)};var ii='<?xml version="1.0" encoding="UTF-8"?>\n',ri=/<|>|'|"|&|\n\r|\n/g,oi=/<|>|&/g;function ai(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.logUsed=function(e){var t=e.uri;i[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(r,o).filter(function(e){return i[e.uri]})}}function si(e,t){return In(t)?(n=e).charAt(0).toLowerCase()+n.slice(1):e;var n}function ci(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function pi(e){return f(e)?e:(e.prefix?e.prefix+":":"")+e.localName}var li={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ui={"<":"lt",">":"gt","&":"amp"};function hi(e,t,n){return(e=f(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function di(e){this.tagName=e}function fi(){}function mi(e){this.tagName=e}function yi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function vi(e,t){yi.call(this,e,t)}function gi(){this.value="",this.write=function(e){this.value+=e}}function bi(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function xi(e){return e=I({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new gi,r=new bi(i,e.format);if(e.preamble&&r.append(ii),(new yi).build(t).serializeTo(r),!n)return i.value}}}function _i(e,t){bn.call(this,e,t)}di.prototype.build=function(e){return this.element=e,this},di.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},fi.prototype.serializeValue=fi.prototype.serializeTo=function(e){e.append(this.escape?hi(this.value,oi,ui):this.value)},fi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(oi)&&(this.escape=!0),this},ci(mi,fi),mi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},yi.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){return v(e.$descriptor.properties,function(t){var n=t.name;if(t.isVirtual)return!1;if(!e.hasOwnProperty(n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)})}(e),this.parseAttributes(v(n,function(e){return e.isAttr})),this.parseContainments(function(e){return v(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},yi.prototype.nsTagName=function(e){return function(e,t){return t.isGeneric?I({localName:t.ns.localName},e):I({localName:si(t.ns.localName,t.$pkg)},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.nsPropertyTagName=function(e){return function(e,t){return I({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},yi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yi.prototype.nsAttributeName=function(e){var t;if(t=f(e)?dn(e):e.ns,e.inherited)return{localName:t.localName};var n=this.logNamespaceUsed(t);return this.getNamespaces().logUsed(n),this.isLocalNs(n)?{localName:t.localName}:I({localName:t.localName},n)},yi.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return g(e,function(r,o){"$body"===o?n.push((new fi).build({type:"String"},r)):"$children"===o?g(r,function(e){n.push(new yi(t).build(e))}):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})}),i},yi.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=dn(t);if("xmlns"===o.prefix&&(i={prefix:o.localName,uri:n}),o.prefix||"xmlns"!==o.localName||(i={uri:n}),!i)return{name:t,value:n};if(r&&r.getPackage(n))this.logNamespace(i,!0,!0);else{var a=this.logNamespaceUsed(i,!0);this.getNamespaces().logUsed(a)}},yi.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return g(i,function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)}),r},yi.prototype.parseGenericAttributes=function(e,t){var n=this;g(t,function(t){if(t.name!==Fn)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}})},yi.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;g(e,function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new fi).build(e,r[0]));else if(hn(e.type))g(r,function(i){n.push(new mi(t.addTagName(t.nsPropertyTagName(e))).build(e,i))});else if(o)g(r,function(i){n.push(new di(t.addTagName(t.nsPropertyTagName(e))).build(i))});else{var a=Hn(e),s=function(e){return"property"===$n(e)}(e);g(r,function(i){var r;r=a?new vi(t,e):s?new yi(t,e):new yi(t),n.push(r.build(i))})}})},yi.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ai(t):n=t),n},yi.prototype.logNamespace=function(e,t,n){var i=this.getNamespaces(n),r=e.uri,o=e.prefix;return i.byUri(r)||i.add(e,t),i.mapPrefix(o,r),e},yi.prototype.logNamespaceUsed=function(e,t){var n,i,r,o=this.element.$model,a=this.getNamespaces(t),s=e.prefix,c=e.uri;if(!s&&!c)return{localName:e.localName};if(r=zn[s]||o&&(o.getPackage(s)||{}).uri,!(c=c||r||a.uriByPrefix(s)))throw new Error("no namespace uri given for prefix <"+s+">");if(!(e=a.byUri(c))){for(n=s,i=1;a.uriByPrefix(n);)n=s+"_"+i++;e=this.logNamespace({prefix:n,uri:c},r===c)}return s&&a.mapPrefix(s,c),e},yi.prototype.parseAttributes=function(e){var t=this,n=this.element;g(e,function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];g(i,function(e){r.push(e.id)}),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)})},yi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),pi(e)},yi.prototype.addAttribute=function(e,t){var n=this.attrs;f(t)&&(t=hi(t,ri,li)),n.push({name:e,value:t})},yi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return w(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(t)),g(t,function(t){e.append(" ").append(pi(t.name)).append('="').append(t.value).append('"')})},yi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==fi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),g(this.body,function(t){t.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},ci(vi,yi),vi.prototype.parseNsAttributes=function(e){var t=yi.prototype.parseNsAttributes.call(this,e),n=e.$descriptor;if(n.name===this.propertyDescriptor.type)return t;var i=this.typeNs=this.nsTagName(n);this.getNamespaces().logUsed(this.typeNs);var r=e.$model.getPackage(i.uri),o=r.xml&&r.xml.typePrefix||"";return this.addAttribute(this.nsAttributeName(Fn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},vi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},_i.prototype=Object.create(bn.prototype),_i.prototype.fromXML=function(e,t,n,i){f(t)||(i=n,n=t,t="bpmn:Definitions"),d(n)&&(i=n,n={});var r=new ni(I({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)},_i.prototype.toXML=function(e,t,n){d(t)&&(n=t,t={});var i,r,o=new xi(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var Ei={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function wi(e,t){return new _i(I({},Ei,e),t)}function Si(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var Ci=new Bt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function Ti(e,t){return e.$instanceOf(t)}function Ri(e,t){var n={},i=[];function r(e,t){return function(n){e(n,t)}}function o(e){n[e.id]=e}function a(n,i){try{var r=n.di&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:Si(n)}));return e.element(n,i)}(n,i);return o(n),r}catch(e){s(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:Si(n)})),console.error(e)}}function s(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?n.di?s(t("multiple DI elements defined for {element}",{element:Si(n)}),{element:n}):(Ci.bind(n,"di"),n.di=e):s(t("no bpmnElement referenced in {element}",{element:Si(e)}),{element:e})}function p(e){var t;c(t=e.plane),g(t.planeElement,l)}function l(e){c(e)}function u(){for(;i.length;)i.shift()()}function h(e,t){A(e,t),E(e.ioSpecification,t),_(e.artifacts,t),o(e)}function d(e,t){a(e,t)}function f(e,t){a(e,t)}function m(e,t){a(e,t)}function b(e,t){a(e,t)}function x(e,t){a(e,t)}function _(e,t){g(e,function(e){Ti(e,"bpmn:Association")?i.push(function(){x(e,t)}):x(e,t)})}function E(e,t){e&&(g(e.dataInputs,r(m,t)),g(e.dataOutputs,r(b,t)))}function w(e,t){A(e,t),_(e.artifacts,t)}function S(e,t){var n=a(e,t);Ti(e,"bpmn:SubProcess")&&w(e,n||t),Ti(e,"bpmn:Activity")&&E(e.ioSpecification,t),i.push(function(){g(e.dataInputAssociations,r(f,t)),g(e.dataOutputAssociations,r(f,t))})}function C(e,t){a(e,t)}function T(e,t){i.push(function(){var n=a(e,t);e.childLaneSet&&R(e.childLaneSet,n||t),function(e){g(e.flowNodeRef,function(t){var n=t.get("lanes");n&&n.push(e)})}(e)})}function R(e,t){g(e.lanes,r(T,t))}function A(e,n){!function(e,n){g(e,function(e){Ti(e,"bpmn:SequenceFlow")?i.push(function(){!function(e,t){a(e,t)}(e,n)}):Ti(e,"bpmn:BoundaryEvent")?i.unshift(function(){S(e,n)}):Ti(e,"bpmn:FlowNode")?S(e,n):Ti(e,"bpmn:DataObject")||(Ti(e,"bpmn:DataStoreReference")?C(e,n):Ti(e,"bpmn:DataObjectReference")?C(e,n):s(t("unrecognized flowElement {element} in context {context}",{element:Si(e),context:n?Si(n.businessObject):"null"}),{element:e,context:n}))})}(e.flowElements,n),e.laneSets&&function(e,t){g(e,r(R,t))}(e.laneSets,n)}function k(e,t){var n=a(e,t),i=e.processRef;i&&h(i,n||t)}return{handleDeferred:u,handleDefinitions:function(o,a){var l=o.diagrams;if(a&&-1===l.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&l&&l.length&&(a=l[0]),!a)throw new Error(t("no diagram to display"));p(a);var f=a.plane;if(!f)throw new Error(t("no plane for {element}",{element:Si(a)}));var m=f.bpmnElement;if(!m){if(!(m=function(e){return y(e.rootElements,function(e){return Ti(e,"bpmn:Process")||Ti(e,"bpmn:Collaboration")})}(o)))throw new Error(t("no process or collaboration to display"));s(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Si(f),rootElement:Si(m)})),f.bpmnElement=m,c(f)}var b,x=function(t,n){return e.root(t,n)}(m,f);if(Ti(m,"bpmn:Process"))h(m,x);else{if(!Ti(m,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:Si(f),rootElement:Si(m)}));g((b=m).participants,r(k)),_(b.artifacts),i.push(function(){var e;g(b.messageFlows,r(d,e))}),function(e,t){v(e,function(e){return!n[e.id]&&Ti(e,"bpmn:Process")&&e.laneSets}).forEach(r(h,t))}(o.rootElements,x)}u()},handleSubProcess:w,registerDi:c}}function Ai(e,t){var n=ki(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function ki(e){return e&&e.businessObject||e}function Pi(e){return!Ai(e,"bpmn:CallActivity")&&(Ai(e,"bpmn:SubProcess")?!!ki(e).di.isExpanded:!Ai(e,"bpmn:Participant")||!!ki(e).processRef)}function Mi(e){return e&&!!ki(e).triggeredByEvent}function Di(e,t){var n=ki(e),i=!1;return n.eventDefinitions&&g(n.eventDefinitions,function(e){Ai(e,t)&&(i=!0)}),i}function Bi(e){return Ai(e,"bpmn:FlowElement")||Ai(e,"bpmn:Participant")||Ai(e,"bpmn:Lane")||Ai(e,"bpmn:SequenceFlow")||Ai(e,"bpmn:MessageFlow")||Ai(e,"bpmn:DataInput")||Ai(e,"bpmn:DataOutput")?"name":Ai(e,"bpmn:TextAnnotation")?"text":Ai(e,"bpmn:Group")?"categoryValueRef":void 0}function Ni(e){var t=e.businessObject,n=Bi(t);if(n)return"categoryValueRef"===n?function(e){var t=e.categoryValueRef;return t&&t.value||""}(t):t[n]||""}function Oi(e,t,n){return E(e.eventDefinitions,function(i){return i.$type===t&&function(e,t){return _(t,function(t,n){return e[n]==t})}(e,n)})}function ji(e){return e.businessObject.di}function Li(e){return e.businessObject}function Ii(e,t){return ji(e).get("bioc:fill")||t||"white"}function zi(e,t){return ji(e).get("bioc:stroke")||t||"black"}var Fi=new r,$i=10,Hi=3,Gi=.95,Wi=.35;function Vi(e,t,n,i,r,o,a){rt.call(this,t,a);var s=e&&e.defaultFillColor,c=e&&e.defaultStrokeColor,p=Fi.next(),l={},h=n.computeStyle;function d(e,t){var n=I({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=Be("marker");xe(t.element,n),ye(a,t.element),xe(a,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var s=he("defs",r._svg);s||(s=Be("defs"),ye(r._svg,s)),ye(s,a),l[e]=a}function f(e){return e.replace(/[()\s,#]+/g,"_")}function m(e,t,n){var i=e+"-"+f(t)+"-"+f(n)+"-"+p;return l[i]||function(e,t,n,i){if("sequenceflow-end"===t){var r=Be("path");xe(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),d(e,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var o=Be("circle");xe(o,{cx:6,cy:6,r:3.5}),d(e,{element:o,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Be("path");xe(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),d(e,{element:a,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Be("path");xe(s,{d:"M 11 5 L 1 10 L 11 15"}),d(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var c=Be("path");xe(c,{d:"M 1 5 L 11 10 L 1 15"}),d(e,{element:c,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=Be("path");xe(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),d(e,{element:p,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var l=Be("path");xe(l,{d:"M 6 4 L 10 16"}),d(e,{element:l,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){u(i)&&(r=i,i=0),i=i||0,"none"===(r=h(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Be("circle");return xe(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),xe(s,r),ye(e,s),s}function v(e,t,n,i,r,o){u(r)&&(o=r,r=0),r=r||0,o=h(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Be("rect");return xe(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),xe(a,o),ye(e,a),a}function b(e,t,n){var i=st(t,n=h(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return ye(e,i),i}function x(e,t,n){n=h(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=Be("path");return xe(i,{d:t}),xe(i,n),ye(e,i),i}function _(e,t,n,i){return x(t,n,I({"data-marker":e},i))}function E(e){return function(t,n){return k[e](t,n)}}function w(e){return k[e]}function S(e,t){var n=Li(e),i=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type}(n);return n.eventDefinitions&&n.eventDefinitions.length>1?n.parallelMultiple?w("bpmn:ParallelMultipleEventDefinition")(t,e,i):w("bpmn:MultipleEventDefinition")(t,e,i):Oi(n,"bpmn:MessageEventDefinition")?w("bpmn:MessageEventDefinition")(t,e,i):Oi(n,"bpmn:TimerEventDefinition")?w("bpmn:TimerEventDefinition")(t,e,i):Oi(n,"bpmn:ConditionalEventDefinition")?w("bpmn:ConditionalEventDefinition")(t,e):Oi(n,"bpmn:SignalEventDefinition")?w("bpmn:SignalEventDefinition")(t,e,i):Oi(n,"bpmn:EscalationEventDefinition")?w("bpmn:EscalationEventDefinition")(t,e,i):Oi(n,"bpmn:LinkEventDefinition")?w("bpmn:LinkEventDefinition")(t,e,i):Oi(n,"bpmn:ErrorEventDefinition")?w("bpmn:ErrorEventDefinition")(t,e,i):Oi(n,"bpmn:CancelEventDefinition")?w("bpmn:CancelEventDefinition")(t,e,i):Oi(n,"bpmn:CompensateEventDefinition")?w("bpmn:CompensateEventDefinition")(t,e,i):Oi(n,"bpmn:TerminateEventDefinition")?w("bpmn:TerminateEventDefinition")(t,e,i):null}function C(e,t,n){n=I({size:{width:100}},n);var i=o.createText(t||"",n);return Ce(i).add("djs-label"),ye(e,i),i}function T(e,t,n){return C(e,Li(t).name,{box:t,align:n,padding:5,style:{fill:zi(t,c)}})}function R(e,t,n){Zt(C(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:zi(n,c)}}),0,-(-1*n.height),270)}function A(e){for(var t=e.waypoints,n="m "+t[0].x+","+t[0].y,i=1;i<t.length;i++)n+="L"+t[i].x+","+t[i].y+" ";return n}var k=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=Gi),y(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Ii(t,s),stroke:zi(t,c)};Li(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Ii(t,s),stroke:zi(t,c)});var i=w("bpmn:Event")(e,t,n);return S(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?zi(t,c):Ii(t,s),stroke:n?Ii(t,s):zi(t,c)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Ii(t,s),stroke:zi(t,c)});x(e,i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:zi(t,c)});for(var r=0;r<12;r++){var o=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;x(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*r+","+t.height/2+","+a+")",stroke:zi(t,c)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)})},"bpmn:ConditionalEventDefinition":function(e,t){return x(e,i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:zi(t,c)})},"bpmn:LinkEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)})},"bpmn:ErrorEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)})},"bpmn:CancelEventDefinition":function(e,t,n){var r=x(e,i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)});return Jt(r,45),r},"bpmn:CompensateEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)})},"bpmn:SignalEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?zi(t,c):"none",stroke:zi(t,c)})},"bpmn:MultipleEventDefinition":function(e,t,n){return x(e,i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?zi(t,c):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return x(e,i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:zi(t,c),stroke:zi(t,c)})},"bpmn:EndEvent":function(e,t){var n=w("bpmn:Event")(e,t,{strokeWidth:4,fill:Ii(t,s),stroke:zi(t,c)});return S(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:zi(t,c),stroke:zi(t,c)})},"bpmn:IntermediateEvent":function(e,t){var n=w("bpmn:Event")(e,t,{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)});return y(e,t.width,t.height,Hi,{strokeWidth:1,fill:Ii(t,"none"),stroke:zi(t,c)}),S(t,e),n},"bpmn:IntermediateCatchEvent":E("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":E("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=Gi),v(e,t.width,t.height,$i,n)},"bpmn:Task":function(e,t){var n={fill:Ii(t,s),stroke:zi(t,c)},i=w("bpmn:Activity")(e,t,n);return T(e,t,"center-middle"),P(e,t),i},"bpmn:ServiceTask":function(e,t){var n=w("bpmn:Task")(e,t);return x(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)}),x(e,i.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Ii(t,s)}),x(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)}),n},"bpmn:UserTask":function(e,t){var n=w("bpmn:Task")(e,t);return x(e,i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ii(t,s),stroke:zi(t,c)}),x(e,i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ii(t,s),stroke:zi(t,c)}),x(e,i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:zi(t,c),stroke:zi(t,c)}),n},"bpmn:ManualTask":function(e,t){var n=w("bpmn:Task")(e,t);return x(e,i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Ii(t,s),stroke:zi(t,c)}),n},"bpmn:SendTask":function(e,t){var n=w("bpmn:Task")(e,t);return x(e,i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:zi(t,c),stroke:Ii(t,s)}),n},"bpmn:ReceiveTask":function(e,t){var n,r=Li(t),o=w("bpmn:Task")(e,t);return r.instantiate?(y(e,28,28,4.4,{strokeWidth:1}),n=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),x(e,n,{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)}),o},"bpmn:ScriptTask":function(e,t){var n=w("bpmn:Task")(e,t);return x(e,i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:zi(t,c)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=w("bpmn:Task")(e,t);return xe(x(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Ii(t,"#aaaaaa"),stroke:zi(t,c)}),xe(x(e,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:zi(t,c)}),n},"bpmn:SubProcess":function(e,t,n){n=I({fill:Ii(t,s),stroke:zi(t,c)},n);var i=w("bpmn:Activity")(e,t,n),r=Pi(t);return Mi(t)&&xe(i,{strokeDasharray:"1,2"}),T(e,t,r?"center-top":"center-middle"),r?P(e,t):P(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return w("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var i=w("bpmn:SubProcess")(e,t),r=n.style(["no-fill","no-events"],{stroke:zi(t,c)});return v(e,t.width,t.height,$i-2,Hi,r),i},"bpmn:CallActivity":function(e,t){return w("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:Gi,fill:Ii(t,s),stroke:zi(t,c)},i=w("bpmn:Lane")(e,t,n);Pi(t)?(b(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:zi(t,c)}),R(e,Li(t).name,t)):C(e,Li(t).name,{box:t,align:"center-middle",style:{fill:zi(t,c)}});return!!Li(t).participantMultiplicity&&w("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=v(e,t.width,t.height,0,I({fill:Ii(t,s),fillOpacity:Wi,stroke:zi(t,c)},n)),r=Li(t);"bpmn:Lane"===r.$type&&R(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=w("bpmn:Gateway")(e,t);return y(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Ii(t,s),stroke:zi(t,c)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=w("bpmn:Gateway")(e,t),r=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return ji(t).isMarkerVisible&&x(e,r,{strokeWidth:1,fill:zi(t,c),stroke:zi(t,c)}),n},"bpmn:ComplexGateway":function(e,t){var n=w("bpmn:Gateway")(e,t);return x(e,i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:zi(t,c),stroke:zi(t,c)}),n},"bpmn:ParallelGateway":function(e,t){var n=w("bpmn:Gateway")(e,t);return x(e,i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:zi(t,c),stroke:zi(t,c)}),n},"bpmn:EventBasedGateway":function(e,t){var n=Li(t),r=w("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:zi(t,c)});var o=n.eventGatewayType,a=!!n.instantiate;if("Parallel"===o){var s=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});xe(x(e,s),{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a)xe(y(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:zi(t,c)});!function(){var n=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),r={strokeWidth:2,fill:Ii(t,"none"),stroke:zi(t,c)};x(e,n,r)}()}return r},"bpmn:Gateway":function(e,t){var n={fill:Ii(t,s),fillOpacity:Gi,stroke:zi(t,c)};return function(e,t,n,i){var r=t/2,o=n/2,a=[{x:r,y:0},{x:t,y:o},{x:r,y:n},{x:0,y:o}].map(function(e){return e.x+","+e.y}).join(" ");i=h(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=Be("polygon");return xe(s,{points:a}),xe(s,i),ye(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=A(t),r=Ii(t,s),o=zi(t,c),a=x(e,i,{strokeLinejoin:"round",markerEnd:m("sequenceflow-end",r,o),stroke:zi(t,c)}),p=Li(t);return t.source&&(n=t.source.businessObject,p.conditionExpression&&n.$instanceOf("bpmn:Activity")&&xe(a,{markerStart:m("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===p&&xe(a,{markerStart:m("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=Li(t),r=Ii(t,s),o=zi(t,c);return n=I({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:zi(t,c)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=m("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=m("association-start",r,o)),b(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Ii(t,s),i=zi(t,c);return w("bpmn:Association")(e,t,{markerEnd:m("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Ii(t,s),i=zi(t,c);return w("bpmn:Association")(e,t,{markerEnd:m("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=Li(t),r=ji(t),o=Ii(t,s),a=zi(t,c),p=x(e,A(t),{markerEnd:m("messageflow-end",o,a),markerStart:m("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:zi(t,c)});if(n.messageRef){var l=p.getPointAtLength(p.getTotalLength()/2),u=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:l.x,y:l.y}}),h={strokeWidth:1};"initiating"===r.messageVisibleKind?(h.fill="white",h.stroke="black"):(h.fill="#888",h.stroke="white"),x(e,u,h)}return p},"bpmn:DataObject":function(e,t){var n=x(e,i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Ii(t,s),fillOpacity:Gi,stroke:zi(t,c)});return function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection}(Li(t))&&function(e,t){var n=(t.height-16)/t.height,r=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:n}});x(e,r,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":E("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=w("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=w("bpmn:DataObject")(e,t);return x(e,n,{strokeWidth:1,fill:"black"}),r},"bpmn:DataStoreReference":function(e,t){return x(e,i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Ii(t,s),fillOpacity:Gi,stroke:zi(t,c)})},"bpmn:BoundaryEvent":function(e,t){var n=Li(t).cancelActivity,i={strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=I({},i,{fillOpacity:1}),o=I({},i,{fill:"none"}),a=w("bpmn:Event")(e,t,r);return y(e,t.width,t.height,Hi,o),S(t,e),a},"bpmn:Group":function(e,t){return v(e,t.width,t.height,$i,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return C(e,Ni(t),{box:n,fitBox:!0,style:I({},o.getExternalStyle(),{fill:zi(t,c)})})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return x(e,i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:zi(t,c)}),C(e,Li(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:zi(t,c)}}),n},ParticipantMultiplicityMarker:function(e,t){_("participant-multiplicity",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)})},SubProcessMarker:function(e,t){Qt(v(e,14,14,0,{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)}),t.width/2-7.5,t.height-20),_("sub-process",e,i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:Ii(t,s),stroke:zi(t,c)})},ParallelMarker:function(e,t,n){_("parallel",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}),{fill:Ii(t,s),stroke:zi(t,c)})},SequentialMarker:function(e,t,n){_("sequential",e,i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}),{fill:Ii(t,s),stroke:zi(t,c)})},CompensationMarker:function(e,t,n){_("compensation",e,i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c)})},LoopMarker:function(e,t,n){_("loop",e,i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:Ii(t,s),stroke:zi(t,c),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){_("adhoc",e,i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:zi(t,c),stroke:zi(t,c)})}};function P(e,t,n){var i,r=Li(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},g(n,function(n){w(n)(e,t,i)}),r.isForCompensation&&w("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&w("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&w("LoopMarker")(e,t,i),!1===s&&w("ParallelMarker")(e,t,i),!0===s&&w("SequentialMarker")(e,t,i))}this._drawPath=x}n(Vi,rt),Vi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],Vi.prototype.canRender=function(e){return Ai(e,"bpmn:BaseElement")},Vi.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Vi.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Vi.prototype.getShapePath=function(e){return Ai(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,ot([["M",n,i],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]])):Ai(e,"bpmn:Activity")?function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return ot([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])}(e,$i):Ai(e,"bpmn:Gateway")?function(e){var t=e.width/2,n=e.height/2;return ot([["M",e.x+t,e.y],["l",t,n],["l",-t,n],["l",-t,-n],["z"]])}(e):function(e){var t=e.x,n=e.y,i=e.width;return ot([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])}(e);var t,n,i,r};var Ui=0,qi={width:150,height:50};function Ki(e,t){var n;t.textContent=e;try{var i,r=""===e;return t.textContent=r?"dummy":e,i={width:(n=t.getBBox()).width+2*n.x,height:n.height},r&&(i.width=0),i}catch(e){return{width:0,height:0}}}function Yi(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Ki(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Xi(e,o,r,i);o=Zi(o,i.width,t)}}function Xi(e,t,n,i){if(t.length<n.length){var r=n.slice(t.length).trim();e.unshift(r)}return{width:i.width,height:i.height,text:t}}function Zi(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function Qi(e){this._config=I({},{size:qi,padding:Ui,style:{},align:"center-top"},e||{})}Qi.prototype.createText=function(e,t){return this.layoutText(e,t).element},Qi.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Qi.prototype.layoutText=function(e,t){var n=I({},this._config.size,t.box),i=I({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return u(e)?I({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(i),c=e.split(/\r?\n/g),p=[],l=n.width-o.left-o.right,h=Be("text");for(xe(h,{x:0,y:0}),xe(h,i),ye(function(){var e=document.getElementById("helper-svg");return e||(xe(e=Be("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}(),h);c.length;)p.push(Yi(c,l,h));"middle"===r.vertical&&(o.top=o.bottom=0);var d=x(p,function(e,t,n){return e+(s||t.height)},0)+o.top+o.bottom,f=x(p,function(e,t,n){return t.width>e?t.width:e},0),m=o.top;"middle"===r.vertical&&(m+=(n.height-d)/2),m-=(s||p[0].height)/4;var y=Be("text");return xe(y,i),g(p,function(e){var t;switch(m+=s||e.height,r.horizontal){case"left":t=o.left;break;case"right":t=(a?f:l)-o.right-e.width;break;default:t=Math.max(((a?f:l)-e.width)/2+o.left,0)}var n=Be("tspan");xe(n,{x:t,y:m}),n.textContent=e.text,ye(y,n)}),Re(h),{dimensions:{width:f,height:d},element:y}};var Ji=12,er=1.2,tr=30;function nr(e){var t=I({fontFamily:"Arial, sans-serif",fontSize:Ji,fontWeight:"normal",lineHeight:er},e&&e.defaultStyle||{}),n=parseInt(t.fontSize,10)-1,i=I({},t,{fontSize:n},e&&e.externalStyle||{}),r=new Qi({style:t});this.getExternalLabelBounds=function(e,t){var n=r.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:i});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,n){var i=r.getDimensions(n,{box:e,style:t,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(tr,Math.round(i.height))}},this.createText=function(e,t){return r.createText(e,t||{})},this.getDefaultStyle=function(){return t},this.getExternalStyle=function(){return i}}nr.$inject=["config.textRenderer"];var ir=/\{([^}]+)\}/g,rr=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var or={__init__:["bpmnRenderer"],bpmnRenderer:["type",Vi],textRenderer:["type",nr],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(ir,function(e,t){return function(e,t,n){var i=n;return t.replace(rr,function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))}),i=(null==i||i==n?e:i)+""}(e,t,a)})}}]};var ar={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(e,n){return t[n]||"{"+n+"}"})}]},sr={width:90,height:20},cr=15;function pr(e){return Ai(e,"bpmn:Event")||Ai(e,"bpmn:Gateway")||Ai(e,"bpmn:DataStoreReference")||Ai(e,"bpmn:DataObjectReference")||Ai(e,"bpmn:DataInput")||Ai(e,"bpmn:DataOutput")||Ai(e,"bpmn:SequenceFlow")||Ai(e,"bpmn:MessageFlow")||Ai(e,"bpmn:Group")}function lr(e){return dr(e.label)}function ur(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=function(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=cr:a+=cr,{x:a,y:s}}function hr(e){return e.waypoints?ur(e.waypoints):Ai(e,"bpmn:Group")?{x:e.x+e.width/2,y:e.y+sr.height/2}:{x:e.x+e.width/2,y:e.y+e.height+sr.height/2}}function dr(e){return e&&!!e.labelTarget}function fr(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function mr(e,t,n,i){if(void 0===i&&(i=5),!e||!t||!n)return!1;var r=(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),o=fr(e,t);return Math.abs(r/o)<=i}var yr=2;function vr(e,t){var n;return function(e,t){var n;n=l(e)?e:[e,t];var i=n.slice().shift();return _(n,function(e){return Math.abs(i.y-e.y)<=yr})}(n=l(e)?e:[e,t])?"h":!!function(e,t){var n;n=l(e)?e:[e,t];var i=n.slice().shift();return _(n,function(e){return Math.abs(i.x-e.x)<=yr})}(n)&&"v"}function gr(e,t,n){return n=n||0,e.x>t.x-n&&e.y>t.y-n&&e.x<t.x+t.width+n&&e.y<t.y+t.height+n}function br(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}
3/**
4 * This file contains portions that got extraced from Snap.svg (licensed Apache-2.0).
5 *
6 * @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
7 */var xr="hasOwnProperty",_r=/,?([a-z]),?/gi,Er=parseFloat,wr=Math,Sr=wr.PI,Cr=wr.min,Tr=wr.max,Rr=wr.pow,Ar=wr.abs,kr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,Pr=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function Mr(e,t){return"finite"==(t=String.prototype.toLowerCase.call(t))?isFinite(e):!("array"!=t||!(e instanceof Array||Array.isArray&&Array.isArray(e)))||("null"==t&&null===e||t==typeof e&&null!==e||"object"==t&&e===Object(e)||Object.prototype.toString.call(e).slice(8,-1).toLowerCase()==t)}function Dr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[xr](n)&&(t[n]=Dr(e[n]));return t}function Br(e){var t=Br.ps=Br.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[xr](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function Nr(e,t,n,i){return null==e&&(e=t=n=i=0),null==t&&(t=e.y,n=e.width,i=e.height,e=e.x),{x:e,y:t,width:n,w:n,height:i,h:i,x2:e+n,y2:t+i,cx:e+n/2,cy:t+i/2,r1:wr.min(n,i)/2,r2:wr.max(n,i)/2,r0:wr.sqrt(n*n+i*i)/2,path:Wr(e,t,n,i),vb:[e,t,n,i].join(" ")}}function Or(){return this.join(",").replace(_r,"$1")}function jr(e){var t=Dr(e);return t.toString=Or,t}function Lr(e,t,n,i,r,o,a,s,c){var p=1-c,l=Rr(p,3),u=Rr(p,2),h=c*c,d=h*c,f=e+2*c*(n-e)+h*(r-2*n+e),m=t+2*c*(i-t)+h*(o-2*i+t),y=n+2*c*(r-n)+h*(a-2*r+n),v=i+2*c*(o-i)+h*(s-2*o+i);return{x:l*e+3*u*c*n+3*p*c*c*r+d*a,y:l*t+3*u*c*i+3*p*c*c*o+d*s,m:{x:f,y:m},n:{x:y,y:v},start:{x:p*e+c*n,y:p*t+c*i},end:{x:p*r+c*a,y:p*o+c*s},alpha:90-180*wr.atan2(f-y,m-v)/Sr}}function Ir(e,t,n,i,r,o,a,s){Mr(e,"array")||(e=[e,t,n,i,r,o,a,s]);var c=function(e,t,n,i,r,o,a,s){for(var c,p,l,u,h,d,f,m,y=[],v=[[],[]],g=0;g<2;++g)if(0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,l=3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,l=3*i-3*t),Ar(c)<1e-12){if(Ar(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else f=p*p-4*l*c,m=wr.sqrt(f),f<0||(0<(h=(-p+m)/(2*c))&&h<1&&y.push(h),0<(d=(-p-m)/(2*c))&&d<1&&y.push(d));var b,x=y.length,_=x;for(;x--;)u=y[x],b=1-u,v[0][x]=b*b*b*e+3*b*b*u*n+3*b*u*u*r+u*u*u*a,v[1][x]=b*b*b*t+3*b*b*u*i+3*b*u*u*o+u*u*u*s;return v[0][_]=e,v[1][_]=t,v[0][_+1]=a,v[1][_+1]=s,v[0].length=v[1].length=_+2,{min:{x:Cr.apply(0,v[0]),y:Cr.apply(0,v[1])},max:{x:Tr.apply(0,v[0]),y:Tr.apply(0,v[1])}}}.apply(null,e);return Nr(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function zr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Fr(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function $r(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=c>1?1:c<0?0:c)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var f=p*l[d]+p,m=Fr(f,e,n,r,a),y=Fr(f,t,i,o,s),v=m*m+y*y;h+=u[d]*wr.sqrt(v)}return p*h}function Hr(e,t,n,i,r,o,a,s){if(!(Tr(e,n)<Cr(r,a)||Cr(e,n)>Tr(r,a)||Tr(t,i)<Cr(o,s)||Cr(t,i)>Tr(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+Cr(e,n).toFixed(2)||u>+Tr(e,n).toFixed(2)||u<+Cr(r,a).toFixed(2)||u>+Tr(r,a).toFixed(2)||h<+Cr(t,i).toFixed(2)||h>+Tr(t,i).toFixed(2)||h<+Cr(o,s).toFixed(2)||h>+Tr(o,s).toFixed(2)))return{x:p,y:l}}}}function Gr(e,t,n){if(!function(e,t){return e=Nr(e),zr(t=Nr(t),e.x,e.y)||zr(t,e.x2,e.y)||zr(t,e.x,e.y2)||zr(t,e.x2,e.y2)||zr(e,t.x,t.y)||zr(e,t.x2,t.y)||zr(e,t.x,t.y2)||zr(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(Ir(e),Ir(t)))return n?0:[];for(var i=~~($r.apply(0,e)/5),r=~~($r.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<i+1;p++){var l=Lr.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<r+1;p++)l=Lr.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],f=a[u],m=a[u+1],y=Ar(d.x-h.x)<.01?"y":"x",v=Ar(m.x-f.x)<.01?"y":"x",g=Hr(h.x,h.y,d.x,d.y,f.x,f.y,m.x,m.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+Ar((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=f.t+Ar((g[v]-f[v])/(m[v]-f[v]))*(m.t-f.t);b>=0&&b<=1&&x>=0&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function Wr(e,t,n,i,r){if(r)return[["M",+e+ +r,t],["l",n-2*r,0],["a",r,r,0,0,1,r,r],["l",0,i-2*r],["a",r,r,0,0,1,-r,r],["l",2*r-n,0],["a",r,r,0,0,1,-r,-r],["l",0,2*r-i],["a",r,r,0,0,1,r,-r],["z"]];var o=[["M",e,t],["l",n,0],["l",0,i],["l",-n,0],["z"]];return o.toString=Or,o}function Vr(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=Or,c}function Ur(e){var t=Br(e);if(t.abs)return jr(t.abs);if(Mr(e,"array")&&Mr(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=Br(e);if(t.arr)return Dr(t.arr);var n={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return Mr(e,"array")&&Mr(e[0],"array")&&(i=Dr(e)),i.length||String(e).replace(kr,function(e,t,r){var o=[],a=t.toLowerCase();if(r.replace(Pr,function(e,t){t&&o.push(+t)}),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L"),"o"==a&&1==o.length&&i.push([t,o[0]]),"r"==a)i.push([t].concat(o));else for(;o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););}),i.toString=Br.toString,t.arr=Dr(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var f=[r,o].concat(l.slice(1)),m=2,y=f.length;m<y;m++)f[m]=+f[m]+r,f[++m]=+f[m]+o;i.pop(),i=i.concat(Xr(f,u));break;case"O":i.pop(),(f=Vr(r,o,l[1],l[2])).push(f[0]),i=i.concat(f);break;case"U":i.pop(),i=i.concat(Vr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));break;case"M":a=+l[1]+r,s=+l[2]+o;default:for(m=1,y=l.length;m<y;m++)p[m]=+l[m]+(m%2?r:o)}else if("R"==n)f=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(Xr(f,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(f=Vr(r,o,l[1],l[2])).push(f[0]),i=i.concat(f);else if("U"==n)i.pop(),i=i.concat(Vr(r,o,l[1],l[2],l[3])),p=["U"].concat(i[i.length-1].slice(-2));else for(var v=0,g=l.length;v<g;v++)p[v]=l[v];if("O"!=(n=n.toUpperCase()))switch(p[0]){case"Z":r=+a,o=+s;break;case"H":r=p[1];break;case"V":o=p[1];break;case"M":a=p[p.length-2],s=p[p.length-1];default:r=p[p.length-2],o=p[p.length-1]}}return i.toString=Or,t.abs=jr(i),i}function qr(e,t,n,i){return[e,t,n,i,n,i]}function Kr(e,t,n,i,r,o){return[1/3*e+2/3*n,1/3*t+2/3*i,1/3*r+2/3*n,1/3*o+2/3*i,r,o]}function Yr(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,f=120*Sr/180,m=Sr/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*wr.cos(n)-t*wr.sin(n),y:e*wr.sin(n)+t*wr.cos(n)}},function e(){var t=Array.prototype.slice.call(arguments,0),n=t.join("␀"),i=e.cache=e.cache||{},r=e.count=e.count||[];return i[xr](n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),d?d(i[n]):i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t),d?d(i[n]):i[n])});if(p)T=p[0],R=p[1],S=p[2],C=p[3];else{e=(l=v(e,t,-m)).x,t=l.y;var g=(e-(s=(l=v(s,c,-m)).x))/2,b=(t-(c=l.y))/2,x=g*g/(n*n)+b*b/(i*i);x>1&&(n*=x=wr.sqrt(x),i*=x);var _=n*n,E=i*i,w=(o==a?-1:1)*wr.sqrt(Ar((_*E-_*b*b-E*g*g)/(_*b*b+E*g*g))),S=w*n*b/i+(e+s)/2,C=w*-i*g/n+(t+c)/2,T=wr.asin(((t-C)/i).toFixed(9)),R=wr.asin(((c-C)/i).toFixed(9));(T=e<S?Sr-T:T)<0&&(T=2*Sr+T),(R=s<S?Sr-R:R)<0&&(R=2*Sr+R),a&&T>R&&(T-=2*Sr),!a&&R>T&&(R-=2*Sr)}var A=R-T;if(Ar(A)>f){var k=R,P=s,M=c;R=T+f*(a&&R>T?1:-1),y=Yr(s=S+n*wr.cos(R),c=C+i*wr.sin(R),n,i,r,0,a,P,M,[R,k,S,C])}A=R-T;var D=wr.cos(T),B=wr.sin(T),N=wr.cos(R),O=wr.sin(R),j=wr.tan(A/4),L=4/3*n*j,I=4/3*i*j,z=[e,t],F=[e+L*B,t-I*D],$=[s+L*O,c-I*N],H=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,H].concat(y);for(var G=[],W=0,V=(y=[F,$,H].concat(y).join().split(",")).length;W<V;W++)G[W]=W%2?v(y[W-1],y[W],m).y:v(y[W],y[W+1],m).x;return G}function Xr(e,t){for(var n=[],i=0,r=e.length;r-2*!t>i;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function Zr(e,t){var n=!t&&Br(e);if(!t&&n.curve)return jr(n.curve);for(var i=Ur(e),r=t&&Ur(t),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(Yr.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(Kr(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(Kr(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(qr(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(qr(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(qr(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(qr(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(e[t].length>7){e[t].shift();for(var n=e[t];n.length;)l[t]="A",r&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),m=Tr(i.length,r&&r.length||0)}},p=function(e,t,n,o,a){e&&t&&"M"==e[a][0]&&"M"!=t[a][0]&&(t.splice(a,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[a][1],n.y=e[a][2],m=Tr(i.length,r&&r.length||0))},l=[],u=[],h="",d="",f=0,m=Tr(i.length,r&&r.length||0);f<m;f++){i[f]&&(h=i[f][0]),"C"!=h&&(l[f]=h,f&&(d=l[f-1])),i[f]=s(i[f],o,d),"A"!=l[f]&&"C"==h&&(l[f]="C"),c(i,f),r&&(r[f]&&(h=r[f][0]),"C"!=h&&(u[f]=h,f&&(d=u[f-1])),r[f]=s(r[f],a,d),"A"!=u[f]&&"C"==h&&(u[f]="C"),c(r,f)),p(i,r,o,a,f),p(r,i,a,o,f);var y=i[f],v=r&&r[f],g=y.length,b=r&&v.length;o.x=y[g-2],o.y=y[g-1],o.bx=Er(y[g-4])||o.x,o.by=Er(y[g-3])||o.y,a.bx=r&&(Er(v[b-4])||a.x),a.by=r&&(Er(v[b-3])||a.y),a.x=r&&v[b-2],a.y=r&&v[b-1]}return r||(n.curve=jr(i)),r?[i,r]:i}var Qr=function(e,t,n){e=Zr(e),t=Zr(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],f=0,m=e.length;f<m;f++){var y=e[f];if("M"==y[0])i=s=y[1],r=c=y[2];else{"C"==y[0]?(u=[i,r].concat(y.slice(1)),i=u[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(h=[o,a].concat(b.slice(1)),o=h[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=Gr(u,h,n);if(n)d+=x;else{for(var _=0,E=x.length;_<E;_++)x[_].segment1=f,x[_].segment2=v,x[_].bez1=u,x[_].bez2=h;d=d.concat(x)}}}}}return d};function Jr(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function eo(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function to(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function no(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function io(e){return eo({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function ro(e,t,n){u(n=n||0)||(n={x:n,y:n});var i=to(e),r=to(t),o=i.bottom+n.y<=r.top,a=i.left-n.x>=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"}function oo(e,t,n){var i=Qr(e,t);return 1===i.length?eo(i[0]):2===i.length&&fr(i[0],i[1])<1?eo(i[0]):i.length>1?eo((i=k(i,function(e){var t=Math.floor(100*e.t2)||1;return t=((t=100-t)<10?"0":"")+t,e.segment2+"#"+t}))[n?0:i.length-1]):null}function ao(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===fr(t,i=e[r+1])||mr(n,i,t)?e.splice(r,1):r++;return e}function so(e,t){return I({id:e.id,type:e.$type,businessObject:e},t)}function co(e,t,n){var i=e.di.waypoint;return!i||i.length<2?[io(t),io(n)]:i.map(function(e){return{x:e.x,y:e.y}})}function po(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:Si(n),referenced:Si(t),property:i}))}function lo(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}lo.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],lo.prototype.add=function(e,t){var n,i,r,o,a,s,c,p=e.di,l=this._translate;if(Ai(p,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(so(e)),this._canvas.setRootElement(n);else if(Ai(p,"bpmndi:BPMNShape")){var u=!Pi(e);i=t&&(t.hidden||t.collapsed);var h=e.di.bounds;n=this._elementFactory.createShape(so(e,{collapsed:u,hidden:i,x:Math.round(h.x),y:Math.round(h.y),width:Math.round(h.width),height:Math.round(h.height)})),Ai(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ai(e,"bpmn:Lane")&&(r=0),Ai(e,"bpmn:DataStoreReference")&&(o=t,a=io(h),s=a.x,c=a.y,s>=o.x&&s<=o.x+o.width&&c>=o.y&&c<=o.y+o.height||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!Ai(p,"bpmndi:BPMNEdge"))throw new Error(l("unknown di {di} for element {semantic}",{di:Si(p),semantic:Si(e)}));var d=this._getSource(e),f=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(so(e,{hidden:i,source:d,target:f,waypoints:co(e,d,f)})),Ai(e,"bpmn:DataAssociation")&&(t=null),Ai(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return pr(e)&&Ni(n)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},lo.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Si(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw po(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},lo.prototype.addLabel=function(e,t){var n,i,r;return n=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(sr.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=hr(t),i=sr),I({x:n.x-i.width/2,y:n.y-i.height/2},i)}(e,t),(i=Ni(t))&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(so(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!Ni(t),x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},lo.prototype._getEnd=function(e,t){var n,i,r=e.$type,o=this._translate;if(i=e[t+"Ref"],"source"===t&&"bpmn:DataInputAssociation"===r&&(i=i&&i[0]),("source"===t&&"bpmn:DataOutputAssociation"===r||"target"===t&&"bpmn:DataInputAssociation"===r)&&(i=e.$parent),n=i&&this._getElement(i))return n;throw i?po(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Si(e),side:t}))},lo.prototype._getSource=function(e){return this._getEnd(e,"source")},lo.prototype._getTarget=function(e){return this._getEnd(e,"target")},lo.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var uo={__depends__:[or,{__depends__:[ar],bpmnImporter:["type",lo]}]};function ho(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function fo(e){return e.originalEvent||e.srcEvent}function mo(e,t){ho(e),ho(fo(e))}function yo(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function vo(e){return!(fo(e)||e).button}function go(e){var t=fo(e)||e;return!!vo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function bo(e){return!0}var xo=500;function _o(e,t,n){var i=this;function r(n,i,r){var o,a;(function(e,t){return!(c[e]||vo)(t)})(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=t.get(a)),a&&r&&!1===e.fire(n,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function a(e){return o[e]}var s={click:"element.click",contextmenu:"element.contextmenu",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseover:"element.hover",mouseout:"element.out",mouseup:"element.mouseup"},c={"element.contextmenu":bo};var p="svg, .djs-element";function l(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(c[n]=i),a.$delegate=oe.bind(e,p,t,a)}function u(e,t,n){var i=a(n);i&&oe.unbind(e,t,i.$delegate)}e.on("canvas.destroy",function(e){var t;t=e.svg,g(s,function(e,n){u(t,n,e)})}),e.on("canvas.init",function(e){var t;t=e.svg,g(s,function(e,n){l(t,n,e)})}),e.on(["shape.added","connection.added"],function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.createHit",{element:n,gfx:i})}),e.on(["shape.changed","connection.changed"],xo,function(t){var n=t.element,i=t.gfx;e.fire("interactionEvents.updateHit",{element:n,gfx:i})}),e.on("interactionEvents.createHit",xo,function(e){var t=e.element,n=e.gfx;i.createDefaultHit(t,n)}),e.on("interactionEvents.updateHit",function(e){var t=e.element,n=e.gfx;i.updateDefaultHit(t,n)});var h=m("djs-hit djs-hit-stroke"),d=m("djs-hit djs-hit-click-stroke"),f={all:m("djs-hit djs-hit-all"),"click-stroke":d,stroke:h};function m(e,t){return t=I({stroke:"white",strokeWidth:15},t||{}),n.cls(e,["no-fill","no-border"],t)}function y(e,t){var n=f[t];if(!n)throw new Error("invalid hit type <"+t+">");return xe(e,n),e}function v(e,t){ye(e,t)}this.removeHits=function(e){g(de(".djs-hit",e),Re)},this.createDefaultHit=function(e,t){var n,i=e.waypoints,r=e.isFrame;return i?this.createWaypointsHit(t,i):(n=r?"stroke":"all",this.createBoxHit(t,n,{width:e.width,height:e.height}))},this.createWaypointsHit=function(e,t){var n=st(t);return y(n,"stroke"),v(e,n),n},this.createBoxHit=function(e,t,n){n=I({x:0,y:0},n);var i=Be("rect");return y(i,t),xe(i,n),v(e,i),i},this.updateDefaultHit=function(e,t){var n=he(".djs-hit",t);if(n)return e.waypoints?function(e,t){xe(e,{points:at(t)})}(n,e.waypoints):xe(n,{width:e.width,height:e.height}),n},this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=s[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=u}_o.$inject=["eventBus","elementRegistry","styles"];var Eo={__init__:["interactionEvents"],interactionEvents:["type",_o]},wo=500;function So(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Be("rect");return xe(n,I({x:10,y:10,width:100,height:100},i)),ye(e,n),n}e.on(["shape.added","shape.changed"],wo,function(e){var t=e.element,n=e.gfx,i=he(".djs-outline",n);i||(i=o(n)),r.updateShapeOutline(i,t)}),e.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=he(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}So.prototype.updateShapeOutline=function(e,t){xe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},So.prototype.updateConnectionOutline=function(e,t){var n=ht(t);xe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},So.$inject=["eventBus","styles","elementRegistry"];var Co={__init__:["outline"],outline:["type",So]};function To(e){this._eventBus=e,this._selectedElements=[];var t=this;e.on(["shape.remove","connection.remove"],function(e){var n=e.element;t.deselect(n)}),e.on(["diagram.clear"],function(e){t.select(null)})}To.$inject=["eventBus"],To.prototype.deselect=function(e){var t=this._selectedElements,n=t.indexOf(e);if(-1!==n){var i=t.slice();t.splice(n,1),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:t})}},To.prototype.get=function(){return this._selectedElements},To.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},To.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();l(e)||(e=e?[e]:[]),t?g(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var Ro="hover",Ao="selected";function ko(e,t,n,i){function r(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,Ro)}),e.on("element.out",function(e){o(e.element,Ro)}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;g(t,function(e){-1===n.indexOf(e)&&o(e,Ao)}),g(n,function(e){-1===t.indexOf(e)&&r(e,Ao)})})}function Po(e,t,n,i){e.on("create.end",500,function(e){var n=e.context,i=n.canExecute,r=n.elements,o=(n.hints||{}).autoSelect;if(i){if(!1===o)return;l(o)?t.select(o):t.select(r)}}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&t.select(e.context.target)}),e.on("shape.move.end",500,function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);y(n,function(e){return r.id===e.id})||t.select(r)}),e.on("element.click",function(e){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=go(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)})}ko.$inject=["eventBus","canvas","selection","styles"],Po.$inject=["eventBus","selection","canvas","elementRegistry"];var Mo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[Eo,Co],selection:["type",To],selectionVisuals:["type",ko],selectionBehavior:["type",Po]};function Do(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}Do.prototype.next=function(){return this._prefix+ ++this._counter};var Bo=new Do("ov");function No(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=Bo,this._overlayDefaults=I({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=ae('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}function Oo(e,t,n){I(e.style,{left:t+"px",top:n+"px"})}function jo(e,t){e.style.display=!1===t?"none":""}function Lo(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}No.$inject=["config.overlays","eventBus","canvas","elementRegistry"],No.prototype.get=function(e){if(f(e)&&(e={id:e}),f(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?v(t.overlays,P({type:e.type})):t.overlays.slice():[]}return e.type?v(this._overlays,P({type:e.type})):e.id?this._overlays[e.id]:null},No.prototype.add=function(e,t,n){if(u(t)&&(n=t,t=null),e.id||(e=this._elementRegistry.get(e)),!n.position)throw new Error("must specifiy overlay position");if(!n.html)throw new Error("must specifiy overlay html");if(!e)throw new Error("invalid element specified");var i=this._ids.next();return n=I({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},No.prototype.remove=function(e){var t=this.get(e)||[];l(t)||(t=[t]);var n=this;g(t,function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(fe(e.html),fe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}})},No.prototype.show=function(){jo(this._overlayRoot)},No.prototype.hide=function(){jo(this._overlayRoot,!1)},No.prototype.clear=function(){this._overlays={},this._overlayContainers=[],K(this._overlayRoot)},No.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ht(t);i=o.x,r=o.y}Oo(n,i,r),$(e.html,"data-container-id",t.id)},No.prototype._updateOverlay=function(e){var t,n,i=e.position,r=e.htmlContainer,o=e.element,a=i.left,s=i.top;void 0!==i.right&&(t=o.waypoints?ht(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?ht(o).height:o.height,s=-1*i.bottom+n);Oo(r,a||0,s||0)},No.prototype._createOverlayContainer=function(e){var t=ae('<div class="djs-overlays" style="position: absolute" />');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},No.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Lo(this._overlayRoot,n)},No.prototype._getOverlayContainer=function(e,t){var n=y(this._overlayContainers,function(t){return t.element===e});return n||t?n:this._createOverlayContainer(e)},No.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),f(o)&&(o=ae(o)),n=this._getOverlayContainer(r),(t=ae('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&U(t).add("djs-overlay-"+e.type),e.htmlContainer=t,n.overlays.push(e),n.html.appendChild(t),this._overlays[i]=e,this._updateOverlay(e),this._updateOverlayVisibilty(e,this._canvas.viewbox())},No.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((p(i)&&i>t.scale||p(r)&&r<t.scale)&&(a=!1),jo(o,a)),this._updateOverlayScale(e,t)},No.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),p(n)&&t.scale<n&&(r=(1/t.scale||1)*n),p(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),p(r)&&(s="scale("+r+","+r+")"),Lo(a,s)},No.prototype._updateOverlaysVisibilty=function(e){var t=this;g(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},No.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element;g(t.get({element:n}),function(e){t.remove(e.id)});var i=t._getOverlayContainer(n);if(i){fe(i.html);var r=t._overlayContainers.indexOf(i);-1!==r&&t._overlayContainers.splice(r,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(g(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&U(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var Io={__init__:["overlays"],overlays:["type",No]},zo='<img width="52" height="52" src="'+("data:image/svg+xml,"+encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 960 960"><path fill="#fff" d="M960 60v839c0 33-27 61-60 61H60c-33 0-60-27-60-60V60C0 27 27 0 60 0h839c34 0 61 27 61 60z"/><path fill="#52b415" d="M217 548a205 205 0 0 0-144 58 202 202 0 0 0-4 286 202 202 0 0 0 285 3 200 200 0 0 0 48-219 203 203 0 0 0-185-128zM752 6a206 206 0 0 0-192 285 206 206 0 0 0 269 111 207 207 0 0 0 111-260A204 204 0 0 0 752 6zM62 0A62 62 0 0 0 0 62v398l60 46a259 259 0 0 1 89-36c5-28 10-57 14-85l99 2 12 85a246 246 0 0 1 88 38l70-52 69 71-52 68c17 30 29 58 35 90l86 14-2 100-86 12a240 240 0 0 1-38 89l43 58h413c37 0 60-27 60-61V407a220 220 0 0 1-44 40l21 85-93 39-45-76a258 258 0 0 1-98 1l-45 76-94-39 22-85a298 298 0 0 1-70-69l-86 22-38-94 76-45a258 258 0 0 1-1-98l-76-45 40-94 85 22a271 271 0 0 1 41-47z"/></svg>'))+'" />';
8/**
9 * This file must not be changed or exchanged.
10 *
11 * @see http://bpmn.io/license for more information.
12 */function Fo(e){return e.join(";")}var $o,Ho='<div class="bjs-powered-by-lightbox" style="'+Fo(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Fo(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+Fo(["position: absolute","left: 50%","top: 40%","margin: 0 -130px","width: 260px","padding: 10px","background: white","border: solid 1px #AAA","border-radius: 3px","font-family: Helvetica, Arial, sans-serif","font-size: 14px","line-height: 1.2em"])+'"><a href="http://bpmn.io" target="_blank" style="float: left; margin-right: 10px">'+zo+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';var Go={width:"100%",height:"100%",position:"relative"};function Wo(e){return e+(h(e)?"px":"")}function Vo(e){
13/**
14 * Adds the project logo to the diagram container as
15 * required by the bpmn.io license.
16 *
17 * @see http://bpmn.io/license
18 *
19 * @param {Element} container
20 */
21var t,n;e=I({},Go,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=ae('<a href="http://bpmn.io" target="_blank" class="bjs-powered-by" title="Powered by bpmn.io" style="position: absolute; bottom: 15px; right: 15px; z-index: 100">'+zo+"</a>"),t.appendChild(n),ie.bind(n,"click",function(e){$o||($o=ae(Ho),oe.bind($o,".backdrop","click",function(e){document.body.removeChild($o)})),document.body.appendChild($o),e.preventDefault()}),this._init(this._container,this._moddle,e)}function Uo(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function qo(e,t){return(e=l(e)?e:[e]).indexOf(t.key)>-1}function Ko(e){return e.shiftKey}n(Vo,on),Vo.prototype.importXML=function(e,t,n){d(t)&&(n=t,t=null),n=n||function(){};var i=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,r,o){r=i._emit("import.parse.complete",{error:e,definitions:r,context:o})||r;var a=o.warnings;if(e)return e=
22/**
23 * The code in the <project-logo></project-logo> area
24 * must not be changed.
25 *
26 * @see http://bpmn.io/license for more information.
27 */
28function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),i._emit("import.done",{error:e,warnings:a}),n(e,a);i.importDefinitions(r,t,function(e,t){var r=[].concat(a,t||[]);i._emit("import.done",{error:e,warnings:r}),n(e,r)})})},Vo.prototype.importDefinitions=function(e,t,n){return d(t)&&(n=t,t=null),n=n||function(){},this._setDefinitions(e),this.open(t,n)},Vo.prototype.open=function(e,t){d(e)&&(t=e,e=null);var n=this._definitions,i=e;if(t=t||function(){},!n)return t(new Error("no XML imported"));if("string"==typeof e&&!(i=function(e,t){return t&&y(e.diagrams,function(e){return e.id===t})||null}(n,e)))return t(new Error("BPMNDiagram <"+e+"> not found"));try{this.clear()}catch(e){return t(e)}return function(e,t,n,i){var r,o,a;d(n)&&(i=n,n=null);var s,c=[];try{r=e.get("bpmnImporter"),o=e.get("eventBus"),a=e.get("translate"),o.fire("import.render.start",{definitions:t}),function(e,t){new Ri({root:function(e){return r.add(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){c.push({message:e,context:t})}},a).handleDefinitions(e,t)}(t,n),o.fire("import.render.complete",{error:s,warnings:c})}catch(e){s=e}i(s,c)}(this,n,i,t)},Vo.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this,i=this._definitions;if(!i)return t(new Error("no definitions loaded"));i=this._emit("saveXML.start",{definitions:i})||i,this._moddle.toXML(i,e,function(e,i){try{i=n._emit("saveXML.serialized",{error:e,xml:i})||i,n._emit("saveXML.done",{error:e,xml:i})}catch(e){console.error("error in saveXML life-cycle listener",e)}t(e,i)})},Vo.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={}),this._emit("saveSVG.start");try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=he("defs",r._svg),s=Ge(o),c=a?"<defs>"+Ge(a)+"</defs>":"",p=o.getBBox();n='<?xml version="1.0" encoding="utf-8"?>\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="'+p.width+'" height="'+p.height+'" viewBox="'+p.x+" "+p.y+" "+p.width+" "+p.height+'" version="1.1">'+c+s+"</svg>"}catch(e){i=e}this._emit("saveSVG.done",{error:i,svg:n}),t(i,n)},Vo.prototype._setDefinitions=function(e){this._definitions=e},Vo.prototype.getModules=function(){return this._modules},Vo.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),on.prototype.clear.call(this)},Vo.prototype.destroy=function(){on.prototype.destroy.call(this),fe(this._container)},Vo.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Vo.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Vo.prototype.attachTo=function(e){if(!e)throw new Error("parentNode required");this.detach(),e.get&&e.constructor.prototype.jquery&&(e=e.get(0)),"string"==typeof e&&(e=he(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Vo.prototype.getDefinitions=function(){return this._definitions},Vo.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Vo.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=I(F(n,["additionalModules"]),{canvas:I({},n.canvas,{container:e}),modules:o});on.call(this,a),n&&n.container&&this.attachTo(n.container)},Vo.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Vo.prototype._createContainer=function(e){var t=ae('<div class="bjs-container"></div>');return I(t.style,{width:Wo(e.width),height:Wo(e.height),position:e.position}),t},Vo.prototype._createModdle=function(e){return new wi(I({},this._moddleExtensions,e.moddleExtensions))},Vo.prototype._modules=[uo,ar,Mo,Io],Vo.prototype._moddleExtensions={};function Yo(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}Yo.$inject=["config.keyboard","eventBus"],Yo.prototype._keydownHandler=function(e){this._keyHandler(e,"keyboard.keydown")},Yo.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Yo.prototype._keyHandler=function(e,t){if(!function(e){return e&&(ue(e,"input, textarea")||"true"===e.contentEditable)}(e.target)){var n={keyEvent:e};this._eventBus.fire(t||"keyboard.keydown",n)&&e.preventDefault()}},Yo.prototype.bind=function(e){this.unbind(),this._node=e,ie.bind(e,"keydown",this._keydownHandler,!0),ie.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},Yo.prototype.getBinding=function(){return this._node},Yo.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),ie.unbind(e,"keydown",this._keydownHandler,!0),ie.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},Yo.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Yo.prototype.addListener=function(e,t,n){d(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||"keyboard.keydown",e,t)},Yo.prototype.removeListener=function(e,t){this._eventBus.off(t||"keyboard.keydown",e)},Yo.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Yo.prototype.isCmd=Uo,Yo.prototype.isShift=Ko,Yo.prototype.isKey=qo;var Xo=500;function Zo(e,t){var n=this;e.on("editorActions.init",Xo,function(e){var i=e.editorActions;n.registerBindings(t,i)})}Zo.$inject=["eventBus","keyboard"],Zo.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}n("undo",function(e){var n=e.keyEvent;if(Uo(n)&&!Ko(n)&&qo(["z","Z"],n))return t.trigger("undo"),!0}),n("redo",function(e){var n=e.keyEvent;if(Uo(n)&&(qo(["y","Y"],n)||qo(["z","Z"],n)&&Ko(n)))return t.trigger("redo"),!0}),n("copy",function(e){var n=e.keyEvent;if(Uo(n)&&qo(["c","C"],n))return t.trigger("copy"),!0}),n("paste",function(e){var n=e.keyEvent;if(Uo(n)&&qo(["v","V"],n))return t.trigger("paste"),!0}),n("stepZoom",function(e){var n=e.keyEvent;if(qo(["+","Add"],n)&&Uo(n))return t.trigger("stepZoom",{value:1}),!0}),n("stepZoom",function(e){var n=e.keyEvent;if(qo(["-","Subtract"],n)&&Uo(n))return t.trigger("stepZoom",{value:-1}),!0}),n("zoom",function(e){var n=e.keyEvent;if(qo("0",n)&&Uo(n))return t.trigger("zoom",{value:1}),!0}),n("removeSelection",function(e){if(qo(["Delete","Del"],e.keyEvent))return t.trigger("removeSelection"),!0})};var Qo={__init__:["keyboard","keyboardBindings"],keyboard:["type",Yo],keyboardBindings:["type",Zo]},Jo={moveSpeed:50,moveSpeedAccelerated:200};function ea(e,t,n){var i=this;this._config=I({},Jo,e||{}),t.addListener(function(e){var n=e.keyEvent,r=i._config;if(!t.isCmd(n))return;if(t.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],n)){var o,a=t.isShift(n)?r.moveSpeedAccelerated:r.moveSpeed;switch(n.key){case"ArrowLeft":case"Left":o="left";break;case"ArrowUp":case"Up":o="up";break;case"ArrowRight":case"Right":o="right";break;case"ArrowDown":case"Down":o="down"}return i.moveCanvas({speed:a,direction:o}),!0}}),this.moveCanvas=function(e){var t=0,i=0,r=e.speed/Math.min(Math.sqrt(n.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":i=r;break;case"right":t=-r;break;case"down":i=-r}n.scroll({dx:t,dy:i})}}ea.$inject=["config.keyboardMove","keyboard","canvas"];var ta={__depends__:[Qo],__init__:["keyboardMove"],keyboardMove:["type",ea]},na=/^djs-cursor-.*$/;function ia(e){var t=U(document.body);t.removeMatching(na),e&&t.add("djs-cursor-"+e)}function ra(){ia(null)}var oa=5e3;function aa(e,t){function n(){return!1}return t=t||"element.click",e.once(t,oa,n),function(){e.off(t,n)}}function sa(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function ca(e,t){return{x:e.x-t.x,y:e.y-t.y}}var pa=15;function la(e,t){var n;function i(i){var r,o=n.start,a=yo(i),s=ca(a,o);(!n.dragging&&(r=s,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>pa)&&(n.dragging=!0,aa(e),ia("grab")),n.dragging)&&(s=ca(a,n.last||n.start),t.scroll({dx:s.x,dy:s.y}),n.last=a);i.preventDefault()}function r(e){ie.unbind(document,"mousemove",i),ie.unbind(document,"mouseup",r),n=null,ra()}e.on("element.mousedown",500,function(e){return function(e){if(J(e.target,".djs-draggable"))return;if(e.button||e.ctrlKey||e.shiftKey||e.altKey)return;return n={start:yo(e)},ie.bind(document,"mousemove",i),ie.bind(document,"mouseup",r),!0}(e.originalEvent)})}la.$inject=["eventBus","canvas"];var ua={__init__:["moveCanvas"],moveCanvas:["type",la]};function ha(e){return Math.log(e)/Math.log(10)}function da(e,t){var n=ha(e.min),i=ha(e.max);return(Math.abs(n)+Math.abs(i))/t}var fa=Math.sign||function(e){return e>=0?1:-1},ma={min:.2,max:4},ya=.75;function va(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=j(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||ya;var i=this;t.on("canvas.init",function(t){i._init(!1!==e.enabled)})}va.$inject=["config.zoomScroll","eventBus","canvas"],va.prototype.scroll=function(e){this._canvas.scroll(e)},va.prototype.reset=function(){this._canvas.zoom("fit-viewport")},va.prototype.zoom=function(e,t){var n=da(ma,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},va.prototype._handleWheel=function(e){if(!J(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*fa(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},va.prototype.stepZoom=function(e,t){var n=da(ma,10);this._zoom(e,t,n)},va.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ha(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s,c,p=Math.pow(10,a);i.zoom((s=ma,c=p,Math.max(s.min,Math.min(s.max,c))),t)},va.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&ie[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},va.prototype._init=function(e){this.toggle(e)};var ga={__init__:["zoomScroll"],zoomScroll:["type",va]};function ba(e){Vo.call(this,e)}n(ba,Vo),ba.prototype._navigationModules=[ta,ua,ga],ba.prototype._modules=[].concat(ba.prototype._modules,ba.prototype._navigationModules);var xa=t(function(e){
29/*! Hammer.JS - v2.0.7 - 2016-04-22
30 * http://hammerjs.github.io/
31 *
32 * Copyright (c) 2016 Jorik Tangelder;
33 * Licensed under the MIT license */
34!function(t,n,i,r){var o,a=["","webkit","Moz","MS","ms","o"],s=n.createElement("div"),c="function",p=Math.round,l=Math.abs,u=Date.now;function h(e,t,n){return setTimeout(b(e,n),t)}function d(e,t,n){return!!Array.isArray(e)&&(f(e,n[t],n),!0)}function f(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==r)for(i=0;i<e.length;)t.call(n,e[i],i,e),i++;else for(i in e)e.hasOwnProperty(i)&&t.call(n,e[i],i,e)}function m(e,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=t.console&&(t.console.warn||t.console.log);return o&&o.call(t.console,r,i),e.apply(this,arguments)}}o="function"!=typeof Object.assign?function(e){if(e===r||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var i=arguments[n];if(i!==r&&null!==i)for(var o in i)i.hasOwnProperty(o)&&(t[o]=i[o])}return t}:Object.assign;var y=m(function(e,t,n){for(var i=Object.keys(t),o=0;o<i.length;)(!n||n&&e[i[o]]===r)&&(e[i[o]]=t[i[o]]),o++;return e},"extend","Use `assign`."),v=m(function(e,t){return y(e,t,!0)},"merge","Use `assign`.");function g(e,t,n){var i,r=t.prototype;(i=e.prototype=Object.create(r)).constructor=e,i._super=r,n&&o(i,n)}function b(e,t){return function(){return e.apply(t,arguments)}}function x(e,t){return typeof e==c?e.apply(t&&t[0]||r,t):e}function _(e,t){return e===r?t:e}function E(e,t,n){f(T(t),function(t){e.addEventListener(t,n,!1)})}function w(e,t,n){f(T(t),function(t){e.removeEventListener(t,n,!1)})}function S(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function C(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function R(e,t,n){if(e.indexOf&&!n)return e.indexOf(t);for(var i=0;i<e.length;){if(n&&e[i][n]==t||!n&&e[i]===t)return i;i++}return-1}function A(e){return Array.prototype.slice.call(e,0)}function k(e,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];R(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function P(e,t){for(var n,i,o=t[0].toUpperCase()+t.slice(1),s=0;s<a.length;){if((i=(n=a[s])?n+o:t)in e)return i;s++}return r}var M=1;function D(e){var n=e.ownerDocument||e;return n.defaultView||n.parentWindow||t}var B="ontouchstart"in t,N=P(t,"PointerEvent")!==r,O=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),j=25,L=1,I=2,z=4,F=8,$=1,H=2,G=4,W=8,V=16,U=H|G,q=W|V,K=U|q,Y=["x","y"],X=["clientX","clientY"];function Z(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){x(e.options.enable,[e])&&n.handler(t)},this.init()}function Q(e,t,n){var i=n.pointers.length,o=n.changedPointers.length,a=t&L&&i-o==0,s=t&(z|F)&&i-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,o=i.length;n.firstInput||(n.firstInput=J(t));o>1&&!n.firstMultiple?n.firstMultiple=J(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,p=t.center=ee(i);t.timeStamp=u(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=re(c,p),t.distance=ie(c,p),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==L&&o.eventType!==z||(r=e.prevDelta={x:o.deltaX||0,y:o.deltaY||0},i=e.offsetDelta={x:n.x,y:n.y});t.deltaX=r.x+(n.x-i.x),t.deltaY=r.y+(n.y-i.y)}(n,t),t.offsetDirection=ne(t.deltaX,t.deltaY);var h=te(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=l(h.x)>l(h.y)?h.x:h.y,t.scale=s?(d=s.pointers,f=i,ie(f[0],f[1],X)/ie(d[0],d[1],X)):1,t.rotation=s?function(e,t){return re(t[1],t[0],X)+re(e[1],e[0],X)}(s.pointers,i):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=F&&(c>j||s.velocity===r)){var p=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,h=te(c,p,u);i=h.x,o=h.y,n=l(h.x)>l(h.y)?h.x:h.y,a=ne(p,u),e.lastInterval=t}else n=s.velocity,i=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=i,t.velocityY=o,t.direction=a}(n,t);var d,f;var m=e.element;S(t.srcEvent.target,m)&&(m=t.srcEvent.target);t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function J(e){for(var t=[],n=0;n<e.pointers.length;)t[n]={clientX:p(e.pointers[n].clientX),clientY:p(e.pointers[n].clientY)},n++;return{timeStamp:u(),pointers:t,center:ee(t),deltaX:e.deltaX,deltaY:e.deltaY}}function ee(e){var t=e.length;if(1===t)return{x:p(e[0].clientX),y:p(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:p(n/t),y:p(i/t)}}function te(e,t,n){return{x:t/e||0,y:n/e||0}}function ne(e,t){return e===t?$:l(e)>=l(t)?e<0?H:G:t<0?W:V}function ie(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function re(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}Z.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(D(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&w(this.element,this.evEl,this.domHandler),this.evTarget&&w(this.target,this.evTarget,this.domHandler),this.evWin&&w(D(this.element),this.evWin,this.domHandler)}};var oe={mousedown:L,mousemove:I,mouseup:z},ae="mousedown",se="mousemove mouseup";function ce(){this.evEl=ae,this.evWin=se,this.pressed=!1,Z.apply(this,arguments)}g(ce,Z,{handler:function(e){var t=oe[e.type];t&L&&0===e.button&&(this.pressed=!0),t&I&&1!==e.which&&(t=z),this.pressed&&(t&z&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var pe={pointerdown:L,pointermove:I,pointerup:z,pointercancel:F,pointerout:F},le={2:"touch",3:"pen",4:"mouse",5:"kinect"},ue="pointerdown",he="pointermove pointerup pointercancel";function de(){this.evEl=ue,this.evWin=he,Z.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}t.MSPointerEvent&&!t.PointerEvent&&(ue="MSPointerDown",he="MSPointerMove MSPointerUp MSPointerCancel"),g(de,Z,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=pe[i],o=le[e.pointerType]||e.pointerType,a="touch"==o,s=R(t,e.pointerId,"pointerId");r&L&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(z|F)&&(n=!0),s<0||(t[s]=e,this.callback(this.manager,r,{pointers:t,changedPointers:[e],pointerType:o,srcEvent:e}),n&&t.splice(s,1))}});var fe={touchstart:L,touchmove:I,touchend:z,touchcancel:F},me="touchstart",ye="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=me,this.evWin=ye,this.started=!1,Z.apply(this,arguments)}g(ve,Z,{handler:function(e){var t=fe[e.type];if(t===L&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(z|F)&&(n=k(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(z|F)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}}});var ge={touchstart:L,touchmove:I,touchend:z,touchcancel:F},be="touchstart touchmove touchend touchcancel";function xe(){this.evTarget=be,this.targetIds={},Z.apply(this,arguments)}g(xe,Z,{handler:function(e){var t=ge[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(L|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return S(e.target,c)}),t===L)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(z|F)&&delete i[a[r].identifier],r++;if(!s.length)return;return[k(o.concat(s),"identifier",!0),s]}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}});var _e=2500,Ee=25;function we(){Z.apply(this,arguments);var e=b(this.handler,this);this.touch=new xe(this.manager,e),this.mouse=new ce(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function Se(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)},_e)}}g(we,Z,{handler:function(e,t,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,Se.call(this,t)):e&(z|F)&&Se.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Ee&&a<=Ee)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Ce=P(s.style,"touchAction"),Te=Ce!==r,Re="auto",Ae="manipulation",ke="none",Pe="pan-x",Me="pan-y",De=function(){if(!Te)return!1;var e={},n=t.CSS&&t.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){e[i]=!n||t.CSS.supports("touch-action",i)}),e}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){"compute"==e&&(e=this.compute()),Te&&this.manager.element.style&&De[e]&&(this.manager.element.style[Ce]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return f(this.manager.recognizers,function(t){x(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(e){if(C(e,ke))return ke;var t=C(e,Pe),n=C(e,Me);if(t&&n)return ke;if(t||n)return t?Pe:Me;if(C(e,Ae))return Ae;return Re}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=C(i,ke)&&!De[ke],o=C(i,Me)&&!De[Me],a=C(i,Pe)&&!De[Pe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&U||a&&n&q?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ne=1,Oe=2,je=4,Le=8,Ie=Le,ze=16;function Fe(e){this.options=o({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=_(this.options.enable,!0),this.state=Ne,this.simultaneous={},this.requireFail=[]}function $e(e){return e&ze?"cancel":e&Le?"end":e&je?"move":e&Oe?"start":""}function He(e){return e==V?"down":e==W?"up":e==H?"left":e==G?"right":""}function Ge(e,t){var n=t.manager;return n?n.get(e):e}function We(){Fe.apply(this,arguments)}function Ve(){We.apply(this,arguments),this.pX=null,this.pY=null}function Ue(){We.apply(this,arguments)}function qe(){Fe.apply(this,arguments),this._timer=null,this._input=null}function Ke(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Xe(){Fe.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Ze(e,t){return(t=t||{}).recognizers=_(t.recognizers,Ze.defaults.preset),new Qe(e,t)}Fe.prototype={defaults:{},set:function(e){return o(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(d(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ge(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return d(e,"dropRecognizeWith",this)?this:(e=Ge(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(d(e,"requireFailure",this))return this;var t=this.requireFail;return-1===R(t,e=Ge(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(d(e,"dropRequireFailure",this))return this;e=Ge(e,this);var t=R(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<Le&&i(t.options.event+$e(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=Le&&i(t.options.event+$e(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Ne)))return!1;e++}return!0},recognize:function(e){var t=o({},e);if(!x(this.options.enable,[this,t]))return this.reset(),void(this.state=32);this.state&(Ie|ze|32)&&(this.state=Ne),this.state=this.process(t),this.state&(Oe|je|Le|ze)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},g(We,Fe,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(Oe|je),r=this.attrTest(e);return i&&(n&F||!r)?t|ze:i||r?n&z?t|Le:t&Oe?t|je:Oe:32}}),g(Ve,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:K},getTouchAction:function(){var e=this.options.direction,t=[];return e&U&&t.push(Me),e&q&&t.push(Pe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&U?(r=0===o?$:o<0?H:G,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?$:a<0?W:V,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&Oe||!(this.state&Oe)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=He(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),g(Ue,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&Oe)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),g(qe,Fe,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Re]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime>t.time;if(this._input=e,!i||!n||e.eventType&(z|F)&&!r)this.reset();else if(e.eventType&L)this.reset(),this._timer=h(function(){this.state=Ie,this.tryEmit()},t.time,this);else if(e.eventType&z)return Ie;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Ie&&(e&&e.eventType&z?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=u(),this.manager.emit(this.options.event,this._input)))}}),g(Ke,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[ke]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&Oe)}}),g(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:U|q,pointers:1},getTouchAction:function(){return Ve.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(U|q)?t=e.overallVelocity:n&U?t=e.overallVelocityX:n&q&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&l(t)>this.options.velocity&&e.eventType&z},emit:function(e){var t=He(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),g(Xe,Fe,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&L&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=z)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ie(this.pCenter,e.center)<t.posThreshold;if(this.pTime=e.timeStamp,this.pCenter=e.center,a&&o?this.count+=1:this.count=1,this._input=e,0===this.count%t.taps)return this.hasRequireFailures()?(this._timer=h(function(){this.state=Ie,this.tryEmit()},t.interval,this),Oe):Ie}return 32},failTimeout:function(){return this._timer=h(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Ie&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Ze.VERSION="2.0.7",Ze.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[Ke,{enable:!1}],[Ue,{enable:!1},["rotate"]],[Ye,{direction:U}],[Ve,{direction:U},["swipe"]],[Xe],[Xe,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Qe(e,t){var n;this.options=o({},Ze.defaults,t||{}),this.options.inputTarget=this.options.inputTarget||e,this.handlers={},this.session={},this.recognizers=[],this.oldCssProps={},this.element=e,this.input=new((n=this).options.inputClass||(N?de:O?xe:B?we:ce))(n,Q),this.touchAction=new Be(this,this.options.touchAction),Je(this,!0),f(this.options.recognizers,function(e){var t=this.add(new e[0](e[1]));e[2]&&t.recognizeWith(e[2]),e[3]&&t.requireFailure(e[3])},this)}function Je(e,t){var n,i=e.element;i.style&&(f(e.options.cssProps,function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""}),t||(e.oldCssProps={}))}Qe.prototype={set:function(e){return o(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Ie)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(Oe|je|Le)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof Fe)return e;for(var t=this.recognizers,n=0;n<t.length;n++)if(t[n].options.event==e)return t[n];return null},add:function(e){if(d(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(d(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=R(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==r&&t!==r){var n=this.handlers;return f(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==r){var n=this.handlers;return f(T(e),function(e){t?n[e]&&n[e].splice(R(n[e],t),1):delete n[e]}),this}},emit:function(e,t){this.options.domEvents&&function(e,t){var i=n.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=t,t.target.dispatchEvent(i)}(e,t);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](t),r++}},destroy:function(){this.element&&Je(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},o(Ze,{INPUT_START:L,INPUT_MOVE:I,INPUT_END:z,INPUT_CANCEL:F,STATE_POSSIBLE:Ne,STATE_BEGAN:Oe,STATE_CHANGED:je,STATE_ENDED:Le,STATE_RECOGNIZED:Ie,STATE_CANCELLED:ze,STATE_FAILED:32,DIRECTION_NONE:$,DIRECTION_LEFT:H,DIRECTION_RIGHT:G,DIRECTION_UP:W,DIRECTION_DOWN:V,DIRECTION_HORIZONTAL:U,DIRECTION_VERTICAL:q,DIRECTION_ALL:K,Manager:Qe,Input:Z,TouchAction:Be,TouchInput:xe,MouseInput:ce,PointerEventInput:de,TouchMouseInput:we,SingleTouchInput:ve,Recognizer:Fe,AttrRecognizer:We,Tap:Xe,Pan:Ve,Swipe:Ye,Pinch:Ue,Rotate:Ke,Press:qe,on:E,off:w,each:f,merge:v,extend:y,assign:o,inherit:g,bindFn:b,prefixed:P}),(void 0!==t?t:"undefined"!=typeof self?self:{}).Hammer=Ze,"function"==typeof r&&r.amd?r(function(){return Ze}):e.exports?e.exports=Ze:t.Hammer=Ze}(window,document)}),_a=.2,Ea=4,wa=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function Sa(e,t){return t.get(e,!1)}function Ca(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function Ta(e){function t(t){setTimeout(function(){g(wa,function(t){ie.unbind(e,t,Ca,!0)})},500)}ie.bind(e,"touchstart",function(t){g(wa,function(t){ie.bind(e,t,Ca,!0)})},!0),ie.bind(e,"touchend",t,!0),ie.bind(e,"touchcancel",t,!0);var n=new xa.Manager(e,{inputClass:xa.TouchInput,recognizers:[]}),i=new xa.Tap,r=new xa.Pan({threshold:10}),o=new xa.Press,a=new xa.Pinch,s=new xa.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout(function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null},0))},n.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&n.reset(!0)}),n}function Ra(e,t,n,i,r){var o,a=Sa("dragging",e),s=Sa("move",e),c=Sa("contextPad",e),p=Sa("palette",e);function l(e){return function(t){r.fire(e,t)}}function u(e){return J(e,"svg, .djs-element",!0)}function h(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=Ta(e)).on("doubletap",l("element.dblclick")),o.on("tap",l("element.click")),o.on("panstart",n),o.on("press",n),o.on("pinchstart",function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(_a,Math.min(Ea,r*n));t.zoom(o,i),Ca(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)})}a&&n.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=yo(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}}),c&&n.on("contextPad.create",function(e){var t=Ta(e.pad.html);t.on("panstart",function(e){c.trigger("dragstart",e,!0)}),t.on("press",function(e){c.trigger("dragstart",e,!0)}),t.on("tap",function(e){c.trigger("click",e)})}),p&&n.on("palette.create",function(e){var t=Ta(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),n.on("canvas.init",function(e){h(e.svg)})}function Aa(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}Ra.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],Aa.$inject=["canvas","eventBus"],Aa.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Be("rect");xe(n,{x:-1e4,y:1e4,width:10,height:10}),xe(n,t),ye(e,n);var i=Be("rect");xe(i,{x:1e4,y:1e4,width:10,height:10}),xe(i,t),ye(e,i)};var ka={__depends__:[{__depends__:[Eo],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",Ra],touchFix:["type",Aa]}]};function Pa(e){return e&&e[e.length-1]}function Ma(e){return e.y}function Da(e){return e.x}var Ba={left:Da,center:Da,right:function(e){return e.x+e.width},top:Ma,middle:Ma,bottom:function(e){return e.y+e.height}};function Na(e){this._modeling=e}Na.$inject=["modeling"],Na.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Na.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Na.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=Pa(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(g(t,function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}}),n=k(p,function(e){return e.elements.length>1&&(l=!0),e.elements.length}),l)return c[e]=Pa(n).center,c;i=t[0],r=Pa(t=k(t,function(e){return e[a]+e[s]})),c[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return c},Na.prototype.trigger=function(e,t){var n=this._modeling,i=k(v(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),Ba[t]),r=this._alignmentPosition(t,i);n.alignElements(i,r)};var Oa={__init__:["alignElements"],alignElements:["type",Na]};function ja(e,t){return E(t,function(t){return Ai(e,t)})}function La(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(ja(e,t))return e;return null}var Ia=50,za=250,Fa=10;function $a(e,t){return Ai(t,"bpmn:TextAnnotation")?function(e,t){var n=to(e),i={x:n.right+t.width/2,y:n.top-50-t.height/2};return Ga(e,t,i,{y:{margin:-30,rowSize:20}})}(e,t):ja(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t){var n=to(e),i={x:n.right-10+t.width/2,y:n.bottom+40+t.width/2};return Ga(e,t,i,{x:{margin:30,rowSize:30}})}(e,t):Ai(t,"bpmn:FlowNode")?function(e,t){var n=to(e),i=io(e),r=function(e,t){var n=to(e);function i(e){return Ai(e,"bpmn:SequenceFlow")}var r=x([].concat(qa(e,i).map((a=5,function(e){return{shape:e,weight:a,distanceTo:function(e){var t=to(e);return t.left-n.right}}})),Ua(e,i).map(function(e){return function(t){return{shape:t,weight:e,distanceTo:function(e){var t=to(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),o=x(r,function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||n>za?e:(r=e[String(n)]=e[String(n)]||{value:n,count:0},i=r.count+=1*a,(!c||c.count<i)&&(e.fav=r),e)},{});var a;return o.fav?o.fav.value:Ia}(e),o="left",a=80,s=30;Ai(e,"bpmn:BoundaryEvent")&&-1!==(o=ro(e,e.host,-25)).indexOf("top")&&(s*=-1);var c={x:n.right+r+t.width/2,y:i.y+(p=o,-1!=p.indexOf("top")?-1*a:-1!=p.indexOf("bottom")?a:0)};var p;return Ga(e,t,c,{y:{margin:s,rowSize:a}})}(e,t):function(e,t){var n=to(e),i=io(e);return{x:n.right+Ia+t.width/2,y:i.y}}(e,t)}function Ha(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return y(function(e,t){var n=Va(e);return e.host&&(n=n.concat(Va(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(Va(t))},[]))),n}(e),function(e){return e!==n&&"intersect"===ro(e,i,Fa)})}function Ga(e,t,n,i){function r(e){var r={x:n.x,y:n.y};return["x","y"].forEach(function(a){var s=i[a];if(s){var c="x"===a?"width":"height",p=s.margin,l=s.rowSize;r[a]=p<0?Math.min(e[a]+p-t[c]/2,n[a]-l+p):Math.max(o[a]+o[c]+p+t[c]/2,n[a]+l+p)}}),r}for(var o;o=Ha(e,n,t);)n=r(o);return n}function Wa(){return!0}function Va(e,t){return[].concat(qa(e,t),Ua(e,t))}function Ua(e,t){return t||(t=Wa),e.incoming.filter(t).map(function(e){return e.source})}function qa(e,t){return t||(t=Wa),e.outgoing.filter(t).map(function(e){return e.target})}function Ka(e,t){function n(t,n){return e.fire(t,n)}this.append=function(e,i){var r=n("autoPlace",{source:e,shape:i});r||(r=$a(e,i));var o=t.appendShape(e,i,r,e.parent);return n("autoPlace.end",{shape:o}),o}}function Ya(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}Ka.$inject=["eventBus","modeling"],Ya.$inject=["eventBus","selection"];var Xa={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Ka],autoPlaceSelectionBehavior:["type",Ya]};function Za(e){this._eventBus=e}Za.$inject=["eventBus"],Za.prototype.on=function(e,t,n,i,r,o){if((d(t)||h(t))&&(o=r,r=i,i=n,n=t,t=null),d(n)&&(o=r,r=i,i=n,n=1e3),u(r)&&(o=r,r=!1),!d(i))throw new Error("handlerFn must be a function");l(e)||(e=[e]);var a=this._eventBus;g(e,function(e){var s=["commandStack",e,t].filter(function(e){return e}).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)})};function Qa(e,t,n,i){Za.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints||{},i=t.shape,o=t.parent||t.newParent;!1!==n.autoResize&&r._expand([i],o)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=o(C(t.closure.topLevel)),i=t.hints,a=!i||i.autoResize;!1!==a&&g(T(n,function(e){return e.parent.id}),function(e,t){l(a)&&(e=e.filter(function(e){return y(a,P({id:e.id}))})),r._expand(e,t)})}),this.postExecuted(["shape.toggleCollapse"],function(e){var t=e.context,n=t.hints,i=t.shape;n&&!1===n.autoResize||i.collapsed||r._expand(i.children||[],i)}),this.postExecuted(["shape.resize"],function(e){var t=e.context,n=t.hints,i=t.shape,o=i.parent;n&&!1===n.autoResize||o&&r._expand([i],o)})}function Ja(e){e.invoke(Qa,this)}function es(e){Za.call(this,e),this.init()}function ts(e){es.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}function ns(e,t){ts.call(this,e),this._modeling=t}g(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(e){Za.prototype[e]=function(t,n,i,r,o){(d(t)||h(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}}),Qa.$inject=["eventBus","elementRegistry","modeling","rules"],n(Qa,Za),Qa.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=to(ht(e)),o=to(t),a={};return r.top-o.top<i.top&&(a.top=r.top-n.top),r.left-o.left<i.left&&(a.left=r.left-n.left),o.right-r.right<i.right&&(a.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(a.bottom=r.bottom+n.bottom),no(I({},o,a))},Qa.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var i=function(e,t){var n="";e=to(e),t=to(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}(z(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},Qa.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Qa.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Qa.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Ja.$inject=["injector"],n(Ja,Qa),Ja.prototype.resize=function(e,t,n){Ai(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},es.$inject=["eventBus"],n(es,Za),es.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){i.canExecute(e,t,function(e,t,i){return n(e)},!0)})},es.prototype.init=function(){},ts.$inject=["eventBus"],n(ts,es),ts.prototype.canResize=function(e,t){return!1},n(ns,ts),ns.$inject=["eventBus","modeling"],ns.prototype.canResize=function(e,t){if(!Ai(t,"bpmn:Participant")&&!Ai(t,"bpmn:Lane")&&!Ai(t,"bpmn:SubProcess"))return!1;var n=!0;return g(e,function(e){(Ai(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var is={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Ja],bpmnAutoResizeProvider:["type",ns]},rs=Math.round,os="djs-drag-active";function as(e){e.preventDefault()}function ss(e,t,n){var i,r={threshold:5,trapClick:!0};function o(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||i;var r=e.createEvent(I({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function s(e,r){var s,c=i.payload,p=i.displacement,l=i.globalStart,u=yo(e),h=ca(u,l),d=i.localStart,m=o(u),y=ca(m,d);if(!i.active&&(r||(s=h,Math.sqrt(Math.pow(s.x,2)+Math.pow(s.y,2))>i.threshold))){if(I(c,{x:rs(d.x+p.x),y:rs(d.y+p.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return f();i.active=!0,i.keepSelection||(c.previousSelection=n.get(),n.select(null)),i.cursor&&ia(i.cursor),t.addMarker(t.getRootElement(),os)}mo(e),i.active&&(I(c,{x:rs(m.x+p.x),y:rs(m.y+p.y),dx:rs(y.x),dy:rs(y.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,mo(e)),t=a("end")),!1===t&&a("rejected"),a("ended",m(!0!==t))}function p(e){27===e.which&&(as(e),f())}function l(t){var n;i.active&&(n=aa(e),setTimeout(n,400),as(t)),c(t)}function u(e){s(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function f(e){var t;if(i){var n=i.active;n&&a("cancel"),t=m(e),n&&a("canceled",t)}}function m(r){var o,m;a("cleanup"),ra(),m=i.trapClick?l:c,ie.unbind(document,"mousemove",s),ie.unbind(document,"dragstart",as),ie.unbind(document,"selectstart",as),ie.unbind(document,"mousedown",m,!0),ie.unbind(document,"mouseup",m,!0),ie.unbind(document,"keyup",p),ie.unbind(document,"touchstart",u,!0),ie.unbind(document,"touchcancel",f,!0),ie.unbind(document,"touchmove",s,!0),ie.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",d),t.removeMarker(t.getRootElement(),os);var y=i.payload.previousSelection;return!1!==r&&y&&!n.get().length&&n.select(y),o=i,i=null,o}e.on("diagram.destroy",f),this.init=function(t,n,m,y){i&&f(!1),"string"==typeof n&&(y=m,m=n,n=null);var v,g,b,x,_,E=(y=I({},r,y||{})).data||{};x=y.trapClick?l:c,t?(v=fo(t)||t,g=yo(t),mo(t),"dragstart"===v.type&&as(v)):(v=null,g={x:0,y:0}),b=o(g),n||(n=b),_=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),i=I({prefix:m,data:E,payload:{},globalStart:g,displacement:ca(n,b),localStart:b,isTouch:_},y),y.manual||(_?(ie.bind(document,"touchstart",u,!0),ie.bind(document,"touchcancel",f,!0),ie.bind(document,"touchmove",s,!0),ie.bind(document,"touchend",c,!0)):(ie.bind(document,"mousemove",s),ie.bind(document,"dragstart",as),ie.bind(document,"selectstart",as),ie.bind(document,"mousedown",x,!0),ie.bind(document,"mouseup",x,!0)),ie.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",d)),a("init"),y.autoActivate&&s(t,!0)},this.move=s,this.hover=h,this.out=d,this.end=c,this.cancel=f,this.context=function(){return i},this.setOptions=function(e){I(r,e)}}ss.$inject=["eventBus","canvas","selection"];var cs=1500;function ps(e,t,n){var i=this;e.on("drag.start",function(r){e.once("drag.move",cs,function(e){!function(e){if(!e.hover){var r=e.originalEvent,o=i._findTargetGfx(r),a=o&&n.get(o);o&&a&&(e.stopPropagation(),t.hover({element:a,gfx:o}),t.move(r))}}(e)})}),e.on("drag.init",function(){var n,i;function r(e){n=e.hover,i=e.hoverGfx}function o(){n=null,i=null}function a(){if(n){var e=n,r=i;n=null,i=null,t.out({element:e,gfx:r})}}e.on("drag.hover",r),e.on("element.out",o),e.on("element.hover",cs,a),e.once("drag.cleanup",function(){e.off("drag.hover",r),e.off("element.out",o),e.off("element.hover",a)})}),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=yo(e),function(e){return J(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}ps.$inject=["eventBus","dragging","elementRegistry"];var ls={__init__:["hoverFix"],__depends__:[Mo],dragging:["type",ss],hoverFix:["type",ps]};function us(e,t,n){this._canvas=n,this._opts=I({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",function(e){var t=i._toBorderPoint(e);i.startScroll(t)}),t.on(["drag.cleanup"],function(){i.stopScroll()})}function hs(e,t,n){return t<e&&e<n}us.$inject=["config.autoScroll","eventBus","canvas"],us.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var a=0,s=0,c=0;c<4;c++)hs(o[c],n.scrollThresholdOut[c],n.scrollThresholdIn[c])&&(0===c?a=n.scrollStep:1==c?s=n.scrollStep:2==c?a=-n.scrollStep:3==c&&(s=-n.scrollStep));0===a&&0===s||(t.scroll({dx:a,dy:s}),this._scrolling=setTimeout(function(){i.startScroll(e)},n.scrollRepeatTimeout))},us.prototype.stopScroll=function(){clearTimeout(this._scrolling)},us.prototype.setOptions=function(e){this._opts=I({},this._opts,e)},us.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=yo(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var ds={__depends__:[ls],__init__:["autoScroll"],autoScroll:["type",us]};function fs(e){this._commandStack=e.get("commandStack",!1)}fs.$inject=["injector"],fs.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var ms={__init__:["rules"],rules:["type",fs]},ys=Math.round,vs=Math.max;var gs=10;function bs(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(fr(i,t)<=gs)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=Qr(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,gs),(n=[],e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n)),o=r[0],a=r[r.length-1];return o?o!==a?o.segment2!==a.segment2?{point:e[i=vs(o.segment2,a.segment2)-1],bendpoint:!0,index:i}:{point:{x:ys(o.x+a.x)/2,y:ys(o.y+a.y)/2},index:o.segment2}:{point:{x:ys(o.x),y:ys(o.y)},index:o.segment2}:null}(e,t)}var xs="djs-bendpoint",_s="djs-segment-dragger";function Es(e,t,n){return bs(t,function(e,t){var n,i=yo(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n))}function ws(e,t){var n=Be("g");Ce(n).add(xs),ye(e,n);var i=Be("circle");xe(i,{cx:0,cy:0,r:4}),Ce(i).add("djs-visual"),ye(n,i);var r=Be("circle");return xe(r,{cx:0,cy:0,r:10}),Ce(r).add("djs-hit"),ye(n,r),t&&Ce(n).add(t),n}function Ss(e,t,n,i){var r=Be("g");ye(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Ts("h"===n?i:r)}(t,n,i),a=Be("rect");xe(a,{x:-7,y:-1.5,width:14,height:3}),Ce(a).add("djs-visual"),ye(r,a);var s=Be("rect");return xe(s,{x:-o/2,y:-4.5,width:o,height:9}),Ce(s).add("djs-hit"),ye(r,s),Jt(r,"v"===i?90:0),r}function Cs(e,t,n){var i=Be("g"),r=br(t,n),o=vr(t,n);return ye(e,i),Ss(i,t,n,o),Ce(i).add(_s),Ce(i).add("h"===o?"horizontal":"vertical"),Qt(i,r.x,r.y),i}function Ts(e){return Math.abs(Math.round(2*e/3))}var Rs=t(function(t,n){var i;i=e,t.exports=function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape;var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.");for(var t,n=String(e),i=n.length,r=-1,o="",a=n.charCodeAt(0);++r<i;)0!=(t=n.charCodeAt(r))?o+=t>=1&&t<=31||127==t||0==r&&t>=48&&t<=57||1==r&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==r&&1==i&&45==t||!(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?"\\"+n.charAt(r):n.charAt(r):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t,t}(i)}),As={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};function ks(e){return(e=""+e)&&e.replace(/[&<>"']/g,function(e){return As[e]})}function Ps(e,t,n,i,r){function o(e,n){var o=n.waypoints,a=Es(t,o,e);if(a)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(o=br(i=t[p-1],r=t[p]),a=vr(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(a,o,function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=vr((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Ts("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a))?i.start(e,n,a.index,!a.bendpoint):r.start(e,n,a.index),!0}function a(e,t,i){ie.bind(e,t,function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()})}function s(e,n){var i=t.getLayer("overlays"),r=he('.djs-bendpoints[data-element-id="'+Rs(e.id)+'"]',i);return!r&&n&&(xe(r=Be("g"),{"data-element-id":e.id}),Ce(r).add("djs-bendpoints"),ye(i,r),a(r,"mousedown",e),a(r,"click",e),a(r,"dblclick",e)),r}function c(e,t){return he('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function p(e,t){t.waypoints.forEach(function(t,n){var i=ws(e);ye(e,i),Qt(i,t.x,t.y)}),ws(e,"floating")}function l(e,t){for(var n,i,r,o=t.waypoints,s=1;s<o.length;s++)vr(n=o[s-1],i=o[s])&&(xe(r=Cs(e,n,i),{"data-segment-idx":s}),a(r,"mousemove",t))}function u(e){var t=s(e);return t||(p(t=s(e,!0),e),l(t,e)),t}function h(e){var t=s(e);t&&(!function(e){g(de("."+_s,e),function(e){Re(e)})}(t),function(e){g(de("."+xs,e),function(e){Re(e)})}(t),l(t,e),p(t,e))}function d(e,t,n){var i,r,o=c(t.index,e),a=n[t.index-1],s=n[t.index],p=t.point,l=br(a,s),u=vr(a,s);o&&(i=function(e){return he(".djs-visual",e)}(o),r={x:p.x-l.x,y:p.y-l.y},"v"===u&&(r={x:r.y,y:r.x}),Qt(i,r.x,r.y))}e.on("connection.changed",function(e){h(e.element)}),e.on("connection.remove",function(e){var t=s(e.element);t&&Re(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Ce(t).add(e.marker):Ce(t).remove(e.marker))}),e.on("element.mousemove",function(e){var n,i,r=e.element,o=r.waypoints;if(o){if(n=s(r,!0),!(i=Es(t,o,e.originalEvent)))return;!function(e,t){var n=he(".floating",e),i=t.point;n&&Qt(n,i.x,i.y)}(n,i),i.bendpoint||d(n,i,o)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=s(t);i&&xe(i,{"data-element-id":n})}}),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=s,this.getSegmentDragger=c}Ps.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Ms="connection.updateWaypoints",Ds="connection.reconnectStart",Bs="connection.reconnectEnd",Ns=Math.round;function Os(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);this.start=function(e,t,o,a){var s,c=t.waypoints,p=n.getGraphics(t);!1!==((s={connection:t,bendpointIndex:o,insert:a,type:a||0!==o?a||o!==c.length-1?Ms:Bs:Ds}).allowed=r.allowed(s.type,s))&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:p,context:s}})},t.on("bendpoint.move.hover",function(e){var t=e.context;(t.hover=e.hover,e.hover)&&((t.allowed=r.allowed(t.type,t))&&(t.target=t.hover))}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context;t.target=null,t.allowed=!1}),t.on("bendpoint.move.end",function(e){var t,n,i=e.context,r=i.connection,s=r.waypoints,c=s.slice(),p=i.bendpointIndex,l=i.allowed,u=i.insert;if(t={x:Ns(e.x),y:Ns(e.y)},l&&i.type===Ds)o.reconnectStart(i.connection,i.target,t);else if(l&&i.type===Bs)o.reconnectEnd(i.connection,i.target,t);else{if(!1===l||i.type!==Ms)return!1;u?c.splice(p,0,t):c[p]=t,n={bendpointMove:{insert:u,bendpointIndex:p}},a&&(r.waypoints=c,r.waypoints=a.getCroppedWaypoints(r),c=r.waypoints,r.waypoints=s),o.updateWaypoints(i.connection,ao(c),n)}})}Os.$inject=["injector","eventBus","canvas","dragging","rules","modeling"];var js="connect-ok",Ls="connect-not-ok",Is="connect-hover",zs="djs-updating",Fs="djs-element-hidden",$s="connection.reconnectStart",Hs="connection.reconnectEnd",Gs=1100;function Ws(e,t,n){var i=e.get("connectionPreview",!1),r=e.get("connectionDocking",!1);t.on("bendpoint.move.start",function(e){var t=e.context,i=t.connection,r=i.waypoints,o=r.slice(),a=t.insert,s=t.bendpointIndex;t.originalWaypoints=r,a&&o.splice(s,0,{x:e.x,y:e.y}),i.waypoints=o,t.draggerGfx=ws(n.getLayer("overlays")),Ce(t.draggerGfx).add("djs-dragging"),n.addMarker(i,zs),n.addMarker(i,Fs)}),t.on("bendpoint.move.hover",function(e){var t=e.context,i=t.allowed,r=t.hover,o=t.type;if(r){if(n.addMarker(r,Is),o!==$s&&o!==Hs)return;i?(n.removeMarker(r,Ls),n.addMarker(r,js)):!1===i&&(n.removeMarker(r,js),n.addMarker(r,Ls))}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],Gs,function(e){var t=e.context.hover;t&&(n.removeMarker(t,Is),n.removeMarker(t,e.context.target?js:Ls))}),t.on("bendpoint.move.move",function(e){var t,n=e.context,o=n.type,a=e.connection,s=a.waypoints,c=s.slice(),p={x:e.x,y:e.y};i&&(t={source:a.source,target:a.target},o===$s?(t.source=n.target,t.connectionStart=p):o===Hs?(t.target=n.target,t.connectionEnd=p):(t.noCropping=!0,t.noLayout=!0,c[n.bendpointIndex]=p),r&&(a.waypoints=c,a.waypoints=r.getCroppedWaypoints(a),c=a.waypoints,a.waypoints=s),t.waypoints=ao(c),i.drawPreview(n,n.allowed,t)),Qt(n.draggerGfx,e.x,e.y)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],Gs,function(e){var t=e.context,r=t.hover,o=t.connection;o.waypoints=t.originalWaypoints,Re(t.draggerGfx),n.removeMarker(o,zs),n.removeMarker(o,Fs),r&&(n.removeMarker(r,js),n.removeMarker(r,t.target?js:Ls)),i&&i.cleanUp(t)})}Ws.$inject=["injector","eventBus","canvas"];var Vs="connect-hover",Us="djs-updating";function qs(e,t,n){return Ks(e,t,e[t]+n)}function Ks(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function Ys(e){return"x"===e?"y":"x"}function Xs(e,t,n){var i,r;return e.original?e.original:(i=io(t),Ks(e,r=Ys(n),i[r]))}function Zs(e,t,n,i,r,o){var a=e.get("connectionDocking",!1);function s(e,t){if(!a)return t;var n,i=e.waypoints;return e.waypoints=t,n=a.getCroppedWaypoints(e),e.waypoints=i,n}function c(e){r.update("connection",e.connection,e.connectionGfx)}function p(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return Ks(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],Ys(e.axis));Qt(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c,p=n.getGraphics(t),l=r-1,u=r,h=t.waypoints,d=h[l],f=h[u],m=Es(n,h,e);(a=vr(d,f))&&(s="v"===a?"x":"y",0===l&&(d=Xs(d,t.source,s)),u===h.length-1&&(f=Xs(f,t.target,s)),o={connection:t,segmentStartIndex:l,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:s,dragPosition:c=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},i.init(e,c,"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:p,context:o}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Cs(r,t.segmentStart,t.segmentEnd),Ce(t.draggerGfx).add("djs-dragging"),n.addMarker(i,Us)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,l=i.segmentStart,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),f=qs(l,h,e["d"+h]),m=qs(u,h,e["d"+h]),y=d.length,v=0;d[o]=f,d[a]=m,o<2&&(t=ro(r.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,v--):"intersect"!==t&&(d.unshift(l),v++)),a>y-3&&(n=ro(r.target,m),a===y-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=s(r,d),p(i,v,e),i.newSegmentStartIndex=o+v,c(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,n.addMarker(e.hover,Vs)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&n.removeMarker(t,Vs)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,i=t.connection;t.draggerGfx&&Re(t.draggerGfx),n.removeMarker(i,Us)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,c(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,a=function(e,t){var n=0;return{waypoints:e.filter(function(i,r){return!mr(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}),segmentOffset:n}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),c=s(n,a.waypoints),p=a.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};o.updateWaypoints(n,c,l)})}Zs.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Qs=Math.abs,Js=Math.round;function ec(e){return{x:e.x,y:e.y}}function tc(e){return{x:e.x+e.width,y:e.y+e.height}}function nc(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:Js(e.x+e.width/2),y:Js(e.y+e.height/2)}}function ic(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function rc(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function oc(e){return e.children||[]}var ac=Math.abs,sc=Math.round,cc=10;function pc(e){function t(e,t){if(l(e)){for(var n=e.length;n--;)if(ac(e[n]-t)<=cc)return e[n]}else{var i=t%(e=+e);if(i<cc)return t-i;if(i>e-cc)return t-i+e}return t}function n(e){if(e.width)return{x:sc(e.width/2+e.x),y:sc(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var i,r,o=function(e){var t=e.snapPoints,i=e.connection,r=i.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,c=e.segmentEndIndex,p=e.axis;if(t)return t;var l=[r[a-1],o,s,r[c+1]];return a<2&&l.unshift(n(i.source)),c>r.length-3&&l.unshift(n(i.target)),e.snapPoints=t={horizontal:[],vertical:[]},g(l,function(e){e&&(e=e.original||e,"y"===p&&t.horizontal.push(e.y),"x"===p&&t.vertical.push(e.x))}),t}(e.context),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));I(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r}),(c||-1!==o.vertical.indexOf(a))&&rc(e,"x",i),(p||-1!==o.horizontal.indexOf(s))&&rc(e,"y",r)}}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(e){var i,r,o=e.context,a=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},g(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(o),s=o.target,c=s&&n(s),p=e.x,l=e.y;if(a){var u=p-(i=t(c?a.vertical.concat([c.x]):a.vertical,p)),h=l-(r=t(c?a.horizontal.concat([c.y]):a.horizontal,l));I(e,{dx:e.dx-u,dy:e.dy-h,x:e.x-u,y:e.y-h}),(u||-1!==a.vertical.indexOf(p))&&rc(e,"x",i),(h||-1!==a.horizontal.indexOf(l))&&rc(e,"y",r)}})}pc.$inject=["eventBus"];var lc={__depends__:[ls,ms],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Ps],bendpointMove:["type",Os],bendpointMovePreview:["type",Ws],connectionSegmentMove:["type",Zs],bendpointSnapping:["type",pc]};function uc(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",function(e){var t=e.context,n=t.source,i=e.hover;null!==(t.canExecute=r(n,i))&&(t.target=i)}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target=null,t.canExecute=!1}),e.on("connect.end",function(e){var t=e.context,i=t.source,o=t.sourcePosition,a=t.target,s={x:e.x,y:e.y},c=t.canExecute||r(i,a);if(!c)return!1;var p=null,l={connectionStart:o,connectionEnd:s};"object"==typeof c&&(p=c),n.connect(i,a,p,l)}),this.start=function(e,n,i,r){"object"!=typeof i&&(r=i,i=io(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{source:n,sourcePosition:i}}})}}uc.$inject=["eventBus","dragging","modeling","rules"];var hc=1100,dc=900,fc="connect-ok",mc="connect-not-ok";function yc(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",function(e){var t=e.context,n=t.source,r=t.target,o=t.canExecute,a={x:e.x,y:e.y};i.drawPreview(t,o,{source:n,target:r,connectionEnd:a})}),t.on("connect.hover",dc,function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?fc:mc)}),t.on(["connect.out","connect.cleanup"],hc,function(e){var t=e.context;t.target&&n.removeMarker(t.target,t.canExecute?fc:mc)}),i&&t.on("connect.cleanup",function(e){i.cleanUp(e.context)})}yc.$inject=["injector","eventBus","canvas"];var vc={__depends__:[Mo,ms,ls],__init__:["connectPreview"],connect:["type",uc],connectPreview:["type",yc]};function gc(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}gc.$inject=["injector","canvas","graphicsFactory","elementFactory"],gc.prototype.drawPreview=function(e,t,n){n=n||{};var i,r,o,a=e.connectionPreviewGfx,s=e.getConnection,c=n.source,p=n.target,l=n.waypoints,u=n.connectionStart,h=n.connectionEnd,d=n.noLayout,f=n.noCropping,m=n.noNoop,y=this;a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Ae(a),s||(s=e.getConnection=(r=function(e,t,n){return y.getConnection(e,t,n)},o={},function(e){var t=JSON.stringify(e),n=o[t];return n||(n=o[t]=r.apply(null,arguments)),n})),t&&(i=s(t,c,p)),i?(i.waypoints=l||[],this._layouter&&!d&&(i.waypoints=this._layouter.layoutConnection(i,{source:c,target:p,connectionStart:u,connectionEnd:h})),i.waypoints&&i.waypoints.length||(i.waypoints=[c?io(c):u,p?io(p):h]),this._connectionDocking&&(c||p)&&!f&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,c,p)),this._graphicsFactory.drawConnection(a,i)):!m&&this.drawNoopPreview(a,n)},gc.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||io(n),o=t.connectionEnd||io(i),a=this.cropWaypoints(r,o,n,i);ye(e,this.createNoopConnection(a[0],a[1]))},gc.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return[e=n&&oo(o,s,!0)||e,t=i&&oo(a,s,!1)||t]},gc.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Re(e.connectionPreviewGfx)},gc.prototype.getConnection=function(e){var t=function(e){return u(e)?e:{}}(e);return this._elementFactory.createConnection(t)},gc.prototype.createConnectionPreviewGfx=function(){var e=Be("g");return xe(e,{pointerEvents:"none"}),Ce(e).add("djs-connection-preview"),ye(this._canvas.getDefaultLayer(),e),e},gc.prototype.createNoopConnection=function(e,t){var n=Be("polyline");return xe(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),xe(n,{points:[e.x,e.y,t.x,t.y]}),n};var bc={__init__:["connectionPreview"],connectionPreview:["type",gc]},xc=Math.min,_c=Math.max;function Ec(e){e.preventDefault()}function wc(e){e.stopPropagation()}function Sc(e){this.container=e.container,this.parent=ae('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=he("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=j(this.autoResize,this),this.handlePaste=j(this.handlePaste,this)}function Cc(e,t){this._eventBus=e,this._providers=[],this._textbox=new Sc({container:t.getContainer(),keyHandler:j(this._handleKey,this),resizeHandler:j(this._handleResize,this)})}Sc.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=z(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);I(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=z(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return I(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&I(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,ie.bind(o,"keydown",this.keyHandler),ie.bind(o,"mousedown",wc),ie.bind(o,"paste",this.handlePaste),i.autoResize&&ie.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Sc.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},Sc.prototype.insertText=function(e){document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Sc.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,a=r.endContainer,s=r.startOffset,c=r.endOffset,p=r.commonAncestorContainer,l=(t=p.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(p)){var u=o.textContent;o.textContent=u.substring(0,s)+e+u.substring(c),n=o,i=s+e.length}else if(o===this.content&&a===this.content){var h=document.createTextNode(e);this.content.insertBefore(h,l[s]),n=h,i=h.textContent.length}else{var d=l.indexOf(o),f=l.indexOf(a);l.forEach(function(t,n){n===d?t.textContent=o.textContent.substring(0,s)+e+a.textContent.substring(c):n>d&&n<=f&&fe(t)}),n=o,i=s+e.length}n&&void 0!==i&&setTimeout(function(){self.setSelection(n,i)})},Sc.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},Sc.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=ae('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Ec(n),wc(n);var u=xc(_c(p+n.clientX-s,i),o),h=xc(_c(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Ec(e),wc(e),ie.unbind(document,"mousemove",u,!1),ie.unbind(document,"mouseup",h,!1)};ie.bind(n,"mousedown",function(e){Ec(e),wc(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,ie.bind(document,"mousemove",u),ie.bind(document,"mouseup",h)})}I(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Sc.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ie.unbind(t,"keydown",this.keyHandler),ie.unbind(t,"mousedown",wc),ie.unbind(t,"input",this.autoResize),ie.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),fe(n)),fe(e)},Sc.prototype.getValue=function(){return this.content.innerText.trim()},Sc.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Sc.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},Cc.$inject=["eventBus","canvas"],Cc.prototype.registerProvider=function(e){this._providers.push(e)},Cc.prototype.isActive=function(){return!!this._active},Cc.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Cc.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Cc.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Cc.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},Cc.prototype.getValue=function(){return this._textbox.getValue()},Cc.prototype._handleKey=function(e){e.stopPropagation();var t=e.keyCode||e.charCode;return 27===t?(e.preventDefault(),this.cancel()):13!==t||e.shiftKey?void 0:(e.preventDefault(),this.complete())},Cc.prototype._handleResize=function(e){this._fire("resize",e)},Cc.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=y(this._providers,function(n){return(t=n.activate(e))?n:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Tc={__depends__:[Eo],__init__:["directEditing"],directEditing:["type",Cc]};function Rc(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var i=p(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:i},this._current=null,this._init()}Rc.$inject=["config.contextPad","eventBus","overlays"],Rc.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()}),e.on("elements.delete",function(e){g(e.elements,function(e){t.isOpen(e)&&t.close()})}),e.on("element.changed",function(e){var n=e.element,i=t._current;i&&i.element===n&&t.open(n,!0)})},Rc.prototype.registerProvider=function(e){this._providers.push(e)},Rc.prototype.getEntries=function(e){var t={};return g(this._providers,function(n){g(n.getContextPadEntries(e),function(e,n){t[n]=e})}),t},Rc.prototype.trigger=function(e,t,n){var i,r,o=this._current.element,a=this._current.entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();if(i=a[$(s,"data-action")].action,r=t.originalEvent||t,d(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},Rc.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Rc.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html;g(t,function(e,t){var n,r=e.group||"default",o=ae(e.html||'<div class="entry" draggable="true"></div>');$(o,"data-action",t),(n=he("[data-group="+r+"]",i))||(n=ae('<div class="group" data-group="'+r+'"></div>'),i.appendChild(n)),n.appendChild(o),e.className&&function(e,t){var n=U(e);(l(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})}(o,e.className),e.title&&$(o,"title",e.title),e.imageUrl&&o.appendChild(ae('<img src="'+e.imageUrl+'">'))}),U(i).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},Rc.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=ae('<div class="djs-context-pad"></div>'),r=I({html:i},this._overlaysConfig);oe.bind(i,".entry","click",function(e){t.trigger("click",e)}),oe.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),ie.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",r);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},Rc.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Rc.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Ac={__depends__:[Eo,Io],contextPad:["type",Rc]},kc=["marker-start","marker-mid","marker-end"],Pc=["circle","ellipse","line","path","polygon","polyline","rect"];function Mc(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i,this._clonedMarkers={};var r=this;t.on("drag.cleanup",function(){g(r._clonedMarkers,function(e){Re(e)}),r._clonedMarkers={}})}Mc.$inject=["elementRegistry","eventBus","canvas","styles"],Mc.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Mc.prototype.addDragger=function(e,t,n){var i=ke(n=n||this.getGfx(e)),r=n.getBoundingClientRect();return this._cloneMarkers(Xt(i)),xe(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ye(t,i),i},Mc.prototype.addFrame=function(e,t){var n=Be("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return ye(t,n),n},Mc.prototype._cloneMarkers=function(e){var t=this;if(e.childNodes)for(var n=0;n<e.childNodes.length;n++)t._cloneMarkers(e.childNodes[n]);(function(e){return-1!==Pc.indexOf(e.nodeName)})(e)&&kc.forEach(function(n){if(xe(e,n)){var i=function(e,t,n){return he("marker#"+(i=xe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]),n||document);var i}(e,n,t._canvas.getContainer());t._cloneMarker(e,i,n)}})},Mc.prototype._cloneMarker=function(e,t,n){var i=t.id,r=this._clonedMarkers[i];if(!r){var o=i+"-clone";(r=ke(t)).id=o,Ce(r).add("djs-dragger").add("djs-dragger-marker"),this._clonedMarkers[i]=r;var a=he("defs",this._canvas._svg);a||(a=Be("defs"),ye(this._canvas._svg,a)),ye(a,r)}xe(e,n,"url(#"+this._clonedMarkers[i].id+")")};var Dc={__init__:["previewSupport"],previewSupport:["type",Mc]},Bc="drop-ok",Nc="drop-not-ok",Oc="attach-ok",jc="new-parent";function Lc(e,t,n,i,r){function o(t,n){[Oc,Bc,Nc,jc].forEach(function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)})}n.on(["create.move","create.hover"],function(e){var t=e.context,n=t.elements,i=e.hover,a=t.source;if(!i)return t.canExecute=!1,void(t.target=null);Ic(e);var s={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i){if(!t)return!1;var o=y(e=v(e,function(e){return!e.parent}),function(e){return!zc(e)}),a=!1,s=!1,c=!1;return Fc(e)&&(a=r.allowed("shape.attach",{position:n,shape:o,target:t})),a||(c=Fc(e)?r.allowed("shape.create",{position:n,shape:o,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t})),c||a?(o&&i&&(s=r.allowed("connection.create",{source:i,target:o,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:s}):(null===c||null===a)&&null}(n,i,s,a);i&&null!==c&&(t.target=i,c&&c.attach?o(i,Oc):o(i,c?jc:Nc))}),n.on(["create.end","create.out","create.cleanup"],function(e){var t=e.hover;t&&o(t,null)}),n.on("create.end",function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,a=t.target,s=t.hints,c=t.canExecute,p=c&&c.attach,l=c&&c.connect;if(!1===c||!a)return!1;Ic(e);var u={x:e.x,y:e.y};r=l?i.appendShape(n,r,u,a,{attach:p,connection:!0===l?{}:l}):y(o=i.createElements(o,u,a,I({},s,{attach:p})),function(e){return!zc(e)}),I(t,{elements:o,shape:r}),I(e,{elements:o,shape:r})}),this.start=function(e,n,i){l(n)||(n=[n]);var r=y(n,function(e){return!zc(e)});if(r){i=I({elements:n,hints:{},shape:r},i||{}),g(n,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var o=ht(n);g(n,function(e){zc(e)&&(e.waypoints=w(e.waypoints,function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}})),I(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})}),t.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function Ic(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function zc(e){return!!e.waypoints}function Fc(e){return e&&1===e.length&&!zc(e[0])}Lc.$inject=["canvas","dragging","eventBus","modeling","rules"];var $c=750;function Hc(e,t,n,i,r){t.on("create.move",$c,function(t){var o=t.context,a=o.elements,s=o.dragGroup;s||(s=o.dragGroup=function(t){var o=Be("g");xe(o,r.cls("djs-drag-group",["no-events"])),ye(e.getDefaultLayer(),o);var a=Be("g");return t.forEach(function(e){var t;e.waypoints?(t=n._createContainer("connection",a),n.drawConnection(Xt(t),e)):(t=n._createContainer("shape",a),n.drawShape(Xt(t),e),Qt(t,e.x,e.y)),i.addDragger(e,o,t)}),o}(a)),Qt(s,t.x,t.y)}),t.on("create.cleanup",function(e){var t=e.context.dragGroup;t&&Re(t)})}Hc.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var Gc={__depends__:[ls,Dc,ms,Mo],__init__:["create","createPreview"],create:["type",Lc],createPreview:["type",Hc]};function Wc(e,t,n){var i=p(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}Wc.$inject=["config.popupMenu","eventBus","canvas"],Wc.prototype.registerProvider=function(e,t){this._providers[e]=t},Wc.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._providers[t],i=n.getEntries(e),r=n.getHeaderEntries&&n.getHeaderEntries(e),o=i.length>0,a=r&&r.length>0;return!o&&!a},Wc.prototype.open=function(e,t,n){var i=this._providers[t];if(!e)throw new Error("Element is missing");if(!i)throw new Error("Provider is not registered: "+t);if(!n)throw new Error("the position argument is missing");this.isOpen()&&this.close(),this._emit("open");var r=this._current={provider:i,className:t,element:e,position:n};i.getHeaderEntries&&(r.headerEntries=i.getHeaderEntries(e)),r.entries=i.getEntries(e),r.container=this._createContainer();var o=r.headerEntries||[],a=r.entries||[];o.length&&r.container.appendChild(this._createEntries(r.headerEntries,"djs-popup-header")),a.length&&r.container.appendChild(this._createEntries(r.entries,"djs-popup-body"));var s=this._canvas.getContainer();this._attachContainer(r.container,s,n.cursor)},Wc.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindHandlers(),fe(this._current.container),this._current.container=null)},Wc.prototype.isOpen=function(){return!!this._current.container},Wc.prototype.trigger=function(e){e.preventDefault();var t=$(e.delegateTarget||e.target,"data-id"),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},Wc.prototype._getEntry=function(e){var t=P({id:e}),n=y(this._current.entries,t)||y(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},Wc.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},Wc.prototype._createContainer=function(){var e=ae('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return I(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),U(e).add(n),e},Wc.prototype._attachContainer=function(e,t,n){var i=this;oe.bind(e,".entry","click",function(e){i.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},Wc.prototype._updateScale=function(e){var t,n,i=this._canvas.zoom(),r=this._config.scale,o=i;!0!==r&&(!1===r?(t=1,n=1):(t=r.min,n=r.max),p(t)&&i<t&&(o=t),p(n)&&i>n&&(o=n)),function(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}(e,"scale("+o+")")},Wc.prototype._assureIsInbounds=function(e,t){var n,i,r=this._canvas._container.getBoundingClientRect(),o=e.offsetLeft,a=e.offsetTop,s=e.scrollWidth,c=e.scrollHeight,p={},l=t.x-r.left,u=t.y-r.top;o+s>r.width&&(p.x=!0),a+c>r.height&&(p.y=!0),p.x&&p.y?(n=l-s+"px",i=u-c+"px"):p.x?(n=l-s+"px",i=u+"px"):p.y&&u<c?(n=l+"px",i="10px"):p.y&&(n=l+"px",i=u-c+"px"),I(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},Wc.prototype._createEntries=function(e,t){var n=ae("<div>"),i=this;return U(n).add(t),g(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},Wc.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=ae("<div>"),n=U(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),$(t,"data-id",e.id),e.label){var i=ae("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(ae('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},Wc.prototype._bindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.once("contextPad.close",n),e.once("canvas.viewbox.changing",n),e.once("commandStack.changed",n)},Wc.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var Vc={__init__:["popupMenu"],popupMenu:["type",Wc]};function Uc(){}Uc.prototype.get=function(){return this._data},Uc.prototype.set=function(e){this._data=e},Uc.prototype.clear=function(){var e=this._data;return delete this._data,e},Uc.prototype.isEmpty=function(){return!this._data};var qc={clipboard:["type",Uc]};function Kc(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",function(e){(t._svg=e.svg).addEventListener("mousemove",n)}),e.on("canvas.destroy",function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)})}Kc.$inject=["eventBus"],Kc.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,a=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,a,!1,!1,!1,!1,0,null);return n}(0,0)};var Yc={__init__:["mouse"],mouse:["type",Kc]};function Xc(e,t,n,i,r,o,a,s){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=a,this._rules=s,r.on("copyPaste.copyElement",function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id,y(i,function(e){return e===n.parent})&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),Zc(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return w(e.waypoints,function(e){return(e=Jc(e)).original&&(e.original=Jc(e.original)),e})}(n)),Qc(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),g(["x","y","width","height"],function(e){h(n[e])&&(t[e]=n[e])})}),r.on("copyPaste.pasteElements",function(e){I(e.hints,{createElementsBehavior:!1})})}function Zc(e){return!!e.waypoints}function Qc(e){return!!e.labelTarget}function Jc(e){return I({},e)}function ep(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}Xc.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],Xc.prototype.copy=function(e){var t,n;return l(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(l(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},Xc.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n={};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},Xc.prototype._paste=function(e,t,n,i){g(e,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var r=ht(e);return g(e,function(e){Zc(e)&&(e.waypoints=w(e.waypoints,function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}})),I(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})}),this._modeling.createElements(e,n,t,I({},i))},Xc.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return g(e,function(e,o){g(e=k(e,"priority"),function(e){var o,a=I({},F(e,["priority"]));return i[e.parent]?a.parent=i[e.parent]:delete a.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:a}),Zc(a)?(a.source=i[e.source],a.target=i[e.target],o=i[e.id]=t.createConnection(a),void r.push(o)):Qc(a)?(a.labelTarget=i[a.labelTarget],o=i[e.id]=t.createLabel(a),void r.push(o)):(a.host&&(a.host=i[a.host]),o=i[e.id]=t.createShape(a),void r.push(o))})}),r},Xc.prototype.createConnection=function(e){return this._elementFactory.createConnection(F(e,["id"]))},Xc.prototype.createLabel=function(e){return this._elementFactory.createLabel(F(e,["id"]))},Xc.prototype.createShape=function(e){return this._elementFactory.createShape(F(e,["id"]))},Xc.prototype.hasRelations=function(e,t){var n,i;return!(Zc(e)&&(n=y(t,P({id:e.source.id})),i=y(t,P({id:e.target.id})),!n||!i))&&!(Qc(e)&&!y(t,P({id:e.labelTarget.id})))},Xc.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=y(r,function(t){return e===t.element});n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r)).push({element:n.element,depth:t}):r.push({element:e,depth:t})}return lt(ct(e),function(e,t,n){if(!Qc(e))return g(e.labels,function(e){o(e,n)}),g([e.attachers,e.incoming,e.outgoing],function(e){e&&e.length&&g(e,function(e){g(e.labels,function(e){o(e,n)}),o(e,n)})}),o(e,n),e.children}),e=w(r,function(e){return e.element}),r=k(r=w(r,function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t}),function(e){return e.descriptor.priority}),e=w(r,function(e){return e.element}),g(r,function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?ep(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):ep(r.element,e)}),i};var tp={__depends__:[qc,Gc,Yc,ms],__init__:["copyPaste"],copyPaste:["type",Xc]};function np(e,t,n){l(n)||(n=[n]),g(n,function(n){c(e[n])||(t[n]=e[n])})}var ip=750;function rp(e,t,n){var i;t.on("copyPaste.copyElement",ip,function(e){var t=e.descriptor,n=e.element,i=t.oldBusinessObject=ki(n);if(t.type=n.type,np(i,t,"name"),t.di={},np(i.di,t.di,["fill","stroke"]),np(i.di,t,"isExpanded"),op(t))return t;i.default&&(t.default=i.default.id)}),t.on("moddleCopy.canCopyProperty",function(t){var n=t.parent,i=t.property,r=t.propertyName;if(Ai(n,"bpmn:Participant")&&Ai(i,"bpmn:Process")&&"processRef"===r)return e.create("bpmn:Process")}),t.on("copyPaste.pasteElements",function(){i={}}),t.on("copyPaste.pasteElement",function(t){var r,o,a,s=t.cache,c=t.descriptor,p=c.oldBusinessObject;op(c)?c.businessObject=ki(s[c.labelTarget]):(r=e.create(p.$type),c.businessObject=n.copyElement(p,r),function(e){var t=ki(e);e.default&&(i[e.default]={element:t,property:"default"}),i=F(i,x(i,function(n,i,r){var o=i.element,a=i.property;return r===e.id&&(o[a]=t,n.push(e.id)),n},[]))}(c),np(c,r,["isExpanded","name"]),o=c,l(a="oldBusinessObject")||(a=[a]),g(a,function(e){o[e]&&delete o[e]}))})}function op(e){return!!e.labelTarget}rp.$inject=["bpmnFactory","eventBus","moddleCopy"];var ap=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing"];function sp(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",function(e){var t=e.propertyNames;if(t&&t.length)return k(t,function(e){return"extensionElements"===e})}),e.on("moddleCopy.canCopyProperty",function(e){var t=e.parent,n=u(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===ap.indexOf(i))&&(!(i&&n&&!y(n.properties,P({name:i})))&&void 0)}),e.on("moddleCopy.canSetCopiedProperty",function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&"function"==typeof t.$instanceOf&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1})}function cp(e,t){return x(e.properties,function(e,n){return t&&n.default?e:e.concat(n.name)},[])}sp.$inject=["eventBus","bpmnFactory","moddle"],sp.prototype.copyElement=function(e,t,n){var i=this;n&&!l(n)&&(n=[n]),n=n||cp(e.$descriptor);var r=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t});return!1===r?t:(l(r)&&(n=r),g(n,function(n){var r;m(e,n)&&(r=e.get(n));var o=i.copyProperty(r,t,n);!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:parent,property:o,propertyName:n})&&p(o)&&t.set(n,o)}),t)},sp.prototype.copyProperty=function(e,t,n){var i=this,r=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n});if(!1!==r){if(r)return u(r)&&r.$type&&!r.$parent&&(r.$parent=t),r;var o=this._moddle.getPropertyDescriptor(t,n);if(!o.isId&&!o.isReference)return l(e)?x(e,function(e,o){return(r=i.copyProperty(o,t,n))?(r.$parent=t,e.concat(r)):e},[]):u(e)&&e.$type?((r=i._bpmnFactory.create(e.$type)).$parent=t,r=i.copyElement(e,r)):e}};var pp={__depends__:[tp],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",rp],moddleCopy:["type",sp]},lp=Math.round;function up(e){this._modeling=e}up.$inject=["modeling"],up.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=lp(e.x+(t.width||e.width)/2),t.y=lp(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var hp={__init__:["replace"],replace:["type",up]};var dp=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function fp(e,t,n,i,r,o){this.replaceElement=function(a,s,p){p=p||{};var u=s.type,h=a.businessObject;if(mp(h)&&"bpmn:SubProcess"===u&&function(e,t){var n=e&&m(e,"collapsed")?e.collapsed:!Pi(e);return n!==(t&&(m(t,"collapsed")||m(t,"isExpanded"))?m(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(a,s))return i.toggleCollapse(a),a;var d,f=e.create(u),y={type:u,businessObject:f},b=cp(h.$descriptor),x=cp(f.$descriptor,!0),_=(d=x,b.filter(function(e){return-1!==d.indexOf(e)}));I(f,z(s,dp));var E=v(_,function(e){return"eventDefinitions"===e?yp(a,s.eventDefinitionType):"loopCharacteristics"===e?!Mi(f):!f.hasOwnProperty(e)&&("processRef"!==e||!1!==s.isExpanded)&&"triggeredByEvent"!==e});return f=n.copyElement(h,f,E),s.eventDefinitionType&&(yp(f,s.eventDefinitionType)||(y.eventDefinitionType=s.eventDefinitionType)),Ai(h,"bpmn:Activity")&&(mp(h)?y.isExpanded=Pi(h):s&&m(s,"isExpanded")&&(y.isExpanded=s.isExpanded),Pi(h)&&!Ai(h,"bpmn:Task")&&y.isExpanded&&(y.width=a.width,y.height=a.height)),mp(h)&&!mp(f)&&(p.moveChildren=!1),Ai(h,"bpmn:Participant")&&(!0===s.isExpanded?f.processRef=e.create("bpmn:Process"):p.moveChildren=!1,y.width=a.width,y.height=t._getDefaultSize(f).height),f.name=h.name,ja(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ja(f,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(f.default=h.default),s.host&&!Ai(h,"bpmn:BoundaryEvent")&&Ai(f,"bpmn:BoundaryEvent")&&(y.host=s.host),y.di={},function(e,t,n){l(n)||(n=[n]),g(n,function(n){c(e[n])||(t[n]=e[n])})}(h.di,y.di,["fill","stroke"]),y=r.replaceElement(a,y,p),!1!==p.select&&o.select(y),y}}function mp(e){return Ai(e,"bpmn:SubProcess")}function yp(e,t){var n=ki(e);return t&&n.get("eventDefinitions").some(function(e){return Ai(e,t)})}fp.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","selection"];var vp={__depends__:[pp,hp,Mo],bpmnReplace:["type",fp]};function gp(e){return function(t){var n=t.target,i=ki(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=i.triggeredByEvent===n.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===Pi(i);return!(o&&a&&s&&c)}}var bp=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throwing",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],xp=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message Intermediate Catch Event",actionName:"replace-with-message-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Message Intermediate Throw Event",actionName:"replace-with-message-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-message",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Intermediate Catch Event",actionName:"replace-with-timer-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Intermediate Throw Event",actionName:"replace-with-escalation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-escalation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Intermediate Catch Event",actionName:"replace-with-conditional-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Link Intermediate Catch Event",actionName:"replace-with-link-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-link",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Link Intermediate Throw Event",actionName:"replace-with-link-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-link",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:LinkEventDefinition"}},{label:"Compensation Intermediate Throw Event",actionName:"replace-with-compensation-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-compensation",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal Intermediate Catch Event",actionName:"replace-with-signal-intermediate-catch",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Signal Intermediate Throw Event",actionName:"replace-with-signal-intermediate-throw",className:"bpmn-icon-intermediate-event-throw-signal",target:{type:"bpmn:IntermediateThrowEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],_p=[{label:"Start Event",actionName:"replace-with-none-start",className:"bpmn-icon-start-event-none",target:{type:"bpmn:StartEvent"}},{label:"Intermediate Throw Event",actionName:"replace-with-none-intermediate-throw",className:"bpmn-icon-intermediate-event-none",target:{type:"bpmn:IntermediateThrowEvent"}},{label:"End Event",actionName:"replace-with-none-end",className:"bpmn-icon-end-event-none",target:{type:"bpmn:EndEvent"}},{label:"Message End Event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Escalation End Event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Error End Event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel End Event",actionName:"replace-with-cancel-end",className:"bpmn-icon-end-event-cancel",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Compensation End Event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Signal End Event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Terminate End Event",actionName:"replace-with-terminate-end",className:"bpmn-icon-end-event-terminate",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:TerminateEventDefinition"}}],Ep=[{label:"Exclusive Gateway",actionName:"replace-with-exclusive-gateway",className:"bpmn-icon-gateway-xor",target:{type:"bpmn:ExclusiveGateway"}},{label:"Parallel Gateway",actionName:"replace-with-parallel-gateway",className:"bpmn-icon-gateway-parallel",target:{type:"bpmn:ParallelGateway"}},{label:"Inclusive Gateway",actionName:"replace-with-inclusive-gateway",className:"bpmn-icon-gateway-or",target:{type:"bpmn:InclusiveGateway"}},{label:"Complex Gateway",actionName:"replace-with-complex-gateway",className:"bpmn-icon-gateway-complex",target:{type:"bpmn:ComplexGateway"}},{label:"Event based Gateway",actionName:"replace-with-event-based-gateway",className:"bpmn-icon-gateway-eventbased",target:{type:"bpmn:EventBasedGateway",instantiate:!1,eventGatewayType:"Exclusive"}}],wp=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Sp=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Event Sub Process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}}],Cp=[{label:"Sub Process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}}],Tp=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"Send Task",actionName:"replace-with-send-task",className:"bpmn-icon-send",target:{type:"bpmn:SendTask"}},{label:"Receive Task",actionName:"replace-with-receive-task",className:"bpmn-icon-receive",target:{type:"bpmn:ReceiveTask"}},{label:"User Task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Manual Task",actionName:"replace-with-manual-task",className:"bpmn-icon-manual",target:{type:"bpmn:ManualTask"}},{label:"Business Rule Task",actionName:"replace-with-rule-task",className:"bpmn-icon-business-rule",target:{type:"bpmn:BusinessRuleTask"}},{label:"Service Task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{label:"Script Task",actionName:"replace-with-script-task",className:"bpmn-icon-script",target:{type:"bpmn:ScriptTask"}},{label:"Call Activity",actionName:"replace-with-call-activity",className:"bpmn-icon-call-activity",target:{type:"bpmn:CallActivity"}},{label:"Sub Process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}},{label:"Sub Process (expanded)",actionName:"replace-with-expanded-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}}],Rp=[{label:"Message Boundary Event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Boundary Event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Escalation Boundary Event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Conditional Boundary Event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Error Boundary Event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Cancel Boundary Event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition"}},{label:"Signal Boundary Event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Compensation Boundary Event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!1}},{label:"Timer Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!1}},{label:"Escalation Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!1}},{label:"Conditional Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!1}},{label:"Signal Boundary Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-boundary",className:"bpmn-icon-intermediate-event-catch-non-interrupting-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!1}}],Ap=[{label:"Message Start Event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{label:"Timer Start Event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{label:"Conditional Start Event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{label:"Signal Start Event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{label:"Error Start Event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Escalation Start Event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{label:"Compensation Start Event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{label:"Message Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-message-start",className:"bpmn-icon-start-event-non-interrupting-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!1}},{label:"Timer Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-timer-start",className:"bpmn-icon-start-event-non-interrupting-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!1}},{label:"Conditional Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-conditional-start",className:"bpmn-icon-start-event-non-interrupting-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!1}},{label:"Signal Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-signal-start",className:"bpmn-icon-start-event-non-interrupting-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!1}},{label:"Escalation Start Event (non-interrupting)",actionName:"replace-with-non-interrupting-escalation-start",className:"bpmn-icon-start-event-non-interrupting-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!1}}],kp=[{label:"Sequence Flow",actionName:"replace-with-sequence-flow",className:"bpmn-icon-connection"},{label:"Default Flow",actionName:"replace-with-default-flow",className:"bpmn-icon-default-flow"},{label:"Conditional Flow",actionName:"replace-with-conditional-flow",className:"bpmn-icon-conditional-flow"}],Pp=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function Mp(e,t,n,i,r,o){this._popupMenu=e,this._modeling=t,this._moddle=n,this._bpmnReplace=i,this._rules=r,this._translate=o,this.register()}Mp.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Mp.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Mp.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var i=gp(e);return Ai(n,"bpmn:StartEvent")&&!Mi(n.$parent)?(t=v(bp,i),this._createEntries(e,t)):Ai(n,"bpmn:Participant")?(t=v(Pp,function(e){return Pi(n)!==e.target.isExpanded}),this._createEntries(e,t)):Ai(n,"bpmn:StartEvent")&&Mi(n.$parent)?(t=v(Ap,function(t){var n=!1!==t.target.isInterrupting,r=ki(e).isInterrupting===n;return i(t)||!i(t)&&!r}),this._createEntries(e,t)):Ai(n,"bpmn:EndEvent")?(t=v(_p,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Ai(n.$parent,"bpmn:Transaction"))&&i(e)}),this._createEntries(e,t)):Ai(n,"bpmn:BoundaryEvent")?(t=v(Rp,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Ai(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,o=n.cancelActivity==r;return i(e)||!i(e)&&!o}),this._createEntries(e,t)):Ai(n,"bpmn:IntermediateCatchEvent")||Ai(n,"bpmn:IntermediateThrowEvent")?(t=v(xp,i),this._createEntries(e,t)):Ai(n,"bpmn:Gateway")?(t=v(Ep,i),this._createEntries(e,t)):Ai(n,"bpmn:Transaction")?(t=v(Sp,i),this._createEntries(e,t)):Mi(n)&&Pi(n)?(t=v(Cp,i),this._createEntries(e,t)):Ai(n,"bpmn:SubProcess")&&Pi(n)?(t=v(wp,i),this._createEntries(e,t)):Ai(n,"bpmn:AdHocSubProcess")&&!Pi(n)?(t=v(Tp,function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return gp(e)&&(!i||r)}),this._createEntries(e,t)):Ai(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,kp):Ai(n,"bpmn:FlowNode")?(t=v(Tp,i),Ai(n,"bpmn:SubProcess")&&!Pi(n)&&(t=v(t,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(e,t)):[]},Mp.prototype.getHeaderEntries=function(e){var t=[];return Ai(e,"bpmn:Activity")&&!Mi(e)&&(t=t.concat(this._getLoopEntries(e))),!Ai(e,"bpmn:SubProcess")||Ai(e,"bpmn:Transaction")||Mi(e)||t.push(this._getAdHocEntry(e)),t},Mp.prototype._createEntries=function(e,t){var n=[],i=this;return g(t,function(t){var r=i._createMenuEntry(t,e);n.push(r)}),n},Mp.prototype._createSequenceFlowEntries=function(e,t){var n=ki(e),i=[],r=this._modeling,o=this._moddle,a=this;return g(t,function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Ai(n.sourceRef,"bpmn:ExclusiveGateway")||Ai(n.sourceRef,"bpmn:InclusiveGateway")||Ai(n.sourceRef,"bpmn:ComplexGateway")||Ai(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&Ai(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}));break;default:if(Ai(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e,{conditionExpression:void 0})}));if((Ai(n.sourceRef,"bpmn:ExclusiveGateway")||Ai(n.sourceRef,"bpmn:InclusiveGateway")||Ai(n.sourceRef,"bpmn:ComplexGateway")||Ai(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:void 0})}))}}),i},Mp.prototype._createMenuEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement;return n=n||function(){return r(t,e.target)},{label:i(e.label),className:e.className,id:e.actionName,action:n}},Mp.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r;i.active?r=void 0:(r=t._moddle.create(i.options.loopCharacteristics),i.options.isSequential&&(r.isSequential=i.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=ki(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Mp.prototype._getAdHocEntry=function(e){var t=this._translate,n=Ai(ki(e),"bpmn:AdHocSubProcess"),i=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:n,action:function(t,r){return i(e,n?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var Dp={__depends__:[Vc,vp],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Mp]},Bp=Math.max,Np=Math.min,Op=20;function jp(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Lp(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return h(r)&&(i=(/top|left/.test(e)?Np:Bp)(i,r)),h(o)&&(i=(/top|left/.test(e)?Bp:Np)(i,o)),i}function Ip(e,t){return void 0!==e?e:Op}function zp(e){return!e.waypoints&&"label"!==e.type}function Fp(e,t){var n;if((n=void 0===e.length?v(e.children,zp):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=Ip(t.left),i=Ip(t.right),r=Ip(t.top),o=Ip(t.bottom)):n=i=r=o=Ip(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(ht(n),t)}var $p=Math.abs;var Hp=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function Gp(e,t){return t=t||[],e.children.filter(function(e){Ai(e,"bpmn:Lane")&&(Gp(e,t),t.push(e))}),t}function Wp(e){return e.children.filter(function(e){return Ai(e,"bpmn:Lane")})}function Vp(e){return La(e,Hp)||e}function Up(e,t){var n=Vp(e),i=Gp(n,Ai(n,"bpmn:Process")?[]:[n]),r=to(e),o=to(t),a=function(e,t){return jp(to(t),to(e))}(e,t),s=[];return i.forEach(function(t){if(t!==e){var n,i,c=0,p=a.right,l=0,u=a.left,h=to(t);a.top&&($p(h.bottom-r.top)<10&&(l=o.top-h.bottom),$p(h.top-r.top)<5&&(c=o.top-h.top)),a.bottom&&($p(h.top-r.bottom)<10&&(c=o.bottom-h.top),$p(h.bottom-r.bottom)<5&&(l=o.bottom-h.bottom)),(c||p||l||u)&&s.push({shape:t,newBounds:(n=t,i={top:c,right:p,bottom:l,left:u},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}}),s}function qp(e,t,n,i,r,o,a,s,c,p,l,u){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=a,this._create=s,this._popupMenu=c,this._canvas=p,this._rules=l,this._translate=u,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,function(e){var t=e.context.shape;if(go(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function Kp(e,t,n){var i=e.$instanceOf(t),r=!1;return g(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}qp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],qp.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,c=this._rules,p=this._autoPlace,u=this._translate,h={};if("label"===e.type)return h;var d=e.businessObject;function f(e,t){r.start(e,t)}function m(e,t,n,r){function a(t,n){var a=i.createShape(I({type:e},r));o.start(t,a,{source:n})}return"string"!=typeof n&&(r=n,n=u("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:p?function(t,n){var o=i.createShape(I({type:e},r));p.append(n,o)}:a}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(ja(d,["bpmn:Lane","bpmn:Participant"])&&Pi(d)){var v=Wp(e);I(h,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:u("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&(e.height>=120&&I(h,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:u("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&I(h,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:u("Divide into three Lanes"),action:{click:y(3)}}})),I(h,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:u("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}Ai(d,"bpmn:FlowNode")&&(Ai(d,"bpmn:EventBasedGateway")?I(h,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",u("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",u("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",u("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",u("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Kp(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?I(h,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",u("Append compensation activity"),{isForCompensation:!0})}):Ai(d,"bpmn:EndEvent")||d.isForCompensation||Kp(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Mi(d)||I(h,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",u("Append EndEvent")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",u("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",u("Append Task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",u("Append Intermediate/Boundary Event"))})),a.isEmpty(e,"bpmn-replace")||I(h,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:u("Change type"),action:{click:function(e,n){var i=I(function(e){var n=s.getContainer(),i=t.getPad(e).html,r=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=o.top-r.top;return{x:o.left-r.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}});a.open(n,"bpmn-replace",i)}}}}),ja(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:u("Connect using "+(d.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:f,dragstart:f}}}),ja(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&I(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:u("Connect using DataInputAssociation"),action:{click:f,dragstart:f}}});var g=c.allowed("elements.delete",{elements:[e]});return l(g)&&(g=g[0]===e),g&&I(h,{delete:{group:"edit",className:"bpmn-icon-trash",title:u("Remove"),action:{click:function(t){n.removeElements([e])}}}}),h};var Yp={__depends__:[Tc,Ac,Mo,vc,Gc,Dp],__init__:["contextPadProvider"],contextPadProvider:["type",qp]},Xp={horizontal:["x","width"],vertical:["y","height"]};function Zp(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return g(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),v(e,function(e){return e[n]<i+50})})}Zp.$inject=["modeling"],Zp.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Zp.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Zp.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(g(t,function(e){r=e(r,n,i)}),r):e},Zp.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return g(k(e,i),function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))}),t},Zp.prototype._setOrientation=function(e){var t=Xp[e];this._axis=t[0],this._dimension=t[1]},Zp.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Zp.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Qp={__init__:["distributeElements"],distributeElements:["type",Zp]};function Jp(e){e.registerFilter(function(e){return v(e,function(e){var t=ja(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}Jp.$inject=["distributeElements"];var el={__depends__:[Qp],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Jp]};function tl(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function nl(e,t){return new Error(e+" "+t)}tl.$inject=["eventBus","injector"],tl.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("keyboardMove",!1),p=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&i&&this.register("copy",function(){var e=i.get();o.copy(e)}),o&&this.register("paste",function(){o.paste()}),r&&this.register("stepZoom",function(e){r.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),n&&i&&s&&this.register("removeSelection",function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});!1!==r&&(t=l(r)?r:e).length&&n.removeElements(t.slice())}}),c&&this.register("moveCanvas",function(e){c.moveCanvas(e)}),p&&this.register("moveSelection",function(e){p.moveSelection(e.direction,e.accelerated)})},tl.prototype.trigger=function(e,t){if(!this._actions[e])throw nl(e,"is not a registered action");return this._actions[e](t)},tl.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);g(e,function(e,t){n._registerAction(t,e)})},tl.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw nl(e,"is already registered");this._actions[e]=t},tl.prototype.unregister=function(e){if(!this.isRegistered(e))throw nl(e,"is not a registered action");this._actions[e]=void 0},tl.prototype.getActions=function(){return Object.keys(this._actions)},tl.prototype.isRegistered=function(e){return!!this._actions[e]};var il={__init__:["editorActions"],editorActions:["type",tl]};function rl(e){e.invoke(tl,this)}n(rl,tl),rl.$inject=["injector"],rl.prototype._registerDefaultActions=function(e){tl.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1);t&&n&&i&&this._registerAction("selectElements",function(){var e=t.getRootElement(),r=n.filter(function(t){return t!==e});return i.select(r),r}),r&&this._registerAction("spaceTool",function(){r.toggle()}),o&&this._registerAction("lassoTool",function(){o.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),i&&c&&this._registerAction("distributeElements",function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)}),i&&p&&this._registerAction("alignElements",function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=v(t,function(e){return!Ai(e,"bpmn:Lane")}),p.trigger(n,r))}),i&&h&&this._registerAction("setColor",function(e){var t=i.get();t.length&&h.setColor(t,e)}),i&&l&&this._registerAction("directEditing",function(){var e=i.get();e.length&&l.activate(e[0])}),u&&this._registerAction("find",function(){u.toggle()}),t&&h&&this._registerAction("moveToOrigin",function(){var e,i,r=t.getRootElement();e=ht(i=Ai(r,"bpmn:Collaboration")?n.filter(function(e){return Ai(e.parent,"bpmn:Collaboration")}):n.filter(function(e){return e!==r&&!Ai(e.parent,"bpmn:SubProcess")})),h.moveElements(i,{x:-e.x,y:-e.y},r)})};var ol={__depends__:[il],editorActions:["type",rl]};function al(e){e.on(["create.init","shape.move.init"],function(e){var t=e.context;ja(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")})}al.$inject=["eventBus"];function sl(e,t,n){return n||(n="round"),Math[n](e/t)*t}var cl=1200,pl=800;function ll(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",pl,function(){r.setActive(i)}),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],cl,function(t){var n=t.originalEvent;if(!(!r.active||n&&Uo(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach(function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,a=o.snapLocation,s=o.snapOffset;if(s&&h(s[t]))return s[t];s||(s=o.snapOffset={});h(s[t])||(s[t]=0);if(!r)return s[t];n.get(r.id)||(ul(t)?s[t]+=r[t]+r.width/2:s[t]+=r[t]+r.height/2);if(!a)return s[t];"x"===t?/left/.test(a)?s[t]-=r.width/2:/right/.test(a)&&(s[t]+=r.width/2):/top/.test(a)?s[t]-=r.height/2:/bottom/.test(a)&&(s[t]+=r.height/2);return s[t]}(t,n,e);o&&(i.offset=o);var a=function(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.gridSnappingContext,a=o.snapConstraints;if(a&&a[t])return a[t];a||(a=o.snapConstraints={});a[t]||(a[t]={});var s=n.direction;i&&(ul(t)?(a.x.min=i.left,a.x.max=i.right):(a.y.min=i.top,a.y.max=i.bottom));var c=r.min,p=r.max;c&&(ul(t)?dl(s)?a.x.max=c.left:a.x.min=c.right:hl(s)?a.y.max=c.top:a.y.min=c.bottom);p&&(ul(t)?dl(s)?a.x.min=p.left:a.x.max=p.right:hl(s)?a.y.min=p.top:a.y.max=p.bottom);return a[t]}(t,n);a&&I(i,a),ic(t,n)||r.snapEvent(t,n,i)})}})}function ul(e){return"x"===e}function hl(e){return"n"===e.charAt(0)}function dl(e){return"w"===e.charAt(1)}function fl(e,t){Za.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;f(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}})}ll.prototype.snapEvent=function(e,t,n){rc(e,t,this.snapValue(e[t],n))},ll.prototype.getGridSpacing=function(){return 10},ll.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=sl(e+=r,10),t&&t.min&&h(n=t.min)&&(n=sl(n+r,10,"ceil"),e=Math.max(e,n)),t&&t.max&&h(i=t.max)&&(i=sl(i+r,10,"floor"),e=Math.min(e,i)),e-=r},ll.prototype.isActive=function(){return this.active},ll.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},ll.prototype.toggleActive=function(){this.setActive(!this.active)},ll.$inject=["elementRegistry","eventBus","config.gridSnapping"],fl.$inject=["eventBus","gridSnapping","modeling"],n(fl,Za),fl.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},fl.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},fl.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),I(e,o),e},fl.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),I(e,o),e};var ml=2e3;function yl(e,t){e.on(["spaceTool.move","spaceTool.end"],ml,function(e){var n=e.context;n.initialized&&("x"===n.axis?e.dx=t.snapValue(e.dx):e.dy=t.snapValue(e.dy))})}yl.$inject=["eventBus","gridSnapping"];var vl={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",fl],gridSnappingSpaceToolBehavior:["type",yl]}],__init__:["gridSnapping"],gridSnapping:["type",ll]};function gl(e,t){e.on("autoPlace",function(e){var n=e.source,i=io(n),r=e.shape,o=$a(n,r);return["x","y"].forEach(function(e){var n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],Ai(r,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-r.height/2:n.offset=-r.width/2),o[e]=t.snapValue(o[e],n))}),o})}gl.$inject=["eventBus","gridSnapping"];var bl=1750;function xl(e,t,n){t.on(["create.start","shape.move.start"],bl,function(t){var i=t.context,r=i.shape,o=e.getRootElement();Ai(r,"bpmn:Participant")&&Ai(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))})}xl.$inject=["canvas","eventBus","gridSnapping"];var _l=3e3;function El(e,t,n){Za.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],_l,function(e){var t=e.context,r=t.connection,o=t.hints||{},a=r.waypoints;o.connectionStart||o.connectionEnd||function(e){return e.length>3}(a)&&n.updateWaypoints(r,i.snapMiddleSegments(a))})}function wl(e,t,n){var i=vr(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=I({},t,r),n=I({},n,r)),[t,n]}El.$inject=["eventBus","gridSnapping","modeling"],n(El,Za),El.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=wl(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var Sl={__depends__:[vl,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingCreateParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",gl],gridSnappingCreateParticipantBehavior:["type",xl],gridSnappingLayoutConnectionBehavior:["type",El]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",al]};function Cl(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],function(e){var t=e.element,i=e.gfx;return Ai(t,"bpmn:Lane")?n.createParticipantHit(t,i):Ai(t,"bpmn:Participant")?Pi(t)?n.createParticipantHit(t,i):n.createDefaultHit(t,i):Ai(t,"bpmn:SubProcess")?Pi(t)?n.createSubProcessHit(t,i):n.createDefaultHit(t,i):void 0})}Cl.$inject=["eventBus","interactionEvents"],Cl.prototype.createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Cl.prototype.createParticipantHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:30,height:e.height}),!0},Cl.prototype.createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var Tl={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Cl]};function Rl(e){e.invoke(Zo,this)}n(Rl,Zo),Rl.$inject=["injector"],Rl.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Zo.prototype.registerBindings.call(this,e,t),n("selectElements",function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0}),n("find",function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0}),n("spaceTool",function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0}),n("lassoTool",function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0}),n("handTool",function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0}),n("globalConnectTool",function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0}),n("directEditing",function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})};var Al={__depends__:[Qo],__init__:["keyboardBindings"],keyboardBindings:["type",Rl]},kl={moveSpeed:1,moveSpeedAccelerated:10},Pl=1500,Ml={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},Dl={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function Bl(e,t,n,i){var r=this;this._config=I({},kl,e||{}),t.addListener(Pl,function(e){var n=e.keyEvent,i=Ml[n.key];if(i&&!t.isCmd(n)){var o=t.isShift(n);return r.moveSelection(i,o),!0}}),this.moveSelection=function(e,t){var r=i.get();if(r.length){var o=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Dl[e](o);n.moveElements(r,a)}}}Bl.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var Nl={__depends__:[Qo,Mo],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Bl]};function Ol(e,t,n,i){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(dt(r)+".changed",i)}),e.on("elements.changed",function(t){var n=t.elements;n.forEach(function(t){e.fire("element.changed",{element:t})}),i.updateContainments(n)}),e.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),e.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}Ol.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var jl={__init__:["changeSupport"],changeSupport:["type",Ol]};function Ll(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y;switch(t){case"nw":return{x:e.x+i,y:e.y+r,width:e.width-i,height:e.height-r};case"sw":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height+r};case"ne":return{x:e.x,y:e.y+r,width:e.width+i,height:e.height-r};case"se":return{x:e.x,y:e.y,width:e.width+i,height:e.height+r};default:throw new Error("unrecognized direction: "+t)}}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=to(e);return no({top:Lp("top",n,t),right:Lp("right",n,t),bottom:Lp("bottom",n,t),left:Lp("left",n,t)})}(n,a),e.canExecute=r.canResize(e)}e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:to(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};o(e.context,t)}),e.on("resize.end",function(e){!function(e){var t=e.shape,i=e.canExecute,r=e.newBounds;if(i){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,r=Jr(r)))return;n.resizeShape(t,r)}}(e.context)})}Ll.prototype.canResize=function(e){var t=this._rules,n=z(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ll.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=I({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");var a={x:/w/.test(r)?t.x:t.x+t.width,y:/n/.test(r)?t.y:t.y+t.height};o.init(e,a,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},Ll.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=to(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?to(i):o;return no({top:Np(o.top,a.top),left:Np(o.left,a.left),bottom:Bp(o.bottom,a.bottom),right:Bp(o.right,a.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Fp(t,e.childrenBoxPadding))},Ll.$inject=["eventBus","rules","modeling","dragging"];var Il="djs-resizing",zl="resize-not-ok",Fl=500;function $l(e,t,n){e.on("resize.move",Fl,function(e){var i,r,o,a;i=e.context,r=i.shape,o=i.newBounds,(a=i.frame)||(a=i.frame=n.addFrame(r,t.getDefaultLayer()),t.addMarker(r,Il)),o.width>5&&xe(a,{x:o.x,width:o.width}),o.height>5&&xe(a,{y:o.y,height:o.height}),i.canExecute?Ce(a).remove(zl):Ce(a).add(zl)}),e.on("resize.cleanup",function(e){var n,i;n=e.context,i=n.shape,n.frame&&Re(n.frame),t.removeMarker(i,Il)})}$l.$inject=["eventBus","canvas","previewSupport"];function Hl(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&g(t,j(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}Hl.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){vo(t)&&i.activate(t,e,n)}ie.bind(t,"mousedown",r),ie.bind(t,"touchstart",r)},Hl.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=Be("g");Ce(a).add("djs-resizer"),Ce(a).add("djs-resizer-"+e.id),Ce(a).add("djs-resizer-"+r),ye(o,a);var s=Be("rect");xe(s,{x:-7,y:-7,width:5,height:5}),Ce(s).add("djs-resizer-visual"),ye(a,s);var c=Be("rect");return xe(c,{x:-7,y:-7,width:20,height:20}),Ce(c).add("djs-resizer-hit"),ye(a,c),Zt(a,t,n,i),a},Hl.prototype.createResizer=function(e,t){var n,i=to(e);n="nw"===t?this._createResizer(e,i.left,i.top,0,t):"ne"===t?this._createResizer(e,i.right,i.top,90,t):"se"===t?this._createResizer(e,i.right,i.bottom,180,t):this._createResizer(e,i.left,i.bottom,270,t),this.makeDraggable(e,n,t)},Hl.prototype.addResizer=function(e){this._resize.canResize({shape:e})&&(this.createResizer(e,"nw"),this.createResizer(e,"ne"),this.createResizer(e,"se"),this.createResizer(e,"sw"))},Hl.prototype.removeResizers=function(){Ae(this._getResizersParent())},Hl.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Hl.$inject=["eventBus","canvas","selection","resize"];var Gl={__depends__:[ms,ls,Dc],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ll],resizePreview:["type",$l],resizeHandles:["type",Hl]};function Wl(e,t){var n=t.create("bpmn:CategoryValue"),i=t.create("bpmn:Category",{categoryValue:[n]});return xt(e.get("rootElements"),i),ki(i).$parent=e,ki(n).$parent=i,n}function Vl(e,t,n,i,r,o,a){function s(e,t){(t||ja(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Group"])||Ul(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=a,i.registerProvider(this),e.on("element.dblclick",function(e){s(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace","popupMenu.open"],function(e){i.isActive()&&i.complete()}),e.on(["commandStack.changed"],function(e){i.isActive()&&i.cancel()}),e.on("directEditing.activate",function(e){o.removeResizers()}),e.on("create.end",500,function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||s(n))}),e.on("autoPlace.end",500,function(e){s(e.shape)})}function Ul(e){return Ai(e,"bpmn:SubProcess")&&!Pi(e)}Vl.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Vl.prototype.activate=function(e){var t=Ni(e);if(void 0!==t){var n={text:t};I(n,this.getEditingBBox(e));var i={};return(ja(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Ul(e))&&I(i,{centerVertically:!0}),pr(e)&&I(i,{autoResize:!0}),Ai(e,"bpmn:TextAnnotation")&&I(i,{resizable:!0,autoResize:!0}),I(n,{options:i}),n}},Vl.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=this._textRenderer.getDefaultStyle(),p=this._textRenderer.getExternalStyle(),l=p.fontSize*s,u=p.lineHeight,h=c.fontSize*s,d=c.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ai(e,"bpmn:Lane")||function(e){return Ai(e,"bpmn:Participant")&&Pi(e)}(e))&&(I(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),I(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(ja(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return Ai(e,"bpmn:Participant")&&!Pi(e)}(e)||Ul(e))&&(I(a,{width:i.width,height:i.height}),I(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return Ai(e,"bpmn:SubProcess")&&Pi(e)}(e)&&(I(a,{width:i.width,x:i.x}),I(f,{fontSize:h+"px",lineHeight:d,paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"}));var m=90*s,y=7*s,v=4*s;if(n.labelTarget&&(I(a,{width:m,height:i.height+y+v,x:r-m/2,y:i.y-y}),I(f,{fontSize:l+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:v+"px"})),pr(n)&&!lr(n)&&!dr(n)){var g=hr(e),b=t.getAbsoluteBBox({x:g.x,y:g.y,width:0,height:0}),x=l+y+v;I(a,{width:m,height:x,x:b.x-m/2,y:b.y-x/2}),I(f,{fontSize:l+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:v+"px"})}return Ai(e,"bpmn:TextAnnotation")&&(I(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),I(f,{textAlign:"left",paddingTop:5*s+"px",paddingBottom:7*s+"px",paddingLeft:7*s+"px",paddingRight:5*s+"px",fontSize:h+"px",lineHeight:d})),{bounds:a,style:f}},Vl.prototype.update=function(e,t,n,i){var r,o,a;if((Ai(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),Ai(e,"bpmn:Group"))&&!ki(e).categoryValueRef){var s=Wl(ki(this._canvas.getRootElement()).$parent,this._bpmnFactory);ki(e).categoryValueRef=s}(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var ql="djs-element-hidden",Kl="djs-label-hidden";function Yl(e,t,n,i){var r,o,a,s=this,c=t.getDefaultLayer();e.on("directEditing.activate",function(e){var n=e.active;if(Ai(r=n.element.label||n.element,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(r),a=Be("g");var p=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),l=s.path=Be("path");xe(l,{d:p,strokeWidth:2,stroke:Xl(r)}),ye(a,l),ye(c,a),Qt(a,r.x,r.y)}Ai(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,ql):(Ai(r,"bpmn:Task")||Ai(r,"bpmn:CallActivity")||Ai(r,"bpmn:SubProcess")||Ai(r,"bpmn:Participant"))&&t.addMarker(r,Kl)}),e.on("directEditing.resize",function(e){if(Ai(r,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(r.height/o.height*(t+n),0),c=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});xe(s.path,{d:c})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,ql),t.removeMarker(r,Kl)),r=void 0,o=void 0,a&&(Re(a),a=void 0)})}function Xl(e,t){return ki(e).di.get("stroke")||t||"black"}Yl.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Zl={__depends__:[jl,Gl,Tc],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vl],labelEditingPreview:["type",Yl]},Ql=["top","bottom","left","right"],Jl=10;function eu(e,t){function n(e){if(lr(e)){var n=function(e){var t=io(e.label),n=tu(io(e),t);if(i=n,-1===Ql.indexOf(i))return;var i;var r=function(e){var t=io(e);return[].concat(e.incoming.map(function(e){return e.waypoints[e.waypoints.length-2]}),e.outgoing.map(function(e){return e.waypoints[1]})).map(function(e){return tu(t,e)})}(e);if(e.host){var o=function(e){var t,n=e.host,i=ro(io(e),n);t=i.indexOf("-")>=0?i.split("-"):[i];return Ql.filter(function(e){return-1===t.indexOf(e)})}(e);r=r.concat(o)}var a=Ql.filter(function(e){return-1===r.indexOf(e)});if(-1!==a.indexOf(n))return;return a[0]}(e);n&&function(e,n){var i,r=io(e),o=e.label,a=io(o),s=to(e);switch(n){case"top":i={x:r.x,y:s.top-Jl-o.height/2};break;case"left":i={x:s.left-Jl-o.width/2,y:r.y};break;case"bottom":i={x:r.x,y:s.bottom+Jl+o.height/2};break;case"right":i={x:s.right+Jl+o.width/2,y:r.y}}var c=ca(i,a);t.moveShape(o,c)}(e,n)}}Za.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],function(e){var t=e.context.connection,i=t.source,r=t.target;n(i),n(r)}),this.postExecuted(["label.create"],function(e){n(e.context.shape.labelTarget)})}function tu(e,t){return ro(t,e,5)}function nu(e,t,n){Za.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(Ai(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})},!0)}function iu(e,t){Za.call(this,e),this.preExecute("elements.move",function(e){var n,i,r,o,a,s=e.shapes,c=e.newHost;1===s.length&&(n=s[0],c&&ja(n,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&(r={type:"bpmn:BoundaryEvent",host:c},(i=(a=ki(n))&&a.eventDefinitions&&a.eventDefinitions[0])&&(r.eventDefinitionType=i.$type),o=t.replaceElement(n,r,{layoutConnection:!1}),e.shapes=[o]))},!0)}function ru(e,t){function n(e){return v(e.attachers,function(e){return Ai(e,"bpmn:BoundaryEvent")})}Za.call(this,e),this.postExecute("connection.create",function(e){var i=e.context.source,r=e.context.target,o=n(r);Ai(i,"bpmn:EventBasedGateway")&&Ai(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)}),this.postExecute("connection.reconnectStart",function(e){var i=e.context.oldSource,r=e.context.newSource;Ai(i,"bpmn:Gateway")&&Ai(r,"bpmn:EventBasedGateway")&&g(r.outgoing,function(e){var i=e.target,r=n(i);Ai(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)})})}function ou(e){e.invoke(Za,this),this.preExecute("shape.create",1500,function(e){var t=e.context,n=t.parent;Ai(n,"bpmn:Lane")&&(t.parent=La(n,"bpmn:Participant"))})}n(eu,Za),eu.$inject=["eventBus","modeling"],n(nu,Za),nu.$inject=["eventBus","elementFactory","bpmnRules"],iu.$inject=["eventBus","bpmnReplace"],n(iu,Za),ru.$inject=["eventBus","modeling"],n(ru,Za),ou.$inject=["injector"],n(ou,Za);var au=1500,su=2e3;function cu(e,t,n){t.on(["create.hover","create.move","create.end","shape.move.hover","shape.move.move","shape.move.end"],au,function(t){var i=t.context.shape||t.shape,r=t.hover;Ai(r,"bpmn:Lane")&&!ja(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Vp(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||Ai(i,"bpmn:Group"))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))}),t.on(["connect.hover","global-connect.hover"],au,function(t){var n=t.hover;Ai(n,"bpmn:Lane")&&(t.hover=Vp(n)||n,t.hoverGfx=e.getGraphics(t.hover))}),t.on(["bendpoint.move.hover"],au,function(t){var n=t.context.type,i=t.hover;Ai(i,"bpmn:Lane")&&/reconnect/.test(n)&&(t.hover=Vp(i)||i,t.hoverGfx=e.getGraphics(t.hover))}),t.on(["connect.start"],au,function(e){var t=e.context,n=t.source;Ai(n,"bpmn:Lane")&&(t.source=Vp(n)||n)}),t.on("shape.move.start",su,function(e){var t=e.shape;Ai(t,"bpmn:Lane")&&(e.shape=Vp(t)||t)})}function pu(e,t,n,i){Za.call(this,e),this.preExecute("shape.create",function(e){var t,r=e.shape,o=e.host,a={cancelActivity:!0};o&&Ai(r,"bpmn:IntermediateThrowEvent")&&(a.attachedToRef=o.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:i.create("bpmn:BoundaryEvent",a)},e.shape=n.createShape(t))},!0)}function lu(e,t,n){Za.call(this,e),this.preExecute("shape.create",function(e){var n=e.context.shape;if(Ai(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}})}cu.$inject=["elementRegistry","eventBus","canvas"],pu.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],n(pu,Za),lu.$inject=["eventBus","bpmnFactory","moddle"],n(lu,Za);var uu=20,hu=20,du=30,fu=2e3;function mu(e,t,n){function i(t){var i,r=t.parent,o=e.getRootElement();Ai(o,"bpmn:Collaboration")?i=o:(i=n.makeCollaboration(),t.process=r),t.parent=i}Za.call(this,t),t.on(["create.start","shape.move.start"],fu,function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(Ai(i,"bpmn:Participant")&&Ai(r,"bpmn:Process")&&r.children.length){var o=r.children.filter(function(e){return!Ai(e,"bpmn:Group")&&!dr(e)&&!function(e){return!!e.waypoints}(e)});if(o.length){var a=ht(o);I(i,function(e,t){t={width:t.width+2*uu+du,height:t.height+2*hu};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,a)),n.createConstraints=function(e,t){return{bottom:(t=to(t)).top+e.height/2-hu,left:t.right-e.width/2+uu,top:t.bottom-e.height/2+hu,right:t.left+e.width/2-uu-du}}(i,a)}}}),t.on("create.start",fu,function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function a(e){e.element=r,e.gfx=o}Ai(i,"bpmn:Participant")&&Ai(r,"bpmn:Process")&&(t.on("element.hover",fu,a),t.once("create.cleanup",function(){t.off("element.hover",a)}))}),this.preExecute("shape.create",function(e){var t=e.parent;Ai(e.shape,"bpmn:Participant")&&Ai(t,"bpmn:Process")&&i(e)},!0),this.execute("shape.create",function(e){var t=e.process,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.process,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var t=e.process,i=e.shape;if(t){var r=t.children.slice();n.moveElements(r,{x:0,y:0},i)}},!0),this.preExecute("elements.create",fu,function(e){var t,n=e.elements,r=e.parent;yu(n)&&Ai(r,"bpmn:Process")&&(i(e),t=yu(n),e.oldProcessRef=t.businessObject.processRef,t.businessObject.processRef=r.businessObject)},!0),this.revert("elements.create",function(e){var t=e.elements;e.process&&(yu(t).businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("elements.create",function(e){var t,i=e.elements,r=e.process;if(r){t=yu(i);var o=r.children.slice();n.moveElements(o,{x:0,y:0},t)}},!0)}function yu(e){return y(e,function(e){return Ai(e,"bpmn:Participant")})}mu.$inject=["canvas","eventBus","modeling"],n(mu,Za);var vu="__targetRef_placeholder";function gu(e,t){function n(e,n){var i=e.get("properties"),r=y(i,function(e){return e.name===vu});return!r&&n&&xt(i,r=t.create("bpmn:Property",{name:vu})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return y(e.get("dataInputAssociations"),function(e){return e!==n&&e.targetRef===t})}(e,i,t)||bt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}Za.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],bu(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],bu(r))}function bu(e){return function(t){if(Ai(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function xu(e){this._bpmnUpdater=e}function _u(e,t,n,i){function r(e){return e.children.filter(function(e){return Ai(e,"bpmn:DataStoreReference")&&!e.labelTarget})}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter(function(e){return Ai(e,"bpmn:Participant")})[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,newSemanticParent:o.processRef||o,newDiParent:o.di})}}Za.call(this,i),t.registerHandler("dataStore.updateContainment",xu),this.preExecute("shape.create",function(e){var t=e.context,n=t.shape;Ai(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)}),this.preExecute("elements.move",function(e){var t=e.context,n=t.shapes;n.filter(function(e){return Ai(e,"bpmn:DataStoreReference")}).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter(function(e){return!Ai(e,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(e){var t=e.context.shape,n=t.parent;Ai(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Ai(n,"bpmn:Collaboration")&&o(t)}),this.postExecute("shape.move",function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Ai(i,"bpmn:Collaboration")||Ai(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Ai(r,"bpmn:Collaboration")&&o(n,Ai(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Ai(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))}),this.postExecute("shape.delete",function(t){var n=t.context.shape,i=e.getRootElement();ja(n,["bpmn:Participant","bpmn:SubProcess"])&&Ai(i,"bpmn:Collaboration")&&r(i).filter(function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)}).forEach(function(e){o(e)})}),this.postExecute("canvas.updateRoot",function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach(function(e){Ai(i,"bpmn:Process")&&o(e,i)})})}gu.$inject=["eventBus","bpmnFactory"],n(gu,Za),xu.$inject=["bpmnUpdater"],xu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.newSemanticParent,i=e.newDiParent;e.oldSemanticParent=t.$parent,e.oldDiParent=t.di.$parent,this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},xu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.oldSemanticParent,i=e.oldDiParent;this._bpmnUpdater.updateSemanticParent(t,n),this._bpmnUpdater.updateDiParent(t.di,i)},_u.$inject=["canvas","commandStack","elementRegistry","eventBus"],n(_u,Za);var Eu=500;function wu(e,t,n){Za.call(this,e),this.postExecuted("shape.delete",Eu,function(e){var t=e.context,i=t.hints,r=t.shape,o=t.oldParent;Ai(r,"bpmn:Lane")&&(i&&i.nested||function(e,t){var i,r,o,a=Wp(t),s=[],c=[];lt(a,function(t){return t.y>e.y?c.push(t):s.push(t),t.children}),a.length&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}(r,o))})}function Su(e,t){Za.call(this,e),this.preExecute("elements.move",function(e){var n,i,r,o,a,s=e.shapes,c=e.newHost;1===s.length&&(dr(n=s[0])||c||!Ai(n,"bpmn:BoundaryEvent")||(r=(i=(a=ki(n))&&a.eventDefinitions&&a.eventDefinitions[0])?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},o=t.replaceElement(n,r,{layoutConnection:!1}),e.shapes=[o]))},!0)}function Cu(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u,h=i.waypoints,d=e.outgoing.slice(),f=e.incoming.slice(),m=bs(h,r);if(m){if(o=h.slice(0,m.index),a=h.slice(m.index+(m.bendpoint?1:0)),!o.length||!a.length)return;s=m.bendpoint?h[m.index]:r,Tu(e,o[o.length-1])||o.push(Ru(s)),Tu(e,a[0])||a.unshift(Ru(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||r),l=i),t.canConnect(e,p,i)&&(l?u=n.connect(e,p,{type:i.type,waypoints:a}):(n.reconnectStart(i,e,a||r),u=i));var y=[].concat(l&&v(f,function(e){return e.source===l.source})||[],u&&v(d,function(e){return e.source===u.source})||[]);y.length&&n.removeElements(y)}Za.call(this,e),this.preExecute("elements.move",function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a,s=(a=o,{x:Math.round(a.x+a.width/2),y:Math.round(a.y+a.height/2)}),c={x:s.x+r.x,y:s.y+r.y},p=y(n.children,function(e){return t.canInsert(i,e)&&bs(e.waypoints,c)});p&&(e.targetFlow=p,e.position=c)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)},!0),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)},!0)}function Tu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Ru(e){return I({},e)}function Au(e,t){Za.call(this,e),this.preExecuted("connection.create",function(e){var n=e.context,i=n.source,r=n.target,o=r.incoming.slice();n.hints&&!1===n.hints.createElementsBehavior||Ai(i,"bpmn:EventBasedGateway")&&r.incoming.length&&o.filter(ku).forEach(function(e){t.removeConnection(e)})}),this.preExecuted("shape.replace",function(e){var n=e.context.newShape;Ai(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(ku).map(function(e){return e.target}).reduce(function(e,t){var n=t.incoming.filter(ku);return e.concat(n)},[]).forEach(function(e){e.source!==n&&t.removeConnection(e)})})}function ku(e){return Ai(e,"bpmn:SequenceFlow")}wu.$inject=["eventBus","modeling","spaceTool"],n(wu,Za),Su.$inject=["eventBus","bpmnReplace"],n(Su,Za),n(Cu,Za),Cu.$inject=["eventBus","bpmnRules","modeling"],Au.$inject=["eventBus","modeling"],n(Au,Za);var Pu=2e3;function Mu(e,t,n,i,r,o){function a(){return ki(t.getRootElement()).$parent}function s(e){var t=ki(e).categoryValueRef;if(t){var n=t.$parent;t&&(bt(n.categoryValue,t),n&&!n.categoryValue.length&&function(e){bt(a().get("rootElements"),e)}(n))}}r.invoke(Za,this),this.executed("shape.delete",function(e){var t,i=e.context.shape;if(Ai(i,"bpmn:Group")){var r=ki(i).categoryValueRef,o=n.filter(function(e){return Ai(e,"bpmn:Group")});t=r,o.some(function(e){var n=ki(e);return n.categoryValueRef&&n.categoryValueRef===t})||s(i)}}),this.reverted("shape.delete",function(e){var t=e.context.shape;if(Ai(t,"bpmn:Group")){var n=ki(t).categoryValueRef,i=a(),r=n?n.$parent:null;xt(r.get("categoryValue"),n),xt(i.get("rootElements"),r)}}),this.execute("shape.create",function(t){var n=ki(t.context.shape);if(Ai(n,"bpmn:Group")&&!n.categoryValueRef){var i=Wl(a(),e);n.categoryValueRef=i}}),this.revert("shape.create",function(e){var t=e.context.shape;Ai(t,"bpmn:Group")&&(s(t),delete ki(t).categoryValueRef)}),i.on("moddleCopy.canCopyProperty",Pu,function(t){var n,i=t.property;if(Ai(i,"bpmn:CategoryValue"))return n=Wl(a(),e),o.copyElement(i,n)})}function Du(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function Bu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Du(e,t,n,r),s=Du(e,t,n,o);i=a&&s?Nu(a,n)>Nu(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],io(n.source)),t(i[i.length-1],i[i.length-2],io(n.target)))})}function Nu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Ou(e){Za.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(e){var n=ki(e.context.shape);ja(n,t)&&!n.di.get("isHorizontal")&&n.di.set("isHorizontal",!0)})}function ju(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Lu(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Iu(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function zu(e,t){var n=Iu(e,t);return ju({x:n.x-e.x,y:n.y-e.y})}function Fu(e,t){return ju({x:e.x-t.x,y:e.y-t.y})}Mu.$inject=["bpmnFactory","canvas","elementRegistry","eventBus","injector","moddleCopy"],n(Mu,Za),Bu.$inject=["eventBus"],Ou.$inject=["eventBus"],n(Ou,Za);var $u=Math.sqrt,Hu=Math.min,Gu=Math.max,Wu=Math.abs;function Vu(e){return Math.pow(e,2)}function Uu(e,t){return $u(Vu(e.x-t.x)+Vu(e.y-t.y))}function qu(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=$u(l),h=-p+u,d=-p-u,f={x:e.x-r*h,y:e.y-o*h};return 0===l?[f]:[f,{x:e.x-r*d,y:e.y-o*d}].filter(function(n){return function(e,t,n){return Ku(e.x,t.x,n.x)&&Ku(e.y,t.y,n.y)}(n,e,t)})}function Ku(e,t,n){return e>=Hu(t,n)-Yu&&e<=Gu(t,n)+Yu}var Yu=.1;function Xu(e,t){return Wu(e.x-t.x)<=Yu&&Wu(e.y-t.y)<=Yu}function Zu(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,f=0;for(f=0;f<t.length-1;f++){if(Xu(n=t[f],i=t[f+1])?s=[n]:(r=Uu(e,n),o=Uu(e,i),s=qu(n,i,e,Hu(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:f,bendpointIndex:Xu(n,s[0])?f:f+1}),2===s.length&&(h=s[0],d=s[1],c={type:"segment",position:a={x:(h.x+d.x)/2,y:(h.y+d.y)/2},segmentIndex:f,relativeLocation:Uu(n,a)/Uu(n,i)}),p=Uu(c.position,e),(!u||l>p)&&(u=c,l=p)}return u}(a,n),c=s.segmentIndex,p=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=l&&(c=p?r+1:r-1),r<l&&(c=r,p&&"bendpoint"!==n.type&&l-1===r&&Qu(t,l)<n.relativeLocation&&c++),c)}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l,u,h=Ju(n,c),d=Ju(t,p),f=s.position,m=function(e,t){var n=Fu(e[0],e[1]),i=Fu(e[0],t);return 0===n?0:i/n}(h,f),y=(l=d,u=Lu(h),Lu(l)-u);if("bendpoint"===s.type){var v=t.length-n.length,g=s.bendpointIndex,b=n[g];if(-1!==t.indexOf(b))return{x:r,y:o};if(0===v){var x=t[g];return{x:x.x-s.position.x,y:x.y-s.position.y}}v<0&&0!==g&&g<n.length-1&&(m=Qu(n,g))}var _,E,w=(d[1].x-d[0].x)*m+d[0].x,S=(d[1].y-d[0].y)*m+d[0].y,C=(_={x:a.x-f.x,y:a.y-f.y},(E=y)?{x:Math.cos(E)*_.x-Math.sin(E)*_.y,y:Math.sin(E)*_.x+Math.cos(E)*_.y}:_);return eo({x:r=w+C.x-a.x,y:o=S+C.y-a.y})}function Qu(e,t){var n=Fu(e[t-1],e[t]);return n/(n+Fu(e[t],e[t+1]))}function Ju(e,t){return[e[t],e[t+1]]}function eh(e,t,n){var i=sa(t),r=sa(n),o=ca(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return eo({x:r.x+a,y:r.y+s})}function th(e,t,n){var i=sa(e),r=sa(t),o=sa(n),a=ca(e,i),s=ca(i,r),c=s.x*(n.width/t.width),p=s.y*(n.height/t.height),l=o.x+c,u=o.y+p;return eo({x:l+a.x-e.x,y:u+a.y-e.y})}var nh={width:90,height:20},ih="name",rh="text";function oh(e,t,n,i){Za.call(this,e),this.postExecute("element.updateProperties",function(e){var n=e.context,r=n.element,o=n.properties;if(ih in o&&t.updateLabel(r,o[ih]),rh in o&&Ai(r,"bpmn:TextAnnotation")){var a=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[rh]||"");t.updateLabel(r,o.text,a)}}),this.postExecute(["shape.create","connection.create"],function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection,o=r.businessObject;if(pr(r)&&Ni(r)){var a=hr(r),s=i.getExternalLabelBounds(nh,Ni(r));t.createLabel(r,a,{id:o.id+"_label",businessObject:o,width:s.width,height:s.height})}}}),this.postExecute("shape.delete",function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})}),this.postExecute(["label.create"],function(e){var t,i=e.context.shape;i.labelTarget&&Ai(i.labelTarget||i,"bpmn:BaseElement")&&((t=i.businessObject.di).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")})),I(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))}),this.postExecute(["connection.layout","connection.updateWaypoints"],function(e){var n,i=e.context.connection.label;i&&(n=function(e){var t=e.context,n=t.connection,i=n.label,r=I({},t.hints),o=t.newWaypoints||n.waypoints,a=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),Zu(i,o,a,r)}(e),t.moveShape(i,n))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=ki(n);r&&pr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)}),this.postExecute("shape.resize",function(e){var n,i=e.context,r=i.shape,o=i.newBounds,a=i.oldBounds;if(lr(r)){var s=r.label,c=ah(function(e,t){if(!t.length)return;var n=function(e,t){return k(t.map(function(t){return{line:t,distance:zu(e,t)}}),"distance")[0].line}(e,t);return Iu(e,n)}(io(s),[[{x:(n=a).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),a,o);t.moveShape(s,c)}})}function ah(e,t,n){return eo(ca(eh(e,t,n),e))}n(oh,Za),oh.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];var sh="flow elements must be children of pools/participants",ch="participants cannot be pasted onto a non-empty process diagram";function ph(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,r=t.shape;Ai(t.target,"bpmn:Collaboration")&&Ai(r,"bpmn:FlowNode")&&i(e,n(sh))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,r=t.position,o=t.target;Ai(o,"bpmn:Collaboration")&&i(r,n(sh)),Ai(o,"bpmn:Process")&&i(r,n(ch),3e3)})}function lh(e,t,n,i){Za.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,a=e.target;e.parent&&(Ai(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),Ai(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),Ai(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",function(e){g(e.closure.allConnections,o)},!0),this.preExecute(["connection.reconnectStart","connection.reconnectEnd"],function(e){var i,o,a=e.context,s=a.connection,c=a.newSource||s.source,p=a.newTarget||s.target;(i=n.canConnect(c,p))&&i.type!==s.type&&(o=t.connect(c,p,{type:i.type,waypoints:s.waypoints.slice()}),t.removeConnection(s),a.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.payload.previousSelection;o&&o.length&&-1!==(n=o.indexOf(e))&&o.splice(n,1,t)}(s,o))}),this.postExecuted("element.updateProperties",function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=y(o.outgoing,P({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})})}function uh(e,t){Za.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Ai(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()},!0)}function hh(e,t,n,i,r,o){Za.call(this,e),this._bpmnReplace=t,this._elementRegistry=i,this._selection=r,this._modeling=o,this.postExecuted(["elements.move"],500,function(e){var t=e.context,i=t.newParent,r=t.newHost,o=[];g(t.closure.topLevel,function(e){o=Mi(e)?o.concat(e.children):o.concat(e)}),1===o.length&&r&&(i=r);var a=n.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)},this),this.postExecute(["shape.replace"],1500,function(e){var t,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(t=n.canReplace(a,o),this.replaceElements(a,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;o.unclaimId(n.businessObject.id,n.businessObject),o.updateProperties(i,{id:n.id})})}ph.$inject=["eventBus","tooltips","translate"],n(lh,Za),lh.$inject=["eventBus","modeling","bpmnRules","injector"],uh.$inject=["eventBus","modeling"],n(uh,Za),n(hh,Za),hh.prototype.replaceElements=function(e,t,n){var i=this._elementRegistry,r=this._bpmnReplace,o=this._selection,a=this._modeling;g(t,function(t){var o={type:t.newElementType},s=i.get(t.oldElementId);n&&Ai(s,"bpmn:BoundaryEvent")&&a.updateAttachment(s,null);var c=e.indexOf(s);e[c]=r.replaceElement(s,o,{select:!1}),n&&Ai(e[c],"bpmn:BoundaryEvent")&&a.updateAttachment(e[c],n)}),t&&o.select(e)},hh.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var dh=Math.abs,fh=Math.min,mh=Math.max;function yh(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function vh(e,t,n){return yh(e,t,n,fh)}function gh(e,t,n){return yh(e,t,n,mh)}var bh=60,xh=300,_h=20,Eh=50,wh=20,Sh=20;var Ch=1500,Th={width:300,height:150},Rh={width:140,height:120},Ah={width:50,height:30};function kh(e){e.on("resize.start",Ch,function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(Ai(n,"bpmn:Lane")||Ai(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Vp(e),r=!0,o=!0,a=Gp(i,[i]),s=to(e),c={},p={};return/e/.test(t)?p.right=s.left+xh:/w/.test(t)&&(p.left=s.right-xh),a.forEach(function(e){var i=to(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&dh(s.top-i.bottom)<10&&gh(c,"top",i.top+bh),dh(s.top-i.top)<5&&vh(p,"top",i.bottom-bh)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&dh(s.bottom-i.top)<10&&vh(c,"bottom",i.bottom-bh),dh(s.bottom-i.bottom)<5&&gh(p,"bottom",i.top+bh))}),i.children.filter(function(e){return!e.hidden&&!e.waypoints&&(Ai(e,"bpmn:FlowElement")||Ai(e,"bpmn:Artifact"))}).forEach(function(e){var n=to(e);r&&/n/.test(t)&&vh(p,"top",n.top-wh),/e/.test(t)&&gh(p,"right",n.right+_h),o&&/s/.test(t)&&gh(p,"bottom",n.bottom+Sh),/w/.test(t)&&vh(p,"left",n.left-Eh)}),{min:p,max:c}}(n,i,r)),Ai(n,"bpmn:Participant")&&(t.minDimensions=Th),Ai(n,"bpmn:SubProcess")&&Pi(n)&&(t.minDimensions=Rh),Ai(n,"bpmn:TextAnnotation")&&(t.minDimensions=Ah)})}kh.$inject=["eventBus"];var Ph=1001;function Mh(e,t){e.on("resize.start",Ph+500,function(e){var t=e.context,n=t.shape;(Ai(n,"bpmn:Lane")||Ai(n,"bpmn:Participant"))&&(t.balanced=!go(e))}),e.on("resize.end",Ph,function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(Ai(i,"bpmn:Lane")||Ai(i,"bpmn:Participant"))return r&&(o=Jr(o),t.resizeLane(i,o,n.balanced)),!1})}function Dh(e,t,n){Za.call(this,e),this.preExecute("shape.delete",function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(Ai(r,"bpmn:SequenceFlow")&&Ai(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var a=function(e,t){var n=Du(Bh(e[e.length-2]),Bh(e[e.length-1]),Bh(t[1]),Bh(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Bh(e[0]),Bh(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,a)}}})}function Bh(e){return e.original||e}function Nh(e,t){e.invoke(Za,this),this.postExecuted("shape.replace",function(e){var n=e.context.oldShape,i=e.context.newShape;if(Ai(i,"bpmn:SubProcess")&&Ai(n,"bpmn:Task")&&Pi(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}})}Mh.$inject=["eventBus","modeling"],n(Dh,Za),Dh.$inject=["eventBus","bpmnRules","modeling"],Nh.$inject=["injector","modeling"],n(Nh,Za);var Oh=500;function jh(e,t,n,i){Za.call(this,e),this.executed(["shape.toggleCollapse"],Oh,function(e){var t,n=e.context.shape;Ai(n,"bpmn:SubProcess")&&(n.collapsed?ki(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),ki(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],Oh,function(e){var t=e.context.shape;t.collapsed?ki(t).di.isExpanded=!1:ki(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],Oh,function(e){var i,r=e.context.shape,o=t._getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r=e.children,o=t;return(n=Fp((i=r,i.filter(function(e){return!e.hidden})).concat([e])))?(o.width=Math.max(n.width,o.width),o.height=Math.max(n.height,o.height),o.x=n.x+(n.width-o.width)/2,o.y=n.y+(n.height-o.height)/2):(o.x=e.x+(e.width-o.width)/2,o.y=e.y+(e.height-o.height)/2),o}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})})}function Lh(e,t){Za.call(this,e),this.preExecute("elements.delete",function(e){g(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}n(jh,Za),jh.$inject=["eventBus","elementFactory","modeling"],n(Lh,Za),Lh.$inject=["eventBus","modeling"];var Ih=500,zh=5e3;function Fh(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}Za.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,zh,function(e){(i=i||new $h).enter()}),this.postExecuted(o,Ih,function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=r();t.labelTarget||(Ai(t,"bpmn:Lane")&&n.addLane(t),Ai(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function $h(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function Hh(e,t){Za.call(this,e),this.preExecute("connection.delete",function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!Ai(e,"bpmn:SequenceFlow"))return!1;var n=ki(t),i=ki(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})})}Fh.$inject=["eventBus","modeling","translate"],n(Fh,Za),n(Hh,Za),Hh.$inject=["eventBus","modeling"];var Gh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","attachEventBehavior","boundaryEventBehavior","createBehavior","fixHoverBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataStoreBehavior","dataInputAssociationBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","toggleElementCollapseBehaviour","subProcessStartEventBehavior","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",eu],appendBehavior:["type",nu],attachEventBehavior:["type",iu],boundaryEventBehavior:["type",ru],createBehavior:["type",ou],fixHoverBehavior:["type",cu],createBoundaryEventBehavior:["type",pu],createDataObjectBehavior:["type",lu],createParticipantBehavior:["type",mu],dataInputAssociationBehavior:["type",gu],dataStoreBehavior:["type",_u],deleteLaneBehavior:["type",wu],detachEventBehavior:["type",Su],dropOnFlowBehavior:["type",Cu],eventBasedGatewayBehavior:["type",Au],groupBehavior:["type",Mu],importDockingFix:["type",Bu],isHorizontalFix:["type",Ou],labelBehavior:["type",oh],modelingFeedback:["type",ph],replaceConnectionBehavior:["type",lh],removeParticipantBehavior:["type",uh],replaceElementBehaviour:["type",hh],resizeBehavior:["type",kh],resizeLaneBehavior:["type",Mh],removeElementBehavior:["type",Dh],toggleElementCollapseBehaviour:["type",jh],subProcessStartEventBehavior:["type",Nh],unclaimIdBehavior:["type",Lh],updateFlowNodeRefsBehavior:["type",Fh],unsetDefaultFlowBehavior:["type",Hh]};function Wh(e,t){var n=ro(e,t,-15);return"intersect"!==n?n:null}function Vh(e){es.call(this,e)}function Uh(e){return!e||dr(e)}function qh(e){do{if(Ai(e,"bpmn:Process"))return ki(e);if(Ai(e,"bpmn:Participant"))return ki(e).processRef||ki(e)}while(e=e.parent)}function Kh(e){return Ai(e,"bpmn:TextAnnotation")}function Yh(e){return Ai(e,"bpmn:Group")&&!e.labelTarget}function Xh(e){return Ai(e,"bpmn:BoundaryEvent")&&Jh(e,"bpmn:CompensateEventDefinition")}function Zh(e){return ki(e).isForCompensation}function Qh(e){for(var t=e;t=t.parent;){if(Ai(t,"bpmn:FlowElementsContainer"))return ki(t);if(Ai(t,"bpmn:Participant"))return ki(t).processRef}return null}function Jh(e,t){return!!y(ki(e).eventDefinitions||[],function(e){return Ai(e,t)})}function ed(e,t){return(ki(e).eventDefinitions||[]).every(function(e){return Ai(e,t)})}function td(e){return Ai(e,"bpmn:ReceiveTask")||Ai(e,"bpmn:IntermediateCatchEvent")&&(Jh(e,"bpmn:MessageEventDefinition")||Jh(e,"bpmn:TimerEventDefinition")||Jh(e,"bpmn:ConditionalEventDefinition")||Jh(e,"bpmn:SignalEventDefinition"))}function nd(e){return e.waypoints}function id(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function rd(e,t,n){if(Uh(e)||Uh(t))return null;if(!Ai(n,"bpmn:DataAssociation")){if(yd(e,t))return{type:"bpmn:MessageFlow"};if(vd(e,t))return{type:"bpmn:SequenceFlow"}}var i=gd(e,t);return i||(Xh(e)&&Zh(t)?{type:"bpmn:Association",associationDirection:"One"}:!!md(e,t)&&{type:"bpmn:Association"})}function od(e,t,n){return!(!dr(e)&&!Yh(e))||!(Ai(t,"bpmn:Participant")&&!Pi(t))&&(Ai(e,"bpmn:Participant")?Ai(t,"bpmn:Process")||Ai(t,"bpmn:Collaboration"):ja(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Ai(e,"bpmn:Lane")?Ai(t,"bpmn:Participant")||Ai(t,"bpmn:Lane"):!(Ai(e,"bpmn:BoundaryEvent")&&(i=e,!ki(i).cancelActivity||!cd(i)&&!pd(i)))&&(Ai(e,"bpmn:FlowElement")&&!Ai(e,"bpmn:DataStoreReference")?Ai(t,"bpmn:FlowElementsContainer")?Pi(t):ja(t,["bpmn:Participant","bpmn:Lane"]):ja(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ja(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Ai(e,"bpmn:MessageFlow")&&(Ai(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var i}function ad(e){return Ai(e,"bpmn:Lane")}function sd(e){return!!function(e){return!dr(e)&&Ai(e,"bpmn:BoundaryEvent")}(e)||(!(!Ai(e,"bpmn:IntermediateThrowEvent")||!cd(e))||Ai(e,"bpmn:IntermediateCatchEvent")&&pd(e))}function cd(e){var t=ki(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function pd(e){return function(e,t){return t.some(function(t){return Jh(e,t)})}(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function ld(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!dr(r)&&(!!sd(r)&&(!Mi(t)&&(!(!Ai(t,"bpmn:Activity")||Zh(t))&&(!(i&&!Wh(i,t))&&(!function(e){return Ai(e,"bpmn:ReceiveTask")&&y(e.incoming,function(e){return Ai(e.source,"bpmn:EventBasedGateway")})}(t)&&"attach")))))}function ud(e,t,n){if(!t)return!1;var i={replacements:[]};return g(e,function(e){Mi(t)||Ai(e,"bpmn:StartEvent")&&"label"!==e.type&&od(e,t)&&(function(e){return e&&!1!==ki(e).isInterrupting}(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Di(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Di(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Di(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Ai(t,"bpmn:Transaction")||Jh(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Ai(e,"bpmn:EndEvent")&&od(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Ai(e,"bpmn:BoundaryEvent")&&ld(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function hd(e,t){return!E(e,ad)&&(!t||e.every(function(e){return od(e,t)}))}function dd(e,t,n,i){return!!t&&(!(!dr(e)&&!Yh(e))||n!==t&&((!n||!id(n,t))&&(od(e,t)||bd(e,t))))}function fd(e,t){return Ai(e,"bpmn:SubProcess")?Pi(e)&&(!t||t.width>=100&&t.height>=80):Ai(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:Ai(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!Kh(e)||!!Yh(e)}function md(e,t){return!nd(e)&&!nd(t)&&(!(!Xh(e)||!Zh(t))||!id(t,e)&&!id(e,t)&&function(e,t){var n=Kh(e),i=Kh(t);return(n||i)&&n!==i}(e,t))}function yd(e,t){return!(wd(e)&&!wd(t))&&(Ai(i=e,"bpmn:InteractionNode")&&(!Ai(i,"bpmn:Event")||Ai(i,"bpmn:ThrowEvent")&&ed(i,"bpmn:MessageEventDefinition"))&&function(e){return Ai(e,"bpmn:InteractionNode")&&!Zh(e)&&(!Ai(e,"bpmn:Event")||Ai(e,"bpmn:CatchEvent")&&ed(e,"bpmn:MessageEventDefinition"))}(t)&&(n=t,!(qh(e)===qh(n))));var n,i}function vd(e,t){return!(td(t)&&t.incoming.length>0&&(n=t.incoming,(n=n||[]).some(Ed))&&!Ai(e,"bpmn:EventBasedGateway"))&&(Ai(r=e,"bpmn:FlowNode")&&!Ai(r,"bpmn:EndEvent")&&!Mi(r)&&!(Ai(r,"bpmn:IntermediateThrowEvent")&&Jh(r,"bpmn:LinkEventDefinition"))&&!Xh(r)&&!Zh(r)&&function(e){return Ai(e,"bpmn:FlowNode")&&!Ai(e,"bpmn:StartEvent")&&!Ai(e,"bpmn:BoundaryEvent")&&!Mi(e)&&!(Ai(e,"bpmn:IntermediateCatchEvent")&&Jh(e,"bpmn:LinkEventDefinition"))&&!Zh(e)}(t)&&(i=t,Qh(e)===Qh(i))&&!(Ai(e,"bpmn:EventBasedGateway")&&!td(t)));var n,i,r}function gd(e,t){return ja(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ja(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!ja(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!ja(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function bd(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(ja(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!dr(t)&&Ai(e,"bpmn:FlowNode")&&!Ai(e,"bpmn:BoundaryEvent")&&od(e,t.parent))}function xd(e,t){return e&&t&&-1!==e.indexOf(t)}function _d(e,t){return!!dr(t)||!(Ai(t,"bpmn:Lane")&&!xd(e,t.parent))&&!(Ai(t,"bpmn:BoundaryEvent")&&!xd(e,t.host))}function Ed(e){if(e&&e.source)return Ai(e.source,"bpmn:EventBasedGateway")}function wd(e){return La(e,"bpmn:Process")||La(e,"bpmn:Collaboration")}n(Vh,es),Vh.$inject=["eventBus"],Vh.prototype.init=function(){this.addRule("connection.start",function(e){return function(e){if(Uh(e))return null;return ja(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])}(e.source)}),this.addRule("connection.create",function(e){var t=e.source,n=e.target,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return rd(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return rd(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return rd(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return{type:e.connection.type}}),this.addRule("shape.resize",function(e){return fd(e.shape,e.newBounds)}),this.addRule("elements.create",function(e){var t=e.elements,n=e.position,i=e.target;return _(t,function(e){return nd(e)?rd(e.source,e.target,e):e.host?ld(e,e.host,null,n):dd(e,i,null)})}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return ld(n,t,null,i)||ud(n,t,i)||hd(n,t)||bd(n,t)}),this.addRule("shape.create",function(e){return dd(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return ld(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){var t=e.element;return _d(e.elements,t)})},Vh.prototype.canConnectMessageFlow=yd,Vh.prototype.canConnectSequenceFlow=vd,Vh.prototype.canConnectDataAssociation=gd,Vh.prototype.canConnectAssociation=md,Vh.prototype.canMove=hd,Vh.prototype.canAttach=ld,Vh.prototype.canReplace=ud,Vh.prototype.canDrop=od,Vh.prototype.canInsert=bd,Vh.prototype.canCreate=dd,Vh.prototype.canConnect=rd,Vh.prototype.canResize=fd,Vh.prototype.canCopy=_d;var Sd={__depends__:[ms],__init__:["bpmnRules"],bpmnRules:["type",Vh]};function Cd(e){Za.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)}),this.preExecute(["shape.move","connection.move"],function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)})}function Td(e,t,n){Cd.call(this,e);var i=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:3,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:Process"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;return t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=y(i,function(t){return ja(e,[t.type])});return t&&t.order||{level:1}}(e)),t}this.getOrdering=function(e,i){if(e.labelTarget)return{parent:t.getRootElement(),index:-1};var o=r(e);o.containers&&(i=function(e,t,i){for(var r=t;r&&!ja(r,i);)r=r.parent;if(!r)throw new Error(n("no parent for {element} in {parent}",{element:e.id,parent:t.id}));return r}(e,i,o.containers));var a=i.children.indexOf(e),s=function(e,t){t=D(t);var n=l(e)?-1:void 0;return g(e,function(e,i){if(t(e,i))return n=i,!1}),n}(i.children,function(t){return!(!e.labelTarget&&t.labelTarget)&&o.level<r(t).level});return-1!==s&&-1!==a&&a<s&&(s-=1),{index:s,parent:i}}}Cd.prototype.getOrdering=function(e,t){return null},n(Cd,Za),Td.$inject=["eventBus","canvas","translate"],n(Td,Cd);var Rd={__depends__:[ar],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Td]};function Ad(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[]},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],function(){this.clear(!1)},this)}Ad.$inject=["eventBus","injector"],Ad.prototype.execute=function(e,t){if(!e)throw new Error("command required");var n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction(n)},Ad.prototype.canExecute=function(e,t){var n={command:e,context:t},i=this._getHandler(e),r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},Ad.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed")},Ad.prototype.undo=function(){var e,t=this._getUndoAction();if(t){for(this._pushAction(t);t&&(this._internalUndo(t),(e=this._getUndoAction())&&e.id===t.id);)t=e;this._popAction()}},Ad.prototype.redo=function(){var e,t=this._getRedoAction();if(t){for(this._pushAction(t);t&&(this._internalExecute(t,!0),(e=this._getRedoAction())&&e.id===t.id);)t=e;this._popAction()}},Ad.prototype.register=function(e,t){this._setHandler(e,t)},Ad.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");var n=this._injector.instantiate(t);this.register(e,n)},Ad.prototype.canUndo=function(){return!!this._getUndoAction()},Ad.prototype.canRedo=function(){return!!this._getRedoAction()},Ad.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},Ad.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},Ad.prototype._internalUndo=function(e){var t=this,n=e.command,i=e.context,r=this._getHandler(n);this._atomicDo(function(){t._fire(n,"revert",e),r.revert&&t._markDirty(r.revert(i)),t._revertedAction(e),t._fire(n,"reverted",e)})},Ad.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);var i,r,o,a=t?[e+"."+t,t]:[e];for(n=this._eventBus.createEvent(n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},Ad.prototype._createId=function(){return this._uid++},Ad.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},Ad.prototype._internalExecute=function(e,t){var n=this,i=e.command,r=e.context,o=this._getHandler(i);if(!o)throw new Error("no command handler registered for <"+i+">");this._pushAction(e),t||(this._fire(i,"preExecute",e),o.preExecute&&o.preExecute(r),this._fire(i,"preExecuted",e)),this._atomicDo(function(){n._fire(i,"execute",e),o.execute&&n._markDirty(o.execute(r)),n._executedAction(e,t),n._fire(i,"executed",e)}),t||(this._fire(i,"postExecute",e),o.postExecute&&o.postExecute(r),this._fire(i,"postExecuted",e)),this._popAction(e)},Ad.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Ad.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:R("id",n)}),n.length=0,this._fire("changed"))},Ad.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=l(e)?e:[e],t.dirty=t.dirty.concat(e))},Ad.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Ad.prototype._revertedAction=function(e){this._stackIdx--},Ad.prototype._getHandler=function(e){return this._handlerMap[e]},Ad.prototype._setHandler=function(e,t){if(!e||!t)throw new Error("command and handler required");if(this._handlerMap[e])throw new Error("overriding handler for command <"+e+">");this._handlerMap[e]=t};var kd={commandStack:["type",Ad]},Pd=new Do("tt");function Md(e,t){e.style.display=!1===t?"none":""}var Dd=".djs-tooltip";function Bd(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Pd,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=ae('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;oe.bind(this._tooltipRoot,Dd,"mousedown",function(e){e.stopPropagation()}),oe.bind(this._tooltipRoot,Dd,"mouseover",function(e){r.trigger("mouseover",e)}),oe.bind(this._tooltipRoot,Dd,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Bd.$inject=["eventBus","canvas"],Bd.prototype.add=function(e){if(!e.position)throw new Error("must specifiy tooltip position");if(!e.html)throw new Error("must specifiy tooltip html");var t=this._ids.next();return e=I({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Bd.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get($(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Bd.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Bd.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Bd.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Bd.prototype.remove=function(e){var t=this.get(e);t&&(fe(t.html),fe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Bd.prototype.show=function(){Md(this._tooltipRoot)},Bd.prototype.hide=function(){Md(this._tooltipRoot,!1)},Bd.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Bd.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),f(i)&&(i=ae(i)),(t=ae('<div data-tooltip-id="'+n+'" class="djs-tooltip" style="position: absolute">')).appendChild(i),e.type&&U(t).add("djs-tooltip-"+e.type),e.className&&U(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Bd.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,I(t.style,{left:n+"px",top:i+"px"})},Bd.prototype._updateTooltipVisibilty=function(e){g(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Md(i,r))})},Bd.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",function(t){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()})};var Nd={__init__:["tooltips"],tooltips:["type",Bd]};function Od(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}var jd=250,Ld=1400;function Id(e,t,n){Za.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Ld,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=zd(n),t.validatedShapes=zd(i)}),i&&t.on("shape.move.start",jd,function(e){var t=e.context,n=t.shapes,r=[];g(n,function(e){g(e.labels,function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)})}),g(r,function(e){i.makeDraggable(t,e,!0)})}),this.preExecuted("elements.move",Ld,function(e){var t=e.context.closure,n=t.enclosedElements,i=[];g(n,function(e){g(e.labels,function(e){n[e.id]||i.push(e)})}),t.addAll(i)}),this.preExecute(["connection.delete","shape.delete"],function(e){var t=e.context;Od((t.connection||t.shape).labels,function(e){n.removeShape(e,{nested:!0})})}),this.execute("shape.delete",function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=_t(i.labels,n),t.labelTarget=i,n.labelTarget=null)}),this.revert("shape.delete",function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(xt(i.labels,n,r),n.labelTarget=i)})}function zd(e){return v(e,function(t){return-1===e.indexOf(t.labelTarget)})}n(Id,Za),Id.$inject=["injector","eventBus","modeling"];var Fd={__init__:["labelSupport"],labelSupport:["type",Id]},$d=251,Hd=1401,Gd="attach-ok";function Wd(e,t,n,i,r){Za.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",Hd,function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=Vd(t=r),A("id",t,n)),i.validatedShapes=function(e){var t=T(e,"id");return v(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(o)}),o&&t.on("shape.move.start",$d,function(e){var t=e.context;g(Vd(t.shapes),function(e){o.makeDraggable(t,e,!0),g(e.labels,function(e){o.makeDraggable(t,e,!0)})})}),o&&t.on("shape.move.start",function(e){var i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,Gd),t.once(["shape.move.out","shape.move.cleanup"],function(){n.removeMarker(r,Gd)}))}}),this.preExecuted("elements.move",Hd,function(e){var t=e.context,n=t.closure;g(Vd(t.shapes),function(e){n.add(e,n.topLevel[e.host.id])})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.shapes,i=t.newHost;1===n.length&&g(i?n:v(n,function(e){return!!e.host}),function(e){r.updateAttachment(e,i)})}),this.postExecuted("elements.move",function(e){g(e.context.shapes,function(e){g(e.attachers,function(e){g(e.outgoing.slice(),function(e){i.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}),g(e.incoming.slice(),function(e){i.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)}),this.postExecute("shape.replace",function(e){var t=e.context,n=t.oldShape,o=t.newShape;Od(n.attachers,function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)}),o.attachers.length&&g(o.attachers,function(e){var t=th(e,n,o);r.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds;g(n.attachers,function(e){var t=th(e,i,o);r.moveShape(e,t,e.parent),g(e.labels,function(e){r.moveShape(e,t,e.parent)})})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;Od(t.attachers,function(e){r.removeShape(e)}),t.host&&r.updateAttachment(t,null)}),t.on("spaceTool.move",function(e){var t=e.context,n=t.initialized,i=t.attachSupportInitialized;if(n&&!i){var r=t.movingShapes;g(v(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)}),function(e){bt(r,e),g(e.labels,function(t){bt(r,e.label)})}),t.attachSupportInitialized=!0}})}function Vd(e){return o(w(e,function(e){return e.attachers||[]}))}n(Wd,Za),Wd.$inject=["injector","eventBus","canvas","rules","modeling"];var Ud={__depends__:[ms],__init__:["attachSupport"],attachSupport:["type",Wd]};function qd(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}qd.$inject=["eventBus","dragging"],qd.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},qd.prototype.isActive=function(e){return e&&this._active===e},qd.prototype.length=function(e){return this._tools.length},qd.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},qd.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)},this),g(t,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;this._active&&(t&&J(t.target,'.group[data-group="tools"]')||this.setActive(null))},this)};var Kd={__depends__:[ls],__init__:["toolManager"],toolManager:["type",qd]};function Yd(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}var Xd=Math.abs,Zd=Math.round,Qd=1500,Jd={x:"width",y:"height"},ef={x:"y",y:"x"};function tf(e,t,n,i,r,o){this._canvas=n,this._dragging=t,this._modeling=i,this._rules=r,this._toolManager=o;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),e.on("spaceTool.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("spaceTool.selection.ended",function(){a.activateMakeSpace(t.originalEvent)})}),e.on("spaceTool.move",Qd,function(e){var t=e.context;t.initialized||(t.initialized=a.initializeMakeSpace(e,t))}),e.on("spaceTool.end",function(t){var n=t.context,i=n.axis,r=n.direction,o=n.movingShapes,s=n.resizingShapes;if(n.initialized){var c={x:Zd(t.dx),y:Zd(t.dy)};c[ef[i]]=0;var p=!0;g(s,function(e){("w"===r&&t.x>e.x+e.width||"e"===r&&t.x<e.x||"n"===r&&t.y>e.y+e.height||"s"===r&&t.y<e.y)&&(p=!1)}),p&&a.makeSpace(o,s,c,r),e.once("spaceTool.ended",function(e){a.activateSelection(e.originalEvent,!0,!0)})}})}tf.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"],tf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:"crosshair",autoActivate:t,data:{context:{reactivate:n}}})},tf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:"crosshair",data:{context:{}}})},tf.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},tf.prototype.initializeMakeSpace=function(e,t){var n=Xd(e.dx)>Xd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Xd(i)<5)return!1;i<0&&(i*=-1),go(e)&&(i*=-1);var o=ut(this._canvas.getRootElement(),!0);return I(t,this.calculateAdjustments(o,n,i,r),{axis:n,direction:Yd(n,i)}),ia("resize-"+("x"===n?"ew":"ns")),!0},tf.prototype.calculateAdjustments=function(e,t,n,i){var r=[],o=[],a=this._rules;return e.forEach(function(e){var s=e[t],c=s+e[Jd[t]];if(e.parent&&!e.waypoints)return n>0&&s>i?r.push(e):n<0&&c<i?r.push(e):s<i&&c>i&&a.allowed("shape.resize",{shape:e})?o.push(e):void 0}),{movingShapes:r,resizingShapes:o}},tf.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},tf.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var nf="djs-dragging",rf="djs-resizing",of=250,af=Math.max;function sf(e,t,n,i,r){function o(e,t){g(e,function(e){r.addDragger(e,t),n.addMarker(e,nf)})}e.on("spaceTool.selection.start",function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=Be("g");xe(s,i.cls("djs-crosshair-group",["no-events"])),ye(t,s);var c=Be("path");xe(c,"d",o),Ce(c).add("djs-crosshair"),ye(s,c);var p=Be("path");xe(p,"d",a),Ce(p).add("djs-crosshair"),ye(s,p),r.crosshairGroup=s}),e.on("spaceTool.selection.move",function(e){Qt(e.context.crosshairGroup,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&Re(t)}),e.on("spaceTool.move",of,function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");xe(s=Be("path"),"d","M0,0 L0,0"),Ce(s).add("djs-crosshair"),ye(u,s),a.line=s;var h=Be("g");xe(h,i.cls("djs-drag-group",["no-events"])),ye(n.getDefaultLayer(),h),o(p,h),o(a.movingConnections=t.filter(function(e){var t=!1;g(p,function(n){g(n.outgoing,function(n){e===n&&(t=!0)})});var n=!1;g(p,function(t){g(t.incoming,function(t){e===t&&(n=!0)})});var i=!1;g(l,function(t){g(t.outgoing,function(t){e===t&&(i=!0)})});var r=!1;return g(l,function(t){g(t.incoming,function(t){e===t&&(r=!0)})}),function(e){return e.waypoints}(e)&&(t||i)&&(n||r)}),h),a.dragGroup=h}if(!a.frameGroup){var d=Be("g");xe(d,i.cls("djs-frame-group",["no-events"])),ye(n.getDefaultLayer(),d);var f=[];g(l,function(e){var t=r.addFrame(e,d),i=t.getBBox();f.push({element:t,initialBounds:i}),n.addMarker(e,rf)}),a.frameGroup=d,a.frames=f}xe(s,{path:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[c],display:""});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[a.axis]]=0,Qt(a.dragGroup,m.x,m.y),g(a.frames,function(e){var t,n,i=e.element,r=e.initialBounds;"e"===a.direction?xe(i,{width:af(r.width+m.x,5)}):xe(i,{width:t=af(r.width-m.x,5),x:r.x+r.width-t}),"s"===a.direction?xe(i,{height:af(r.height+m.y,5)}):xe(i,{height:n=af(r.height-m.y,5),y:r.y+r.height-n})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;g(i,function(e){n.removeMarker(e,nf)}),g(r,function(e){n.removeMarker(e,nf)}),s&&(Re(a),Re(s)),g(o,function(e){n.removeMarker(e,rf)}),c&&Re(c)})}sf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var cf={__init__:["spaceToolPreview"],__depends__:[ls,ms,Kd,Dc],spaceTool:["type",tf],spaceToolPreview:["type",sf]};function pf(e){this._model=e}function lf(e,t,n,i){Za.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){g(e.context.oldRoot.children,function(e){Ai(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;Ai(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function c(e){r.updateConnectionWaypoints(e.context.connection)}function p(e){r.updateAttachment(e.context)}this.executed(["connection.layout","connection.create"],function(e){var t,i=e.context;i.cropped||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],uf(function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)})),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],uf(function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)})),this.executed(["canvas.updateRoot"],o),this.reverted(["canvas.updateRoot"],o),this.executed(["shape.move","shape.create","shape.resize"],uf(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],uf(function(e){"label"!==e.context.shape.type&&a(e)})),e.on("shape.changed",function(e){"label"===e.element.type&&a({context:{shape:e.element}})}),this.executed(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],uf(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],uf(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],uf(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],uf(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],uf(function(e){var t=e.context,n=t.connection,i=ki(n),r=ki(t.oldSource),o=ki(t.oldTarget),a=ki(n.source),s=ki(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(Ai(s,"bpmn:Activity")||Ai(s,"bpmn:EndEvent")||Ai(s,"bpmn:Gateway")||Ai(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!Ai(a,"bpmn:Activity")&&!Ai(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(Ai(s,"bpmn:Activity")||Ai(s,"bpmn:EndEvent")||Ai(s,"bpmn:Gateway")||Ai(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],uf(function(e){var t=e.context,n=t.connection,i=ki(n),r=ki(n.source);t.default&&(Ai(r,"bpmn:ExclusiveGateway")||Ai(r,"bpmn:InclusiveGateway")||Ai(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&Ai(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],uf(p)),this.reverted(["element.updateAttachment"],uf(p))}function uf(e){return function(t){var n=t.context;Ai(n.shape||n.connection,"bpmn:BaseElement")&&e(t)}}function hf(e,t,n){Ut.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function df(e,t,n){e[n]=t[n],delete t[n]}function ff(e,t){this._modeling=e,this._canvas=t}function mf(e){this._modeling=e}function yf(e,t){this._canvas=e,this._layouter=t}pf.$inject=["moddle"],pf.prototype._needsId=function(e){return ja(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},pf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},pf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},pf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},pf.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",I({bpmnElement:e,bounds:this.createDiBounds(t)},n))},pf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},pf.prototype.createDiWaypoints=function(e){var t=this;return w(e,function(e){return t.createDiWaypoint(e)})},pf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",z(e,["x","y"]))},pf.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",I({bpmnElement:e},n))},pf.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})},n(lf,Za),lf.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],lf.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},lf.prototype.updateParent=function(e,t){if(!(e instanceof Gt||Ai(e,"bpmn:DataStoreReference")&&e.parent&&Ai(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;Ai(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),Ai(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),Ai(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),Ai(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},lf.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof Gt?this._getLabel(t):t,i=n.bounds;i||(i=this._bpmnFactory.createDiBounds(),n.set("bounds",i)),I(i,{x:e.x,y:e.y,width:e.width,height:e.height})},lf.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Ai(n,"bpmn:Lane")&&bt(n.get("flowNodeRef"),e),Ai(t,"bpmn:Lane")&&xt(t.get("flowNodeRef"),e))},lf.prototype.updateDiConnection=function(e,t,n){e.sourceElement&&e.sourceElement.bpmnElement!==t&&(e.sourceElement=t&&t.di),e.targetElement&&e.targetElement.bpmnElement!==n&&(e.targetElement=n&&n.di)},lf.prototype.updateDiParent=function(e,t){if(t&&!Ai(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(bt(n,e),e.$parent=null)}},lf.prototype.getLaneSet=function(e){var t,n;return Ai(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Ai(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},lf.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t&&!((Ai(e,"bpmn:DataInput")||Ai(e,"bpmn:DataOutput"))&&(Ai(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),"ioSpecification"in t&&t.ioSpecification===e.$parent))){if(Ai(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Ai(e,"bpmn:FlowElement")){if(t)if(Ai(t,"bpmn:Participant"))t=t.processRef;else if(Ai(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Ai(t,"bpmn:Lane"));i="flowElements"}else if(Ai(e,"bpmn:Artifact")){for(;t&&!Ai(t,"bpmn:Process")&&!Ai(t,"bpmn:SubProcess")&&!Ai(t,"bpmn:Collaboration");){if(Ai(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Ai(e,"bpmn:MessageFlow"))i="messageFlows";else if(Ai(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!Ai(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(bt(o.get("rootElements"),a),a.$parent=null),t&&(xt(o.get("rootElements"),a),a.$parent=o))}else Ai(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Ai(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(r("no parent for {element} in {parent}",{element:e.id,parent:t.id}));var s;if(e.$parent&&bt(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);bt(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},lf.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},lf.prototype.updateConnection=function(e){var t,n=e.connection,i=ki(n),r=ki(n.source),o=ki(n.target);if(Ai(i,"bpmn:DataAssociation"))Ai(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t)):Ai(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=Ai(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(bt(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(bt(i.targetRef&&i.targetRef.get("incoming"),i),o&&o.get("incoming")&&o.get("incoming").push(i)),i.targetRef=o)}this.updateConnectionWaypoints(n),this.updateDiConnection(i.di,r,o)},lf.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},n(hf,Ut),hf.$inject=["bpmnFactory","moddle","translate"],hf.prototype.baseCreate=Ut.prototype.create,hf.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,I({type:"label"},sr,t)):this.createBpmnElement(e,t)},hf.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),Ai(a,"bpmn:Group")&&(t=I({isFrame:!0},t)),t.di&&(I(a.di,t.di),delete t.di),function(e,t,n){g(n,function(n){void 0!==t[n]&&df(e,t,n)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&df(a.di,t,"isExpanded"),Ai(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),r.$parent=a,a.eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=I({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},hf.prototype._getDefaultSize=function(e){return Ai(e,"bpmn:SubProcess")?Pi(e)?{width:350,height:200}:{width:100,height:80}:Ai(e,"bpmn:Task")?{width:100,height:80}:Ai(e,"bpmn:Gateway")?{width:50,height:50}:Ai(e,"bpmn:Event")?{width:36,height:36}:Ai(e,"bpmn:Participant")?Pi(e)?{width:600,height:250}:{width:400,height:60}:Ai(e,"bpmn:Lane")?{width:400,height:100}:Ai(e,"bpmn:DataObjectReference")?{width:36,height:50}:Ai(e,"bpmn:DataStoreReference")?{width:50,height:50}:Ai(e,"bpmn:TextAnnotation")?{width:100,height:30}:Ai(e,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},hf.prototype.createParticipantShape=function(e){return u(e)||(e={isExpanded:e}),!1!==(e=I({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},ff.$inject=["modeling","canvas"],ff.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;g(n,function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},ff.prototype.postExecute=function(e){},mf.$inject=["modeling"],mf.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape;i=e.shape=this._modeling.createShape(i,e.position,n,{attach:e.attach}),e.shape=i},mf.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,E(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)},yf.$inject=["canvas","layouter"],yf.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,a=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,a)),this._canvas.addConnection(t,r,o),t},yf.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null};var vf=Math.round;function gf(e){this._modeling=e}function bf(e){return!!e.waypoints}gf.$inject=["modeling"],gf.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,a=this._modeling;g(t,function(e){h(e.x)||(e.x=0),h(e.y)||(e.y=0)});var s=ht(t);g(t,function(e){bf(e)&&(e.waypoints=w(e.waypoints,function(e){return{x:vf(e.x-s.x-s.width/2+r.x),y:vf(e.y-s.y-s.height/2+r.y)}})),I(e,{x:vf(e.x-s.x-s.width/2+r.x),y:vf(e.y-s.y-s.height/2+r.y)})});var c=ct(t),p={};g(t,function(e){if(bf(e))p[e.id]=h(i)?a.createConnection(p[e.source.id],p[e.target.id],i,e,e.parent||n,o):a.createConnection(p[e.source.id],p[e.target.id],e,e.parent||n,o);else{var t=I({},o);-1===c.indexOf(e)&&(t.autoResize=!1),p[e.id]=h(i)?a.createShape(e,z(e,["x","y","width","height"]),e.parent||n,i,t):a.createShape(e,z(e,["x","y","width","height"]),e.parent||n,t)}}),e.elements=C(p)};var xf=Math.round;function _f(e){this._canvas=e}function Ef(e){_f.call(this,e)}_f.$inject=["canvas"],_f.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?I(t,n):I(t,{x:n.x-xf(t.width/2),y:n.y-xf(t.height/2)}),this._canvas.addShape(t,i,r),t},_f.prototype.revert=function(e){this._canvas.removeShape(e.shape)},n(Ef,_f),Ef.$inject=["canvas"];var wf=_f.prototype.execute;Ef.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach(function(t){void 0===e[t]&&(e[t]=0)})}(t),t.labelTarget=e.labelTarget,wf.call(this,e)};var Sf=_f.prototype.revert;function Cf(e,t){this._canvas=e,this._modeling=t}function Tf(e,t){this._modeling=e,this._elementRegistry=t}function Rf(e,t){this._canvas=e,this._modeling=t}function Af(e){this._modeling=e}Ef.prototype.revert=function(e){return e.shape.labelTarget=null,Sf.call(this,e)},Cf.$inject=["canvas","modeling"],Cf.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=_t(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Cf.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,xt(n.children,t,i),this._canvas.addConnection(t,n),t},Tf.$inject=["modeling","elementRegistry"],Tf.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;g(e.elements,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})},Rf.$inject=["canvas","modeling"],Rf.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Od(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),Od(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),Od(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},Rf.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=_t(i.children,n),t.removeShape(n),n},Rf.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return xt(i.children,n,r),t.addShape(n,i),n},Af.$inject=["modeling"];var kf={x:"y",y:"x"};function Pf(e,t){this._layouter=e,this._canvas=t}function Mf(){}function Df(e,t,n){var i=Lf(e)[0];return eh(i.original||i,n,t)}function Bf(e,t,n){var i=Lf(e),r=i[i.length-1];return eh(r.original||r,n,t)}function Nf(e,t,n){return Df(e,t,jf(t,n))}function Of(e,t,n){return Bf(e,t,jf(t,n))}function jf(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Lf(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function If(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function zf(e){this._modeling=e}function Ff(e){this._helper=new zf(e)}function $f(e){this._modeling=e,this._helper=new zf(e)}function Hf(e){this._modeling=e}function Gf(e,t){this._modeling=e,this._rules=t}function Wf(e){this._modeling=e}function Vf(e){this._modeling=e}function Uf(e){this._modeling=e}function qf(e){this._modeling=e}function Kf(e,t){return bt(e&&e.attachers,t)}function Yf(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),xt(i,t,n)}}function Xf(){}function Zf(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Af.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],f=0;g(n,function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),f+=c(e.range)):(u=(l=k(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,g(l,function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[kf[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}}),p&&p!==n.length-1&&(f+=c(e.range)))}),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-f)/(n.length-1)))<n.length-1||g(n,function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,g(e.elements,function(n,o){s[kf[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)}))})},Af.prototype.postExecute=function(e){},Pf.$inject=["layouter","canvas"],Pf.prototype.execute=function(e){var t=e.connection;return I(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Pf.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Mf.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=bt(o.children,t),xt(i.children,t,r),t.parent=i,g(t.waypoints,function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)}),t},Mf.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return bt(n.children,t),xt(i.children,t,r),t.parent=i,g(t.waypoints,function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)}),t},If.prototype.add=function(e,t){return this.addAll([e],t)},If.prototype.addAll=function(e,t){return I(this,function(e,t,n){c(t)&&(t=!0),u(t)&&(n=t,t=!0);var i=mt((n=n||{}).allShapes),r=mt(n.allConnections),o=mt(n.enclosedElements),a=mt(n.enclosedConnections),s=mt(n.topLevel,t&&T(e,function(e){return e.id}));function p(e){s[e.source.id]&&s[e.target.id]&&(s[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return lt(e,function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,g(e.incoming,p),g(e.outgoing,p),e.children;a[e.id]=r[e.id]=e}),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},zf.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},zf.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),g(a,function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})}),g(s,function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&Nf(e,e.source,t),connectionEnd:r&&Of(e,e.target,t)})})},zf.prototype.getClosure=function(e){return(new If).addAll(e,!0)},Ff.$inject=["modeling"],Ff.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Ff.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},$f.$inject=["modeling"],$f.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=z(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=bt(o.children,t),xt(i.children,t,r),I(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},$f.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(g(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:Of(e,t,n)})}),g(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:Nf(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},$f.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return xt(n.children,t,i),I(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},$f.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},$f.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Hf.$inject=["modeling"],Hf.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget are required");if(t&&n)throw new Error("must specify either newSource or newTarget");return l(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},Hf.prototype.postExecute=function(e){var t,n,i=e.connection,r=e.dockingOrPoints,o=e.newSource,a=o?"connectionStart":"connectionEnd",s={};!1!==e.hints.layoutConnection&&(t=l(r)?o?r[0]:r[r.length-1]:r,s[a]=(n=t).original||n,this._modeling.layoutConnection(i,s))},Hf.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},Gf.$inject=["modeling","rules"],Gf.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return r.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};t=e.newShape=e.newShape||n.createShape(a,l,o.parent,s),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t));var u=o.incoming.slice(),h=o.outgoing.slice();g(u,function(e){var i=e.waypoints,r=i[i.length-1];c("connection.reconnectEnd",e.source,t,e)&&n.reconnectEnd(e,t,r,{layoutConnection:s.layoutConnection})}),g(h,function(e){var i=e.waypoints[0],r=e.target;c("connection.reconnectStart",t,r,e)&&n.reconnectStart(e,t,i,{layoutConnection:s.layoutConnection})})},Gf.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;!1!==e.hints.layoutConnection&&(g(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),g(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})})),t.removeShape(n)},Gf.prototype.execute=function(e){},Gf.prototype.revert=function(e){},Gf.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},Gf.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},Gf.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Wf.$inject=["modeling"],Wf.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Wf.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;g(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:Bf(e,t,n)})}),g(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Df(e,t,n)})})},Wf.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return I(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Vf.$inject=["modeling"],Vf.prototype.preExecute=function(e){var t=this._modeling,n=e.resizingShapes,i=e.delta,r=e.direction;g(n,function(e){var n=function(e,t,n){var i=n.x,r=n.y;switch(t){case"n":return{x:e.x,y:e.y+r,width:e.width,height:e.height-r};case"s":return{x:e.x,y:e.y,width:e.width,height:e.height+r};case"w":return{x:e.x+i,y:e.y,width:e.width-i,height:e.height};case"e":return{x:e.x,y:e.y,width:e.width+i,height:e.height};default:throw new Error("unrecognized direction: "+t)}}(e,r,i);t.resizeShape(e,n)})},Vf.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},Vf.prototype.execute=function(e){},Vf.prototype.revert=function(e){},Uf.$inject=["modeling"],Uf.prototype.execute=function(e){var t,n=e.shape,i=n.children;return e.oldChildrenVisibility=(t={},i.forEach(function(e){t[e.id]=e.hidden}),t),n.collapsed=!n.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(i,n.collapsed),[n].concat(i)},Uf.prototype.revert=function(e){var t,n=e.shape,i=e.oldChildrenVisibility,r=n.children;return t=i,r.forEach(function(e){e.hidden=t[e.id]}),n.collapsed=!n.collapsed,[n].concat(r)},qf.$inject=["modeling"],qf.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Kf(i,t),Yf(n,t),t.host=n,t},qf.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Kf(n,t),Yf(i,t,r),t},Xf.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},Xf.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Zf.$inject=["eventBus","elementFactory","commandStack"],Zf.prototype.getHandlers=function(){return{"shape.append":mf,"shape.create":_f,"shape.delete":Rf,"shape.move":$f,"shape.resize":Wf,"shape.replace":Gf,"shape.toggleCollapse":Uf,spaceTool:Vf,"label.create":Ef,"connection.create":yf,"connection.delete":Cf,"connection.move":Mf,"connection.layout":Pf,"connection.updateWaypoints":Xf,"connection.reconnectStart":Hf,"connection.reconnectEnd":Hf,"elements.create":gf,"elements.move":Ff,"elements.delete":Tf,"elements.distribute":Af,"elements.align":ff,"element.updateAttachment":qf}},Zf.prototype.registerHandlers=function(e){g(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Zf.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},Zf.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Zf.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Zf.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},Zf.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Zf.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var a={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",a),a.connection},Zf.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,a,s=(r=r||{}).attach;e=this._create("shape",e),s?(o=n.parent,a=n):o=n;var c={position:t,shape:e,parent:o,parentIndex:i,host:a,hints:r};return this._commandStack.execute("shape.create",c),c.shape},Zf.prototype.createElements=function(e,t,n,i,r){l(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},Zf.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},Zf.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,attach:r.attach};return this._commandStack.execute("shape.append",o),o.shape},Zf.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Zf.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Zf.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Zf.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Zf.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Zf.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Zf.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},Zf.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Zf.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Zf.prototype.reconnectStart=function(e,t,n,i){var r={connection:e,newSource:t,dockingOrPoints:n,hints:i||{}};this._commandStack.execute("connection.reconnectStart",r)},Zf.prototype.reconnectEnd=function(e,t,n,i){var r={connection:e,newTarget:t,dockingOrPoints:n,hints:i||{}};this._commandStack.execute("connection.reconnectEnd",r)},Zf.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Zf.prototype._create=function(e,t){return t instanceof Ft?t:this._elementFactory.create(e,t)},Zf.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};var Qf="id",Jf="di",em={width:0,height:0};function tm(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function nm(e,t){return Qf in e&&e[Qf]!==t[Qf]}function im(e,t){g(t,function(t,n){n!==Jf?e.set(n,t):e.di&&function(e,t){g(t,function(t,n){e.set(n,t)})}(e.di,t)})}tm.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],tm.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=I({},e);return rm.forEach(function(n){n in e&&(t[n]=ki(t[n]))}),t}(e.properties),c=e.oldProperties||function(e,t){return x(S(t),function(n,i){return n[i]=i!==Jf?e.get(i):function(e,t){return x(t,function(t,n){return t[n]=e.get(n),t},{})}(e.di,S(t.di)),n},{})}(a,s);return nm(s,a)&&(o.unclaim(a[Qf]),r.updateId(t,s[Qf]),o.claim(s[Qf],a)),"default"in s&&(s.default&&n.push(r.get(s.default.id)),a.default&&n.push(r.get(a.default.id))),im(a,s),e.oldProperties=c,e.changed=n,n},tm.prototype.postExecute=function(e){var t=e.element.label,n=t&&ki(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,em)}},tm.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,a=this._moddle.ids;return im(r,i),nm(n,r)&&(a.unclaim(n[Qf]),o.updateId(t,i[Qf]),a.claim(i[Qf],r)),e.changed};var rm=["default"];function om(e,t){this._canvas=e,this._modeling=t}function am(e,t){this._modeling=e,this._spaceTool=t}function sm(e,t){this._modeling=e,this._translate=t}function cm(e,t){this._modeling=e,this._spaceTool=t}om.$inject=["canvas","modeling"],om.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,a=o.$parent,s=o.di;t.setRootElement(n,!0),xt(a.rootElements,i),i.$parent=a,bt(a.rootElements,o),o.$parent=null,o.di=null,s.bpmnElement=i,i.di=s,e.oldRoot=r},om.prototype.revert=function(e){var t=this._canvas,n=e.newRoot.businessObject,i=e.oldRoot,r=i.businessObject,o=n.$parent,a=n.di;t.setRootElement(i,!0),bt(o.rootElements,n),n.$parent=null,xt(o.rootElements,r),r.$parent=o,n.di=null,a.bpmnElement=r,r.di=a},am.$inject=["modeling","spaceTool"],am.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Vp(i),a=o===i,s=a?i:i.parent;Wp(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+30,y:i.y,width:i.width-30,height:i.height},s);var c=[];lt(o,function(e){return c.push(e),e===i?[]:v(e.children,function(e){return e!==i})});var p="top"===r?-120:120,l="top"===r?i.y:i.y+i.height,u=l+("top"===r?10:-10),h="top"===r?"n":"s",d=t.calculateAdjustments(c,"y",p,u);t.makeSpace(d.movingShapes,d.resizingShapes,{x:0,y:p},h),e.newLane=n.createShape({type:"bpmn:Lane"},{x:i.x+(a?30:0),y:l-("top"===r?120:0),width:i.width-(a?30:0),height:120},s)},sm.$inject=["modeling","translate"],sm.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Wp(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+30,y:s,width:i.width-30,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},cm.$inject=["modeling","spaceTool"],cm.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},cm.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Up(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},cm.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=to(e),p=jp(to(t),c),l=Vp(e),u=[],h=[];lt(l,function(e){return u.push(e),(Ai(e,"bpmn:Lane")||Ai(e,"bpmn:Participant"))&&h.push(e),e.children}),(p.bottom||p.top)&&(n=p.bottom||p.top,i=e.y+(p.bottom?e.height:0)+(p.bottom?-10:10),r=p.bottom?"s":"n",o=p.top>0||p.bottom<0?-n:n,a=s.calculateAdjustments(u,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(p.left||p.right)&&(n=p.right||p.left,i=e.x+(p.right?e.width:0)+(p.right?-10:100),r=p.right?"e":"w",o=p.left>0||p.right<0?-n:n,a=s.calculateAdjustments(h,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};function pm(e){this._elementRegistry=e}function lm(e){this._moddle=e}pm.$inject=["elementRegistry"],pm.prototype.computeUpdates=function(e,t){var n={},i=[],r={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(e){return e.parent?function(e){var t=Vp(e);return r[t.id]||(r[t.id]=Gp(t)),r[t.id]}(e).filter(function(t){return n=e,i=to(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=Vp(e);t&&!n[t.id]&&(t.children.filter(function(e){return Ai(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get("lanes").slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get("flowNodeRef").forEach(function(e){i.push({flowNode:e,remove:[t],add:[]})})}),i},pm.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.remove.forEach(function(e){bt(n,e),bt(e.get("flowNodeRef"),t)}),e.add.forEach(function(e){xt(n,e),xt(e.get("flowNodeRef"),t)})})},pm.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.add.forEach(function(e){bt(n,e),bt(e.get("flowNodeRef"),t)}),e.remove.forEach(function(e){xt(n,e),xt(e.get("flowNodeRef"),t)})})},lm.$inject=["moddle"],lm.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},lm.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.unclaim(n):t.claim(n,i)};var um={fill:void 0,stroke:void 0};function hm(e){this._commandStack=e}hm.$inject=["commandStack"],hm.prototype.postExecute=function(e){var t=e.elements,n=e.colors||um,i=this,r={};"fill"in n&&I(r,{fill:n.fill}),"stroke"in n&&I(r,{stroke:n.stroke}),g(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var dm={width:0,height:0};function fm(e,t){function n(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t,n){var i=e.businessObject,r=Bi(i);r&&("categoryValueRef"===r?i.categoryValueRef.value=t:i[r]=t)}(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!dr(n)&&pr(n)&&!lr(n)&&!mm(r)){var o=hr(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i})}},this.execute=function(e){return e.oldLabel=Ni(e.element),n(e.element,e.newLabel)},this.revert=function(e){return n(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,a=n.newBounds,s=n.hints||{};if(dr(r)&&mm(o))!1!==s.removeShape&&e.removeShape(r,{unsetLabel:!1});else if(pr(i)||Ai(i,"bpmn:TextAnnotation")){var c=Ni(r);c&&(void 0===a&&(a=t.getExternalLabelBounds(r,c)),a&&e.resizeShape(r,a,dm))}}}function mm(e){return!e||!e.trim()}function ym(e,t,n,i){Zf.call(this,e,t,n),this._bpmnRules=i}function vm(){}fm.$inject=["modeling","textRenderer"],n(ym,Zf),ym.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ym.prototype.getHandlers=function(){var e=Zf.prototype.getHandlers.call(this);return e["element.updateProperties"]=tm,e["canvas.updateRoot"]=om,e["lane.add"]=am,e["lane.resize"]=cm,e["lane.split"]=sm,e["lane.updateRefs"]=pm,e["id.updateClaim"]=lm,e["element.setColor"]=hm,e["element.updateLabel"]=fm,e},ym.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},ym.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},ym.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ym.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ym.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ym.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ym.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ym.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ym.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},ym.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ym.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ym.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},vm.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||io(t.source||e.source),t.connectionEnd||io(t.target||e.target)]};var gm=20,bm=5,xm=Math.round,_m=20,Em={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function wm(e,t,n){var i,r,o,a=ro(t,e,bm),s=n.split(":")[0],c=xm((t.x-e.x)/2+e.x),p=xm((t.y-e.y)/2+e.y),l=(o=a,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[s].test(o)),u=/h|r|l/.test(s),h=!1;return l?(i=u?{x:c,y:e.y}:{x:e.x,y:p},r=u?"h:h":"v:v"):(r=u?"h:v":"v:h",function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(a,s)?u?(h=p===e.y,i={x:e.x+gm*(/l/.test(s)?-1:1),y:h?p+gm:p}):i={x:(h=c===e.x)?c+gm:c,y:e.y+gm*(/t/.test(s)?-1:1)}:i={x:c,y:p}),{waypoints:Cm(e,i,r).concat(i),directions:r,turnNextDirections:h}}function Sm(e){return e.split(":").reverse().join(":")}function Cm(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Pm(n)){var i=function(e,t,n){return wm(e,t,n)}(e,t,n),r=function(e,t,n){var i=wm(t,e,Sm(n));return{waypoints:i.waypoints.slice().reverse(),directions:Sm(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Cm(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=xm((t.x-e.x)/2+e.x),r=xm((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Tm(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=ro(e,t,Em[o]||0),s=function(e,t){if(Pm(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(a,o);n=n||io(e),i=i||io(t);var c=s.split(":");return function(e,t,n){var i=Cm(e,t,n);return i.unshift(e),i.push(t),Dm(i)}(Mm(n,e,c[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(a)),Mm(i,t,c[1],a),s)}function Rm(e,t,n,i,r,o){var a;return l(n)&&(r=n,o=i,n=io(e),i=io(t)),r=r||[],(a=-1!==(o=I({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=ro(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===r.preserveDocking?Am(o,i,e)?(s[o]=i[o],[{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y,original:{x:void 0!==s.x?s.x:n.x,y:void 0!==s.y?s.y:n.y}},{x:i.x,y:i.y}]):null:Am(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null}(e,t,n,i,o))?a:(a=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return(r=km(e,t,n,r))?r.reverse():null}(t,e,i,r))?a:(a=o.connectionStart&&km(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Tm(e,t,n,i,o))}function Am(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function km(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!y(e,function(t,n){var i=e[n-1];return i&&fr(t,i)<3})}(i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(vr(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(a[1],o,n),(r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(gr(e[i],t,_m)||gr(e[i],n,_m))return e.slice(i);return e}(a,e,t))!==a&&(a=km(e,t,n,r)),a&&vr(a)?null:a}function Pm(e){return e&&/t|r|b|l/.test(e)}function Mm(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Dm(e){return e.reduce(function(t,n,i){return mr(t[t.length-1],e[i+1],n,0)||t.push(n),t},[])}var Bm=40;function Nm(){}function Om(e,t){return Ai(t,"bpmn:Participant")?"source":Ai(e,"bpmn:Participant")?"target":Im(t)?"source":Im(e)?"target":Ai(t,"bpmn:Event")?"target":Ai(e,"bpmn:Event")?"source":null}function jm(e,t){return e?e.original||e:io(t)}function Lm(e,t){return Ai(t,"bpmn:Activity")&&Ai(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Im(e){return Ai(e,"bpmn:SubProcess")&&Pi(e)}function zm(e,t){return e===t}n(Nm,vm),Nm.prototype.layoutConnection=function(e,t){var n,i,r=(t=t||{}).source||e.source,o=t.target||e.target,a=e.waypoints,s=t.connectionStart,c=t.connectionEnd;return s||(s=jm(a&&a[0],r)),c||(c=jm(a&&a[a.length-1],o)),(Ai(e,"bpmn:Association")||Ai(e,"bpmn:DataAssociation"))&&a&&!Lm(r,o)?[].concat([s],a.slice(1,-1),[c]):(Ai(e,"bpmn:MessageFlow")?n=function(e,t){return{preferredLayouts:["straight","v:v"],preserveDocking:Om(e,t)}}(r,o):(Ai(e,"bpmn:SequenceFlow")||Lm(r,o))&&(n=r===o?{preferredLayouts:Vm(r,e)}:Ai(r,"bpmn:BoundaryEvent")?{preferredLayouts:Um(r,o,c)}:Ai(r,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Ai(o,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=Dm(Rm(r,o,s,c,a,n=I(n,t)))),i||[s,c])};var Fm={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},$m={top:"t",right:"r",bottom:"b",left:"l"};function Hm(e){var t=/right|left/.exec(e);return t&&t[0]}function Gm(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Wm(e){return"right"===e||"left"===e}function Vm(e,t){var n=t.waypoints,i=n&&n.length&&ro(n[0],e);return"top"===i?["t:r"]:"right"===i?["r:b"]:"left"===i?["l:t"]:["b:l"]}function Um(e,t,n){var i,r,o=io(e),a=io(t),s=(r=(i=e).host,ro(io(i),r,-10)),c=zm(e.host,t),p=-1!==["top","right","bottom","left"].indexOf(s),l=ro(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return c?function(e,t,n,i,r){var o,a=$m[t?e:Gm(e)];o=t?Wm(e)?qm("y",n,i,r)?"h":"b":qm("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(s,p,e,t,n):[function(e,t,n){if(n)return $m[e];if(zm(Gm(e),Gm(t))||(i=Hm(e),r=Hm(t),Fm[i]===r))return $m[Gm(e)];var i,r;return $m[Hm(e)]}(s,l,p)+":"+function(e,t,n){if(n)return Wm(e)?(i=t,r=Hm(e),o=Fm[r],-1!==i.indexOf(o)||zm(e,t)?"h":"v"):function(e,t){var n=Gm(e),i=Fm[n];return-1!==t.indexOf(i)}(e,t)||zm(e,t)?"v":"h";var i,r,o;return Wm(t)||zm(Gm(e),Gm(t))&&Hm(t)?"h":"v"}(s,l,p)]}function qm(e,t,n,i){var r=Bm;return!(Km(e,i,n,r)||Km(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Km(e,i,io(t),r))}function Km(e,t,n,i){return Math.abs(t[e]-n[e])<i}function Ym(e){return I({original:e.point.original||e.point},e.actual)}function Xm(e,t){this._elementRegistry=e,this._graphicsFactory=t}Xm.$inject=["elementRegistry","graphicsFactory"],Xm.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(Ym(i)),o.push(Ym(r)),o},Xm.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},Xm.prototype._getIntersection=function(e,t,n){return oo(this._getShapePath(e),this._getConnectionPath(t),n)},Xm.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Xm.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Xm.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Zm={__init__:["modeling","bpmnUpdater"],__depends__:[Gh,Sd,Rd,vp,kd,Nd,Fd,Ud,Mo,jl,cf],bpmnFactory:["type",pf],bpmnUpdater:["type",lf],elementFactory:["type",hf],modeling:["type",ym],layouter:["type",Nm],connectionDocking:["type",Xm]},Qm=500,Jm=1250,ey=1500,ty=Math.round;function ny(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i,r){if(u(i)&&(r=i,i=!1),!n.waypoints&&n.parent){var o=function(e){return{x:e.x+ty(e.width/2),y:e.y+ty(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",ey,function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),I(t,{shapes:r=function(e){var t=T(e,"id");return v(e,function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0})}(r),validatedShapes:r,shape:n})}),e.on("shape.move.start",Jm,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1}),e.on("shape.move.move",Qm,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null}),e.on("shape.move.end",function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!1===r)return!1;i.x=ty(i.x),i.y=ty(i.y),0===i.x&&0===i.y||n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})}),e.on("element.mousedown",function(e){var t=fo(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}),this.start=a}ny.$inject=["eventBus","dragging","modeling","selection","rules"];var iy=499,ry="djs-dragging",oy="drop-ok",ay="drop-not-ok",sy="new-parent",cy="attach-ok";function py(e,t,n,i){function r(e){return function(e){return v(e,function(t){return!function(e){return e.waypoints}(t)||y(e,P({id:t.source.id}))&&y(e,P({id:t.target.id}))})}(a(e))}function a(e){var t=ut(e,!0),n=w(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return o(t.concat(n))}function s(e,n){[cy,oy,ay,sy].forEach(function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)})}e.on("shape.move.start",iy,function(e){var s=e.context,c=s.shapes,p=s.allDraggedElements,l=r(c);if(!s.dragGroup){var u=Be("g");xe(u,n.cls("djs-drag-group",["no-events"])),ye(t.getDefaultLayer(),u),s.dragGroup=u}l.forEach(function(e){i.addDragger(e,s.dragGroup)}),g(p=p?o([p,a(c)]):a(c),function(e){t.addMarker(e,ry)}),s.allDraggedElements=p,s.differentParents=1!==function(e){return S(e).length}(T(c,function(e){return e.parent&&e.parent.id}))}),e.on("shape.move.move",iy,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?s(i,cy):t.canExecute&&i&&i.id!==r.id?s(i,sy):s(i,t.canExecute?oy:ay)),Qt(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("shape.move.cleanup",function(e){var n=e.context,i=n.allDraggedElements,r=n.dragGroup;g(i,function(e){t.removeMarker(e,ry)}),r&&Re(r)}),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,ry),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}py.$inject=["eventBus","canvas","styles","previewSupport"];var ly={__depends__:[Eo,Mo,Co,ms,ls,Dc],__init__:["move","movePreview"],move:["type",ny],movePreview:["type",py]};function uy(e,t){this._eventBus=e,this._canvas=t,this._providers=[];var n=this;e.on("tool-manager.update",function(e){var t=e.tool;n.updateToolHighlight(t)}),e.on("i18n.changed",function(){n._update()}),e.on("diagram.init",function(){n._diagramInitialized=!0,n._providers.length&&(n._init(),n._update())})}uy.$inject=["eventBus","canvas"],uy.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},uy.prototype.getEntries=function(){var e={};return g(this._providers,function(t){g(t.getPaletteEntries(),function(t,n){e[n]=t})}),e},uy.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=ae(uy.HTML_MARKUP);n.appendChild(i),oe.bind(i,".djs-palette-toggle, .entry","click",function(t){var n=t.delegateTarget;if(ue(n,".djs-palette-toggle"))return e.toggle();e.trigger("click",t)}),ie.bind(i,"mousedown",function(e){e.stopPropagation()}),oe.bind(i,".entry","dragstart",function(t){e.trigger("dragstart",t)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},uy.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=U(i);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle("two-column",t),"open"in e&&o.toggle("open",e.open),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},uy.prototype._update=function(){var e=he(".djs-palette-entries",this._container),t=this._entries=this.getEntries();K(e),g(t,function(t,n){var i=t.group||"default",r=he("[data-group="+i+"]",e);r||(r=ae('<div class="group" data-group="'+i+'"></div>'),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),a=ae(o);r.appendChild(a),t.separator||($(a,"data-action",n),t.title&&$(a,"title",t.title),t.className&&function(e,t){var n=U(e);(l(t)?t:t.split(/\s+/g)).forEach(function(e){n.add(e)})}(a,t.className),t.imageUrl&&a.appendChild(ae('<img src="'+t.imageUrl+'">')))}),this.open()},uy.prototype.trigger=function(e,t,n){var i,r,o,a=this._entries,s=t.delegateTarget||t.target;if(!s)return t.preventDefault();(i=a[$(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,d(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},uy.prototype._layoutChanged=function(){this._toggleState({})},uy.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},uy.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},uy.prototype.open=function(){this._toggleState({open:!0})},uy.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},uy.prototype.isActiveTool=function(e){return e&&this._activeTool===e},uy.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=he(".djs-palette-entries",this._container),this._toolsContainer=he("[data-group=tools]",t)),g(this._toolsContainer.children,function(t){var n=t.getAttribute("data-action");if(n){var i=U(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},uy.prototype.isOpen=function(){return U(this._container).has("open")},uy.prototype._getParentContainer=function(){return this._canvas.getContainer()},uy.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var hy={__init__:["palette"],palette:["type",uy]};function dy(e,t,n,i,r,o){this._selection=r,this._dragging=n;var a=this,s=function(e){var n,i=t.getDefaultLayer();xe(n=e.frame=Be("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ye(i,n)},c=function(e){var t=e.frame,n=e.bbox;xe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Re(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",function(){a.activateLasso(t.originalEvent,!0)})}),e.on("lasso.end",function(e){var t=fy(e),n=i.filter(function(e){return e});a.select(n,t)}),e.on("lasso.start",function(e){var t=e.context;t.bbox=fy(e),s(t)}),e.on("lasso.move",function(e){var t=e.context;t.bbox=fy(e),c(t)}),e.on("lasso.cleanup",function(e){var t=e.context;p(t)}),e.on("element.mousedown",1500,function(e){if(function(e){var t=fo(e)||e;return vo(e)&&t.shiftKey}(e))return a.activateLasso(e.originalEvent),!0})}function fy(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}dy.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],dy.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:"crosshair",data:{context:{}}})},dy.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},dy.prototype.select=function(e,t){var n=function(e,t){var n={};return g(e,function(e){var i=e;i.waypoints&&(i=ht(i)),!h(t.y)&&i.x>t.x&&(n[e.id]=e),!h(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(h(t.width)&&h(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:h(t.width)&&h(t.height)||(n[e.id]=e))}),n}(e,t);this._selection.select(C(n))},dy.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},dy.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var my={__depends__:[Kd],__init__:["lassoTool"],lassoTool:["type",dy]},yy=1500;function vy(e,t,n,i,r){this._dragging=n;var o=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",yy,function(e){if(go(e))return this.activateMove(e.originalEvent),!1},this),a&&a.addListener(yy,function(e){function t(e){o.activateMove(e),window.removeEventListener("mousemove",t)}gy(e.keyEvent)&&(o.isActive()||(window.addEventListener("mousemove",t),a.addListener(yy,function e(i){gy(i.keyEvent)&&(window.removeEventListener("mousemove",t),a.removeListener(e,"keyboard.keyup"),n.cancel())},"keyboard.keyup")))},"keyboard.keydown"),e.on("hand.end",function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",function(){this.activateMove(t.originalEvent,{reactivate:!0})},this)},this),e.on("hand.move.move",function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})}),e.on("hand.move.end",function(t){var n=t.context.reactivate;return!go(t)&&n&&e.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}function gy(e){return qo(" ",e)}vy.$inject=["eventBus","canvas","dragging","injector","toolManager"],vy.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:"grab",data:{context:n||{}}})},vy.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},vy.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},vy.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var by={__depends__:[Kd],__init__:["handTool"],handTool:["type",vy]},xy="connect-ok",_y="connect-not-ok";function Ey(e,t,n,i,r,o){var a=this;this._dragging=t,this._rules=o,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(e){var t=e.context,n=e.hover,r=t.canStartConnect=a.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?xy:_y))}),e.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?xy:_y)}),e.on(["global-connect.ended"],function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(a.canStartConnect(i))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,i,r)}),!1})}Ey.$inject=["eventBus","dragging","connect","canvas","toolManager","rules"],Ey.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Ey.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Ey.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Ey.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var wy={__depends__:[vc,ms,ls,Kd],globalConnect:["type",Ey]};function Sy(e,t,n,i,r,o,a,s){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=a,this._translate=s,e.registerProvider(this)}Sy.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Sy.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(I({type:e},a));a&&(r.businessObject.di.isExpanded=a.isExpanded),n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e){var t=i.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=i.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:t});n.start(e,[t,r],{hints:{autoSelect:[r]}})}function u(e){n.start(e,i.createParticipantShape())}return I(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none",c("Create StartEvent")),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none",c("Create EndEvent")),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task",c("Create Task")),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",c("Create DataObjectReference")),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",c("Create DataStoreReference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:c("Create expanded SubProcess"),action:{dragstart:l,click:l}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:u,click:u}},"create.group":p("bpmn:Group","artifact","bpmn-icon-group",c("Create Group"))}),t};var Cy={__depends__:[hy,Gc,cf,my,by,wy,ar],__init__:["paletteProvider"],paletteProvider:["type",Sy]},Ty=250;function Ry(e,t,n,i,r){Za.call(this,e),e.on("shape.move.move",Ty,function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a&&a.replacements?function(e){g(e.canExecute.replacements,function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var c=t.get(a);I(s,{x:c.x,y:c.y});var p=n.createShape(s);i.addShape(p,c.parent);var l=he('[data-element-id="'+Rs(c.id)+'"]',e.dragGroup);l&&xe(l,{display:"none"});var u=r.addDragger(p,e.dragGroup);e.visualReplacements[a]=u,i.removeShape(p)}})}(o):function(e){var t=e.visualReplacements;g(t,function(n,i){var r=he('[data-element-id="'+Rs(i)+'"]',e.dragGroup);r&&xe(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]})}(o)})}Ry.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],n(Ry,Za);var Ay={__depends__:[Dc],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ry]},ky=1250,Py=40,My=20,Dy=20,By=["x","y"],Ny=Math.abs;function Oy(e,t){e.on(["connect.hover","connect.move","connect.end"],ky,function(e){var n=e.context,i=n.source,r=n.target;if(!e.originalEvent||!Uo(e.originalEvent)){n.initialSourcePosition||(n.initialSourcePosition=n.sourcePosition);var o=t.allowed("connection.create",{source:i,target:r});r&&o&&function(e,t,n){By.forEach(function(i){var r,o=Iy(i,t);e[i]<t[i]+n?r=t[i]+n:e[i]>t[i]+o-n&&(r=t[i]+o-n),r&&rc(e,i,r)})}(e,r,function(e){return Ai(e,"bpmn:Task")?10:My}(r)),r&&function(e,t){return E(t,function(t){return Ly(e,t)})}(o,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(n.sourcePosition=nc(i),ja(r,["bpmn:Event","bpmn:Gateway"])&&jy(e,nc(r)),Ai(r,"bpmn:Task")&&function(e,t){_(By,function(n){var i=e[n],r=Iy(n,t);return i>t[n]+Dy&&i<t[n]+r-Dy})&&jy(e,nc(t))}(e,r),Ai(i,"bpmn:BoundaryEvent")&&r===i.host&&function(e,t,n){var i=nc(t),r=ro(i,n,-10),o=[];/top|bottom/.test(r)&&o.push("x");/left|right/.test(r)&&o.push("y");o.forEach(function(t){var n,r=e[t];Ny(r-i[t])<Py&&(n=r>i[t]?i[t]+Py:i[t]-Py,rc(e,t,n))})}(e,i,r)):Ly(o,"bpmn:MessageFlow")?(Ai(i,"bpmn:Event")&&(n.sourcePosition=nc(i)),Ai(r,"bpmn:Event")&&jy(e,nc(r))):n.sourcePosition=n.initialSourcePosition}})}function jy(e,t){rc(e,"x",t.x),rc(e,"y",t.y)}function Ly(e,t){return e&&e.type===t}function Iy(e,t){return"x"===e?t.width:t.height}function zy(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Fy(e){this._snapValues={}}Oy.$inject=["eventBus","rules"],zy.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zy.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},zy.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},zy.prototype.getSnapLocations=function(){return this._snapLocations},zy.prototype.setSnapLocations=function(e){this._snapLocations=e},zy.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Fy).initDefaults(this._defaultSnaps),n},Fy.prototype.add=function(e,t){var n=this._snapValues[e];n||(n=this._snapValues[e]={x:[],y:[]}),-1===n.x.indexOf(t.x)&&n.x.push(t.x),-1===n.y.indexOf(t.y)&&n.y.push(t.y)},Fy.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],Qs(r-e)<=n)return r}(e[n],r[n],i)},Fy.prototype.initDefaults=function(e){var t=this;g(e||{},function(e,n){g(e,function(e){t.add(n,e)})})};var $y=1250;function Hy(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],function(e){i.initSnap(e)}),t.on(["create.move","create.end","shape.move.move","shape.move.end"],$y,function(e){var t=e.context,r=t.shape,o=t.snapContext,a=t.target;if((!e.originalEvent||!Uo(e.originalEvent))&&!ic(e)&&a){var s=o.pointsForTarget(a);s.initialized||((s=i.addSnapTargetPoints(s,r,a)).initialized=!0),n.snap(e,s)}}),t.on(["create.cleanup","shape.move.cleanup"],function(){n.hide()})}function Gy(e){return!!e.labelTarget}Hy.$inject=["elementRegistry","eventBus","snapping"],Hy.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new zy);var a=(t=n.get(r.id)?nc(r,e):{x:e.x+nc(r).x,y:e.y+nc(r).y}).x-r.width/2,s=t.y-r.height/2,c=t.x+r.width/2,p=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),Gy(r)?o:(o.setSnapOrigin("top-left",{x:a-e.x,y:s-e.y}),o.setSnapOrigin("bottom-right",{x:c-e.x,y:p-e.y}),o)},Hy.prototype.addSnapTargetPoints=function(e,t,n){return g(this.getSnapTargets(t,n),function(n){if(Gy(n))Gy(t)&&e.add("mid",nc(n));else if(n.waypoints){if(n.waypoints.length<3)return;g(n.waypoints.slice(1,-1),function(t){e.add("mid",t)})}else{e.add("mid",nc(n))}}),h(t.x)&&h(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",nc(t)),e):e},Hy.prototype.getSnapTargets=function(e,t){return oc(t).filter(function(e){return!e.hidden})};var Wy=1500;function Vy(e,t,n){n.invoke(Hy,this),t.on(["create.move","create.end"],Wy,Uy),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Wy,function(t){var n=t.context,i=n.target,r=n.shape;i&&function(t,n,i){return"attach"===e.canAttach([t],n,null,i)}(r,i,t)&&!ic(t)&&function(e,t){var n=to(t),i=Wh(e,t);/top/.test(i)?rc(e,"y",n.top):/bottom/.test(i)&&rc(e,"y",n.bottom);/left/.test(i)?rc(e,"x",n.left):/right/.test(i)&&rc(e,"x",n.right)}(t,i)})}function Uy(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&rc(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&rc(e,"y",e.y)}}function qy(e,t){return-1!==e.indexOf(t)}n(Vy,Hy),Vy.$inject=["bpmnRules","eventBus","injector"],Vy.prototype.initSnap=function(e){var t=Hy.prototype.initSnap.call(this,e),n=e.shape;return g(n.outgoing,function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",{x:i.x-e.x,y:i.y-e.y})}),g(n.incoming,function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",{x:i.x-e.x,y:i.y-e.y})}),Ai(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},Vy.prototype.addSnapTargetPoints=function(e,t,n){Hy.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);return g(i,function(n){var i;(function(e){if(Ai(e,"bpmn:SubProcess")&&Pi(e))return!0;return Ai(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every(function(e){return Ai(e,i)})))&&(e.add("top-left",ec(n)),e.add("bottom-right",tc(n)))}),g(t.incoming,function(t){qy(i,t.source)||e.add("mid",io(t.source));var n=t.waypoints[0];e.add(t.id+"-docking",n.original||n)}),g(t.outgoing,function(t){qy(i,t.target)||e.add("mid",io(t.target));var n=t.waypoints[t.waypoints.length-1];e.add(t.id+"-docking",n.original||n)}),Ai(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},Vy.prototype.getSnapTargets=function(e,t){return Hy.prototype.getSnapTargets.call(this,e,t).filter(function(e){return!Ai(e,"bpmn:Lane")})};var Ky=1250;function Yy(e,t){var n=this;e.on(["resize.start"],function(e){n.initSnap(e)}),e.on(["resize.move","resize.end"],Ky,function(e){var i=e.context,r=i.shape,o=r.parent,a=i.direction,s=i.snapContext;if(!(e.originalEvent&&Uo(e.originalEvent)||ic(e))){var c=s.pointsForTarget(o);c.initialized||((c=n.addSnapTargetPoints(c,r,o,a)).initialized=!0),t.snap(e,c)}}),e.on(["resize.cleanup"],function(){t.hide()})}function Xy(e,t){return"nw"===t?ec(e):"ne"===t?{x:(n=e).x+n.width,y:n.y}:"sw"===t?function(e){return{x:e.x,y:e.y+e.height}}(e):tc(e);var n}Yy.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new zy);var o=Xy(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Yy.prototype.addSnapTargetPoints=function(e,t,n,i){return g(this.getSnapTargets(t,n),function(t){e.add("corner",tc(t)),e.add("corner",ec(t))}),e.add("corner",Xy(t,i)),e},Yy.$inject=["eventBus","snapping"],Yy.prototype.getSnapTargets=function(e,t){return oc(t).filter(function(t){return!(n=t,i=e,n.host===i||function(e){return!!e.waypoints}(t)||function(e){return!!e.hidden}(t)||function(e){return!!e.labelTarget}(t));var n,i})};var Zy=1e3;function Qy(e){this._canvas=e,this._asyncHide=O(j(this.hide,this),Zy)}Qy.$inject=["canvas"],Qy.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:ic(e,"x"),y:ic(e,"y")};g(i,function(i){var o=n.getSnapOrigin(i),a={x:e.x+o.x,y:e.y+o.y};if(g(["x","y"],function(e){var n;r[e]||void 0!==(n=t.snap(a,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})}),r.x&&r.y)return!1}),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),g(["x","y"],function(t){var n=r[t];u(n)&&rc(e,t,n.originValue)})},Qy.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Be("path");return xe(n,{d:"M0,0 L0,0"}),Ce(n).add("djs-snap-line"),ye(t,n),{update:function(t){h(t)?xe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):xe(n,{display:"none"})}}},Qy.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Qy.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Qy.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Qy.prototype.hide=function(){g(this._snapLines,function(e){e.update()})};var Jy={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Hy],resizeSnapping:["type",Yy],snapping:["type",Qy]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Oy],createMoveSnapping:["type",Vy]};function ev(e,t,n,i){this._open=!1,this._results=[],this._eventMaps=[],this._canvas=e,this._eventBus=t,this._overlays=n,this._selection=i,this._container=ae(ev.BOX_HTML),this._searchInput=he(ev.INPUT_SELECTOR,this._container),this._resultsContainer=he(ev.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function tv(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+ev.RESULT_HIGHLIGHT_CLASS+'">'+ks(e.matched)+"</strong>":t+=ks(e.normal)}),""!==t?t:null}(t),r=ae(n);r.innerHTML=i,e.appendChild(r)}ev.$inject=["canvas","eventBus","overlays","selection"],ev.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:oe.bind(t,n,i,r)})}t(document,"html","click",function(t){e.close()}),t(this._container,ev.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,ev.RESULT_SELECTOR,"mouseover",function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,ev.RESULT_SELECTOR,"click",function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,ev.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),t(this._container,ev.INPUT_SELECTOR,"keyup",function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))})},ev.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){oe.unbind(e.el,e.type,e.listener)})},ev.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}});var i=he(ev.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},ev.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ev.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},ev.prototype._clearResults=function(){K(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},ev.prototype._getCurrentResult=function(){return he(ev.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ev.prototype._createResultNode=function(e,t){var n=ae(ev.RESULT_HTML);return e.primaryTokens.length>0&&tv(n,e.primaryTokens,ev.RESULT_PRIMARY_HTML),tv(n,e.secondaryTokens,ev.RESULT_SECONDARY_HTML),$(n,ev.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ev.prototype.registerProvider=function(e){this._searchProvider=e},ev.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,U(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ev.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,U(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},ev.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ev.prototype.isOpen=function(){return this._open},ev.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&U(t).remove(ev.RESULT_SELECTED_CLASS);var n=$(e,ev.RESULT_ID_ATTRIBUTE),i=this._results[n].element;U(e).add(ev.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ev.prototype._select=function(e){var t=$(e,ev.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this.close(),this._resetOverlay(),this._centerViewbox(n),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},ev.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=ht(e),i={x:n.x+n.width/2-t.outer.width/2,y:n.y+n.height/2-t.outer.height/2,width:t.outer.width,height:t.outer.height};this._canvas.viewbox(i),this._canvas.zoom(t.scale)},ev.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+ev.OVERLAY_CLASS+'"></div>'}}(ht(e));this._overlayId=this._overlays.add(e,t)}},ev.CONTAINER_SELECTOR=".djs-search-container",ev.INPUT_SELECTOR=".djs-search-input input",ev.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ev.RESULT_SELECTOR=".djs-search-result",ev.RESULT_SELECTED_CLASS="djs-search-result-selected",ev.RESULT_SELECTED_SELECTOR="."+ev.RESULT_SELECTED_CLASS,ev.RESULT_ID_ATTRIBUTE="data-result-id",ev.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ev.OVERLAY_CLASS="djs-search-overlay",ev.BOX_HTML='<div class="djs-search-container djs-draggable djs-scrollable"><div class="djs-search-input"><input type="text"/></div><div class="djs-search-results"></div></div>',ev.RESULT_HTML='<div class="djs-search-result"></div>',ev.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ev.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var nv={__depends__:[Io,Mo],searchPad:["type",ev]};function iv(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function rv(e){return v(e,function(e){return!!e.matched}).length>0}function ov(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}iv.$inject=["elementRegistry","searchPad","canvas"],iv.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(e){return!e.labelTarget});return n=v(n,function(e){return e!==t}),n=k(n=v(n=w(n,function(t){return{primaryTokens:ov(Ni(t),e),secondaryTokens:ov(t.id,e),element:t}}),function(e){return rv(e.primaryTokens)||rv(e.secondaryTokens)}),function(e){return Ni(e.element)+e.element.id})};var av={__depends__:[nv],__init__:["bpmnSearch"],bpmnSearch:["type",iv]};function sv(e){Vo.call(this,e),this.on("import.parse.complete",function(e){e.error||this._collectIds(e.definitions,e.context)},this),this.on("diagram.destroy",function(){this.get("moddle").ids.clear()},this)}return n(sv,Vo),sv.Viewer=Vo,sv.NavigatedViewer=ba,sv.prototype.createDiagram=function(e){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>',e)},sv.prototype._createModdle=function(e){var t=Vo.prototype._createModdle.call(this,e);return t.ids=new r([32,36,1]),t},sv.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},sv.prototype._interactionModules=[ta,ua,ka,ga],sv.prototype._modelingModules=[Oa,Xa,ds,is,lc,vc,bc,Yp,pp,Gc,el,ol,Sl,Tl,Al,Nl,Zl,Zm,ly,Cy,Ay,Gl,Jy,av],sv.prototype._modules=[].concat(sv.prototype._modules,sv.prototype._interactionModules,sv.prototype._modelingModules),sv});