UNPKG

431 kBJavaScriptView Raw
1/*! bpmn-js - bpmn-modeler v3.0.1 | 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.BpmnJS=t()}(this,function(){"use strict";var i="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e(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}}),n=e(function(e){var c=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i<Math.floor(n);i++){o=Math.floor(Math.random()*t).toString(t)+o}if(r){var a=Math.pow(t,r);o=Math.floor(Math.random()*a).toString(t)+o}var s=parseInt(o,t);return s!==1/0&&s>=Math.pow(2,e)?c(e,t):o};c.rack=function(i,r,o){var n=function(e){var t=0;do{if(10<t++){if(!o)throw new Error("too many ID collisions, use more bits");i+=o}var n=c(i,r)}while(Object.hasOwnProperty.call(a,n));return a[n]=e,n},a=n.hats={};return n.get=function(e){return n.hats[e]},n.set=function(e,t){return n.hats[e]=t,n},n.bits=i||128,n.base=r||16,n}});function r(e){if(!(this instanceof r))return new r(e);e=e||[128,36,1],this._seed=e.length?n.rack(e[0],e[1],e[2]):e}var o=r;function h(e){return Array.prototype.concat.apply([],e)}r.prototype.next=function(e){return this._seed(e||!0)},r.prototype.nextPrefixed=function(e,t){for(var n;n=e+this.next(!0),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 p(e){return void 0===e}function c(e){return void 0!==e}function g(e){return"[object Array]"===a.call(e)}function R(e){return"[object Object]"===a.call(e)}function l(e){return"[object Number]"===a.call(e)}function u(e){return"[object Function]"===a.call(e)}function d(e){return"[object String]"===a.call(e)}function x(e,t){return s.call(e,t)}function P(e,n){var i;return n=B(n),M(e,function(e,t){if(n(e,t))return i=e,!1}),i}function m(e,n){n=B(n);var i=g(e)?-1:void 0;return M(e,function(e,t){if(n(e,t))return i=t,!1}),i}function k(e,n){var i=[];return M(e,function(e,t){n(e,t)&&i.push(e)}),i}function M(e,t){if(!p(e)){var n=g(e)?L:O;for(var i in e){if(x(e,i))if(!1===t(e[i],n(i)))return}}}function f(e,n){return p(e)?[]:(function(e){if(!g(e))throw new Error("must supply array")}(e),n=B(n),e.filter(function(e,t){return!n(e,t)}))}function _(e,n,i){return M(e,function(e,t){i=n(i,e,t)}),i}function y(e,i){return _(e,function(e,t,n){return e&&i(t,n)},!0)}function v(e,t){return!!P(e,t)}function b(e,n){var i=[];return M(e,function(e,t){i.push(n(e,t))}),i}function E(e){return e&&Object.keys(e)||[]}function w(e){return b(e,function(e){return e})}function S(e,i){var r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{};return i=N(i),M(e,function(e){var t=i(e)||"_",n=r[t];n||(n=r[t]=[]),n.push(e)}),r}function C(t){t=N(t);for(var n={},e=arguments.length,i=Array(1<e?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return M(i,function(e){return S(e,t,n)}),b(n,function(e,t){return e[0]})}var T=C;function A(e,o){o=N(o);var a=[];return M(e,function(e,t){for(var n=o(e,t),i={d:n,v:e},r=0;r<a.length;r++){if(n<a[r].d)return void a.splice(r,0,i)}a.push(i)}),b(a,function(e){return e.v})}function D(e){return function(n){return y(e,function(e,t){return n[t]===e})}}function N(t){return u(t)?t:function(e){return e[t]}}function B(t){return u(t)?t:function(e){return e===t}}function O(e){return e}function L(e){return Number(e)}var I=Array.prototype.slice;function j(t,n){var i;return function(){var e=I.call(arguments);i&&clearTimeout(i),i=setTimeout(function(){t.apply(void 0,function(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)}(e))},n)}}function z(e,t){return e.bind(t)}var F=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};function $(e){for(var t=arguments.length,n=Array(1<t?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return F.apply(void 0,[e].concat(n))}function H(t,e){var n={},i=Object(t);return M(e,function(e){e in i&&(n[e]=t[e])}),n}function W(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)}var G=[].indexOf,V=function(e,t){if(G)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},U=/\s+/,q=Object.prototype.toString;function K(e){return new Y(e)}function Y(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function X(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e}Y.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~V(t,e)||t.push(e),this.el.className=t.join(" "),this},Y.prototype.remove=function(e){if("[object RegExp]"==q.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=V(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},Y.prototype.removeMatching=function(e){for(var t=this.array(),n=0;n<t.length;n++)e.test(t[n])&&this.remove(t[n]);return this},Y.prototype.toggle=function(e,t){return this.list?void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},Y.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(U);return""===e[0]&&e.shift(),e},Y.prototype.has=Y.prototype.contains=function(e){return this.list?this.list.contains(e):!!~V(this.array(),e)};var Z=Element.prototype,Q=Z.matchesSelector||Z.webkitMatchesSelector||Z.mozMatchesSelector||Z.msMatchesSelector||Z.oMatchesSelector,J=function(e,t){if(Q)return Q.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;++i)if(n[i]==e)return!0;return!1};var ee,te=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(J(i,t))return i;i=i.parentNode}},ne=window.addEventListener?"addEventListener":"attachEvent",ie=window.removeEventListener?"removeEventListener":"detachEvent",re="addEventListener"!==ne?"on":"",oe={bind:function(e,t,n,i){return e[ne](re+t,n,i||!1),n},unbind:function(e,t,n,i){return e[ie](re+t,n,i||!1),n}},ae=["focus","blur"],se={bind:function(n,i,e,r,t){return-1!==ae.indexOf(e)&&(t=!0),oe.bind(n,e,function(e){var t=e.target||e.srcElement;e.delegateTarget=te(t,i,!0,n),e.delegateTarget&&r.call(n,e)},t)},unbind:function(e,t,n,i){-1!==ae.indexOf(t)&&(i=!0),oe.unbind(e,t,n,i)}},ce=function(e,t){if("string"!=typeof e)throw new TypeError("String expected");t||(t=document);var n=/<([\w:]+)/.exec(e);if(!n)return t.createTextNode(e);e=e.replace(/^\s+|\s+$/g,"");var i=n[1];if("body"==i){var r=t.createElement("html");return r.innerHTML=e,r.removeChild(r.lastChild)}var o=le[i]||le._default,a=o[0],s=o[1],c=o[2];(r=t.createElement("div")).innerHTML=s+e+c;for(;a--;)r=r.lastChild;if(r.firstChild==r.lastChild)return r.removeChild(r.firstChild);var p=t.createDocumentFragment();for(;r.firstChild;)p.appendChild(r.removeChild(r.firstChild));return p},pe=!1;"undefined"!=typeof document&&((ee=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',pe=!ee.getElementsByTagName("link").length,ee=void 0);var le={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:pe?[1,"X<div>","</div>"]:[0,"",""]};le.td=le.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],le.option=le.optgroup=[1,'<select multiple="multiple">',"</select>"],le.thead=le.tbody=le.colgroup=le.caption=le.tfoot=[1,"<table>","</table>"],le.polyline=le.ellipse=le.polygon=le.circle=le.text=le.line=le.path=le.rect=le.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var ue="undefined"!=typeof Element?Element.prototype:{},he=ue.matches||ue.matchesSelector||ue.webkitMatchesSelector||ue.mozMatchesSelector||ue.msMatchesSelector||ue.oMatchesSelector,de=function(e,t){if(!e||1!==e.nodeType)return!1;if(he)return he.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 me(e,t){return(t=t||document).querySelector(e)}function fe(e,t){return(t=t||document).querySelectorAll(e)}function ye(e){e.parentNode&&e.parentNode.removeChild(e)}function ve(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 ge(e,t){return ve(t,e),e}var be=2,xe={"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":be,"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":be,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function _e(e,t,n){var i=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),r=xe[i];r?(r===be&&"number"==typeof n&&(n=String(n)+"px"),e.style[i]=n):e.setAttributeNS(null,t,n)}function Ee(e,t,n){if("string"==typeof t){if(void 0===n)return i=e,xe[r=t]?i.style[r]:i.getAttributeNS(null,r);_e(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)_e(e,i,t[i])}(e,t);var i,r;return e}function we(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 Se=/\s+/,Ce=Object.prototype.toString;function Te(e){return void 0!==e}function Ae(e){return new Re(e)}function Re(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function Pe(e){var t=e.parentNode;return t&&t.removeChild(e),e}function ke(e){for(var t;t=e.firstChild;)Pe(t);return e}Re.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~we(t,e)||t.push(e),Te(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Re.prototype.remove=function(e){if("[object RegExp]"===Ce.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=we(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Re.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},Re.prototype.toggle=function(e,t){return this.list?Te(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e):Te(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this},Re.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Se);return""===e[0]&&e.shift(),e},Re.prototype.has=Re.prototype.contains=function(e){return this.list?this.list.contains(e):!!~we(this.array(),e)};var Me={svg:"http://www.w3.org/2000/svg"},De='<svg xmlns="'+Me.svg+'"';function Ne(e){var t=!1;"<svg"===e.substring(0,4)?-1===e.indexOf(Me.svg)&&(e=De+e.substring(4)):(e=De+">"+e+"</svg>",t=!0);var n,i,r=(n=e,(i=new DOMParser).async=!1,i.parseFromString(n,"text/xml"));if(!t)return r;for(var o=document.createDocumentFragment(),a=r.firstChild;a.firstChild;)o.appendChild(a.firstChild);return o}function Be(e,t){var n;return n="<"===e.charAt(0)?(n=Ne(e).firstChild,document.importNode(n,!0)):document.createElementNS(Me.svg,e),t&&Ee(n,t),n}var Oe=Be("svg");function Le(e,t,n,i,r,o){var a=Oe.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:i,e:r,f:o}}return function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}(a,e)}function Ie(e){return e?Oe.createSVGTransformFromMatrix(e):Oe.createSVGTransform()}var je=/([&<>]{1})/g,ze=/([\n\r"]{1})/g,Fe={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function $e(e,t){return e.replace(t,function(e,t){return Fe[t]||t})}function He(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push($e(e.textContent,je));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,'="',$e(o.value,ze),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)He(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",$e(e.nodeValue,je),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function We(e,t){var n=Ne(t);if(ke(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o<r.length;o++)ve(r[o],e)}}function Ge(e,t){if(void 0===t)return function(e){for(var t=e.firstChild,n=[];t;)He(t,n),t=t.nextSibling;return n.join("")}(e);try{We(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}function Ve(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}function Ue(e,t){var n=e.transform.baseVal;if(1===arguments.length)return n.consolidate();t.length?function(e,t){var n,i;for(e.clear(),n=0;i=t[n];n++)e.appendItem(Ve(e,i));e.consolidate()}(n,t):n.initialize(Ve(n,t))}var qe=/^class /;function Ke(e){return"[object Array]"===Object.prototype.toString.call(e)}function Ye(){var e=Array.prototype.slice.call(arguments);1===e.length&&Ke(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var Xe=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Ze=/^function\s*[^(]*\(\s*([^)]*)\)/m,Qe=/\/\*([^*]*)\*\//m;function Je(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t,n=e.toString().match((t=e,qe.test(t.toString())?Xe:Ze));return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(Qe))?n[1].trim():e.trim()})||[]}var et="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 tt(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 nt(e,o){o=o||{get:function(e,t){if(a.push(e),!1===t)return null;throw c('No provider for "'+e+'"!')}};var a=[],h=this._providers=Object.create(o._providers||null),s=this._instances=Object.create(null),d=s.injector=this,c=function(e){var t=a.join(" -> ");return a.length=0,new Error(t?e+" (Resolving: "+t+")":e)},n=function e(t,n){if(!h[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),r=e(i.shift());i.length;)r=r[i.shift()];return r}if(it(s,t))return s[t];if(it(h,t)){if(-1!==a.indexOf(t))throw a.push(t),c("Cannot resolve circular dependency!");return a.push(t),s[t]=h[t][0](h[t][1]),a.pop(),s[t]}return o.get(t,n)},p=function(e){var t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!Ke(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Ye(e.slice())}return{fn:e,dependencies:(e.$inject||Je(e)).map(function(e){return it(t,e)?t[e]:n(e)})}},t=function(e){var t=p(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(tt(n))))},i=function(e,t,n){var i=p(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(tt(r)))},m=function(t){return Ye(function(e){return t.get(e)})},l={factory:i,type:t,value:function(e){return e}};e.forEach(function(i){function r(e,t){return"value"!==e&&Ke(t)&&(t=Ye(t.slice())),t}if(i instanceof function(){var n=[];this.factory=function(e,t){return n.push([e,"factory",t]),this},this.value=function(e,t){return n.push([e,"value",t]),this},this.type=function(e,t){return n.push([e,"type",t]),this},this.forEach=function(e){n.forEach(e)}})i.forEach(function(e){var t=e[0],n=e[1],i=e[2];h[t]=[l[n],r(n,i),n]});else if("object"===(void 0===i?"undefined":et(i)))if(i.__exports__){var e=Object.keys(i).reduce(function(e,t){return"__"!==t.substring(0,2)&&(e[t]=i[t]),e},Object.create(null)),t=new nt((i.__modules__||[]).concat([e]),d),n=Ye(function(e){return t.get(e)});i.__exports__.forEach(function(e){h[e]=[n,e,"private",t]})}else Object.keys(i).forEach(function(e){if("private"!==i[e][2]){var t=i[e][0],n=i[e][1];h[e]=[l[t],r(t,n),t]}else h[e]=i[e]})}),this.get=n,this.invoke=i,this.instantiate=t,this.createChild=function(e,t){if(t&&t.length){var n,i,r,o,a=Object.create(null),s=Object.create(null),c=[],p=[],l=[];for(var u in h)n=h[u],-1!==t.indexOf(u)&&("private"===n[2]?(i=c.indexOf(n[3]),a[u]=-1===i?(r=n[3].createChild([],t),o=m(r),c.push(n[3]),p.push(r),l.push(o),[o,u,"private",r]):[l[i],u,"private",p[i]]):a[u]=[n[2],n[1]],s[u]=!0),"factory"!==n[2]&&"type"!==n[2]||!n[1].$scope||t.forEach(function(e){-1!==n[1].$scope.indexOf(e)&&(a[u]=[n[2],n[1]],s[e]=!0)});t.forEach(function(e){if(!s[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),e.unshift(a)}return new nt(e,d)}}function it(e,t){return Object.hasOwnProperty.call(e,t)}var rt=1e3;function ot(e,t){var o=this;t=t||rt,e.on(["render.shape","render.connection"],t,function(e,t){var n=e.type,i=t.element,r=t.gfx;if(o.canRender(i))return"render.shape"===n?o.drawShape(r,i):o.drawConnection(r,i)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(o.canRender(t))return"render.getShapePath"===e.type?o.getShapePath(t):o.getConnectionPath(t)})}function at(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")}function st(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}function ct(e,t){var n=Be("polyline");return Ee(n,{points:st(e)}),t&&Ee(n,t),n}ot.prototype.canRender=function(){},ot.prototype.drawShape=function(){},ot.prototype.drawConnection=function(){},ot.prototype.getShapePath=function(){},ot.prototype.getConnectionPath=function(){};function pt(e,t){ot.call(this,e,1),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2})}t(pt,ot),pt.prototype.canRender=function(){return!0},pt.prototype.drawShape=function(e,t){var n=Be("rect");return Ee(n,{x:0,y:0,width:t.width||0,height:t.height||0}),Ee(n,this.SHAPE_STYLE),ge(e,n),n},pt.prototype.drawConnection=function(e,t){var n=ct(t.waypoints,this.CONNECTION_STYLE);return ge(e,n),n},pt.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width;return at([["M",t,n],["l",i,0],["l",0,e.height],["l",-i,0],["z"]])},pt.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 at(r)},pt.$inject=["eventBus","styles"];var lt={__init__:["defaultRenderer"],defaultRenderer:["type",pt],styles:["type",function(){var i={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},r=this;this.cls=function(e,t,n){return $(this.style(t,n),{class:e})},this.style=function(e,t){g(e)||t||(t=e,e=[]);var n=_(e,function(e,t){return $(e,i[t]||{})},{});return t?$(n,t):n},this.computeStyle=function(e,t,n){return g(t)||(n=t,t=[]),r.style(t||[],$({},n,e||{}))}}]};function ut(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n}function ht(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 dt(e,t){return e&&t?e.indexOf(t):-1}function mt(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function ft(e,i,r){r=r||0,g(e)||(e=[e]),M(e,function(e,t){var n=i(e,t,r);g(n)&&n.length&&ft(n,i,r+1)})}function yt(e,t){return r=!t,o=-1,a=[],s=[],ft(e,function(e,t,n){mt(a,e,r);var i=e.children;if((-1===o||n<o)&&i&&mt(s,i,r))return i}),a;var r,o,a,s}function vt(e,a){var s,c,p,l;return a=!!a,g(e)||(e=[e]),M(e,function(e){var t=e;e.waypoints&&!a&&(t=vt(e.waypoints,!0));var n=t.x,i=t.y,r=t.height||0,o=t.width||0;(n<s||void 0===s)&&(s=n),(i<c||void 0===c)&&(c=i),(p<n+o||void 0===p)&&(p=n+o),(l<i+r||void 0===l)&&(l=i+r)}),{x:s,y:c,height:l-c,width:p-s}}function gt(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"}function bt(e,t){return $({},e||{},t||{})}function xt(e,t){return Math.round(e*t)/t}function _t(e){return l(e)?e+"px":e}function Et(e,t,n){var i=Be("g");Ae(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]||null),i}var wt={shape:["x","y","width","height"],connection:["waypoints"]};function St(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}function Ct(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}St.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"],St.prototype._init=function(e){var t,n,i,r=this._eventBus,o=this._container=(n=(t=$({},{width:"100%",height:"100%"},t=e)).container||document.body,(i=document.createElement("div")).setAttribute("class","djs-container"),$(i.style,{position:"relative",overflow:"hidden",width:_t(t.width),height:_t(t.height)}),n.appendChild(i),i),a=this._svg=Be("svg");Ee(a,{width:"100%",height:"100%"}),ge(o,a);var s=this._viewport=Et(a,"viewport");!(this._layers={})!==e.deferUpdate&&(this._viewboxChanged=j(z(this._viewboxChanged,this),300)),r.on("diagram.init",function(){r.fire("canvas.init",{svg:a,viewport:s})},this),r.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),r.on("diagram.destroy",500,this._destroy,this),r.on("diagram.clear",500,this._clear,this)},St.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},St.prototype._clear=function(){var n=this;this._elementRegistry.getAll().forEach(function(e){var t=gt(e);"root"===t?n.setRootElement(null,!0):n._removeElement(e,t)}),delete this._cachedViewbox},St.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},St.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},St.prototype._createLayer=function(e,n){n||(n=0);var t=_(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:Et(this._viewport,"layer-"+e,t),index:n}},St.prototype.getContainer=function(){return this._container},St.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(M([i.gfx,i.secondaryGfx],function(e){e&&(n?Ae(e).add(t):Ae(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},St.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},St.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},St.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Ae(this.getGraphics(e)).has(t)},St.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},St.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},St.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},St.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=wt[e];if(!y(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},St.prototype._setParent=function(e,t,n){ht(t.children,e,n),e.parent=t},St.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},St.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},St.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},St.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),ut(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},St.prototype.removeShape=function(e){return this._removeElement(e,"shape")},St.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},St.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},St.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},St.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},St.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,i,r,o,a,s=this._viewport,c=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(c.width/t.width,c.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);Ue(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=Ue(s))?i.matrix:Le(),r=xt(n.a,1e3),o=xt(-n.e||0,1e3),a=xt(-n.f||0,1e3),t=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:c})},St.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=$({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Ct(t,n)}),{x:n.e,y:n.f}},St.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),xt(i.a,1e3)):this.viewbox(e).scale;var n,i},St.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return n=0<=o.x&&0<=o.y&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?{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),{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},St.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 o=t?(n=$(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),i.multiply(r)):c.scale(e),Ct(this._viewport,o),o},St.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},St.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}},St.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Tt="data-element-id";function At(e){this._elements={},this._eventBus=e}At.$inject=["eventBus"],At.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),Ee(t,Tt,i),n&&Ee(n,Tt,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},At.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(Ee(i.gfx,Tt,""),i.secondaryGfx&&Ee(i.secondaryGfx,Tt,""),delete t[n])},At.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)},At.prototype.get=function(e){var t;t="string"==typeof e?e:e&&Ee(e,Tt);var n=this._elements[t];return n&&n.element},At.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},At.prototype.getAll=function(){return this.filter(function(e){return e})},At.prototype.forEach=function(r){var o=this._elements;Object.keys(o).forEach(function(e){var t=o[e],n=t.element,i=t.gfx;return r(n,i)})},At.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},At.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 Rt={extend:function(e,i,t,r){var o=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),i.unset(e,o,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&i.set(e,o,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function Pt(t,n,i){var e=Rt.extend(i[n.name]||[],t,n,i);Object.defineProperty(i,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,i)})}function kt(e,t){if(!(this instanceof kt))return new kt(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}kt.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]}var n,i,r,o,a;t.collection?Pt(this,t,e):(n=this,r=e,o=(i=t).inverse,a=r[i.name],Object.defineProperty(r,i.name,{configurable:i.configurable,enumerable:i.enumerable,get:function(){return a},set:function(e){if(e!==a){var t=a;a=null,t&&n.unset(t,o,r),a=e,n.set(a,o,r)}}}))},kt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return Rt.isExtended(n)||Pt(this,t,e),n},kt.prototype.ensureBound=function(e,t){var n,i;n=e,i=t,Object.prototype.hasOwnProperty.call(n,i.name||i)||this.bind(e,t)},kt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},kt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Mt=kt,Dt=Rt;Mt.Collection=Dt;var Nt=new Mt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Bt=new Mt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ot=new Mt({name:"attachers",collection:!0},{name:"host"}),Lt=new Mt({name:"outgoing",collection:!0},{name:"source"}),It=new Mt({name:"incoming",collection:!0},{name:"target"});function jt(){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)}}),Nt.bind(this,"parent"),Bt.bind(this,"labels"),Lt.bind(this,"outgoing"),It.bind(this,"incoming")}function zt(){jt.call(this),Nt.bind(this,"children"),Ot.bind(this,"host"),Ot.bind(this,"attachers")}function Ft(){zt.call(this)}function $t(){zt.call(this),Bt.bind(this,"labelTarget")}function Ht(){jt.call(this),Lt.bind(this,"source"),It.bind(this,"target")}t(zt,jt),t(Ft,zt),t($t,zt),t(Ht,jt);var Wt={connection:Ht,shape:zt,label:$t,root:Ft};function Gt(){this._uid=12}Gt.prototype.createRoot=function(e){return this.create("root",e)},Gt.prototype.createLabel=function(e){return this.create("label",e)},Gt.prototype.createShape=function(e){return this.create("shape",e)},Gt.prototype.createConnection=function(e){return this.create("connection",e)},Gt.prototype.create=function(e,t){return(t=$({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Wt[e];if(!n)throw new Error("unknown type: <"+e+">");return $(new n,t)}(e,t)};var Vt="__fn",Ut=Array.prototype.slice;function qt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Kt(){}function Yt(e,t,n,i,r){var o=Ie();o.setTranslate(t,n);var a=Ie();a.setRotate(i,0,0);var s=Ie();s.setScale(r||1,r||1),Ue(e,[o,a,s])}function Xt(e,t,n){var i=Ie();i.setTranslate(t,n),Ue(e,i)}function Zt(e,t){var n=Ie();n.setRotate(t,0,0),Ue(e,n)}function Qt(e,t){this._eventBus=e,this._elementRegistry=t}function Jt(e,t,n){t.insertBefore(e,n||t.firstChild)}qt.prototype.on=function(e,t,n,i){if(e=g(e)?e:[e],u(t)&&(i=n,n=t,t=1e3),!l(t))throw new Error("priority must be a number");var r=n;i&&((r=z(n,i))[Vt]=n[Vt]||n);var o=this,a={priority:t,callback:r};e.forEach(function(e){o._addListener(e,a)})},qt.prototype.once=function(e,t,n,i){var r=this;if(u(t)&&(i=n,n=t,t=1e3),!l(t))throw new Error("priority must be a number");function o(){return r.off(e,o),n.apply(i,arguments)}o[Vt]=n,this.on(e,t,o)},qt.prototype.off=function(e,t){e=g(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},qt.prototype.createEvent=function(e){var t=new Kt;return t.init(e),t},qt.prototype.fire=function(e,t){var n,i,r,o;if(o=Ut.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 Kt?t:this.createEvent(t);var a=(o[0]=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}},qt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},qt.prototype._destroy=function(){this._listeners={}},qt.prototype._invokeListeners=function(e,t,n){var i,r,o;for(i=0;(r=n[i])&&!e.cancelBubble;i++)o=this._invokeListener(e,t,r);return o},qt.prototype._invokeListener=function(e,t,n){var i,r,o;try{r=n.callback,o=t,void 0!==(i=r.apply(null,o))&&(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},qt.prototype._addListener=function(e,t){var n,i,r=this._getListeners(e);for(i=0;n=r[i];i++)if(n.priority<t.priority)return void r.splice(i,0,t);r.push(t)},qt.prototype._getListeners=function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t},qt.prototype._removeListener=function(e,t){var n,i,r,o=this._getListeners(e);if(t)for(r=o.length-1;n=o[r];r--)(i=n.callback)!==t&&i[Vt]!==t||o.splice(r,1);else o.length=0},Kt.prototype.stopPropagation=function(){this.cancelBubble=!0},Kt.prototype.preventDefault=function(){this.defaultPrevented=!0},Kt.prototype.init=function(e){$(this,e||{})},Qt.$inject=["eventBus","elementRegistry"],Qt.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=n.parentNode.childNodes[1])||(Ae(t=Be("g")).add("djs-children"),ge(n.parentNode,t)):t=n,t},Qt.prototype._clear=function(e){var t=me(".djs-visual",e);return X(t),t},Qt.prototype._createContainer=function(e,t,n){var i=Be("g");Ae(i).add("djs-group"),void 0!==n?Jt(i,t,t.childNodes[n]):ge(t,i);var r=Be("g");Ae(r).add("djs-element"),Ae(r).add("djs-"+e),ge(i,r);var o=Be("g");return Ae(o).add("djs-visual"),ge(r,o),r},Qt.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},Qt.prototype.updateContainments=function(e){var i=this,r=this._elementRegistry;M(_(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),function(e){var t=e.children;if(t){var n=i._getChildren(e);M(t.slice().reverse(),function(e){Jt(r.getGraphics(e).parentNode,n)})}})},Qt.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Qt.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Qt.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Qt.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Qt.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),Xt(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?Ee(n,"display","none"):Ee(n,"display","block")}},Qt.prototype.remove=function(e){Pe(this._elementRegistry.getGraphics(e).parentNode)};var en={__depends__:[lt],__init__:["canvas"],canvas:["type",St],elementRegistry:["type",At],elementFactory:["type",Gt],eventBus:["type",qt],graphicsFactory:["type",Qt]};function tn(e){var i=[],r=[];function o(e){return 0<=i.indexOf(e)}e.forEach(function e(t){var n;o(t)||((t.__depends__||[]).forEach(e),o(t)||(n=t,i.push(n),(t.__init__||[]).forEach(function(e){r.push(e)})))});var t=new nt(i);return r.forEach(function(e){try{t["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),t}function nn(e,t){var n;this.injector=t=t||tn([{config:["value",n=(n=e)||{}]},en].concat(n.modules||[])),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}nn.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},nn.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var rn,on=(rn=Object.freeze({default:nn}))&&rn.default||rn;function an(){}function sn(e,t){this.model=e,this.properties=t}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);M(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}),M(e,z(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 mn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function fn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,M(e,z(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 fn(e,this.properties),this.typeCache={}}mn.prototype.build=function(){return H(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},mn.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)},mn.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},mn.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},mn.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},mn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},mn.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},mn.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},mn.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")},mn.prototype.hasProperty=function(e){return this.propertiesByName[e]},mn.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(M(i.properties,z(function(e){e=$({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:i});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(i),e[n]=i)},fn.prototype.getPackage=function(e){return this.packageMap[e]},fn.prototype.getPackages=function(){return this.packages},fn.prototype.registerPackage=function(t){t=$({},t);var e=this.packageMap;yn(e,t,"prefix"),yn(e,t,"uri"),M(t.types,z(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},fn.prototype.registerType=function(e,t){var i=dn((e=$({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:$(e.meta||{})})).name,t.prefix),n=i.name,r={};M(e.properties,z(function(e){var t=dn(e.name,i.prefix),n=t.name;un(e.type)||(e.type=dn(e.type,t.prefix).name),$(e,{ns:t,name:n}),r[n]=e},this)),$(e,{ns:i,name:n,propertiesByName:r}),M(e.extends,z(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},fn.prototype.mapTypes=function(i,r,e){var t=un(i.name)?{name:i.name}:this.typeMap[i.name],o=this;function n(e){return a(e,!0)}function a(e,t){var n=dn(e,un(e)?"":i.prefix);o.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+i.name+">");M(t.superClass,e?n:a),r(t,!e),M(t.traits,n)},fn.prototype.getEffectiveDescriptor=function(e){var t=dn(e),n=new mn(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},fn.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=d(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}),M(n,function(e,t){R(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=e(function(e,t){var i,n=function(){function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(e,t,n){return t&&i(e.prototype,t),n&&i(e,n),e}}();"undefined"!=typeof window&&window,
3/**
4 * Tiny stack for browser or server
5 *
6 * @author Jason Mulligan <jason.mulligan@avoidwork.com>
7 * @copyright 2018
8 * @license BSD-3-Clause
9 * @link http://avoidwork.github.io/tiny-stack
10 * @version 1.1.0
11 */
12i=function(){function i(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}
13/**
14 * Tiny stack for browser or server
15 *
16 * @author Jason Mulligan <jason.mulligan@avoidwork.com>
17 * @copyright 2018
18 * @license BSD-3-Clause
19 * @link http://avoidwork.github.io/tiny-stack
20 * @version 1.1.0
21 */(this,i);for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];this.data=[null].concat(t),this.top=this.data.length-1}return n(i,[{key:"clear",value:function(){return this.data.length=1,this.top=0,this}},{key:"empty",value:function(){return 0===this.top}},{key:"length",value:function(){return this.top}},{key:"peek",value:function(){return this.data[this.top]}},{key:"pop",value:function(){var e=void 0;return 0<this.top&&(e=this.data.pop(),this.top--),e}},{key:"push",value:function(e){return this.data[++this.top]=e,this}},{key:"search",value:function(e){var t=this.data.indexOf(e);return-1===t?-1:this.data.length-t}}]),i}(),e.exports=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return new(Function.prototype.bind.apply(i,[null].concat(t)))}}),_n=String.fromCharCode,En=Object.prototype.hasOwnProperty,wn=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,Sn={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function Cn(e,t,n,i){return i?En.call(Sn,i)?Sn[i]:"&"+i+";":_n(t||parseInt(n,16))}function Tn(e){return 3<e.length&&-1!==e.indexOf("&")?e.replace(wn,Cn):e}Object.keys(Sn).forEach(function(e){Sn[e.toUpperCase()]=Sn[e]});var An="http://www.w3.org/2001/XMLSchema-instance",Rn="xsi",Pn="xsi:type",kn="non-whitespace outside of root node";function Mn(e){return new Error(e)}function Dn(e){return"missing namespace for prefix <"+e+">"}function Nn(e){return{get:e,enumerable:!0}}function Bn(e){var t,n={};for(t in e)n[t]=e[t];return n}function On(e){return e+"$uri"}function Ln(){return{line:0,column:0}}function In(e){throw e}function jn(e){if(!this)return new jn(e);var v,w,S,C,n,T,A,R,P,k=e&&e.proxy,i=In,M=Ln,D=!1,N=!1,t=null,B=!1;function O(e){e instanceof Error||(e=Mn(e)),i(t=e,M)}function L(e){n&&(e instanceof Error||(e=Mn(e)),n(e,M))}this.on=function(e,t){if("function"!=typeof t)throw Mn("required args <name, cb>");switch(e){case"openTag":w=t;break;case"text":v=t;break;case"closeTag":S=t;break;case"error":i=t;break;case"warn":n=t;break;case"cdata":C=t;break;case"attention":R=t;break;case"question":A=t;break;case"comment":T=t;break;default:throw Mn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Mn("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[An]=Rn,N=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw Mn("required args <xml=string>");return t=null,function(a){var e,t,n,i,r,o,s,c,p,g,l=N?[]:null,b=N?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[On(n)]=t;return i}(P):null,u=[],x=0,h=!1,d=!1,m=0,f=0,_="",E=0;function y(){if(null!==g)return g;var e,t,n,i,r,o,a,s,c,p,l,u=N&&b.xmlns,h=N&&D?[]:null,d=E,m=_,f=m.length,y={},v={};e:for(;d<f;d++)if(c=!1,!(32===(p=m.charCodeAt(d))||p<14&&8<p)){for((p<65||122<p||90<p&&p<97)&&95!==p&&58!==p&&(L("illegal first char attribute name"),c=!0),l=d+1;l<f;l++)if(!(96<(p=m.charCodeAt(l))&&p<123||64<p&&p<91||47<p&&p<59||46===p||45===p||95===p)){if(32===p||p<14&&8<p){L("missing attribute value"),d=l;continue e}if(61===p)break;L("illegal attribute name char"),c=!0}if("xmlns:xmlns"===(s=m.substring(d,l))&&(L("illegal declaration of xmlns"),c=!0),34===(p=m.charCodeAt(l+1)))-1===(l=m.indexOf('"',d=l+2))&&-1!==(l=m.indexOf("'",d))&&(L("attribute value quote missmatch"),c=!0);else if(39===p)-1===(l=m.indexOf("'",d=l+2))&&-1!==(l=m.indexOf('"',d))&&(L("attribute value quote missmatch"),c=!0);else for(L("missing attribute value quotes"),c=!0,l+=1;l<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++);for(-1===l&&(L("missing closing quotes"),l=f,c=!0),c||(o=m.substring(d,l)),d=l;l+1<f&&!(32===(p=m.charCodeAt(l+1))||p<14&&8<p);l++)d===l&&(L("illegal character after attribute end"),c=!0);if(d=l+1,!c)if(s in v)L("attribute <"+s+"> already defined");else if(v[s]=!0,N)if(D){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Tn(o),t=On(r),!(a=P[e])){if("xmlns"===r||t in b&&b[t]!==e)for(;a="ns"+x++,void 0!==b[a];);else a=r;P[e]=a}b[r]!==a&&(i||(b=Bn(b),i=!0),b[r]=a,"xmlns"===r&&(b[On(a)]=e,u=a),b[t]=e),y[s]=o;continue}h.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=b[s.substring(0,p)])?((s=u===n?s.substr(p+1):n+s.substr(p))===Pn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o),y[s]=o):L(Dn(s.substring(0,p))):y[s]=o;else y[s]=o}if(D)for(d=0,f=h.length;d<f;d++){if(s=h[d++],o=h[d],-1!==(p=s.indexOf(":"))){if(!(n=b[s.substring(0,p)])){L(Dn(s.substring(0,p)));continue}(s=u===n?s.substr(p+1):n+s.substr(p))===Pn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o)}y[s]=o}return g=y}M=function(){for(var e,t=/(\r\n|\r|\n)/g,n=0,i=0,r=0,o=f;r<=m&&(e=t.exec(a))&&(o=e[0].length+e.index,!(m<o));)n+=1,r=o;return{data:-1==m?(i=o,a.substring(f)):0===f?(console.log(m-r),a.substring(f,m)):(i=m-r,-1==f?a.substring(m):a.substring(m,f+1)),line:n,column:i}},k&&(p=Object.create({},{name:Nn(function(){return s}),originalName:Nn(function(){return c}),attrs:Nn(y),ns:Nn(function(){return b})}));for(;-1!==f;){if(-1===(m=60===a.charCodeAt(f)?f:a.indexOf("<",f)))return u.length?O("unexpected end of file"):0===f?O("missing start tag"):f<a.length&&a.substring(f).trim()&&L(kn);if(f!==m)if(u.length){if(v&&(v(a.substring(f,m),Tn,M),B))return}else if(a.substring(f,m).trim()&&(L(kn),B))return;if(33!==(r=a.charCodeAt(m+1)))if(63!==r){if(-1==(f=a.indexOf(">",m+1)))return O("unclosed tag");if(g={},47===r){if(d=!(h=!1),!u.length)return O("missing open tag");if(t=s=u.pop(),i=m+2+t.length,a.substring(m+2,i)!==t)return O("closing tag mismatch");for(;i<f;i++)if(!(32===(r=a.charCodeAt(i))||8<r&&r<14))return O("close tag")}else{if(d=47===a.charCodeAt(f-1)?(t=s=a.substring(m+1,f-1),h=!0):(t=s=a.substring(m+1,f),!(h=!0)),!(96<r&&r<123||64<r&&r<91||95===r||58===r))return O("illegal first char nodeName");for(i=1,n=t.length;i<n;i++)if(!(96<(r=t.charCodeAt(i))&&r<123||64<r&&r<91||47<r&&r<59||45===r||95===r||46==r)){if(32===r||r<14&&8<r){s=t.substring(0,i),g=null;break}return O("invalid nodeName")}d||u.push(s)}if(N){if(e=b,h&&(d||l.push(e),null===g&&(D=-1!==t.indexOf("xmlns",i))&&(E=i,_=t,y(),D=!1)),-1!==(r=(c=s).indexOf(":"))){if(!(o=b[s.substring(0,r)]))return O("missing namespace on <"+c+">");s=s.substr(r+1)}else o=b.xmlns;o&&(s=o+":"+s)}if(h&&(E=i,_=t,w&&(k?w(p,Tn,d,M):w(s,y,Tn,d,M),B)))return;if(d){if(S&&(S(k?p:s,Tn,h,M),B))return;N&&(b=h?e:l.pop())}f+=1}else{if(-1===(f=a.indexOf("?>",m)))return O("unclosed question");if(A&&(A(a.substring(m,f+2),M),B))return;f+=2}else{if(91===(r=a.charCodeAt(m+2))&&"CDATA["===a.substr(m+3,6)){if(-1===(f=a.indexOf("]]>",m)))return O("unclosed cdata");if(C&&(C(a.substring(m+9,f),M),B))return;f+=3;continue}if(45===r&&45===a.charCodeAt(m+3)){if(-1===(f=a.indexOf("--\x3e",m)))return O("unclosed comment");if(T&&(T(a.substring(m+4,f),Tn,M),B))return;f+=3;continue}if(-1===(f=a.indexOf(">",m+1)))return O("unclosed tag");if(R&&(R(a.substring(m,f+1),Tn,M),B))return;f+=1}}}(e),M=Ln,B=!1,t},this.stop=function(){B=!0}}function zn(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var Fn={xsi:"http://www.w3.org/2001/XMLSchema-instance"},$n="xsi:type";function Hn(e){return e.xml&&e.xml.serialize}function Wn(e){return Hn(e)===$n}function Gn(e,t){return zn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Vn(e){return new Error(e)}function Un(e){return e.$descriptor}function qn(e){$(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Vn("expected element");var t,n=this.elementsById,i=Un(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw Vn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Kn(){}function Yn(){}function Xn(){}function Zn(e,t){this.property=e,this.context=t}function Qn(e,t){this.element=t,this.propertyDesc=e}function Jn(){}function ei(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function ti(e,t,n){ei.call(this,e,t,n)}function ni(e,t,n){this.model=e,this.context=n}function ii(e){e instanceof bn&&(e={model:e}),$(this,{lax:!1},e)}Kn.prototype.handleEnd=function(){},Kn.prototype.handleText=function(){},Kn.prototype.handleNode=function(){},(Yn.prototype=Object.create(Kn.prototype)).handleNode=function(){return this},(Xn.prototype=Object.create(Kn.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Zn.prototype=Object.create(Xn.prototype)).handleNode=function(e){if(this.element)throw Vn("expected no sub nodes");return this.element=this.createReference(e),this},Zn.prototype.handleEnd=function(){this.element.id=this.body},Zn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(Qn.prototype=Object.create(Xn.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)},(Jn.prototype=Object.create(Xn.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},(ei.prototype=Object.create(Jn.prototype)).addReference=function(e){this.context.addReference(e)},ei.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Un(t).bodyProperty;n&&void 0!==e&&(e=ln(n.type,e),t.set(n.name,e))},ei.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=Un(n),o=this.context,a=new n({}),s=this.model;return M(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?M(e.split(" "),function(e){o.addReference({element:a,property:n.ns.name,id:e})}):o.addReference({element:a,property:n.ns.name,id:e}):(n?e=ln(n.type,e):"xmlns"!==t&&(i=dn(t,r.ns.prefix),s.getPackage(i.prefix)&&o.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},ei.prototype.getPropertyForNode=function(e){var t,n,i,r,o,a,s,c,p,l,u=dn(e.name),h=this.type,d=this.model,m=Un(h),f=u.name,y=m.propertiesByName[f];if(y)return Wn(y)&&(t=e.attributes[$n])?(i=d,p=dn(t),l=i.getPackage(p.prefix),o=l,a=(r=p).name,s=r.localName,t=(c=o.xml&&o.xml.typePrefix)&&0===s.indexOf(c)?r.prefix+":"+s.slice(c.length):a,$({},y,{effectiveType:Un(n=d.getType(t)).name})):y;var v=d.getPackage(u.prefix);if(v){if(t=Gn(u,v),n=d.getType(t),y=P(m.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return $({},y,{effectiveType:Un(n).name})}else if(y=P(m.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return y;throw Vn("unrecognized element <"+u.name+">")},ei.prototype.toString=function(){return"ElementDescriptor["+Un(this.type).name+"]"},ei.prototype.valueHandler=function(e,t){return new Qn(e,t)},ei.prototype.referenceHandler=function(e){return new Zn(e,this.context)},ei.prototype.handler=function(e){return"Element"===e?new ni(this.model,e,this.context):new ei(this.model,e,this.context)},ei.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?($(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},(ti.prototype=Object.create(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 Vn("unexpected element <"+e.originalName+">");return ei.prototype.createElement.call(this,e)},(ni.prototype=Object.create(Jn.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)},ni.prototype.handleChild=function(e){var t=new ni(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},ni.prototype.handleText=function(e){this.body=this.body||""+e},ni.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ii.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof ei?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t=this.model,a=this.lax,p=new qn($({},e,{rootHandler:r})),o=new jn({proxy:!0}),s=new xn;function c(e,t,n){var i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var s="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return p.addWarning({message:s,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),Vn(s)}r.context=p,s.push(r);var l=/^<\?xml /i,u=/ encoding="([^"]+)"/i,h=/^utf-8$/i;var d=t.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});o.ns(d).on("openTag",function(e,i,t,n){var r=e.attrs||{},o=Object.keys(r).reduce(function(e,t){var n=i(r[t]);return e[t]=n,e},{});!function(e,t){var n=s.peek();try{s.push(n.handleNode(e))}catch(e){c(e,t,a)&&s.push(new Yn)}}({name:e.name,originalName:e.originalName,attributes:o,ns:e.ns},n)}).on("question",function(e){if(l.test(e)){var t=u.exec(e),n=t&&t[1];n&&!h.test(n)&&p.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){s.pop().handleEnd()}).on("cdata",function(e){s.peek().handleText(e)}).on("text",function(e,t){var n;(n=(n=t(e)).trim())&&s.peek().handleText(n)}).on("error",c).on("warn",function(e,t){return c(e,t,!0)}),setTimeout(function(){var t;try{o.parse(n),function(){var e,t,n=p.elementsById,i=p.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=Un(r).propertiesByName[t.property];if(o||p.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var s=r.get(a.name),c=s.indexOf(t);-1===c&&(c=s.length),o?s[c]=o:s.splice(c,1)}else r.set(a.name,o)}}()}catch(e){t=e}var e=r.element;t||e||(t=Vn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)},0)},ii.prototype.handler=function(e){return new ti(this.model,e)};var ri=/<|>|'|"|&|\n\r|\n/g,oi=/<|>|&/g;function ai(t){var n={},i={},r={},o=[],a=[];this.byUri=function(e){return i[e]||t&&t.byUri(e)},this.add=function(e,t){i[e.uri]=e,t?o.push(e):a.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(o,a).filter(function(e){return r[e.uri]})}}function si(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ci(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function pi(e,t){return t.isGeneric?$({localName:t.ns.localName},e):$({localName:(n=t.ns.localName,i=t.$pkg,zn(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var li={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},ui={"<":"lt",">":"gt","&":"amp"};function hi(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function di(e){this.tagName=e}function mi(){}function fi(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(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function xi(r){return r=$({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new gi,i=new bi(n,r.format);if(r.preamble&&i.append('<?xml version="1.0" encoding="UTF-8"?>\n'),(new yi).build(e).serializeTo(i),!t)return n.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()},mi.prototype.serializeValue=mi.prototype.serializeTo=function(e){e.append(this.escape?hi(this.value,oi,ui):this.value)},mi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(oi)&&(this.escape=!0),this},si(fi,mi),fi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},yi.prototype.build=function(e){var t,n,i,r=(this.element=e).$descriptor,o=this.propertyDescriptor,a=r.isGeneric;return t=a?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=o?this.nsPropertyTagName(o):this.nsTagName(r),this.tagName=this.addTagName(this.ns),a||(n=k((i=e).$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!i.hasOwnProperty(t))return!1;var n=i[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)}),this.parseAttributes(k(n,function(e){return e.isAttr})),this.parseContainments(k(n,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,t),this},yi.prototype.nsTagName=function(e){return pi(this.logNamespaceUsed(e.ns),e)},yi.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,$({localName:e.ns.localName},t)},yi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},yi.prototype.nsAttributeName=function(e){var t;if(t=d(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}:$({localName:t.localName},n)},yi.prototype.parseGeneric=function(n){var i=this,r=this.body,o=[];return M(n,function(e,t){"$body"===t?r.push((new mi).build({type:"String"},e)):"$children"===t?M(e,function(e){r.push(new yi(i).build(e))}):0!==t.indexOf("$")&&i.parseNsAttribute(n,t,e)&&o.push({name:t,value:e})}),o},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(i,e){var r=this,t=i.$attrs,o=[];return M(t,function(e,t){var n=r.parseNsAttribute(i,t,e);n&&o.push(n)}),o},yi.prototype.parseGenericAttributes=function(n,e){var i=this;M(e,function(t){if(t.name!==$n)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},yi.prototype.parseContainments=function(e){var o=this,a=this.body,s=this.element;M(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)a.push((new mi).build(n,e[0]));else if(hn(n.type))M(e,function(e){a.push(new fi(o.addTagName(o.nsPropertyTagName(n))).build(n,e))});else if(t)M(e,function(e){a.push(new di(o.addTagName(o.nsPropertyTagName(n))).build(e))});else{var i=Wn(n),r="property"===Hn(n);M(e,function(e){var t;t=i?new vi(o,n):r?new yi(o,n):new yi(o),a.push(t.build(e))})}})},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=Fn[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 i=this,r=this.element;M(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];M(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;i.addAttribute(i.nsAttributeName(e),t)})},yi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ci(e)},yi.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=hi(t,ri,li)),n.push({name:e,value:t})},yi.prototype.serializeAttributes=function(t){var e,n=this.attrs,i=this.namespaces;i&&(n=(e=i,b(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})).concat(n)),M(n,function(e){t.append(" ").append(ci(e.name)).append('="').append(e.value).append('"')})},yi.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==mi;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),M(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("</"+this.tagName+">")),t.appendNewLine()},si(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($n),(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)).fromXML=function(e,t,n,i){d(t)||(i=n,n=t,t="bpmn:Definitions"),u(n)&&(i=n,n={});var r=new ii($({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)};_i.prototype.toXML=function(e,t,n){u(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:"participantRefs",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:"participantRefs",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:["FlowElementsContainer","Collaboration"]},{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($({},Ei,e),t)}function Si(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}var Ci=new Mt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function Ti(e,t){return e.$instanceOf(t)}function Ai(p,l){var u={},h=[];function d(t,n){return function(e){t(e,n)}}function i(e){u[e.id]=e}function o(t,e){try{var n=t.di&&function(e,t){if(e.gfx)throw new Error(l("already rendered {element}",{element:Si(e)}));return p.element(e,t)}(t,e);return i(t),n}catch(e){m(e.message,{element:t,error:e}),console.error(l("failed to import {element}",{element:Si(t)})),console.error(e)}}function m(e,t){p.error(e,t)}function f(e){var t=e.bpmnElement;t?t.di?m(l("multiple DI elements defined for {element}",{element:Si(t)}),{element:t}):(Ci.bind(t,"di"),t.di=e):m(l("no bpmnElement referenced in {element}",{element:Si(e)}),{element:e})}function y(e){var t;f(t=e.plane),M(t.planeElement,n)}function n(e){f(e)}function v(){for(;h.length;)h.shift()()}function g(e,t){T(e,t),_(e.ioSpecification,t),x(e.artifacts,t),i(e)}function b(e,t){o(e,t)}function a(e,t){o(e,t)}function r(e,t){o(e,t)}function s(e,t){o(e,t)}function c(e,t){o(e,t)}function x(e,t){M(e,function(e){Ti(e,"bpmn:Association")?h.push(function(){c(e,t)}):c(e,t)})}function _(e,t){e&&(M(e.dataInputs,d(r,t)),M(e.dataOutputs,d(s,t)))}function E(e,t){T(e,t),x(e.artifacts,t)}function w(e,t){o(e,t)}function S(t,i){h.push(function(){var n,e=o(t,i);t.childLaneSet&&C(t.childLaneSet,e||i),M((n=t).flowNodeRef,function(e){var t=e.get("lanes");t&&t.push(n)})})}function C(e,t){M(e.lanes,d(S,t))}function T(e,t){var n,r;n=e.flowElements,r=t,M(n,function(e){var t,n,i;Ti(e,"bpmn:SequenceFlow")?h.push(function(){o(e,r)}):Ti(e,"bpmn:BoundaryEvent")?h.unshift(function(){o(e,r)}):Ti(e,"bpmn:FlowNode")?(i=o(t=e,n=r),Ti(t,"bpmn:SubProcess")&&E(t,i||n),Ti(t,"bpmn:Activity")&&_(t.ioSpecification,n),h.push(function(){M(t.dataInputAssociations,d(a,n)),M(t.dataOutputAssociations,d(a,n))})):Ti(e,"bpmn:DataObject")||(Ti(e,"bpmn:DataStoreReference")?w(e,r):Ti(e,"bpmn:DataObjectReference")?w(e,r):m(l("unrecognized flowElement {element} in context {context}",{element:Si(e),context:r?Si(r.businessObject):"null"}),{element:e,context:r}))}),e.laneSets&&M(e.laneSets,d(C,t))}function A(e,t){var n=o(e,t),i=e.processRef;i&&g(i,n||t)}return{handleDeferred:v,handleDefinitions:function(e,t){var n=e.diagrams;if(t&&-1===n.indexOf(t))throw new Error(l("diagram not part of bpmn:Definitions"));if(!t&&n&&n.length&&(t=n[0]),!t)throw new Error(l("no diagram to display"));y(t);var i=t.plane;if(!i)throw new Error(l("no plane for {element}",{element:Si(t)}));var r=i.bpmnElement;if(!r){if(!(r=P(e.rootElements,function(e){return Ti(e,"bpmn:Process")||Ti(e,"bpmn:Collaboration")})))throw new Error(l("no process or collaboration to display"));m(l("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Si(i),rootElement:Si(r)})),i.bpmnElement=r,f(i)}var o,a,s,c=(o=r,a=i,p.root(o,a));if(Ti(r,"bpmn:Process"))g(r,c);else{if(!Ti(r,"bpmn:Collaboration"))throw new Error(l("unsupported bpmnElement for {plane}: {rootElement}",{plane:Si(i),rootElement:Si(r)}));M((s=r).participants,d(A)),x(s.artifacts),h.push(function(){var e;M(s.messageFlows,d(b,e))}),k(e.rootElements,function(e){return!u[e.id]&&Ti(e,"bpmn:Process")&&e.laneSets}).forEach(d(g))}v()},handleSubProcess:E,registerDi:f}}function Ri(e,t){var n=Pi(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Pi(e){return e&&e.businessObject||e}function ki(e){return!Ri(e,"bpmn:CallActivity")&&(Ri(e,"bpmn:SubProcess")?!!Pi(e).di.isExpanded:!Ri(e,"bpmn:Participant")||!!Pi(e).processRef)}function Mi(e){return e&&!!Pi(e).triggeredByEvent}function Di(e,t){var n=Pi(e),i=!1;return n.eventDefinitions&&M(n.eventDefinitions,function(e){Ri(e,t)&&(i=!0)}),i}function Ni(t,i,r){return v(t.eventDefinitions,function(e){return e.$type===i&&(n=t,y(r,function(e,t){return n[t]==e}));var n})}function Bi(e){return e.businessObject.di}function Oi(e){return e.businessObject}function Li(e,t){return Bi(e).get("bioc:fill")||t||"white"}function Ii(e,t){return Bi(e).get("bioc:stroke")||t||"black"}var ji=new o;function zi(e,t,r,l,s,a,n){ot.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,d=ji.next(),c={},p=r.computeStyle;function m(e,t){var n=$({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var o=Be("marker");Ee(t.element,n),ge(o,t.element),Ee(o,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var a=me("defs",s._svg);a||(a=Be("defs"),ge(s._svg,a)),ge(a,o),c[e]=o}function f(e,t,n){var i=e+"-"+t+"-"+n+"-"+d;return c[i]||function(e,t,n){var i=e+"-"+t+"-"+n+"-"+d;if("sequenceflow-end"===e){var r=Be("path");Ee(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),m(i,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:n,stroke:n}})}if("messageflow-start"===e){var o=Be("circle");Ee(o,{cx:6,cy:6,r:3.5}),m(i,{element:o,attrs:{fill:t,stroke:n},ref:{x:6,y:6}})}if("messageflow-end"===e){var a=Be("path");Ee(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),m(i,{element:a,attrs:{fill:t,stroke:n,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===e){var s=Be("path");Ee(s,{d:"M 11 5 L 1 10 L 11 15"}),m(i,{element:s,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===e){var c=Be("path");Ee(c,{d:"M 1 5 L 11 10 L 1 15"}),m(i,{element:c,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===e){var p=Be("path");Ee(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),m(i,{element:p,attrs:{fill:t,stroke:n},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===e){var l=Be("path");Ee(l,{d:"M 6 4 L 10 16"}),m(i,{element:l,attrs:{stroke:n},ref:{x:0,y:10},scale:.5})}}(e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){R(i)&&(r=i,i=0),i=i||0,"none"===(r=p(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Be("circle");return Ee(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),Ee(s,r),ge(e,s),s}function v(e,t,n,i,r,o){R(r)&&(o=r,r=0),r=r||0,o=p(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Be("rect");return Ee(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),Ee(a,o),ge(e,a),a}function g(e,t,n){var i=ct(t,n=p(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return ge(e,i),i}function b(e,t,n){n=p(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=Be("path");return Ee(i,{d:t}),Ee(i,n),ge(e,i),i}function i(e,t,n,i){return b(t,n,$({"data-marker":e},i))}function o(n){return function(e,t){return T[n](e,t)}}function x(e){return T[e]}function _(e,t){var n,i=Oi(e),r="bpmn:IntermediateThrowEvent"===(n=i).$type||"bpmn:EndEvent"===n.$type;return Ni(i,"bpmn:MessageEventDefinition")?x("bpmn:MessageEventDefinition")(t,e,r):Ni(i,"bpmn:TimerEventDefinition")?x("bpmn:TimerEventDefinition")(t,e,r):Ni(i,"bpmn:ConditionalEventDefinition")?x("bpmn:ConditionalEventDefinition")(t,e):Ni(i,"bpmn:SignalEventDefinition")?x("bpmn:SignalEventDefinition")(t,e,r):Ni(i,"bpmn:CancelEventDefinition")&&Ni(i,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?x("bpmn:MultipleEventDefinition")(t,e,r):Ni(i,"bpmn:CancelEventDefinition")&&Ni(i,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?x("bpmn:ParallelMultipleEventDefinition")(t,e,r):Ni(i,"bpmn:EscalationEventDefinition")?x("bpmn:EscalationEventDefinition")(t,e,r):Ni(i,"bpmn:LinkEventDefinition")?x("bpmn:LinkEventDefinition")(t,e,r):Ni(i,"bpmn:ErrorEventDefinition")?x("bpmn:ErrorEventDefinition")(t,e,r):Ni(i,"bpmn:CancelEventDefinition")?x("bpmn:CancelEventDefinition")(t,e,r):Ni(i,"bpmn:CompensateEventDefinition")?x("bpmn:CompensateEventDefinition")(t,e,r):Ni(i,"bpmn:TerminateEventDefinition")?x("bpmn:TerminateEventDefinition")(t,e,r):null}function E(e,t,n){n=$({size:{width:100}},n);var i=a.createText(t||"",n);return Ae(i).add("djs-label"),ge(e,i),i}function w(e,t,n){return E(e,Oi(t).name,{box:t,align:n,padding:5,style:{fill:Ii(t,h)}})}function S(e,t,n){Yt(E(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:Ii(n,h)}}),0,-(-1*n.height),270)}function C(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 T=this.handlers={"bpmn:Event":function(e,t,n){return"fillOpacity"in n||(n.fillOpacity=.95),y(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:Li(t,u),stroke:Ii(t,h)};Oi(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round",fill:Li(t,u),stroke:Ii(t,h)});var i=x("bpmn:Event")(e,t,n);return _(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?Ii(t,h):Li(t,u),stroke:n?Li(t,u):Ii(t,h)})},"bpmn:TimerEventDefinition":function(e,t){var n=y(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:Li(t,u),stroke:Ii(t,h)});b(e,l.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:Ii(t,h)});for(var i=0;i<12;i++){var r=l.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),o=t.width/2;b(e,r,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*i+","+t.height/2+","+o+")",stroke:Ii(t,h)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)})},"bpmn:ConditionalEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:Ii(t,h)})},"bpmn:LinkEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)})},"bpmn:ErrorEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)})},"bpmn:CancelEventDefinition":function(e,t,n){var i=b(e,l.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)});return Zt(i,45),i},"bpmn:CompensateEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)})},"bpmn:SignalEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?Ii(t,h):"none",stroke:Ii(t,h)})},"bpmn:MultipleEventDefinition":function(e,t,n){return b(e,l.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?Ii(t,h):"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return b(e,l.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:Ii(t,h),stroke:Ii(t,h)})},"bpmn:EndEvent":function(e,t){var n=x("bpmn:Event")(e,t,{strokeWidth:4,fill:Li(t,u),stroke:Ii(t,h)});return _(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return y(e,t.width,t.height,8,{strokeWidth:4,fill:Ii(t,h),stroke:Ii(t,h)})},"bpmn:IntermediateEvent":function(e,t){var n=x("bpmn:Event")(e,t,{strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)});return y(e,t.width,t.height,3,{strokeWidth:1,fill:Li(t,"none"),stroke:Ii(t,h)}),_(t,e),n},"bpmn:IntermediateCatchEvent":o("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":o("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=.95),v(e,t.width,t.height,10,n)},"bpmn:Task":function(e,t){var n={fill:Li(t,u),stroke:Ii(t,h)},i=x("bpmn:Activity")(e,t,n);return w(e,t,"center-middle"),A(e,t),i},"bpmn:ServiceTask":function(e,t){var n=x("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:Li(t,u)}),b(e,l.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)}),n},"bpmn:UserTask":function(e,t){var n=x("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Li(t,u),stroke:Ii(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Li(t,u),stroke:Ii(t,h)}),b(e,l.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:Ii(t,h),stroke:Ii(t,h)}),n},"bpmn:ManualTask":function(e,t){var n=x("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:Li(t,u),stroke:Ii(t,h)}),n},"bpmn:SendTask":function(e,t){var n=x("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:Ii(t,h),stroke:Li(t,u)}),n},"bpmn:ReceiveTask":function(e,t){var n=Oi(t),i=x("bpmn:Task")(e,t);return b(e,n.instantiate?(y(e,28,28,4.4,{strokeWidth:1}),l.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):l.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),{strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)}),i},"bpmn:ScriptTask":function(e,t){var n=x("bpmn:Task")(e,t);return b(e,l.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:Ii(t,h)}),n},"bpmn:BusinessRuleTask":function(e,t){var n=x("bpmn:Task")(e,t);return Ee(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}})),{strokeWidth:1,fill:Li(t,"#aaaaaa"),stroke:Ii(t,h)}),Ee(b(e,l.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}})),{strokeWidth:1,stroke:Ii(t,h)}),n},"bpmn:SubProcess":function(e,t,n){n=$({fill:Li(t,u),stroke:Ii(t,h)},n);var i=x("bpmn:Activity")(e,t,n),r=ki(t);return Mi(t)&&Ee(i,{strokeDasharray:"1,2"}),w(e,t,r?"center-top":"center-middle"),r?A(e,t):A(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return x("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var n=x("bpmn:SubProcess")(e,t),i=r.style(["no-fill","no-events"],{stroke:Ii(t,h)});return v(e,t.width,t.height,8,3,i),n},"bpmn:CallActivity":function(e,t){return x("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:.95,fill:Li(t,u),stroke:Ii(t,h)},i=x("bpmn:Lane")(e,t,n);ki(t)?(g(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:Ii(t,h)}),S(e,Oi(t).name,t)):E(e,Oi(t).name,{box:t,align:"center-middle",style:{fill:Ii(t,h)}});return!!Oi(t).participantMultiplicity&&x("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=v(e,t.width,t.height,0,$({fill:Li(t,u),fillOpacity:.35,stroke:Ii(t,h)},n)),r=Oi(t);"bpmn:Lane"===r.$type&&S(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=x("bpmn:Gateway")(e,t);return y(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:Li(t,u),stroke:Ii(t,h)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=x("bpmn:Gateway")(e,t),i=l.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return Bi(t).isMarkerVisible&&b(e,i,{strokeWidth:1,fill:Ii(t,h),stroke:Ii(t,h)}),n},"bpmn:ComplexGateway":function(e,t){var n=x("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:Ii(t,h),stroke:Ii(t,h)}),n},"bpmn:ParallelGateway":function(e,t){var n=x("bpmn:Gateway")(e,t);return b(e,l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:Ii(t,h),stroke:Ii(t,h)}),n},"bpmn:EventBasedGateway":function(e,t){var n=Oi(t),i=x("bpmn:Gateway")(e,t);y(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:Ii(t,h)});var r,o,a=n.eventGatewayType,s=!!n.instantiate;if("Parallel"===a){var c=l.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}});Ee(b(e,c),{strokeWidth:1,fill:"none"})}else if("Exclusive"===a){if(!s)Ee(y(e,t.width,t.height,.26*t.height),{strokeWidth:1,fill:"none",stroke:Ii(t,h)});r=l.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),o={strokeWidth:2,fill:Li(t,"none"),stroke:Ii(t,h)},b(e,r,o)}return i},"bpmn:Gateway":function(e,t){var n={fill:Li(t,u),fillOpacity:.95,stroke:Ii(t,h)};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=p(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=Be("polygon");return Ee(s,{points:a}),Ee(s,i),ge(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=C(t),r=Li(t,u),o=Ii(t,h),a=b(e,i,{strokeLinejoin:"round",markerEnd:f("sequenceflow-end",r,o),stroke:Ii(t,h)}),s=Oi(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&Ee(a,{markerStart:f("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&Ee(a,{markerStart:f("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=Oi(t),r=Li(t,u),o=Ii(t,h);return n=$({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:Ii(t,h)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=f("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=f("association-start",r,o)),g(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=Li(t,u),i=Ii(t,h);return x("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=Li(t,u),i=Ii(t,h);return x("bpmn:Association")(e,t,{markerEnd:f("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=Oi(t),i=Bi(t),r=Li(t,u),o=Ii(t,h),a=b(e,C(t),{markerEnd:f("messageflow-end",r,o),markerStart:f("messageflow-start",r,o),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:Ii(t,h)});if(n.messageRef){var s=a.getPointAtLength(a.getTotalLength()/2),c=l.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:s.x,y:s.y}}),p={strokeWidth:1};"initiating"===i.messageVisibleKind?(p.fill="white",p.stroke="black"):(p.fill="#888",p.stroke="white"),b(e,c,p)}return a},"bpmn:DataObject":function(e,t){var n,i,r,o,a,s,c=b(e,l.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:Li(t,u),fillOpacity:.95,stroke:Ii(t,h)}),p=Oi(t);return s=(a=p).dataObjectRef,(a.isCollection||s&&s.isCollection)&&(n=e,r=((i=t).height-16)/i.height,o=l.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:.451,my:r}}),b(n,o,{strokeWidth:2})),c},"bpmn:DataObjectReference":o("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=x("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1}),i},"bpmn:DataOutput":function(e,t){var n=l.getRawPath("DATA_ARROW"),i=x("bpmn:DataObject")(e,t);return b(e,n,{strokeWidth:1,fill:"black"}),i},"bpmn:DataStoreReference":function(e,t){return b(e,l.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:Li(t,u),fillOpacity:.95,stroke:Ii(t,h)})},"bpmn:BoundaryEvent":function(e,t){var n=Oi(t).cancelActivity,i={strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=$({},i,{fillOpacity:1}),o=$({},i,{fill:"none"}),a=x("bpmn:Event")(e,t,r);return y(e,t.width,t.height,3,o),_(t,e),a},"bpmn:Group":function(e,t){var n=Oi(t),i=Bi(t),r=v(e,t.width,t.height,10,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"}),o=n.categoryValueRef||{};if(o.value){var a=i.label?i.label.bounds:t;E(e,o.value,{box:a,style:{fill:Ii(t,h)}})}return r},label:function(e,t){return n=e,r=Oi(i=t),o={width:90,height:30,x:i.width/2+i.x,y:i.height/2+i.y},E(n,r.name,{box:o,fitBox:!0,style:$({},a.getExternalStyle(),{fill:Ii(i,h)})});var n,i,r,o},"bpmn:TextAnnotation":function(e,t){var n=v(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return b(e,l.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:Ii(t,h)}),E(e,Oi(t).text||"",{box:t,align:"left-top",padding:5,style:{fill:Ii(t,h)}}),n},ParticipantMultiplicityMarker:function(e,t){i("participant-multiplicity",e,l.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:Li(t,u),stroke:Ii(t,h)})},SubProcessMarker:function(e,t){Xt(v(e,14,14,0,{strokeWidth:1,fill:Li(t,u),stroke:Ii(t,h)}),t.width/2-7.5,t.height-20),i("sub-process",e,l.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:Li(t,u),stroke:Ii(t,h)})},ParallelMarker:function(e,t,n){i("parallel",e,l.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:Li(t,u),stroke:Ii(t,h)})},SequentialMarker:function(e,t,n){i("sequential",e,l.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:Li(t,u),stroke:Ii(t,h)})},CompensationMarker:function(e,t,n){i("compensation",e,l.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:Li(t,u),stroke:Ii(t,h)})},LoopMarker:function(e,t,n){i("loop",e,l.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:Li(t,u),stroke:Ii(t,h),strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){i("adhoc",e,l.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:Ii(t,h),stroke:Ii(t,h)})}};function A(t,n,e){var i,r=Oi(n),o=e&&-1!==e.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},M(e,function(e){x(e)(t,n,i)}),r.isForCompensation&&x("CompensationMarker")(t,n,i),"bpmn:AdHocSubProcess"===r.$type&&x("AdhocMarker")(t,n,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&x("LoopMarker")(t,n,i),!1===s&&x("ParallelMarker")(t,n,i),!0===s&&x("SequentialMarker")(t,n,i))}this._drawPath=b}t(zi,ot),zi.$inject=["config.bpmnRenderer","eventBus","styles","pathMap","canvas","textRenderer"],zi.prototype.canRender=function(e){return Ri(e,"bpmn:BaseElement")},zi.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},zi.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},zi.prototype.getShapePath=function(e){return Ri(e,"bpmn:Event")?(n=(t=e).x+t.width/2,i=t.y+t.height/2,r=t.width/2,at([["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"]])):Ri(e,"bpmn:Activity")?(a=10,s=(o=e).x,c=o.y,p=o.width,l=o.height,at([["M",s+a,c],["l",p-2*a,0],["a",a,a,0,0,1,a,a],["l",0,l-2*a],["a",a,a,0,0,1,-a,a],["l",2*a-p,0],["a",a,a,0,0,1,-a,-a],["l",0,2*a-l],["a",a,a,0,0,1,a,-a],["z"]])):Ri(e,"bpmn:Gateway")?(h=(u=e).width/2,d=u.height/2,at([["M",u.x+h,u.y],["l",h,d],["l",-h,d],["l",-h,-d],["z"]])):(f=(m=e).x,y=m.y,v=m.width,at([["M",f,y],["l",v,0],["l",0,m.height],["l",-v,0],["z"]]));var t,n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v};var Fi=0,$i={width:150,height:50};function Hi(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 Wi(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=Hi(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return Gi(e,o,r,i);o=Vi(o,i.width,t)}}function Gi(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 Vi(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(1<i.length)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 Ui(e){this._config=$({},{size:$i,padding:Fi,style:{},align:"center-top"},e||{})}Ui.prototype.createText=function(e,t){return this.layoutText(e,t).element},Ui.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},Ui.prototype.layoutText=function(e,t){var n,i,r,o,a=$({},this._config.size,t.box),s=$({},this._config.style,t.style),c=(i=t.align||this._config.align,{horizontal:(r=i.split("-"))[0]||"center",vertical:r[1]||"top"}),p=R(n=void 0!==t.padding?t.padding:this._config.padding)?$({top:0,left:0,right:0,bottom:0},n):{top:n,left:n,right:n,bottom:n},l=t.fitBox||!1,u=function(e){if("fontSize"in e&&"lineHeight"in e)return e.lineHeight*parseInt(e.fontSize,10)}(s),h=e.split(/\r?\n/g),d=[],m=a.width-p.left-p.right,f=Be("text");for(Ee(f,{x:0,y:0}),Ee(f,s),ge(((o=document.getElementById("helper-svg"))||(Ee(o=Be("svg"),{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(o)),o),f);h.length;)d.push(Wi(h,m,f));"middle"===c.vertical&&(p.top=p.bottom=0);var y=_(d,function(e,t,n){return e+(u||t.height)},0)+p.top+p.bottom,v=_(d,function(e,t,n){return t.width>e?t.width:e},0),g=p.top;"middle"===c.vertical&&(g+=(a.height-y)/2),g-=(u||d[0].height)/4;var b=Be("text");return Ee(b,s),M(d,function(e){var t;switch(g+=u||e.height,c.horizontal){case"left":t=p.left;break;case"right":t=(l?v:m)-p.right-e.width;break;default:t=Math.max(((l?v:m)-e.width)/2+p.left,0)}var n=Be("tspan");Ee(n,{x:t,y:g}),n.textContent=e.text,ge(b,n)}),Pe(f),{dimensions:{width:v,height:y},element:b}};function qi(e){var i=$({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(i.fontSize,10)-1,r=$({},i,{fontSize:t},e&&e.externalStyle||{}),o=new Ui({style:i});this.getExternalLabelBounds=function(e,t){var n=o.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});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,t){var n=o.getDimensions(t,{box:e,style:i,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(n.height))}},this.createText=function(e,t){return o.createText(e,t||{})},this.getDefaultStyle=function(){return i},this.getExternalStyle=function(){return r}}qi.$inject=["config.textRenderer"];var Ki=/\{([^}]+)\}/g,Yi=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Xi={__init__:["bpmnRenderer"],bpmnRenderer:["type",zi],textRenderer:["type",qi],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];i=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,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(Ki,function(e,t){return n=e,o=i=a,t.replace(Yi,function(e,t,n,i,r){t=t||i,o&&(t in o&&(o=o[t]),"function"==typeof o&&r&&(o=o()))}),o=(null==o||o==i?n:o)+"";var n,i,o})}}]};var Zi={translate:["value",function(e,n){return n=n||{},e.replace(/{([^}]+)}/g,function(e,t){return n[t]||"{"+t+"}"})}]},Qi={width:90,height:20},Ji=15;function er(e){return Ri(e,"bpmn:Event")||Ri(e,"bpmn:Gateway")||Ri(e,"bpmn:DataStoreReference")||Ri(e,"bpmn:DataObjectReference")||Ri(e,"bpmn:SequenceFlow")||Ri(e,"bpmn:MessageFlow")}function tr(e){return rr(e.label)}function nr(e){var t,n,i,r,o=e.length/2-1,a=e[Math.floor(o)],s=e[Math.ceil(o+.01)],c=(n=(t=e).length/2-1,i=t[Math.floor(n)],r=t[Math.ceil(n+.01)],{x:i.x+(r.x-i.x)/2,y:i.y+(r.y-i.y)/2}),p=Math.atan((s.y-a.y)/(s.x-a.x)),l=c.x,u=c.y;return Math.abs(p)<Math.PI/2?u-=Ji:l+=Ji,{x:l,y:u}}function ir(e){return e.waypoints?nr(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Qi.height/2}}function rr(e){return e&&e.labelTarget}function or(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}function ar(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=or(e,t);return Math.abs(r/o)<=i}var sr=2;function cr(e,t){return Math.abs(e.x-t.x)<=sr?"h":Math.abs(e.y-t.y)<=sr&&"v"}function pr(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 lr(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}}
22/**
23 * This file contains portions that got extraced from Snap.svg (licensed Apache-2.0).
24 *
25 * @see https://github.com/adobe-webplatform/Snap.svg/blob/master/src/path.js
26 */var ur="hasOwnProperty",hr=/,?([a-z]),?/gi,dr=parseFloat,mr=Math,fr=mr.PI,yr=mr.min,vr=mr.max,gr=mr.pow,br=mr.abs,xr=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,_r=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function Er(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 wr(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[ur](n)&&(t[n]=wr(e[n]));return t}function Sr(t){var n=Sr.ps=Sr.ps||{};return n[t]?n[t].sleep=100:n[t]={sleep:100},setTimeout(function(){for(var e in n)n[ur](e)&&e!=t&&(n[e].sleep--,!n[e].sleep&&delete n[e])}),n[t]}function Cr(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:mr.min(n,i)/2,r2:mr.max(n,i)/2,r0:mr.sqrt(n*n+i*i)/2,path:function(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=Tr,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function Tr(){return this.join(",").replace(hr,"$1")}function Ar(e){var t=wr(e);return t.toString=Tr,t}function Rr(e,t,n,i,r,o,a,s,c){var p=1-c,l=gr(p,3),u=gr(p,2),h=c*c,d=h*c,m=e+2*c*(n-e)+h*(r-2*n+e),f=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:m,y:f},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*mr.atan2(m-y,f-v)/fr}}function Pr(e,t,n,i,r,o,a,s){Er(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,m,f,y=[],v=[[],[]],g=0;g<2;++g)if(l=0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,3*i-3*t),br(c)<1e-12){if(br(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=mr.sqrt(m),m<0||(0<(h=(-p+f)/(2*c))&&h<1&&y.push(h),0<(d=(-p-f)/(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:yr.apply(0,v[0]),y:yr.apply(0,v[1])},max:{x:vr.apply(0,v[0]),y:vr.apply(0,v[1])}}}.apply(null,e);return Cr(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function kr(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Mr(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 Dr(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=1<c?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 m=p*l[d]+p,f=Mr(m,e,n,r,a),y=Mr(m,t,i,o,s),v=f*f+y*y;h+=u[d]*mr.sqrt(v)}return p*h}function Nr(e,t,n,i,r,o,a,s){if(!(vr(e,n)<yr(r,a)||yr(e,n)>vr(r,a)||vr(t,i)<yr(o,s)||yr(t,i)>vr(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<+yr(e,n).toFixed(2)||u>+vr(e,n).toFixed(2)||u<+yr(r,a).toFixed(2)||u>+vr(r,a).toFixed(2)||h<+yr(t,i).toFixed(2)||h>+vr(t,i).toFixed(2)||h<+yr(o,s).toFixed(2)||h>+vr(o,s).toFixed(2)))return{x:p,y:l}}}}function Br(e,t,n){var i,r,o=Pr(e),a=Pr(t);if(r=a,i=Cr(i=o),!(kr(r=Cr(r),i.x,i.y)||kr(r,i.x2,i.y)||kr(r,i.x,i.y2)||kr(r,i.x2,i.y2)||kr(i,r.x,r.y)||kr(i,r.x2,r.y)||kr(i,r.x,r.y2)||kr(i,r.x2,r.y2)||(i.x<r.x2&&i.x>r.x||r.x<i.x2&&r.x>i.x)&&(i.y<r.y2&&i.y>r.y||r.y<i.y2&&r.y>i.y)))return n?0:[];for(var s=~~(Dr.apply(0,e)/5),c=~~(Dr.apply(0,t)/5),p=[],l=[],u={},h=n?0:[],d=0;d<s+1;d++){var m=Rr.apply(0,e.concat(d/s));p.push({x:m.x,y:m.y,t:d/s})}for(d=0;d<c+1;d++)m=Rr.apply(0,t.concat(d/c)),l.push({x:m.x,y:m.y,t:d/c});for(d=0;d<s;d++)for(var f=0;f<c;f++){var y=p[d],v=p[d+1],g=l[f],b=l[f+1],x=br(v.x-y.x)<.01?"y":"x",_=br(b.x-g.x)<.01?"y":"x",E=Nr(y.x,y.y,v.x,v.y,g.x,g.y,b.x,b.y);if(E){if(u[E.x.toFixed(0)]==E.y.toFixed(0))continue;u[E.x.toFixed(0)]=E.y.toFixed(0);var w=y.t+br((E[x]-y[x])/(v[x]-y[x]))*(v.t-y.t),S=g.t+br((E[_]-g[_])/(b[_]-g[_]))*(b.t-g.t);0<=w&&w<=1&&0<=S&&S<=1&&(n?h++:h.push({x:E.x,y:E.y,t1:w,t2:S}))}}return h}function Or(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,+(180<r-i),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=Tr,c}function Lr(e){var t=Sr(e);if(t.abs)return Ar(t.abs);if(Er(e,"array")&&Er(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=Sr(e);if(t.arr)return wr(t.arr);var o={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},a=[];return Er(e,"array")&&Er(e[0],"array")&&(a=wr(e)),a.length||String(e).replace(xr,function(e,t,n){var i=[],r=t.toLowerCase();if(n.replace(_r,function(e,t){t&&i.push(+t)}),"m"==r&&2<i.length&&(a.push([t].concat(i.splice(0,2))),r="l",t="m"==t?"l":"L"),"o"==r&&1==i.length&&a.push([t,i[0]]),"r"==r)a.push([t].concat(i));else for(;i.length>=o[r]&&(a.push([t].concat(i.splice(0,o[r]))),o[r]););}),a.toString=Sr.toString,t.arr=wr(a),a}(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 m=[r,o].concat(l.slice(1)),f=2,y=m.length;f<y;f++)m[f]=+m[f]+r,m[++f]=+m[f]+o;i.pop(),i=i.concat(Fr(m,u));break;case"O":i.pop(),(m=Or(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(Or(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(f=1,y=l.length;f<y;f++)p[f]=+l[f]+(f%2?r:o)}else if("R"==n)m=[r,o].concat(l.slice(1)),i.pop(),i=i.concat(Fr(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=Or(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(Or(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=Tr,t.abs=Ar(i),i}function Ir(e,t,n,i){return[e,t,n,i,n,i]}function jr(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 zr(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*fr/180,f=fr/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*mr.cos(n)-t*mr.sin(n),y:e*mr.sin(n)+t*mr.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[ur](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):(1e3<=r.length&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t)),d?d(i[n]):i[n]});if(p)T=p[0],A=p[1],S=p[2],C=p[3];else{e=(l=v(e,t,-f)).x,t=l.y;var g=(e-(s=(l=v(s,c,-f)).x))/2,b=(t-(c=l.y))/2,x=g*g/(n*n)+b*b/(i*i);1<x&&(n*=x=mr.sqrt(x),i*=x);var _=n*n,E=i*i,w=(o==a?-1:1)*mr.sqrt(br((_*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=mr.asin(((t-C)/i).toFixed(9)),A=mr.asin(((c-C)/i).toFixed(9));(T=e<S?fr-T:T)<0&&(T=2*fr+T),(A=s<S?fr-A:A)<0&&(A=2*fr+A),a&&A<T&&(T-=2*fr),!a&&T<A&&(A-=2*fr)}var R=A-T;if(br(R)>m){var P=A,k=s,M=c;A=T+m*(a&&T<A?1:-1),y=zr(s=S+n*mr.cos(A),c=C+i*mr.sin(A),n,i,r,0,a,k,M,[A,P,S,C])}R=A-T;var D=mr.cos(T),N=mr.sin(T),B=mr.cos(A),O=mr.sin(A),L=mr.tan(R/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*D],$=[s+I*O,c-j*B],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 W=[],G=0,V=(y=[F,$,H].concat(y).join().split(",")).length;G<V;G++)W[G]=G%2?v(y[G-1],y[G],f).y:v(y[G],y[G+1],f).x;return W}function Fr(e,t){for(var n=[],i=0,r=e.length;i<r-2*!t;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 $r(e,t){var n=!t&&Sr(e);if(!t&&n.curve)return Ar(n.curve);for(var o=Lr(e),a=t&&Lr(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r={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(zr.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":r="C"==n||"S"==n?(i=2*t.x-t.bx,2*t.y-t.by):(i=t.x,t.y),e=["C",i,r].concat(e.slice(1));break;case"T":t.qy="Q"==n||"T"==n?(t.qx=2*t.x-t.qx,2*t.y-t.qy):(t.qx=t.x,t.y),e=["C"].concat(jr(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(jr(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(Ir(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(Ir(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(Ir(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(Ir(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(7<e[t].length){e[t].shift();for(var n=e[t];n.length;)l[t]="A",a&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=vr(o.length,a&&a.length||0)}},p=function(e,t,n,i,r){e&&t&&"M"==e[r][0]&&"M"!=t[r][0]&&(t.splice(r,0,["M",i.x,i.y]),n.bx=0,n.by=0,n.x=e[r][1],n.y=e[r][2],f=vr(o.length,a&&a.length||0))},l=[],u=[],h="",d="",m=0,f=vr(o.length,a&&a.length||0);m<f;m++){o[m]&&(h=o[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),o[m]=s(o[m],i,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(o,m),a&&(a[m]&&(h=a[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),a[m]=s(a[m],r,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(a,m)),p(o,a,i,r,m),p(a,o,r,i,m);var y=o[m],v=a&&a[m],g=y.length,b=a&&v.length;i.x=y[g-2],i.y=y[g-1],i.bx=dr(y[g-4])||i.x,i.by=dr(y[g-3])||i.y,r.bx=a&&(dr(v[b-4])||r.x),r.by=a&&(dr(v[b-3])||r.y),r.x=a&&v[b-2],r.y=a&&v[b-1]}return a||(n.curve=Ar(o)),a?[o,a]:o}var Hr=function(e,t,n){e=$r(e),t=$r(t);for(var i,r,o,a,s,c,p,l,u,h,d=n?0:[],m=0,f=e.length;m<f;m++){var y=e[m];if("M"==y[0])i=s=y[1],r=c=y[2];else{r="C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],u[7]):(u=[i,r,i,r,s,c,s,c],i=s,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{a="C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],h[7]):(h=[o,a,o,a,p,l,p,l],o=p,l);var x=Br(u,h,n);if(n)d+=x;else{for(var _=0,E=x.length;_<E;_++)x[_].segment1=m,x[_].segment2=v,x[_].bez1=u,x[_].bez2=h;d=d.concat(x)}}}}}return d};function Wr(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}}function Gr(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Vr(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Ur(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}}function qr(e){return Gr({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})}function Kr(e,t,n){R(n=n||0)||(n={x:n,y:n});var i=Vr(e),r=Vr(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 Yr(e,t,n){var i=Hr(e,t);return 1===i.length?Gr(i[0]):2===i.length&&or(i[0],i[1])<1?Gr(i[0]):1<i.length?Gr((i=A(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 Xr(e,t){return $({id:e.id,type:e.$type,businessObject:e},t)}function Zr(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 Qr(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textRenderer=o}Qr.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate","textRenderer"],Qr.prototype.add=function(e,t){var n,i,r,o,a,s,c,p,l=e.di,u=this._translate;if(Ri(l,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Xr(e)),this._canvas.setRootElement(n);else if(Ri(l,"bpmndi:BPMNShape")){var h=!ki(e);i=t&&(t.hidden||t.collapsed);var d=e.di.bounds;n=this._elementFactory.createShape(Xr(e,{collapsed:h,hidden:i,x:Math.round(d.x),y:Math.round(d.y),width:Math.round(d.width),height:Math.round(d.height)})),Ri(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ri(e,"bpmn:Lane")&&(r=0),Ri(e,"bpmn:DataStoreReference")&&(a=t,s=qr(d),c=s.x,p=s.y,c>=a.x&&c<=a.x+a.width&&p>=a.y&&p<=a.y+a.height||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!Ri(l,"bpmndi:BPMNEdge"))throw new Error(u("unknown di {di} for element {semantic}",{di:Si(l),semantic:Si(e)}));var m=this._getSource(e),f=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Xr(e,{hidden:i,source:m,target:f,waypoints:(o=e.di.waypoint,b(o,function(e){return{x:e.x,y:e.y}}))})),Ri(e,"bpmn:DataAssociation")&&(t=null),Ri(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return er(e)&&e.name&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Qr.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 Zr(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Qr.prototype.addLabel=function(e,t){var n,i,r,o,a,s,c,p;return o=t,(p=e.di.label)&&p.bounds?(c=p.bounds,s={width:Math.max(Qi.width,c.width),height:c.height},a={x:c.x+c.width/2,y:c.y+c.height/2}):(a=ir(o),s=Qi),n=$({x:a.x-s.width/2,y:a.y-s.height/2},s),(i=e.name)&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(Xr(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!e.name,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)},Qr.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?Zr(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Si(e),side:t}))},Qr.prototype._getSource=function(e){return this._getEnd(e,"source")},Qr.prototype._getTarget=function(e){return this._getEnd(e,"target")},Qr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Jr={__depends__:[Xi,{__depends__:[Zi],bpmnImporter:["type",Qr]}]};function eo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function to(e){return e.originalEvent||e.srcEvent}function no(e,t){eo(e),eo(to(e))}function io(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 ro(e){return!(to(e)||e).button}function oo(e){var t=to(e)||e;return!!ro(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function ao(e){return!0}function so(a,s,e){var r=e.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function o(e,t,n){var i,r,o;(i=t,(u[e]||ro)(i))&&(n?o=s.getGraphics(n):(r=t.delegateTarget||t.target)&&(o=r,n=s.get(o)),o&&n&&!1===a.fire(e,{element:n,gfx:o,originalEvent:t})&&(t.stopPropagation(),t.preventDefault()))}var c={};function p(e){return c[e]}var l={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":ao};var h="svg, .djs-element";function i(e,t,n,i){var r=c[n]=function(e){o(n,e)};i&&(u[n]=i),r.$delegate=se.bind(e,h,t,r)}function d(e,t,n){var i=p(n);i&&se.unbind(e,t,i.$delegate)}a.on("canvas.destroy",function(e){var n;n=e.svg,M(l,function(e,t){d(n,t,e)})}),a.on("canvas.init",function(e){var n;n=e.svg,M(l,function(e,t){i(n,t,e)})}),a.on(["shape.added","connection.added"],function(e){var t,n=e.element,i=e.gfx;n.waypoints?t=ct(n.waypoints):Ee(t=Be("rect"),{x:0,y:0,width:n.width,height:n.height}),Ee(t,r),ge(i,t)}),a.on("shape.changed",500,function(e){var t=e.element;Ee(me(".djs-hit",e.gfx),{width:t.width,height:t.height})}),a.on("connection.changed",function(e){var t,n,i=e.element,r=me(".djs-hit",e.gfx);t=r,n=i.waypoints,Ee(t,{points:st(n)})}),this.fire=o,this.triggerMouseEvent=function(e,t,n){var i=l[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return o(i,t,n)},this.mouseHandler=p,this.registerEvent=i,this.unregisterEvent=d}so.$inject=["eventBus","elementRegistry","styles"];var co={__init__:["interactionEvents"],interactionEvents:["type",so]};function po(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 Ee(n,$({x:10,y:10,width:100,height:100},i)),ge(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,i=me(".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=me(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}po.prototype.updateShapeOutline=function(e,t){Ee(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},po.prototype.updateConnectionOutline=function(e,t){var n=vt(t);Ee(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},po.$inject=["eventBus","styles","elementRegistry"];var lo={__init__:["outline"],outline:["type",po]};function uo(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}uo.$inject=["eventBus"],uo.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})}},uo.prototype.get=function(){return this._selectedElements},uo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},uo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();g(e)||(e=e?[e]:[]),t?M(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 ho="selected";function mo(e,n,t,i){function r(e,t){n.addMarker(e,t)}function o(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){o(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;M(t,function(e){-1===n.indexOf(e)&&o(e,ho)}),M(n,function(e){-1===t.indexOf(e)&&r(e,ho)})})}function fo(e,o,a,i){e.on("create.end",500,function(e){e.context.canExecute&&o.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&o.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=i.get(e.context.shape.id);P(t,function(e){return n.id===e.id})||o.select(n)}),e.on("element.click",function(e){var t=e.element;t===a.getRootElement()&&(t=null);var n=o.isSelected(t),i=1<o.get().length,r=oo(e);if(n&&i)return r?o.deselect(t):o.select(t);n?o.deselect(t):o.select(t,r)})}mo.$inject=["eventBus","canvas","selection","styles"],fo.$inject=["eventBus","selection","canvas","elementRegistry"];var yo={__init__:["selectionVisuals","selectionBehavior"],__depends__:[co,lo],selection:["type",uo],selectionVisuals:["type",mo],selectionBehavior:["type",fo]};function vo(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}vo.prototype.next=function(){return this._prefix+ ++this._counter};var go=new vo("ov");function bo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=go,this._overlayDefaults=$({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=ce('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}function xo(e,t,n){$(e.style,{left:t+"px",top:n+"px"})}function _o(e,t){e.style.display=!1===t?"none":""}function Eo(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}bo.$inject=["config.overlays","eventBus","canvas","elementRegistry"],bo.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k(t.overlays,D({type:e.type})):t.overlays.slice():[]}return e.type?k(this._overlays,D({type:e.type})):e.id?this._overlays[e.id]:null},bo.prototype.add=function(e,t,n){if(R(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=$({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},bo.prototype.remove=function(e){var t=this.get(e)||[];g(t)||(t=[t]);var i=this;M(t,function(e){var t=i._getOverlayContainer(e.element,!0);if(e&&(ye(e.html),ye(e.htmlContainer),delete e.htmlContainer,delete e.element,delete i._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},bo.prototype.show=function(){_o(this._overlayRoot)},bo.prototype.hide=function(){_o(this._overlayRoot,!1)},bo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],X(this._overlayRoot)},bo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=vt(t);i=o.x,r=o.y}xo(n,i,r),W(e.html,"data-container-id",t.id)},bo.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?vt(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?vt(o).height:o.height,s=-1*i.bottom+n);xo(r,a||0,s||0)},bo.prototype._createOverlayContainer=function(e){var t=ce('<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},bo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";Eo(this._overlayRoot,n)},bo.prototype._getOverlayContainer=function(t,e){var n=P(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},bo.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)),d(o)&&(o=ce(o)),n=this._getOverlayContainer(r),(t=ce('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&K(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())},bo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((c(i)&&i>t.scale||c(r)&&r<t.scale)&&(a=!1),_o(o,a)),this._updateOverlayScale(e,t)},bo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(i=!1===o?n=1:(n=o.min,o.max),c(n)&&t.scale<n&&(r=(1/t.scale||1)*n),c(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),c(r)&&(s="scale("+r+","+r+")"),Eo(a,s)},bo.prototype._updateOverlaysVisibilty=function(t){var n=this;M(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},bo.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,r._updateRoot(t),r._updateOverlaysVisibilty(t),r.show()}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;M(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){ye(n.html);var i=r._overlayContainers.indexOf(n);-1!==i&&r._overlayContainers.splice(i,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(M(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&K(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var wo={__init__:["overlays"],overlays:["type",bo]},So='<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>'))+'" />';
27/**
28 * This file must not be changed or exchanged.
29 *
30 * @see http://bpmn.io/license for more information.
31 */function Co(e){return e.join(";")}var To,Ao='<div class="bjs-powered-by-lightbox" style="'+Co(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+Co(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+Co(["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">'+So+'</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 Ro={width:"100%",height:"100%",position:"relative"};function Po(e){return e+(l(e)?"px":"")}function ko(e){
32/**
33 * Adds the project logo to the diagram container as
34 * required by the bpmn.io license.
35 *
36 * @see http://bpmn.io/license
37 *
38 * @param {Element} container
39 */
40var t,n;e=$({},Ro,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=ce('<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">'+So+"</a>"),t.appendChild(n),oe.bind(n,"click",function(e){To||(To=ce(Ao),se.bind(To,".backdrop","click",function(e){document.body.removeChild(To)})),document.body.appendChild(To),e.preventDefault()}),this._init(this._container,this._moddle,e)}function Mo(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Do(e,t){return-1<(e=g(e)?e:[e]).indexOf(t.key)}function No(e){return e.shiftKey}t(ko,on),ko.prototype.importXML=function(e,a){a=a||function(){};var s=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,t,n){t=s._emit("import.parse.complete",{error:e,definitions:t,context:n})||t;var i,r,o=n.warnings;if(e)return(r=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec((i=e).message))&&(i.message="unparsable content <"+r[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+r[2]),e=i,s._emit("import.done",{error:e,warnings:o}),a(e,o);s.importDefinitions(t,function(e,t){var n=[].concat(o,t||[]);s._emit("import.done",{error:e,warnings:n}),a(e,n)})})},ko.prototype.saveXML=function(e,n){n||(n=e,e={});var i=this,t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=i._emit("saveXML.serialized",{error:e,xml:t})||t,i._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})},ko.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=me("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)},ko.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e}catch(e){return t(e)}return function(e,t,n){var i,r,o,a,s,c=[];try{i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),r.fire("import.render.start",{definitions:t}),s=t,new Ai({root:function(e){return i.add(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){c.push({message:e,context:t})}},o).handleDefinitions(s),r.fire("import.render.complete",{error:a,warnings:c})}catch(e){a=e}n(a,c)}(this,e,t)},ko.prototype.getModules=function(){return this._modules},ko.prototype.destroy=function(){on.prototype.destroy.call(this),ye(this._container)},ko.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ko.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ko.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=me(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ko.prototype.getDefinitions=function(){return this._definitions},ko.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ko.prototype._init=function(e,t,n){var i,r,o=n.modules||this.getModules(),a=n.additionalModules||[],s=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],o,a),c=$((i=["additionalModules"],r={},M(Object(n),function(e,t){-1===i.indexOf(t)&&(r[t]=e)}),r),{canvas:$({},n.canvas,{container:e}),modules:s});on.call(this,c),n&&n.container&&this.attachTo(n.container)},ko.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ko.prototype._createContainer=function(e){var t=ce('<div class="bjs-container"></div>');return $(t.style,{width:Po(e.width),height:Po(e.height),position:e.position}),t},ko.prototype._createModdle=function(e){return new wi($({},this._moddleExtensions,e.moddleExtensions))},ko.prototype._modules=[Jr,Zi,yo,wo],ko.prototype._moddleExtensions={};var Bo="keyboard.keydown";function Oo(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keyHandler=this._keyHandler.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()})}Oo.$inject=["config.keyboard","eventBus"],Oo.prototype._keyHandler=function(e){var t=e.target;if(!(n=t)||!de(n,"input, textarea")&&"true"!==n.contentEditable){var n,i={keyEvent:e};this._eventBus.fire(Bo,i)&&e.preventDefault()}},Oo.prototype.bind=function(e){this.unbind(),this._node=e,oe.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},Oo.prototype.getBinding=function(){return this._node},Oo.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),oe.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},Oo.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Oo.prototype.addListener=function(e,t){u(e)&&(t=e,e=1e3),this._eventBus.on(Bo,e,t)},Oo.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Oo.prototype.isCmd=Mo,Oo.prototype.isShift=No,Oo.prototype.isKey=Do;var Lo=500;function Io(e,n){var i=this;e.on("editorActions.init",Lo,function(e){var t=e.editorActions;i.registerBindings(n,t)})}Io.$inject=["eventBus","keyboard"],Io.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(Mo(t)&&!No(t)&&Do(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(Mo(t)&&(Do(["y","Y"],t)||Do(["z","Z"],t)&&No(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(Mo(t)&&Do(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(Mo(t)&&Do(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Do(["+","Add"],t)&&Mo(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Do(["-","Subtract"],t)&&Mo(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Do("0",t)&&Mo(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Do("Delete",e.keyEvent))return i.trigger("removeSelection"),!0})};var jo={__init__:["keyboard","keyboardBindings"],keyboard:["type",Oo],keyboardBindings:["type",Io]},zo={moveSpeed:50,moveSpeedAccelerated:200};function Fo(e,o,r){var a=this;this._config=$({},zo,e||{}),o.addListener(function(e){var t=e.keyEvent,n=a._config;if(!o.isCmd(t))return;if(o.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var i,r=o.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":i="left";break;case"ArrowUp":case"Up":i="up";break;case"ArrowRight":case"Right":i="right";break;case"ArrowDown":case"Down":i="down"}return a.moveCanvas({speed:r,direction:i}),!0}}),this.moveCanvas=function(e){var t=0,n=0,i=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":n=i;break;case"right":t=-i;break;case"down":n=-i}r.scroll({dx:t,dy:n})}}Fo.$inject=["config.keyboardMove","keyboard","canvas"];var $o={__depends__:[jo],__init__:["keyboardMove"],keyboardMove:["type",Fo]},Ho=/^djs-cursor-.*$/;function Wo(e){var t=K(document.body);t.removeMatching(Ho),e&&t.add("djs-cursor-"+e)}function Go(){Wo(null)}var Vo=5e3;function Uo(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Vo,n),function(){e.off(t,n)}}function qo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ko(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yo(o,a){var s;function t(e){var t,n=s.start,i=io(e),r=Ko(i,n);(!s.dragging&&(t=r,15<Math.sqrt(Math.pow(t.x,2)+Math.pow(t.y,2)))&&(s.dragging=!0,Uo(o),Wo("grab")),s.dragging)&&(r=Ko(i,s.last||s.start),a.scroll({dx:r.x,dy:r.y}),s.last=i);e.preventDefault()}function n(e){oe.unbind(document,"mousemove",t),oe.unbind(document,"mouseup",n),s=null,Go()}o.on("element.mousedown",500,function(e){return function(e){if(te(e.target,".djs-draggable"))return;if(e.button||e.ctrlKey||e.shiftKey||e.altKey)return;return s={start:io(e)},oe.bind(document,"mousemove",t),oe.bind(document,"mouseup",n),!0}(e.originalEvent)})}Yo.$inject=["eventBus","canvas"];var Xo={__init__:["moveCanvas"],moveCanvas:["type",Yo]};function Zo(e){return Math.log(e)/Math.log(10)}function Qo(e,t){var n=Zo(e.min),i=Zo(e.max);return(Math.abs(n)+Math.abs(i))/t}var Jo=Math.sign||function(e){return 0<=e?1:-1},ea={min:.2,max:4};function ta(t,e,n){t=t||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=z(this._handleWheel,this),this._totalDelta=0,this._scale=t.scale||.75;var i=this;e.on("canvas.init",function(e){i._init(!1!==t.enabled)})}ta.$inject=["config.zoomScroll","eventBus","canvas"],ta.prototype.scroll=function(e){this._canvas.scroll(e)},ta.prototype.reset=function(){this._canvas.zoom("fit-viewport")},ta.prototype.zoom=function(e,t){var n=Qo(ea,20);this._totalDelta+=e,.1<Math.abs(this._totalDelta)&&(this._zoom(e,t,n),this._totalDelta=0)},ta.prototype._handleWheel=function(e){if(!te(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))*Jo(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)}},ta.prototype.stepZoom=function(e,t){var n=Qo(ea,10);this._zoom(e,t,n)},ta.prototype._zoom=function(e,t,n){var i=this._canvas,r=0<e?1:-1,o=Zo(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s,c,p=Math.pow(10,a);i.zoom((s=ea,c=p,Math.max(s.min,Math.min(s.max,c))),t)},ta.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&oe[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e},ta.prototype._init=function(e){this.toggle(e)};var na={__init__:["zoomScroll"],zoomScroll:["type",ta]};function ia(e){ko.call(this,e)}t(ia,ko),ia.prototype._modules=[].concat(ia.prototype._modules,ia.prototype._navigationModules=[$o,Xo,na]);var ra=e(function(Ge){
41/*! Hammer.JS - v2.0.7 - 2016-04-22
42 * http://hammerjs.github.io/
43 *
44 * Copyright (c) 2016 Jorik Tangelder;
45 * Licensed under the MIT license */
46!function(o,s,e,f){var a,c=["","webkit","Moz","MS","ms","o"],t=s.createElement("div"),n="function",p=Math.round,y=Math.abs,v=Date.now;function l(e,t,n){return setTimeout(g(e,n),t)}function i(e,t,n){return!!Array.isArray(e)&&(u(e,n[t],n),!0)}function u(e,t,n){var i;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==f)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 r(i,e,t){var r="DEPRECATED METHOD: "+e+"\n"+t+" AT \n";return function(){var e=new Error("get-stack-trace"),t=e&&e.stack?e.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=o.console&&(o.console.warn||o.console.log);return n&&n.call(o.console,r,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===f||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!==f&&null!==i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}:Object.assign;var h=r(function(e,t,n){for(var i=Object.keys(t),r=0;r<i.length;)(!n||n&&e[i[r]]===f)&&(e[i[r]]=t[i[r]]),r++;return e},"extend","Use `assign`."),d=r(function(e,t){return h(e,t,!0)},"merge","Use `assign`.");function m(e,t,n){var i,r=t.prototype;(i=e.prototype=Object.create(r)).constructor=e,i._super=r,n&&a(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==n?e.apply(t&&t[0]||f,t):e}function x(e,t){return e===f?t:e}function _(t,e,n){u(C(e),function(e){t.addEventListener(e,n,!1)})}function E(t,e,n){u(C(e),function(e){t.removeEventListener(e,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return-1<e.indexOf(t)}function C(e){return e.trim().split(/\s+/g)}function T(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 R(e,n,t){for(var i=[],r=[],o=0;o<e.length;){var a=n?e[o][n]:e[o];T(r,a)<0&&i.push(e[o]),r[o]=a,o++}return t&&(i=n?i.sort(function(e,t){return e[n]>t[n]}):i.sort()),i}function P(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;o<c.length;){if((i=(n=c[o])?n+r:t)in e)return i;o++}return f}var k=1;function M(e){var t=e.ownerDocument||e;return t.defaultView||t.parentWindow||o}var D="ontouchstart"in o,N=P(o,"PointerEvent")!==f,B=D&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O="touch",L=25,I=1,j=4,z=8,F=1,$=2,H=4,W=8,G=16,V=$|H,U=W|G,q=V|U,K=["x","y"],Y=["clientX","clientY"];function X(t,e){var n=this;this.manager=t,this.callback=e,this.element=t.element,this.target=t.options.inputTarget,this.domHandler=function(e){b(t.options.enable,[t])&&n.handler(e)},this.init()}function Z(e,t,n){var i=n.pointers.length,r=n.changedPointers.length,o=t&I&&i-r==0,a=t&(j|z)&&i-r==0;n.isFirst=!!o,n.isFinal=!!a,o&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,i=t.pointers,r=i.length;n.firstInput||(n.firstInput=Q(t));1<r&&!n.firstMultiple?n.firstMultiple=Q(t):1===r&&(n.firstMultiple=!1);var o=n.firstInput,a=n.firstMultiple,s=a?a.center:o.center,c=t.center=J(i);t.timeStamp=v(),t.deltaTime=t.timeStamp-o.timeStamp,t.angle=ie(s,c),t.distance=ne(s,c),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==I&&o.eventType!==j||(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=te(t.deltaX,t.deltaY);var p=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=p.x,t.overallVelocityY=p.y,t.overallVelocity=y(p.x)>y(p.y)?p.x:p.y,t.scale=a?(h=a.pointers,d=i,ne(d[0],d[1],Y)/ne(h[0],h[1],Y)):1,t.rotation=a?(l=a.pointers,u=i,ie(u[1],u[0],Y)+ie(l[1],l[0],Y)):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,r,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(L<s||a.velocity===f)){var c=t.deltaX-a.deltaX,p=t.deltaY-a.deltaY,l=ee(s,c,p);i=l.x,r=l.y,n=y(l.x)>y(l.y)?l.x:l.y,o=te(c,p),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}(n,t);var l,u;var h,d;var m=e.element;w(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 Q(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:v(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(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 ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:y(e)>=y(t)?e<0?$:H:t<0?W:G}function ne(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=K);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(M(this.element),this.evWin,this.domHandler)}};var re={mousedown:I,mousemove:2,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}m(se,X,{handler:function(e){var t=re[e.type];t&I&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=j),this.pressed&&(t&j&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:I,pointermove:2,pointerup:j,pointercancel:z,pointerout:z},pe={2:O,3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),m(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a=o==O,s=T(t,e.pointerId,"pointerId");r&I&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(j|z)&&(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 de={touchstart:I,touchmove:2,touchend:j,touchcancel:z};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,X.apply(this,arguments)}m(me,X,{handler:function(e){var t=de[e.type];if(t===I&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(j|z)&&(n=R(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(j|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}}});var fe={touchstart:I,touchmove:2,touchend:j,touchcancel:z},ye="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=ye,this.targetIds={},X.apply(this,arguments)}m(ve,X,{handler:function(e){var t=fe[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(2|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 w(e.target,c)}),t===I)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&(j|z)&&delete i[a[r].identifier],r++;return s.length?[R(o.concat(s),"identifier",!0),s]:void 0}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}});var ge=2500;function be(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new ve(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function xe(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);-1<e&&i.splice(e,1)},ge)}}m(be,X,{handler:function(e,t,n){var i=n.pointerType==O,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&I?(this.primaryTouch=t.changedPointers[0].identifier,xe.call(this,t)):e&(j|z)&&xe.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<=25&&a<=25)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var _e=P(t.style,"touchAction"),Ee=_e!==f,we="manipulation",Se="none",Ce="pan-x",Te="pan-y",Ae=function(){if(!Ee)return!1;var t={},n=o.CSS&&o.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(e){t[e]=!n||o.CSS.supports("touch-action",e)}),t}();function Re(e,t){this.manager=e,this.set(t)}Re.prototype={set:function(e){"compute"==e&&(e=this.compute()),Ee&&this.manager.element.style&&Ae[e]&&(this.manager.element.style[_e]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var t=[];return u(this.manager.recognizers,function(e){b(e.options.enable,[e])&&(t=t.concat(e.getTouchAction()))}),function(e){if(S(e,Se))return Se;var t=S(e,Ce),n=S(e,Te);if(t&&n)return Se;if(t||n)return t?Ce:Te;if(S(e,we))return we;return"auto"}(t.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Se)&&!Ae.none,o=S(i,Te)&&!Ae[Te],a=S(i,Ce)&&!Ae[Ce];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&V||a&&n&U?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Pe=1;function ke(e){this.options=a({},this.defaults,e||{}),this.id=k++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Pe,this.simultaneous={},this.requireFail=[]}function Me(e){return 16&e?"cancel":8&e?"end":4&e?"move":2&e?"start":""}function De(e){return e==G?"down":e==W?"up":e==$?"left":e==H?"right":""}function Ne(e,t){var n=t.manager;return n?n.get(e):e}function Be(){ke.apply(this,arguments)}function Oe(){Be.apply(this,arguments),this.pX=null,this.pY=null}function Le(){Be.apply(this,arguments)}function Ie(){ke.apply(this,arguments),this._timer=null,this._input=null}function je(){Be.apply(this,arguments)}function ze(){Be.apply(this,arguments)}function Fe(){ke.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function $e(e,t){return(t=t||{}).recognizers=x(t.recognizers,$e.defaults.preset),new He(e,t)}ke.prototype={defaults:{},set:function(e){return a(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(i(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ne(e,this)).id]||(t[e.id]=e).recognizeWith(this),this},dropRecognizeWith:function(e){return i(e,"dropRecognizeWith",this)||(e=Ne(e,this),delete this.simultaneous[e.id]),this},requireFailure:function(e){if(i(e,"requireFailure",this))return this;var t=this.requireFail;return-1===T(t,e=Ne(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(i(e,"dropRequireFailure",this))return this;e=Ne(e,this);var t=T(this.requireFail,e);return-1<t&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return 0<this.requireFail.length},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(t){var n=this,e=this.state;function i(e){n.manager.emit(e,t)}e<8&&i(n.options.event+Me(e)),i(n.options.event),t.additionalEvent&&i(t.additionalEvent),8<=e&&i(n.options.event+Me(e))},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|Pe)))return!1;e++}return!0},recognize:function(e){var t=a({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);56&this.state&&(this.state=Pe),this.state=this.process(t),30&this.state&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},m(Be,ke,{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=6&t,r=this.attrTest(e);return i&&(n&z||!r)?16|t:i||r?n&j?8|t:2&t?4|t:2:32}}),m(Oe,Be,{defaults:{event:"pan",threshold:10,pointers:1,direction:q},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Te),e&U&&t.push(Ce),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||(i=t.direction&V?(r=0===o?F:o<0?$:H,n=o!=this.pX,Math.abs(e.deltaX)):(r=0===a?F:a<0?W:G,n=a!=this.pY,Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return Be.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(Le,Be,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},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)}}),m(Ie,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},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&(j|z)&&!r)this.reset();else if(e.eventType&I)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&j)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=v(),this.manager.emit(this.options.event,this._input)))}}),m(je,Be,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),m(ze,Be,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|U,pointers:1},getTouchAction:function(){return Oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|U)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&U&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&y(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),m(Fe,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[we]},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&I&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=j)return this.failTimeout();var o=!this.pTime||e.timeStamp-this.pTime<t.interval,a=!this.pCenter||ne(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=l(function(){this.state=8,this.tryEmit()},t.interval,this),2):8}return 32},failTimeout:function(){return this._timer=l(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){8==this.state&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),$e.VERSION="2.0.7",$e.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[je,{enable:!1}],[Le,{enable:!1},["rotate"]],[ze,{direction:V}],[Oe,{direction:V},["swipe"]],[Fe],[Fe,{event:"doubletap",taps:2},["tap"]],[Ie]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function He(e,t){var n;this.options=a({},$e.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?he:B?ve:D?be:se))(n,Z),this.touchAction=new Re(this,this.options.touchAction),We(this,!0),u(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 We(n,i){var r,o=n.element;o.style&&(u(n.options.cssProps,function(e,t){r=P(o.style,t),o.style[r]=i?(n.oldCssProps[r]=o.style[r],e):n.oldCssProps[r]||""}),i||(n.oldCssProps={}))}He.prototype={set:function(e){return a(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&&8&r.state)&&(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&&14&n.state&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ke)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(i(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),(e.manager=this).touchAction.update(),e},remove:function(e){if(i(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=T(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==f&&t!==f){var n=this.handlers;return u(C(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==f){var n=this.handlers;return u(C(e),function(e){t?n[e]&&n[e].splice(T(n[e],t),1):delete n[e]}),this}},emit:function(e,t){var n,i,r;this.options.domEvents&&(n=e,i=t,(r=s.createEvent("Event")).initEvent(n,!0,!0),(r.gesture=i).target.dispatchEvent(r));var o=this.handlers[e]&&this.handlers[e].slice();if(o&&o.length){t.type=e,t.preventDefault=function(){t.srcEvent.preventDefault()};for(var a=0;a<o.length;)o[a](t),a++}},destroy:function(){this.element&&We(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},a($e,{INPUT_START:I,INPUT_MOVE:2,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Pe,STATE_BEGAN:2,STATE_CHANGED:4,STATE_ENDED:8,STATE_RECOGNIZED:8,STATE_CANCELLED:16,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:H,DIRECTION_UP:W,DIRECTION_DOWN:G,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:U,DIRECTION_ALL:q,Manager:He,Input:X,TouchAction:Re,TouchInput:ve,MouseInput:se,PointerEventInput:he,TouchMouseInput:be,SingleTouchInput:me,Recognizer:ke,AttrRecognizer:Be,Tap:Fe,Pan:Oe,Swipe:ze,Pinch:Le,Rotate:je,Press:Ie,on:_,off:E,each:u,merge:d,extend:h,assign:a,inherit:m,bindFn:g,prefixed:P}),(void 0!==o?o:"undefined"!=typeof self?self:{}).Hammer=$e,"function"==typeof f&&f.amd?f(function(){return $e}):Ge.exports?Ge.exports=$e:o.Hammer=$e}(window,document)}),oa=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function aa(e,t){return t.get(e,!1)}function sa(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function ca(t){function e(e){setTimeout(function(){M(oa,function(e){oe.unbind(t,e,sa,!0)})},500)}oe.bind(t,"touchstart",function(e){M(oa,function(e){oe.bind(t,e,sa,!0)})},!0),oe.bind(t,"touchend",e,!0),oe.bind(t,"touchcancel",e,!0);var r=new ra.Manager(t,{inputClass:ra.TouchInput,recognizers:[]}),n=new ra.Tap,i=new ra.Pan({threshold:10}),o=new ra.Press,a=new ra.Pinch,s=new ra.Tap({event:"doubletap",taps:2});return a.requireFailure(i),a.requireFailure(o),r.add([i,o,a,s,n]),r.reset=function(e){var n=this.recognizers,i=this.session;i.stopped||(r.stop(e),setTimeout(function(){var e,t;for(e=0;t=n[e];e++)t.reset(),t.state=8;i.curRecognizer=null},0))},r.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&r.reset(!0)}),r}function pa(e,o,t,a,n){var s,c=aa("dragging",e),i=aa("move",e),r=aa("contextPad",e),p=aa("palette",e);function l(t){return function(e){n.fire(t,e)}}function u(e){return te(e,"svg, .djs-element",!0)}function h(e){function t(e){var t=u(e.target),n=t&&a.get(t);if(i&&o.getRootElement()!==n)return i.start(e,n,!0);!function(e){var i=0,r=0;function t(e){var t=e.deltaX-i,n=e.deltaY-r;o.scroll({dx:t,dy:n}),i=e.deltaX,r=e.deltaY}function n(e){s.off("panmove",t),s.off("panend",n),s.off("pancancel",n)}s.on("panmove",t),s.on("panend",n),s.on("pancancel",n)}()}(s=ca(e)).on("doubletap",l("element.dblclick")),s.on("tap",l("element.click")),s.on("panstart",t),s.on("press",t),s.on("pinchstart",function(e){var i=o.zoom(),r=e.center;function t(e){var t=1-(1-e.scale)/1.5,n=Math.max(.2,Math.min(4,t*i));o.zoom(n,r),sa(e)}function n(e){s.off("pinchmove",t),s.off("pinchend",n),s.off("pinchcancel",n),s.reset(!0)}s.on("pinchmove",t),s.on("pinchend",n),s.on("pinchcancel",n)})}c&&t.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=io(t),i=u(document.elementFromPoint(n.x,n.y)),r=i&&a.get(i);r!==e.hover&&(e.hover&&c.out(e),r&&(c.hover({element:r,gfx:i}),e.hover=r,e.hoverGfx=i))}}),r&&t.on("contextPad.create",function(e){var t=ca(e.pad.html);t.on("panstart",function(e){r.trigger("dragstart",e,!0)}),t.on("press",function(e){r.trigger("dragstart",e,!0)}),t.on("tap",function(e){r.trigger("click",e)})}),p&&t.on("palette.create",function(e){var t=ca(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)})}),t.on("canvas.init",function(e){h(e.svg)})}function la(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}pa.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"],la.$inject=["canvas","eventBus"],la.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=Be("rect");Ee(n,{x:-1e4,y:1e4,width:10,height:10}),Ee(n,t),ge(e,n);var i=Be("rect");Ee(i,{x:1e4,y:1e4,width:10,height:10}),Ee(i,t),ge(e,i)};var ua={__depends__:[{__depends__:[co],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",pa],touchFix:["type",la]}]};function ha(e){return e&&e[e.length-1]}function da(e){return e.y}function ma(e){return e.x}var fa={left:ma,center:ma,right:function(e){return e.x+e.width},top:da,middle:da,bottom:function(e){return e.y+e.height}};function ya(e){this._modeling=e}ya.$inject=["modeling"],ya.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},ya.prototype._isType=function(e,t){return-1!==t.indexOf(e)},ya.prototype._alignmentPosition=function(e,t){var n,i,r,o,a,s=this._getOrientationDetails(e),c=s.axis,p=s.dimension,l={},u={},h=!1;if(this._isType(e,["left","top"]))l[e]=t[0][c];else if(this._isType(e,["right","bottom"]))r=ha(t),l[e]=r[c]+r[p];else if(this._isType(e,["center","middle"])){if(M(t,function(e){var t=e[c]+Math.round(e[p]/2);u[t]?u[t].elements.push(e):u[t]={elements:[e],center:t}}),n=A(u,function(e){return 1<e.elements.length&&(h=!0),e.elements.length}),h)return l[e]=ha(n).center,l;i=t[0],r=ha(t=A(t,function(e){return e[c]+e[p]})),l[e]=(o=i,a=r,Math.round((o[c]+a[c]+a[p])/2))}return l},ya.prototype.trigger=function(e,t){var n=this._modeling,i=A(k(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),fa[t]),r=this._alignmentPosition(t,i);n.alignElements(i,r)};var va={__init__:["alignElements"],alignElements:["type",ya]};function ga(t,e){return v(e,function(e){return Ri(t,e)})}var ba=50,xa=250,_a=10;function Ea(e,t){var n,i=Vr(e),r=qr(e),o=function(e,t){var n=Vr(e);function i(e){return Ri(e,"bpmn:SequenceFlow")}var r=_(_([].concat(Ra(e,i).map((a=5,function(e){return{shape:e,weight:a,distanceTo:function(e){var t=Vr(e);return t.left-n.right}}})),Aa(e,i).map((o=1,function(e){return{shape:e,weight:o,distanceTo:function(e){var t=Vr(e);return n.left-t.right}}}))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||xa<n||(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 o;var a;return r.fav?r.fav.value:ba}(e),a="left",s=30;return Ri(e,"bpmn:BoundaryEvent")&&-1!==(a=Kr(e,e.host,-25)).indexOf("top")&&(s*=-1),Sa(e,t,{x:i.right+o+t.width/2,y:r.y+(n=a,-1!=n.indexOf("top")?-80:-1!=n.indexOf("bottom")?80:0)},{y:{margin:s,rowSize:80}})}function wa(e,t,n){var i,r,o={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height};return P((r=Ta(i=e),i.host&&(r=r.concat(Ta(i.host))),i.attachers&&(r=r.concat(i.attachers.reduce(function(e,t){return e.concat(Ta(t))},[]))),r),function(e){return e!==n&&"intersect"===Kr(e,o,_a)})}function Sa(e,s,c,p){function t(o){var a={x:c.x,y:c.y};return["x","y"].forEach(function(e){var t=p[e];if(t){var n="x"===e?"width":"height",i=t.margin,r=t.rowSize;a[e]=i<0?Math.min(o[e]+i-s[n]/2,c[e]-r+i):Math.max(l[e]+l[n]+i+s[n]/2,c[e]+r+i)}}),a}for(var l;l=wa(e,c,s);)c=t(l);return c}function Ca(){return!0}function Ta(e,t){return[].concat(Ra(e,t),Aa(e,t))}function Aa(e,t){return t||(t=Ca),e.incoming.filter(t).map(function(e){return e.source})}function Ra(e,t){return t||(t=Ca),e.outgoing.filter(t).map(function(e){return e.target})}function Pa(n,r){function o(e,t){return n.fire(e,t)}this.append=function(e,t){var n=o("autoPlace",{source:e,shape:t});n||(n=function(e,t){if(Ri(t,"bpmn:TextAnnotation"))return i=t,r=Vr(n=e),Sa(n,i,{x:r.right+i.width/2,y:r.top-50-i.height/2},{y:{margin:-30,rowSize:20}});var n,i,r;if(ga(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return a=t,s=Vr(o=e),Sa(o,a,{x:s.right-10+a.width/2,y:s.bottom+40+a.width/2},{x:{margin:30,rowSize:30}});var o,a,s;if(Ri(t,"bpmn:FlowNode"))return Ea(e,t);return c=e,p=t,l=Vr(c),u=qr(c),{x:l.right+ba+p.width/2,y:u.y};var c,p,l,u}(e,t));var i=r.appendShape(e,t,n,e.parent);return o("autoPlace.end",{shape:i}),i}}function ka(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}Pa.$inject=["eventBus","modeling"],ka.$inject=["eventBus","selection"];var Ma={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",Pa],autoPlaceSelectionBehavior:["type",ka]};function Da(e){this._eventBus=e}Da.$inject=["eventBus"],Da.prototype.on=function(e,r,o,a,s,c){if((u(r)||l(r))&&(c=s,s=a,a=o,o=r,r=null),u(o)&&(c=s,s=a,a=o,o=1e3),R(s)&&(c=s,s=!1),!u(a))throw new Error("handlerFn must be a function");g(e)||(e=[e]);var p=this._eventBus;M(e,function(e){var t,n,i=["commandStack",e,r].filter(function(e){return e}).join(".");p.on(i,o,s?(t=a,n=c,function(e){return t.call(n||null,e.context,e.command,e)}):a,c)})};function Na(e,t,n,i){Da.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,r=t.parent||t.newParent;(!n||!1!==n.root&&!1!==n.autoResize)&&o._expand([i],r)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=h(w(t.closure.topLevel)),i=t.hints,r=!i||i.autoResize;!1!==r&&M(S(n,function(e){return e.parent.id}),function(e,t){g(r)&&(e=e.filter(function(e){return-1!==r.indexOf(e)})),o._expand(e,t)})}),this.postExecuted(["shape.toggleCollapse"],function(e){var t=e.context,n=t.hints,i=t.shape;(!n||!1!==n.root&&!1!==n.autoResize)&&(i.collapsed||o._expand(i.children||[],i))}),this.postExecuted(["shape.resize"],function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;(!n||!1!==n.root&&!1!==n.autoResize)&&r&&o._expand([i],r)})}function Ba(e){e.invoke(Na,this)}function Oa(e){Da.call(this,e),this.init()}function La(e){Oa.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}function Ia(e,t){La.call(this,e),this._modeling=t}M(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(o){Da.prototype[o]=function(e,t,n,i,r){(u(e)||l(e))&&(r=i,i=n,n=t,t=e,e=null),this.on(e,o,t,n,i,r)}}),Na.$inject=["eventBus","elementRegistry","modeling","rules"],t(Na,Da),Na.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=Vr(vt(e)),o=Vr(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),Ur($({},o,a))},Na.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(r=t,(i=n).x!==r.x||i.y!==r.y||i.width!==r.width||i.height!==r.height){var i,r;this.resize(t,n);var o=t.parent;o&&this._expand([t],o)}}},Na.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Na.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Na.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)},Ba.$inject=["injector"],t(Ba,Na),Ba.prototype.resize=function(e,t){Ri(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},Oa.$inject=["eventBus"],t(Oa,Da),Oa.prototype.addRule=function(e,t,i){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.canExecute(e,t,function(e,t,n){return i(e)},!0)})},Oa.prototype.init=function(){},La.$inject=["eventBus"],t(La,Oa),La.prototype.canResize=function(e,t){return!1},t(Ia,La),Ia.$inject=["eventBus","modeling"],Ia.prototype.canResize=function(e,t){if(!Ri(t,"bpmn:Participant")&&!Ri(t,"bpmn:Lane")&&!Ri(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(e){(Ri(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var ja={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Ba],bpmnAutoResizeProvider:["type",Ia]},za=Math.round,Fa="djs-drag-active";function $a(e){e.preventDefault()}function Ha(u,h,d){var m,f={threshold:5,trapClick:!0};function y(e){var t=h.viewbox(),n=h._container.getBoundingClientRect();return{x:t.x+(e.x-n.left)/t.scale,y:t.y+(e.y-n.top)/t.scale}}function v(e,t){t=t||m;var n=u.createEvent($({},t.payload,t.data,{isTouch:t.isTouch}));return!1!==u.fire("drag."+e,n)&&u.fire(t.prefix+"."+e,n)}function g(e,t){var n,i=m.payload,r=m.displacement,o=m.globalStart,a=io(e),s=Ko(a,o),c=m.localStart,p=y(a),l=Ko(p,c);if(!m.active&&(t||(n=s,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))>m.threshold))){if($(i,{x:za(c.x+r.x),y:za(c.y+r.y),dx:0,dy:0},{originalEvent:e}),!1===v("start"))return C();m.active=!0,m.keepSelection||(i.previousSelection=d.get(),d.select(null)),m.cursor&&Wo(m.cursor),h.addMarker(h.getRootElement(),Fa)}no(e),m.active&&($(i,{x:za(p.x+r.x),y:za(p.y+r.y),dx:za(l.x),dy:za(l.y)},{originalEvent:e}),v("move"))}function b(e){var t=!0;m.active&&(e&&no(m.payload.originalEvent=e),t=v("end")),!1===t&&v("rejected"),v("ended",i(!0!==t))}function x(e){27===e.which&&($a(e),C())}function _(e){var t;m.active&&(t=Uo(u),setTimeout(t,400),$a(e)),b(e)}function E(e){g(e)}function w(e){var t=m.payload;t.hoverGfx=e.gfx,t.hover=e.element,v("hover")}function S(e){v("out");var t=m.payload;t.hoverGfx=null,t.hover=null}function C(e){var t;if(m){var n=m.active;n&&v("cancel"),t=i(e),n&&v("canceled",t)}}function i(e){var t,n;v("cleanup"),Go(),n=m.trapClick?_:b,oe.unbind(document,"mousemove",g),oe.unbind(document,"dragstart",$a),oe.unbind(document,"selectstart",$a),oe.unbind(document,"mousedown",n,!0),oe.unbind(document,"mouseup",n,!0),oe.unbind(document,"keyup",x),oe.unbind(document,"touchstart",E,!0),oe.unbind(document,"touchcancel",C,!0),oe.unbind(document,"touchmove",g,!0),oe.unbind(document,"touchend",b,!0),u.off("element.hover",w),u.off("element.out",S),h.removeMarker(h.getRootElement(),Fa);var i=m.payload.previousSelection;return!1!==e&&i&&!d.get().length&&d.select(i),t=m,m=null,t}u.on("diagram.destroy",C),this.init=function(e,t,n,i){m&&C(!1),"string"==typeof t&&(i=n,n=t,t=null);var r,o,a,s,c,p,l=(i=$({},f,i||{})).data||{};s=i.trapClick?_:b,e?(r=to(e)||e,o=io(e),no(e),"dragstart"===r.type&&$a(r)):(r=null,o={x:0,y:0}),a=y(o),t||(t=a),p=r,c="undefined"!=typeof TouchEvent&&p instanceof TouchEvent,m=$({prefix:n,data:l,payload:{},globalStart:o,displacement:Ko(t,a),localStart:a,isTouch:c},i),i.manual||(c?(oe.bind(document,"touchstart",E,!0),oe.bind(document,"touchcancel",C,!0),oe.bind(document,"touchmove",g,!0),oe.bind(document,"touchend",b,!0)):(oe.bind(document,"mousemove",g),oe.bind(document,"dragstart",$a),oe.bind(document,"selectstart",$a),oe.bind(document,"mousedown",s,!0),oe.bind(document,"mouseup",s,!0)),oe.bind(document,"keyup",x),u.on("element.hover",w),u.on("element.out",S)),v("init"),i.autoActivate&&g(e,!0)},this.move=g,this.hover=w,this.out=S,this.end=b,this.cancel=C,this.context=function(){return m},this.setOptions=function(e){$(f,e)}}function Wa(t,a,s){var n=this;t.on("drag.start",function(e){t.once("drag.move",function(){t.once("drag.move",function(e){n.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var t,n,i,r,o=e.originalEvent;if(o instanceof MouseEvent)t=io(o),n=document.elementFromPoint(t.x,t.y),(r=te(n,"svg, .djs-element",!0))&&(i=s.get(r),a.hover({element:i,gfx:r}))}}}Ha.$inject=["eventBus","canvas","selection"],Wa.$inject=["eventBus","dragging","elementRegistry"];var Ga={__init__:["hoverFix"],__depends__:[yo],dragging:["type",Ha],hoverFix:["type",Wa]};function Va(e,t){this._eventBus=e,this._canvas=t,this._init()}Va.$inject=["eventBus","canvas"],Va.prototype.getHoverContext=function(){var e=this._canvas.viewbox();return{element:this._hoverElement,point:{x:e.x+Math.round(this._mouseX/e.scale),y:e.y+Math.round(this._mouseY/e.scale)}}},Va.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=z(this._setMousePosition,this),t.addEventListener("mousemove",this._setMousePosition),e.on("diagram.destroy",function(){t.removeEventListener("mousemove",this._setMousePosition)},this),e.on("element.hover",this._setHoverElement,this)},Va.prototype._setHoverElement=function(e){this._hoverElement=e.element},Va.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var Ua={__init__:["mouseTracking"],mouseTracking:["type",Va]};function qa(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=$({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}function Ka(e,t,n){return t<e&&e<n}qa.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"],qa.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++)Ka(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))},qa.prototype.stopScroll=function(){clearTimeout(this._scrolling)},qa.prototype.setOptions=function(e){this._opts=$({},this._opts,e)},qa.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=io(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Ya={__depends__:[Ga,Ua],__init__:["autoScroll"],autoScroll:["type",qa]};function Xa(e){this._commandStack=e.get("commandStack",!1)}Xa.$inject=["injector"],Xa.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Za={__init__:["rules"],rules:["type",Xa]},Qa="djs-bendpoint",Ja="djs-segment-dragger";function es(e,t){var n=Be("g");Ae(n).add(Qa),ge(e,n);var i=Be("circle");Ee(i,{cx:0,cy:0,r:4}),Ae(i).add("djs-visual"),ge(n,i);var r=Be("circle");return Ee(r,{cx:0,cy:0,r:10}),Ae(r).add("djs-hit"),ge(n,r),t&&Ae(n).add(t),n}function ts(e,t,n){var i=Be("g"),r=lr(t,n),o=cr(t,n);return ge(e,i),function(e,t,n){var i=Be("g");ge(e,i);var r=Be("rect");Ee(r,{x:-7,y:-1.5,width:14,height:3}),Ae(r).add("djs-visual"),ge(i,r);var o=Be("rect");Ee(o,{x:-10,y:-4.5,width:20,height:9}),Ae(o).add("djs-hit"),ge(i,o),Zt(i,"h"===n?90:0)}(i,0,o),Ae(i).add(Ja),Ae(i).add("h"===o?"vertical":"horizontal"),Xt(i,r.x,r.y),i}var ns=e(function(e,t){var n;n=i,e.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+=1<=t&&t<=31||127==t||0==r&&48<=t&&t<=57||1==r&&48<=t&&t<=57&&45==a?"\\"+t.toString(16)+" ":0==r&&1==i&&45==t||!(128<=t||45==t||95==t||48<=t&&t<=57||65<=t&&t<=90||97<=t&&t<=122)?"\\"+n.charAt(r):n.charAt(r):o+="�";return o};return e.CSS||(e.CSS={}),e.CSS.escape=t}(n)}),is=Math.round,rs=Math.max;var os=10;function as(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(or(i,t)<=os)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||(n=e,s=Hr((o=os,[["M",(r=t).x,r.y],["m",0,-o],["a",o,o,0,1,1,0,2*o],["a",o,o,0,1,1,0,-2*o],["z"]]),(i=[],n.forEach(function(e,t){i.push([0===t?"M":"L",e.x,e.y])}),i)),c=s[0],p=s[s.length-1],c?c!==p?c.segment2!==p.segment2?{point:n[a=rs(c.segment2,p.segment2)-1],bendpoint:!0,index:a}:{point:{x:is(c.x+p.x)/2,y:is(c.y+p.y)/2},index:c.segment2}:{point:{x:is(c.x),y:is(c.y)},index:c.segment2}:null);var n,i,r,o,a,s,c,p}function ss(e,r,i,f,y){function v(e,t){return as(e,function(e,t){var n,i=io(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}}(r,t))}function o(e,t){var n,i,r,o,a,s,c,p,l,u,h,d=t.waypoints,m=v(d,e);if(m)return i=d,r=10,u=(n=m).index,h=n.point,!(u<=0||n.bendpoint)&&(s=lr(o=i[u-1],a=i[u]),c=cr(o,a),p=Math.abs(h.x-s.x),l=Math.abs(h.y-s.y),c&&p<=r&&l<=r)?y.start(e,t,m.index):f.start(e,t,m.index,!m.bendpoint),!0}function a(e,t,n){oe.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function s(e,t){var n=r.getLayer("overlays"),i=me('.djs-bendpoints[data-element-id="'+ns(e.id)+'"]',n);return!i&&t&&(Ee(i=Be("g"),{"data-element-id":e.id}),Ae(i).add("djs-bendpoints"),ge(n,i),a(i,"mousedown",e),a(i,"click",e),a(i,"dblclick",e)),i}function n(i,e){e.waypoints.forEach(function(e,t){var n=es(i);ge(i,n),Xt(n,e.x,e.y)}),es(i,"floating")}function c(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)cr(n=r[o-1],i=r[o])&&ts(e,n,i)}function p(e){var t=s(e);return t||(n(t=s(e,!0),e),c(t,e)),t}function t(e){var t=s(e);t&&(M(fe("."+Ja,t),function(e){Pe(e)}),M(fe("."+Qa,t),function(e){Pe(e)}),c(t,e),n(t,e))}e.on("connection.changed",function(e){t(e.element)}),e.on("connection.remove",function(e){var t=s(e.element);t&&Pe(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=p(n),e.add?Ae(t).add(e.marker):Ae(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i=e.element,r=i.waypoints;if(r){if(!(t=me(".floating",s(i,!0))))return;(n=v(r,e.originalEvent))&&Xt(t,n.point.x,n.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return o(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&p(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(p(t),i.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){i.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&&Ee(i,{"data-element-id":n})}}),this.addHandles=p,this.updateHandles=t,this.getBendpointsContainer=s}ss.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var cs="connect-ok",ps="connect-not-ok",ls="connect-hover",us="djs-updating",hs="connection.updateWaypoints",ds="connection.reconnectStart",ms="connection.reconnectEnd",fs=Math.round;function ys(e,t,s,c,n,i,p){var a=e.get("connectionDocking",!1);function l(e){n.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,n,i){var r,o=t.waypoints,a=s.getGraphics(t);r={connection:t,bendpointIndex:n,insert:i,type:i||0!==n?i||n!==o.length-1?hs:ms:ds},c.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:a,context:r}})},t.on("bendpoint.move.start",function(e){var t=e.context,n=t.connection,i=n.waypoints,r=i.slice(),o=t.insert,a=t.bendpointIndex;t.originalWaypoints=i,o&&r.splice(a,0,null),n.waypoints=r,t.draggerGfx=es(s.getLayer("overlays")),Ae(t.draggerGfx).add("djs-dragging"),s.addMarker(n,us)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){s.addMarker(e.hover,ls);var n=t.allowed=i.allowed(t.type,t);n?(s.removeMarker(t.hover,ps),s.addMarker(t.hover,cs),t.target=t.hover):!1===n&&(s.removeMarker(t.hover,cs),s.addMarker(t.hover,ps),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(s.removeMarker(t,ls),s.removeMarker(t,e.context.target?cs:ps))}),t.on("bendpoint.move.move",function(e){var t,n,i=e.context,r=i.type,o=e.connection;o.waypoints[i.bendpointIndex]={x:e.x,y:e.y},a&&(i.hover&&(r===ds&&(t=i.hover),r===ms&&(n=i.hover)),o.waypoints=a.getCroppedWaypoints(o,t,n)),Xt(i.draggerGfx,e.x,e.y),l(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,n=t.hover,i=t.connection;Pe(t.draggerGfx),t.newWaypoints=i.waypoints.slice(),i.waypoints=t.originalWaypoints,s.removeMarker(i,us),n&&(s.removeMarker(n,cs),s.removeMarker(n,ps))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],a=n.allowed;if(o.x=fs(o.x),o.y=fs(o.y),a&&n.type===ds)p.reconnectStart(n.connection,n.target,o);else if(a&&n.type===ms)p.reconnectEnd(n.connection,n.target,o);else{if(!1===a||n.type!==hs)return l(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},p.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===or(t,i=e[r+1])||ar(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){l(e)})}ys.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var vs="connect-hover",gs="djs-updating";function bs(e,t,n){return xs(e,t,e[t]+n)}function xs(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function _s(e){return"x"===e?"y":"x"}function Es(e,t,n){var i,r;return e.original?e.original:(i=qr(t),xs(e,r=_s(n),i[r]))}function ws(e,t,h,d,n,i,m){var r=e.get("connectionDocking",!1);function f(e,t){if(!r)return t;var n,i=e.waypoints;return e.waypoints=t,n=r.getCroppedWaypoints(e),e.waypoints=i,n}function y(e){n.update("connection",e.connection,e.connectionGfx)}function v(e,t,n){var i,r,o,a,s,c,p=e.newWaypoints,l=p[e.segmentStartIndex+t],u=p[e.segmentEndIndex+t],h=_s(e.axis),d=(i=n,r=l,o=u,a=h,s=Math.max(r[a],o[a]),c=Math.min(r[a],o[a]),xs(r,a,Math.min(Math.max(c+20,i[a]),s-20)));Xt(e.draggerGfx,d.x,d.y)}this.start=function(e,t,n){var i,r,o,a=h.getGraphics(t),s=n-1,c=n,p=t.waypoints,l=p[s],u=p[c];(r=cr(l,u))&&(o="v"===r?"y":"x",0===s&&(l=Es(l,t.source,o)),c===p.length-1&&(u=Es(u,t.target,o)),i={connection:t,segmentStartIndex:s,segmentEndIndex:c,segmentStart:l,segmentEnd:u,axis:o},d.init(e,{x:(l.x+u.x)/2,y:(l.y+u.y)/2},"connectionSegment.move",{cursor:"x"===o?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:a,context:i}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,n=e.connection,i=h.getLayer("overlays");t.originalWaypoints=n.waypoints.slice(),t.draggerGfx=ts(i,t.segmentStart,t.segmentEnd),Ae(t.draggerGfx).add("djs-dragging"),h.addMarker(n,gs)}),t.on("connectionSegment.move.move",function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,a=i.segmentEndIndex,s=i.segmentStart,c=i.segmentEnd,p=i.axis,l=i.originalWaypoints.slice(),u=bs(s,p,e["d"+p]),h=bs(c,p,e["d"+p]),d=l.length,m=0;l[o]=u,l[a]=h,o<2&&(t=Kr(r.source,u),1===o?"intersect"===t&&(l.shift(),l[0]=u,m--):"intersect"!==t&&(l.unshift(s),m++)),d-3<a&&(n=Kr(r.target,h),a===d-2?"intersect"===n&&(l.pop(),l[l.length-1]=h):"intersect"!==n&&l.push(c)),i.newWaypoints=r.waypoints=f(r,l),v(i,m,e),i.newSegmentStartIndex=o+m,y(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,h.addMarker(e.hover,vs)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&h.removeMarker(t,vs)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,n=t.connection;t.draggerGfx&&Pe(t.draggerGfx),h.removeMarker(n,gs)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,y(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}});var o,a,s,c=(a=r,s=0,{waypoints:(o=i).filter(function(e,t){return!ar(o[t-1],o[t+1],e)||(s=t<=a?s-1:s,!1)}),segmentOffset:s}),p=f(n,c.waypoints),l=c.segmentOffset,u={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+l}};m.updateWaypoints(n,p,u)})}ws.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var Ss=Math.abs,Cs=Math.round;function Ts(e){function p(e,t){if(g(e)){for(var n=e.length;n--;)if(Ss(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(e-10<i)return t-i+e}return t}function l(e){if(e.width)return{x:Cs(e.width/2+e.x),y:Cs(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var t,n,i=function(e){var t=e.snapPoints,n=e.connection,i=n.waypoints,r=e.segmentStart,o=e.segmentStartIndex,a=e.segmentEnd,s=e.segmentEndIndex,c=e.axis;if(t)return t;var p=[i[o-1],r,a,i[s+1]];return o<2&&p.unshift(l(n.source)),s>i.length-3&&p.unshift(l(n.target)),e.snapPoints=t={horizontal:[],vertical:[]},M(p,function(e){e&&(e=e.original||e,"y"===c&&t.horizontal.push(e.y),"x"===c&&t.vertical.push(e.x))}),t}(e.context),r=e.x,o=e.y;if(i){var a=r-(t=p(i.vertical,r)),s=o-(n=p(i.horizontal,o));$(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n})}}),e.on("bendpoint.move.move",1500,function(e){var t=e.context,n=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:[]},M(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(t),i=t.target,r=i&&l(i),o=e.x,a=e.y;if(n){var s=o-p(r?n.vertical.concat([r.x]):n.vertical,o),c=a-p(r?n.horizontal.concat([r.y]):n.horizontal,a);$(e,{dx:e.dx-s,dy:e.dy-c,x:e.x-s,y:e.y-c})}})}Ts.$inject=["eventBus"];var As={__depends__:[Ga,Za],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",ss],bendpointMove:["type",ys],connectionSegmentMove:["type",ws],bendpointSnapping:["type",Ts]},Rs=Math.min,Ps=Math.max;function ks(e){e.preventDefault()}function Ms(e){e.stopPropagation()}function Ds(e){this.container=e.container,this.parent=ce('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=me("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=z(this.autoResize,this),this.handlePaste=z(this.handlePaste,this)}function Ns(e,t){this._eventBus=e,this._providers=[],this._textbox=new Ds({container:t.getContainer(),keyHandler:z(this._handleKey,this),resizeHandler:z(this._handleResize,this)})}Ds.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=H(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);$(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=H(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return $(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&$(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,oe.bind(o,"keydown",this.keyHandler),oe.bind(o,"mousedown",Ms),oe.bind(o,"paste",this.handlePaste),i.autoResize&&oe.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Ds.prototype.handlePaste=function(e){var n,t,i=this,r=this.options,o=this.style;if(e.preventDefault(),n=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,n)){var a,s,c=this.getSelection(),p=c.startContainer,l=c.endContainer,u=c.startOffset,h=c.endOffset,d=c.commonAncestorContainer,m=(t=d.childNodes,[].slice.call(t));if(d.nodeType===Node.TEXT_NODE){var f=p.textContent;p.textContent=f.substring(0,u)+n+f.substring(h),a=p,s=u+n.length}else if(p===this.content&&l===this.content){var y=document.createTextNode(n);this.content.insertBefore(y,m[u]),s=(a=y).textContent.length}else{var v=m.indexOf(p),g=m.indexOf(l);m.forEach(function(e,t){t===v?e.textContent=p.textContent.substring(0,u)+n+l.textContent.substring(h):v<t&&t<=g&&ye(e)}),a=p,s=u+n.length}a&&void 0!==s&&setTimeout(function(){i.setSelection(a,s)})}if(r.autoResize){var b=this.autoResize(o);b&&this.resizeHandler(b)}},Ds.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})}},Ds.prototype.resizable=function(){var i=this,r=this.parent,e=this.resizeHandle,o=parseInt(this.style.minWidth)||0,a=parseInt(this.style.minHeight)||0,s=parseInt(this.style.maxWidth)||1/0,c=parseInt(this.style.maxHeight)||1/0;if(!e){var p,l,u,h;e=this.resizeHandle=ce('<div class="djs-direct-editing-resize-handle"></div>');var n=function(e){ks(e),Ms(e);var t=Rs(Ps(u+e.clientX-p,o),s),n=Rs(Ps(h+e.clientY-l,a),c);r.style.width=t+"px",r.style.height=n+"px",i.resizeHandler({width:u,height:h,dx:e.clientX-p,dy:e.clientY-l})},d=function(e){ks(e),Ms(e),oe.unbind(document,"mousemove",n,!1),oe.unbind(document,"mouseup",d,!1)};oe.bind(e,"mousedown",function(e){ks(e),Ms(e),p=e.clientX,l=e.clientY;var t=r.getBoundingClientRect();u=t.width,h=t.height,oe.bind(document,"mousemove",n),oe.bind(document,"mouseup",d)})}$(e.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"}),r.appendChild(e)},Ds.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),oe.unbind(t,"keydown",this.keyHandler),oe.unbind(t,"mousedown",Ms),oe.unbind(t,"input",this.autoResize),oe.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),ye(n)),ye(e)},Ds.prototype.getValue=function(){return this.content.innerText},Ds.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ds.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)},Ns.$inject=["eventBus","canvas"],Ns.prototype.registerProvider=function(e){this._providers.push(e)},Ns.prototype.isActive=function(){return!!this._active},Ns.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ns.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ns.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Ns.prototype.complete=function(){var e=this._active;if(e){var t=this.getValue(),n=this.$textbox.getBoundingClientRect();(t!==e.context.text||this.resizable)&&e.provider.update(e.element,t,e.context.text,{x:n.top,y:n.left,width:n.width,height:n.height}),this._fire("complete"),this.close()}},Ns.prototype.getValue=function(){return this._textbox.getValue()},Ns.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())},Ns.prototype._handleResize=function(e){this._fire("resize",e)},Ns.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=P(this._providers,function(e){return(n=e.activate(t))?e:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:t,context:n,provider:e},n.options&&n.options.resizable&&(this.resizable=!0),this._fire("activate")),!!n};var Bs={__depends__:[co],__init__:["directEditing"],directEditing:["type",Ns]};function Os(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:i},this._current=null,this._init()}Os.$inject=["config.contextPad","eventBus","overlays"],Os.prototype._init=function(){var e=this._eventBus,i=this;e.on("selection.changed",function(e){var t=e.newSelection;1===t.length?i.open(t[0]):i.close()}),e.on("elements.delete",function(e){M(e.elements,function(e){i.isOpen(e)&&i.close()})}),e.on("element.changed",function(e){var t=e.element,n=i._current;n&&n.element===t&&i.open(t,!0)})},Os.prototype.registerProvider=function(e){this._providers.push(e)},Os.prototype.getEntries=function(t){var n={};return M(this._providers,function(e){M(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},Os.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[W(s,"data-action")].action,r=t.originalEvent||t,u(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},Os.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},Os.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),c=n.html;M(t,function(e,t){var n,i,r,o,a=e.group||"default",s=ce(e.html||'<div class="entry" draggable="true"></div>');W(s,"data-action",t),(n=me("[data-group="+a+"]",c))||(n=ce('<div class="group" data-group="'+a+'"></div>'),c.appendChild(n)),n.appendChild(s),e.className&&(i=s,r=e.className,o=K(i),(g(r)?r:r.split(/\s+/g)).forEach(function(e){o.add(e)})),e.title&&W(s,"title",e.title),e.imageUrl&&s.appendChild(ce('<img src="'+e.imageUrl+'">'))}),K(c).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},Os.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=ce('<div class="djs-context-pad"></div>'),r=$({html:i},this._overlaysConfig);se.bind(i,".entry","click",function(e){t.trigger("click",e)}),se.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),oe.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},Os.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},Os.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Ls={__depends__:[co,wo],contextPad:["type",Os]},Is="connect-ok",js="connect-not-ok";function zs(e,r,p,n,o,f){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n,i,r,o,a,s,c,p,l=e.context,u=l.source,h=l.target,d=l.visual,m=l.sourcePosition;t={x:e.x,y:e.y},i=m,r=t,o=u,a=h,s=f.getShapePath(o),c=a&&f.getShapePath(a),p=f.getConnectionPath({waypoints:[i,r]}),Ee(d,{points:[(n=[i=Yr(s,p,!0)||i,r=a&&Yr(c,p,!1)||r])[0].x,n[0].y,n[1].x,n[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,r=e.hover;null!==(t=n.canExecute=l(i,r))&&(n.target=r,o.addMarker(r,t?Is:js))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&o.removeMarker(t.target,t.canExecute?Is:js),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Pe(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;Ee(t=Be("polyline"),{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),ge(o.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,n=t.source,i=t.sourcePosition,r=t.target,o={x:e.x,y:e.y},a=t.canExecute||l(n,r);if(!a)return!1;var s=null,c={connectionStart:i,connectionEnd:o};"object"==typeof a&&(s=a),p.connect(n,r,s,c)}),this.start=function(e,t,n,i){"object"!=typeof n&&(i=n,n=qr(t)),r.init(e,"connect",{autoActivate:i,data:{shape:t,context:{source:t,sourcePosition:n}}})}}zs.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Fs={__depends__:[yo,Za,Ga],connect:["type",zs]},$s="drop-ok",Hs="drop-not-ok",Ws="attach-ok",Gs="new-parent";function Vs(e,i,c,p,o,a,s){function l(t,n){[Ws,$s,Hs,Gs].forEach(function(e){e===n?o.addMarker(t,e):o.removeMarker(t,e)})}e.on("create.move",function(e){var t,n=e.context,i=e.hover,r=n.shape,o=n.source,a={x:e.x,y:e.y};t=n.canExecute=i&&function(e,t,n,i){if(!t)return!1;var r,o,a,s={source:n,shape:e,target:t,position:i};return(o=c.allowed("shape.attach",s))||(r=c.allowed("shape.create",s)),(r||o)&&(a=n&&c.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:o}})),!(!r&&!o)&&{attach:o,connect:a}}(r,i,o,a),i&&null!==t&&(n.target=i,t&&t.attach?l(i,Ws):l(i,t?Gs:Hs))}),e.on("create.move",750,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;Ee(t=Be("g"),a.cls("djs-drag-group",["no-events"])),ge(o.getDefaultLayer(),t),Ae(n=Be("g")).add("djs-dragger"),ge(t,n),Xt(n,e.width/-2,e.height/-2);var r=Be("g");return Ae(r).add("djs-visual"),ge(n,r),i=r,s.drawShape(i,e),t}(n)),Xt(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&l(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,i=t.shape,r=t.target,o=t.canExecute,a=o&&o.attach,s=o&&o.connect,c={x:e.x,y:e.y};if(!o)return!1;i=s?p.appendShape(n,i,c,r,{attach:a,connection:!0===s?{}:s}):p.createShape(i,c,r,{attach:a}),t.shape=i}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Pe(t.visual)}),this.start=function(e,t,n){i.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:{shape:t,source:n}}})}}Vs.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var Us={__depends__:[Ga,yo,Za],create:["type",Vs]},qs="data-id";function Ks(e,t,n){var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}Ks.$inject=["config.popupMenu","eventBus","canvas"],Ks.prototype.registerProvider=function(e,t){this._providers[e]=t},Ks.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=0<i.length,a=r&&0<r.length;return!o&&!a},Ks.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)},Ks.prototype.close=function(){this.isOpen()&&(this._emit("close"),this._unbindHandlers(),ye(this._current.container),this._current.container=null)},Ks.prototype.isOpen=function(){return!!this._current.container},Ks.prototype.trigger=function(e){e.preventDefault();var t=W(e.delegateTarget||e.target,qs),n=this._getEntry(t);if(n.action)return n.action.call(null,e,n)},Ks.prototype._getEntry=function(e){var t=D({id:e}),n=P(this._current.entries,t)||P(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},Ks.prototype._emit=function(e){this._eventBus.fire("popupMenu."+e)},Ks.prototype._createContainer=function(){var e=ce('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return $(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),K(e).add(n),e},Ks.prototype._attachContainer=function(e,t,n){var i=this;se.bind(e,".entry","click",function(e){i.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},Ks.prototype._updateScale=function(e){var t,n,i,r,o=this._canvas.zoom(),a=this._config.scale,s=o;!0!==a&&(n=!1===a?t=1:(t=a.min,a.max),c(t)&&o<t&&(s=t),c(n)&&n<o&&(s=n)),r="scale("+s+")",(i=e).style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){i.style[e+"transform"]=r})},Ks.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"),$(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},Ks.prototype._createEntries=function(e,t){var n=ce("<div>"),i=this;return K(n).add(t),M(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},Ks.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=ce("<div>"),n=K(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),W(t,qs,e.id),e.label){var i=ce("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(ce('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},Ks.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)},Ks.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 Ys={__init__:["popupMenu"],popupMenu:["type",Ks]},Xs=Math.round;function Zs(e){this._modeling=e}Zs.$inject=["modeling"],Zs.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Xs(e.x+(t.width||e.width)/2),t.y=Xs(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var Qs={__init__:["replace"],replace:["type",Zs]},Js=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"];function ec(e,t){var n=[];return M(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n}function tc(e,t){this._eventBus=e,this._bpmnFactory=t}tc.prototype.clone=function(s,c,e){var p=this,l={newElement:c,hasNestedProperty:!1};return M(e=A(e,function(e){return"bpmn:extensionElements"===e}),function(e){var t,n,i,r=s.get(e),o=c.get(e),a=c.$model.getPropertyDescriptor(c,e);o!==r&&(a&&(a.isId||a.isReference)||(i=r,v(["boolean","string","number"],function(e){return typeof i===e})||null===r?c.set(e,r):g(r)?M(r,function(e){var t;l.refTopLevelProperty=e,t=p._deepClone(e,l),l.hasNestedProperty&&(t.$parent=c,o.push(t)),l.hasNestedProperty=!1}):(n=e.replace(/bpmn:/,""),l.refTopLevelProperty=r,t=p._deepClone(r,l),l.hasNestedProperty&&(t.$parent=c).set(n,t),l.hasNestedProperty=!1)))}),c},tc.prototype._deepClone=function(s,c){var p=this,l=this._eventBus,u=this._bpmnFactory.create(s.$type),e=k(Object.keys(s),function(e){var t=u.$model.getPropertyDescriptor(u,e);return(!t||!t.isId&&!t.isReference)&&(-1===Js.indexOf(e)&&"$type"!==e)});return e.length||(c.hasNestedProperty=!0),M(e,function(a){void 0!==s[a]&&(s[a].$type||g(s[a]))?g(s[a])?(u[a]=[],M(s[a],function(e){var t,n=s.$model.getTypeDescriptor(e.$type);if(n){var i,r,o;if(!l.fire("property.clone",{newElement:c.newElement,refTopLevelProperty:c.refTopLevelProperty,propertyDescriptor:n})&&"bpmn:ExtensionElements"===s.$type&&n.meta&&n.meta.allowedIn&&(i=n,r=c.newElement.$type,(1!==(o=i.meta.allowedIn).length||"*"!==o[0])&&-1===o.indexOf(r)))return!1;((t=p._deepClone(e,c)).$parent=u)[a]||(u[a]=[]),c.hasNestedProperty=!0,u[a].push(t)}})):s[a].$type&&(u[a]=p._deepClone(s[a],c),u[a]&&(c.hasNestedProperty=!0,u[a].$parent=u)):(c.hasNestedProperty=!0,u[a]=s[a])}),u};var nc=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function ic(f,y,v,g,e){var b=new tc(e,f);this.replaceElement=function(n,i,e){e=e||{};var t,r,o,a=i.type,s=n.businessObject;if(rc(s)&&"bpmn:SubProcess"===a&&(r=i,(o=(t=n)&&x(t,"collapsed")?t.collapsed:!ki(t))!==(r&&(x(r,"collapsed")||x(r,"isExpanded"))?x(r,"collapsed")?r.collapsed:!r.isExpanded:o)&&(t.collapsed=o,1)))return g.toggleCollapse(n),n;var c,p=f.create(a),l={type:a,businessObject:p},u=ec(s.$descriptor),h=ec(p.$descriptor,!0),d=(c=h,u.filter(function(e){return-1!==c.indexOf(e)}));$(p,H(i,nc));var m=k(d,function(e){var t=e.replace(/bpmn:/,"");return"eventDefinitions"===t?oc(n,i.eventDefinitionType):"loopCharacteristics"===t?!Mi(p):!(e in p||"processRef"===t&&!1===i.isExpanded||"triggeredByEvent"===t||-1!==Js.indexOf(t))});return p=b.clone(s,p,m),i.eventDefinitionType&&(oc(p,i.eventDefinitionType)||(l.eventDefinitionType=i.eventDefinitionType)),Ri(s,"bpmn:Activity")&&(rc(s)?l.isExpanded=ki(s):i&&x(i,"isExpanded")&&(l.isExpanded=i.isExpanded),ki(s)&&!Ri(s,"bpmn:Task")&&l.isExpanded&&(l.width=n.width,l.height=n.height)),rc(s)&&!rc(p)&&(e.moveChildren=!1),Ri(s,"bpmn:Participant")&&(!0===i.isExpanded?p.processRef=f.create("bpmn:Process"):e.moveChildren=!1,l.width=n.width,l.height=n.height),p.name=s.name,ga(s,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ga(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=s.default),("fill"in s.di||"stroke"in s.di)&&$(l,{colors:H(s.di,["fill","stroke"])}),l=y.replaceElement(n,l,e),!1!==e.select&&v.select(l),l}}function rc(e){return Ri(e,"bpmn:SubProcess")}function oc(e,t){var n=Pi(e);return t&&n.get("eventDefinitions").some(function(e){return Ri(e,t)})}ic.$inject=["bpmnFactory","replace","selection","modeling","eventBus"];var ac={__depends__:[yo,Qs],bpmnReplace:["type",ic]};function sc(c){return function(e){var t=e.target,n=Pi(c),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=n.triggeredByEvent===t.triggeredByEvent,s=void 0===t.isExpanded||t.isExpanded===ki(n);return!(r&&o&&a&&s)}}var cc=[{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"}}],pc=[{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"}}],lc=[{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"}}],uc=[{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"}}],hc=[{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}}],dc=[{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}}],mc=[{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}}],fc=[{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}}],yc=[{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}}],vc=[{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}}],gc=[{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"}],bc=[{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 xc(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()}xc.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],xc.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},xc.prototype.getEntries=function(r){var e,o=r.businessObject;if(!this._rules.allowed("shape.replace",{element:r}))return[];var a=sc(r);return Ri(o,"bpmn:StartEvent")&&!Mi(o.$parent)?(e=k(cc,a),this._createEntries(r,e)):Ri(o,"bpmn:Participant")?(e=k(bc,function(e){return ki(o)!==e.target.isExpanded}),this._createEntries(r,e)):Ri(o,"bpmn:StartEvent")&&Mi(o.$parent)?(e=k(vc,function(e){var t=!1!==e.target.isInterrupting,n=Pi(r).isInterrupting===t;return a(e)||!a(e)&&!n}),this._createEntries(r,e)):Ri(o,"bpmn:EndEvent")?(e=k(lc,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Ri(o.$parent,"bpmn:Transaction"))&&a(e)}),this._createEntries(r,e)):Ri(o,"bpmn:BoundaryEvent")?(e=k(yc,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Ri(o.attachedToRef,"bpmn:Transaction"))return!1;var n=!1!==t.cancelActivity,i=o.cancelActivity==n;return a(e)||!a(e)&&!i}),this._createEntries(r,e)):Ri(o,"bpmn:IntermediateCatchEvent")||Ri(o,"bpmn:IntermediateThrowEvent")?(e=k(pc,a),this._createEntries(r,e)):Ri(o,"bpmn:Gateway")?(e=k(uc,a),this._createEntries(r,e)):Ri(o,"bpmn:Transaction")?(e=k(dc,a),this._createEntries(r,e)):Mi(o)&&ki(o)?(e=k(mc,a),this._createEntries(r,e)):Ri(o,"bpmn:SubProcess")&&ki(o)?(e=k(hc,a),this._createEntries(r,e)):Ri(o,"bpmn:AdHocSubProcess")&&!ki(o)?(e=k(fc,function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return sc(r)&&(!n||i)}),this._createEntries(r,e)):Ri(o,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(r,gc):Ri(o,"bpmn:FlowNode")?(e=k(fc,a),Ri(o,"bpmn:SubProcess")&&!ki(o)&&(e=k(e,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(r,e)):[]},xc.prototype.getHeaderEntries=function(e){var t=[];return Ri(e,"bpmn:Activity")&&!Mi(e)&&(t=t.concat(this._getLoopEntries(e))),!Ri(e,"bpmn:SubProcess")||Ri(e,"bpmn:Transaction")||Mi(e)||t.push(this._getAdHocEntry(e)),t},xc.prototype._createEntries=function(n,e){var i=[],r=this;return M(e,function(e){var t=r._createMenuEntry(e,n);i.push(t)}),i},xc.prototype._createSequenceFlowEntries=function(t,e){var n=Pi(t),i=[],r=this._modeling,o=this._moddle,a=this;return M(e,function(e){switch(e.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Ri(n.sourceRef,"bpmn:ExclusiveGateway")||Ri(n.sourceRef,"bpmn:InclusiveGateway")||Ri(n.sourceRef,"bpmn:ComplexGateway")||Ri(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&Ri(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(e,t,function(){var e=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(t,{conditionExpression:e})}));break;default:if(Ri(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t,{conditionExpression:void 0})}));if((Ri(n.sourceRef,"bpmn:ExclusiveGateway")||Ri(n.sourceRef,"bpmn:InclusiveGateway")||Ri(n.sourceRef,"bpmn:ComplexGateway")||Ri(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:void 0})}))}}),i},xc.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}},xc.prototype._getLoopEntries=function(i){var r=this,e=this._translate;function t(e,t){var n;t.active?n=void 0:(n=r._moddle.create(t.options.loopCharacteristics),t.options.isSequential&&(n.isSequential=t.options.isSequential)),r._modeling.updateProperties(i,{loopCharacteristics:n})}var n,o,a,s=Pi(i).loopCharacteristics;return s&&(n=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:e("Parallel Multi Instance"),active:a,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:e("Sequential Multi Instance"),active:n,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:e("Loop"),active:o,action:t,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},xc.prototype._getAdHocEntry=function(n){var e=this._translate,i=Ri(Pi(n),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:e("Ad-hoc"),active:i,action:function(e,t){return r(n,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var _c={__depends__:[Ys,ac],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",xc]},Ec=Math.max,wc=Math.min,Sc=20;function Cc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Tc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return l(r)&&(i=(/top|left/.test(e)?wc:Ec)(i,r)),l(o)&&(i=(/top|left/.test(e)?Ec:wc)(i,o)),i}function Ac(e,t){return void 0!==e?e:Sc}function Rc(e){return!e.waypoints&&"label"!==e.type}function Pc(e,t){var n,i,r,o,a,s,c;if((n=void 0===e.length?k(e.children,Rc):e).length)return i=vt(n),"object"==typeof(r=t)?(o=Ac(r.left),a=Ac(r.right),s=Ac(r.top),c=Ac(r.bottom)):o=a=s=c=Ac(r),{x:i.x-o,y:i.y-s,width:i.width+o+a,height:i.height+s+c}}var kc=Math.abs;var Mc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function Dc(e,t){return t=t||[],e.children.filter(function(e){Ri(e,"bpmn:Lane")&&(Dc(e,t),t.push(e))}),t}function Nc(e){return e.children.filter(function(e){return Ri(e,"bpmn:Lane")})}function Bc(e){return function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(ga(e,t))return e;return null}(e,Mc)||e}function Oc(c,e){var t,n=Bc(c),i=Dc(n,Ri(n,"bpmn:Process")?[]:[n]),p=Vr(c),l=Vr(e),u=(t=c,Cc(Vr(e),Vr(t))),h=[];return i.forEach(function(e){if(e!==c){var t,n,i=0,r=u.right,o=0,a=u.left,s=Vr(e);u.top&&(kc(s.bottom-p.top)<10&&(o=l.top-s.bottom),kc(s.top-p.top)<5&&(i=l.top-s.top)),u.bottom&&(kc(s.top-p.bottom)<10&&(i=l.bottom-s.top),kc(s.bottom-p.bottom)<5&&(o=l.bottom-s.bottom)),(i||r||o||a)&&h.push({shape:e,newBounds:(t=e,n={top:i,right:r,bottom:o,left:a},{x:t.x+(n.left||0),y:t.y+(n.top||0),width:t.width-(n.left||0)+(n.right||0),height:t.height-(n.top||0)+(n.bottom||0)})})}}),h}function Lc(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(oo(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function Ic(e,t,n){var i=e.$instanceOf(t),r=!1;return M(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}Lc.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],Lc.prototype.getContextPadEntries=function(t){var p=this._contextPad,i=this._modeling,o=this._elementFactory,n=this._connect,a=this._create,l=this._popupMenu,u=this._canvas,e=this._rules,s=this._autoPlace,c=this._translate,r={};if("label"===t.type)return r;var h=t.businessObject;function d(e,t){n.start(e,t)}function m(i,e,t,r){function n(e,t){var n=o.createShape($({type:i},r));a.start(e,n,t)}return"string"!=typeof t&&(r=t,t=c("Append {type}",{type:i.replace(/^bpmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:s?function(e,t){var n=o.createShape($({type:i},r));s.append(t,n)}:n}}}function f(n){return function(e,t){i.splitLane(t,n),p.open(t,!0)}}if(ga(h,["bpmn:Lane","bpmn:Participant"])&&ki(h)){var y=Nc(t);$(r,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add Lane above"),action:{click:function(e,t){i.addLane(t,"top")}}}}),y.length<2&&(120<=t.height&&$(r,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two Lanes"),action:{click:f(2)}}}),180<=t.height&&$(r,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:f(3)}}})),$(r,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add Lane below"),action:{click:function(e,t){i.addLane(t,"bottom")}}}})}Ri(h,"bpmn:FlowNode")&&(Ri(h,"bpmn:EventBasedGateway")?$(r,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ic(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?$(r,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):Ri(h,"bpmn:EndEvent")||h.isForCompensation||Ic(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Mi(h)||$(r,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),l.isEmpty(t,"bpmn-replace")||$(r,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,t){var n,i,r,o,a,s,c=$((n=t,i=u.getContainer(),r=p.getPad(n).html,o=i.getBoundingClientRect(),a=r.getBoundingClientRect(),s=a.top-o.top,{x:a.left-o.left,y:s+a.height+5}),{cursor:{x:e.x,y:e.y}});l.open(t,"bpmn-replace",c)}}}}),ga(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&$(r,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using "+(h.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:d,dragstart:d}}}),ga(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&$(r,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using DataInputAssociation"),action:{click:d,dragstart:d}}});var v=e.allowed("elements.delete",{elements:[t]});return g(v)&&(v=v[0]===t),v&&$(r,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(e){i.removeElements([t])}}}}),r};var jc={__depends__:[Bs,Ls,yo,Fs,Us,_c],__init__:["contextPadProvider"],contextPadProvider:["type",Lc]};function zc(){}zc.prototype.get=function(){return this._data},zc.prototype.set=function(e){this._data=e},zc.prototype.clear=function(){var e=this._data;return delete this._data,e},zc.prototype.isEmpty=function(){return!this._data};var Fc={clipboard:["type",zc]};function $c(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,n){return n.priority=1,n.id=e.id,e.parent&&(n.parent=e.parent.id),e.labelTarget&&(n.priority=4,n.labelTarget=e.labelTarget.id),e.host&&(n.priority=2,n.host=e.host.id),"number"==typeof e.x&&(n.x=e.x,n.y=e.y),e.width&&(n.width=e.width,n.height=e.height),e.waypoints&&(n.priority=3,n.waypoints=[],M(e.waypoints,function(e){var t={x:e.x,y:e.y};e.original&&(t.original={x:e.original.x,y:e.original.y}),n.waypoints.push(t)})),e.source&&e.target&&(n.source=e.source.id,n.target=e.target.id),n})}$c.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],$c.prototype.copy=function(e){var t,r,n=this._clipboard;if(g(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),r=this._bbox=qo(vt(t.allShapes)),delete t.allShapes,M(t,function(i){M(i,function(e){var n,t;e.labelTarget?(t=P(i,D({id:e.labelTarget})),n=t.waypoints?Ko(e,t.waypoints[0]):Ko(e,t)):3===e.priority?(n=[],M(e.waypoints,function(e){var t=Ko(e,r);n.push(t)})):n=Ko(e,r),e.delta=n})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?n.clear():n.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},$c.prototype.paste=function(e){var t,n=this._clipboard,i=this._modeling,r=this._eventBus,o=this._rules,a=n.get(),s=e.element,c=e.point;n.isEmpty()||(t=_(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)||(e[i]=t),e},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},$c.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Ko(t,t.labelTarget):(3===t.priority?(i=[],M(t.waypoints,function(e){var t=Ko(e,n);i.push(t)})):i=Ko(t,n),i)},$c.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=P(e,D({id:t.source.id})),i=P(e,D({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!P(e,D({id:t.labelTarget.id})))},$c.prototype.registerDescriptor=function(e){if("function"!=typeof e)throw new Error("the descriptor must be a function");if(-1!==this._descriptors.indexOf(e))throw new Error("this descriptor is already registered");this._descriptors.push(e)},$c.prototype._executeDescriptors=function(t){return t.descriptor||(t.descriptor={}),M(this._descriptors,function(e){t.descriptor=e(t.element,t.descriptor)}),t},$c.prototype.createTree=function(e){var r,n,i,t,o,a=this._rules,s=this,c={},p=[],l=(n={},i=[],t=[],o=[],M(e,function(e){var t=e.parent;n[t.id]||(n[t.id]=[]),-1===i.indexOf(t.id)&&i.push(t.id),n[t.id].push(e)}),M(i,function(e){M(n[e],function(e){n[e.id]&&o.push(e.id)})}),M(i,function(e){-1===o.indexOf(e)&&(t=t.concat(n[e]))}),t);function u(e){var t=m(p,D({element:e.element}));if(-1===t)return p.push(e);p[t].depth<e.depth&&(p.splice(t,1),p.push(e))}return c.allShapes=[],ft(l,function(e,t,n){var i=e.children;if(!e.labelTarget)return M(e.labels,function(e){u({element:e,depth:n})}),M([e.attachers,e.incoming,e.outgoing],function(e){e&&e.length&&M(e,function(e){M(e.labels,function(e){u({element:e,depth:n})}),u({element:e,depth:n})})}),u({element:e,depth:n}),i||void 0}),p=A(p=b(p,function(e){return s._executeDescriptors(e)}),function(e){return e.descriptor.priority}),r=b(p,function(e){return e.element}),M(p,function(e){var t,n,i=e.depth;s.hasRelations(c.allShapes,e.element)&&(t=r,n=e.element,a.allowed("element.copy",{collection:t,element:n})&&(c.allShapes.push(e.element),c[i]||(c[i]=[]),c[i].push(e.descriptor)))}),c};var Hc={__depends__:[Fc,Za,Ua],__init__:["copyPaste"],copyPaste:["type",$c]};function Wc(t,n,e){M(e,function(e){void 0!==n[e]&&(t[e]=n[e])})}function Gc(h,e,t,n,d,m){var f=new tc(e,h);t.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Pi(e),i={};return t.type=e.type,Wc(t,n.di,["isExpanded"]),Wc(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type||(Wc(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id)),t}),e.on("element.paste",function(e){var t,n,i,r,o=e.descriptor,a=e.createdElements,s=o.parent,c=d.getRootElement(),p=o.oldBusinessObject;t=h.create(p.$type);var l,u=ec(p.$descriptor);(u=k(u,function(e){return-1===Js.indexOf(e.replace(/bpmn:/,""))}),o.businessObject=f.clone(p,t,u),"label"!==o.type)&&(Ri(s,"bpmn:Process")&&(o.parent=Ri(c,"bpmn:Collaboration")?c:s),"bpmn:DataOutputAssociation"!==o.type&&"bpmn:DataInputAssociation"!==o.type&&"bpmn:MessageFlow"!==o.type||(o.parent=c),Ri(s,"bpmn:Lane")&&(o.parent=s.parent),o.waypoints&&(n=a[o.source],i=a[o.target],n&&i&&(n=n.element,i=i.element),(r=m.canConnect(n,i))&&(o.type=r.type)),delete t.id,h._ensureId(t),"bpmn:Participant"===o.type&&o.processRef&&(o.processRef=t.processRef=h.create("bpmn:Process")),Wc(t,o,["isExpanded","triggeredByEvent"]),l=o,M(["triggeredByEvent"],function(e){l[e]&&delete l[e]}))})}Gc.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Vc={__depends__:[Hc],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",Gc]},Uc={horizontal:["x","width"],vertical:["y","height"]};function qc(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return M(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),k(e,function(e){return e[n]<i+50})})}qc.$inject=["modeling"],qc.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},qc.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},qc.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(M(t,function(e){r=e(r,n,i)}),r):e},qc.prototype._createGroups=function(e){var o=[],a=this,s=this._axis,c=this._dimension;if(!s)throw new Error('must have a defined "axis" and "dimension"');return M(A(e,s),function(e,t){var n,i=a._findRange(e,s,c),r=o[o.length-1];r&&a._hasIntersection(r.range,i)?o[o.length-1].elements.push(e):(n={range:i,elements:[e]},o.push(n))}),o},qc.prototype._setOrientation=function(e){var t=Uc[e];this._axis=t[0],this._dimension=t[1]},qc.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)},qc.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Kc={__init__:["distributeElements"],distributeElements:["type",qc]};function Yc(e){e.registerFilter(function(e){return k(e,function(e){var t=ga(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}Yc.$inject=["distributeElements"];var Xc={__depends__:[Kc],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",Yc]},Zc="is not a registered action";function Qc(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function Jc(e,t){return new Error(e+" "+t)}Qc.$inject=["eventBus","injector"],Qc.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),i=e.get("modeling",!1),r=e.get("selection",!1),n=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("mouseTracking",!1),p=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var e=r.get();o.copy(e)}),c&&o&&this.register("paste",function(){var e=c.getHoverContext();o.paste(e)}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),i&&r&&s&&this.register("removeSelection",function(){var e=r.get();if(e.length){var t,n=s.allowed("elements.delete",{elements:e});!1!==n&&(t=g(n)?n:e).length&&i.removeElements(t.slice())}}),p&&this.register("moveCanvas",function(e){p.moveCanvas(e)}),l&&this.register("moveSelection",function(e){l.moveSelection(e.direction,e.accelerated)})},Qc.prototype.trigger=function(e,t){if(!this._actions[e])throw Jc(e,Zc);return this._actions[e](t)},Qc.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);M(e,function(e,t){n._registerAction(t,e)})},Qc.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Jc(e,"is already registered");this._actions[e]=t},Qc.prototype.unregister=function(e){if(!this.isRegistered(e))throw Jc(e,Zc);this._actions[e]=void 0},Qc.prototype.getActions=function(){return Object.keys(this._actions)},Qc.prototype.isRegistered=function(e){return!!this._actions[e]};var ep={__init__:["editorActions"],editorActions:["type",Qc]};function tp(e){e.invoke(Qc,this)}t(tp,Qc),tp.$inject=["injector"],tp.prototype._registerDefaultActions=function(e){Qc.prototype._registerDefaultActions.call(this,e);var i=e.get("canvas",!1),r=e.get("elementRegistry",!1),o=e.get("selection",!1),t=e.get("spaceTool",!1),n=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);i&&r&&o&&this._registerAction("selectElements",function(){var t=i.getRootElement(),e=r.filter(function(e){return e!==t});return o.select(e),e}),t&&this._registerAction("spaceTool",function(){t.toggle()}),n&&this._registerAction("lassoTool",function(){n.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),o&&c&&this._registerAction("distributeElements",function(e){var t=o.get(),n=e.type;t.length&&c.trigger(t,n)}),o&&p&&this._registerAction("alignElements",function(e){var t=o.get(),n=[],i=e.type;t.length&&(n=k(t,function(e){return!Ri(e,"bpmn:Lane")}),p.trigger(n,i))}),o&&h&&this._registerAction("setColor",function(e){var t=o.get();t.length&&h.setColor(t,e)}),o&&l&&this._registerAction("directEditing",function(){var e=o.get();e.length&&l.activate(e[0])}),u&&this._registerAction("find",function(){u.toggle()}),i&&h&&this._registerAction("moveToOrigin",function(){var e,t,n=i.getRootElement();e=vt(t=Ri(n,"bpmn:Collaboration")?r.filter(function(e){return Ri(e.parent,"bpmn:Collaboration")}):r.filter(function(e){return e!==n&&!Ri(e.parent,"bpmn:SubProcess")})),h.moveElements(t,{x:-e.x,y:-e.y},n)})};var np={__depends__:[ep],editorActions:["type",tp]};function ip(e){e.invoke(Io,this)}t(ip,Io),ip.$inject=["injector"],ip.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}Io.prototype.registerBindings.call(this,n,i),e("selectElements",function(e){var t=e.keyEvent;if(n.isKey(["a","A"],t)&&n.isCmd(t))return i.trigger("selectElements"),!0}),e("find",function(e){var t=e.keyEvent;if(n.isKey(["f","F"],t)&&n.isCmd(t))return i.trigger("find"),!0}),e("spaceTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["s","S"],t)?(i.trigger("spaceTool"),!0):void 0}),e("lassoTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["l","L"],t)?(i.trigger("lassoTool"),!0):void 0}),e("handTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["h","H"],t)?(i.trigger("handTool"),!0):void 0}),e("globalConnectTool",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["c","C"],t)?(i.trigger("globalConnectTool"),!0):void 0}),e("directEditing",function(e){var t=e.keyEvent;if(!n.hasModifier(t))return n.isKey(["e","E"],t)?(i.trigger("directEditing"),!0):void 0})};var rp={__depends__:[jo],__init__:["keyboardBindings"],keyboardBindings:["type",ip]},op={moveSpeed:1,moveSpeedAccelerated:10},ap={ArrowLeft:"left",Left:"left",ArrowUp:"up",Up:"up",ArrowRight:"right",Right:"right",ArrowDown:"down",Down:"down"},sp={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 cp(e,r,o,a){var s=this;this._config=$({},op,e||{}),r.addListener(1500,function(e){var t=e.keyEvent,n=ap[t.key];if(n&&!r.isCmd(t)){var i=r.isShift(t);return s.moveSelection(n,i),!0}}),this.moveSelection=function(e,t){var n=a.get();if(n.length){var i=this._config[t?"moveSpeedAccelerated":"moveSpeed"],r=sp[e](i);o.moveElements(n,r)}}}cp.$inject=["config.keyboardMoveSelection","keyboard","modeling","selection"];var pp={__depends__:[jo,yo],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",cp]};function lp(n,i,r,o){n.on("element.changed",function(e){var t=e.element;(t.parent||t===i.getRootElement())&&(e.gfx=r.getGraphics(t)),e.gfx&&n.fire(gt(t)+".changed",e)}),n.on("elements.changed",function(e){var t=e.elements;t.forEach(function(e){n.fire("element.changed",{element:e})}),o.updateContainments(t)}),n.on("shape.changed",function(e){o.update("shape",e.element,e.gfx)}),n.on("connection.changed",function(e){o.update("connection",e.element,e.gfx)})}lp.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var up={__init__:["changeSupport"],changeSupport:["type",lp]};function hp(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}hp.$inject=["elementRegistry","canvas","styles"],hp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},hp.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=n.cloneNode(!0),r=n.getBoundingClientRect();return e.waypoints&&function t(e){e.children&&M(e.children,function(e){t(e)});e.style.markerStart="";e.style.markerEnd=""}(i),Ee(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),ge(t,i),i},hp.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 ge(t,n),n};var dp={__init__:["previewSupport"],previewSupport:["type",hp]};function mp(e,t,o,n){this._dragging=n,this._rules=t;var a=this;function i(e,t){var n,i=e.shape,r=e.direction,o=e.resizeConstraints;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,r,e.delta=t),e.newBounds=function(e,t){if(!t)return e;var n=Vr(e);return Ur({top:Tc("top",n,t),right:Tc("right",n,t),bottom:Tc("bottom",n,t),left:Tc("left",n,t)})}(n,o),e.canExecute=a.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=a.computeMinResizeBox(t)),t.resizeConstraints={min:Vr(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};i(e.context,t)}),e.on("resize.end",function(e){var t,n,i,r;t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds,i&&(r=Wr(r),o.resizeShape(n,r))})}mp.prototype.canResize=function(e){var t=this._rules,n=H(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},mp.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=$({shape:t},n)).direction))throw new Error("must provide a direction (nw|se|ne|sw)");o.init(e,"resize",{autoActivate:!0,cursor:"resize-"+(/nw|se/.test(r)?"nwse":"nesw"),data:{shape:t,context:i}})},mp.prototype.computeMinResizeBox=function(e){var t,n,i,r,o,a,s,c,p=e.shape,l=e.direction;return t=e.minDimensions||{width:10,height:10},n=Pc(p,e.childrenBoxPadding),i=l,r=t,o=n,a=Vr(p),s={top:/n/.test(i)?a.bottom-r.height:a.top,left:/w/.test(i)?a.right-r.width:a.left,bottom:/s/.test(i)?a.top+r.height:a.bottom,right:/e/.test(i)?a.left+r.width:a.right},c=o?Vr(o):s,Ur({top:wc(s.top,c.top),left:wc(s.left,c.left),bottom:Ec(s.bottom,c.bottom),right:Ec(s.right,c.right)})},mp.$inject=["eventBus","rules","modeling","dragging"];var fp="djs-resizing",yp="resize-not-ok";function vp(e,o,a){e.on("resize.move",500,function(e){var t,n,i,r;t=e.context,n=t.shape,i=t.newBounds,(r=t.frame)||(r=t.frame=a.addFrame(n,o.getDefaultLayer()),o.addMarker(n,fp)),5<i.width&&Ee(r,{x:i.x,width:i.width}),5<i.height&&Ee(r,{y:i.y,height:i.height}),t.canExecute?Ae(r).remove(yp):Ae(r).add(yp)}),e.on("resize.cleanup",function(e){var t,n;t=e.context,n=t.shape,t.frame&&Pe(t.frame),o.removeMarker(n,fp)})}vp.$inject=["eventBus","canvas","previewSupport"];var gp="djs-resizer";function bp(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&&M(t,z(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}bp.prototype.makeDraggable=function(t,e,n){var i=this._resize;function r(e){ro(e)&&i.activate(e,t,n)}oe.bind(e,"mousedown",r),oe.bind(e,"touchstart",r)},bp.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=Be("g");Ae(a).add(gp),Ae(a).add(gp+"-"+e.id),Ae(a).add(gp+"-"+r),ge(o,a);var s=Be("rect");Ee(s,{x:-7,y:-7,width:5,height:5}),Ae(s).add(gp+"-visual"),ge(a,s);var c=Be("rect");return Ee(c,{x:-7,y:-7,width:20,height:20}),Ae(c).add(gp+"-hit"),ge(a,c),Yt(a,t,n,i),a},bp.prototype.createResizer=function(e,t){var n,i=Vr(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)},bp.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"))},bp.prototype.removeResizers=function(){ke(this._getResizersParent())},bp.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},bp.$inject=["eventBus","canvas","selection","resize"];var xp={__depends__:[Za,Ga,dp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",mp],resizePreview:["type",vp],resizeHandles:["type",bp]};function _p(e){return Ri(e,"bpmn:FlowElement")||Ri(e,"bpmn:Participant")||Ri(e,"bpmn:Lane")||Ri(e,"bpmn:SequenceFlow")||Ri(e,"bpmn:MessageFlow")?"name":Ri(e,"bpmn:TextAnnotation")?"text":void 0}function Ep(e){var t=e.businessObject,n=_p(t);if(n)return t[n]||""}function wp(e,t,n,i,r,o){function a(e,t){(t||ga(e,["bpmn:Task","bpmn:TextAnnotation"])||Sp(e))&&n.activate(e)}this._canvas=t,this._modeling=i,this._textRenderer=o,n.registerProvider(this),e.on("element.dblclick",function(e){a(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace","popupMenu.open"],function(e){n.isActive()&&n.complete()}),e.on(["commandStack.changed"],function(e){n.isActive()&&n.cancel()}),e.on("directEditing.activate",function(e){r.removeResizers()}),e.on("create.end",500,function(e){var t=e.shape,n=e.context.canExecute;e.isTouch||n&&a(t)}),e.on("autoPlace.end",500,function(e){a(e.shape)})}function Sp(e){return Ri(e,"bpmn:SubProcess")&&!ki(e)}wp.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles","textRenderer"],wp.prototype.activate=function(e){var t=Ep(e);if(void 0!==t){var n={text:t};$(n,this.getEditingBBox(e));var i={};return(ga(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Sp(e))&&$(i,{centerVertically:!0}),er(e)&&$(i,{autoResize:!0}),Ri(e,"bpmn:TextAnnotation")&&$(i,{resizable:!0,autoResize:!0}),$(n,{options:i}),n}},wp.prototype.getEditingBBox=function(e){var t,n,i,r=this._canvas,o=e.label||e,a=r.getAbsoluteBBox(o),s=a.x+a.width/2,c=a.y+a.height/2,p={x:a.x,y:a.y},l=r.zoom(),u=this._textRenderer.getDefaultStyle(),h=this._textRenderer.getExternalStyle(),d=h.fontSize*l,m=h.lineHeight,f=u.fontSize*l,y=u.lineHeight,v={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};(Ri(e,"bpmn:Lane")||Ri(t=e,"bpmn:Participant")&&ki(t))&&($(p,{width:a.height,height:30*l,x:a.x-a.height/2+15*l,y:c-30*l/2}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px",transform:"rotate(-90deg)"})),(ga(e,["bpmn:Task","bpmn:CallActivity"])||Ri(n=e,"bpmn:Participant")&&!ki(n)||Sp(e))&&($(p,{width:a.width,height:a.height}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"})),Ri(i=e,"bpmn:SubProcess")&&ki(i)&&($(p,{width:a.width,x:a.x}),$(v,{fontSize:f+"px",lineHeight:y,paddingTop:7*l+"px",paddingBottom:7*l+"px",paddingLeft:5*l+"px",paddingRight:5*l+"px"}));var g=90*l,b=7*l,x=4*l;if(o.labelTarget&&($(p,{width:g,height:a.height+b+x,x:s-g/2,y:a.y-b}),$(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})),er(o)&&!tr(o)&&!rr(o)){var _=ir(e),E=r.getAbsoluteBBox({x:_.x,y:_.y,width:0,height:0}),w=d+b+x;$(p,{width:g,height:w,x:E.x-g/2,y:E.y-w/2}),$(v,{fontSize:d+"px",lineHeight:m,paddingTop:b+"px",paddingBottom:x+"px"})}return Ri(e,"bpmn:TextAnnotation")&&($(p,{width:a.width,height:a.height,minWidth:30*l,minHeight:10*l}),$(v,{textAlign:"left",paddingTop:5*l+"px",paddingBottom:7*l+"px",paddingLeft:7*l+"px",paddingRight:5*l+"px",fontSize:f+"px",lineHeight:y})),{bounds:p,style:v}},wp.prototype.update=function(e,t,n,i){var r,o,a;Ri(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}),(a=t)&&a.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var Cp="djs-element-hidden",Tp="djs-label-hidden";function Ap(e,a,t,s){var c,p,l,u=this,h=a.getDefaultLayer();e.on("directEditing.activate",function(e){var t,n,i=e.active;if(Ri(c=i.element.label||i.element,"bpmn:TextAnnotation")){p=a.getAbsoluteBBox(c),l=Be("g");var r=s.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:c.width,containerHeight:c.height,position:{mx:0,my:0}}),o=u.path=Be("path");Ee(o,{d:r,strokeWidth:2,stroke:(t=c,Pi(t).di.get("stroke")||n||"black")}),ge(l,o),ge(h,l),Xt(l,c.x,c.y)}Ri(c,"bpmn:TextAnnotation")||c.labelTarget?a.addMarker(c,Cp):(Ri(c,"bpmn:Task")||Ri(c,"bpmn:CallActivity")||Ri(c,"bpmn:SubProcess")||Ri(c,"bpmn:Participant"))&&a.addMarker(c,Tp)}),e.on("directEditing.resize",function(e){if(Ri(c,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,i=Math.max(c.height/p.height*(t+n),0),r=s.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:c.width,containerHeight:i,position:{mx:0,my:0}});Ee(u.path,{d:r})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var t=e.active;t&&(a.removeMarker(t.element.label||t.element,Cp),a.removeMarker(c,Tp)),p=c=void 0,l&&(Pe(l),l=void 0)})}Ap.$inject=["eventBus","canvas","elementRegistry","pathMap"];var Rp={__depends__:[up,xp,Bs],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",wp],labelEditingPreview:["type",Ap]};function Pp(e,c){function r(e){if(tr(e)){var t=function(e){var t=qr(e.label),n=qr(e),i=Mp(n,t);if(r=i,-1===kp.indexOf(r))return;var r;var o=[].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 Mp(n,e)}),a=kp.filter(function(e){return-1===o.indexOf(e)});return-1===a.indexOf(i)?a[0]:void 0}(e);t&&function(e,t){var n,i=qr(e),r=e.label,o=qr(r),a=Vr(e);switch(t){case"top":n={x:i.x,y:a.top-p-r.height/2};break;case"left":n={x:a.left-p-r.width/2,y:i.y};break;case"bottom":n={x:i.x,y:a.bottom+p+r.height/2};break;case"right":n={x:a.right+p+r.width/2,y:i.y}}var s=Ko(n,o);c.moveShape(r,s)}(e,t)}}Da.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t=e.context.connection,n=t.source,i=t.target;r(n),r(i)}),this.postExecuted(["label.create"],function(e){r(e.context.shape.labelTarget)});var p=10}t(Pp,Da),Pp.$inject=["eventBus","modeling"];var kp=["top","bottom","left","right"];function Mp(e,t){return Kr(t,e,5)}function Dp(e,t,n){Da.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(Ri(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 Np(e,r){function o(e){return k(e.attachers,function(e){return Ri(e,"bpmn:BoundaryEvent")})}Da.call(this,e),this.postExecute("connection.create",function(e){var t=e.context.source,n=e.context.target,i=o(n);Ri(t,"bpmn:EventBasedGateway")&&Ri(n,"bpmn:ReceiveTask")&&0<i.length&&r.removeElements(i)}),this.postExecute("connection.reconnectStart",function(e){var t=e.context.oldSource,n=e.context.newSource;Ri(t,"bpmn:Gateway")&&Ri(n,"bpmn:EventBasedGateway")&&M(n.outgoing,function(e){var t=e.target,n=o(t);Ri(t,"bpmn:ReceiveTask")&&0<n.length&&r.removeElements(n)})})}function Bp(e,a,n){Da.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Ri(t,"bpmn:Lane"))for(;Ri(t=e.topParent=t.parent,"bpmn:Lane")||!Ri(t,"bpmn:Participant"););},!0),this.postExecute("elements.paste",function(e){var o=e.tree.createdElements;M(o,function(e){var t,n=e.element,i=n.businessObject,r=e.descriptor;(Ri(i,"bpmn:ExclusiveGateway")||Ri(i,"bpmn:InclusiveGateway")||Ri(i,"bpmn:Activity"))&&r.default&&(t=(t=o[r.default])?t.element:void 0,delete n.default,a.updateProperties(n,{default:t}))})},!0)}function Op(e,t,o,a){Da.call(this,e),this.preExecute("shape.create",function(e){var t,n=e.shape,i=e.host,r={cancelActivity:!0};i&&Ri(n,"bpmn:IntermediateThrowEvent")&&(r.attachedToRef=i.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:a.create("bpmn:BoundaryEvent",r)},e.shape=o.createShape(t))},!0)}function Lp(e,i,t){Da.call(this,e),this.preExecute("shape.create",function(e){var t=e.context.shape;if(Ri(t,"bpmn:DataObjectReference")&&"label"!==t.type){var n=i.create("bpmn:DataObject");t.businessObject.dataObjectRef=n}})}function Ip(e,a,t,n,s){Da.call(this,e),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape,i=e.position,r=s.getRootElement();if(Ri(t,"bpmn:Process")&&Ri(n,"bpmn:Participant")&&!Ri(r,"bpmn:Collaboration")){var o=a.makeCollaboration();e.position=i,e.parent=o,e.processRoot=t}},!0),this.execute("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(e.oldProcessRef=n.businessObject.processRef,n.businessObject.processRef=t.businessObject)},!0),this.revert("shape.create",function(e){var t=e.processRoot,n=e.shape;t&&(n.businessObject.processRef=e.oldProcessRef)},!0),this.postExecute("shape.create",function(e){var t=e.processRoot,n=e.shape;if(t){var i=t.children.slice();a.moveElements(i,{x:0,y:0},n)}},!0)}t(Dp,Da),Dp.$inject=["eventBus","elementFactory","bpmnRules"],Np.$inject=["eventBus","modeling"],t(Np,Da),Bp.$inject=["eventBus","modeling","canvas"],t(Bp,Da),Op.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],t(Op,Da),Lp.$inject=["eventBus","bpmnFactory","moddle"],t(Lp,Da),Ip.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],t(Ip,Da);var jp="__targetRef_placeholder";function zp(e,r){function u(e,t){var n=e.get("properties"),i=P(n,function(e){return e.name===jp});return!i&&t&&ht(n,i=r.create("bpmn:Property",{name:jp})),i}function h(e,t){var n,i,r=u(e);r&&(n=r,i=t,P(e.get("dataInputAssociations"),function(e){return e!==i&&e.targetRef===n})||ut(e.get("properties"),r))}function t(e){var t=e.context,n=t.connection,i=n.businessObject,r=n.target,o=r&&r.businessObject,a=t.newTarget,s=a&&a.businessObject,c=t.oldTarget||t.target,p=c&&c.businessObject,l=n.businessObject;p&&p!==o&&h(p,i),s&&s!==o&&h(s,i),l.targetRef=o?u(o,!0):null}Da.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Fp(t)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],Fp(t))}function Fp(t){return function(e){if(Ri(e.context.connection,"bpmn:DataInputAssociation"))return t(e)}}function $p(e){this._bpmnUpdater=e}function Hp(i,r,o,e){function a(e){return e.children.filter(function(e){return Ri(e,"bpmn:DataStoreReference")&&!e.labelTarget})}function s(e,t){var n=e.businessObject||e;if(t=t||o.filter(function(e){return Ri(e,"bpmn:Participant")})[0]){var i=t.businessObject||t;r.execute("dataStore.updateContainment",{dataStoreBo:n,newSemanticParent:i.processRef||i,newDiParent:i.di})}}Da.call(this,e),r.registerHandler("dataStore.updateContainment",$p),this.preExecute("shape.create",function(e){var t=e.context,n=t.shape;Ri(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 Ri(e,"bpmn:DataStoreReference")}).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter(function(e){return!Ri(e,"bpmn:DataStoreReference")}))}),this.postExecute("shape.create",function(e){var t=e.context.shape,n=t.parent;Ri(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Ri(n,"bpmn:Collaboration")&&s(t)}),this.postExecute("shape.move",function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Ri(i,"bpmn:Collaboration")||Ri(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Ri(r,"bpmn:Collaboration")&&s(n,Ri(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Ri(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))}),this.postExecute("shape.delete",function(e){var t=e.context.shape,n=i.getRootElement();ga(t,["bpmn:Participant","bpmn:SubProcess"])&&Ri(n,"bpmn:Collaboration")&&a(n).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,t)}).forEach(function(e){s(e)})}),this.postExecute("canvas.updateRoot",function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;a(n).forEach(function(e){Ri(i,"bpmn:Process")&&s(e,i)})})}zp.$inject=["eventBus","bpmnFactory"],t(zp,Da),$p.$inject=["bpmnUpdater"],$p.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)},$p.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)},Hp.$inject=["canvas","commandStack","elementRegistry","eventBus"],t(Hp,Da);function Wp(e,t,h){Da.call(this,e),this.postExecuted("shape.delete",500,function(e){var t,n,i,r,o,a,s,c=e.context,p=c.hints,l=c.shape,u=c.oldParent;Ri(l,"bpmn:Lane")&&(p&&p.nested||(t=l,o=Nc(u),a=[],s=[],ft(o,function(e){return e.y>t.y?s.push(e):a.push(e),e.children}),o.length&&(n=s.length&&a.length?t.height/2:t.height,a.length&&(i=h.calculateAdjustments(a,"y",n,t.y-10),h.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:n},"s")),s.length&&(r=h.calculateAdjustments(s,"y",-n,t.y+t.height+10),h.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:-n},"n")))))})}function Gp(e,f,y){function r(e,t,n){var i,r,o,a,s,c,p,l=t.waypoints,u=e.outgoing.slice(),h=e.incoming.slice(),d=as(l,n);if(d){if(i=l.slice(0,d.index),r=l.slice(d.index+(d.bendpoint?1:0)),!i.length||!r.length)return;o=d.bendpoint?l[d.index]:n,Vp(e,i[i.length-1])||i.push(Up(o)),Vp(e,r[0])||r.unshift(Up(o))}a=t.source,s=t.target,f.canConnect(a,e,t)&&(y.reconnectEnd(t,e,i||n),c=t),f.canConnect(e,s,t)&&(p=c?y.connect(e,s,{type:t.type,waypoints:r}):(y.reconnectStart(t,e,r||n),t));var m=[].concat(c&&k(h,function(e){return e.source===c.source})||[],p&&k(u,function(e){return e.source===p.source})||[]);m.length&&y.removeElements(m)}Da.call(this,e),this.preExecute("elements.move",function(e){var t=e.newParent,n=e.shapes,i=e.delta,r=n[0];if(r&&t){t&&t.waypoints&&(e.newParent=t=t.parent);var o,a=(o=r,{x:Math.round(o.x+o.width/2),y:Math.round(o.y+o.height/2)}),s={x:a.x+i.x,y:a.y+i.y},c=P(t.children,function(e){return f.canInsert(n,e)&&as(e.waypoints,s)});c&&(e.targetFlow=c,e.position=s)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape;f.canInsert(n,t)&&(e.targetFlow=t,e.parent=t.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}function Vp(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 Up(e){return $({},e)}function qp(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 Kp(e){function r(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=qp(e,t,n,r),s=qp(e,t,n,o);i=a&&s?Yp(a,n)>Yp(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var t,n,i=e.element;i.waypoints&&(r((n=(t=i).waypoints)[0],n[1],qr(t.source)),r(n[n.length-1],n[n.length-2],qr(t.target)))})}function Yp(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xp(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Zp(e,t){return n={x:e.x-t.x,y:e.y-t.y},Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2));var n}Wp.$inject=["eventBus","modeling","spaceTool"],t(Wp,Da),t(Gp,Da),Gp.$inject=["eventBus","bpmnRules","modeling"],Kp.$inject=["eventBus"];var Qp=Math.sqrt,Jp=Math.min,el=Math.max,tl=Math.abs;function nl(e){return Math.pow(e,2)}function il(e,t){return Qp(nl(e.x-t.x)+nl(e.y-t.y))}function rl(r,o,e,t){var n=o.x-r.x,i=o.y-r.y,a=e.x-r.x,s=e.y-r.y,c=n*n+i*i,p=(n*a+i*s)/c,l=p*p-(a*a+s*s-t*t)/c;if(l<0&&-1e-6<l&&(l=0),l<0)return[];var u=Qp(l),h=-p+u,d=-p-u,m={x:r.x-n*h,y:r.y-i*h};return 0===l?[m]:[m,{x:r.x-n*d,y:r.y-i*d}].filter(function(e){return n=r,i=o,ol((t=e).x,n.x,i.x)&&ol(t.y,n.y,i.y);var t,n,i})}function ol(e,t,n){return e>=Jp(t,n)-al&&e<=el(t,n)+al}var al=.1;function sl(e,t){return tl(e.x-t.x)<=al&&tl(e.y-t.y)<=al}function cl(e,t,n,i){var r,o=0,a=0,s={x:(r=e).x+r.width/2,y:r.y+r.height/2},c=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m<t.length-1;m++){if((s=sl(n=t[m],i=t[m+1])?[n]:(r=il(e,n),o=il(e,i),rl(n,i,e,Jp(r,o)))).length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:sl(n,s[0])?m:m+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:m,relativeLocation:il(n,a)/il(n,i)}),p=il(c.position,e),(!u||p<l)&&(u=c,l=p)}return u}(s,n),p=c.segmentIndex,l=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:s<=r?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;return 0===o?r:(l<=r&&(c=p?r+1:r-1),r<l&&(c=r,p&&"bendpoint"!==n.type&&l-1===r&&pl(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,c,i);if(null===l)return{x:o,y:a};if(l<0||l>t.length-2)return{x:o,y:a};var u,h,d,m,f,y,v=ll(n,p),g=ll(t,l),b=c.position,x=(m=b,f=Zp((d=v)[0],d[1]),y=Zp(d[0],m),0===f?0:y/f),_=(u=g,h=Xp(v),Xp(u)-h);if("bendpoint"===c.type){var E=t.length-n.length,w=c.bendpointIndex,S=n[w];if(-1!==t.indexOf(S))return{x:o,y:a};if(0===E){var C=t[w];return{x:C.x-c.position.x,y:C.y-c.position.y}}E<0&&0!==w&&w<n.length-1&&(x=pl(n,w))}var T,A,R=(g[1].x-g[0].x)*x+g[0].x,P=(g[1].y-g[0].y)*x+g[0].y,k=(T={x:s.x-b.x,y:s.y-b.y},(A=_)?{x:Math.cos(A)*T.x-Math.sin(A)*T.y,y:Math.sin(A)*T.x+Math.cos(A)*T.y}:T);return Gr({x:o=R+k.x-s.x,y:a=P+k.y-s.y})}function pl(e,t){var n=Zp(e[t-1],e[t]);return n/(n+Zp(e[t],e[t+1]))}function ll(e,t){return[e[t],e[t+1]]}var ul={width:90,height:20};function hl(e,u,i,a){Da.call(this,e),this.postExecute("element.updateProperties",function(e){var t=e.context,n=t.element,i=t.properties;if("name"in i&&u.updateLabel(n,i.name),"text"in i&&Ri(n,"bpmn:TextAnnotation")){var r=a.getTextAnnotationBounds({x:n.x,y:n.y,width:n.width,height:n.height},i.text||"");u.updateLabel(n,i.text,r)}}),this.postExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=n.businessObject;if(er(n)&&i.name){var r=ir(n),o=a.getExternalLabelBounds(ul,i.name||"");u.createLabel(n,r,{id:i.id+"_label",businessObject:i,width:o.width,height:o.height})}}),this.postExecute("shape.delete",function(e){var t=e.context,n=t.labelTarget,i=t.hints||{};n&&!1!==i.unsetLabel&&u.updateLabel(n,null,null,{removeShape:!1})}),this.postExecute(["label.create"],function(e){var t,n=e.context.shape;n.labelTarget&&Ri(n.labelTarget||n,"bpmn:BaseElement")&&((t=n.businessObject.di).label||(t.label=i.create("bpmndi:BPMNLabel",{bounds:i.create("dc:Bounds")})),$(t.label.bounds,{x:n.x,y:n.y,width:n.width,height:n.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t,n,i,r,o,a,s,c,p,l=e.context.connection.label;l&&(i=(n=e).command,r=n.context,o=r.connection,a=o.label,s=$({},r.hints),c=r.newWaypoints||o.waypoints,p=r.oldWaypoints,void 0===s.startChanged&&(s.startChanged="connection.reconnectStart"===i),void 0===s.endChanged&&(s.endChanged="connection.reconnectEnd"===i),t=cl(a,c,p,s),u.moveShape(l,t))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Pi(n);r&&er(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})}t(hl,Da),hl.$inject=["eventBus","modeling","bpmnFactory","textRenderer"];var dl="flow elements must be children of pools/participants";function ml(e,i,r){function o(e,t,n){i.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:n||2e3,html:"<div>"+t+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,n=t.shape;Ri(t.target,"bpmn:Collaboration")&&Ri(n,"bpmn:FlowNode")&&o(e,r(dl))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,n=t.position,i=t.target;Ri(i,"bpmn:Collaboration")&&o(n,r(dl)),Ri(i,"bpmn:Process")&&o(n,r("participants cannot be pasted onto a non-empty process diagram"),3e3)})}function fl(e,a,o){function t(e){var t,n,i=e.source,r=e.target;e.parent&&(Ri(e,"bpmn:SequenceFlow")&&(o.canConnectSequenceFlow(i,r)||(n=!0),o.canConnectMessageFlow(i,r)&&(t="bpmn:MessageFlow")),Ri(e,"bpmn:MessageFlow")&&(o.canConnectMessageFlow(i,r)||(n=!0),o.canConnectSequenceFlow(i,r)&&(t="bpmn:SequenceFlow")),Ri(e,"bpmn:Association")&&!o.canConnectAssociation(i,r)&&(n=!0),n&&a.removeConnection(e),t&&a.connect(i,r,{type:t,waypoints:e.waypoints.slice()}))}Da.call(this,e),this.postExecuted("elements.move",function(e){M(e.closure.allConnections,t)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){t(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var t,n=e.context,i=n.properties,r=n.element,o=r.businessObject;i.default&&(t=P(r.outgoing,D({id:r.businessObject.default.id})))&&a.updateProperties(t,{conditionExpression:void 0}),i.conditionExpression&&o.sourceRef.default===o&&a.updateProperties(r.source,{default:void 0})})}function yl(e,n){Da.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Ri(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var t=e.collaborationRoot;t&&!t.businessObject.participants.length&&n.makeProcess()},!0)}function vl(e,t,a,n,i,r){Da.call(this,e),this._bpmnReplace=t,this._elementRegistry=n,this._selection=i,this._modeling=r,this.postExecuted(["elements.move"],500,function(e){var t=e.context,n=t.newParent,i=t.newHost,r=[];M(t.closure.topLevel,function(e){r=Mi(e)?r.concat(e.children):r.concat(e)}),1===r.length&&i&&(n=i);var o=a.canReplace(r,n);o&&this.replaceElements(r,o.replacements,i)},this),this.postExecute(["shape.replace"],1500,function(e){var t,n=e.context,i=n.oldShape,r=n.newShape,o=i.attachers;o&&o.length&&(t=a.canReplace(o,r),this.replaceElements(o,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})})}ml.$inject=["eventBus","tooltips","translate"],t(fl,Da),fl.$inject=["eventBus","modeling","bpmnRules"],yl.$inject=["eventBus","modeling"],t(yl,Da),t(vl,Da),vl.prototype.replaceElements=function(r,e,o){var a=this._elementRegistry,s=this._bpmnReplace,t=this._selection,c=this._modeling;M(e,function(e){var t={type:e.newElementType},n=a.get(e.oldElementId);o&&Ri(n,"bpmn:BoundaryEvent")&&c.updateAttachment(n,null);var i=r.indexOf(n);r[i]=s.replaceElement(n,t,{select:!1}),o&&Ri(r[i],"bpmn:BoundaryEvent")&&c.updateAttachment(r[i],o)}),e&&t.select(r)},vl.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];function gl(e,o){e.on("resize.start",1501,function(e){var t=e.context,n=t.shape;(Ri(n,"bpmn:Lane")||Ri(n,"bpmn:Participant"))&&(t.balanced=!oo(e))}),e.on("resize.end",1001,function(e){var t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds;if(Ri(n,"bpmn:Lane")||Ri(n,"bpmn:Participant"))return i&&(r=Wr(r),o.resizeLane(n,r,t.balanced)),!1})}function bl(e,c,p){Da.call(this,e),this.preExecute("shape.delete",function(e){var t,n,i,r=e.context.shape;if(1==r.incoming.length&&1==r.outgoing.length){var o=r.incoming[0],a=r.outgoing[0];if(c.canConnect(o.source,a.target,o)){var s=(t=o.waypoints,n=a.waypoints,(i=qp(xl(t[t.length-2]),xl(t[t.length-1]),xl(n[1]),xl(n[0])))?[].concat(t.slice(0,t.length-1),[i],n.slice(1)):[xl(t[0]),xl(n[n.length-1])]);p.reconnectEnd(o,a.target,s)}}})}function xl(e){return e.original||e}gl.$inject=["eventBus","modeling"],t(bl,Da),bl.$inject=["eventBus","bpmnRules","modeling"];function _l(e,h,d,t){Da.call(this,e),this.executed(["shape.toggleCollapse"],500,function(e){var t,n=e.context.shape;Ri(n,"bpmn:SubProcess")&&(n.collapsed?Pi(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),Pi(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;t.collapsed?Pi(t).di.isExpanded=!1:Pi(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],500,function(e){var t,n,i,r,o,a,s,c,p,l=e.context.shape,u=h._getDefaultSize(l);t=l.collapsed?(p=u,{x:(c=l).x+(c.width-p.width)/2,y:c.y+(c.height-p.height)/2,width:p.width,height:p.height}):(i=u,a=(n=l).children,s=i,r=Pc((o=a,o.filter(function(e){return!e.hidden})).concat([n])),s.y=r?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,r.y+(r.height-s.height)/2):(s.x=n.x+(n.width-s.width)/2,n.y+(n.height-s.height)/2),s),d.resizeShape(l,t)})}function El(e,t){Da.call(this,e),this.preExecute("elements.delete",function(e){M(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}t(_l,Da),_l.$inject=["eventBus","elementFactory","modeling"],t(El,Da),El.$inject=["eventBus","modeling"];function wl(e,t,i){var r;Da.call(this,e);var n=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(n,5e3,function(e){(r=r||new Sl).enter()}),this.postExecuted(n,500,function(e){!function(){if(!r)throw new Error(i("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=function(){if(!r)throw new Error(i("out of bounds release"));return r}();t.labelTarget||(Ri(t,"bpmn:Lane")&&n.addLane(t),Ri(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function Sl(){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 Cl(e,i){Da.call(this,e),this.preExecute("connection.delete",function(e){var t=e.context.connection,n=t.source;(function(e,t){if(!Ri(e,"bpmn:SequenceFlow"))return!1;var n=Pi(t),i=Pi(e);return n.get("default")===i})(t,n)&&i.updateProperties(n,{default:null})})}wl.$inject=["eventBus","modeling","translate"],t(wl,Da),t(Cl,Da),Cl.$inject=["eventBus","modeling"];var Tl={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","boundaryEventBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","dataStoreBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",Pp],appendBehavior:["type",Dp],boundaryEventBehavior:["type",Np],copyPasteBehavior:["type",Bp],createBoundaryEventBehavior:["type",Op],createDataObjectBehavior:["type",Lp],createParticipantBehavior:["type",Ip],dataInputAssociationBehavior:["type",zp],dataStoreBehavior:["type",Hp],deleteLaneBehavior:["type",Wp],dropOnFlowBehavior:["type",Gp],importDockingFix:["type",Kp],labelBehavior:["type",hl],modelingFeedback:["type",ml],replaceConnectionBehavior:["type",fl],removeParticipantBehavior:["type",yl],replaceElementBehaviour:["type",vl],resizeLaneBehavior:["type",gl],removeElementBehavior:["type",bl],toggleElementCollapseBehaviour:["type",_l],unclaimIdBehavior:["type",El],updateFlowNodeRefsBehavior:["type",wl],unsetDefaultFlowBehavior:["type",Cl]};function Al(e,t){var n=Kr(e,t,-15);return"intersect"!==n?n:null}var Rl=Math.abs,Pl=Math.min,kl=Math.max;function Ml(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Dl(e,t,n){return Ml(e,t,n,Pl)}function Nl(e,t,n){return Ml(e,t,n,kl)}var Bl=60,Ol=300,Ll=20,Il=50,jl=20,zl=20;function Fl(e){Oa.call(this,e)}function $l(e){return!e||rr(e)}function Hl(e){do{if(Ri(e,"bpmn:Process"))return Pi(e);if(Ri(e,"bpmn:Participant"))return Pi(e).processRef||Pi(e)}while(e=e.parent)}function Wl(e){return Ri(e,"bpmn:TextAnnotation")}function Gl(e){return Ri(e,"bpmn:BoundaryEvent")&&ql(e,"bpmn:CompensateEventDefinition")}function Vl(e){return Pi(e).isForCompensation}function Ul(e){for(var t=e;t=t.parent;){if(Ri(t,"bpmn:FlowElementsContainer"))return Pi(t);if(Ri(t,"bpmn:Participant"))return Pi(t).processRef}return null}function ql(e,t){return!!P(Pi(e).eventDefinitions||[],function(e){return Ri(e,t)})}function Kl(e,t){return(Pi(e).eventDefinitions||[]).every(function(e){return Ri(e,t)})}function Yl(e){return e.waypoints}function Xl(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function Zl(e,t,n){if($l(e)||$l(t))return null;if(!Ri(n,"bpmn:DataAssociation")){if(su(e,t))return{type:"bpmn:MessageFlow"};if(cu(e,t))return{type:"bpmn:SequenceFlow"}}var i=pu(e,t);return i||(Gl(e)&&Vl(t)?{type:"bpmn:Association",associationDirection:"One"}:!!au(e,t)&&{type:"bpmn:Association"})}function Ql(e,t,n){return!!rr(e)||!(Ri(t,"bpmn:Participant")&&!ki(t))&&(Ri(e,"bpmn:Participant")?Ri(t,"bpmn:Process")||Ri(t,"bpmn:Collaboration"):Ri(e,"bpmn:Lane")?Ri(t,"bpmn:Participant")||Ri(t,"bpmn:Lane"):!Ri(e,"bpmn:BoundaryEvent")&&(Ri(e,"bpmn:FlowElement")&&!Ri(e,"bpmn:DataStoreReference")?Ri(t,"bpmn:FlowElementsContainer")?ki(t):ga(t,["bpmn:Participant","bpmn:Lane"]):ga(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ga(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Ri(e,"bpmn:MessageFlow")&&(Ri(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Jl(e){return!rr(e)&&Ri(e,"bpmn:BoundaryEvent")}function eu(e){return Ri(e,"bpmn:Lane")}function tu(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r,o,a=e[0];return!rr(a)&&(!!(Jl(r=a)||Ri(r,"bpmn:IntermediateThrowEvent")&&!r.parent)&&(!t||!Mi(t)&&(!(!Ri(t,"bpmn:Activity")||Vl(t))&&(!(i&&!Al(i,t))&&((!Ri(o=t,"bpmn:ReceiveTask")||!P(o.incoming,function(e){return Ri(e.source,"bpmn:EventBasedGateway")}))&&"attach")))))}function nu(e,n,i){if(!n)return!1;var r={replacements:[]};return M(e,function(e){var t;Mi(n)||Ri(e,"bpmn:StartEvent")&&"label"!==e.type&&Ql(e,n)&&((t=e)&&!1!==Pi(t).isInterrupting||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(Di(e,"bpmn:ErrorEventDefinition")||Di(e,"bpmn:EscalationEventDefinition")||Di(e,"bpmn:CompensateEventDefinition"))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Ri(n,"bpmn:Transaction")||ql(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Ri(e,"bpmn:EndEvent")&&Ql(e,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Ri(e,"bpmn:BoundaryEvent")&&tu(e,n,null,i)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!r.replacements.length&&r}function iu(e,t){return!v(e,Jl)&&(!v(e,eu)&&(!t||e.every(function(e){return Ql(e,t)})))}function ru(e,t,n,i){return!!t&&(rr(t)?null:n!==t&&((!n||!Xl(n,t))&&(Ql(e,t)||lu(e,t,i))))}function ou(e,t){return Ri(e,"bpmn:SubProcess")?ki(e)&&(!t||100<=t.width&&80<=t.height):Ri(e,"bpmn:Lane")?!t||130<=t.width&&60<=t.height:Ri(e,"bpmn:Participant")?!t||250<=t.width&&50<=t.height:!!Wl(e)}function au(e,t){return!Yl(e)&&!Yl(t)&&(!(!Gl(e)||!Vl(t))||!Xl(t,e)&&!Xl(e,t)&&(n=t,i=Wl(e),r=Wl(n),(i||r)&&i!==r));var n,i,r}function su(e,t){return Ri(r=e,"bpmn:InteractionNode")&&(!Ri(r,"bpmn:Event")||Ri(r,"bpmn:ThrowEvent")&&Kl(r,"bpmn:MessageEventDefinition"))&&(Ri(i=t,"bpmn:InteractionNode")&&!Vl(i)&&(!Ri(i,"bpmn:Event")||Ri(i,"bpmn:CatchEvent")&&Kl(i,"bpmn:MessageEventDefinition")))&&(n=t,!(Hl(e)===Hl(n)));var n,i,r}function cu(e,t){return Ri(s=e,"bpmn:FlowNode")&&!Ri(s,"bpmn:EndEvent")&&!Mi(s)&&!(Ri(s,"bpmn:IntermediateThrowEvent")&&ql(s,"bpmn:LinkEventDefinition"))&&!Gl(s)&&!Vl(s)&&(Ri(a=t,"bpmn:FlowNode")&&!Ri(a,"bpmn:StartEvent")&&!Ri(a,"bpmn:BoundaryEvent")&&!Mi(a)&&!(Ri(a,"bpmn:IntermediateCatchEvent")&&ql(a,"bpmn:LinkEventDefinition"))&&!Vl(a))&&(i=t,r=Ul(e),o=Ul(i),r&&r===o)&&!(Ri(e,"bpmn:EventBasedGateway")&&!(Ri(n=t,"bpmn:ReceiveTask")||Ri(n,"bpmn:IntermediateCatchEvent")&&(ql(n,"bpmn:MessageEventDefinition")||ql(n,"bpmn:TimerEventDefinition")||ql(n,"bpmn:ConditionalEventDefinition")||ql(n,"bpmn:SignalEventDefinition"))));var n,i,r,o,a,s}function pu(e,t){return ga(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&ga(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!ga(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!ga(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function lu(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&&(ga(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!rr(t)&&Ri(e,"bpmn:FlowNode")&&!Ri(e,"bpmn:BoundaryEvent")&&Ql(e,t.parent))}function uu(e,t){return e&&t&&-1!==e.indexOf(t)}function hu(e,t){return!(Ri(t,"bpmn:Lane")&&!uu(e,t.parent))&&!(Ri(t,"bpmn:BoundaryEvent")&&!uu(e,t.host))}t(Fl,Oa),Fl.$inject=["eventBus"],Fl.prototype.init=function(){this.addRule("connection.start",function(e){return function(e){if($l(e))return null;return ga(e.businessObject,["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 Zl(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return Zl(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return Zl(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return ou(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return tu(n,t,null,i)||nu(n,t,i)||iu(n,t)||lu(n,t,i)}),this.addRule("shape.create",function(e){return ru(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return tu(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return hu(e.collection,e.element)}),this.addRule("element.paste",function(e){var t=e.parent,n=e.element,i=e.position,r=e.source,o=e.target;return r||o?Zl(r,o):tu([n],t,null,i)||ru(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(Ri(t,"bpmn:Collaboration"))return y(n,function(e){return"bpmn:Participant"===e.type});if(Ri(t,"bpmn:Process"))return!(v(n,function(e){return"bpmn:Participant"===e.type})&&0<t.children.length);if(Ri(t,"bpmn:Participant")&&!ki(t))return!1;if(Ri(t,"bpmn:FlowElementsContainer"))return ki(t);return ga(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)})},Fl.prototype.canConnectMessageFlow=su,Fl.prototype.canConnectSequenceFlow=cu,Fl.prototype.canConnectDataAssociation=pu,Fl.prototype.canConnectAssociation=au,Fl.prototype.canMove=iu,Fl.prototype.canAttach=tu,Fl.prototype.canReplace=nu,Fl.prototype.canDrop=Ql,Fl.prototype.canInsert=lu,Fl.prototype.canCreate=ru,Fl.prototype.canConnect=Zl,Fl.prototype.canResize=ou,Fl.prototype.canCopy=hu;var du={__depends__:[Za],__init__:["bpmnRules"],bpmnRules:["type",Fl]};function mu(e){Da.call(this,e);var o=this;this.preExecute(["shape.create","connection.create"],function(e){var t=e.context,n=t.shape||t.connection,i=t.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.parent=r.parent),t.parentIndex=r.index)}),this.preExecute(["shape.move","connection.move"],function(e){var t=e.context,n=t.shape||t.connection,i=t.newParent||n.parent,r=o.getOrdering(n,i);r&&(void 0!==r.parent&&(t.newParent=r.parent),t.newParentIndex=r.index)})}function fu(e,o){mu.call(this,e);var n=[{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:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function a(e){var t=e.order;return t||(e.order=t=function(t){if(t.labelTarget)return{level:10};var e=P(n,function(e){return ga(t,[e.type])});return e&&e.order||{level:1}}(e)),t}this.getOrdering=function(t,e){var n=a(t);n.containers&&(e=function(e,t,n){for(var i=t;i&&!ga(i,n);)i=i.parent;if(!i)throw new Error(o("no parent for {element} in {parent}",{element:e.id,parent:t.id}));return i}(t,e,n.containers));var i=e.children.indexOf(t),r=m(e.children,function(e){return!(!t.labelTarget&&e.labelTarget)&&n.level<a(e).level});return-1!==r&&-1!==i&&i<r&&(r-=1),{index:r,parent:e}}}mu.prototype.getOrdering=function(e,t){return null},t(mu,Da),fu.$inject=["eventBus","translate"],t(fu,mu);var yu={__depends__:[Zi],__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",fu]};function vu(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)}vu.$inject=["eventBus","injector"],vu.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)},vu.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},vu.prototype.clear=function(e){this._stack.length=0,!(this._stackIdx=-1)!==e&&this._fire("changed")},vu.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()}},vu.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()}},vu.prototype.register=function(e,t){this._setHandler(e,t)},vu.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)},vu.prototype.canUndo=function(){return!!this._getUndoAction()},vu.prototype.canRedo=function(){return!!this._getRedoAction()},vu.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},vu.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},vu.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)})},vu.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},vu.prototype._createId=function(){return this._uid++},vu.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},vu.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)},vu.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)},vu.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:C("id",n)}),n.length=0,this._fire("changed"))},vu.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=g(e)?e:[e],t.dirty=t.dirty.concat(e))},vu.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},vu.prototype._revertedAction=function(e){this._stackIdx--},vu.prototype._getHandler=function(e){return this._handlerMap[e]},vu.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 gu={commandStack:["type",vu]},bu=new vo("tt");function xu(e,t){e.style.display=!1===t?"none":""}var _u="djs-tooltip",Eu="."+_u;function wu(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=bu,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=ce('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;se.bind(this._tooltipRoot,Eu,"mousedown",function(e){e.stopPropagation()}),se.bind(this._tooltipRoot,Eu,"mouseover",function(e){r.trigger("mouseover",e)}),se.bind(this._tooltipRoot,Eu,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}wu.$inject=["eventBus","canvas"],wu.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=$({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},wu.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(W(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},wu.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},wu.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},wu.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},wu.prototype.remove=function(e){var t=this.get(e);t&&(ye(t.html),ye(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},wu.prototype.show=function(){xu(this._tooltipRoot)},wu.prototype.hide=function(){xu(this._tooltipRoot,!1)},wu.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},wu.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)),d(i)&&(i=ce(i)),(t=ce('<div data-tooltip-id="'+n+'" class="'+_u+'" style="position: absolute">')).appendChild(i),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},wu.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,$(t.style,{left:n+"px",top:i+"px"})},wu.prototype._updateTooltipVisibilty=function(r){M(this._tooltips,function(e){var t=e.show,n=e.htmlContainer,i=!0;t&&((t.minZoom>r.scale||t.maxZoom<r.scale)&&(i=!1),xu(n,i))})},wu.prototype._init=function(){var n=this;this._eventBus.on("canvas.viewbox.changing",function(e){n.hide()}),this._eventBus.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,n._updateRoot(t),n._updateTooltipVisibilty(t),n.show()})};var Su={__init__:["tooltips"],tooltips:["type",wu]};function Cu(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}}function Tu(e,t,n){Da.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Au(n),t.validatedShapes=Au(i)}),r&&t.on("shape.move.start",250,function(e){var n=e.context,t=n.shapes,i=[];M(t,function(t){M(t.labels,function(e){e.hidden||-1!==n.shapes.indexOf(e)||i.push(e),t.labelTarget&&i.push(t)})}),M(i,function(e){r.makeDraggable(n,e,!0)})}),this.preExecuted("elements.move",1400,function(e){var t=e.context.closure,n=t.enclosedElements,i=[];M(n,function(e){M(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;Cu((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=dt(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&&(ht(i.labels,n,r),n.labelTarget=i)})}function Au(t){return k(t,function(e){return-1===t.indexOf(e.labelTarget)})}t(Tu,Da),Tu.$inject=["injector","eventBus","modeling"];var Ru={__init__:["labelSupport"],labelSupport:["type",Tu]};function Pu(e,t,n){var i=qo(t),r=qo(n),o=Ko(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return Gr({x:r.x+a,y:r.y+s})}function ku(e,t,n){var i=qo(e),r=qo(t),o=qo(n),a=Ko(e,i),s=Ko(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 Gr({x:l+a.x-e.x,y:u+a.y-e.y})}function Mu(e,t,r,o){Da.call(this,t);var n=e.get("movePreview",!1);t.on("shape.move.start",1401,function(e){var t,n,i,r,o=e.context,a=o.shapes,s=o.validatedShapes;o.shapes=(n=Du(t=a),T("id",t,n)),o.validatedShapes=(r=S(i=s,"id"),k(i,function(e){for(;e;){if(e.host&&r[e.host.id])return!1;e=e.parent}return!0}))}),n&&t.on("shape.move.start",251,function(e){var t=e.context;M(Du(t.shapes),function(e){n.makeDraggable(t,e,!0),M(e.labels,function(e){n.makeDraggable(t,e,!0)})})}),this.preExecuted("elements.move",1401,function(e){var t=e.context,n=t.closure;M(Du(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||M(i?n:k(n,function(e){return!!e.host}),function(e){o.updateAttachment(e,i)})}),this.postExecuted("elements.move",function(e){M(e.context.shapes,function(e){M(e.attachers,function(e){M(e.outgoing.slice(),function(e){r.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)}),M(e.incoming.slice(),function(e){r.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||o.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,i=t.host;i&&o.updateAttachment(n,i)}),this.postExecute("shape.replace",function(e){var t=e.context,n=t.oldShape,i=t.newShape;Cu(n.attachers,function(e){"attach"===r.allowed("elements.move",{target:i,shapes:[e]})?o.updateAttachment(e,i):o.removeShape(e)}),i.attachers.length&&M(i.attachers,function(e){var t=ku(e,n,i);o.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,i=t.oldBounds,r=t.newBounds;M(n.attachers,function(e){var t=ku(e,i,r);o.moveShape(e,t,e.parent),M(e.labels,function(e){o.moveShape(e,t,e.parent)})})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;Cu(t.attachers,function(e){o.removeShape(e)}),t.host&&o.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;M(k(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)}),function(t){ut(r,t),M(t.labels,function(e){ut(r,t.label)})}),t.attachSupportInitialized=!0}})}function Du(e){return h(b(e,function(e){return e.attachers||[]}))}t(Mu,Da),Mu.$inject=["injector","eventBus","rules","modeling"];var Nu={__depends__:[Za],__init__:["attachSupport"],attachSupport:["type",Mu]};function Bu(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Bu.$inject=["eventBus","dragging"],Bu.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)},Bu.prototype.isActive=function(e){return e&&this._active===e},Bu.prototype.length=function(e){return this._tools.length},Bu.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Bu.prototype.bindEvents=function(t,e){var n=this._eventBus,i=this._dragging,r=[];n.on(e.tool+".init",function(e){if(!e.context.reactivate&&this.isActive(t))return this.setActive(null),void i.cancel();this.setActive(t)},this),M(e,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;this._active&&(t&&te(t.target,'.group[data-group="tools"]')||this.setActive(null))},this)};var Ou={__depends__:[Ga],__init__:["toolManager"],toolManager:["type",Bu]};var Lu=Math.abs,Iu=Math.round,ju="crosshair",zu={x:"width",y:"height"},Fu={x:"y",y:"x"};function $u(c,e,t,n,i,r){this._canvas=t,this._dragging=e,this._modeling=n,this._rules=i,this._toolManager=r;var p=this;r.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),c.on("spaceTool.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&c.once("spaceTool.selection.ended",function(){p.activateMakeSpace(e.originalEvent)})}),c.on("spaceTool.move",1500,function(e){var t=e.context;t.initialized||(t.initialized=p.initializeMakeSpace(e,t))}),c.on("spaceTool.end",function(t){var e=t.context,n=e.axis,i=e.direction,r=e.movingShapes,o=e.resizingShapes;if(e.initialized){var a={x:Iu(t.dx),y:Iu(t.dy)},s=!(a[Fu[n]]=0);M(o,function(e){("w"===i&&t.x>e.x+e.width||"e"===i&&t.x<e.x||"n"===i&&t.y>e.y+e.height||"s"===i&&t.y<e.y)&&(s=!1)}),s&&p.makeSpace(r,o,a,i),c.once("spaceTool.ended",function(e){p.activateSelection(e.originalEvent,!0,!0)})}})}$u.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"],$u.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:ju,autoActivate:t,data:{context:{reactivate:n}}})},$u.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:ju,data:{context:{}}})},$u.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},$u.prototype.initializeMakeSpace=function(e,t){var n=Lu(e.dx)>Lu(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Lu(i)<5)return!1;i<0&&(i*=-1),oo(e)&&(i*=-1);var o=yt(this._canvas.getRootElement(),!0);return $(t,this.calculateAdjustments(o,n,i,r),{axis:n,direction:function(e,t){if("x"===e){if(0<t)return"e";if(t<0)return"w"}if("y"===e){if(0<t)return"s";if(t<0)return"n"}return null}(n,i)}),Wo("resize-"+("x"===n?"ew":"ns")),!0},$u.prototype.calculateAdjustments=function(e,i,r,o){var a=[],s=[],c=this._rules;return e.forEach(function(e){var t=e[i],n=t+e[zu[i]];if(e.parent&&!e.waypoints)return 0<r&&o<t?a.push(e):r<0&&n<o?a.push(e):t<o&&o<n&&c.allowed("shape.resize",{shape:e})?s.push(e):void 0}),{movingShapes:a,resizingShapes:s}},$u.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},$u.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var Hu="djs-dragging",Wu="djs-resizing";function Gu(e,u,h,d,m){function f(e,t){M(e,function(e){m.addDragger(e,t),h.addMarker(e,Hu)})}e.on("spaceTool.selection.start",function(e){var t=h.getLayer("space"),n=e.context,i="M 0,-10000 L 0,10000",r="M -10000,0 L 10000,0",o=Be("g");Ee(o,d.cls("djs-crosshair-group",["no-events"])),ge(t,o);var a=Be("path");Ee(a,"d",i),Ae(a).add("djs-crosshair"),ge(o,a);var s=Be("path");Ee(s,"d",r),Ae(s).add("djs-crosshair"),ge(o,s),n.crosshairGroup=o}),e.on("spaceTool.selection.move",function(e){Xt(e.context.crosshairGroup,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&Pe(t)}),e.on("spaceTool.move",250,function(e){var t=e.context,n=t.line,i=t.axis,a=t.movingShapes,s=t.resizingShapes;if(t.initialized){if(!t.dragGroup){var r=h.getLayer("space");Ee(n=Be("path"),"d","M0,0 L0,0"),Ae(n).add("djs-crosshair"),ge(r,n),t.line=n;var o=Be("g");Ee(o,d.cls("djs-drag-group",["no-events"])),ge(h.getDefaultLayer(),o),f(a,o),f(t.movingConnections=u.filter(function(t){var n=!1;M(a,function(e){M(e.outgoing,function(e){t===e&&(n=!0)})});var i=!1;M(a,function(e){M(e.incoming,function(e){t===e&&(i=!0)})});var r=!1;M(s,function(e){M(e.outgoing,function(e){t===e&&(r=!0)})});var o=!1;return M(s,function(e){M(e.incoming,function(e){t===e&&(o=!0)})}),t.waypoints&&(n||r)&&(i||o)}),o),t.dragGroup=o}if(!t.frameGroup){var c=Be("g");Ee(c,d.cls("djs-frame-group",["no-events"])),ge(h.getDefaultLayer(),c);var p=[];M(s,function(e){var t=m.addFrame(e,c);p.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),h.addMarker(e,Wu)}),t.frameGroup=c,t.frames=p}Ee(n,{path:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[i],display:""});var l={x:e.dx,y:e.dy};l[{x:"y",y:"x"}[t.axis]]=0,Xt(t.dragGroup,l.x,l.y),M(t.frames,function(e){5<e.initialWidth+l.x&&Ee(e.element,{width:e.initialWidth+l.x}),5<e.initialHeight+l.y&&Ee(e.element,{height:e.initialHeight+l.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,n=t.movingShapes,i=t.movingConnections,r=t.resizingShapes,o=t.line,a=t.dragGroup,s=t.frameGroup;M(n,function(e){h.removeMarker(e,Hu)}),M(i,function(e){h.removeMarker(e,Hu)}),a&&(Pe(o),Pe(a)),M(r,function(e){h.removeMarker(e,Wu)}),s&&Pe(s)})}Gu.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Vu={__init__:["spaceToolPreview"],__depends__:[Ga,Za,Ou,dp],spaceTool:["type",$u],spaceToolPreview:["type",Gu]};function Uu(e){this._model=e}function qu(e,t,i,n){Da.call(this,e),this._bpmnFactory=t,this._translate=n;var r=this;function o(e){M(e.context.oldRoot.children,function(e){Ri(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;Ri(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","connection.reconnectEnd","connection.reconnectStart"],function(e){var t,n=e.context;n.cropped||((t=n.connection).waypoints=i.getCroppedWaypoints(t),n.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"],Ku(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"],Ku(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"],Ku(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],Ku(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"],Ku(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],Ku(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],Ku(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],Ku(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],Ku(function(e){var t=e.context,n=t.connection,i=Pi(n),r=Pi(t.oldSource),o=Pi(t.oldTarget),a=Pi(n.source),s=Pi(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(Ri(s,"bpmn:Activity")||Ri(s,"bpmn:EndEvent")||Ri(s,"bpmn:Gateway")||Ri(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!Ri(a,"bpmn:Activity")&&!Ri(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(Ri(s,"bpmn:Activity")||Ri(s,"bpmn:EndEvent")||Ri(s,"bpmn:Gateway")||Ri(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],Ku(function(e){var t=e.context,n=t.connection,i=Pi(n),r=Pi(n.source);t.default&&(Ri(r,"bpmn:ExclusiveGateway")||Ri(r,"bpmn:InclusiveGateway")||Ri(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&Ri(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],Ku(p)),this.reverted(["element.updateAttachment"],Ku(p))}function Ku(n){return function(e){var t=e.context;Ri(t.shape||t.connection,"bpmn:BaseElement")&&n(e)}}function Yu(e,t,n){Gt.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}function Xu(e,t,n){e[n]=t[n],delete t[n]}function Zu(e){this._modeling=e}Uu.$inject=["moddle"],Uu.prototype._needsId=function(e){return ga(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"])},Uu.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Uu.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Uu.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Uu.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",$({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Uu.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Uu.prototype.createDiWaypoints=function(e){var t=this;return b(e,function(e){return t.createDiWaypoint(e)})},Uu.prototype.createDiWaypoint=function(e){return this.create("dc:Point",H(e,["x","y"]))},Uu.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",$({bpmnElement:e},n))},Uu.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})},t(qu,Da),qu.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],qu.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},qu.prototype.updateParent=function(e,t){if(!(e instanceof $t||Ri(e,"bpmn:DataStoreReference")&&e.parent&&Ri(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;Ri(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),Ri(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),Ri(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),Ri(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},qu.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof $t?this._getLabel(t):t,i=n.bounds;i||(i=this._bpmnFactory.createDiBounds(),n.set("bounds",i)),$(i,{x:e.x,y:e.y,width:e.width,height:e.height})},qu.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Ri(n,"bpmn:Lane")&&ut(n.get("flowNodeRef"),e),Ri(t,"bpmn:Lane")&&ht(t.get("flowNodeRef"),e))},qu.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)},qu.prototype.updateDiParent=function(e,t){if(t&&!Ri(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");e.$parent=t?(n.push(e),t):(ut(n,e),null)}},qu.prototype.getLaneSet=function(e){var t,n;return Ri(e,"bpmn:Lane")?(t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),(e.childLaneSet=t).$parent=e):(Ri(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t))),t},qu.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t){if(Ri(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Ri(e,"bpmn:FlowElement")){if(t)if(Ri(t,"bpmn:Participant"))t=t.processRef;else if(Ri(t,"bpmn:Lane"))for(;Ri(t=t.$parent.$parent,"bpmn:Lane"););i="flowElements"}else if(Ri(e,"bpmn:Artifact")){for(;t&&!Ri(t,"bpmn:Process")&&!Ri(t,"bpmn:SubProcess")&&!Ri(t,"bpmn:Collaboration");){if(Ri(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Ri(e,"bpmn:MessageFlow"))i="messageFlows";else if(Ri(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!Ri(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(ut(o.get("rootElements"),a),a.$parent=null),t&&(ht(o.get("rootElements"),a),a.$parent=o))}else Ri(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Ri(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&&ut(s=e.$parent.get(i),e),e.$parent=t?((s=t.get(i)).push(e),t):null,n){var c=n.get(i);ut(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},qu.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},qu.prototype.updateConnection=function(e){var t,n=e.connection,i=Pi(n),r=Pi(n.source),o=Pi(n.target);if(Ri(i,"bpmn:DataAssociation"))Ri(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):Ri(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=Ri(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(ut(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(ut(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)},qu.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},t(Yu,Gt),Yu.$inject=["bpmnFactory","moddle","translate"],Yu.prototype.baseCreate=Gt.prototype.create,Yu.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,$({type:"label"},Qi,t)):this.createBpmnElement(e,t)},Yu.prototype.createBpmnElement=function(e,t){var n,i,r,o,a,s=this._translate,c=(t=t||{}).businessObject;if(!c){if(!t.type)throw new Error(s("no shape type specified"));c=this._bpmnFactory.create(t.type)}return c.di||(c.di="root"===e?this._bpmnFactory.createDiPlane(c,[],{id:c.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(c,[],{id:c.id+"_di"}):this._bpmnFactory.createDiShape(c,{},{id:c.id+"_di"})),t.colors&&($(c.di,t.colors),delete t.colors),i=c,r=t,M(["processRef","isInterrupting","associationDirection","isForCompensation"],function(e){void 0!==r[e]&&Xu(i,r,e)}),t.isExpanded&&Xu(c.di,t,"isExpanded"),Ri(c,"bpmn:ExclusiveGateway")&&(c.di.isMarkerVisible=!0),t.eventDefinitionType&&(o=c.get("eventDefinitions")||[],a=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(a.condition=this._moddle.create("bpmn:FormalExpression")),o.push(a),(a.$parent=c).eventDefinitions=o,delete t.eventDefinitionType),n=this._getDefaultSize(c),t=$({businessObject:c,id:c.id},n,t),this.baseCreate(e,t)},Yu.prototype._getDefaultSize=function(e){return Ri(e,"bpmn:SubProcess")?ki(e)?{width:350,height:200}:{width:100,height:80}:Ri(e,"bpmn:Task")?{width:100,height:80}:Ri(e,"bpmn:Gateway")?{width:50,height:50}:Ri(e,"bpmn:Event")?{width:36,height:36}:Ri(e,"bpmn:Participant")?ki(e)?{width:600,height:250}:{width:400,height:100}:Ri(e,"bpmn:Lane")?{width:400,height:100}:Ri(e,"bpmn:DataObjectReference")?{width:36,height:50}:Ri(e,"bpmn:DataStoreReference")?{width:50,height:50}:Ri(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},Yu.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)},Zu.$inject=["modeling"],Zu.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},Zu.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,v(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)};var Qu=Math.round;function Ju(e){this._canvas=e}function eh(e,t){this._canvas=e,this._modeling=t}function th(e,t,n){var i=ah(e)[0];return Pu(i.original||i,n,t)}function nh(e,t,n){var i=ah(e),r=i[i.length-1];return Pu(r.original||r,n,t)}function ih(e,t,n){return th(e,t,oh(t,n))}function rh(e,t,n){return nh(e,t,oh(t,n))}function oh(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function ah(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function sh(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function ch(e){this._modeling=e}function ph(e){this._modeling=e,this._helper=new ch(e)}function lh(e){this._modeling=e}function uh(e,t){this._modeling=e,this._rules=t}function hh(e){this._modeling=e}function dh(e){this._modeling=e}function mh(e){Ju.call(this,e)}Ju.$inject=["canvas"],Ju.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?$(t,n):$(t,{x:n.x-Qu(t.width/2),y:n.y-Qu(t.height/2)}),this._canvas.addShape(t,i,r),t},Ju.prototype.revert=function(e){this._canvas.removeShape(e.shape)},eh.$inject=["canvas","modeling"],eh.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;Cu(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),Cu(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),Cu(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},eh.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=dt(i.children,n),t.removeShape(n),n},eh.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return ht(i.children,n,r),t.addShape(n,i),n},sh.prototype.add=function(e,t){return this.addAll([e],t)},sh.prototype.addAll=function(e,t){return $(this,function(e,t,n){p(t)&&(t=!0),R(t)&&(n=t,t=!0);var i=bt((n=n||{}).allShapes),r=bt(n.allConnections),o=bt(n.enclosedElements),a=bt(n.enclosedConnections),s=bt(n.topLevel,t&&S(e,function(e){return e.id}));function c(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 ft(e,function(e){if(!(o[e.id]=e).waypoints)return M((i[e.id]=e).incoming,c),M(e.outgoing,c),e.children;a[e.id]=r[e.id]=e}),{allShapes:i,allConnections:r,topLevel:s,enclosedConnections:a,enclosedElements:o}}(e,!!t,this)),this},ch.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},ch.prototype.moveClosure=function(e,i,r,t,n){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;n&&n.parent===r&&(l=!0),M(a,function(e){o.moveShape(e,i,p[e.id]&&!l&&r,{recurse:!1,layout:!1})}),M(s,function(e){var t=!!a[e.source.id],n=!!a[e.target.id];c[e.id]&&t&&n?o.moveConnection(e,i,p[e.id]&&!l&&r):o.layoutConnection(e,{connectionStart:t&&ih(e,e.source,i),connectionEnd:n&&rh(e,e.target,i)})})},ch.prototype.getClosure=function(e){return(new sh).addAll(e,!0)},ph.$inject=["modeling"],ph.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=H(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=ut(o.children,t),ht(i.children,t,r),$(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},ph.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(M(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:rh(e,t,n)})}),M(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:ih(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},ph.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return ht(n.children,t,i),$(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},ph.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},ph.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},lh.$inject=["modeling"],lh.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},$(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},lh.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;M(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:nh(e,t,n)})}),M(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:th(e,t,n)})})},lh.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return $(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},uh.$inject=["modeling","rules"],uh.prototype.preExecute=function(e){var i,r=this,t=this._modeling,o=this._rules,n=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return o.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};i=e.newShape=e.newShape||r.createShape(a,l,n.parent,s),n.host&&t.updateAttachment(i,n.host),!1!==s.moveChildren&&(p=n.children.slice(),t.moveElements(p,{x:0,y:0},i));var u=n.incoming.slice(),h=n.outgoing.slice();M(u,function(e){var t=e.waypoints,n=t[t.length-1];c("connection.reconnectEnd",e.source,i,e)&&r.reconnectEnd(e,i,n)}),M(h,function(e){var t=e.waypoints[0],n=e.target;c("connection.reconnectStart",i,n,e)&&r.reconnectStart(e,i,t)})},uh.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;M(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),M(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},uh.prototype.execute=function(e){},uh.prototype.revert=function(e){},uh.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},uh.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},uh.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)},hh.$inject=["modeling"],hh.prototype.execute=function(e){var t,n,i,r=e.shape,o=r.children;return e.oldChildrenVisibility=(t={},o.forEach(function(e){t[e.id]=e.hidden}),t),r.collapsed=!r.collapsed,n=o,i=r.collapsed,n.forEach(function(e){e.hidden=i}),[r].concat(o)},hh.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)},dh.$inject=["modeling"],dh.prototype.preExecute=function(e){var n=this._modeling,t=e.resizingShapes,i=e.delta,r=e.direction;M(t,function(e){var t=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);n.resizeShape(e,t)})},dh.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},dh.prototype.execute=function(e){},dh.prototype.revert=function(e){},t(mh,Ju),mh.$inject=["canvas"];var fh=Ju.prototype.execute;mh.prototype.execute=function(e){var t,n=e.shape;return t=n,["width","height"].forEach(function(e){void 0===t[e]&&(t[e]=0)}),n.labelTarget=e.labelTarget,fh.call(this,e)};var yh=Ju.prototype.revert;function vh(e,t){this._canvas=e,this._layouter=t}function gh(e,t){this._canvas=e,this._modeling=t}function bh(){}function xh(e,t){this._layouter=e,this._canvas=t}function _h(){}function Eh(){}function wh(e){this._helper=new ch(e)}function Sh(e,t){this._modeling=e,this._elementRegistry=t}function Ch(e){this._modeling=e}mh.prototype.revert=function(e){return e.shape.labelTarget=null,yh.call(this,e)},vh.$inject=["canvas","layouter"],vh.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},vh.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null},gh.$inject=["canvas","modeling"],gh.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=dt(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},gh.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,ht(n.children,t,i),this._canvas.addConnection(t,n),t},bh.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=ut(o.children,t),ht(i.children,t,r),t.parent=i,M(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},bh.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return ut(n.children,t),ht(i.children,t,r),t.parent=i,M(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},xh.$inject=["layouter","canvas"],xh.prototype.execute=function(e){var t=e.connection;return $(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},xh.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},_h.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},_h.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},Eh.$inject=[],Eh.prototype.execute=function(e){var t,n=e.newSource,i=e.newTarget,r=e.connection,o=e.dockingOrPoints,a=r.waypoints;if(!n&&!i)throw new Error("newSource or newTarget are required");if(n&&i)throw new Error("must specify either newSource or newTarget");return e.oldWaypoints=a,g(o)?t=o:(t=a.slice()).splice(n?0:-1,1,o),n&&(e.oldSource=r.source,r.source=n),i&&(e.oldTarget=r.target,r.target=i),r.waypoints=t,r},Eh.prototype.revert=function(e){var t=e.newSource,n=e.newTarget,i=e.connection;return t&&(i.source=e.oldSource),n&&(i.target=e.oldTarget),i.waypoints=e.oldWaypoints,i},wh.$inject=["modeling"],wh.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},wh.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)},Sh.$inject=["modeling","elementRegistry"],Sh.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;M(e.elements,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})},Ch.$inject=["modeling"];var Th={x:"y",y:"x"};function Ah(e,t){this._modeling=e,this._canvas=t}function Rh(e){this._modeling=e}function Ph(e,t){return ut(e&&e.attachers,t)}function kh(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),ht(i,t,n)}}function Mh(t,e){M(e,function(e){t[e]&&delete t[e]})}function Dh(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}function Nh(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Ch.prototype.preExecute=function(e){var o=this._modeling,a=e.groups,s=e.axis,c=e.dimension;function p(e,t){e.range.min=Math.min(t[s],e.range.min),e.range.max=Math.max(t[s]+t[c],e.range.max)}function l(e){return e[s]+e[c]/2}function u(e){return e.length-1}function h(e){return e.max-e.min}var d,t,m=a[0],f=u(a),y=a[f],v=0;M(a,function(i,e){var t,n,r;i.elements.length<2?e&&e!==a.length-1&&(p(i,i.elements[0]),v+=h(i.range)):(n=(t=A(i.elements,s))[0],e===f&&(n=t[u(t)]),r=l(n),i.range=null,M(t,function(e){var t,n;(n={y:0})[s]=r-l(t=e),n[s]&&(n[Th[s]]=0,o.moveElements([t],n,t.parent)),null!==i.range?p(i,e):i.range={min:e[s],max:e[s]+e[c]}}),e&&e!==a.length-1&&(v+=h(i.range)))}),t=Math.abs(y.range.min-m.range.max),(d=Math.round((t-v)/(a.length-1)))<a.length-1||M(a,function(n,e){var i,r={};n!==m&&n!==y&&(i=a[e-1],n.range.max=0,M(n.elements,function(e,t){r[Th[s]]=0,r[s]=i.range.max-e[s]+d,n.range.min!==e[s]&&(r[s]+=e[s]-n.range.min),r[s]&&o.moveElements([e],r,e.parent),n.range.max=Math.max(e[s]+e[c],t?n.range.max:0)}))})},Ch.prototype.postExecute=function(e){},Ah.$inject=["modeling","canvas"],Ah.prototype.preExecute=function(e){var n=this._modeling,t=e.elements,i=e.alignment;M(t,function(e){var t={x:0,y:0};i.left?t.x=i.left-e.x:i.right?t.x=i.right-e.width-e.x:i.center?t.x=i.center-Math.round(e.width/2)-e.x:i.top?t.y=i.top-e.y:i.bottom?t.y=i.bottom-e.height-e.y:i.middle&&(t.y=i.middle-Math.round(e.height/2)-e.y),n.moveElements([e],t,e.parent)})},Ah.prototype.postExecute=function(e){},Rh.$inject=["modeling"],Rh.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Ph(i,t),kh(n,t),t.host=n,t},Rh.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Ph(n,t),kh(i,t,r),t},Dh.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"],Dh.prototype.preExecute=function(e){var s=this._eventBus,c=this,p=e.tree,l=e.topParent,u=e.position;p.createdElements={},p.labels=[],M(p,function(e,t){var a=parseInt(t,10);isNaN(a)||(a||(e=b(e,function(e){return e.parent=l,e})),M(e=A(e,"priority"),function(e){var t,n=e.id,i=e.parent,r={},o=$({},e);if(a&&(o.parent=c._getCreatedElement(i,p)),i)if(s.fire("element.paste",{createdElements:p.createdElements,descriptor:o}),i=o.parent,o.waypoints)(o=c._createConnection(o,i,u,p))&&(p.createdElements[n]={element:o,descriptor:e});else{if(o.parent!==l&&(r.root=!1),o.host&&(r.attach=!0,i=c._getCreatedElement(o.host,p)),o.labelTarget)return p.labels.push(o);t={x:Math.round(u.x+o.delta.x+o.width/2),y:Math.round(u.y+o.delta.y+o.height/2)},Mh(o,["id","parent","delta","host","priority"]),(o=c._createShape(o,i,t,r))&&(p.createdElements[n]={element:o,descriptor:e})}}))})},Dh.prototype.postExecute=function(e){var o=this._modeling,t=this._selection,a=this,s=e.tree,n=s.labels,i=[];M(n,function(t){var e,n,i,r=a._getCreatedElement(t.labelTarget,s);r&&(e=r.labels)&&e.length&&(n={x:r.x,y:r.y},r.waypoints&&(n=r.waypoints[0]),M(e,function(e){i={x:Math.round(n.x-e.x+t.delta.x),y:Math.round(n.y-e.y+t.delta.y)},o.moveShape(e,i,r.parent)}))}),M(s[0],function(e){var t=e.id,n=s.createdElements[t];n&&i.push(n.element)}),t.select(i)},Dh.prototype._createConnection=function(n,e,i,t){var r,o,a=this._modeling,s=this._rules;return n.waypoints=b(n.waypoints,function(e,t){return{x:Math.round(i.x+n.delta[t].x),y:Math.round(i.y+n.delta[t].y)}}),r=this._getCreatedElement(n.source,t),o=this._getCreatedElement(n.target,t),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Mh(n,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,n,e)):null},Dh.prototype._createShape=function(e,t,n,i,r){var o=this._modeling,a=this._elementFactory;if(!this._rules.allowed("element.paste",{element:e,position:n,parent:t}))return null;var s=a.createShape(e);return o.createShape(s,n,t,i,r),s},Dh.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element},Nh.$inject=["eventBus","elementFactory","commandStack"],Nh.prototype.getHandlers=function(){return{"shape.append":Zu,"shape.create":Ju,"shape.delete":eh,"shape.move":ph,"shape.resize":lh,"shape.replace":uh,"shape.toggleCollapse":hh,spaceTool:dh,"label.create":mh,"connection.create":vh,"connection.delete":gh,"connection.move":bh,"connection.layout":xh,"connection.updateWaypoints":_h,"connection.reconnectStart":Eh,"connection.reconnectEnd":Eh,"elements.move":wh,"elements.delete":Sh,"elements.distribute":Ch,"elements.align":Ah,"element.updateAttachment":Rh,"elements.paste":Dh}},Nh.prototype.registerHandlers=function(n){M(this.getHandlers(),function(e,t){n.registerHandler(t,e)})},Nh.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)},Nh.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Nh.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?a=(r=n).parent:!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Nh.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)},Nh.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Nh.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},Nh.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},Nh.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},Nh.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},Nh.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Nh.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Nh.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Nh.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Nh.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Nh.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},Nh.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Nh.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},Nh.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Nh.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Nh.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},Nh.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},Nh.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Nh.prototype._create=function(e,t){return t instanceof jt?t:this._elementFactory.create(e,t)},Nh.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};var Bh="default",Oh="id",Lh={width:0,height:0};function Ih(e,t,n,i,r){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textRenderer=r}function jh(e,t){return Oh in e&&e.id!==t.id}function zh(i,e){M(e,function(e,t){var n;"di"!==t?i.set(t,e):i.di&&(n=i.di,M(e,function(e,t){n.set(t,e)}))})}Ih.$inject=["elementRegistry","moddle","translate","modeling","textRenderer"],Ih.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r,o,a,s,c=this._elementRegistry,p=this._moddle.ids,l=t.businessObject,u=(a=e.properties,s=$({},a),Fh.forEach(function(e){e in a&&(s[e]=Pi(s[e]))}),s),h=e.oldProperties||(r=l,_(E(o=u),function(e,t){var n;return e[t]="di"!==t?r.get(t):(n=r.di,_(E(o.di),function(e,t){return e[t]=n.get(t),e},{})),e},{}));return jh(u,l)&&(p.unclaim(l.id),c.updateId(t,u.id),p.claim(u.id,l)),Bh in u&&(u[Bh]&&n.push(c.get(u[Bh].id)),l[Bh]&&n.push(c.get(l[Bh].id))),zh(l,u),e.oldProperties=h,e.changed=n},Ih.prototype.postExecute=function(e){var t=e.element.label,n=t&&Pi(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,Lh)}},Ih.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 zh(r,i),jh(n,r)&&(a.unclaim(n.id),o.updateId(t,i.id),a.claim(i.id,r)),e.changed};var Fh=["default"];function $h(e,t){this._canvas=e,this._modeling=t}function Hh(e,t){this._modeling=e,this._spaceTool=t}function Wh(e,t){this._modeling=e,this._translate=t}function Gh(e,t){this._modeling=e,this._spaceTool=t}$h.$inject=["canvas","modeling"],$h.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),ht(a.rootElements,i),ut((i.$parent=a).rootElements,o),o.$parent=null,o.di=null,(s.bpmnElement=i).di=s,e.oldRoot=r},$h.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),ut(o.rootElements,n),n.$parent=null,ht(o.rootElements,r),r.$parent=o,n.di=null,(a.bpmnElement=r).di=a},Hh.$inject=["modeling","spaceTool"],Hh.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Bc(i),a=o===i,s=a?i:i.parent;Nc(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+30,y:i.y,width:i.width-30,height:i.height},s);var c=[];ft(o,function(e){return c.push(e),e===i?[]:k(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)},Wh.$inject=["modeling","translate"],Wh.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Nc(i),a=o.length;if(r<a)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))},Gh.$inject=["modeling","spaceTool"],Gh.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Gh.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Oc(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Gh.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=Vr(e),p=Cc(Vr(t),c),l=Bc(e),u=[],h=[];ft(l,function(e){return u.push(e),(Ri(e,"bpmn:Lane")||Ri(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=0<p.top||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=0<p.left||p.right<0?-n:n,a=s.calculateAdjustments(h,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var Vh="flowNodeRef",Uh="lanes";function qh(e){this._elementRegistry=e}function Kh(e){this._moddle=e}qh.$inject=["elementRegistry"],qh.prototype.computeUpdates=function(e,t){var n={},r=[],i={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(o){return o.parent?(e=Bc(o),i[e.id]||(i[e.id]=Dc(e)),i[e.id]).filter(function(e){return t=o,n=Vr(e),i=t.x+t.width/2,r=t.y+t.height/2,i>n.left&&i<n.right&&r>n.top&&r<n.bottom;var t,n,i,r}).map(function(e){return e.businessObject}):[];var e}return t.forEach(function(e){var t=Bc(e);t&&!n[t.id]&&(t.children.filter(function(e){return Ri(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get(Uh).slice(),i=s(e);r.push({flowNode:t,remove:n,add:i})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get(Vh).forEach(function(e){r.push({flowNode:e,remove:[t],add:[]})})}),r},qh.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(Uh);e.remove.forEach(function(e){ut(n,e),ut(e.get(Vh),t)}),e.add.forEach(function(e){ht(n,e),ht(e.get(Vh),t)})})},qh.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get(Uh);e.add.forEach(function(e){ut(n,e),ut(e.get(Vh),t)}),e.remove.forEach(function(e){ht(n,e),ht(e.get(Vh),t)})})},Kh.$inject=["moddle"],Kh.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Kh.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 Yh={fill:void 0,stroke:void 0};function Xh(e){this._commandStack=e}Xh.$inject=["commandStack"],Xh.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Yh,i=this,r={};"fill"in n&&$(r,{fill:n.fill}),"stroke"in n&&$(r,{stroke:n.stroke}),M(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var Zh={width:0,height:0};function Qh(c,p){function t(e,t){var n,i,r,o=e.label||e,a=e.labelTarget||e;return n=t,i=o.businessObject,(r=_p(i))&&(i[r]=n),[o,a]}this.preExecute=function(e){var t=e.element,n=t.businessObject,i=e.newLabel;if(!rr(t)&&er(t)&&!tr(t)&&!Jh(i)){var r=ir(t);r={x:r.x,y:r.y+7},c.createLabel(t,r,{id:n.id+"_label",businessObject:n})}},this.execute=function(e){return e.oldLabel=Ep(e.element),t(e.element,e.newLabel)},this.revert=function(e){return t(e.element,e.oldLabel)},this.postExecute=function(e){var t=e.element,n=t.label||t,i=e.newLabel,r=e.newBounds,o=e.hints||{};if(rr(n)&&Jh(i))!1!==o.removeShape&&c.removeShape(n,{unsetLabel:!1});else if(er(t)||Ri(t,"bpmn:TextAnnotation")){var a=Pi(n),s=a.name||a.text;s&&(void 0===r&&(r=p.getExternalLabelBounds(n,s)),r&&c.resizeShape(n,r,Zh))}}}function Jh(e){return!e||!e.trim()}function ed(e,t,n,i){Nh.call(this,e,t,n),this._bpmnRules=i}function td(){}Qh.$inject=["modeling","textRenderer"],t(ed,Nh),ed.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],ed.prototype.getHandlers=function(){var e=Nh.prototype.getHandlers.call(this);return e["element.updateProperties"]=Ih,e["canvas.updateRoot"]=$h,e["lane.add"]=Hh,e["lane.resize"]=Gh,e["lane.split"]=Wh,e["lane.updateRefs"]=qh,e["id.updateClaim"]=Kh,e["element.setColor"]=Xh,e["element.updateLabel"]=Qh,e},ed.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},ed.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)},ed.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},ed.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},ed.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},ed.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},ed.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},ed.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},ed.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},ed.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},ed.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},ed.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},td.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||qr(e.source),t.connectionEnd||qr(e.target)]};var nd=20,id=5,rd=Math.round,od=20,ad={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function sd(e,t,n){var i,r,o,a,s=Kr(t,e,id),c=n.split(":")[0],p=rd((t.x-e.x)/2+e.x),l=rd((t.y-e.y)/2+e.y),u=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[c].test(o)),h=/h|r|l/.test(c),d=!1;return u?(i=h?{x:p,y:e.y}:{x:e.x,y:l},r=h?"h:h":"v:v"):(a=s,r=h?"h:v":"v:h",i=!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[c].test(a)?h?(d=l===e.y,{x:e.x+nd*(/l/.test(c)?-1:1),y:d?l+nd:l}):{x:(d=p===e.x)?p+nd:p,y:e.y+nd*(/t/.test(c)?-1:1)}:{x:p,y:l}),{waypoints:pd(e,i,r).concat(i),directions:r,turnNextDirections:d}}function cd(e){return e.split(":").reverse().join(":")}function pd(e,t,n){if(!(i=n=n||"h:h")||!/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(i))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");var i,r;if(md(n)){var o=sd(e,t,n),a={waypoints:(r=sd(t,e,cd(n))).waypoints.slice().reverse(),directions:cd(r.directions),turnNextDirections:r.turnNextDirections},s=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:pd(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(o,a);return[].concat(o.waypoints,s.waypoints,a.waypoints)}return function(e,t,n){var i=rd((t.x-e.x)/2+e.x),r=rd((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 ld(e,t,n,i,r){var o=f(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=Kr(e,t,ad[o]||0),s=function(e,t){if(md(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||qr(e),i=i||qr(t);var c,p,l,u=s.split(":"),h=fd(n,e,u[0],{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[a]),d=fd(i,t,u[1],a);return(l=pd(c=h,p=d,s)).unshift(c),l.push(p),yd(l)}function ud(e,t,n,i,r,o){var a;return g(n)&&(r=n,o=i,n=qr(e),i=qr(t)),r=r||[],-1!==(o=$({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&(a=function(e,t,n,i,r){var o,a,s={};if(a=Kr(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?hd(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:hd(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||(o.connectionEnd?a=(a=dd(t,e,i,r.slice().reverse()))&&a.reverse():o.connectionStart?a=dd(e,t,n,r):r&&r.length&&(a=r)),a||(a=ld(e,t,n,i,o)),a}function hd(e,t,n){var i,r,o;return i=t[e],r=n[e],o=n[e]+n[{x:"width",y:"height"}[e]],r<=i&&i<=o}function dd(e,t,n,i){if((r=i).length<3||!(4<r.length)&&P(r,function(e,t){var n=r[t-1];return n&&or(e,n)<3}))return null;var r,o,a=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(cr(t,e)){case"v":return{x:e.x,y:n.y};case"h":return{x:n.x,y:e.y}}return{x:e.x,y:e.y}}(s[1],a,n),(o=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(pr(e[i],t,od)||pr(e[i],n,od))return e.slice(i);return e}(s,e,t))!==s?dd(e,t,n,o):s}function md(e){return e&&/t|r|b|l/.test(e)}function fd(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 yd(i){return i.reduce(function(e,t,n){return ar(e[e.length-1],i[n+1],t,0)||e.push(t),e},[])}function vd(){}function gd(e,t){return e?e.original||e:qr(t)}function bd(e){var t=e.source,n=e.target;return Ri(n,"bpmn:Activity")&&Ri(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function xd(e){return Ri(e,"bpmn:SubProcess")&&ki(e)}function _d(e,t){return e===t}t(vd,td),vd.prototype.layoutConnection=function(e,t){t=t||{};var n,i,r,o,a=e.source,s=e.target,c=e.waypoints,p=t.connectionStart,l=t.connectionEnd;return p||(p=gd(c&&c[0],a)),l||(l=gd(c&&c[c.length-1],s)),(Ri(e,"bpmn:Association")||Ri(e,"bpmn:DataAssociation"))&&c&&!bd(e)?[].concat([p],c.slice(1,-1),[l]):(Ri(e,"bpmn:MessageFlow")?n={preferredLayouts:["straight","v:v"],preserveDocking:(r=a,o=s,Ri(o,"bpmn:Participant")?"source":Ri(r,"bpmn:Participant")?"target":xd(o)?"source":xd(r)?"target":Ri(o,"bpmn:Event")?"target":Ri(r,"bpmn:Event")?"source":null)}:(Ri(e,"bpmn:SequenceFlow")||bd(e))&&(n=a===s?{preferredLayouts:["b:l"]}:Ri(a,"bpmn:BoundaryEvent")?{preferredLayouts:function(e,t){var n,i,r=qr(e),o=qr(t),a=(d=e,m=d.host,Kr(qr(d),m,-10)),s=_d(e.host,t),c=(u=a,h=["top","right","bottom","left"],-1!==h.indexOf(u)),p=Td(a),l=Kr(o,r,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});var u,h;var d,m;n=c?wd[p?Sd(a):Cd(a)]:s||_d(Cd(a),Cd(l))||(f=Sd(a),y=Sd(l),Ed[f]===y)?wd[Cd(a)]:wd[Sd(a)];var f,y;i=c?s||(p?(x=l,_=Sd(a),E=Ed[_],-1!==x.indexOf(E)):(v=l,g=Cd(a),b=Ed[g],-1!==v.indexOf(b)))?p?"h":"v":p?"v":"h":Td(l)||_d(Cd(a),Cd(l))&&Sd(l)?"h":"v";var v,g,b;var x,_,E;return[n+":"+i]}(a,s)}:Ri(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Ri(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=yd(ud(a,s,p,l,c,n=$(n,t)))),i||[p,l])};var Ed={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},wd={top:"t",right:"r",bottom:"b",left:"l"};function Sd(e){var t=/right|left/.exec(e);return t&&t[0]}function Cd(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Td(e){return"right"===e||"left"===e}function Ad(e){return $({original:e.point.original||e.point},e.actual)}function Rd(e,t){this._elementRegistry=e,this._graphicsFactory=t}Rd.$inject=["elementRegistry","graphicsFactory"],Rd.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(Ad(i)),o.push(Ad(r)),o},Rd.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}},Rd.prototype._getIntersection=function(e,t,n){return Yr(this._getShapePath(e),this._getConnectionPath(t),n)},Rd.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Rd.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Rd.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Pd={__init__:["modeling","bpmnUpdater"],__depends__:[Tl,du,yu,ac,gu,Su,Ru,Nu,yo,up,Vu],bpmnFactory:["type",Uu],bpmnUpdater:["type",qu],elementFactory:["type",Yu],modeling:["type",ed],layouter:["type",vd],connectionDocking:["type",Rd]},kd=Math.round;function Md(e,o,a,s,r){function c(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function n(e,t,n){if(!t.waypoints&&t.parent){var i,r={x:(i=t).x+kd(i.width/2),y:i.y+kd(i.height/2)};return o.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:n,data:{shape:t,context:{}}}),!0}}e.on("shape.move.start",1500,function(e){var t,n,i=e.context,r=e.shape,o=s.get().slice();-1===o.indexOf(r)&&(o=[r]),n=S(t=o,"id"),$(i,{shapes:o=k(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),validatedShapes:o,shape:r})}),e.on("shape.move.start",1250,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=c(n)))return!1}),e.on("shape.move.move",500,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,o={x:e.dx,y:e.dy};t=c(i,o,{x:e.x,y:e.y},r),n.delta=o,null!==(n.canExecute=t)?n.target=r:n.target=null}),e.on("shape.move.end",function(e){var t=e.context,n=t.delta,i=t.canExecute,r="attach"===i,o=t.shapes;if(!i)return!1;n.x=kd(n.x),n.y=kd(n.y),a.moveElements(o,n,t.target,{primaryShape:t.shape,attach:r})}),e.on("element.mousedown",function(e){var t=to(e);if(!t)throw new Error("must supply DOM mousedown event");return n(t,e.element)}),this.start=n}Md.$inject=["eventBus","dragging","modeling","selection","rules"];var Dd="djs-dragging",Nd="drop-ok",Bd="drop-not-ok",Od="new-parent",Ld="attach-ok";function Id(e,t,a,s,c){function p(e){var t,n=l(e);return k(t=n,function(e){return!e.waypoints||P(t,D({id:e.source.id}))&&P(t,D({id:e.target.id}))})}function l(e){var t=yt(e,!0),n=b(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return h(t.concat(n))}function u(t,n){[Ld,Nd,Bd,Od].forEach(function(e){e===n?a.addMarker(t,e):a.removeMarker(t,e)})}e.on("shape.move.start",499,function(e){var t=e.context,n=t.shapes,i=t.allDraggedElements,r=p(n);if(!t.dragGroup){var o=Be("g");Ee(o,s.cls("djs-drag-group",["no-events"])),ge(a.getDefaultLayer(),o),t.dragGroup=o}r.forEach(function(e){c.addDragger(e,t.dragGroup)}),M(i=i?h([i,l(n)]):l(n),function(e){a.addMarker(e,Dd)}),t.allDraggedElements=i,t.differentParents=1!==E(S(n,function(e){return e.parent&&e.parent.id})).length}),e.on("shape.move.move",499,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?u(i,Ld):t.canExecute&&i&&i.id!==r.id?u(i,Od):u(i,t.canExecute?Nd:Bd)),Xt(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&u(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,n=t.allDraggedElements,i=t.dragGroup;M(n,function(e){a.removeMarker(e,Dd)}),i&&ke(i)}),this.makeDraggable=function(e,t,n){c.addDragger(t,e.dragGroup),n&&a.addMarker(t,Dd),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}Id.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var jd={__depends__:[co,yo,lo,Za,Ga,dp],__init__:["move","movePreview"],move:["type",Md],movePreview:["type",Id]},zd=".djs-palette-toggle";function Fd(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())})}Fd.$inject=["eventBus","canvas"],Fd.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},Fd.prototype.getEntries=function(){var n={};return M(this._providers,function(e){M(e.getPaletteEntries(),function(e,t){n[t]=e})}),n},Fd.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=ce(Fd.HTML_MARKUP),r=this;n.appendChild(i),se.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(de(t,zd))return r.toggle();r.trigger("click",e)}),oe.bind(i,"mousedown",function(e){e.stopPropagation()}),se.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},Fd.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=K(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()})},Fd.prototype._update=function(){var p=me(".djs-palette-entries",this._container),e=this._entries=this.getEntries();X(p),M(e,function(e,t){var n=e.group||"default",i=me("[data-group="+n+"]",p);i||(i=ce('<div class="group" data-group="'+n+'"></div>'),p.appendChild(i));var r,o,a,s=e.html||(e.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),c=ce(s);i.appendChild(c),e.separator||(W(c,"data-action",t),e.title&&W(c,"title",e.title),e.className&&(r=c,o=e.className,a=K(r),(g(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.imageUrl&&c.appendChild(ce('<img src="'+e.imageUrl+'">')))}),this.open()},Fd.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[W(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,u(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},Fd.prototype._layoutChanged=function(){this._toggleState({})},Fd.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Fd.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Fd.prototype.open=function(){this._toggleState({open:!0})},Fd.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Fd.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Fd.prototype.updateToolHighlight=function(i){var e;this._toolsContainer||(e=me(".djs-palette-entries",this._container),this._toolsContainer=me("[data-group=tools]",e)),M(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");if(t){var n=K(e);t=t.replace("-tool",""),n.contains("entry")&&t===i?n.add("highlighted-entry"):n.remove("highlighted-entry")}})},Fd.prototype.isOpen=function(){return K(this._container).has("open")},Fd.prototype._getParentContainer=function(){return this._canvas.getContainer()},Fd.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var $d={__init__:["palette"],palette:["type",Fd]},Hd="crosshair";function Wd(n,i,e,r,t,o){this._selection=t,this._dragging=e;var a=this,s=function(e){var t,n=i.getDefaultLayer();Ee(t=e.frame=Be("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ge(n,t)},c=function(e){var t=e.frame,n=e.bbox;Ee(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Pe(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&n.once("lasso.selection.ended",function(){a.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=Gd(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=Gd(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=Gd(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;p(t)}),n.on("element.mousedown",1500,function(e){if(n=to(t=e)||t,ro(t)&&n.shiftKey)return a.activateLasso(e.originalEvent),!0;var t,n})}function Gd(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}:n.x<=t.x&&t.y<n.y||n.x<t.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&&n.y<t.y||t.x<n.x&&n.y<=t.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:n.x<=t.x&&n.y<t.y||n.x<t.x&&n.y<=t.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}}Wd.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"],Wd.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Hd,data:{context:{}}})},Wd.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:Hd,data:{context:{}}})},Wd.prototype.select=function(e,t){var n,i,r=(n=t,i={},M(e,function(e){var t=e;t.waypoints&&(t=vt(t)),!l(n.y)&&t.x>n.x&&(i[e.id]=e),!l(n.x)&&t.y>n.y&&(i[e.id]=e),t.x>n.x&&t.y>n.y&&(l(n.width)&&l(n.height)&&t.width+t.x<n.width+n.x&&t.height+t.y<n.height+n.y?i[e.id]=e:l(n.width)&&l(n.height)||(i[e.id]=e))}),i);this._selection.select(w(r))},Wd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Wd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Vd={__depends__:[Ou],__init__:["lassoTool"],lassoTool:["type",Wd]};function Ud(n,i,e,t){this._dragging=e,t.registerTool("hand",{tool:"hand",dragging:"hand.move"}),n.on("element.mousedown",1500,function(e){if(oo(e))return this.activateMove(e.originalEvent),!1},this),n.on("hand.end",function(e){var t=e.originalEvent.target;if(!(e.hover||t instanceof SVGElement))return!1;n.once("hand.ended",function(){this.activateMove(e.originalEvent,{reactivate:!0})},this)},this),n.on("hand.move.move",function(e){var t=i.viewbox().scale;i.scroll({dx:e.dx*t,dy:e.dy*t})}),n.on("hand.move.end",function(e){var t=e.context.reactivate;return!oo(e)&&t&&n.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Ud.$inject=["eventBus","canvas","dragging","toolManager"],Ud.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||{}}})},Ud.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Ud.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Ud.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var qd={__depends__:[Ou],__init__:["handTool"],handTool:["type",Ud]},Kd="connect-ok",Yd="connect-not-ok";function Xd(i,e,r,o,t,n){var a=this;this._dragging=e,this._rules=n,t.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),i.on("global-connect.hover",function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,o.addMarker(n,i?Kd:Yd))}),i.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&o.removeMarker(t,n?Kd:Yd)}),i.on(["global-connect.ended"],function(e){var t=e.context.startTarget,n={x:e.x,y:e.y};if(a.canStartConnect(t))return i.once("element.out",function(){i.once(["connect.ended","connect.canceled"],function(){i.fire("global-connect.drag.ended")}),r.start(null,t,n)}),!1})}Xd.$inject=["eventBus","dragging","connect","canvas","toolManager","rules"],Xd.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Xd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Xd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Xd.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Zd={__depends__:[Fs,Za,Ga,Ou],globalConnect:["type",Xd]};function Qd(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)}Qd.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Qd.prototype.getPaletteEntries=function(e){var t={},s=this._create,c=this._elementFactory,n=this._spaceTool,i=this._lassoTool,r=this._handTool,o=this._globalConnect,p=this._translate;function a(n,e,t,i,r){function o(e){var t=c.createShape($({type:n},r));r&&(t.businessObject.di.isExpanded=r.isExpanded),s.start(e,t)}var a=n.replace(/^bpmn:/,"");return{group:e,className:t,title:i||p("Create {type}",{type:a}),action:{dragstart:o,click:o}}}function l(e,t){s.start(e,c.createParticipantShape(t))}return $(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:p("Activate the hand tool"),action:{click:function(e){r.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:p("Activate the lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:p("Activate the create/remove space tool"),action:{click:function(e){n.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:p("Activate the global connect tool"),action:{click:function(e){o.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":a("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":a("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",p("Create Intermediate/Boundary Event")),"create.end-event":a("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":a("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",p("Create Gateway")),"create.task":a("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":a("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":a("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":a("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",p("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:p("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Jd={__depends__:[$d,Us,Vu,Vd,qd,Zd,Zi],__init__:["paletteProvider"],paletteProvider:["type",Qd]};function em(e,c,p,l,u){Da.call(this,e),e.on("shape.move.move",250,function(e){var i,r,s,t=e.context,n=t.canExecute;t.visualReplacements||(t.visualReplacements={}),n.replacements?M((s=t).canExecute.replacements,function(e){var t=e.oldElementId,n={type:e.newElementType};if(!s.visualReplacements[t]){var i=c.get(t);$(n,{x:i.x,y:i.y});var r=p.createShape(n);l.addShape(r,i.parent);var o=me('[data-element-id="'+ns(i.id)+'"]',s.dragGroup);o&&Ee(o,{display:"none"});var a=u.addDragger(r,s.dragGroup);s.visualReplacements[t]=a,l.removeShape(r)}}):M(r=(i=t).visualReplacements,function(e,t){var n=me('[data-element-id="'+ns(t)+'"]',i.dragGroup);n&&Ee(n,{display:"inline"}),e.remove(),r[t]&&delete r[t]})})}em.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],t(em,Da);var tm={__depends__:[dp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",em]},nm=Math.abs,im=Math.round;function rm(e){return{x:e.x,y:e.y}}function om(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:im(e.x+e.width/2),y:im(e.y+e.height/2)}}function am(e){return{x:e.x+e.width,y:e.y+e.height}}function sm(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function cm(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 pm(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function lm(e){this._snapValues={}}pm.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},pm.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},pm.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},pm.prototype.getSnapLocations=function(){return this._snapLocations},pm.prototype.setSnapLocations=function(e){this._snapLocations=e},pm.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new lm).initDefaults(this._defaultSnaps),n},lm.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)},lm.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],nm(r-e)<=n)return r}(e[n],r[n],i)},lm.prototype.initDefaults=function(e){var n=this;M(e||{},function(e,t){M(e,function(e){n.add(t,e)})})};var um=1250;function hm(e,t){this._canvas=t;var n=this;e.on(["shape.move.start","create.start"],function(e){n.initSnap(e)}),e.on(["shape.move.move","shape.move.end","create.move","create.end"],um,function(e){e.originalEvent&&e.originalEvent.ctrlKey||sm(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=j(z(this.hide,this),1e3)}hm.$inject=["eventBus","canvas"],hm.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new pm);var r=om(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},hm.prototype.snap=function(o){var e=o.context,t=e.snapContext,n=e.shape,i=e.target,r=t.getSnapLocations();if(i){var a=t.pointsForTarget(i);a.initialized||(this.addTargetSnaps(a,n,i),a.initialized=!0);var s={x:sm(o,"x"),y:sm(o,"y")};M(r,function(n){var i=t.getSnapOrigin(n),r={x:o.x+i.x,y:o.y+i.y};if(M(["x","y"],function(e){var t;s[e]||void 0!==(t=a.snap(r,n,e,7))&&(s[e]={value:t,originValue:t-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),M(["x","y"],function(e){var t=s[e];"object"==typeof t&&cm(o,e,t.originValue)})}},hm.prototype._createLine=function(t){var e=this._canvas.getLayer("snap"),n=Be("path");return Ee(n,{d:"M0,0 L0,0"}),Ae(n).add("djs-snap-line"),ge(e,n),{update:function(e){Ee(n,"number"!=typeof e?{display:"none"}:"horizontal"===t?{d:"M-100000,"+e+" L+100000,"+e,display:""}:{d:"M "+e+",-100000 L "+e+", +100000",display:""})}}},hm.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hm.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hm.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hm.prototype.hide=function(){M(this._snapLines,function(e){e.update()})},hm.prototype.addTargetSnaps=function(t,e,n){M(this.getSiblings(e,n),function(e){t.add("mid",om(e))})},hm.prototype.getSiblings=function(t,e){return e&&k(e.children,function(e){return!e.hidden&&!e.labelTarget&&e.host!==t&&e!==t})};var dm=Math.round,mm=1500;function fm(e,r,s,i){hm.call(this,e,r),e.on("create.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();Ri(n,"bpmn:Participant")&&Ri(i,"bpmn:Process")&&ym(t,n,i.children)}),e.on(["create.move","create.end"],mm,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!sm(e)&&i&&function(e,t,n,i){i=i||0;var r=t.width/2-i,o=t.height/2,a={x:n.x-r-i,y:n.y-o},s={x:n.x+r+i,y:n.y+o},c=e,p=am(e);a.x>=c.x?cm(n,"x",c.x+i+r):s.x<=p.x&&cm(n,"x",p.x-i-r);a.y>=c.y?cm(n,"y",c.y+o):s.y<=p.y&&cm(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var t=e.context,n=t.shape,i=r.getRootElement();Ri(n,"bpmn:Participant")&&Ri(i,"bpmn:Process")&&ym(t,n,i.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],mm,function(e){var t,n,i,r=e.context,o=r.target,a=r.shape;o&&!sm(e)&&(t=a,n=o,i=e,"attach"===s.canAttach([t],n,null,i))&&function(e,t,n){var i=Vr(n),r=Al(e,n);/top/.test(r)?cm(e,"y",i.top):/bottom/.test(r)&&cm(e,"y",i.bottom);/left/.test(r)?cm(e,"x",i.left):/right/.test(r)&&cm(e,"x",i.right)}(e,0,o)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],mm,function(e){var t=e.context.shape,n=e.hover;Ri(n,"bpmn:Lane")&&!ga(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=Bc(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],mm,function(e){var t,n,i=e.context,r=i.source,o=i.target,a=(t=r,n=o,s.canConnect(t,n)||{});i.initialSourcePosition||(i.initialSourcePosition=i.sourcePosition),!o||"bpmn:Association"!==a.type&&"bpmn:DataOutputAssociation"!==a.type&&"bpmn:DataInputAssociation"!==a.type&&"bpmn:SequenceFlow"!==a.type?"bpmn:MessageFlow"===a.type?(Ri(r,"bpmn:Event")&&(i.sourcePosition=om(r)),Ri(o,"bpmn:Event")&&vm(e,om(o))):i.sourcePosition=i.initialSourcePosition:(i.sourcePosition=om(r),vm(e,om(o)))}),e.on("resize.start",mm,function(e){var t,n,i,r,o,a,s,c,p,l,u=e.context,h=u.shape;Ri(h,"bpmn:SubProcess")&&ki(h)&&(u.minDimensions={width:140,height:120}),Ri(h,"bpmn:Participant")&&(u.minDimensions={width:300,height:150}),(Ri(h,"bpmn:Lane")||Ri(h,"bpmn:Participant"))&&(u.resizeConstraints=(t=h,n=u.direction,i=u.balanced,r=Bc(t),a=o=!0,s=Dc(r,[r]),c=Vr(t),p={},l={},/e/.test(n)?l.right=c.left+Ol:/w/.test(n)&&(l.left=c.right-Ol),s.forEach(function(e){var t=Vr(e);/n/.test(n)&&(t.top<c.top-10&&(o=!1),i&&Rl(c.top-t.bottom)<10&&Nl(p,"top",t.top+Bl),Rl(c.top-t.top)<5&&Dl(l,"top",t.bottom-Bl)),/s/.test(n)&&(t.bottom>c.bottom+10&&(a=!1),i&&Rl(c.bottom-t.top)<10&&Dl(p,"bottom",t.bottom-Bl),Rl(c.bottom-t.bottom)<5&&Nl(l,"bottom",t.top+Bl))}),r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(Ri(e,"bpmn:FlowElement")||Ri(e,"bpmn:Artifact"))}).forEach(function(e){var t=Vr(e);o&&/n/.test(n)&&Dl(l,"top",t.top-jl),/e/.test(n)&&Nl(l,"right",t.right+Ll),a&&/s/.test(n)&&Nl(l,"bottom",t.bottom+zl),/w/.test(n)&&Dl(l,"left",t.left-Il)}),{min:l,max:p})),Ri(h,"bpmn:TextAnnotation")&&(u.minDimensions={width:50,height:30})})}function ym(e,t,n){if(n.length){var i=vt(n.filter(function(e){return!e.labelTarget&&!e.waypoints}));i.x-=50,i.y-=20,i.width+=70,i.height+=40,t.width=Math.max(t.width,i.width),t.height=Math.max(t.height,i.height),e.participantSnapBox=i}}function vm(e,t){cm(e,"x",t.x),cm(e,"y",t.y)}t(fm,hm),fm.$inject=["eventBus","canvas","bpmnRules","elementRegistry"],fm.prototype.initSnap=function(n){var e,t,i,r,o,a=n.context,s=n.shape;o=hm.prototype.initSnap.call(this,n),Ri(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(e=om(s,n),i=rm(t={width:s.width,height:s.height,x:isNaN(s.x)?dm(e.x-s.width/2):s.x,y:isNaN(s.y)?dm(e.y-s.height/2):s.y}),r=am(t),o.setSnapOrigin("top-left",{x:i.x-n.x,y:i.y-n.y}),o.setSnapOrigin("bottom-right",{x:r.x-n.x,y:r.y-n.y}),M(s.outgoing,function(e){var t=e.waypoints[0];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),M(s.incoming,function(e){var t=e.waypoints[e.waypoints.length-1];t=t.original||t,o.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}));var c=a.source;c&&o.addDefaultSnap("mid",om(c))},fm.prototype.addTargetSnaps=function(o,e,t){Ri(e,"bpmn:BoundaryEvent")&&"label"!==e.type&&(t=t.parent),Ri(t,"bpmn:SequenceFlow")&&this.addTargetSnaps(o,e,t.parent);var n=this.getSiblings(e,t)||[];M(n,function(r){Ri(r,"bpmn:Lane")||(r.waypoints?M(r.waypoints.slice(1,-1),function(e,t){var n=r.waypoints[t+2],i=r.waypoints[t];if(!n||!i)throw new Error("waypoints must exist");n.x!==e.x&&n.y!==e.y&&i.x!==e.x&&i.y!==e.y||o.add("mid",e)}):(o.add("mid",om(r)),Ri(r,"bpmn:Participant")&&(o.add("top-left",rm(r)),o.add("bottom-right",am(r)))))}),M(e.incoming,function(e){-1===n.indexOf(e.source)&&o.add("mid",om(e.source));var t=e.waypoints[0];o.add(e.id+"-docking",t.original||t)}),M(e.outgoing,function(e){-1===n.indexOf(e.target)&&o.add("mid",om(e.target));var t=e.waypoints[e.waypoints.length-1];o.add(e.id+"-docking",t.original||t)})};var gm={__init__:["snapping"],snapping:["type",fm]};function bm(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=ce(bm.BOX_HTML),this._searchInput=me(bm.INPUT_SELECTOR,this._container),this._resultsContainer=me(bm.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function xm(e,t,n){var i,r=(i="",t.forEach(function(e){e.matched?i+='<strong class="'+bm.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":i+=e.normal}),""!==i?i:null),o=ce(n);o.innerHTML=r,e.appendChild(o)}bm.$inject=["canvas","eventBus","overlays","selection"],bm.prototype._bindEvents=function(){var r=this;function e(e,t,n,i){r._eventMaps.push({el:e,type:n,listener:se.bind(e,t,n,i)})}e(document,"html","click",function(e){r.close()}),e(this._container,bm.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),e(this._container,bm.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),r._scrollToNode(e.delegateTarget),r._preselect(e.delegateTarget)}),e(this._container,bm.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),r._select(e.delegateTarget)}),e(this._container,bm.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),e(this._container,bm.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return r.close();if(13!==e.keyCode)return 38===e.keyCode?r._scrollToDirection(!0):40===e.keyCode?r._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&r._search(e.delegateTarget.value));var t=r._getCurrentResult();return t?r._select(t):r.close()})},bm.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){se.unbind(e.el,e.type,e.listener)})},bm.prototype._search=function(e){var i=this;if(this._clearResults(),e&&""!==e){var t=this._searchProvider.find(e);if(t.length){t.forEach(function(e){var t=e.element.id,n=i._createResultNode(e,t);i._results[t]={element:e.element,node:n}});var n=me(bm.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(n),this._preselect(n)}}},bm.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},bm.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)}},bm.prototype._clearResults=function(){X(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},bm.prototype._getCurrentResult=function(){return me(bm.RESULT_SELECTED_SELECTOR,this._resultsContainer)},bm.prototype._createResultNode=function(e,t){var n=ce(bm.RESULT_HTML);return 0<e.primaryTokens.length&&xm(n,e.primaryTokens,bm.RESULT_PRIMARY_HTML),xm(n,e.secondaryTokens,bm.RESULT_SECONDARY_HTML),W(n,bm.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},bm.prototype.registerProvider=function(e){this._searchProvider=e},bm.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,K(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},bm.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,K(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},bm.prototype.toggle=function(){this.isOpen()?this.close():this.open()},bm.prototype.isOpen=function(){return this._open},bm.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(bm.RESULT_SELECTED_CLASS);var n=W(e,bm.RESULT_ID_ATTRIBUTE),i=this._results[n].element;K(e).add(bm.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},bm.prototype._select=function(e){var t=W(e,bm.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)},bm.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=vt(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)},bm.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=vt(e),n=(r=(i=t).width+12,o=i.height+12,a=["width: "+r+"px","height: "+o+"px"].join("; "),{position:{bottom:o-6,right:r-6},show:!0,html:'<div style="'+a+'" class="'+bm.OVERLAY_CLASS+'"></div>'});this._overlayId=this._overlays.add(e,n)}var i,r,o,a},bm.CONTAINER_SELECTOR=".djs-search-container",bm.INPUT_SELECTOR=".djs-search-input input",bm.RESULTS_CONTAINER_SELECTOR=".djs-search-results",bm.RESULT_SELECTOR=".djs-search-result",bm.RESULT_SELECTED_SELECTOR="."+(bm.RESULT_SELECTED_CLASS="djs-search-result-selected"),bm.RESULT_ID_ATTRIBUTE="data-result-id",bm.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",bm.OVERLAY_CLASS="djs-search-overlay",bm.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>',bm.RESULT_HTML='<div class="djs-search-result"></div>',bm.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',bm.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var _m={__depends__:[wo,yo],searchPad:["type",bm]};function Em(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function wm(e){return 0<k(e,function(e){return!!e.matched}).length}function Sm(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return-1<r?(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}Em.$inject=["elementRegistry","searchPad","canvas"],Em.prototype.find=function(t){var n=this._canvas.getRootElement(),e=this._elementRegistry.filter(function(e){return!e.labelTarget});return e=A(e=k(e=b(e=k(e,function(e){return e!==n}),function(e){return{primaryTokens:Sm(Ep(e),t),secondaryTokens:Sm(e.id,t),element:e}}),function(e){return wm(e.primaryTokens)||wm(e.secondaryTokens)}),function(e){return Ep(e.element)+e.element.id})};var Cm={__depends__:[_m],__init__:["bpmnSearch"],bpmnSearch:["type",Em]};function Tm(e){ko.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 t(Tm,ko),Tm.Viewer=ko,Tm.NavigatedViewer=ia,Tm.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)},Tm.prototype._createModdle=function(e){var t=ko.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Tm.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},Tm.prototype._modules=[].concat(Tm.prototype._modules,Tm.prototype._interactionModules=[$o,Xo,ua,na],Tm.prototype._modelingModules=[va,Ma,Ya,ja,As,jc,Vc,Xc,np,rp,pp,Rp,Pd,jd,Jd,tm,xp,gm,Cm]),Tm});