bpmn-js 0.28.3 → 0.31.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- /*! bpmn-js - bpmn-modeler v0.28.3 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2
- !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BpmnJS=e()}}(function(){var e=function(e,t,r){if("string"==typeof t){if(void 0===r)return function(e,t){return n[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);i(e,t,r)}else!function(e,t){var n,r,o=Object.keys(t);for(n=0;r=o[n];n++)i(e,r,t[r])}(e,t);return e},t=2,n={"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":t,"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":t,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function i(e,i,r){var o=i.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=n[o];a?(a===t&&"number"==typeof r&&(r=String(r)+"px"),e.style[o]=r):e.setAttributeNS(null,i,r)}var r={svg:"http://www.w3.org/2000/svg"},o=function(e){"<svg"===e.substring(0,4)?-1===e.indexOf(r.svg)&&(e=a+e.substring(4)):e=a+">"+e+"</svg>";return function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e)},a='<svg xmlns="'+r.svg+'"';var s=function(t,n){var i;"<"===t.charAt(0)?(i=o(t).firstChild,i=document.importNode(i,!0)):i=document.createElementNS(r.svg,t);n&&e(i,n);return i};var c={};function p(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}c.componentsToPath=function(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")},c.createLine=function(t,n){var i=s("polyline");return e(i,{points:p(t)}),n&&e(i,n),i},c.updateLine=function(t,n){return e(t,{points:p(n)}),t};var l={};Object.defineProperty(l,"__esModule",{value:!0});var u=Object.prototype.toString,h=Object.prototype.hasOwnProperty;function d(e){return null==e}function m(e){return"[object Array]"===u.call(e)}function f(e){return"[object Object]"===u.call(e)}function y(e){return"[object Function]"===u.call(e)}function v(e){if(!m(e))throw new Error("must supply array")}function g(e,t){return h.call(e,t)}function b(e,t){var n;return t=P(t),x(e,function(e,i){if(t(e,i))return n=e,!1}),n}function x(e,t){if(!d(e)){var n=m(e)?k:M;for(var i in e){if(g(e,i))if(!1===t(e[i],n(i)))return}}}function E(e,t,n){return x(e,function(e,i){n=t(n,e,i)}),n}function _(e,t){return E(e,function(e,n,i){return e&&t(n,i)},!0)}function w(e,t){var n=[];return x(e,function(e,i){n.push(t(e,i))}),n}function S(e){return e&&Object.keys(e)||[]}function T(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=R(t),x(e,function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)}),n}function C(e){e=R(e);for(var t={},n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return x(i,function(n){return T(n,e,t)}),w(t,function(e,t){return e[0]})}var A=C;function R(e){return y(e)?e:function(t){return t[e]}}function P(e){return y(e)?e:function(t){return t===e}}function M(e){return e}function k(e){return Number(e)}var B=Array.prototype.slice;var N=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};l.flatten=function(e){return Array.prototype.concat.apply([],e)},l.find=b,l.findIndex=function(e,t){t=P(t);var n=m(e)?-1:void 0;return x(e,function(e,i){if(t(e,i))return n=i,!1}),n},l.filter=function(e,t){var n=[];return x(e,function(e,i){t(e,i)&&n.push(e)}),n},l.forEach=x,l.without=function(e,t){return d(e)?[]:(v(e),t=P(t),e.filter(function(e,n){return!t(e,n)}))},l.reduce=E,l.every=_,l.some=function(e,t){return!!b(e,t)},l.map=w,l.keys=S,l.size=function(e){return S(e).length},l.values=function(e){return w(e,function(e){return e})},l.groupBy=T,l.uniqueBy=C,l.unionBy=A,l.sortBy=function(e,t){t=R(t);var n=[];return x(e,function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++)if(r<n[a].d)return void n.splice(a,0,o);n.push(o)}),w(n,function(e){return e.v})},l.matchPattern=function(e){return function(t){return _(e,function(e,n){return t[n]===e})}},l.debounce=function(e,t){var n;return function(){var i=B.call(arguments);n&&clearTimeout(n),n=setTimeout(function(){e.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)}(i))},t)}},l.bind=function(e,t){return e.bind(t)},l.isArray=m,l.isObject=f,l.isNumber=function(e){return"[object Number]"===u.call(e)},l.isFunction=y,l.isString=function(e){return"[object String]"===u.call(e)},l.has=g,l.assign=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return N.apply(void 0,[e].concat(n))},l.pick=function(e,t){var n={},i=Object(e);return x(t,function(t){t in i&&(n[t]=e[t])}),n},l.omit=function(e,t){var n={};return x(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n};var D={},O=l.every,L=l.some,I=c.componentsToPath;function j(e){return e.businessObject.di}D.isTypedEvent=function(e,t,n){return L(e.eventDefinitions,function(i){return i.$type===t&&function(e,t){return O(t,function(t,n){return e[n]==t})}(e,n)})},D.isThrowEvent=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type},D.isCollection=function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection},D.getDi=j,D.getSemantic=function(e){return e.businessObject},D.getFillColor=function(e,t){return j(e).get("bioc:fill")||t||"white"},D.getStrokeColor=function(e,t){return j(e).get("bioc:stroke")||t||"black"},D.getCirclePath=function(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2;return I([["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])},D.getRoundRectPath=function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return I([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])},D.getDiamondPath=function(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2;return I([["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]])},D.getRectPath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return I([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])};var z={};function F(e){return e&&e.businessObject||e}z.is=function(e,t){var n=F(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)},z.getBusinessObject=F;var $={},G=z.is,W=z.getBusinessObject,H=l.forEach;function V(e,t){var n=W(e),i=!1;return n.eventDefinitions&&H(n.eventDefinitions,function(e){G(e,t)&&(i=!0)}),i}$.isExpanded=function(e){return!G(e,"bpmn:CallActivity")&&(G(e,"bpmn:SubProcess")?!!W(e).di.isExpanded:!G(e,"bpmn:Participant")||!!W(e).processRef)},$.isInterrupting=function(e){return e&&!1!==W(e).isInterrupting},$.isEventSubProcess=function(e){return e&&!!W(e).triggeredByEvent},$.hasErrorEventDefinition=function(e){return V(e,"bpmn:ErrorEventDefinition")},$.hasEscalationEventDefinition=function(e){return V(e,"bpmn:EscalationEventDefinition")},$.hasCompensateEventDefinition=function(e){return V(e,"bpmn:CompensateEventDefinition")};var q=1e3;function U(e,t){var n=this;t=t||q,e.on(["render.shape","render.connection"],t,function(e,t){var i=e.type,r=t.element,o=t.gfx;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r):n.drawConnection(o,r)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)})}U.prototype.canRender=function(){},U.prototype.drawShape=function(){},U.prototype.drawConnection=function(){},U.prototype.getShapePath=function(){},U.prototype.getConnectionPath=function(){};var Y=U,K={},X=s("svg");function Z(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}K.createTransform=function(e){return e?X.createSVGTransformFromMatrix(e):X.createSVGTransform()},K.createMatrix=function(e,t,n,i,r,o){var a=X.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:i,e:r,f:o}}return Z(a,e)};var Q=function(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(J(e,i));e.consolidate()}(n,t):n.initialize(J(n,t))};function J(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}var ee={},te=K.createTransform;ee.transform=function(e,t,n,i,r){var o=te();o.setTranslate(t,n);var a=te();a.setRotate(i,0,0);var s=te();s.setScale(r||1,r||1),Q(e,[o,a,s])},ee.translate=function(e,t,n){var i=te();i.setTranslate(t,n),Q(e,i)},ee.rotate=function(e,t){var n=te();n.setRotate(t,0,0),Q(e,n)};var ne=function(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e};var ie=function(e,t){return t.appendChild(ne(e,t)),e};var re=function(e,t){return ie(t,e),e};var oe=function(e){var t=e.parentNode;t&&t.removeChild(e);return e};var ae=l.isObject,se=l.assign,ce=l.pick,pe=l.forEach,le=l.reduce,ue=0,he={width:150,height:50};function de(e,t){t.textContent=e;try{var n,i=""===e;return t.textContent=i?"dummy":e,n=ce(t.getBBox(),["width","height"]),i&&(n.width=0),n}catch(e){return{width:0,height:0}}}function me(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=de(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return fe(e,o,r,i);o=ye(o,i.width,t)}}function fe(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 ye(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function ve(e){this._config=se({},{size:he,padding:ue,style:{},align:"center-top"},e||{})}ve.prototype.createText=function(e,t){return this.layoutText(e,t).element},ve.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},ve.prototype.layoutText=function(t,n){var i=se({},this._config.size,n.box),r=se({},this._config.style,n.style),o=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(n.align||this._config.align),a=function(e){return ae(e)?se({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==n.padding?n.padding:this._config.padding),c=n.fitBox||!1,p=t.split(/\r?\n/g),l=[],u=i.width-a.left-a.right,h=s("text");e(h,{x:0,y:0}),e(h,r);var d=function(){var t=document.getElementById("helper-svg");return t||(t=s("svg"),e(t,{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(t)),t}();for(re(d,h);p.length;)l.push(me(p,u,h));var m,f,y=le(l,function(e,t,n){return e+t.height},0),v=le(l,function(e,t,n){return t.width>e?t.width:e},0);switch(o.vertical){case"middle":m=(i.height-y)/2-l[0].height/4;break;default:m=a.top}var g=s("text");return e(g,r),pe(l,function(t){switch(m+=t.height,o.horizontal){case"left":f=a.left;break;case"right":f=(c?v:u)-a.right-t.width;break;default:f=Math.max(((c?v:u)-t.width)/2+a.left,0)}var n=s("tspan");e(n,{x:f,y:m}),n.textContent=t.text,re(g,n)}),oe(h),{dimensions:{width:v,height:y},element:g}};var ge=ve,be={},xe=be=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)?xe(e,t):o};function Ee(e){if(!(this instanceof Ee))return new Ee(e);e=e||[128,36,1],this._seed=e.length?be.rack(e[0],e[1],e[2]):e}xe.rack=function(e,t,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var a=xe(e,t)}while(Object.hasOwnProperty.call(r,a));return r[a]=i,a},r=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i};var _e=Ee;Ee.prototype.next=function(e){return this._seed(e||!0)},Ee.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},Ee.prototype.claim=function(e,t){this._seed.set(e,t||!0)},Ee.prototype.assigned=function(e){return this._seed.get(e)||!1},Ee.prototype.unclaim=function(e){delete this._seed.hats[e]},Ee.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var we={};we="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var Se={};Object.defineProperty(Se,"__esModule",{value:!0});var Te=[].indexOf,Ce=function(e,t){if(Te)return e.indexOf(t);for(var n=0;n<e.length;++n)if(e[n]===t)return n;return-1},Ae=/\s+/,Re=Object.prototype.toString;function Pe(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Pe.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Ce(t,e)||t.push(e),this.el.className=t.join(" "),this},Pe.prototype.remove=function(e){if("[object RegExp]"==Re.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Ce(t,e);return~n&&t.splice(n,1),this.el.className=t.join(" "),this},Pe.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},Pe.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Pe.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Ae);return""===e[0]&&e.shift(),e},Pe.prototype.has=Pe.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Ce(this.array(),e)};var Me=Element.prototype,ke=Me.matchesSelector||Me.webkitMatchesSelector||Me.mozMatchesSelector||Me.msMatchesSelector||Me.oMatchesSelector,Be=function(e,t){if(ke)return ke.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 Ne,De=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(Be(i,t))return i;i=i.parentNode}},Oe=window.addEventListener?"addEventListener":"attachEvent",Le=window.removeEventListener?"removeEventListener":"detachEvent",Ie="addEventListener"!==Oe?"on":"",je={bind:function(e,t,n,i){return e[Oe](Ie+t,n,i||!1),n},unbind:function(e,t,n,i){return e[Le](Ie+t,n,i||!1),n}},ze=["focus","blur"],Fe={bind:function(e,t,n,i,r){return-1!==ze.indexOf(n)&&(r=!0),je.bind(e,n,function(n){var r=n.target||n.srcElement;n.delegateTarget=De(r,t,!0),n.delegateTarget&&i.call(e,n)},r)},unbind:function(e,t,n,i){-1!==ze.indexOf(t)&&(i=!0),je.unbind(e,t,n,i)}},$e=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=We[i]||We._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},Ge=!1;"undefined"!=typeof document&&((Ne=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',Ge=!Ne.getElementsByTagName("link").length,Ne=void 0);var We={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:Ge?[1,"X<div>","</div>"]:[0,"",""]};We.td=We.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],We.option=We.optgroup=[1,'<select multiple="multiple">',"</select>"],We.thead=We.tbody=We.colgroup=We.caption=We.tfoot=[1,"<table>","</table>"],We.polyline=We.ellipse=We.polygon=We.circle=We.text=We.line=We.path=We.rect=We.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var He="undefined"!=typeof Element?Element.prototype:{},Ve=He.matches||He.matchesSelector||He.webkitMatchesSelector||He.mozMatchesSelector||He.msMatchesSelector||He.oMatchesSelector,qe=function(e,t){if(!e||1!==e.nodeType)return!1;if(Ve)return Ve.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};Se.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},Se.classes=function(e){return new Pe(e)},Se.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},Se.closest=De,Se.delegate=Fe,Se.domify=$e,Se.event=je,Se.matches=qe,Se.query=function(e,t){return(t=t||document).querySelector(e)},Se.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},Se.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)};var Ue=function(e){return new Qe(e)},Ye=function(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},Ke=/\s+/,Xe=Object.prototype.toString;function Ze(e){return void 0!==e}function Qe(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}Qe.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~Ye(t,e)||t.push(e),Ze(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},Qe.prototype.remove=function(e){if("[object RegExp]"===Xe.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=Ye(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},Qe.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},Qe.prototype.toggle=function(e,t){return this.list?(Ze(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(Ze(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},Qe.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(Ke);return""===e[0]&&e.shift(),e},Qe.prototype.has=Qe.prototype.contains=function(e){return this.list?this.list.contains(e):!!~Ye(this.array(),e)};var Je=l.isObject,et=l.assign,tt=l.forEach,nt=z.is,it=c.createLine,rt=D.isTypedEvent,ot=D.isThrowEvent,at=D.isCollection,st=D.getDi,ct=D.getSemantic,pt=D.getCirclePath,lt=D.getRoundRectPath,ut=D.getDiamondPath,ht=D.getRectPath,dt=D.getFillColor,mt=D.getStrokeColor,ft=Se.query,yt=ee.rotate,vt=ee.transform,gt=ee.translate,bt=new _e,xt=10,Et=3,_t={fontFamily:"Arial, sans-serif",fontSize:12},wt=.95,St=.35;function Tt(t,n,i,r,o){Y.call(this,t,o);var a=bt.next(),c=new ge({style:_t,size:{width:100}}),p={},l=n.computeStyle;function u(t,n){var i=et({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},n.attrs),o=n.ref||{x:0,y:0},a=n.scale||1;"none"===i.strokeDasharray&&(i.strokeDasharray=[1e4,1]);var c=s("marker");e(n.element,i),re(c,n.element),e(c,{id:t,viewBox:"0 0 20 20",refX:o.x,refY:o.y,markerWidth:20*a,markerHeight:20*a,orient:"auto"});var l=ft("defs",r._svg);l||(l=s("defs"),re(r._svg,l)),re(l,c),p[t]=c}function h(t,n,i){var r=t+"-"+n+"-"+i+"-"+a;return p[r]||function(t,n,i){var r=t+"-"+n+"-"+i+"-"+a;if("sequenceflow-end"===t){var o=s("path");e(o,{d:"M 1 5 L 11 10 L 1 15 Z"}),u(r,{element:o,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var c=s("circle");e(c,{cx:6,cy:6,r:3.5}),u(r,{element:c,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var p=s("path");e(p,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),u(r,{element:p,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var l=s("path");e(l,{d:"M 11 5 L 1 10 L 11 15"}),u(r,{element:l,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var h=s("path");e(h,{d:"M 1 5 L 11 10 L 1 15"}),u(r,{element:h,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var d=s("path");e(d,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),u(r,{element:d,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var m=s("path");e(m,{d:"M 6 4 L 10 16"}),u(r,{element:m,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(t,n,i),"url(#"+r+")"}function d(t,n,i,r,o){Je(r)&&(o=r,r=0),r=r||0,o=l(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=n/2,c=i/2,p=s("circle");return e(p,{cx:a,cy:c,r:Math.round((n+i)/4-r)}),e(p,o),re(t,p),p}function m(t,n,i,r,o,a){Je(o)&&(a=o,o=0),o=o||0,a=l(a,{stroke:"black",strokeWidth:2,fill:"white"});var c=s("rect");return e(c,{x:o,y:o,width:n-2*o,height:i-2*o,rx:r,ry:r}),e(c,a),re(t,c),c}function f(e,t,n){n=l(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var i=it(t,n);return re(e,i),i}function y(t,n,i){i=l(i,["no-fill"],{strokeWidth:2,stroke:"black"});var r=s("path");return e(r,{d:n}),e(r,i),re(t,r),r}function v(e,t,n,i){return y(t,n,et({"data-marker":e},i))}function g(e){return function(t,n){return T[e](t,n)}}function b(e){return T[e]}function x(e,t){var n=ct(e),i=ot(n);return rt(n,"bpmn:MessageEventDefinition")?b("bpmn:MessageEventDefinition")(t,e,i):rt(n,"bpmn:TimerEventDefinition")?b("bpmn:TimerEventDefinition")(t,e,i):rt(n,"bpmn:ConditionalEventDefinition")?b("bpmn:ConditionalEventDefinition")(t,e):rt(n,"bpmn:SignalEventDefinition")?b("bpmn:SignalEventDefinition")(t,e,i):rt(n,"bpmn:CancelEventDefinition")&&rt(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?b("bpmn:MultipleEventDefinition")(t,e,i):rt(n,"bpmn:CancelEventDefinition")&&rt(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?b("bpmn:ParallelMultipleEventDefinition")(t,e,i):rt(n,"bpmn:EscalationEventDefinition")?b("bpmn:EscalationEventDefinition")(t,e,i):rt(n,"bpmn:LinkEventDefinition")?b("bpmn:LinkEventDefinition")(t,e,i):rt(n,"bpmn:ErrorEventDefinition")?b("bpmn:ErrorEventDefinition")(t,e,i):rt(n,"bpmn:CancelEventDefinition")?b("bpmn:CancelEventDefinition")(t,e,i):rt(n,"bpmn:CompensateEventDefinition")?b("bpmn:CompensateEventDefinition")(t,e,i):rt(n,"bpmn:TerminateEventDefinition")?b("bpmn:TerminateEventDefinition")(t,e,i):null}function E(e,t,n){var i=c.createText(t||"",n);return Ue(i).add("djs-label"),re(e,i),i}function _(e,t,n){return E(e,ct(t).name,{box:t,align:n,padding:5,style:{fill:mt(t)}})}function w(e,t,n){var i=E(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:mt(n)}}),r=-1*n.height;vt(i,0,-r,270)}function S(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=wt),d(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:dt(t),stroke:mt(t)};ct(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round"});var i=b("bpmn:Event")(e,t,n);return x(t,e),i},"bpmn:MessageEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:n?mt(t):dt(t),stroke:n?dt(t):mt(t)})},"bpmn:TimerEventDefinition":function(e,t){var n=d(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:dt(t),stroke:mt(t)});y(e,i.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:mt(t)});for(var r=0;r<12;r++){var o=i.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;y(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*r+","+t.height/2+","+a+")",stroke:mt(t)})}return n},"bpmn:EscalationEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?mt(t):"none",stroke:mt(t)})},"bpmn:ConditionalEventDefinition":function(e,t){return y(e,i.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:mt(t)})},"bpmn:LinkEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:n?mt(t):"none",stroke:mt(t)})},"bpmn:ErrorEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:n?mt(t):"none",stroke:mt(t)})},"bpmn:CancelEventDefinition":function(e,t,n){var r=y(e,i.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:n?"black":"none"});return yt(r,45),r},"bpmn:CompensateEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:n?mt(t):"none",stroke:mt(t)})},"bpmn:SignalEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:n?mt(t):"none",stroke:mt(t)})},"bpmn:MultipleEventDefinition":function(e,t,n){return y(e,i.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:n?"black":"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return y(e,i.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:mt(t),stroke:mt(t)})},"bpmn:EndEvent":function(e,t){var n=b("bpmn:Event")(e,t,{strokeWidth:4,fill:dt(t),stroke:mt(t)});return x(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return d(e,t.width,t.height,8,{strokeWidth:4,fill:mt(t),stroke:mt(t)})},"bpmn:IntermediateEvent":function(e,t){var n=b("bpmn:Event")(e,t,{strokeWidth:1,fill:dt(t),stroke:mt(t)});return d(e,t.width,t.height,Et,{strokeWidth:1,fill:dt(t,"none"),stroke:mt(t)}),x(t,e),n},"bpmn:IntermediateCatchEvent":g("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":g("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=wt),m(e,t.width,t.height,xt,n)},"bpmn:Task":function(e,t){var n={fill:dt(t),stroke:mt(t)},i=b("bpmn:Activity")(e,t,n);return _(e,t,"center-middle"),C(e,t),i},"bpmn:ServiceTask":function(e,t){var n=b("bpmn:Task")(e,t);return y(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:dt(t),stroke:mt(t)}),y(e,i.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:dt(t)}),y(e,i.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:dt(t),stroke:mt(t)}),n},"bpmn:UserTask":function(e,t){var n=b("bpmn:Task")(e,t);return y(e,i.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:dt(t),stroke:mt(t)}),y(e,i.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:dt(t),stroke:mt(t)}),y(e,i.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:mt(t),stroke:mt(t)}),n},"bpmn:ManualTask":function(e,t){var n=b("bpmn:Task")(e,t);return y(e,i.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:dt(t),stroke:mt(t)}),n},"bpmn:SendTask":function(e,t){var n=b("bpmn:Task")(e,t);return y(e,i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:mt(t),stroke:dt(t)}),n},"bpmn:ReceiveTask":function(e,t){var n,r=ct(t),o=b("bpmn:Task")(e,t);return r.instantiate?(d(e,28,28,4.4,{strokeWidth:1}),n=i.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):n=i.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),y(e,n,{strokeWidth:1,fill:dt(t),stroke:mt(t)}),o},"bpmn:ScriptTask":function(e,t){var n=b("bpmn:Task")(e,t);return y(e,i.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:mt(t)}),n},"bpmn:BusinessRuleTask":function(t,n){var r=b("bpmn:Task")(t,n),o=y(t,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}));e(o,{strokeWidth:1,fill:dt(n,"#aaaaaa"),stroke:mt(n)});var a=y(t,i.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}));return e(a,{strokeWidth:1,stroke:mt(n)}),r},"bpmn:SubProcess":function(t,n,i){i=et({fill:dt(n),stroke:mt(n)},i);var r=b("bpmn:Activity")(t,n,i),o=$.isExpanded(n);return $.isEventSubProcess(n)&&e(r,{strokeDasharray:"1,2"}),_(t,n,o?"center-top":"center-middle"),o?C(t,n):C(t,n,["SubProcessMarker"]),r},"bpmn:AdHocSubProcess":function(e,t){return b("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,t){var i=b("bpmn:SubProcess")(e,t),r=n.style(["no-fill","no-events"],{stroke:mt(t)});return m(e,t.width,t.height,xt-2,Et,r),i},"bpmn:CallActivity":function(e,t){return b("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:wt,fill:dt(t),stroke:mt(t)},i=b("bpmn:Lane")(e,t,n);$.isExpanded(t)?(f(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:mt(t)}),w(e,ct(t).name,t)):E(e,ct(t).name,{box:t,align:"center-middle",style:{fill:mt(t)}});return!!ct(t).participantMultiplicity&&b("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=m(e,t.width,t.height,0,et({fill:dt(t),fillOpacity:St,stroke:mt(t)},n)),r=ct(t);"bpmn:Lane"===r.$type&&w(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=b("bpmn:Gateway")(e,t);return d(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:dt(t),stroke:mt(t)}),n},"bpmn:ExclusiveGateway":function(e,t){var n=b("bpmn:Gateway")(e,t),r=i.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return st(t).isMarkerVisible&&y(e,r,{strokeWidth:1,fill:mt(t),stroke:mt(t)}),n},"bpmn:ComplexGateway":function(e,t){var n=b("bpmn:Gateway")(e,t);return y(e,i.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:mt(t),stroke:mt(t)}),n},"bpmn:ParallelGateway":function(e,t){var n=b("bpmn:Gateway")(e,t);return y(e,i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:mt(t),stroke:mt(t)}),n},"bpmn:EventBasedGateway":function(t,n){var r=ct(n),o=b("bpmn:Gateway")(t,n);d(t,n.width,n.height,.2*n.height,{strokeWidth:1,fill:"none",stroke:mt(n)});var a=r.eventGatewayType,s=!!r.instantiate;if("Parallel"===a){var c=i.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:n.width,containerHeight:n.height,position:{mx:.474,my:.296}}),p=y(t,c);e(p,{strokeWidth:1,fill:"none"})}else if("Exclusive"===a){if(!s){var l=d(t,n.width,n.height,.26*n.height);e(l,{strokeWidth:1,fill:"none",stroke:mt(n)})}!function(){var e=i.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:n.width,containerHeight:n.height,position:{mx:.36,my:.44}}),r={strokeWidth:2,fill:dt(n,"none"),stroke:mt(n)};y(t,e,r)}()}return o},"bpmn:Gateway":function(t,n){var i={fill:dt(n),fillOpacity:wt,stroke:mt(n)};return function(t,n,i,r){var o=n/2,a=i/2,c=[{x:o,y:0},{x:n,y:a},{x:o,y:i},{x:0,y:a}].map(function(e){return e.x+","+e.y}).join(" ");r=l(r,{stroke:"black",strokeWidth:2,fill:"white"});var p=s("polygon");return e(p,{points:c}),e(p,r),re(t,p),p}(t,n.width,n.height,i)},"bpmn:SequenceFlow":function(t,n){var i,r=S(n),o=dt(n),a=mt(n),s=y(t,r,{strokeLinejoin:"round",markerEnd:h("sequenceflow-end",o,a),stroke:mt(n)}),c=ct(n);return n.source&&(i=n.source.businessObject,c.conditionExpression&&i.$instanceOf("bpmn:Activity")&&e(s,{markerStart:h("conditional-flow-marker",o,a)}),i.default&&(i.$instanceOf("bpmn:Gateway")||i.$instanceOf("bpmn:Activity"))&&i.default===c&&e(s,{markerStart:h("conditional-default-flow-marker",o,a)})),s},"bpmn:Association":function(e,t,n){var i=ct(t),r=dt(t),o=mt(t);return n=et({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:mt(t)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=h("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=h("association-start",r,o)),f(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=dt(t),i=mt(t);return b("bpmn:Association")(e,t,{markerEnd:h("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=dt(t),i=mt(t);return b("bpmn:Association")(e,t,{markerEnd:h("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var n=ct(t),r=st(t),o=dt(t),a=mt(t),s=y(e,S(t),{markerEnd:h("messageflow-end",o,a),markerStart:h("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:mt(t)});if(n.messageRef){var c=s.getPointAtLength(s.getTotalLength()/2),p=i.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:c.x,y:c.y}}),l={strokeWidth:1};"initiating"===r.messageVisibleKind?(l.fill="white",l.stroke="black"):(l.fill="#888",l.stroke="white"),y(e,p,l)}return s},"bpmn:DataObject":function(e,t){var n=y(e,i.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:dt(t),fillOpacity:wt,stroke:mt(t)}),r=ct(t);return at(r)&&function(e,t){var n=(t.height-16)/t.height,r=i.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:n}});y(e,r,{strokeWidth:2})}(e,t),n},"bpmn:DataObjectReference":g("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=b("bpmn:DataObject")(e,t);return y(e,n,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var n=i.getRawPath("DATA_ARROW"),r=b("bpmn:DataObject")(e,t);return y(e,n,{strokeWidth:1,fill:"black"}),r},"bpmn:DataStoreReference":function(e,t){return y(e,i.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:dt(t),fillOpacity:wt,stroke:mt(t)})},"bpmn:BoundaryEvent":function(e,t){var n=ct(t).cancelActivity,i={strokeWidth:1,fill:dt(t),stroke:mt(t),fillOpacity:1};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=b("bpmn:Event")(e,t,i);return d(e,t.width,t.height,Et,et(i,{fill:"none"})),x(t,e),r},"bpmn:Group":function(e,t){return m(e,t.width,t.height,xt,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n=ct(t),i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return E(e,n.name,{box:i,fitBox:!0,style:{fontSize:"11px"}})}(e,t)},"bpmn:TextAnnotation":function(e,t){var n=m(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return y(e,i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:mt(t)}),E(e,ct(t).text||"",{box:t,align:"left-top",padding:5}),n},ParticipantMultiplicityMarker:function(e,t){v("participant-multiplicity",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:t.width/2/t.width,my:(t.height-15)/t.height}}))},SubProcessMarker:function(e,t){var n=m(e,14,14,0,{strokeWidth:1,fill:dt(t),stroke:mt(t)});gt(n,t.width/2-7.5,t.height-20),v("sub-process",e,i.getScaledPath("MARKER_SUB_PROCESS",{xScaleFactor:1.5,yScaleFactor:1.5,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2-7.5)/t.width,my:(t.height-20)/t.height}}),{fill:dt(t),stroke:mt(t)})},ParallelMarker:function(e,t,n){v("parallel",e,i.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.parallel)/t.width,my:(t.height-20)/t.height}}))},SequentialMarker:function(e,t,n){v("sequential",e,i.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.seq)/t.width,my:(t.height-19)/t.height}}))},CompensationMarker:function(e,t,n){v("compensation",e,i.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1})},LoopMarker:function(e,t,n){v("loop",e,i.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:"none",strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,n){v("adhoc",e,i.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+n.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:"black"})}};function C(e,t,n){var i,r=ct(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},tt(n,function(n){b(n)(e,t,i)}),r.isForCompensation&&b("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&b("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&b("LoopMarker")(e,t,i),!1===s&&b("ParallelMarker")(e,t,i),!0===s&&b("SequentialMarker")(e,t,i))}this._drawPath=y}we(Tt,Y),Tt.$inject=["eventBus","styles","pathMap","canvas"];var Ct=Tt;Tt.prototype.canRender=function(e){return nt(e,"bpmn:BaseElement")},Tt.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Tt.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Tt.prototype.getShapePath=function(e){return nt(e,"bpmn:Event")?pt(e):nt(e,"bpmn:Activity")?lt(e,xt):nt(e,"bpmn:Gateway")?ut(e):ht(e)};var At=function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(Rt,function(e,t){return function(e,t,n){var i=n;return t.replace(Pt,function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))}),i=(null==i||i==n?e:i)+""}(e,t,a)})}},Rt=/\{([^}]+)\}/g,Pt=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Mt={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ct],pathMap:["type",At]},kt={elementToString:function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}},Bt={},Nt=l.assign,Dt=z.is,Ot=Bt.DEFAULT_LABEL_SIZE={width:90,height:20},Lt=15;function It(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=jt(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Lt:a+=Lt,{x:a,y:s}}function jt(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function zt(e){return e.waypoints?It(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Ot.height/2}}Bt.hasExternalLabel=function(e){return Dt(e,"bpmn:Event")||Dt(e,"bpmn:Gateway")||Dt(e,"bpmn:DataStoreReference")||Dt(e,"bpmn:DataObjectReference")||Dt(e,"bpmn:SequenceFlow")||Dt(e,"bpmn:MessageFlow")},Bt.getExternalLabelMid=zt,Bt.getExternalLabelBounds=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Ot.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=zt(t),i=Ot),Nt({x:n.x-i.width/2,y:n.y-i.height/2},i)};var Ft=l.assign,$t=l.map,Gt=z.is,Wt=Bt.hasExternalLabel,Ht=Bt.getExternalLabelBounds,Vt=$.isExpanded,qt=kt.elementToString;function Ut(e,t){return Ft({id:e.id,type:e.$type,businessObject:e},t)}function Yt(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:qt(n),referenced:qt(t),property:i}))}function Kt(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textUtil=new ge}Kt.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"];var Xt=Kt;Kt.prototype.add=function(e,t){var n,i,r,o,a=e.di,s=this._translate;if(Gt(a,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Ut(e)),this._canvas.setRootElement(n);else if(Gt(a,"bpmndi:BPMNShape")){var c=!Vt(e);i=t&&(t.hidden||t.collapsed);var p=e.di.bounds;n=this._elementFactory.createShape(Ut(e,{collapsed:c,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height)})),Gt(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Gt(e,"bpmn:Lane")&&(r=0),this._canvas.addShape(n,t,r)}else{if(!Gt(a,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:qt(a),semantic:qt(e)}));var l=this._getSource(e),u=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Ut(e,{hidden:i,source:l,target:u,waypoints:(o=e.di.waypoint,$t(o,function(e){return{x:e.x,y:e.y}}))})),Gt(e,"bpmn:DataAssociation")&&(t=null),Gt(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return Wt(e)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Kt.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:qt(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Yt(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Kt.prototype.addLabel=function(e,t){var n,i,r;return n=Ht(e,t),(i=e.name)&&(n=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Zt});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(n,i,this._textUtil)),r=this._elementFactory.createLabel(Ut(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)},Kt.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?Yt(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:qt(e),side:t}))},Kt.prototype._getSource=function(e){return this._getEnd(e,"source")},Kt.prototype._getTarget=function(e){return this._getEnd(e,"target")},Kt.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Zt={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Qt={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(e,n){return t[n]||"{"+n+"}"})}]},Jt={__depends__:[Mt,{__depends__:[Qt],bpmnImporter:["type",Xt]}]},en={};function tn(e,t,n){Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:en.extend(n[t.name]||[],e,t,n)})}function nn(e,t){if(!(this instanceof nn))return new nn(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}en.extend=function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e){this.contains(e)||(this.push(e),t.set(e,r,i))}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},en.isExtended=function(e){return!0===e.__refs_collection},nn.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?tn(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},nn.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return en.isExtended(n)||tn(this,t,e),n},nn.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},nn.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},nn.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var rn={};(rn=nn).Collection=en;var on=l.filter,an=l.find,sn=l.forEach,cn=kt.elementToString,pn=new rn({name:"bpmnElement",enumerable:!0},{name:"di"});function ln(e,t){return e.$instanceOf(t)}var un=function(e,t){var n={},i=[];function r(e,t){return function(n){e(n,t)}}function o(e){n[e.id]=e}function a(n,i){try{var r=n.di&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:cn(n)}));return e.element(n,i)}(n,i);return o(n),r}catch(e){s(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:cn(n)})),console.error(e)}}function s(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?n.di?s(t("multiple DI elements defined for {element}",{element:cn(n)}),{element:n}):(pn.bind(n,"di"),n.di=e):s(t("no bpmnElement referenced in {element}",{element:cn(e)}),{element:e})}function p(e){var t;c(t=e.plane),sn(t.planeElement,l)}function l(e){c(e)}function u(e,t){w(e,t),g(e.ioSpecification,t),v(e.artifacts,t),o(e)}function h(e,t){a(e,t)}function d(e,t){a(e,t)}function m(e,t){a(e,t)}function f(e,t){a(e,t)}function y(e,t){a(e,t)}function v(e,t){sn(e,function(e){ln(e,"bpmn:Association")?i.push(function(){y(e,t)}):y(e,t)})}function g(e,t){e&&(sn(e.dataInputs,r(m,t)),sn(e.dataOutputs,r(f,t)))}function b(e,t){var n=a(e,t);ln(e,"bpmn:SubProcess")&&function(e,t){w(e,t),v(e.artifacts,t)}(e,n||t),ln(e,"bpmn:Activity")&&g(e.ioSpecification,t),i.push(function(){sn(e.dataInputAssociations,r(d,t)),sn(e.dataOutputAssociations,r(d,t))})}function x(e,t){a(e,t)}function E(e,t){i.push(function(){var n=a(e,t);e.childLaneSet&&_(e.childLaneSet,n||t),function(e){sn(e.flowNodeRef,function(t){var n=t.get("lanes");n&&n.push(e)})}(e)})}function _(e,t){sn(e.lanes,r(E,t))}function w(e,n){!function(e,n){sn(e,function(e){ln(e,"bpmn:SequenceFlow")?i.push(function(){!function(e,t){a(e,t)}(e,n)}):ln(e,"bpmn:BoundaryEvent")?i.unshift(function(){!function(e,t){a(e,t)}(e,n)}):ln(e,"bpmn:FlowNode")?b(e,n):ln(e,"bpmn:DataObject")||(ln(e,"bpmn:DataStoreReference")?x(e,n):ln(e,"bpmn:DataObjectReference")?x(e,n):s(t("unrecognized flowElement {element} in context {context}",{element:cn(e),context:n?cn(n.businessObject):"null"}),{element:e,context:n}))})}(e.flowElements,n),e.laneSets&&function(e,t){sn(e,r(_,t))}(e.laneSets,n)}function S(e,t){var n=a(e,t),i=e.processRef;i&&u(i,n||t)}return{handleDefinitions:function(o,a){var l=o.diagrams;if(a&&-1===l.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&l&&l.length&&(a=l[0]),!a)throw new Error(t("no diagram to display"));p(a);var d=a.plane;if(!d)throw new Error(t("no plane for {element}",{element:cn(a)}));var m=d.bpmnElement;if(!m){if(!(m=function(e){return an(e.rootElements,function(e){return ln(e,"bpmn:Process")||ln(e,"bpmn:Collaboration")})}(o)))throw new Error(t("no process or collaboration to display"));s(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:cn(d),rootElement:cn(m)})),d.bpmnElement=m,c(d)}var f,y,g=function(t,n){return e.root(t,n)}(m,d);if(ln(m,"bpmn:Process"))u(m,g);else{if(!ln(m,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:cn(d),rootElement:cn(m)}));sn((y=m).participants,r(S)),v(y.artifacts),i.push(function(){var e,t;e=y.messageFlows,sn(e,r(h,t))}),f=o.rootElements,on(f,function(e){return!n[e.id]&&ln(e,"bpmn:Process")&&e.laneSets}).forEach(r(u))}!function(e){for(;e.length;)e.shift()()}(i)}}},hn={};hn.importBpmnDiagram=function(e,t,n){var i,r,o,a,s=[];try{i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),r.fire("import.render.start",{definitions:t}),function(e){new un({root:function(e){return i.add(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){s.push({message:e,context:t})}},o).handleDefinitions(e)}(t),r.fire("import.render.complete",{error:a,warnings:s})}catch(e){a=e}n(a,s)};var dn={},mn=Se.domify,fn=Se.delegate,yn='<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>'))+'" />';function vn(e){return e.join(";")}var gn,bn='<div class="bjs-powered-by-lightbox" style="'+vn(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+vn(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+vn(["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">'+yn+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';dn.open=function(){gn||(gn=mn(bn),fn.bind(gn,".backdrop","click",function(e){document.body.removeChild(gn)})),document.body.appendChild(gn)},dn.BPMNIO_IMG=yn;var xn={};xn.hasLowerCaseAlias=function(e){return e.xml&&"lowerCase"===e.xml.tagAlias},xn.DEFAULT_NS_MAP={xsi:"http://www.w3.org/2001/XMLSchema-instance"};var En=xn.XSI_TYPE="xsi:type";function _n(e){return e.xml&&e.xml.serialize}function wn(){}xn.serializeAsType=function(e){return _n(e)===En},xn.serializeAsProperty=function(e){return"property"===_n(e)},wn.prototype.get=function(e){return this.$model.properties.get(this,e)},wn.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};var Sn=wn,Tn=l.forEach,Cn=l.bind;function An(e,t){this.model=e,this.properties=t}var Rn=An;An.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(Sn.prototype);Tn(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}),Tn(e,Cn(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 Pn={};function Mn(e){this.model=e}Pn.parseName=function(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}};var kn=Mn;function Bn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}Mn.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:Bn(e,i,n):e.$attrs[t]=n},Mn.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&&Bn(e,n,[]),e[i]},Mn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},Mn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Mn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};var Nn=l.pick,Dn=l.assign,On=l.forEach,Ln=l.bind,In=Pn.parseName;function jn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}var zn=jn;jn.prototype.build=function(){return Nn(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},jn.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)},jn.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},jn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=In(r[0],i),a=In(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},jn.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},jn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},jn.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},jn.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},jn.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")},jn.prototype.hasProperty=function(e){return this.propertiesByName[e]},jn.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(On(e.properties,Ln(function(n){n=Dn({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))},this)),i.push(e),n[r]=e)};var Fn={},$n={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},Gn={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)}};Fn.coerceType=function(e,t){var n=Gn[e];return n?n(t):t},Fn.isBuiltIn=function(e){return!!$n[e]},Fn.isSimple=function(e){return!!Gn[e]};var Wn=l.assign,Hn=l.forEach,Vn=l.bind,qn=Pn.parseName,Un=Fn.isBuiltIn;function Yn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,Hn(e,Vn(this.registerPackage,this))}var Kn=Yn;function Xn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}Yn.prototype.getPackage=function(e){return this.packageMap[e]},Yn.prototype.getPackages=function(){return this.packages},Yn.prototype.registerPackage=function(e){e=Wn({},e);var t=this.packageMap;Xn(t,e,"prefix"),Xn(t,e,"uri"),Hn(e.types,Vn(function(t){this.registerType(t,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Yn.prototype.registerType=function(e,t){e=Wn({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Wn(e.meta||{})});var n=qn(e.name,t.prefix),i=n.name,r={};Hn(e.properties,Vn(function(e){var t=qn(e.name,n.prefix),i=t.name;Un(e.type)||(e.type=qn(e.type,t.prefix).name),Wn(e,{ns:t,name:i}),r[i]=e},this)),Wn(e,{ns:n,name:i,propertiesByName:r}),Hn(e.extends,Vn(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Yn.prototype.mapTypes=function(e,t,n){var i=Un(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=qn(n,Un(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");Hn(i.superClass,n?o:a),t(i,!n),Hn(i.traits,o)},Yn.prototype.getEffectiveDescriptor=function(e){var t=qn(e),n=new zn(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},Yn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};var Zn=l.isString,Qn=l.isObject,Jn=l.forEach,ei=Pn.parseName;function ti(e){this.properties=new kn(this),this.factory=new Rn(this,this.properties),this.registry=new Kn(e,this.properties),this.typeCache={}}var ni=ti;ti.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},ti.prototype.getType=function(e){var t=this.typeCache,n=Zn(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},ti.prototype.createAny=function(e,t,n){var i=ei(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}),Jn(n,function(e,t){Qn(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},ti.prototype.getPackage=function(e){return this.registry.getPackage(e)},ti.prototype.getPackages=function(){return this.registry.getPackages()},ti.prototype.getElementDescriptor=function(e){return e.$descriptor},ti.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},ti.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},ti.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var ii,ri,oi=ni,ai={exports:{}};ii=this,ri=function(e){"use strict";var t=String.fromCharCode,n=Object.prototype.hasOwnProperty,i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,r={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function o(e,i,o,a){return a?n.call(r,a)?r[a]:"&"+a+";":t(i||parseInt(o,16))}function a(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(i,o):e}Object.keys(r).forEach(function(e){r[e.toUpperCase()]=r[e]});var s="http://www.w3.org/2001/XMLSchema-instance",c="xsi",p="xsi:type";function l(e){return new Error(e)}function u(e){return"missing namespace for prefix <"+e+">"}function h(e){return{get:e,enumerable:!0}}function d(e){var t,n={};for(t in e)n[t]=e[t];return n}function m(e){return e+"$uri"}function f(){return{line:0,column:0}}function y(e){throw e}e.Parser=function e(t){if(!this)return new e(t);var n,i,r,o,v,g,b,x,E,_=t&&t.proxy,w=y,S=f,T=!1,C=!1,A=null,R=!1;function P(e){e instanceof Error||(e=l(e)),A=e,w(e,S)}function M(e){v&&(e instanceof Error||(e=l(e)),v(e,S))}this.on=function(e,t){if("function"!=typeof t)throw l("required args <name, cb>");switch(e){case"openTag":i=t;break;case"text":n=t;break;case"closeTag":r=t;break;case"error":w=t;break;case"warn":v=t;break;case"cdata":o=t;break;case"attention":x=t;break;case"question":b=t;break;case"comment":g=t;break;default:throw l("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw l("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[s]=c,C=!0,E=n,this},this.parse=function(e){if("string"!=typeof e)throw l("required args <xml=string>");return A=null,function(e){var t,s,c,l,f,y,v,w,A,k,B=C?[]:null,N=C?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[m(n)]=t;return i}(E):null,D=[],O=0,L=!1,I=!1,j=0,z=0,F="",$=0;function G(){if(null!==k)return k;var e,t,n,i,r,o,s,c,l,h,f,y=C&&N.xmlns,v=C&&T?[]:null,g=$,b=F,x=b.length,_={},w={};e:for(;g<x;g++)if(l=!1,!(32===(h=b.charCodeAt(g))||h<14&&h>8)){for((h<65||h>122||h>90&&h<97)&&95!==h&&58!==h&&(M("illegal first char attribute name"),l=!0),f=g+1;f<x;f++)if(!((h=b.charCodeAt(f))>96&&h<123||h>64&&h<91||h>47&&h<59||45===h||95===h)){if(32===h||h<14&&h>8){M("missing attribute value"),g=f;continue e}if(61===h)break;M("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(c=b.substring(g,f))&&(M("illegal declaration of xmlns"),l=!0),34===(h=b.charCodeAt(f+1)))-1===(f=b.indexOf('"',g=f+2))&&-1!==(f=b.indexOf("'",g))&&(M("attribute value quote missmatch"),l=!0);else if(39===h)-1===(f=b.indexOf("'",g=f+2))&&-1!==(f=b.indexOf('"',g))&&(M("attribute value quote missmatch"),l=!0);else for(M("missing attribute value quotes"),l=!0,f+=1;f<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++);for(-1===f&&(M("missing closing quotes"),f=x,l=!0),l||(o=b.substring(g,f)),g=f;f+1<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++)g===f&&(M("illegal character after attribute end"),l=!0);if(g=f+1,!l)if(c in w)M("attribute <"+c+"> already defined");else if(w[c]=!0,C)if(T){if(null!==(r="xmlns"===c?"xmlns":120===c.charCodeAt(0)&&"xmlns:"===c.substr(0,6)?c.substr(6):null)){if(e=a(o),t=m(r),!(s=E[e])){if("xmlns"===r||t in N&&N[t]!==e)do{s="ns"+O++}while(void 0!==N[s]);else s=r;E[e]=s}N[r]!==s&&(i||(N=d(N),i=!0),N[r]=s,"xmlns"===r&&(N[m(s)]=e,y=s),N[t]=e),_[c]=o;continue}v.push(c,o)}else-1!==(h=c.indexOf(":"))?(n=N[c.substring(0,h)])?((c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o),_[c]=o):M(u(c.substring(0,h))):_[c]=o;else _[c]=o}if(T)for(g=0,x=v.length;g<x;g++){if(c=v[g++],o=v[g],-1!==(h=c.indexOf(":"))){if(!(n=N[c.substring(0,h)])){M(u(c.substring(0,h)));continue}(c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o)}_[c]=o}return k=_}for(S=function(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=z;j>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>j);)r+=1,a=s;return-1==j?(o=s,n=""):(o=j-a,n=-1==z?e.substring(j):e.substring(j,z+1)),{data:n,line:r,column:o}},_&&(A=Object.create({},{name:h(function(){return v}),originalName:h(function(){return w}),attrs:h(G),ns:h(function(){return N})}));-1!==z;){if(-1===(j=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return D.length?P("unexpected end of file"):0===z?P("missing start tag"):void 0;if(z!==j&&n&&(n(e.substring(z,j),a,S),R))return;if(33!==(f=e.charCodeAt(j+1)))if(63!==f){if(-1==(z=e.indexOf(">",j+1)))return P("unclosed tag");if(k={},47===f){if(L=!1,I=!0,!D.length)return P("missing open tag");if(s=v=D.pop(),l=j+2+s.length,e.substring(j+2,l)!==s)return P("closing tag mismatch");for(;l<z;l++)if(!(32===(f=e.charCodeAt(l))||f>8&&f<14))return P("close tag")}else{if(47===e.charCodeAt(z-1)?(s=v=e.substring(j+1,z-1),L=!0,I=!0):(s=v=e.substring(j+1,z),L=!0,I=!1),!(f>96&&f<123||f>64&&f<91||95===f||58===f))return P("illegal first char nodeName");for(l=1,c=s.length;l<c;l++)if(!((f=s.charCodeAt(l))>96&&f<123||f>64&&f<91||f>47&&f<59||45===f||95===f)){if(32===f||f<14&&f>8){v=s.substring(0,l),k=null;break}return P("invalid nodeName")}I||D.push(v)}if(C){if(t=N,L&&(I||B.push(t),null===k&&(T=-1!==s.indexOf("xmlns",l))&&($=l,F=s,G(),T=!1)),w=v,-1!==(f=v.indexOf(":"))){if(!(y=N[v.substring(0,f)]))return P("missing namespace on <"+w+">");v=v.substr(f+1)}else y=N.xmlns;y&&(v=y+":"+v)}if(L&&($=l,F=s,i&&(_?i(A,a,I,S):i(v,G,a,I,S),R)))return;if(I){if(r&&(r(_?A:v,a,L,S),R))return;C&&(N=L?t:B.pop())}z+=1}else{if(-1===(z=e.indexOf("?>",j)))return P("unclosed question");if(b&&(b(e.substring(j,z+2),S),R))return;z+=2}else{if(91===(f=e.charCodeAt(j+2))&&"CDATA["===e.substr(j+3,6)){if(-1===(z=e.indexOf("]]>",j)))return P("unclosed cdata");if(o&&(o(e.substring(j+9,z),S),R))return;z+=3;continue}if(45===f&&45===e.charCodeAt(j+3)){if(-1===(z=e.indexOf("--\x3e",j)))return P("unclosed comment");if(g&&(g(e.substring(j+4,z),a,S),R))return;z+=3;continue}if(-1===(z=e.indexOf(">",j+1)))return P("unclosed tag");if(x&&(x(e.substring(j,z+1),a,S),R))return;z+=1}}}(e),S=f,R=!1,A},this.stop=function(){R=!0}},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof ai.exports?ri(ai.exports):ri(ii.Saxen={}),ai=ai.exports;var si={};!function(e){"use strict";function t(){this.data=[null],this.top=0}function n(){return new t}t.prototype.clear=function(){return this.data=[null],this.top=0,this},t.prototype.length=function(){return this.top},t.prototype.peek=function(){return this.data[this.top]},t.prototype.pop=function(){return this.top>0?(this.top--,this.data.pop()):void 0},t.prototype.push=function(e){return this.data[++this.top]=e,this},void 0!==si?si=n:e.stack=n}(this);var ci={},pi=l.forEach,li=l.find,ui=l.assign,hi=ai.Parser,di=Pn.parseName,mi=Fn.coerceType,fi=Fn.isSimple,yi=xn.XSI_TYPE,vi=xn.serializeAsType,gi=xn.hasLowerCaseAlias;function bi(e,t){return gi(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function xi(e){return new Error(e)}function Ei(e){return e.$descriptor}function _i(){}function wi(){}function Si(){}function Ti(e,t){this.property=e,this.context=t}function Ci(e,t){this.element=t,this.propertyDesc=e}function Ai(){}function Ri(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Pi(e,t,n){Ri.call(this,e,t,n)}function Mi(e,t,n){this.model=e,this.context=n}function ki(e){e instanceof oi&&(e={model:e}),ui(this,{lax:!1},e)}_i.prototype.handleEnd=function(){},_i.prototype.handleText=function(){},_i.prototype.handleNode=function(){},wi.prototype=Object.create(_i.prototype),wi.prototype.handleNode=function(){return this},Si.prototype=Object.create(_i.prototype),Si.prototype.handleText=function(e){this.body=(this.body||"")+e},Ti.prototype=Object.create(Si.prototype),Ti.prototype.handleNode=function(e){if(this.element)throw xi("expected no sub nodes");return this.element=this.createReference(e),this},Ti.prototype.handleEnd=function(){this.element.id=this.body},Ti.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Ci.prototype=Object.create(Si.prototype),Ci.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=mi(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Ai.prototype=Object.create(Si.prototype),Ai.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},Ri.prototype=Object.create(Ai.prototype),Ri.prototype.addReference=function(e){this.context.addReference(e)},Ri.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Ei(t).bodyProperty;n&&void 0!==e&&(e=mi(n.type,e),t.set(n.name,e))},Ri.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=Ei(n),r=this.context,o=new n({});return pi(t,function(e,t){var n,a=i.propertiesByName[t];a&&a.isReference?a.isMany?(n=e.split(" "),pi(n,function(e){r.addReference({element:o,property:a.ns.name,id:e})})):r.addReference({element:o,property:a.ns.name,id:e}):(a&&(e=mi(a.type,e)),o.set(t,e))}),o},Ri.prototype.getPropertyForNode=function(e){var t,n,i=e.name,r=di(i),o=this.type,a=this.model,s=Ei(o),c=r.name,p=s.propertiesByName[c];if(p)return vi(p)&&(t=e.attributes[yi])?(t=function(e,t){var n=di(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,a),n=a.getType(t),ui({},p,{effectiveType:Ei(n).name})):p;var l=a.getPackage(r.prefix);if(l){if(t=bi(r,l),n=a.getType(t),p=li(s.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return ui({},p,{effectiveType:Ei(n).name})}else if(p=li(s.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return p;throw xi("unrecognized element <"+r.name+">")},Ri.prototype.toString=function(){return"ElementDescriptor["+Ei(this.type).name+"]"},Ri.prototype.valueHandler=function(e,t){return new Ci(e,t)},Ri.prototype.referenceHandler=function(e){return new Ti(e,this.context)},Ri.prototype.handler=function(e){return"Element"===e?new Mi(this.model,e,this.context):new Ri(this.model,e,this.context)},Ri.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,fi(n))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?(ui(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},Pi.prototype=Object.create(Ri.prototype),Pi.prototype.createElement=function(e){var t=e.name,n=di(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&bi(n,o)||t;if(!r.hasType(a))throw xi("unexpected element <"+e.originalName+">");return Ri.prototype.createElement.call(this,e)},Mi.prototype=Object.create(Ai.prototype),Mi.prototype.createElement=function(e){var t=e.name,n=di(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Mi.prototype.handleChild=function(e){var t=new Mi(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},Mi.prototype.handleText=function(e){this.body=this.body||""+e},Mi.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ki.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Ri?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new function(e){ui(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw xi("expected element");var t,n=this.elementsById,i=Ei(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw xi("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}(ui({},t,{rootHandler:i})),s=new hi({proxy:!0}),c=new si;function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),xi(c)}i.context=a,c.push(i);var l=/^<\?xml /i,u=/ encoding="([^"]+)"/i,h=/^utf-8$/i;var d=r.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(d).on("openTag",function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,n){var i=t(r[n]);return e[n]=i,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){p(e,t,o)&&c.push(new wi)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)}).on("question",function(e){if(l.test(e)){var t=u.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",function(e){c.peek().handleText(e)}).on("text",function(e,t){!function(e){(e=e.trim())&&c.peek().handleText(e)}(t(e))}).on("error",p).on("warn",function(e,t){return p(e,t,!0)}),setTimeout(function(){var t;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=Ei(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}()}catch(e){t=e}var r=i.element;t||r||(t=xi("failed to parse document as <"+i.type.$descriptor.name+">")),n(t,t?void 0:r,a)},0)},ki.prototype.handler=function(e){return new Pi(this.model,e)},(ci=ki).ElementHandler=Ri;var Bi=l.map,Ni=l.forEach,Di=l.isString,Oi=l.filter,Li=l.assign,Ii=Pn.parseName,ji=xn.hasLowerCaseAlias,zi=xn.serializeAsType,Fi=xn.serializeAsProperty,$i='<?xml version="1.0" encoding="UTF-8"?>\n',Gi=/(<|>|'|"|&|\n\r|\n)/g,Wi=xn.DEFAULT_NS_MAP,Hi=xn.XSI_TYPE;function Vi(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function qi(e){return Di(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function Ui(e,t){return t.isGeneric?Li({localName:t.ns.localName},e):Li({localName:(n=t.ns.localName,i=t.$pkg,ji(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var Yi={"\n":"10","\n\r":"10",'"':"34","'":"39","<":"60",">":"62","&":"38"};function Ki(e){this.tagName=e}function Xi(){}function Zi(e){this.tagName=e}function Qi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function Ji(e,t){Qi.call(this,e,t)}Ki.prototype.build=function(e){return this.element=e,this},Ki.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Xi.prototype.serializeValue=Xi.prototype.serializeTo=function(e){var t=this.escape;t&&e.append("<![CDATA["),e.append(this.value),t&&e.append("]]>")},Xi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(Gi)&&(this.escape=!0),this},Vi(Zi,Xi),Zi.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Qi.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){var t=e.$descriptor;return Oi(t.properties,function(t){var n=t.name;if(t.isVirtual)return!1;if(!e.hasOwnProperty(n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)})}(e),this.parseAttributes(Oi(n,function(e){return e.isAttr})),this.parseContainments(function(e){return Oi(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},Qi.prototype.nsTagName=function(e){return Ui(this.logNamespaceUsed(e.ns),e)},Qi.prototype.nsPropertyTagName=function(e){return function(e,t){return Li({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},Qi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Qi.prototype.nsAttributeName=function(e){var t;if(t=Di(e)?Ii(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}:Li({localName:t.localName},n)},Qi.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return Ni(e,function(r,o){"$body"===o?n.push((new Xi).build({type:"String"},r)):"$children"===o?Ni(r,function(e){n.push(new Qi(t).build(e))}):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})}),i},Qi.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=Ii(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)}},Qi.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return Ni(i,function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)}),r},Qi.prototype.parseGenericAttributes=function(e,t){var n=this;Ni(t,function(t){if(t.name!==Hi)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}})},Qi.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;Ni(e,function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new Xi).build(e,r[0]));else if(Fn.isSimple(e.type))Ni(r,function(i){n.push(new Zi(t.addTagName(t.nsPropertyTagName(e))).build(e,i))});else if(o)Ni(r,function(i){n.push(new Ki(t.addTagName(t.nsPropertyTagName(e))).build(i))});else{var a=zi(e),s=Fi(e);Ni(r,function(i){var r;r=a?new Ji(t,e):s?new Qi(t,e):new Qi(t),n.push(r.build(i))})}})},Qi.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new function(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.logUsed=function(e){var t=e.uri;i[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(r,o).filter(function(e){return i[e.uri]})}}(t):n=t),n},Qi.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},Qi.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=Wi[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},Qi.prototype.parseAttributes=function(e){var t=this,n=this.element;Ni(e,function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];Ni(i,function(e){r.push(e.id)}),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)})},Qi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),qi(e)},Qi.prototype.addAttribute=function(e,t){var n,i=this.attrs;Di(t)&&(t=(n=Di(n=t)?n:""+n).replace(Gi,function(e){return"&#"+Yi[e]+";"})),i.push({name:e,value:t})},Qi.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return Bi(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(t)),Ni(t,function(t){e.append(" ").append(qi(t.name)).append('="').append(t.value).append('"')})},Qi.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Xi;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),Ni(this.body,function(t){t.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Vi(Ji,Qi),Ji.prototype.parseNsAttributes=function(e){var t=Qi.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(Hi),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},Ji.prototype.isLocalNs=function(e){return e.uri===this.typeNs.uri};var er=function(e){return e=Li({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new function(){this.value="",this.write=function(e){this.value+=e}},r=new function(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}(i,e.format);if(e.preamble&&r.append($i),(new Qi).build(t).serializeTo(r),!n)return i.value}}},tr=l.isString,nr=l.isFunction,ir=l.assign;function rr(e,t){oi.call(this,e,t)}rr.prototype=Object.create(oi.prototype);var or=rr;rr.prototype.fromXML=function(e,t,n,i){tr(t)||(i=n,n=t,t="bpmn:Definitions"),nr(n)&&(i=n,n={});var r=new ci(ir({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)},rr.prototype.toXML=function(e,t,n){nr(t)&&(n=t,t={});var i,r,o=new er(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var ar=l.assign,sr={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"}]},{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:"Expression",xml:{serialize:"xsi:type"}}]},{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}]},{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:[]}},cr=function(e,t){return new or(ar({},sr,e),t)},pr={remove:function(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n},add:function(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)}},indexOf:function(e,t){return e&&t?e.indexOf(t):-1}},lr={},ur=l.isArray,hr=l.isNumber,dr=l.groupBy,mr=l.forEach;function fr(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function yr(e,t,n){n=n||0,ur(e)||(e=[e]),mr(e,function(e,i){var r=t(e,i,n);ur(r)&&r.length&&yr(r,t,n+1)})}function vr(e,t,n){var i=[],r=[];return yr(e,function(e,o,a){fr(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&fr(r,s,t))return s}),i}function gr(e,t){var n,i,r,o;return t=!!t,ur(e)||(e=[e]),mr(e,function(e){var a=e;e.waypoints&&!t&&(a=gr(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)}),{x:n,y:i,height:o-i,width:r-n}}lr.eachElement=yr,lr.selfAndAllChildren=function(e,t){return vr(e,!t,-1)},lr.getBBox=gr,lr.getEnclosedElements=function(e,t){var n={};return mr(e,function(e){var i=e;i.waypoints&&(i=gr(i)),!hr(t.y)&&i.x>t.x&&(n[e.id]=e),!hr(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(hr(t.width)&&hr(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:hr(t.width)&&hr(t.height)||(n[e.id]=e))}),n},lr.getClosure=function(e){var t=dr(e,function(e){return e.id}),n={},i={},r={},o={};function a(e){t[e.source.id]&&t[e.target.id]&&(t[e.id]=[e]),n[e.source.id]&&n[e.target.id]&&(o[e.id]=r[e.id]=e),i[e.id]=e}return yr(e,function(e){if(r[e.id]=e,!e.waypoints)return n[e.id]=e,mr(e.incoming,a),mr(e.outgoing,a),e.children;o[e.id]=i[e.id]=e}),{allShapes:n,allConnections:i,topLevel:t,enclosedConnections:o,enclosedElements:r}},lr.getType=function(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"};var br=l.isNumber,xr=l.assign,Er=l.forEach,_r=l.every,wr=l.debounce,Sr=l.bind,Tr=l.reduce,Cr=K.createMatrix;function Ar(e,t){return Math.round(e*t)/t}function Rr(e){return br(e)?e+"px":e}function Pr(e,t,n){var i=s("g");Ue(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]),i}var Mr={shape:["x","y","width","height"],connection:["waypoints"]};function kr(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}kr.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"];var Br=kr;function Nr(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}kr.prototype._init=function(t){var n=this._eventBus,i=this._container=function(e){var t=(e=xr({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),xr(n.style,{position:"relative",overflow:"hidden",width:Rr(e.width),height:Rr(e.height)}),t.appendChild(n),n}(t),r=this._svg=s("svg");e(r,{width:"100%",height:"100%"}),re(i,r);var o=this._viewport=Pr(r,"viewport");this._layers={},!1!==t.deferUpdate&&(this._viewboxChanged=wr(Sr(this._viewboxChanged,this),300)),n.on("diagram.init",function(){n.fire("canvas.init",{svg:r,viewport:o})},this),n.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),n.on("diagram.destroy",500,this._destroy,this),n.on("diagram.clear",500,this._clear,this)},kr.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},kr.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach(function(t){var n=lr.getType(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)}),delete this._cachedViewbox},kr.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},kr.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},kr.prototype._createLayer=function(e,t){t||(t=0);var n=Tr(this._layers,function(e,n){return t>=n.index&&e++,e},0);return{group:Pr(this._viewport,"layer-"+e,n),index:t}},kr.prototype.getContainer=function(){return this._container},kr.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(Er([i.gfx,i.secondaryGfx],function(e){e&&(n?Ue(e).add(t):Ue(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},kr.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},kr.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},kr.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));var n=this.getGraphics(e);return Ue(n).has(t)},kr.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},kr.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},kr.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e,e},kr.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=Mr[e];if(!_r(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},kr.prototype._setParent=function(e,t,n){pr.add(t.children,e,n),e.parent=t},kr.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},kr.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},kr.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},kr.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),pr.remove(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},kr.prototype.removeShape=function(e){return this._removeElement(e,"shape")},kr.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},kr.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},kr.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},kr.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},kr.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s=this._viewport,c=this.getSize();return e?(this._changeViewbox(function(){r=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(r).translate(-e.x,-e.y);Q(s,t)}),e):(t=this.getDefaultLayer().getBBox(),n=(i=Q(s))?i.matrix:Cr(),r=Ar(n.a,1e3),o=Ar(-n.e||0,1e3),a=Ar(-n.f||0,1e3),e=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:t.width,height:t.height,x:t.x,y:t.y},outer:c})},kr.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=xr({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Nr(t,n)}),{x:n.e,y:n.f}},kr.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)}),Ar(i.a,1e3)):this.viewbox(e).scale;var n,i},kr.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},kr.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=xr(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),Nr(this._viewport,o),o},kr.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},kr.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}},kr.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Dr={},Or=l.assign,Lr=new rn({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Ir=new rn({name:"label",enumerable:!0},{name:"labelTarget"}),jr=new rn({name:"attachers",collection:!0},{name:"host"}),zr=new rn({name:"outgoing",collection:!0},{name:"source"}),Fr=new rn({name:"incoming",collection:!0},{name:"target"});function $r(){Object.defineProperty(this,"businessObject",{writable:!0}),Lr.bind(this,"parent"),Ir.bind(this,"label"),zr.bind(this,"outgoing"),Fr.bind(this,"incoming")}function Gr(){$r.call(this),Lr.bind(this,"children"),jr.bind(this,"host"),jr.bind(this,"attachers")}function Wr(){Gr.call(this)}function Hr(){Gr.call(this),Ir.bind(this,"labelTarget")}function Vr(){$r.call(this),zr.bind(this,"source"),Fr.bind(this,"target")}we(Gr,$r),we(Wr,Gr),we(Hr,Gr),we(Vr,$r);var qr={connection:Vr,shape:Gr,label:Hr,root:Wr};Dr.create=function(e,t){var n=qr[e];if(!n)throw new Error("unknown type: <"+e+">");return Or(new n,t)},Dr.Base=$r,Dr.Label=Hr;var Ur=l.assign;function Yr(){this._uid=12}var Kr=Yr;Yr.prototype.createRoot=function(e){return this.create("root",e)},Yr.prototype.createLabel=function(e){return this.create("label",e)},Yr.prototype.createShape=function(e){return this.create("shape",e)},Yr.prototype.createConnection=function(e){return this.create("connection",e)},Yr.prototype.create=function(e,t){return(t=Ur({},t||{})).id||(t.id=e+"_"+this._uid++),Dr.create(e,t)};var Xr="data-element-id";function Zr(e){this._elements={},this._eventBus=e}Zr.$inject=["eventBus"];var Qr=Zr;Zr.prototype.add=function(t,n,i){var r=t.id;this._validateId(r),e(n,Xr,r),i&&e(i,Xr,r),this._elements[r]={element:t,gfx:n,secondaryGfx:i}},Zr.prototype.remove=function(t){var n=this._elements,i=t.id||t,r=i&&n[i];r&&(e(r.gfx,Xr,""),r.secondaryGfx&&e(r.secondaryGfx,Xr,""),delete n[i])},Zr.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)},Zr.prototype.get=function(t){var n;n="string"==typeof t?t:t&&e(t,Xr);var i=this._elements[n];return i&&i.element},Zr.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},Zr.prototype.getAll=function(){return this.filter(function(e){return e})},Zr.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},Zr.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Zr.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 Jr={},eo=l.isFunction,to=l.isArray,no=l.isNumber,io=l.bind,ro=l.assign,oo=Array.prototype.slice;function ao(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function so(){}Jr=ao,ao.prototype.on=function(e,t,n,i){if(e=to(e)?e:[e],eo(t)&&(i=n,n=t,t=1e3),!no(t))throw new Error("priority must be a number");var r=n;i&&((r=io(n,i)).__fn=n.__fn||n);var o=this,a={priority:t,callback:r};e.forEach(function(e){o._addListener(e,a)})},ao.prototype.once=function(e,t,n,i){var r=this;if(eo(t)&&(i=n,n=t,t=1e3),!no(t))throw new Error("priority must be a number");function o(){return r.off(e,o),n.apply(i,arguments)}o.__fn=n,this.on(e,t,o)},ao.prototype.off=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.__fn!==t||o.splice(r,1);else o.length=0},ao.prototype.fire=function(e,t){var n,i,r,o;if(o=oo.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){t instanceof so?n=t:(n=new so).init(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},ao.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},ao.prototype._destroy=function(){this._listeners={}},ao.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},ao.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},ao.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)},ao.prototype._getListeners=function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t},Jr.Event=so,so.prototype.stopPropagation=function(){this.cancelBubble=!0},so.prototype.preventDefault=function(){this.defaultPrevented=!0},so.prototype.init=function(e){ro(this,e||{})};var co={},po=Se.query;co.getVisual=function(e){return po(".djs-visual",e)},co.getChildren=function(e){return e.parentNode.childNodes[1]};var lo=l.forEach,uo=l.reduce,ho=ee.translate,mo=Se.clear;function fo(e,t){this._eventBus=e,this._elementRegistry=t}fo.$inject=["eventBus","elementRegistry"];var yo=fo;function vo(e,t,n){t.insertBefore(e,n||t.firstChild)}fo.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=co.getChildren(n))||(t=s("g"),Ue(t).add("djs-children"),re(n.parentNode,t)):t=n,t},fo.prototype._clear=function(e){var t=co.getVisual(e);return mo(t),t},fo.prototype._createContainer=function(e,t,n){var i=s("g");Ue(i).add("djs-group"),void 0!==n?vo(i,t,t.childNodes[n]):re(t,i);var r=s("g");Ue(r).add("djs-element"),Ue(r).add("djs-"+e),re(i,r);var o=s("g");return Ue(o).add("djs-visual"),re(r,o),r},fo.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},fo.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=uo(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),lo(t,function(e){var t=e.children;if(t){var r=n._getChildren(e);lo(t.slice().reverse(),function(e){vo(i.getGraphics(e).parentNode,r)})}})},fo.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},fo.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},fo.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},fo.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},fo.prototype.update=function(t,n,i){if(n.parent){var r=this._clear(i);if("shape"===t)this.drawShape(r,n),ho(i,n.x,n.y);else{if("connection"!==t)throw new Error("unknown type: "+t);this.drawConnection(r,n)}n.hidden?e(i,"display","none"):e(i,"display","block")}},fo.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);oe(t.parentNode)};var go=c.componentsToPath,bo=c.createLine,xo=1;function Eo(e,t){Y.call(this,e,xo),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2})}we(Eo,Y),Eo.prototype.canRender=function(){return!0},Eo.prototype.drawShape=function(t,n){var i=s("rect");return e(i,{x:0,y:0,width:n.width||0,height:n.height||0}),e(i,this.SHAPE_STYLE),re(t,i),i},Eo.prototype.drawConnection=function(e,t){var n=bo(t.waypoints,this.CONNECTION_STYLE);return re(e,n),n},Eo.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return go([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])},Eo.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 go(r)},Eo.$inject=["eventBus","styles"];var _o=Eo,wo=l.isArray,So=l.assign,To=l.reduce;var Co={__depends__:[{__init__:["defaultRenderer"],defaultRenderer:["type",_o],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){var i=this.style(t,n);return So(i,{class:e})},this.style=function(t,n){wo(t)||n||(n=t,t=[]);var i=To(t,function(t,n){return So(t,e[n]||{})},{});return n?So(i,n):i},this.computeStyle=function(e,n,i){return wo(n)||(i=n,n=[]),t.style(n||[],So({},i,e||{}))}}]}],__init__:["canvas"],canvas:["type",Br],elementRegistry:["type",Qr],elementFactory:["type",Kr],eventBus:["type",Jr],graphicsFactory:["type",yo]},Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});var Ro=/^class /;function Po(e){return"[object Array]"===Object.prototype.toString.call(e)}function Mo(){var e=Array.prototype.slice.call(arguments);1===e.length&&Po(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var ko=/constructor\s*[^(]*\(\s*([^)]*)\)/m,Bo=/^function\s*[^(]*\(\s*([^)]*)\)/m,No=/\/\*([^*]*)\*\//m;function Do(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var t=e.toString().match(function(e){return Ro.test(e.toString())}(e)?ko:Bo);return t&&t[1]&&t[1].split(",").map(function(e){return(t=e.match(No))?t[1].trim():e.trim()})||[]}function Oo(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}var Lo="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 Io(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 jo(e,t){return Object.hasOwnProperty.call(e,t)}Ao.Injector=function e(t,n){n=n||{get:function(e,t){if(i.push(e),!1===t)return null;throw s('No provider for "'+e+'"!')}};var i=[],r=this._providers=Object.create(n._providers||null),o=this._instances=Object.create(null),a=o.injector=this,s=function(e){var t=i.join(" -> ");return i.length=0,new Error(t?e+" (Resolving: "+t+")":e)},c=function e(t,a){if(!r[t]&&-1!==t.indexOf(".")){for(var c=t.split("."),p=e(c.shift());c.length;)p=p[c.shift()];return p}if(jo(o,t))return o[t];if(jo(r,t)){if(-1!==i.indexOf(t))throw i.push(t),s("Cannot resolve circular dependency!");return i.push(t),o[t]=r[t][0](r[t][1]),i.pop(),o[t]}return n.get(t,a)},p=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!Po(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=Mo(e.slice())}return{fn:e,dependencies:(e.$inject||Do(e)).map(function(e){return jo(t,e)?t[e]:c(e)})}},l=function(e){var t=p(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(Io(n))))},u=function(e,t,n){var i=p(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(Io(r)))},h=function(e){return Mo(function(t){return e.get(t)})},d={factory:u,type:l,value:function(e){return e}};t.forEach(function(t){function n(e,t){return"value"!==e&&Po(t)&&(t=Mo(t.slice())),t}if(t instanceof Oo)t.forEach(function(e){var t=e[0],i=e[1],o=e[2];r[t]=[d[i],n(i,o),i]});else if("object"===(void 0===t?"undefined":Lo(t)))if(t.__exports__){var i=Object.keys(t).reduce(function(e,n){return"__"!==n.substring(0,2)&&(e[n]=t[n]),e},Object.create(null)),o=new e((t.__modules__||[]).concat([i]),a),s=Mo(function(e){return o.get(e)});t.__exports__.forEach(function(e){r[e]=[s,e,"private",o]})}else Object.keys(t).forEach(function(e){if("private"!==t[e][2]){var i=t[e][0],o=t[e][1];r[e]=[d[i],n(i,o),i]}else r[e]=t[e]})}),this.get=c,this.invoke=u,this.instantiate=l,this.createChild=function(t,n){if(n&&n.length){var i,o,s,c,p=Object.create(null),l=Object.create(null),u=[],d=[],m=[];for(var f in r)i=r[f],-1!==n.indexOf(f)&&("private"===i[2]?-1===(o=u.indexOf(i[3]))?(s=i[3].createChild([],n),c=h(s),u.push(i[3]),d.push(s),m.push(c),p[f]=[c,f,"private",s]):p[f]=[m[o],f,"private",d[o]]:p[f]=[i[2],i[1]],l[f]=!0),"factory"!==i[2]&&"type"!==i[2]||!i[1].$scope||n.forEach(function(e){-1!==i[1].$scope.indexOf(e)&&(p[f]=[i[2],i[1]],l[e]=!0)});n.forEach(function(e){if(!l[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),t.unshift(p)}return new e(t,a)}};var zo=Ao.Injector;function Fo(e){var t=[],n=[];function i(e){return t.indexOf(e)>=0}e.forEach(function e(r){i(r)||((r.__depends__||[]).forEach(e),i(r)||(function(e){t.push(e)}(r),(r.__init__||[]).forEach(function(e){n.push(e)})))});var r=new zo(t);return n.forEach(function(e){try{r["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),r}function $o(e,t){this.injector=t=t||function(e){return Fo([{config:["value",e=e||{}]},Co].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}var Go=$o;$o.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},$o.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var Wo=Go;function Ho(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}var Vo=Ho;Ho.prototype.next=function(){return this._prefix+ ++this._counter};var qo=l.isArray,Uo=l.isString,Yo=l.isObject,Ko=l.assign,Xo=l.forEach,Zo=l.find,Qo=l.filter,Jo=l.matchPattern,ea=Se.domify,ta=Se.classes,na=Se.attr,ia=Se.remove,ra=Se.clear,oa=lr.getBBox,aa=new Vo("ov");function sa(e,t,n){Ko(e.style,{left:t+"px",top:n+"px"})}function ca(e,t){e.style.display=!1===t?"none":""}function pa(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}function la(e){return void 0!==e}function ua(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=aa,this._overlayDefaults=Ko({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=ea('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}ua.$inject=["config.overlays","eventBus","canvas","elementRegistry"];var ha=ua;ua.prototype.get=function(e){if(Uo(e)&&(e={id:e}),Uo(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?Qo(t.overlays,Jo({type:e.type})):t.overlays.slice():[]}return e.type?Qo(this._overlays,Jo({type:e.type})):e.id?this._overlays[e.id]:null},ua.prototype.add=function(e,t,n){if(Yo(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=Ko({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},ua.prototype.remove=function(e){var t=this.get(e)||[];qo(t)||(t=[t]);var n=this;Xo(t,function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ia(e.html),ia(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}})},ua.prototype.show=function(){ca(this._overlayRoot)},ua.prototype.hide=function(){ca(this._overlayRoot,!1)},ua.prototype.clear=function(){this._overlays={},this._overlayContainers=[],ra(this._overlayRoot)},ua.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=oa(t);i=o.x,r=o.y}sa(n,i,r),na(e.html,"data-container-id",t.id)},ua.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?oa(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?oa(o).height:o.height,s=-1*i.bottom+n);sa(r,a||0,s||0)},ua.prototype._createOverlayContainer=function(e){var t=ea('<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},ua.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";pa(this._overlayRoot,n)},ua.prototype._getOverlayContainer=function(e,t){var n=Zo(this._overlayContainers,function(t){return t.element===e});return n||t?n:this._createOverlayContainer(e)},ua.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)),Uo(o)&&(o=ea(o)),n=this._getOverlayContainer(r),(t=ea('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&ta(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())},ua.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((la(i)&&i>t.scale||la(r)&&r<t.scale)&&(a=!1),ca(o,a)),this._updateOverlayScale(e,t)},ua.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),la(n)&&t.scale<n&&(r=(1/t.scale||1)*n),la(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),la(r)&&(s="scale("+r+","+r+")"),pa(a,s)},ua.prototype._updateOverlaysVisibilty=function(e){var t=this;Xo(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},ua.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});Xo(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){ia(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(Xo(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&ta(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var da={__init__:["overlays"],overlays:["type",ha]},ma={};function fa(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function ya(e){return e.originalEvent||e.srcEvent}ma.getOriginal=ya,ma.stopPropagation=function(e,t){fa(e),fa(ya(e))},ma.toPoint=function(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};var va={isMac:function(){return/mac/i.test(navigator.platform)}},ga={},ba=ma.getOriginal,xa=va.isMac;function Ea(e){return!(ba(e)||e).button}ga.isPrimaryButton=Ea,ga.hasPrimaryModifier=function(e){var t=ba(e)||e;return!!Ea(e)&&(xa()?t.metaKey:t.ctrlKey)},ga.hasSecondaryModifier=function(e){var t=ba(e)||e;return Ea(e)&&t.shiftKey};var _a=l.forEach,wa=Se.delegate,Sa=ga.isPrimaryButton,Ta=Se.query,Ca=c.createLine,Aa=c.updateLine;function Ra(e){return!0}var Pa=500;function Ma(t,n,i){var r=i.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function o(e,i,r){var o,a;(function(e,t){return!(l[e]||Sa)(t)})(e,i)||(r?a=n.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=n.get(a)),a&&r&&!1===t.fire(e,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var a={};function c(e){return a[e]}var p={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},l={"element.contextmenu":Ra};var u="svg, .djs-element";function h(e,t,n,i){var r=a[n]=function(e){o(n,e)};i&&(l[n]=i),r.$delegate=wa.bind(e,u,t,r)}function d(e,t,n){var i=c(n);i&&wa.unbind(e,t,i.$delegate)}t.on("canvas.destroy",function(e){var t;t=e.svg,_a(p,function(e,n){d(t,n,e)})}),t.on("canvas.init",function(e){var t;t=e.svg,_a(p,function(e,n){h(t,n,e)})}),t.on(["shape.added","connection.added"],function(t){var n,i=t.element,o=t.gfx;i.waypoints?n=Ca(i.waypoints):(n=s("rect"),e(n,{x:0,y:0,width:i.width,height:i.height})),e(n,r),re(o,n)}),t.on("shape.changed",Pa,function(t){var n=t.element,i=t.gfx,r=Ta(".djs-hit",i);e(r,{width:n.width,height:n.height})}),t.on("connection.changed",function(e){var t=e.element,n=e.gfx,i=Ta(".djs-hit",n);Aa(i,t.waypoints)}),this.fire=o,this.triggerMouseEvent=function(e,t,n){var i=p[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return o(i,t,n)},this.mouseHandler=c,this.registerEvent=h,this.unregisterEvent=d}Ma.$inject=["eventBus","elementRegistry","styles"];var ka={__init__:["interactionEvents"],interactionEvents:["type",Ma]},Ba=lr.getBBox,Na=500,Da=Se.query,Oa=l.assign;function La(t,n,i){this.offset=6;var r=n.cls("djs-outline",["no-fill"]),o=this;function a(t,n){var i=s("rect");return e(i,Oa({x:10,y:10,width:100,height:100},r)),re(t,i),i}t.on(["shape.added","shape.changed"],Na,function(e){var t=e.element,n=e.gfx,i=Da(".djs-outline",n);i||(i=a(n)),o.updateShapeOutline(i,t)}),t.on(["connection.added","connection.changed"],function(e){var t=e.element,n=e.gfx,i=Da(".djs-outline",n);i||(i=a(n)),o.updateConnectionOutline(i,t)})}La.prototype.updateShapeOutline=function(t,n){e(t,{x:-this.offset,y:-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},La.prototype.updateConnectionOutline=function(t,n){var i=Ba(n);e(t,{x:i.x-this.offset,y:i.y-this.offset,width:i.width+2*this.offset,height:i.height+2*this.offset})},La.$inject=["eventBus","styles","elementRegistry"];var Ia={__init__:["outline"],outline:["type",La]},ja=l.isArray,za=l.forEach;function Fa(e){this._eventBus=e,this._selectedElements=[];var t=this;e.on(["shape.remove","connection.remove"],function(e){var n=e.element;t.deselect(n)}),e.on(["diagram.clear"],function(e){t.select(null)})}Fa.$inject=["eventBus"];var $a=Fa;Fa.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})}},Fa.prototype.get=function(){return this._selectedElements},Fa.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Fa.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();ja(e)||(e=e?[e]:[]),t?za(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 Ga=ga.hasPrimaryModifier,Wa=l.find;function Ha(e,t,n,i){e.on("create.end",500,function(e){e.context.canExecute&&t.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&t.select(e.context.target)}),e.on("shape.move.end",500,function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);Wa(n,function(e){return r.id===e.id})||t.select(r)}),e.on("element.click",function(e){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=Ga(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)})}Ha.$inject=["eventBus","selection","canvas","elementRegistry"];var Va=Ha,qa=l.forEach,Ua="hover",Ya="selected";function Ka(e,t,n,i){function r(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,Ua)}),e.on("element.out",function(e){o(e.element,Ua)}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;qa(t,function(e){-1===n.indexOf(e)&&o(e,Ya)}),qa(n,function(e){-1===t.indexOf(e)&&r(e,Ya)})})}Ka.$inject=["eventBus","canvas","selection","styles"];var Xa={__init__:["selectionVisuals","selectionBehavior"],__depends__:[ka,Ia],selection:["type",$a],selectionVisuals:["type",Ka],selectionBehavior:["type",Va]},Za=function(e){var t;for(;t=e.firstChild;)oe(t);return e};var Qa=function e(t,n){var i,r,o,a,s;switch(t.nodeType){case 3:n.push(ns(t.textContent,Ja));break;case 1:if(n.push("<",t.tagName),t.hasAttributes())for(o=t.attributes,i=0,r=o.length;i<r;++i)a=o.item(i),n.push(" ",a.name,'="',ns(a.value,es),'"');if(t.hasChildNodes()){for(n.push(">"),s=t.childNodes,i=0,r=s.length;i<r;++i)e(s.item(i),n);n.push("</",t.tagName,">")}else n.push("/>");break;case 8:n.push("\x3c!--",ns(t.nodeValue,Ja),"--\x3e");break;case 4:n.push("<![CDATA[",t.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+t.nodeType)}return n},Ja=/([&<>]{1})/g,es=/([\n\r"]{1})/g,ts={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function ns(e,t){return e.replace(t,function(e,t){return ts[t]||t})}var is=function(e,t){if(void 0!==t){try{!function(e,t){var n,i=o(t).documentElement;if(Za(e),!t)return;n=i.firstChild;for(;n;)ie(n,e),n=n.nextSibling}(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){var t=e.firstChild,n=[];for(;t;)Qa(t,n),t=t.nextSibling;return n.join("")}(e)};var rs=l.assign,os=l.isNumber,as=l.omit,ss=Se.domify,cs=Se.query,ps=Se.remove,ls=hn.importBpmnDiagram;var us={width:"100%",height:"100%",position:"relative"};function hs(e){return e+(os(e)?"px":"")}function ds(e){var t,n,i;e=rs({},us,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=dn.BPMNIO_IMG,i=ss('<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">'+n+"</a>"),t.appendChild(i),fs.bind(i,"click",function(e){dn.open(),e.preventDefault()}),this._init(this._container,this._moddle,e)}we(ds,Wo);var ms=ds;ds.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var o=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:o}),t(e,o);n.importDefinitions(i,function(e,i){var r=[].concat(o,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},ds.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},ds.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={});try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=cs("defs",r._svg),s=is(o),c=a?"<defs>"+is(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}t(i,n)},ds.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e}catch(e){return t(e)}return ls(this,e,t)},ds.prototype.getModules=function(){return this._modules},ds.prototype.destroy=function(){Wo.prototype.destroy.call(this),ps(this._container)},ds.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},ds.prototype.off=function(e,t){this.get("eventBus").off(e,t)},ds.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=cs(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},ds.prototype.getDefinitions=function(){return this._definitions},ds.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},ds.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=rs(as(n,["additionalModules"]),{canvas:rs({},n.canvas,{container:e}),modules:o});Wo.call(this,a),n&&n.container&&this.attachTo(n.container)},ds.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},ds.prototype._createContainer=function(e){var t=ss('<div class="bjs-container"></div>');return rs(t.style,{width:hs(e.width),height:hs(e.height),position:e.position}),t},ds.prototype._createModdle=function(e){var t=rs({},this._moddleExtensions,e.moddleExtensions);return new cr(t)},ds.prototype._modules=[Jt,Qt,Xa,da],ds.prototype._moddleExtensions={};var fs=Se.event;var ys={},vs=5e3;ys.install=function(e,t){function n(){return!1}return t=t||"element.click",e.once(t,vs,n),function(){e.off(t,n)}};var gs={},bs=Se.classes,xs=/^djs-cursor-.*$/;gs.set=function(e){var t=bs(document.body);t.removeMatching(xs),e&&t.add("djs-cursor-"+e)},gs.unset=function(){this.set(null)};var Es={};Es.log10=function(e){return Math.log(e)/Math.log(10)},Es.substract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var _s=Es.substract,ws=Se.event,Ss=Se.closest;var Ts=15;function Cs(e,t){var n;function i(i){var r,o=n.start,a=ma.toPoint(i),s=_s(a,o);if(!n.dragging&&(r=s,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>Ts)&&(n.dragging=!0,ys.install(e),gs.set("grab")),n.dragging){var c=n.last||n.start;s=_s(a,c),t.scroll({dx:s.x,dy:s.y}),n.last=a}i.preventDefault()}function r(e){ws.unbind(document,"mousemove",i),ws.unbind(document,"mouseup",r),n=null,gs.unset()}e.on("element.mousedown",500,function(e){return function(e){if(!Ss(e.target,".djs-draggable")&&!(e.button||e.ctrlKey||e.shiftKey||e.altKey))return n={start:ma.toPoint(e)},ws.bind(document,"mousemove",i),ws.bind(document,"mouseup",r),!0}(e.originalEvent)})}Cs.$inject=["eventBus","canvas"];var As={__init__:["moveCanvas"],moveCanvas:["type",Cs]},Rs={},Ps=Es.log10;Rs.getStepSize=function(e,t){var n=Ps(e.min),i=Ps(e.max);return(Math.abs(n)+Math.abs(i))/t},Rs.cap=function(e,t){return Math.max(e.min,Math.min(e.max,t))};var Ms=Se.event,ks=Se.closest,Bs=Rs.getStepSize,Ns=Rs.cap,Ds=Es.log10,Os=l.bind,Ls=Math.sign||function(e){return e>=0?1:-1},Is={min:.2,max:4},js=.75;function zs(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=Os(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||js;var i=this;t.on("canvas.init",function(t){i._init(!1!==e.enabled)})}zs.$inject=["config.zoomScroll","eventBus","canvas"];var Fs=zs;zs.prototype.scroll=function(e){this._canvas.scroll(e)},zs.prototype.reset=function(){this._canvas.zoom("fit-viewport")},zs.prototype.zoom=function(e,t){var n=Bs(Is,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},zs.prototype._handleWheel=function(e){if(!ks(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))*Ls(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)}},zs.prototype.stepZoom=function(e,t){var n=Bs(Is,10);this._zoom(e,t,n)},zs.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=Ds(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Ns(Is,s),t)},zs.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Ms[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},zs.prototype._init=function(e){this.toggle(e)};var $s={__init__:["zoomScroll"],zoomScroll:["type",Fs]};function Gs(e){ms.call(this,e)}we(Gs,ms);var Ws=Gs;Gs.prototype._navigationModules=[$s,As],Gs.prototype._modules=[].concat(Gs.prototype._modules,Gs.prototype._navigationModules);var Hs={};function Vs(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}Hs.pointDistance=Vs,Hs.pointsOnLine=function(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=Vs(e,t);return Math.abs(r/o)<=i};var qs=2;Hs.pointsAligned=function(e,t){return Math.abs(e.x-t.x)<=qs?"h":Math.abs(e.y-t.y)<=qs&&"v"},Hs.pointInRect=function(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},Hs.getMidPoint=function(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}};var Us="hasOwnProperty",Ys=/,?([a-z]),?/gi,Ks=parseFloat,Xs=Math,Zs=Xs.PI,Qs=Xs.min,Js=Xs.max,ec=Xs.pow,tc=Xs.abs,nc=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,ic=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function rc(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 oc(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[Us](n)&&(t[n]=oc(e[n]));return t}function ac(e){var t=ac.ps=ac.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[Us](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function sc(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:Xs.min(n,i)/2,r2:Xs.max(n,i)/2,r0:Xs.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=cc,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function cc(){return this.join(",").replace(Ys,"$1")}function pc(e){var t=oc(e);return t.toString=cc,t}function lc(e,t,n,i,r,o,a,s,c){var p=1-c,l=ec(p,3),u=ec(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*Xs.atan2(m-y,f-v)/Zs}}function uc(e,t,n,i,r,o,a,s){rc(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(0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,l=3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,l=3*i-3*t),tc(c)<1e-12){if(tc(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=Xs.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,E=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]=e,v[1][E]=t,v[0][E+1]=a,v[1][E+1]=s,v[0].length=v[1].length=E+2,{min:{x:Qs.apply(0,v[0]),y:Qs.apply(0,v[1])},max:{x:Js.apply(0,v[0]),y:Js.apply(0,v[1])}}}.apply(null,e);return sc(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function hc(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function dc(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 mc(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=c>1?1:c<0?0:c)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=dc(m,e,n,r,a),y=dc(m,t,i,o,s),v=f*f+y*y;h+=u[d]*Xs.sqrt(v)}return p*h}function fc(e,t,n,i,r,o,a,s){if(!(Js(e,n)<Qs(r,a)||Qs(e,n)>Js(r,a)||Js(t,i)<Qs(o,s)||Qs(t,i)>Js(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<+Qs(e,n).toFixed(2)||u>+Js(e,n).toFixed(2)||u<+Qs(r,a).toFixed(2)||u>+Js(r,a).toFixed(2)||h<+Qs(t,i).toFixed(2)||h>+Js(t,i).toFixed(2)||h<+Qs(o,s).toFixed(2)||h>+Js(o,s).toFixed(2)))return{x:p,y:l}}}}function yc(e,t,n){if(!function(e,t){return e=sc(e),hc(t=sc(t),e.x,e.y)||hc(t,e.x2,e.y)||hc(t,e.x,e.y2)||hc(t,e.x2,e.y2)||hc(e,t.x,t.y)||hc(e,t.x2,t.y)||hc(e,t.x,t.y2)||hc(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(uc(e),uc(t)))return n?0:[];for(var i=~~(mc.apply(0,e)/5),r=~~(mc.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<i+1;p++){var l=lc.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<r+1;p++)l=lc.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],m=a[u],f=a[u+1],y=tc(d.x-h.x)<.01?"y":"x",v=tc(f.x-m.x)<.01?"y":"x",g=fc(h.x,h.y,d.x,d.y,m.x,m.y,f.x,f.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+tc((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=m.t+tc((g[v]-m[v])/(f[v]-m[v]))*(f.t-m.t);b>=0&&b<=1&&x>=0&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function vc(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=cc,c}function gc(e){var t=ac(e);if(t.abs)return pc(t.abs);if(rc(e,"array")&&rc(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=ac(e);if(t.arr)return oc(t.arr);var n={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return rc(e,"array")&&rc(e[0],"array")&&(i=oc(e)),i.length||String(e).replace(nc,function(e,t,r){var o=[],a=t.toLowerCase();if(r.replace(ic,function(e,t){t&&o.push(+t)}),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L"),"o"==a&&1==o.length&&i.push([t,o[0]]),"r"==a)i.push([t].concat(o));else for(;o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););}),i.toString=ac.toString,t.arr=oc(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var 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(_c(m,u));break;case"O":i.pop(),(m=vc(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(vc(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(_c(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=vc(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(vc(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=cc,t.abs=pc(i),i}function bc(e,t,n,i){return[e,t,n,i,n,i]}function xc(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 Ec(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*Zs/180,f=Zs/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*Xs.cos(n)-t*Xs.sin(n),y:e*Xs.sin(n)+t*Xs.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[Us](n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),d?d(i[n]):i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t),d?d(i[n]):i[n])});if(p)C=p[0],A=p[1],S=p[2],T=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);x>1&&(n*=x=Xs.sqrt(x),i*=x);var E=n*n,_=i*i,w=(o==a?-1:1)*Xs.sqrt(tc((E*_-E*b*b-_*g*g)/(E*b*b+_*g*g))),S=w*n*b/i+(e+s)/2,T=w*-i*g/n+(t+c)/2,C=Xs.asin(((t-T)/i).toFixed(9)),A=Xs.asin(((c-T)/i).toFixed(9));(C=e<S?Zs-C:C)<0&&(C=2*Zs+C),(A=s<S?Zs-A:A)<0&&(A=2*Zs+A),a&&C>A&&(C-=2*Zs),!a&&A>C&&(A-=2*Zs)}var R=A-C;if(tc(R)>m){var P=A,M=s,k=c;A=C+m*(a&&A>C?1:-1),y=Ec(s=S+n*Xs.cos(A),c=T+i*Xs.sin(A),n,i,r,0,a,M,k,[A,P,S,T])}R=A-C;var B=Xs.cos(C),N=Xs.sin(C),D=Xs.cos(A),O=Xs.sin(A),L=Xs.tan(R/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*B],$=[s+I*O,c-j*D],G=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,G].concat(y);for(var W=[],H=0,V=(y=[F,$,G].concat(y).join().split(",")).length;H<V;H++)W[H]=H%2?v(y[H-1],y[H],f).y:v(y[H],y[H+1],f).x;return W}function _c(e,t){for(var n=[],i=0,r=e.length;r-2*!t>i;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function wc(e,t){var n=!t&&ac(e);if(!t&&n.curve)return pc(n.curve);for(var i=gc(e),r=t&&gc(t),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(Ec.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(xc(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(xc(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(bc(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(bc(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(bc(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(bc(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(e[t].length>7){e[t].shift();for(var n=e[t];n.length;)l[t]="A",r&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=Js(i.length,r&&r.length||0)}},p=function(e,t,n,o,a){e&&t&&"M"==e[a][0]&&"M"!=t[a][0]&&(t.splice(a,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[a][1],n.y=e[a][2],f=Js(i.length,r&&r.length||0))},l=[],u=[],h="",d="",m=0,f=Js(i.length,r&&r.length||0);m<f;m++){i[m]&&(h=i[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),i[m]=s(i[m],o,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(i,m),r&&(r[m]&&(h=r[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),r[m]=s(r[m],a,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(r,m)),p(i,r,o,a,m),p(r,i,a,o,m);var y=i[m],v=r&&r[m],g=y.length,b=r&&v.length;o.x=y[g-2],o.y=y[g-1],o.bx=Ks(y[g-4])||o.x,o.by=Ks(y[g-3])||o.y,a.bx=r&&(Ks(v[b-4])||a.x),a.by=r&&(Ks(v[b-3])||a.y),a.x=r&&v[b-2],a.y=r&&v[b-1]}return r||(n.curve=pc(i)),r?[i,r]:i}var Sc=function(e,t,n){e=wc(e),t=wc(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{"C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=yc(u,h,n);if(n)d+=x;else{for(var E=0,_=x.length;E<_;E++)x[E].segment1=m,x[E].segment2=v,x[E].bez1=u,x[E].bez2=h;d=d.concat(x)}}}}}return d},Tc={},Cc=l.isObject,Ac=l.sortBy,Rc=Hs.pointDistance;function Pc(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Mc(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function kc(e,t){return Sc(e,t)}Tc.roundBounds=function(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}},Tc.roundPoint=Pc,Tc.asTRBL=Mc,Tc.asBounds=function(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}},Tc.getMid=function(e){return Pc({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})},Tc.getOrientation=function(e,t,n){Cc(n=n||0)||(n={x:n,y:n});var i=Mc(e),r=Mc(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"},Tc.getElementLineIntersection=function(e,t,n){var i=kc(e,t);return 1===i.length?Pc(i[0]):2===i.length&&Rc(i[0],i[1])<1?Pc(i[0]):i.length>1?Pc((i=Ac(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};var Bc={},Nc=z.is,Dc=Tc.getMid,Oc=Tc.asTRBL,Lc=Tc.getOrientation,Ic=l.find,jc=l.reduce,zc=50,Fc=250,$c=10;function Gc(e,t){var n=Oc(e);function i(e){return Nc(e,"bpmn:SequenceFlow")}var r,o=jc([].concat(Yc(e,i).map((r=5,function(e){return{shape:e,weight:r,distanceTo:function(e){return Oc(e).left-n.right}}})),Uc(e,i).map(function(e){return function(t){return{shape:t,weight:e,distanceTo:function(e){var t=Oc(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),a=jc(o,function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||n>Fc?e:(i=(r=e[String(n)]=e[String(n)]||{value:n,count:0}).count+=1*a,(!c||c.count<i)&&(e.fav=r),e)},{});return a.fav?a.fav.value:zc}function Wc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e,t){var n=qc(e);return e.host&&(n=n.concat(qc(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(qc(t))},[]))),n}(e);return Ic(r,function(e){return e!==n&&"intersect"===Lc(e,i,$c)})}function Hc(e,t,n,i){function r(e){var r={x:n.x,y:n.y};return["x","y"].forEach(function(a){var s=i[a];if(s){var c="x"===a?"width":"height",p=s.margin,l=s.rowSize;r[a]=p<0?Math.min(e[a]+p-t[c]/2,n[a]-l+p):Math.max(o[a]+o[c]+p+t[c]/2,n[a]+l+p)}}),r}for(var o;o=Wc(e,n,t);)n=r(o);return n}function Vc(){return!0}function qc(e,t){return[].concat(Yc(e,t),Uc(e,t))}function Uc(e,t){return t||(t=Vc),e.incoming.filter(t).map(function(e){return e.source})}function Yc(e,t){return t||(t=Vc),e.outgoing.filter(t).map(function(e){return e.target})}Bc.getFlowNodePosition=function(e,t){var n=Oc(e),i=Dc(e),r=Gc(e,t),o="left",a=30;Nc(e,"bpmn:BoundaryEvent")&&"top"===(o=Lc(e,e.host,-25))&&(a*=-1);var s={left:0,right:0,top:-80,bottom:80};return Hc(e,t,{x:n.right+r+t.width/2,y:i.y+s[o]},{y:{margin:a,rowSize:80}})},Bc.getTextAnnotationPosition=function(e,t){var n=Oc(e);return Hc(e,t,{x:n.right+t.width/2,y:n.top-50-t.height/2},{y:{margin:-30,rowSize:20}})},Bc.getDataElementPosition=function(e,t){var n=Oc(e);return Hc(e,t,{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},{x:{margin:30,rowSize:30}})},Bc.getDefaultPosition=function(e,t){var n=Oc(e),i=Dc(e);return{x:n.right+zc+t.width/2,y:i.y}};var Kc={},Xc=l.some,Zc=z.is;function Qc(e,t){return Xc(t,function(t){return Zc(e,t)})}Kc.isAny=Qc,Kc.getParent=function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(Qc(e,t))return e;return null};var Jc=z.is,ep=Kc.isAny,tp=Bc.getTextAnnotationPosition,np=Bc.getDataElementPosition,ip=Bc.getFlowNodePosition,rp=Bc.getDefaultPosition;function op(e,t){function n(t,n){return e.fire(t,n)}this.append=function(e,i){var r=n("autoPlace",{source:e,shape:i});r||(r=function(e,t){if(Jc(t,"bpmn:TextAnnotation"))return tp(e,t);if(ep(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return np(e,t);if(Jc(t,"bpmn:FlowNode"))return ip(e,t);return rp(e,t)}(e,i));var o=t.appendShape(e,i,r,e.parent);return n("autoPlace.end",{shape:o}),o}}op.$inject=["eventBus","modeling"];var ap=op;function sp(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}sp.$inject=["eventBus","selection"];var cp={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ap],autoPlaceSelectionBehavior:["type",sp]},pp=l.forEach,lp=l.isFunction,up=l.isArray,hp=l.isNumber;function dp(e){this._eventBus=e}dp.$inject=["eventBus"];var mp=dp;dp.prototype.on=function(e,t,n,i,r,o){if((lp(t)||hp(t))&&(o=r,r=i,i=n,n=t,t=null),lp(n)&&(o=r,r=i,i=n,n=1e3),"object"==typeof r&&(o=r,r=!1),!lp(i))throw new Error("handlerFn must be a function");up(e)||(e=[e]);var a=this._eventBus;pp(e,function(e){var s=["commandStack",e,t].filter(function(e){return e}).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)})};pp(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(e){dp.prototype[e]=function(t,n,i,r,o){(lp(t)||hp(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}});var fp=lr.getBBox,yp=Tc.asTRBL,vp=Tc.asBounds,gp=l.assign,bp=l.flatten,xp=l.forEach,Ep=l.values,_p=l.groupBy;function wp(e,t,n,i){mp.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,o=t.parent||t.newParent;n&&!1===n.root||r._expand([i],o)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=bp(Ep(t.closure.topLevel)),i=t.hints;if(!i||!1!==i.autoResize){var o=_p(n,function(e){return e.parent.id});xp(o,function(e,t){r._expand(e,t)})}})}wp.$inject=["eventBus","elementRegistry","modeling","rules"],we(wp,mp);var Sp=wp;wp.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=yp(fp(e)),o=yp(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),vp(gp({},o,a))},wp.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){this.resize(t,n);var i=t.parent;i&&this._expand([t],i)}}},wp.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},wp.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},wp.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)};var Tp=z.is;function Cp(e,t,n,i){Sp.call(this,e,t,n,i)}Cp.$inject=["eventBus","elementRegistry","modeling","rules"],we(Cp,Sp);var Ap=Cp;function Rp(e){mp.call(this,e),this.init()}Cp.prototype.resize=function(e,t){Tp(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},Rp.$inject=["eventBus"],we(Rp,mp);var Pp=Rp;function Mp(e){Pp.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}Rp.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){i.canExecute(e,t,function(e,t,i){return n(e)},!0)})},Rp.prototype.init=function(){},Mp.$inject=["eventBus"],we(Mp,Pp);var kp=Mp;Mp.prototype.canResize=function(e,t){return!1};var Bp=z.is,Np=l.forEach;function Dp(e,t){kp.call(this,e),this._modeling=t}we(Dp,kp),Dp.$inject=["eventBus","modeling"];var Op=Dp;Dp.prototype.canResize=function(e,t){if(!Bp(t,"bpmn:Participant")&&!Bp(t,"bpmn:Lane")&&!Bp(t,"bpmn:SubProcess"))return!1;var n=!0;return Np(e,function(e){(Bp(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Lp={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Ap],bpmnAutoResizeProvider:["type",Op]},Ip={},jp=l.filter,zp=Math.max,Fp=Math.min,$p=20,Gp=lr.getBBox,Wp=Tc.asTRBL,Hp=Tc.asBounds;function Vp(e){return"number"==typeof e}function qp(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Vp(r)&&(i=(/top|left/.test(e)?Fp:zp)(i,r)),Vp(o)&&(i=(/top|left/.test(e)?zp:Fp)(i,o)),i}function Up(e,t){return void 0!==e?e:$p}function Yp(e,t){var n,i,r,o;return"object"==typeof t?(n=Up(t.left),i=Up(t.right),r=Up(t.top),o=Up(t.bottom)):n=i=r=o=Up(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Kp(e){return!e.waypoints&&"label"!==e.type}Ip.substractTRBL=function(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}},Ip.resizeBounds=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)}},Ip.resizeTRBL=function(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}},Ip.ensureConstraints=function(e,t){if(!t)return e;var n=Wp(e);return Hp({top:qp("top",n,t),right:qp("right",n,t),bottom:qp("bottom",n,t),left:qp("left",n,t)})},Ip.getMinResizeBounds=function(e,t,n,i){var r=Wp(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Wp(i):o,s={top:Fp(o.top,a.top),left:Fp(o.left,a.left),bottom:zp(o.bottom,a.bottom),right:zp(o.right,a.right)};return Hp(s)},Ip.computeChildrenBBox=function(e,t){var n;if((n=void 0===e.length?jp(e.children,Kp):e).length)return Yp(Gp(n),t)};var Xp={},Zp=z.is,Qp=Kc.getParent,Jp=Tc.asTRBL,el=Ip.substractTRBL,tl=Ip.resizeTRBL,nl=Math.abs;var il=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function rl(e,t){return t=t||[],e.children.filter(function(e){Zp(e,"bpmn:Lane")&&(rl(e,t),t.push(e))}),t}function ol(e){return Qp(e,il)||e}Xp.LANE_INDENTATION=30,Xp.collectLanes=rl,Xp.getChildLanes=function(e){return e.children.filter(function(e){return Zp(e,"bpmn:Lane")})},Xp.getLanesRoot=ol,Xp.computeLanesResize=function(e,t){var n=ol(e),i=rl(n,Zp(n,"bpmn:Process")?[]:[n]),r=Jp(e),o=Jp(t),a=function(e,t){return el(Jp(t),Jp(e))}(e,t),s=[];return i.forEach(function(t){if(t!==e){var n=0,i=a.right,c=0,p=a.left,l=Jp(t);a.top&&(nl(l.bottom-r.top)<10&&(c=o.top-l.bottom),nl(l.top-r.top)<5&&(n=o.top-l.top)),a.bottom&&(nl(l.top-r.bottom)<10&&(n=o.bottom-l.top),nl(l.bottom-r.bottom)<5&&(c=o.bottom-l.bottom)),(n||i||c||p)&&s.push({shape:t,newBounds:tl(t,{top:n,right:i,bottom:c,left:p})})}}),s};var al=l.assign,sl=l.forEach,cl=l.isArray,pl=z.is,ll=$.isExpanded,ul=Kc.isAny,hl=Xp.getChildLanes,dl=$.isEventSubProcess,ml=ga.hasPrimaryModifier;function fl(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(ml(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}fl.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"];var yl=fl;function vl(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return sl(o,function(e){e.$type===n&&(r=!0)}),i&&r}fl.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,c=this._rules,p=this._autoPlace,l=this._translate,u={};if("label"===e.type)return u;var h,d=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function a(t,n){var a=i.createShape(al({type:e},r));o.start(t,a,n)}return"string"!=typeof n&&(r=n,n=l("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:p?function(t,n){var o=i.createShape(al({type:e},r));p.append(n,o)}:a}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(ul(d,["bpmn:Lane","bpmn:Participant"])&&ll(d)){var v=hl(e);al(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&(e.height>=120&&al(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&al(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three Lanes"),action:{click:y(3)}}})),al(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}pl(d,"bpmn:FlowNode")&&(pl(d,"bpmn:EventBasedGateway")?al(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):vl(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?al(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):pl(d,"bpmn:EndEvent")||d.isForCompensation||vl(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||dl(d)||al(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":f("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")})),a._providers["bpmn-replace"]&&(h=a.create("bpmn-replace",e)),h&&!h.isEmpty()&&al(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,n){h.open(al(function(e){var n=s.getContainer(),i=t.getPad(e).html,r=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=o.top-r.top;return{x:o.left-r.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}}),n)}}}}),ul(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&al(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using "+(d.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:m,dragstart:m}}}),ul(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&al(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}});var g=c.allowed("elements.delete",{elements:[e]});return cl(g)&&(g=g[0]===e),g&&al(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var gl={},bl=z.getBusinessObject,xl=$.isExpanded;gl.isDifferentType=function(e){return function(t){var n=t.target,i=bl(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=i.triggeredByEvent===n.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===xl(i);return!(o&&a&&s&&c)}};var El={START_EVENT:[{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"}}],INTERMEDIATE_EVENT:[{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"}}],END_EVENT:[{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"}}],GATEWAY:[{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"}}],SUBPROCESS_EXPANDED:[{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}}],TRANSACTION:[{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}}],EVENT_SUB_PROCESS:[{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}}],TASK:[{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}}],BOUNDARY_EVENT:[{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}}],EVENT_SUB_PROCESS_START_EVENT:[{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}}],SEQUENCE_FLOW:[{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"}],PARTICIPANT:[{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}}]},_l=z.is,wl=$.isEventSubProcess,Sl=z.getBusinessObject,Tl=$.isExpanded,Cl=gl.isDifferentType,Al=l.forEach,Rl=l.filter;function Pl(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()}Pl.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Pl.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Pl.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var i=Cl(e);return _l(n,"bpmn:StartEvent")&&!wl(n.$parent)?(t=Rl(El.START_EVENT,i),this._createEntries(e,t)):_l(n,"bpmn:Participant")?(t=Rl(El.PARTICIPANT,function(e){return Tl(n)!==e.target.isExpanded}),this._createEntries(e,t)):_l(n,"bpmn:StartEvent")&&wl(n.$parent)?(t=Rl(El.EVENT_SUB_PROCESS_START_EVENT,function(t){var n=!1!==t.target.isInterrupting,r=Sl(e).isInterrupting===n;return i(t)||!i(t)&&!r}),this._createEntries(e,t)):_l(n,"bpmn:EndEvent")?(t=Rl(El.END_EVENT,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!_l(n.$parent,"bpmn:Transaction"))&&i(e)}),this._createEntries(e,t)):_l(n,"bpmn:BoundaryEvent")?(t=Rl(El.BOUNDARY_EVENT,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!_l(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,o=n.cancelActivity==r;return i(e)||!i(e)&&!o}),this._createEntries(e,t)):_l(n,"bpmn:IntermediateCatchEvent")||_l(n,"bpmn:IntermediateThrowEvent")?(t=Rl(El.INTERMEDIATE_EVENT,i),this._createEntries(e,t)):_l(n,"bpmn:Gateway")?(t=Rl(El.GATEWAY,i),this._createEntries(e,t)):_l(n,"bpmn:Transaction")?(t=Rl(El.TRANSACTION,i),this._createEntries(e,t)):wl(n)&&Tl(n)?(t=Rl(El.EVENT_SUB_PROCESS,i),this._createEntries(e,t)):_l(n,"bpmn:SubProcess")&&Tl(n)?(t=Rl(El.SUBPROCESS_EXPANDED,i),this._createEntries(e,t)):_l(n,"bpmn:AdHocSubProcess")&&!Tl(n)?(t=Rl(El.TASK,function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return Cl(e,n)&&(!i||r)}),this._createEntries(e,t)):_l(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,El.SEQUENCE_FLOW):_l(n,"bpmn:FlowNode")?(t=Rl(El.TASK,i),_l(n,"bpmn:SubProcess")&&!Tl(n)&&(t=Rl(t,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(e,t)):[]},Pl.prototype.getHeaderEntries=function(e){var t=[];return _l(e,"bpmn:Activity")&&!wl(e)&&(t=t.concat(this._getLoopEntries(e))),!_l(e,"bpmn:SubProcess")||_l(e,"bpmn:Transaction")||wl(e)||t.push(this._getAdHocEntry(e)),t},Pl.prototype._createEntries=function(e,t){var n=[],i=this;return Al(t,function(t){var r=i._createMenuEntry(t,e);n.push(r)}),n},Pl.prototype._createSequenceFlowEntries=function(e,t){var n=Sl(e),i=[],r=this._modeling,o=this._moddle,a=this;return Al(t,function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(_l(n.sourceRef,"bpmn:ExclusiveGateway")||_l(n.sourceRef,"bpmn:InclusiveGateway")||_l(n.sourceRef,"bpmn:ComplexGateway")||_l(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&_l(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}));break;default:if(_l(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e,{conditionExpression:void 0})}));if((_l(n.sourceRef,"bpmn:ExclusiveGateway")||_l(n.sourceRef,"bpmn:InclusiveGateway")||_l(n.sourceRef,"bpmn:ComplexGateway")||_l(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:void 0})}))}}),i},Pl.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}},Pl.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r;i.active?r=void 0:(r=t._moddle.create(i.options.loopCharacteristics),i.options.isSequential&&(r.isSequential=i.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=Sl(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Pl.prototype._getAdHocEntry=function(e){var t=this._translate,n=Sl(e),i=_l(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(t,n){return r(e,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var Ml=Pl,kl={},Bl=l.forEach;kl.IGNORED_PROPERTIES=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"],kl.getProperties=function(e,t){var n=[];return Bl(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n};var Nl=l.forEach,Dl=l.filter,Ol=l.some,Ll=l.sortBy,Il=l.isArray,jl=kl.IGNORED_PROPERTIES;function zl(e,t){this._eventBus=e,this._bpmnFactory=t}var Fl=zl;zl.prototype.clone=function(e,t,n){var i=this,r={newElement:t,hasNestedProperty:!1};return n=Ll(n,function(e){return"bpmn:extensionElements"===e}),Nl(n,function(n){var o,a,s,c=e.get(n),p=t.get(n),l=t.$model.getPropertyDescriptor(t,n);p!==c&&(l&&(l.isId||l.isReference)||(s=c,Ol(["boolean","string","number"],function(e){return typeof s===e})||null===c?t.set(n,c):Il(c)?Nl(c,function(e){var n;r.refTopLevelProperty=e,n=i._deepClone(e,r),r.hasNestedProperty&&(n.$parent=t,p.push(n)),r.hasNestedProperty=!1}):(a=n.replace(/bpmn:/,""),r.refTopLevelProperty=c,o=i._deepClone(c,r),r.hasNestedProperty&&(t[a]=o),r.hasNestedProperty=!1)))}),t},zl.prototype._deepClone=function(e,t){var n=this,i=this._eventBus,r=this._bpmnFactory.create(e.$type),o=Dl(Object.keys(e),function(e){var t=r.$model.getPropertyDescriptor(r,e);return(!t||!t.isId&&!t.isReference)&&(-1===jl.indexOf(e)&&"$type"!==e)});return o.length||(t.hasNestedProperty=!0),Nl(o,function(o){void 0!==e[o]&&(e[o].$type||Il(e[o]))?Il(e[o])?(r[o]=[],Nl(e[o],function(a){var s,c=e.$model.getTypeDescriptor(a.$type);if(c){if(!i.fire("property.clone",{newElement:t.newElement,refTopLevelProperty:t.refTopLevelProperty,propertyDescriptor:c})&&"bpmn:ExtensionElements"===e.$type&&c.meta&&c.meta.allowedIn&&!function(e,t){var n=e.meta.allowedIn;return 1===n.length&&"*"===n[0]||-1!==n.indexOf(t)}(c,t.newElement.$type))return!1;(s=n._deepClone(a,t)).$parent=r,r[o]||(r[o]=[]),t.hasNestedProperty=!0,r[o].push(s)}})):e[o].$type&&(r[o]=n._deepClone(e[o],t),r[o]&&(t.hasNestedProperty=!0,r[o].$parent=r)):(t.hasNestedProperty=!0,r[o]=e[o])}),r};var $l=l.pick,Gl=l.assign,Wl=l.uniqueBy,Hl=l.findIndex,Vl=l.filter,ql=l.has,Ul=z.is,Yl=Kc.isAny,Kl=$.isExpanded,Xl=$.isEventSubProcess,Zl=kl.getProperties,Ql=kl.IGNORED_PROPERTIES,Jl=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function eu(e,t,n,i,r){var o=new Fl(r,e);this.replaceElement=function(r,a,s){s=s||{};var c=a.type,p=r.businessObject;if(nu(p)&&"bpmn:SubProcess"===c&&function(e,t){var n=e&&ql(e,"collapsed")?e.collapsed:!Kl(e);return n!==(t&&(ql(t,"collapsed")||ql(t,"isExpanded"))?ql(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(r,a))return i.toggleCollapse(r),r;var l=e.create(c),u={type:c,businessObject:l},h=Zl(p.$descriptor),d=Zl(l.$descriptor,!0),m=Wl(function(e){return e},Vl(h,function(e){return-1!==Hl(d,e)}));return Gl(l,$l(a,Jl)),m=Vl(m,function(e){var t=e.replace(/bpmn:/,"");return void 0===l[e]&&("loopCharacteristics"===t?!Xl(l):("processRef"!==t||!1!==a.isExpanded)&&"triggeredByEvent"!==t&&"eventDefinitions"!==t&&-1===Ql.indexOf(t))}),l=o.clone(p,l,m),a.eventDefinitionType&&(u.eventDefinitionType=a.eventDefinitionType),Ul(p,"bpmn:Activity")&&(nu(p)?u.isExpanded=Kl(p):a&&ql(a,"isExpanded")&&(u.isExpanded=a.isExpanded),Kl(p)&&!Ul(p,"bpmn:Task")&&u.isExpanded&&(u.width=r.width,u.height=r.height)),nu(p)&&!nu(l)&&(s.moveChildren=!1),Ul(p,"bpmn:Participant")&&(!0===a.isExpanded?l.processRef=e.create("bpmn:Process"):s.moveChildren=!1,u.width=r.width,u.height=r.height),l.name=p.name,Yl(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Yl(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(l.default=p.default),("fill"in p.di||"stroke"in p.di)&&Gl(u,{colors:$l(p.di,["fill","stroke"])}),u=t.replaceElement(r,u,s),!1!==s.select&&n.select(u),u}}eu.$inject=["bpmnFactory","replace","selection","modeling","eventBus"];var tu=eu;function nu(e){return Ul(e,"bpmn:SubProcess")}function iu(e){this._modeling=e}var ru=iu;iu.$inject=["modeling"],iu.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Math.ceil(e.x+(t.width||e.width)/2),t.y=Math.ceil(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var ou={__depends__:[{__init__:["replace"],replace:["type",ru]},Xa],bpmnReplace:["type",tu]},au=l.forEach,su=l.assign,cu=l.find,pu=l.matchPattern,lu=Se.delegate,uu=Se.domify,hu=Se.classes,du=Se.attr,mu=Se.remove;function fu(e,t){this._eventBus=e,this._canvas=t,this._providers={}}fu.$inject=["eventBus","canvas"],fu.prototype.registerProvider=function(e,t){this._providers[e]=t},fu.prototype.create=function(e,t){var n=this._providers[e];if(!n)throw new Error("Provider is not registered: "+e);if(!t)throw new Error("Element is missing");var i=this._current={provider:n,className:e,element:t};return n.getHeaderEntries&&(i.headerEntries=n.getHeaderEntries(t)),i.entries=n.getEntries(t),this},fu.prototype.isEmpty=function(){var e=this._current;return 0===e.entries.length&&e.headerEntries&&0===e.headerEntries.length},fu.prototype.open=function(e){if(!e)throw new Error("the position argument is missing");this.isOpen()&&this.close();var t=this._current,n=this._canvas.getContainer();t.position=e,t.container=this._createContainer();var i=t.headerEntries||[],r=t.entries||[];return i.length&&t.container.appendChild(this._createEntries(t.headerEntries,"djs-popup-header")),r.length&&t.container.appendChild(this._createEntries(t.entries,"djs-popup-body")),this._attachContainer(t.container,n,e.cursor),this},fu.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),mu(this._current.container),this._current.container=null)},fu.prototype.isOpen=function(){return!!this._current.container},fu.prototype.trigger=function(e){e.preventDefault();var t=e.delegateTarget||e.target,n=du(t,"data-id"),i=this._getEntry(n);if(i.action)return i.action.call(null,e,i)},fu.prototype._getEntry=function(e){var t=pu({id:e}),n=cu(this._current.entries,t)||cu(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},fu.prototype._createContainer=function(){var e=uu('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return su(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),hu(e).add(n),e},fu.prototype._attachContainer=function(e,t,n){var i=this;lu.bind(e,".entry","click",function(e){i.trigger(e)});var r=this._canvas.zoom();e.style.transformOrigin="top left",e.style.transform="scale("+r+")",t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},fu.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"),su(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},fu.prototype._createEntries=function(e,t){var n=uu("<div>"),i=this;return hu(n).add(t),au(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},fu.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=uu("<div>"),n=hu(t);if(n.add("entry"),e.className&&n.add(e.className),du(t,"data-id",e.id),e.label){var i=uu("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(uu('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},fu.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)},fu.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 yu={__depends__:[{__init__:["popupMenu"],popupMenu:["type",fu]},ou],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Ml]},vu=l.assign,gu=l.bind,bu=l.pick,xu=Se.domify,Eu=Se.query,_u=Se.event,wu=Se.remove,Su=Math.min,Tu=Math.max;function Cu(e){e.preventDefault()}function Au(e){e.stopPropagation()}function Ru(e){this.container=e.container,this.parent=xu('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Eu("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=gu(this.autoResize,this),this.handlePaste=gu(this.handlePaste,this)}var Pu=Ru;Ru.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{},t=this.style=t||{};var s=bu(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);vu(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",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=bu(t,["fontSize","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return vu(o.style,{boxSizing:"border-box",width:"100%",outline:"none"},c),i.centerVertically&&vu(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,_u.bind(o,"keydown",this.keyHandler),_u.bind(o,"mousedown",Au),_u.bind(o,"paste",this.handlePaste),i.autoResize&&_u.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Ru.prototype.handlePaste=function(e){var t,n,i=this,r=this.options,o=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,t)){var a,s,c=this.getSelection(),p=c.startContainer,l=c.endContainer,u=c.startOffset,h=c.endOffset,d=c.commonAncestorContainer,m=(n=d.childNodes,[].slice.call(n));if(d.nodeType===Node.TEXT_NODE){var f=p.textContent;p.textContent=f.substring(0,u)+t+f.substring(h),a=p,s=u+t.length}else if(p===this.content&&l===this.content){var y=document.createTextNode(t);this.content.insertBefore(y,m[u]),a=y,s=y.textContent.length}else{var v=m.indexOf(p),g=m.indexOf(l);m.forEach(function(e,n){n===v?e.textContent=p.textContent.substring(0,u)+t+l.textContent.substring(h):n>v&&n<=g&&wu(e)}),a=p,s=u+t.length}a&&void 0!==s&&setTimeout(function(){i.setSelection(a,s)})}if(r.autoResize){var b=this.autoResize(o);b&&this.resizeHandler(b)}},Ru.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})}},Ru.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=xu('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Cu(n),Au(n);var u=Su(Tu(p+n.clientX-s,i),o),h=Su(Tu(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Cu(e),Au(e),_u.unbind(document,"mousemove",u,!1),_u.unbind(document,"mouseup",h,!1)};_u.bind(n,"mousedown",function(e){Cu(e),Au(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,_u.bind(document,"mousemove",u),_u.bind(document,"mouseup",h)})}vu(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Ru.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),_u.unbind(t,"keydown",this.keyHandler),_u.unbind(t,"mousedown",Au),_u.unbind(t,"input",this.autoResize),_u.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),wu(n)),wu(e)},Ru.prototype.getValue=function(){return this.content.innerText},Ru.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Ru.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)};var Mu=l.bind,ku=l.find;function Bu(e,t){this._eventBus=e,this._providers=[],this._textbox=new Pu({container:t.getContainer(),keyHandler:Mu(this._handleKey,this),resizeHandler:Mu(this._handleResize,this)})}Bu.$inject=["eventBus","canvas"],Bu.prototype.registerProvider=function(e){this._providers.push(e)},Bu.prototype.isActive=function(){return!!this._active},Bu.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Bu.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Bu.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Bu.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()}},Bu.prototype.getValue=function(){return this._textbox.getValue()},Bu.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())},Bu.prototype._handleResize=function(e){this._fire("resize",e)},Bu.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=ku(this._providers,function(n){return(t=n.activate(e))?n:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Nu={__depends__:[ka],__init__:["directEditing"],directEditing:["type",Bu]},Du=Tc.getElementLineIntersection,Ou=Tc.getMid,Lu="connect-ok",Iu="connect-not-ok";function ju(t,n,i,r,o,a){function c(e,t){return r.allowed("connection.create",{source:e,target:t})}t.on("connect.move",function(t){var n,i=t.context,r=i.source,o=i.target,s=i.visual;n=function(e,t,n,i){var r=a.getShapePath(n),o=i&&a.getShapePath(i),s=a.getConnectionPath({waypoints:[e,t]});return[e=Du(r,s,!0)||e,t=i&&Du(o,s,!1)||t]}(i.sourcePosition,{x:t.x,y:t.y},r,o),e(s,{points:[n[0].x,n[0].y,n[1].x,n[1].y]})}),t.on("connect.hover",function(e){var t,n=e.context,i=n.source,r=e.hover;null!==(t=n.canExecute=c(i,r))&&(n.target=r,o.addMarker(r,t?Lu:Iu))}),t.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&o.removeMarker(t.target,t.canExecute?Lu:Iu),t.target=null,t.canExecute=!1}),t.on("connect.cleanup",function(e){var t=e.context;t.visual&&oe(t.visual)}),t.on("connect.start",function(t){var n,i=t.context;n=s("polyline"),e(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),re(o.getDefaultLayer(),n),i.visual=n}),t.on("connect.end",function(e){var t=e.context,n=t.source,r=t.sourcePosition,o=t.target,a={x:e.x,y:e.y},s=t.canExecute||c(n,o);if(!s)return!1;var p=null,l={connectionStart:r,connectionEnd:a};"object"==typeof s&&(p=s),i.connect(n,o,p,l)}),this.start=function(e,t,i,r){"object"!=typeof i&&(r=i,i=Ou(t)),n.init(e,"connect",{autoActivate:r,data:{shape:t,context:{source:t,sourcePosition:i}}})}}ju.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var zu=ju,Fu=Math.round,$u=l.assign,Gu=Se.event,Wu=Jr.Event,Hu="djs-drag-active";function Vu(e){e.preventDefault()}function qu(e){ma.stopPropagation(e)}function Uu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Yu(e,t,n){var i,r={threshold:5,trapClick:!0};function o(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+Fu((e.x-i.left)/n.scale),y:n.y+Fu((e.y-i.top)/n.scale)}}function a(t,n){n=n||i;var r=$u(new Wu,n.payload,n.data,{isTouch:n.isTouch});return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function s(e,r){var s,c=i.payload,p=i.displacement,l=i.globalStart,u=ma.toPoint(e),h=Uu(u,l),d=i.localStart,f=o(u),y=Uu(f,d);if(!i.active&&(r||(s=h,Math.sqrt(Math.pow(s.x,2)+Math.pow(s.y,2))>i.threshold))){if($u(c,{x:d.x+p.x,y:d.y+p.y,dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(c.previousSelection=n.get(),n.select(null)),i.cursor&&gs.set(i.cursor),t.addMarker(t.getRootElement(),Hu)}qu(e),i.active&&($u(c,{x:f.x+p.x,y:f.y+p.y,dx:y.x,dy:y.y},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,qu(e)),t=a("end")),!1===t&&a("rejected"),a("ended",f(!0!==t))}function p(e){27===e.which&&(e.preventDefault(),m())}function l(t){var n;i.active&&(n=ys.install(e),setTimeout(n,400)),c(t)}function u(e){s(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=f(e),n&&a("canceled",t)}}function f(r){var o,f;a("cleanup"),gs.unset(),f=i.trapClick?l:c,Gu.unbind(document,"mousemove",s),Gu.unbind(document,"dragstart",Vu),Gu.unbind(document,"selectstart",Vu),Gu.unbind(document,"mousedown",f,!0),Gu.unbind(document,"mouseup",f,!0),Gu.unbind(document,"keyup",p),Gu.unbind(document,"touchstart",u,!0),Gu.unbind(document,"touchcancel",m,!0),Gu.unbind(document,"touchmove",s,!0),Gu.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",d),t.removeMarker(t.getRootElement(),Hu);var y=i.payload.previousSelection;return!1!==r&&y&&!n.get().length&&n.select(y),o=i,i=null,o}e.on("diagram.destroy",m),this.init=function(t,n,f,y){i&&m(!1),"string"==typeof n&&(y=f,f=n,n=null);var v,g,b,x,E,_=(y=$u({},r,y||{})).data||{};x=y.trapClick?l:c,t?(v=ma.getOriginal(t)||t,g=ma.toPoint(t),qu(t),"dragstart"===v.type&&Vu(v)):(v=null,g={x:0,y:0}),b=o(g),n||(n=b),E=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),i=$u({prefix:f,data:_,payload:{},globalStart:g,displacement:Uu(n,b),localStart:b,isTouch:E},y),y.manual||(E?(Gu.bind(document,"touchstart",u,!0),Gu.bind(document,"touchcancel",m,!0),Gu.bind(document,"touchmove",s,!0),Gu.bind(document,"touchend",c,!0)):(Gu.bind(document,"mousemove",s),Gu.bind(document,"dragstart",Vu),Gu.bind(document,"selectstart",Vu),Gu.bind(document,"mousedown",x,!0),Gu.bind(document,"mouseup",x,!0)),Gu.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",d)),a("init"),y.autoActivate&&s(t,!0)},this.move=s,this.hover=h,this.out=d,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){$u(r,e)}}Yu.$inject=["eventBus","canvas","selection"];var Ku=Yu,Xu=Se.closest;function Zu(e,t,n){var i=this;e.on("drag.start",function(t){e.once("drag.move",function(){e.once("drag.move",function(e){i.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var i,r,o,a=e.originalEvent;a instanceof MouseEvent&&(i=ma.toPoint(a),(o=function(e){return Xu(e,"svg, .djs-element",!0)}(document.elementFromPoint(i.x,i.y)))&&(r=n.get(o),t.hover({element:r,gfx:o})))}}}Zu.$inject=["eventBus","dragging","elementRegistry"];var Qu={__init__:["hoverFix"],__depends__:[Xa],dragging:["type",Ku],hoverFix:["type",Zu]};function Ju(e){this._commandStack=e.get("commandStack",!1)}Ju.$inject=["injector"];var eh=Ju;Ju.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var th={__init__:["rules"],rules:["type",eh]},nh={__depends__:[Xa,th,Qu],connect:["type",zu]},ih=l.isFunction,rh=l.isArray,oh=l.forEach,ah=Se.delegate,sh=Se.event,ch=Se.attr,ph=Se.query,lh=Se.classes,uh=Se.domify;function hh(e,t){this._providers=[],this._eventBus=e,this._overlays=t,this._current=null,this._init()}hh.$inject=["eventBus","overlays"];var dh=hh;hh.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()}),e.on("elements.delete",function(e){var n=e.elements;oh(n,function(e){t.isOpen(e)&&t.close()})}),e.on("element.changed",function(e){var n=e.element,i=t._current;i&&i.element===n&&t.open(n,!0)})},hh.prototype.registerProvider=function(e){this._providers.push(e)},hh.prototype.getEntries=function(e){var t={};return oh(this._providers,function(n){var i=n.getContextPadEntries(e);oh(i,function(e,n){t[n]=e})}),t},hh.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[ch(s,"data-action")].action,r=t.originalEvent||t,ih(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},hh.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},hh.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html;oh(t,function(e,t){var n,r,o,a,s=e.group||"default",c=uh(e.html||'<div class="entry" draggable="true"></div>');ch(c,"data-action",t),(n=ph("[data-group="+s+"]",i))||(n=uh('<div class="group" data-group="'+s+'"></div>'),i.appendChild(n)),n.appendChild(c),e.className&&(r=c,o=e.className,a=lh(r),(rh(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.title&&ch(c,"title",e.title),e.imageUrl&&c.appendChild(uh('<img src="'+e.imageUrl+'">'))}),lh(i).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},hh.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=uh('<div class="djs-context-pad"></div>');ah.bind(i,".entry","click",function(e){t.trigger("click",e)}),ah.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),sh.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",{position:{right:-9,top:-6},html:i});var r=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:r}),r},hh.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},hh.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var mh={__depends__:[ka,da],contextPad:["type",dh]},fh=750,yh="drop-ok",vh="drop-not-ok",gh="attach-ok",bh="new-parent",xh=ee.translate;function Eh(t,n,i,r,o,a,c){function p(e,t){[gh,yh,vh,bh].forEach(function(n){n===t?o.addMarker(e,n):o.removeMarker(e,n)})}t.on("create.move",function(e){var t,n=e.context,r=e.hover,o=n.shape,a=n.source,s={x:e.x,y:e.y};t=n.canExecute=r&&function(e,t,n,r){if(!t)return!1;var o,a,s,c={source:n,shape:e,target:t,position:r};return(a=i.allowed("shape.attach",c))||(o=i.allowed("shape.create",c)),(o||a)&&(s=n&&i.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:a}})),!(!o&&!a)&&{attach:a,connect:s}}(o,r,a,s),r&&null!==t&&(n.target=r,t&&t.attach?p(r,gh):p(r,t?bh:vh))}),t.on("create.move",fh,function(t){var n=t.context,i=n.shape,r=n.visual;r||(r=n.visual=function(t){var n,i,r;n=s("g"),e(n,a.cls("djs-drag-group",["no-events"])),re(o.getDefaultLayer(),n),i=s("g"),Ue(i).add("djs-dragger"),re(n,i),xh(i,t.width/-2,t.height/-2);var p=s("g");return Ue(p).add("djs-visual"),re(i,p),r=p,c.drawShape(r,t),n}(i)),xh(r,t.x,t.y)}),t.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&p(t,null)}),t.on("create.end",function(e){var t=e.context,n=t.source,i=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect,p={x:e.x,y:e.y};if(!a)return!1;i=c?r.appendShape(n,i,p,o,{attach:s,connection:!0===c?{}:c}):r.createShape(i,p,o,{attach:s}),t.shape=i}),t.on("create.cleanup",function(e){var t=e.context;t.visual&&oe(t.visual)}),this.start=function(e,t,i){n.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:{shape:t,source:i}}})}}Eh.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var _h={__depends__:[Qu,Xa,th],create:["type",Eh]},wh={__depends__:[Nu,mh,Xa,nh,_h,yu],__init__:["contextPadProvider"],contextPadProvider:["type",yl]},Sh=z.getBusinessObject,Th=z.is,Ch=kl.getProperties,Ah=kl.IGNORED_PROPERTIES,Rh=l.filter,Ph=l.forEach;function Mh(e,t,n){Ph(n,function(n){void 0!==t[n]&&(e[n]=t[n])})}function kh(e,t,n,i,r,o){var a=new Fl(t,e);n.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Sh(e),i={};return t.type=e.type,Mh(t,n.di,["isExpanded"]),Mh(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type?t:(Mh(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id),t)}),t.on("element.paste",function(t){var n,i,s,c,p=t.descriptor,l=t.createdElements,u=p.parent,h=r.getRootElement(),d=p.oldBusinessObject;n=e.create(d.$type);var m=Ch(d.$descriptor);m=Rh(m,function(e){return-1===Ah.indexOf(e.replace(/bpmn:/,""))}),p.businessObject=a.clone(d,n,m),"label"!==p.type&&(Th(u,"bpmn:Process")&&(p.parent=Th(h,"bpmn:Collaboration")?h:u),"bpmn:DataOutputAssociation"!==p.type&&"bpmn:DataInputAssociation"!==p.type&&"bpmn:MessageFlow"!==p.type||(p.parent=h),Th(u,"bpmn:Lane")&&(p.parent=u.parent),p.waypoints&&(i=l[p.source],s=l[p.target],i&&s&&(i=i.element,s=s.element),(c=o.canConnect(i,s))&&(p.type=c.type)),delete n.id,e._ensureId(n),"bpmn:Participant"===p.type&&p.processRef&&(p.processRef=n.processRef=e.create("bpmn:Process")),Mh(n,p,["isExpanded","triggeredByEvent"]),function(e,t){Ph(t,function(t){e[t]&&delete e[t]})}(p,["triggeredByEvent"]))})}kh.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Bh=kh;function Nh(){}var Dh=Nh;Nh.prototype.get=function(){return this._data},Nh.prototype.set=function(e){this._data=e},Nh.prototype.clear=function(){var e=this._data;return delete this._data,e},Nh.prototype.isEmpty=function(){return!this._data};var Oh={clipboard:["type",Dh]},Lh={},Ih=l.forEach;Lh.getTopLevel=function(e){var t={},n=[],i=[],r=[];return Ih(e,function(e){var i=e.parent;t[i.id]||(t[i.id]=[]),-1===n.indexOf(i.id)&&n.push(i.id),t[i.id].push(e)}),Ih(n,function(e){Ih(t[e],function(e){t[e.id]&&r.push(e.id)})}),Ih(n,function(e){-1===r.indexOf(e)&&(i=i.concat(t[e]))}),i};var jh={};jh.center=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},jh.delta=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var zh=l.isArray,Fh=l.forEach,$h=l.map,Gh=l.matchPattern,Wh=l.find,Hh=l.findIndex,Vh=l.sortBy,qh=l.reduce,Uh=lr.getBBox;function Yh(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,t){return t.priority=1,t.id=e.id,e.parent&&(t.parent=e.parent.id),e.labelTarget&&(t.priority=4,t.labelTarget=e.labelTarget.id),e.host&&(t.priority=2,t.host=e.host.id),"number"==typeof e.x&&(t.x=e.x,t.y=e.y),e.width&&(t.width=e.width,t.height=e.height),e.waypoints&&(t.priority=3,t.waypoints=[],Fh(e.waypoints,function(e){var n={x:e.x,y:e.y};e.original&&(n.original={x:e.original.x,y:e.original.y}),t.waypoints.push(n)})),e.source&&e.target&&(t.source=e.source.id,t.target=e.target.id),t})}Yh.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"];var Kh=Yh;Yh.prototype.copy=function(e){var t,n,i=this._clipboard;if(zh(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),n=this._bbox=jh.center(Uh(t.allShapes)),delete t.allShapes,Fh(t,function(e){Fh(e,function(t){var i,r;t.labelTarget?(r=Wh(e,Gh({id:t.labelTarget})),i=r.waypoints?jh.delta(t,r.waypoints[0]):jh.delta(t,r)):3===t.priority?(i=[],Fh(t.waypoints,function(e){var t=jh.delta(e,n);i.push(t)})):i=jh.delta(t,n),t.delta=i})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?i.clear():i.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},Yh.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=qh(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)?e:(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}}))},Yh.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?jh.delta(t,t.labelTarget):(3===t.priority?(i=[],Fh(t.waypoints,function(e){var t=jh.delta(e,n);i.push(t)})):i=jh.delta(t,n),i)},Yh.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=Wh(e,Gh({id:t.source.id})),i=Wh(e,Gh({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!Wh(e,Gh({id:t.labelTarget.id})))},Yh.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)},Yh.prototype._executeDescriptors=function(e){return e.descriptor||(e.descriptor={}),Fh(this._descriptors,function(t){e.descriptor=t(e.element,e.descriptor)}),e},Yh.prototype.createTree=function(e){var t,n=this._rules,i=this,r={},o=[],a=Lh.getTopLevel(e);function s(e){var t=Hh(o,Gh({element:e.element}));if(-1===t)return o.push(e);o[t].depth<e.depth&&(o.splice(t,1),o.push(e))}return r.allShapes=[],lr.eachElement(a,function(e,t,n){var i,r=e.children;if(!e.labelTarget)return e.label&&s({element:e.label,depth:n}),i=[e.attachers,e.incoming,e.outgoing],Fh(i,function(e){e&&e.length&&Fh(e,function(e){e.label&&s({element:e.label,depth:n}),s({element:e,depth:n})})}),s({element:e,depth:n}),r||void 0}),o=$h(o,function(e){return i._executeDescriptors(e)}),o=Vh(o,function(e){return e.descriptor.priority}),t=$h(o,function(e){return e.element}),Fh(o,function(e){var o,a,s=e.depth;i.hasRelations(r.allShapes,e.element)&&(o=t,a=e.element,n.allowed("element.copy",{collection:o,element:a})&&(r.allShapes.push(e.element),r[s]||(r[s]=[]),r[s].push(e.descriptor)))}),r};var Xh=l.bind;function Zh(e,t){this._eventBus=e,this._canvas=t,this._init()}Zh.$inject=["eventBus","canvas"];var Qh=Zh;Zh.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)}}},Zh.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=Xh(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)},Zh.prototype._setHoverElement=function(e){this._hoverElement=e.element},Zh.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var Jh={__init__:["mouseTracking"],mouseTracking:["type",Qh]},ed={__depends__:[Oh,th,Jh],__init__:["copyPaste"],copyPaste:["type",Kh]},td={__depends__:[ed],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",Bh]},nd=l.filter,id=Kc.isAny;function rd(e){e.registerFilter(function(e){return nd(e,function(e){var t=id(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}rd.$inject=["distributeElements"];var od=rd,ad=l.sortBy,sd=l.forEach,cd=l.filter,pd={horizontal:["x","width"],vertical:["y","height"]};function ld(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return sd(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),cd(e,function(e){return e[n]<i+50})})}var ud=ld;ld.$inject=["modeling"],ld.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},ld.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},ld.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(sd(t,function(e){r=e(r,n,i)}),r):e},ld.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=ad(e,i);return sd(o,function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))}),t},ld.prototype._setOrientation=function(e){var t=pd[e];this._axis=t[0],this._dimension=t[1]},ld.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)},ld.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var hd={__depends__:[{__init__:["distributeElements"],distributeElements:["type",ud]}],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",od]},dd=l.forEach,md=l.isArray;function fd(e,t,n,i,r,o,a,s,c){this._actions={undo:function(){t.undo()},redo:function(){t.redo()},copy:function(){var e=i.get();o.copy(e)},paste:function(){var e=c.getHoverContext();o.paste(e)},stepZoom:function(e){r.stepZoom(e.value)},zoom:function(e){a.zoom(e.value)},removeSelection:function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});if(!1===r)return;(t=md(r)?r:e).length&&n.removeElements(t.slice())}},moveCanvas:function(e){var t=0,n=0,i=e.invertY,r=e.speed/Math.min(Math.sqrt(a.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":n=r;break;case"right":t=-r;break;case"down":n=-r}n&&i&&(n=-n),a.scroll({dx:t,dy:n})}}}fd.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"];var yd=fd;function vd(e,t){return new Error(e+" "+t)}fd.prototype.trigger=function(e,t){if(!this._actions[e])throw vd(e,"is not a registered action");return this._actions[e](t)},fd.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);dd(e,function(e,t){n._registerAction(t,e)})},fd.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw vd(e,"is already registered");this._actions[e]=t},fd.prototype.unregister=function(e){if(!this.isRegistered(e))throw vd(e,"is not a registered action");this._actions[e]=void 0},fd.prototype.length=function(){return Object.keys(this._actions).length},fd.prototype.isRegistered=function(e){return!!this._actions[e]};var gd=l.filter,bd=z.is,xd=lr.getBBox;function Ed(e,t,n,i,r,o,a,s,c,p,l,u,h){e.invoke(yd,this),this.register({selectElements:function(){var e=t.getRootElement(),r=n.filter(function(t){return t!==e});return i.select(r),r},spaceTool:function(){r.toggle()},lassoTool:function(){o.toggle()},handTool:function(){a.toggle()},globalConnectTool:function(){s.toggle()},distributeElements:function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)},alignElements:function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=gd(t,function(e){return!bd(e,"bpmn:Lane")}),p.trigger(n,r))},setColor:function(e){var t=i.get();t.length&&h.setColor(t,e)},directEditing:function(){var e=i.get();e.length&&l.activate(e[0])},find:function(){u.toggle()},moveToOrigin:function(){var e,i,r=t.getRootElement();i=bd(r,"bpmn:Collaboration")?n.filter(function(e){return bd(e.parent,"bpmn:Collaboration")}):n.filter(function(e){return e!==r&&!bd(e.parent,"bpmn:SubProcess")}),e=xd(i),h.moveElements(i,{x:-e.x,y:-e.y},r)}})}we(Ed,yd),Ed.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"];var _d=Ed,wd=Kc.isAny;function Sd(e){e.registerProvider(this)}Sd.$inject=["globalConnect"];var Td=Sd;Sd.prototype.canStartConnect=function(e){if(!(t=e)||function(e){return e.labelTarget}(t))return null;var t,n=e.businessObject;return wd(n,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])};var Cd="connect-ok",Ad="connect-not-ok";function Rd(e,t,n,i,r){var o=this;this._dragging=t,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(e){var t=e.context,n=e.hover,r=t.canStartConnect=o.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Cd:Ad))}),e.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Cd:Ad)}),e.on(["global-connect.ended"],function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(o.canStartConnect(i))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,i,r)}),!1})}Rd.$inject=["eventBus","dragging","connect","canvas","toolManager"];var Pd=Rd;Rd.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Rd.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Rd.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Rd.prototype.registerProvider=function(e){this._provider=e},Rd.prototype.canStartConnect=function(e){return this._provider.canStartConnect(e)};var Md=l.forEach;function kd(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}kd.$inject=["eventBus","dragging"];var Bd=kd;kd.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)},kd.prototype.isActive=function(e){return e&&this._active===e},kd.prototype.length=function(e){return this._tools.length},kd.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},kd.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)},this),Md(t,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;!this._active||t&&"tools"===t.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)};var Nd={__depends__:[Qu],__init__:["toolManager"],toolManager:["type",Bd]},Dd={__depends__:[{__depends__:[nh,th,Qu,Nd],globalConnect:["type",Pd]}],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",Td]},Od={},Ld=z.is;function Id(e){return Ld(e,"bpmn:FlowElement")||Ld(e,"bpmn:Participant")||Ld(e,"bpmn:Lane")||Ld(e,"bpmn:SequenceFlow")||Ld(e,"bpmn:MessageFlow")?"name":Ld(e,"bpmn:TextAnnotation")?"text":void 0}Od.getLabel=function(e){var t=e.businessObject,n=Id(t);if(n)return t[n]||""},Od.setLabel=function(e,t,n){var i=e.businessObject,r=Id(i);return r&&(i[r]=t),n&&(e.hidden=!t),e};var jd=l.map,zd=l.filter,Fd=l.sortBy;function $d(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}var Gd=$d;function Wd(e){return zd(e,function(e){return!!e.matched}).length>0}function Hd(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}$d.$inject=["elementRegistry","searchPad","canvas"],$d.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(e){return!e.labelTarget});return n=zd(n,function(e){return e!==t}),n=jd(n,function(t){return{primaryTokens:Hd(Od.getLabel(t),e),secondaryTokens:Hd(t.id,e),element:t}}),n=zd(n,function(e){return Wd(e.primaryTokens)||Wd(e.secondaryTokens)}),n=Fd(n,function(e){return Od.getLabel(e.element)+e.element.id})};var Vd=Se.clear,qd=Se.delegate,Ud=Se.query,Yd=Se.classes,Kd=Se.attr,Xd=Se.domify,Zd=lr.getBBox;function Qd(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=Xd(Qd.BOX_HTML),this._searchInput=Ud(Qd.INPUT_SELECTOR,this._container),this._resultsContainer=Ud(Qd.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}Qd.$inject=["canvas","eventBus","overlays","selection"],Qd.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:qd.bind(t,n,i,r)})}t(document,"html","click",function(t){e.close()}),t(this._container,Qd.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,Qd.RESULT_SELECTOR,"mouseover",function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,Qd.RESULT_SELECTOR,"click",function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,Qd.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),t(this._container,Qd.INPUT_SELECTOR,"keyup",function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))})},Qd.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){qd.unbind(e.el,e.type,e.listener)})},Qd.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}});var i=Ud(Qd.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},Qd.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},Qd.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)}},Qd.prototype._clearResults=function(){Vd(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},Qd.prototype._getCurrentResult=function(){return Ud(Qd.RESULT_SELECTED_SELECTOR,this._resultsContainer)},Qd.prototype._createResultNode=function(e,t){var n=Xd(Qd.RESULT_HTML);return e.primaryTokens.length>0&&em(n,e.primaryTokens,Qd.RESULT_PRIMARY_HTML),em(n,e.secondaryTokens,Qd.RESULT_SECONDARY_HTML),Kd(n,Qd.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},Qd.prototype.registerProvider=function(e){this._searchProvider=e},Qd.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,Yd(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},Qd.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,Yd(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},Qd.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Qd.prototype.isOpen=function(){return this._open},Qd.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&Yd(t).remove(Qd.RESULT_SELECTED_CLASS);var n=Kd(e,Qd.RESULT_ID_ATTRIBUTE),i=this._results[n].element;Yd(e).add(Qd.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},Qd.prototype._select=function(e){var t=Kd(e,Qd.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)},Qd.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=Zd(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)},Qd.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+Qd.OVERLAY_CLASS+'"></div>'}}(Zd(e));this._overlayId=this._overlays.add(e,t)}};var Jd=Qd;function em(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+Qd.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":t+=e.normal}),""!==t?t:null}(t),r=Xd(n);r.innerHTML=i,e.appendChild(r)}Qd.CONTAINER_SELECTOR=".djs-search-container",Qd.INPUT_SELECTOR=".djs-search-input input",Qd.RESULTS_CONTAINER_SELECTOR=".djs-search-results",Qd.RESULT_SELECTOR=".djs-search-result",Qd.RESULT_SELECTED_CLASS="djs-search-result-selected",Qd.RESULT_SELECTED_SELECTOR="."+Qd.RESULT_SELECTED_CLASS,Qd.RESULT_ID_ATTRIBUTE="data-result-id",Qd.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",Qd.OVERLAY_CLASS="djs-search-overlay",Qd.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>',Qd.RESULT_HTML='<div class="djs-search-result"></div>',Qd.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',Qd.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var tm={__depends__:[{__depends__:[da,Xa],searchPad:["type",Jd]}],__init__:["bpmnSearch"],bpmnSearch:["type",Gd]},nm=l.filter,im=l.forEach,rm=l.sortBy;function om(e){return e&&e[e.length-1]}function am(e){return e.y}function sm(e){return e.x}var cm={left:sm,center:sm,right:function(e){return e.x+e.width},top:am,middle:am,bottom:function(e){return e.y+e.height}};function pm(e){this._modeling=e}var lm=pm;pm.$inject=["modeling"],pm.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},pm.prototype._isType=function(e,t){return-1!==t.indexOf(e)},pm.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=om(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(im(t,function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}}),n=rm(p,function(e){return e.elements.length>1&&(l=!0),e.elements.length}),l)return c[e]=om(n).center,c;i=t[0],r=om(t=rm(t,function(e){return e[a]+e[s]})),c[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return c},pm.prototype.trigger=function(e,t){var n=this._modeling,i=nm(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),r=rm(i,cm[t]),o=this._alignmentPosition(t,r);n.alignElements(r,o)};var um={__init__:["alignElements"],alignElements:["type",lm]},hm={__depends__:[Xa,ed,$s],__init__:["editorActions"],editorActions:["type",yd]},dm=ga.hasPrimaryModifier,mm=1500;function fm(e,t,n,i){this._dragging=n,i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",mm,function(e){if(dm(e))return this.activateMove(e.originalEvent),!1},this),e.on("hand.end",function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",function(){this.activateMove(t.originalEvent,{reactivate:!0})},this)},this),e.on("hand.move.move",function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})}),e.on("hand.move.end",function(t){var n=t.context.reactivate;return!dm(t)&&n&&e.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}fm.$inject=["eventBus","canvas","dragging","toolManager"];var ym=fm;fm.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||{}}})},fm.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},fm.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},fm.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var vm={__depends__:[Nd],__init__:["handTool"],handTool:["type",ym]},gm=l.values,bm=lr.getEnclosedElements,xm=ga.hasSecondaryModifier;function Em(t,n,i,r,o,a){this._selection=o,this._dragging=i;var c=this,p=function(t){var i,r=n.getDefaultLayer();i=t.frame=s("rect"),e(i,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),re(r,i)},l=function(t){var n=t.frame,i=t.bbox;e(n,{x:i.x,y:i.y,width:i.width,height:i.height})},u=function(e){e.frame&&oe(e.frame)};a.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),t.on("lasso.selection.end",function(e){var n=e.originalEvent.target;(e.hover||n instanceof SVGElement)&&t.once("lasso.selection.ended",function(){c.activateLasso(e.originalEvent,!0)})}),t.on("lasso.end",function(e){var t=wm(e),n=r.filter(function(e){return e});c.select(n,t)}),t.on("lasso.start",function(e){var t=e.context;t.bbox=wm(e),p(t)}),t.on("lasso.move",function(e){var t=e.context;t.bbox=wm(e),l(t)}),t.on("lasso.cleanup",function(e){var t=e.context;u(t)}),t.on("element.mousedown",1500,function(e){if(xm(e))return c.activateLasso(e.originalEvent),!0})}Em.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"];var _m=Em;function wm(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Em.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:"crosshair",data:{context:{}}})},Em.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},Em.prototype.select=function(e,t){var n=bm(e,t);this._selection.select(gm(n))},Em.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Em.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Sm={__depends__:[Nd],__init__:["lassoTool"],lassoTool:["type",_m]},Tm=function(e){return e.cloneNode(!0)};var Cm=l.forEach;function Am(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}var Rm=Am;Am.$inject=["elementRegistry","canvas","styles"],Am.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Am.prototype.addDragger=function(t,n){var i=this.getGfx(t),r=Tm(i),o=i.getBoundingClientRect();return t.waypoints&&function e(t){t.children&&Cm(t.children,function(t){e(t)});t.style.markerStart="";t.style.markerEnd=""}(r),e(r,this._styles.cls("djs-dragger",[],{x:o.top,y:o.left})),re(n,r),r},Am.prototype.addFrame=function(e,t){var n=s("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return re(t,n),n};var Pm={__init__:["previewSupport"],previewSupport:["type",Rm]},Mm={};Mm.getDirection=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null},Mm.resizeBounds=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)}};var km=ga.hasPrimaryModifier,Bm=Math.abs,Nm=Math.round,Dm=1500,Om={x:"width",y:"height"},Lm={x:"y",y:"x"},Im=lr.selfAndAllChildren,jm=l.assign,zm=l.forEach;function Fm(e,t,n,i,r,o){this._canvas=n,this._dragging=t,this._modeling=i,this._rules=r,this._toolManager=o;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),e.on("spaceTool.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("spaceTool.selection.ended",function(){a.activateMakeSpace(t.originalEvent)})}),e.on("spaceTool.move",Dm,function(e){var t=e.context;t.initialized||(t.initialized=a.initializeMakeSpace(e,t))}),e.on("spaceTool.end",function(t){var n=t.context,i=n.axis,r=n.direction,o=n.movingShapes,s=n.resizingShapes;if(n.initialized){var c={x:Nm(t.dx),y:Nm(t.dy)};c[Lm[i]]=0;var p=!0;zm(s,function(e){("w"===r&&t.x>e.x+e.width||"e"===r&&t.x<e.x||"n"===r&&t.y>e.y+e.height||"s"===r&&t.y<e.y)&&(p=!1)}),p&&a.makeSpace(o,s,c,r),e.once("spaceTool.ended",function(e){a.activateSelection(e.originalEvent,!0,!0)})}})}Fm.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"];var $m=Fm;Fm.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:"crosshair",autoActivate:t,data:{context:{reactivate:n}}})},Fm.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:"crosshair",data:{context:{}}})},Fm.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},Fm.prototype.initializeMakeSpace=function(e,t){var n=Bm(e.dx)>Bm(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Bm(i)<5)return!1;i<0&&(i*=-1),km(e)&&(i*=-1);var o=this._canvas.getRootElement(),a=Im(o,!0),s=this.calculateAdjustments(a,n,i,r);return jm(t,s,{axis:n,direction:Mm.getDirection(n,i)}),gs.set("resize-"+("x"===n?"ew":"ns")),!0},Fm.prototype.calculateAdjustments=function(e,t,n,i){var r=[],o=[],a=this._rules;return e.forEach(function(e){var s=e[t],c=s+e[Om[t]];if(e.parent&&!e.waypoints)return n>0&&s>i?r.push(e):n<0&&c<i?r.push(e):s<i&&c>i&&a.allowed("shape.resize",{shape:e})?o.push(e):void 0}),{movingShapes:r,resizingShapes:o}},Fm.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Fm.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var Gm=l.forEach,Wm="djs-dragging",Hm="djs-resizing",Vm=250,qm=ee.translate;function Um(t,n,i,r,o){function a(e,t){Gm(e,function(e){o.addDragger(e,t),i.addMarker(e,Wm)})}t.on("spaceTool.selection.start",function(t){var n=i.getLayer("space"),o=t.context,a="M 0,-10000 L 0,10000",c="M -10000,0 L 10000,0",p=s("g");e(p,r.cls("djs-crosshair-group",["no-events"])),re(n,p);var l=s("path");e(l,"d",a),Ue(l).add("djs-crosshair"),re(p,l);var u=s("path");e(u,"d",c),Ue(u).add("djs-crosshair"),re(p,u),o.crosshairGroup=p}),t.on("spaceTool.selection.move",function(e){var t=e.context.crosshairGroup;qm(t,e.x,e.y)}),t.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&oe(t)}),t.on("spaceTool.move",Vm,function(t){var c=t.context,p=c.line,l=c.axis,u=c.movingShapes,h=c.resizingShapes;if(c.initialized){if(!c.dragGroup){var d=i.getLayer("space");p=s("path"),e(p,"d","M0,0 L0,0"),Ue(p).add("djs-crosshair"),re(d,p),c.line=p;var m=s("g");e(m,r.cls("djs-drag-group",["no-events"])),re(i.getDefaultLayer(),m),a(u,m),a(c.movingConnections=n.filter(function(e){var t=!1;Gm(u,function(n){Gm(n.outgoing,function(n){e===n&&(t=!0)})});var n=!1;Gm(u,function(t){Gm(t.incoming,function(t){e===t&&(n=!0)})});var i=!1;Gm(h,function(t){Gm(t.outgoing,function(t){e===t&&(i=!0)})});var r=!1;return Gm(h,function(t){Gm(t.incoming,function(t){e===t&&(r=!0)})}),function(e){return e.waypoints}(e)&&(t||i)&&(n||r)}),m),c.dragGroup=m}if(!c.frameGroup){var f=s("g");e(f,r.cls("djs-frame-group",["no-events"])),re(i.getDefaultLayer(),f);var y=[];Gm(h,function(e){var t=o.addFrame(e,f);y.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),i.addMarker(e,Hm)}),c.frameGroup=f,c.frames=y}var v={x:"M"+t.x+", -10000 L"+t.x+", 10000",y:"M -10000, "+t.y+" L 10000, "+t.y};e(p,{path:v[l],display:""});var g={x:t.dx,y:t.dy};g[{x:"y",y:"x"}[c.axis]]=0,qm(c.dragGroup,g.x,g.y),Gm(c.frames,function(t){t.initialWidth+g.x>5&&e(t.element,{width:t.initialWidth+g.x}),t.initialHeight+g.y>5&&e(t.element,{height:t.initialHeight+g.y})})}}),t.on("spaceTool.cleanup",function(e){var t=e.context,n=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;Gm(n,function(e){i.removeMarker(e,Wm)}),Gm(r,function(e){i.removeMarker(e,Wm)}),s&&(oe(a),oe(s)),Gm(o,function(e){i.removeMarker(e,Hm)}),c&&oe(c)})}Um.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Ym={__init__:["spaceToolPreview"],__depends__:[Qu,th,Nd,Pm],spaceTool:["type",$m],spaceToolPreview:["type",Um]},Km={__depends__:[um,hm,vm,Sm,Ym,Nu,Dd,td,hd,tm],editorActions:["type",_d]};function Xm(e,t){e.addListener(function(n,i){return 65===n&&e.isCmd(i)?(t.trigger("selectElements"),!0):70===n&&e.isCmd(i)?(t.trigger("find"),!0):e.hasModifier(i)?void 0:83===n?(t.trigger("spaceTool"),!0):76===n?(t.trigger("lassoTool"),!0):72===n?(t.trigger("handTool"),!0):67===n?(t.trigger("globalConnectTool"),!0):69===n?(t.trigger("directEditing"),!0):void 0})}Xm.$inject=["keyboard","editorActions"];var Zm=Xm,Qm=Se.event,Jm=Se.matches;function ef(e,t,n){var i=this;this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],this._keyHandler=function(e){var t,n,r=e.target,o=i._listeners,a=e.keyCode||e.charCode||-1;if(!r||!Jm(r,"input, textarea")&&"true"!==r.contentEditable)for(t=0;n=o[t];t++)n(a,e)&&(e.preventDefault(),e.stopPropagation())},t.on("diagram.destroy",function(){i._fire("destroy"),i.unbind(),i._listeners=null}),t.on("diagram.init",function(){i._fire("init")}),t.on("attach",function(){e&&e.bindTo&&i.bind(e.bindTo)}),t.on("detach",function(){i.unbind()}),this._init()}ef.$inject=["config.keyboard","eventBus","editorActions"];var tf=ef;function nf(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function rf(e){return e.shiftKey}ef.prototype.bind=function(e){this.unbind(),this._node=e,Qm.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},ef.prototype.getBinding=function(){return this._node},ef.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),Qm.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},ef.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})},ef.prototype._init=function(){var e=this._listeners,t=this._editorActions,n=this._config;e.push(function(e,n){if(nf(n)&&!rf(n)&&90===e)return t.trigger("undo"),!0}),e.push(function(e,n){if(nf(n)&&(89===e||90===e&&rf(n)))return t.trigger("redo"),!0}),e.push(function(e,n){if(nf(n)&&67===e)return t.trigger("copy"),!0}),e.push(function(e,n){if(nf(n)&&86===e)return t.trigger("paste"),!0}),e.push(function(e,n){if(46===e)return t.trigger("removeSelection"),!0}),e.push(function(e,n){if((107===e||187===e||171===e||61===e)&&nf(n))return t.trigger("stepZoom",{value:1}),!0}),e.push(function(e,n){if((109===e||189===e||173===e)&&nf(n))return t.trigger("stepZoom",{value:-1}),!0}),e.push(function(e,n){if((96===e||48===e)&&nf(n))return t.trigger("zoom",{value:1}),!0}),e.push(function(e,i){if([37,38,39,40].indexOf(e)>=0){var r={invertY:n.invertY,speed:n.speed||50};switch(e){case 37:r.direction="left";break;case 38:r.direction="up";break;case 39:r.direction="right";break;case 40:r.direction="down"}return t.trigger("moveCanvas",r),!0}})},ef.prototype.addListener=function(e){this._listeners.push(e)},ef.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},ef.prototype.isCmd=nf,ef.prototype.isShift=rf;var of={__depends__:[{__init__:["keyboard"],keyboard:["type",tf]}],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",Zm]},af=z.getBusinessObject,sf=z.is,cf=ee.translate,pf="djs-element-hidden",lf="djs-label-hidden";function uf(t,n,i,r){var o,a,c,p=this,l=n.getDefaultLayer();t.on("directEditing.activate",function(t){var i=t.active;if(o=i.element.label||i.element,sf(o,"bpmn:TextAnnotation")){a=n.getAbsoluteBBox(o),c=s("g");var u=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:o.height,position:{mx:0,my:0}}),h=p.path=s("path");e(h,{d:u,strokeWidth:2,stroke:function(e,t){return af(e).di.get("stroke")||t||"black"}(o)}),re(c,h),re(l,c),cf(c,o.x,o.y)}sf(o,"bpmn:TextAnnotation")||o.labelTarget?n.addMarker(o,pf):(sf(o,"bpmn:Task")||sf(o,"bpmn:CallActivity")||sf(o,"bpmn:SubProcess")||sf(o,"bpmn:Participant"))&&n.addMarker(o,lf)}),t.on("directEditing.resize",function(t){if(sf(o,"bpmn:TextAnnotation")){var n=t.height,i=t.dy,s=Math.max(o.height/a.height*(n+i),0),c=r.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:o.width,containerHeight:s,position:{mx:0,my:0}});e(p.path,{d:c})}}),t.on(["directEditing.complete","directEditing.cancel"],function(e){var t=e.active;t&&(n.removeMarker(t.element.label||t.element,pf),n.removeMarker(o,lf)),o=void 0,a=void 0,c&&(oe(c),c=void 0)})}uf.$inject=["eventBus","canvas","elementRegistry","pathMap"];var hf=uf,df=l.assign,mf=z.is,ff=Kc.isAny,yf=$.isExpanded;function vf(e,t,n,i,r){function o(e,t){(t||ff(e,["bpmn:Task","bpmn:TextAnnotation"])||bf(e))&&n.activate(e)}this._canvas=t,this._modeling=i,n.registerProvider(this),e.on("element.dblclick",function(e){o(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace"],function(e){n.complete()}),e.on(["commandStack.changed"],function(e){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&&o(t)}),e.on("autoPlace.end",500,function(e){o(e.shape)})}vf.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles"];var gf=vf;function bf(e){return mf(e,"bpmn:SubProcess")&&!yf(e)}vf.prototype.activate=function(e){var t=Od.getLabel(e);if(void 0!==t){var n={text:t},i=this.getEditingBBox(e);df(n,i);var r=e.label||e,o={};return(ff(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||bf(e))&&df(o,{centerVertically:!0}),r.labelTarget&&df(o,{autoResize:!0}),mf(e,"bpmn:TextAnnotation")&&df(o,{resizable:!0,autoResize:!0}),df(n,{options:o}),n}},vf.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=11*s,p=13*s,l=12*s,u=14*s,h={};if((mf(e,"bpmn:Lane")||function(e){return mf(e,"bpmn:Participant")&&yf(e)}(e))&&(df(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),df(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(ff(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return mf(e,"bpmn:Participant")&&!yf(e)}(e)||bf(e))&&(df(a,{width:i.width,height:i.height}),df(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return mf(e,"bpmn:SubProcess")&&yf(e)}(e)&&(df(a,{width:i.width,x:i.x}),df(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),n.labelTarget){var d=90*s,m=7*s,f=4*s;df(a,{width:d,height:i.height+m+f,x:r-d/2,y:i.y-m}),df(h,{fontSize:c+"px",lineHeight:p+"px",paddingTop:m+"px",paddingBottom:f+"px"})}return mf(e,"bpmn:TextAnnotation")&&(df(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),df(h,{textAlign:"left",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",fontSize:l+"px",lineHeight:u+"px"})),{bounds:a,style:h}},vf.prototype.update=function(e,t,n,i){var r,o;mf(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}),this._modeling.updateLabel(e,t,r)};var xf=lr.getType;function Ef(e,t,n,i){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(xf(r)+".changed",i)}),e.on("elements.changed",function(t){var n=t.elements;n.forEach(function(t){e.fire("element.changed",{element:t})}),i.updateContainments(n)}),e.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),e.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}Ef.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var _f={__init__:["changeSupport"],changeSupport:["type",Ef]},wf=l.pick,Sf=l.assign,Tf=Tc.asTRBL,Cf=Tc.roundBounds;function Af(e,t,n,i){this._dragging=i,this._rules=t;var r=this;e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:Tf(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};!function(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=Ip.resizeBounds(i,o,t),e.newBounds=Ip.ensureConstraints(n,a),e.canExecute=r.canResize(e)}(e.context,t)}),e.on("resize.end",function(e){var t,i,r,o;t=e.context,i=t.shape,r=t.canExecute,o=t.newBounds,r&&(o=Cf(o),n.resizeShape(i,o))})}Af.prototype.canResize=function(e){var t=this._rules,n=wf(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Af.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=Sf({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}})},Af.prototype.computeMinResizeBox=function(e){var t,n,i=e.shape,r=e.direction;return t=e.minDimensions||{width:10,height:10},n=Ip.computeChildrenBBox(i,e.childrenBoxPadding),Ip.getMinResizeBounds(r,i,t,n)},Af.$inject=["eventBus","rules","modeling","dragging"];var Rf=Af,Pf=l.bind,Mf=l.forEach,kf=Se.event,Bf=ga.isPrimaryButton,Nf=Tc.asTRBL,Df=ee.transform;function Of(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&&Mf(t,Pf(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}Of.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){Bf(t)&&i.activate(t,e,n)}kf.bind(t,"mousedown",r),kf.bind(t,"touchstart",r)},Of.prototype._createResizer=function(t,n,i,r,o){var a=this._getResizersParent(),c=s("g");Ue(c).add("djs-resizer"),Ue(c).add("djs-resizer-"+t.id),Ue(c).add("djs-resizer-"+o),re(a,c);var p=s("rect");e(p,{x:-7,y:-7,width:5,height:5}),Ue(p).add("djs-resizer-visual"),re(c,p);var l=s("rect");return e(l,{x:-7,y:-7,width:20,height:20}),Ue(l).add("djs-resizer-hit"),re(c,l),Df(c,n,i,r),c},Of.prototype.createResizer=function(e,t){var n,i=Nf(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)},Of.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"))},Of.prototype.removeResizers=function(){var e=this._getResizersParent();Za(e)},Of.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Of.$inject=["eventBus","canvas","selection","resize"];var Lf=Of,If="djs-resizing",jf="resize-not-ok",zf=500;function Ff(t,n,i){t.on("resize.move",zf,function(t){var r,o,a,s;r=t.context,o=r.shape,a=r.newBounds,(s=r.frame)||(s=r.frame=i.addFrame(o,n.getDefaultLayer()),n.addMarker(o,If)),a.width>5&&e(s,{x:a.x,width:a.width}),a.height>5&&e(s,{y:a.y,height:a.height}),r.canExecute?Ue(s).remove(jf):Ue(s).add(jf)}),t.on("resize.cleanup",function(e){var t,i;t=e.context,i=t.shape,t.frame&&oe(t.frame),n.removeMarker(i,If)})}Ff.$inject=["eventBus","canvas","previewSupport"];var $f={__depends__:[th,Qu,Pm],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Rf],resizePreview:["type",Ff],resizeHandles:["type",Lf]},Gf={__depends__:[_f,$f,Nu],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",gf],labelEditingPreview:["type",hf]},Wf=l.map,Hf=l.assign,Vf=l.pick;function qf(e){this._model=e}qf.$inject=["moddle"],qf.prototype._needsId=function(e){return e.$instanceOf("bpmn:RootElement")||e.$instanceOf("bpmn:FlowElement")||e.$instanceOf("bpmn:MessageFlow")||e.$instanceOf("bpmn:DataAssociation")||e.$instanceOf("bpmn:Artifact")||e.$instanceOf("bpmn:Participant")||e.$instanceOf("bpmn:Lane")||e.$instanceOf("bpmn:Process")||e.$instanceOf("bpmn:Collaboration")||e.$instanceOf("bpmndi:BPMNShape")||e.$instanceOf("bpmndi:BPMNEdge")||e.$instanceOf("bpmndi:BPMNDiagram")||e.$instanceOf("bpmndi:BPMNPlane")||e.$instanceOf("bpmn:Property")},qf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},qf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},qf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},qf.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",Hf({bpmnElement:e,bounds:this.createDiBounds(t)},n))},qf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},qf.prototype.createDiWaypoints=function(e){var t=this;return Wf(e,function(e){return t.createDiWaypoint(e)})},qf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Vf(e,["x","y"]))},qf.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",Hf({bpmnElement:e},n))},qf.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})};var Uf=qf,Yf=Tc.getMid;function Kf(){}var Xf=Kf;Kf.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Yf(e.source),t.connectionEnd||Yf(e.target)]};var Zf={},Qf=l.isArray,Jf=l.find,ey=l.without,ty=l.assign,ny=Tc.getOrientation,iy=Tc.getMid,ry=Hs.pointsAligned,oy=Hs.pointInRect,ay=Hs.pointDistance,sy=20,cy={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function py(e,t,n){var i,r;if("h:v"===(n=n||"h:h"))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=Math.round((t.x-e.x)/2+e.x),y:e.y},{x:i,y:t.y}];if("v:v"===n)return r=Math.round((t.y-e.y)/2+e.y),[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("unknown directions: <"+n+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")}function ly(e,t,n){var i=[];return ry(e,t)||(i=py(e,t,n)),i.unshift(e),i.push(t),i}function uy(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=ey(o,"straight")[0]||"h:h",s=cy[a]||0,c=ny(e,t,s),p=function(e,t){switch(e){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(c,a);if(n=n||iy(e),i=i||iy(t),p){if("h:h"===p)switch(c){case"top-right":case"right":case"bottom-right":n={original:n,x:e.x,y:n.y},i={original:i,x:t.x+t.width,y:i.y};break;case"top-left":case"left":case"bottom-left":n={original:n,x:e.x+e.width,y:n.y},i={original:i,x:t.x,y:i.y}}if("v:v"===p)switch(c){case"top-left":case"top":case"top-right":n={original:n,x:n.x,y:e.y+e.height},i={original:i,x:i.x,y:t.y};break;case"bottom-left":case"bottom":case"bottom-right":n={original:n,x:n.x,y:e.y},i={original:i,x:i.x,y:t.y+t.height}}return ly(n,i,p)}}function hy(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function dy(e,t,n,i,r){var o,a,s={};return a=ny(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?hy(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:hy(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):null}function my(e,t,n,i){if(function(e,t,n){return n.length<3||!(n.length>4)&&!!Jf(n,function(e,t){var i=n[t-1];return i&&ay(e,i)<3})}(0,0,i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(ry(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}}(a[1],o,n),(r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(oy(e[i],t,sy)||oy(e[i],n,sy))return e.slice(i);return e}(a,e,t))!==a?my(e,t,n,r):a}Zf.repairConnection=function(e,t,n,i,r,o){var a;return Qf(n)&&(r=n,o=i,n=iy(e),i=iy(t)),r=r||[],-1!==(o=ty({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&(a=dy(e,t,n,i,o)),a||(o.connectionEnd?a=(a=my(t,e,i,r.slice().reverse()))&&a.reverse():o.connectionStart?a=my(e,t,n,r):r&&r.length&&(a=r)),a||(a=uy(e,t,n,i,o)),a};var fy=l.assign,yy=Hs.pointsOnLine,vy=$.isExpanded,gy=Tc.getMid,by=Tc.getOrientation,xy=z.is;function Ey(){}we(Ey,Xf);var _y=Ey;function wy(e,t){return e?e.original||e:gy(t)}function Sy(e){var t=e.source,n=e.target;return xy(n,"bpmn:Activity")&&xy(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function Ty(e){return xy(e,"bpmn:SubProcess")&&vy(e)}Ey.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;if(p||(p=wy(c&&c[0],a)),l||(l=wy(c&&c[c.length-1],s)),(xy(e,"bpmn:Association")||xy(e,"bpmn:DataAssociation"))&&c&&!Sy(e))return[].concat([p],c.slice(1,-1),[l]);if(xy(e,"bpmn:MessageFlow"))n={preferredLayouts:["v:v"]},xy(s,"bpmn:Participant")&&(n={preferredLayouts:["straight","v:v"]}),Ty(s)&&(n={preferredLayouts:["straight","v:v"]}),Ty(a)&&xy(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:Ty(s)?"source":"target"}),xy(a,"bpmn:Participant")&&xy(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),xy(s,"bpmn:Event")&&(n={preferredLayouts:["v:v"]});else if(xy(e,"bpmn:SequenceFlow")||Sy(e))if(xy(a,"bpmn:BoundaryEvent")){var u=(o=(r=a).host,by(gy(r),o,-10));/left|right/.test(u)?n={preferredLayouts:["h:v"]}:/top|bottom/.test(u)&&(n={preferredLayouts:["v:h"]})}else n=xy(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:xy(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return n&&(n=fy(n,t),i=(i=Zf.repairConnection(a,s,p,l,c,n))&&i.reduce(function(e,t,n){var r=e[e.length-1],o=i[n+1];return yy(r,o,t,0)||e.push(t),e},[])),i||[p,l]};var Cy=l.assign,Ay=l.forEach,Ry=z.getBusinessObject,Py=z.is;function My(e,t,n,i){mp.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t=e.context.oldRoot.children;Ay(t,function(e){Py(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;Py(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,i=e.context;i.cropped||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],By(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"],By(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"],By(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],By(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"],By(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],By(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],By(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],By(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],By(function(e){var t=e.context,n=t.connection,i=Ry(n),r=Ry(t.oldSource),o=Ry(t.oldTarget),a=Ry(n.source),s=Ry(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(Py(s,"bpmn:Activity")||Py(s,"bpmn:EndEvent")||Py(s,"bpmn:Gateway")||Py(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!Py(a,"bpmn:Activity")&&!Py(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(Py(s,"bpmn:Activity")||Py(s,"bpmn:EndEvent")||Py(s,"bpmn:Gateway")||Py(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],By(function(e){var t=e.context,n=t.connection,i=Ry(n),r=Ry(n.source);t.default&&(Py(r,"bpmn:ExclusiveGateway")||Py(r,"bpmn:InclusiveGateway")||Py(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&Py(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],By(p)),this.reverted(["element.updateAttachment"],By(p))}we(My,mp);var ky=My;function By(e){return function(t){var n=t.context,i=n.shape||n.connection;Py(i,"bpmn:BaseElement")&&e(t)}}My.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],My.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},My.prototype.updateParent=function(e,t){if(!(e instanceof Dr.Label)){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;Py(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),Py(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),Py(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),Py(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},My.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof Dr.Label?this._getLabel(t).bounds:t.bounds;Cy(n,{x:e.x,y:e.y,width:e.width,height:e.height})},My.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(Py(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),pr.remove(i,e)),Py(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),pr.add(r,e)))},My.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)},My.prototype.updateDiParent=function(e,t){if(t&&!Py(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(pr.remove(n,e),e.$parent=null)}},My.prototype.getLaneSet=function(e){var t,n;return Py(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Py(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},My.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t){if(Py(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Py(e,"bpmn:FlowElement")){if(t)if(Py(t,"bpmn:Participant"))t=t.processRef;else if(Py(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Py(t,"bpmn:Lane"));i="flowElements"}else if(Py(e,"bpmn:Artifact")){for(;t&&!Py(t,"bpmn:Process")&&!Py(t,"bpmn:SubProcess")&&!Py(t,"bpmn:Collaboration");){if(Py(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Py(e,"bpmn:MessageFlow"))i="messageFlows";else if(Py(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!Py(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(pr.remove(o.get("rootElements"),a),a.$parent=null),t&&(pr.add(o.get("rootElements"),a),a.$parent=o))}else Py(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Py(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&&(s=e.$parent.get(i),pr.remove(s,e)),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);pr.remove(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},My.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},My.prototype.updateConnection=function(e){var t,n=e.connection,i=Ry(n),r=Ry(n.source),o=Ry(n.target);if(Py(i,"bpmn:DataAssociation"))Py(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):Py(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=Py(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(pr.remove(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(pr.remove(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)},My.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};var Ny=l.assign,Dy=l.forEach,Oy=z.is,Ly=$.isExpanded;function Iy(e,t,n){Kr.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}we(Iy,Kr),Iy.$inject=["bpmnFactory","moddle","translate"];var jy=Iy;function zy(e,t,n){e[n]=t[n],delete t[n]}Iy.prototype.baseCreate=Kr.prototype.create,Iy.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,Ny({type:"label"},Bt.DEFAULT_LABEL_SIZE,t)):this.createBpmnElement(e,t)},Iy.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),t.colors&&(Ny(a.di,t.colors),delete t.colors),function(e,t,n){Dy(n,function(n){void 0!==t[n]&&zy(e,t,n)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&zy(a.di,t,"isExpanded"),Oy(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),r.$parent=a,a.eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=Ny({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},Iy.prototype._getDefaultSize=function(e){return Oy(e,"bpmn:SubProcess")?Ly(e)?{width:350,height:200}:{width:100,height:80}:Oy(e,"bpmn:Task")?{width:100,height:80}:Oy(e,"bpmn:Gateway")?{width:50,height:50}:Oy(e,"bpmn:Event")?{width:36,height:36}:Oy(e,"bpmn:Participant")?Ly(e)?{width:600,height:250}:{width:400,height:100}:Oy(e,"bpmn:Lane")?{width:400,height:100}:Oy(e,"bpmn:DataObjectReference")?{width:36,height:50}:Oy(e,"bpmn:DataStoreReference")?{width:50,height:50}:Oy(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},Iy.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)};var Fy=Bt.hasExternalLabel,$y=z.getBusinessObject,Gy=z.is,Wy={width:0,height:0};function Hy(e){var t=new ge;function n(e,t){var n=e.label||e,i=e.labelTarget||e;return Od.setLabel(n,t,i!==n),[n,i]}this.execute=function(e){return e.oldLabel=Od.getLabel(e.element),n(e.element,e.newLabel)},this.revert=function(e){return n(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newBounds;if(Fy(i)||Gy(i,"bpmn:TextAnnotation")){var a=$y(r),s=a.name||a.text;s&&(void 0===o&&(o=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:qy});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(r,s,t)),o&&e.resizeShape(r,o,Wy))}}}Hy.$inject=["modeling"];var Vy=Hy,qy={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Uy=l.filter,Yy=Xp.getLanesRoot,Ky=Xp.getChildLanes,Xy=Xp.LANE_INDENTATION;function Zy(e,t){this._modeling=e,this._spaceTool=t}Zy.$inject=["modeling","spaceTool"];var Qy=Zy;function Jy(e){this._moddle=e}Zy.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Yy(i),a=o===i,s=a?i:i.parent;Ky(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+Xy,y:i.y,width:i.width-Xy,height:i.height},s);var c=[];lr.eachElement(o,function(e){return c.push(e),e===i?[]:Uy(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?Xy:0),y:l-("top"===r?120:0),width:i.width-(a?Xy:0),height:120},s)},Jy.$inject=["moddle"];var ev=Jy;Jy.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Jy.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 tv=z.is,nv=Xp.getLanesRoot,iv=Xp.computeLanesResize,rv=lr.eachElement,ov=Tc.asTRBL,av=Ip.substractTRBL;function sv(e,t){this._modeling=e,this._spaceTool=t}sv.$inject=["modeling","spaceTool"];var cv=sv;sv.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},sv.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=iv(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},sv.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=ov(e),p=ov(t),l=av(p,c),u=nv(e),h=[],d=[];rv(u,function(e){return h.push(e),(tv(e,"bpmn:Lane")||tv(e,"bpmn:Participant"))&&d.push(e),e.children}),(l.bottom||l.top)&&(n=l.bottom||l.top,i=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),r=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(h,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var pv=l.assign,lv=l.forEach,uv={fill:void 0,stroke:void 0};function hv(e){this._commandStack=e}hv.$inject=["commandStack"];var dv=hv;hv.prototype.postExecute=function(e){var t=e.elements,n=e.colors||uv,i=this,r={};"fill"in n&&pv(r,{fill:n.fill}),"stroke"in n&&pv(r,{stroke:n.stroke}),lv(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var mv=Xp.getChildLanes,fv=Xp.LANE_INDENTATION;function yv(e,t){this._modeling=e,this._translate=t}yv.$inject=["modeling","translate"];var vv=yv;function gv(e,t){this._canvas=e,this._modeling=t}yv.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=mv(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+fv,y:s,width:i.width-fv,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},gv.$inject=["canvas","modeling"];var bv=gv;gv.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),pr.add(a.rootElements,i),i.$parent=a,pr.remove(a.rootElements,o),o.$parent=null,o.di=null,s.bpmnElement=i,i.di=s,e.oldRoot=r},gv.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),pr.remove(o.rootElements,n),n.$parent=null,pr.add(o.rootElements,r),r.$parent=o,n.di=null,a.bpmnElement=r,r.di=a};var xv=Xp.collectLanes,Ev=Xp.getLanesRoot,_v=z.is,wv=Tc.asTRBL;function Sv(e){this._elementRegistry=e}Sv.$inject=["elementRegistry"];var Tv=Sv;Sv.prototype.computeUpdates=function(e,t){var n={},i=[],r={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(e){return e.parent?function(e){var t=Ev(e);return r[t.id]||(r[t.id]=xv(t)),r[t.id]}(e).filter(function(t){return n=e,i=wv(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=Ev(e);t&&!n[t.id]&&(t.children.filter(function(e){return _v(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get("lanes").slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get("flowNodeRef").forEach(function(e){i.push({flowNode:e,remove:[t],add:[]})})}),i},Sv.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.remove.forEach(function(e){pr.remove(n,e),pr.remove(e.get("flowNodeRef"),t)}),e.add.forEach(function(e){pr.add(n,e),pr.add(e.get("flowNodeRef"),t)})})},Sv.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.add.forEach(function(e){pr.remove(n,e),pr.remove(e.get("flowNodeRef"),t)}),e.remove.forEach(function(e){pr.add(n,e),pr.add(e.get("flowNodeRef"),t)})})};var Cv=l.reduce,Av=l.keys,Rv=l.forEach,Pv=l.assign,Mv=z.getBusinessObject,kv="id",Bv="di",Nv={width:0,height:0};function Dv(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textUtil=new ge}Dv.$inject=["elementRegistry","moddle","translate","modeling"];var Ov=Dv;function Lv(e,t){return kv in e&&e[kv]!==t[kv]}function Iv(e,t){Rv(t,function(t,n){var i;n!==Bv?e.set(n,t):e.di&&(i=e.di,Rv(t,function(e,t){i.set(t,e)}))})}Dv.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=Pv({},e);return jv.forEach(function(n){n in e&&(t[n]=Mv(t[n]))}),t}(e.properties),c=e.oldProperties||function(e,t){var n=Av(t);return Cv(n,function(n,i){var r,o;return n[i]=i!==Bv?e.get(i):(r=e.di,o=Av(t.di),Cv(o,function(e,t){return e[t]=r.get(t),e},{})),n},{})}(a,s);return Lv(s,a)&&(o.unclaim(a[kv]),r.updateId(t,s[kv]),o.claim(s[kv],a)),"default"in s&&(s.default&&n.push(r.get(s.default.id)),a.default&&n.push(r.get(a.default.id))),"name"in s&&t.label&&(n.push(t.label),t.label.hidden=!s.name),Iv(a,s),e.oldProperties=c,e.changed=n,n},Dv.prototype.postExecute=function(e){var t=e.element.label,n=t&&Mv(t).name;if(n){var i=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:zv});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(t,n,this._textUtil);this._modeling.resizeShape(t,i,Nv)}},Dv.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 Iv(r,i),Lv(n,r)&&(a.unclaim(n[kv]),o.updateId(t,i[kv]),a.claim(i[kv],r)),e.changed};var jv=["default"];var zv={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Fv=l.forEach;function $v(e,t){this._modeling=e,this._canvas=t}$v.$inject=["modeling","canvas"];var Gv=$v;function Wv(){}$v.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;Fv(n,function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},$v.prototype.postExecute=function(e){};var Hv=Wv;Wv.prototype.execute=function(){},Wv.prototype.revert=function(){};var Vv=l.some;function qv(e){this._modeling=e}we(qv,Hv),qv.$inject=["modeling"];var Uv=qv;function Yv(e,t){this._canvas=e,this._layouter=t}qv.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},qv.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,Vv(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)},Yv.$inject=["canvas","layouter"];var Kv=Yv;Yv.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},Yv.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null};var Xv=l.assign,Zv=Math.round;function Qv(e){this._canvas=e}Qv.$inject=["canvas"];var Jv=Qv;function eg(e){Jv.call(this,e)}Qv.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?Xv(t,n):Xv(t,{x:n.x-Zv(t.width/2),y:n.y-Zv(t.height/2)}),this._canvas.addShape(t,i,r),t},Qv.prototype.revert=function(e){this._canvas.removeShape(e.shape)},we(eg,Jv),eg.$inject=["canvas"];var tg=eg,ng=Jv.prototype.execute;eg.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach(function(t){void 0===e[t]&&(e[t]=0)})}(t),t.labelTarget=e.labelTarget,ng.call(this,e)};var ig=Jv.prototype.revert;function rg(e,t){this._canvas=e,this._modeling=t}eg.prototype.revert=function(e){return e.shape.labelTarget=null,ig.call(this,e)},rg.$inject=["canvas","modeling"];var og=rg;rg.prototype.preExecute=function(e){var t=e.connection;t.label&&this._modeling.removeShape(t.label)},rg.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=pr.indexOf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t.label=null,t},rg.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,pr.add(n.children,t,i),this._canvas.addConnection(t,n),t};var ag=l.forEach;function sg(e,t){this._modeling=e,this._elementRegistry=t}we(sg,Hv),sg.$inject=["modeling","elementRegistry"];var cg=sg;sg.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;ag(i,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};var pg={saveClear:function(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}}},lg=pg.saveClear;function ug(e,t){this._canvas=e,this._modeling=t}ug.$inject=["canvas","modeling"];var hg=ug;ug.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=n.label;n.labelTarget&&(e.labelTarget=n.labelTarget,n.labelTarget=null),i&&this._modeling.removeShape(i,{nested:!0}),lg(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),lg(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),lg(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},ug.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=pr.indexOf(i.children,n),n.label=null,t.removeShape(n),n},ug.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex,o=e.labelTarget;return pr.add(i.children,n,r),o&&(o.label=n),t.addShape(n,i),n};var dg=l.forEach,mg=l.sortBy;function fg(e){this._modeling=e}fg.$inject=["modeling"];var yg=fg,vg={x:"y",y:"x"};fg.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],m=0;dg(n,function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),m+=c(e.range)):(u=(l=mg(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,dg(l,function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[vg[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}}),p&&p!==n.length-1&&(m+=c(e.range)))}),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-m)/(n.length-1)))<n.length-1||dg(n,function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,dg(e.elements,function(n,o){s[vg[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)}))})},fg.prototype.postExecute=function(e){};var gg=l.assign;function bg(e,t){this._layouter=e,this._canvas=t}bg.$inject=["layouter","canvas"];var xg=bg;bg.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return gg(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},bg.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};var Eg=l.forEach;function _g(){}var wg=_g;_g.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=pr.remove(o.children,t),pr.add(i.children,t,r),t.parent=i,Eg(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},_g.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return pr.remove(n.children,t),pr.add(i.children,t,r),t.parent=i,Eg(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};var Sg={},Tg=Tc.roundPoint,Cg=jh.center,Ag=jh.delta;Sg.getNewAttachPoint=function(e,t,n){var i=Cg(t),r=Cg(n),o=Ag(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return Tg({x:r.x+a,y:r.y+s})},Sg.getNewAttachShapeDelta=function(e,t,n){var i=Cg(e),r=Cg(t),o=Cg(n),a=Ag(e,i),s=Ag(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 Tg({x:l+a.x-e.x,y:u+a.y-e.y})};var Rg={},Pg=Sg.getNewAttachPoint;function Mg(e,t,n){var i=Ng(e)[0];return Pg(i.original||i,n,t)}function kg(e,t,n){var i=Ng(e),r=i[i.length-1];return Pg(r.original||r,n,t)}function Bg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ng(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}Rg.getResizedSourceAnchor=Mg,Rg.getResizedTargetAnchor=kg,Rg.getMovedSourceAnchor=function(e,t,n){return Mg(e,t,Bg(t,n))},Rg.getMovedTargetAnchor=function(e,t,n){return kg(e,t,Bg(t,n))};var Dg=l.forEach,Og=Rg.getMovedSourceAnchor,Lg=Rg.getMovedTargetAnchor;function Ig(e){this._modeling=e}var jg=Ig;function zg(e){this._helper=new jg(e)}Ig.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Ig.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),Dg(a,function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})}),Dg(s,function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&Og(e,e.source,t),connectionEnd:r&&Lg(e,e.target,t)})})},Ig.prototype.getClosure=function(e){return lr.getClosure(e)},zg.$inject=["modeling"];var Fg=zg;zg.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},zg.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)},zg.prototype.execute=function(e){},zg.prototype.revert=function(e){};var $g=l.assign,Gg=l.forEach,Wg=l.pick,Hg=Rg.getMovedSourceAnchor,Vg=Rg.getMovedTargetAnchor;function qg(e){this._modeling=e,this._helper=new jg(e)}qg.$inject=["modeling"];var Ug=qg;qg.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=Wg(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=pr.remove(o.children,t),pr.add(i.children,t,r),$g(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},qg.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(Gg(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:Vg(e,t,n)})}),Gg(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:Hg(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},qg.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return pr.add(n.children,t,i),$g(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},qg.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},qg.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};var Yg=l.forEach,Kg=l.map,Xg=l.sortBy,Zg=l.assign;function Qg(e,t){Yg(t,function(t){e[t]&&delete e[t]})}function Jg(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}we(Jg,Hv),Jg.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"];var eb=Jg;Jg.prototype.preExecute=function(e){var t=this._eventBus,n=this,i=e.tree,r=e.topParent,o=e.position;i.createdElements={},i.labels=[],Yg(i,function(e,a){var s=parseInt(a,10);isNaN(s)||(s||(e=Kg(e,function(e){return e.parent=r,e})),e=Xg(e,"priority"),Yg(e,function(e){var a,c=e.id,p=e.parent,l={},u=Zg({},e);if(s&&(u.parent=n._getCreatedElement(p,i)),p)if(t.fire("element.paste",{createdElements:i.createdElements,descriptor:u}),p=u.parent,u.waypoints)(u=n._createConnection(u,p,o,i))&&(i.createdElements[c]={element:u,descriptor:e});else{if(u.parent!==r&&(l.root=!1),u.host&&(l.attach=!0,p=n._getCreatedElement(u.host,i)),u.labelTarget)return i.labels.push(u);a={x:Math.round(o.x+u.delta.x+u.width/2),y:Math.round(o.y+u.delta.y+u.height/2)},Qg(u,["id","parent","delta","host","priority"]),(u=n._createShape(u,p,a,l))&&(i.createdElements[c]={element:u,descriptor:e})}}))})},Jg.prototype.postExecute=function(e){var t=this._modeling,n=this._selection,i=this,r=e.tree,o=r.labels,a=[];Yg(o,function(e){var n,o,a,s=i._getCreatedElement(e.labelTarget,r);s&&(n=s.label)&&(o={x:s.x,y:s.y},s.waypoints&&(o=s.waypoints[0]),a={x:Math.round(o.x-n.x+e.delta.x),y:Math.round(o.y-n.y+e.delta.y)},t.moveShape(n,a,s.parent))}),Yg(r[0],function(e){var t=e.id,n=r.createdElements[t];n&&a.push(n.element)}),n.select(a)},Jg.prototype._createConnection=function(e,t,n,i){var r,o,a=this._modeling,s=this._rules;return e.waypoints=Kg(e.waypoints,function(t,i){return{x:Math.round(n.x+e.delta[i].x),y:Math.round(n.y+e.delta[i].y)}}),r=this._getCreatedElement(e.source,i),o=this._getCreatedElement(e.target,i),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Qg(e,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,e,t)):null},Jg.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},Jg.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element};var tb=l.isArray;function nb(){}nb.$inject=[];var ib=nb;nb.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,tb(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},nb.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};var rb=l.forEach;function ob(e,t){this._modeling=e,this._rules=t}ob.$inject=["modeling","rules"];var ab=ob;ob.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return r.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};t=e.newShape=e.newShape||n.createShape(a,l,o.parent),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t));var u=o.incoming.slice(),h=o.outgoing.slice();rb(u,function(e){var i=e.waypoints,r=i[i.length-1];c("connection.reconnectEnd",e.source,t,e)&&n.reconnectEnd(e,t,r)}),rb(h,function(e){var i=e.waypoints[0],r=e.target;c("connection.reconnectStart",t,r,e)&&n.reconnectStart(e,t,i)})},ob.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;rb(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),rb(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},ob.prototype.execute=function(e){},ob.prototype.revert=function(e){},ob.prototype.createShape=function(e,t,n){return this._modeling.createShape(e,t,n)},ob.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},ob.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)};var sb=l.assign,cb=l.forEach,pb=Rg.getResizedSourceAnchor,lb=Rg.getResizedTargetAnchor;function ub(e){this._modeling=e}ub.$inject=["modeling"];var hb=ub;ub.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},sb(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},ub.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;cb(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:lb(e,t,n)})}),cb(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:pb(e,t,n)})})},ub.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return sb(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};var db=l.forEach;function mb(e){this._modeling=e}mb.$inject=["modeling"];var fb=mb;function yb(e){this._modeling=e}mb.prototype.preExecute=function(e){var t=this._modeling,n=e.resizingShapes,i=e.delta,r=e.direction;db(n,function(e){var n=Mm.resizeBounds(e,r,i);t.resizeShape(e,n)})},mb.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},mb.prototype.execute=function(e){},mb.prototype.revert=function(e){},yb.$inject=["modeling"];var vb=yb;function gb(e){this._modeling=e}yb.prototype.execute=function(e){var t,n=e.shape,i=n.children;return e.oldChildrenVisibility=(t={},i.forEach(function(e){t[e.id]=e.hidden}),t),n.collapsed=!n.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(i,n.collapsed),[n].concat(i)},yb.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)};var bb=gb;function xb(e,t){return pr.remove(e&&e.attachers,t)}function Eb(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),pr.add(i,t,n)}}function _b(){}gb.$inject=["modeling"],gb.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=xb(i,t),Eb(n,t),t.host=n,t},gb.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,xb(n,t),Eb(i,t,r),t};var wb=_b;_b.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},_b.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};var Sb=l.forEach;function Tb(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}Tb.$inject=["eventBus","elementFactory","commandStack"];var Cb=Tb;Tb.prototype.getHandlers=function(){return{"shape.append":Uv,"shape.create":Jv,"shape.delete":hg,"shape.move":Ug,"shape.resize":hb,"shape.replace":ab,"shape.toggleCollapse":vb,spaceTool:fb,"label.create":tg,"connection.create":Kv,"connection.delete":og,"connection.move":wg,"connection.layout":xg,"connection.updateWaypoints":wb,"connection.reconnectStart":ib,"connection.reconnectEnd":ib,"elements.move":Fg,"elements.delete":cg,"elements.distribute":yg,"elements.align":Gv,"element.updateAttachment":bb,"elements.paste":eb}},Tb.prototype.registerHandlers=function(e){Sb(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},Tb.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)},Tb.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},Tb.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},Tb.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)},Tb.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},Tb.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},Tb.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},Tb.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},Tb.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},Tb.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},Tb.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},Tb.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},Tb.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},Tb.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},Tb.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},Tb.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},Tb.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},Tb.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},Tb.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},Tb.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},Tb.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},Tb.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},Tb.prototype._create=function(e,t){return t instanceof Dr.Base?t:this._elementFactory.create(e,t)},Tb.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function Ab(e,t,n,i){Cb.call(this,e,t,n),this._bpmnRules=i}we(Ab,Cb),Ab.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];var Rb=Ab;Ab.prototype.getHandlers=function(){var e=Cb.prototype.getHandlers.call(this);return e["element.updateProperties"]=Ov,e["canvas.updateRoot"]=bv,e["lane.add"]=Qy,e["lane.resize"]=cv,e["lane.split"]=vv,e["lane.updateRefs"]=Tv,e["id.updateClaim"]=ev,e["element.setColor"]=dv,e["element.updateLabel"]=Vy,e},Ab.prototype.updateLabel=function(e,t,n){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n})},Ab.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)},Ab.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ab.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ab.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ab.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ab.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ab.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ab.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},Ab.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ab.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ab.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};var Pb=Tc.getOrientation,Mb=Tc.getMid,kb=Tc.asTRBL,Bb=Es.substract,Nb=Bt.hasExternalLabel;function Db(e,t){function n(e){if(Nb(e)){var n=function(e){var t=Mb(e.label),n=Mb(e),i=Ib(n,t);if(r=i,-1===Lb.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 Ib(n,e)}),a=Lb.filter(function(e){return-1===o.indexOf(e)});if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var r,o=Mb(e),a=e.label,s=Mb(a),c=kb(e);switch(n){case"top":r={x:o.x,y:c.top-i-a.height/2};break;case"left":r={x:c.left-i-a.width/2,y:o.y};break;case"bottom":r={x:o.x,y:c.bottom+i+a.height/2};break;case"right":r={x:c.right+i+a.width/2,y:o.y}}var p=Bb(r,s);t.moveShape(a,p)}(e,n)}}mp.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t=e.context.connection,i=t.source,r=t.target;n(i),n(r)});var i=10}we(Db,mp),Db.$inject=["eventBus","modeling"];var Ob=Db;var Lb=["top","bottom","left","right"];function Ib(e,t){return Pb(t,e,5)}var jb=z.is;function zb(e,t,n){mp.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(jb(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)}zb.$inject=["eventBus","elementFactory","bpmnRules"],we(zb,mp);var Fb=zb,$b=l.forEach,Gb=z.is;function Wb(e,t,n){mp.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Gb(t,"bpmn:Lane"))do{t=e.topParent=t.parent}while(Gb(t,"bpmn:Lane")||!Gb(t,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(e){var n=e.tree.createdElements;$b(n,function(e){var i,r=e.element,o=r.businessObject,a=e.descriptor;(Gb(o,"bpmn:ExclusiveGateway")||Gb(o,"bpmn:InclusiveGateway")||Gb(o,"bpmn:Activity"))&&a.default&&(i=(i=n[a.default])?i.element:void 0,delete r.default,t.updateProperties(r,{default:i}))})},!0)}Wb.$inject=["eventBus","modeling","canvas"],we(Wb,mp);var Hb=Wb,Vb=z.is;function qb(e,t,n,i){mp.call(this,e),this.preExecute("shape.create",function(e){var t,r=e.shape,o=e.host,a={cancelActivity:!0};o&&Vb(r,"bpmn:IntermediateThrowEvent")&&(a.attachedToRef=o.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:i.create("bpmn:BoundaryEvent",a)},e.shape=n.createShape(t))},!0)}qb.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],we(qb,mp);var Ub=qb,Yb=z.is;function Kb(e,t,n){mp.call(this,e),this.preExecute("shape.create",function(e){var n=e.context.shape;if(Yb(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}})}Kb.$inject=["eventBus","bpmnFactory","moddle"],we(Kb,mp);var Xb=Kb,Zb=z.is;function Qb(e,t,n,i,r){mp.call(this,e),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape,o=e.position,a=r.getRootElement();if(Zb(n,"bpmn:Process")&&Zb(i,"bpmn:Participant")&&!Zb(a,"bpmn:Collaboration")){var s=t.makeCollaboration();e.position=o,e.parent=s,e.processRoot=n}},!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 n=e.processRoot,i=e.shape;if(n){var r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}},!0)}Qb.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],we(Qb,mp);var Jb=Qb,ex=l.find,tx=z.is,nx="__targetRef_placeholder";function ix(e,t){function n(e,n){var i=e.get("properties"),r=ex(i,function(e){return e.name===nx});return!r&&n&&(r=t.create("bpmn:Property",{name:nx}),pr.add(i,r)),r}function i(e,t){var i=n(e);i&&(function(e,t,n){var i=e.get("dataInputAssociations");return ex(i,function(e){return e!==n&&e.targetRef===t})}(e,i,t)||pr.remove(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}mp.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ox(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],ox(r))}ix.$inject=["eventBus","bpmnFactory"],we(ix,mp);var rx=ix;function ox(e){return function(t){var n=t.context.connection;if(tx(n,"bpmn:DataInputAssociation"))return e(t)}}var ax=z.is,sx=Xp.getChildLanes,cx=lr.eachElement,px=500;function lx(e,t,n){mp.call(this,e),this.postExecuted("shape.delete",px,function(e){var t=e.context,i=t.hints,r=t.shape,o=t.oldParent;ax(r,"bpmn:Lane")&&(i&&i.nested||function(e,t){var i,r,o,a=sx(t),s=[],c=[];cx(a,function(t){return t.y>e.y?c.push(t):s.push(t),t.children}),a.length&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}(r,o))})}lx.$inject=["eventBus","modeling","spaceTool"],we(lx,mp);var ux=lx,hx={},dx=Hs.pointDistance,mx=Math.round,fx=Math.max;var yx=10;hx.getApproxIntersection=function(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(dx(i,t)<=yx)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r,o,a=Sc((r=yx,[["M",(i=t).x,i.y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]),(n=[],e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n)),s=a[0],c=a[a.length-1];return s?s!==c?s.segment2!==c.segment2?{point:e[o=fx(s.segment2,c.segment2)-1],bendpoint:!0,index:o}:{point:{x:mx(s.x+c.x)/2,y:mx(s.y+c.y)/2},index:s.segment2}:{point:{x:mx(s.x),y:mx(s.y)},index:s.segment2}:null}(e,t)};var vx=l.assign,gx=l.find,bx=hx.getApproxIntersection;function xx(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 Ex(e){return vx({},e)}function _x(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u=i.waypoints,h=bx(u,r);if(h){if(o=u.slice(0,h.index),a=u.slice(h.index+(h.bendpoint?1:0)),!o.length||!a.length)return;s=h.bendpoint?u[h.index]:r,xx(e,o[o.length-1])||o.push(Ex(s)),xx(e,a[0])||a.unshift(Ex(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||r),l=!0),t.canConnect(e,p,i)&&(l?n.connect(e,p,{type:i.type,waypoints:a}):n.reconnectStart(i,e,a||r))}mp.call(this,e),this.preExecute("elements.move",function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a,s=(a=o,{x:Math.round(a.x+a.width/2),y:Math.round(a.y+a.height/2)}),c={x:s.x+r.x,y:s.y+r.y},p=gx(n.children,function(e){return t.canInsert(i,e)&&bx(e.waypoints,c)});p&&(e.targetFlow=p,e.position=c)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)},!0),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)},!0)}we(_x,mp),_x.$inject=["eventBus","bpmnRules","modeling"];var wx=_x,Sx=function(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))})},Tx=Tc.getMid;function Cx(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Sx(e,t,n,r),s=Sx(e,t,n,o);i=a&&s?Rx(a,n)>Rx(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],Tx(n.source)),t(i[i.length-1],i[i.length-2],Tx(n.target)))})}Cx.$inject=["eventBus"];var Ax=Cx;function Rx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}var Px={};function Mx(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}Px.getAngle=function(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))},Px.rotateVector=function(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e},Px.getDistancePointPoint=function(e,t){return Mx({x:e.x-t.x,y:e.y-t.y})};var kx={},Bx=Math.sqrt,Nx=Math.min,Dx=Math.max,Ox=Math.abs;function Lx(e){return Math.pow(e,2)}function Ix(e,t){return Bx(Lx(e.x-t.x)+Lx(e.y-t.y))}function jx(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=Bx(l),h=-p+u,d=-p-u,m={x:e.x-r*h,y:e.y-o*h};return 0===l?[m]:[m,{x:e.x-r*d,y:e.y-o*d}].filter(function(n){return function(e,t,n){return zx(e.x,t.x,n.x)&&zx(e.y,t.y,n.y)}(n,e,t)})}function zx(e,t,n){return e>=Nx(t,n)-Fx&&e<=Dx(t,n)+Fx}kx.getAttachment=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($x(n=t[m],i=t[m+1])?s=[n]:(r=Ix(e,n),o=Ix(e,i),s=jx(n,i,e,Nx(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:$x(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:Ix(n,a)/Ix(n,i)}),p=Ix(c.position,e),(!u||l>p)&&(u=c,l=p)}return u};var Fx=.1;function $x(e,t){return Ox(e.x-t.x)<=Fx&&Ox(e.y-t.y)<=Fx}var Gx={},Wx=Px.getDistancePointPoint,Hx=Px.rotateVector,Vx=Px.getAngle,qx=kx.getAttachment,Ux=Tc.roundPoint;function Yx(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;if(0===o)return r;if(r>=l&&(c=p?r+1:r-1),r<l)if(c=r,p&&"bendpoint"!==n.type&&l-1===r)Kx(t,l)<n.relativeLocation&&c++;return c}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}function Kx(e,t){var n=Wx(e[t-1],e[t]);return n/(n+Wx(e[t],e[t+1]))}function Xx(e,t){return[e[t],e[t+1]]}Gx.getLabelAdjustment=function(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=qx(a,n),c=s.segmentIndex,p=Yx(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l,u,h,d,m,f,y=Xx(n,c),v=Xx(t,p),g=s.position,b=(d=g,m=Wx((h=y)[0],h[1]),f=Wx(h[0],d),0===m?0:f/m),x=(l=v,u=Vx(y),Vx(l)-u);if("bendpoint"===s.type){var E=t.length-n.length,_=s.bendpointIndex,w=n[_];if(-1!==t.indexOf(w))return{x:r,y:o};if(0===E){var S=t[_];return{x:S.x-s.position.x,y:S.y-s.position.y}}E<0&&0!==_&&_<n.length-1&&(b=Kx(n,_))}var T=(v[1].x-v[0].x)*b+v[0].x,C=(v[1].y-v[0].y)*b+v[0].y,A=Hx({x:a.x-g.x,y:a.y-g.y},x);return r=T+A.x-a.x,o=C+A.y-a.y,Ux({x:r,y:o})};var Zx=l.assign,Qx=z.is,Jx=z.getBusinessObject,eE=Bt.hasExternalLabel,tE=Bt.getExternalLabelMid,nE=Gx.getLabelAdjustment,iE={width:90,height:20};function rE(e,t,n){mp.call(this,e);var i=new ge;this.postExecute(["shape.create","connection.create"],function(e){var n=e.context,r=n.shape||n.connection,o=r.businessObject;if(eE(r)){var a=tE(r),s=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:aE});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(iE,o.name||"",i);t.createLabel(r,a,{id:o.id+"_label",hidden:!o.name,businessObject:o,width:s.width,height:s.height})}}),this.executed(["label.create"],function(e){var t,i=e.context.shape;i.labelTarget&&Qx(i.labelTarget||i,"bpmn:BaseElement")&&((t=i.businessObject.di).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")})),Zx(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var n,i=e.context.connection.label;i&&(n=i.hidden?function(e){var t=e.context.connection,n=t.label,i=tE(t);return{x:i.x-n.x-n.width/2,y:i.y-n.y-n.height/2}}(e):function(e){var t=e.command,n=e.context,i=n.connection,r=i.label,o=Zx({},n.hints),a=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===o.startChanged&&(o.startChanged="connection.reconnectStart"===t),void 0===o.endChanged&&(o.endChanged="connection.reconnectEnd"===t),nE(r,a,s,o)}(e),t.moveShape(i,n))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Jx(n);r&&eE(r)&&(n.label.x=i.label.x,n.label.y=i.label.y)})}we(rE,mp),rE.$inject=["eventBus","modeling","bpmnFactory"];var oE=rE,aE={fontFamily:"Arial, sans-serif",fontSize:"11px"};var sE=z.is,cE="flow elements must be children of pools/participants",pE="participants cannot be pasted onto a non-empty process diagram";function lE(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,r=t.shape,o=t.target;sE(o,"bpmn:Collaboration")&&sE(r,"bpmn:FlowNode")&&i(e,n(cE))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,r=t.position,o=t.target;sE(o,"bpmn:Collaboration")&&i(r,n(cE)),sE(o,"bpmn:Process")&&i(r,n(pE),3e3)})}lE.$inject=["eventBus","tooltips","translate"];var uE=lE;function hE(e,t,n){mp.call(this,e),this.preExecute("shape.delete",function(e){var i,r,o,a=e.context.shape;if(1==a.incoming.length&&1==a.outgoing.length){var s=a.incoming[0],c=a.outgoing[0];if(t.canConnect(s.source,c.target,s)){var p=(i=s.waypoints,r=c.waypoints,(o=Sx(mE(i[i.length-2]),mE(i[i.length-1]),mE(r[1]),mE(r[0])))?[].concat(i.slice(0,i.length-1),[o],r.slice(1)):[mE(i[0]),mE(r[r.length-1])]);n.reconnectEnd(s,c.target,p)}}})}we(hE,mp),hE.$inject=["eventBus","bpmnRules","modeling"];var dE=hE;function mE(e){return e.original||e}var fE=z.is;function yE(e,t){mp.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;fE(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()},!0)}yE.$inject=["eventBus","modeling"],we(yE,mp);var vE=yE,gE=l.forEach,bE=l.find,xE=l.matchPattern,EE=z.is;function _E(e,t,n){function i(e){var i,r,o=e.source,a=e.target;e.parent&&(EE(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),EE(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),EE(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}mp.call(this,e),this.postExecuted("elements.move",function(e){var t=e.closure.allConnections;gE(t,i)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){i(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=bE(o.outgoing,xE({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})})}we(_E,mp),_E.$inject=["eventBus","modeling","bpmnRules"];var wE=_E,SE=l.forEach,TE=$.isEventSubProcess,CE=z.is;function AE(e,t,n,i,r,o){mp.call(this,e),this._bpmnReplace=t,this._elementRegistry=i,this._selection=r,this._modeling=o,this.postExecuted(["elements.move"],500,function(e){var t=e.context,i=t.newParent,r=t.newHost,o=[];SE(t.closure.topLevel,function(e){o=TE(e)?o.concat(e.children):o.concat(e)}),1===o.length&&r&&(i=r);var a=n.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)},this),this.postExecute(["shape.replace"],1500,function(e){var t,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(t=n.canReplace(a,o),this.replaceElements(a,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;o.unclaimId(n.businessObject.id,n.businessObject),o.updateProperties(i,{id:n.id})})}we(AE,mp),AE.prototype.replaceElements=function(e,t,n){var i=this._elementRegistry,r=this._bpmnReplace,o=this._selection,a=this._modeling;SE(t,function(t){var o={type:t.newElementType},s=i.get(t.oldElementId);n&&CE(s,"bpmn:BoundaryEvent")&&a.updateAttachment(s,null);var c=e.indexOf(s);e[c]=r.replaceElement(s,o,{select:!1}),n&&CE(e[c],"bpmn:BoundaryEvent")&&a.updateAttachment(e[c],n)}),t&&o.select(e)},AE.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var RE=AE,PE=z.is,ME=Tc.roundBounds,kE=ga.hasPrimaryModifier,BE=1001;function NE(e,t){e.on("resize.start",BE+500,function(e){var t=e.context,n=t.shape;(PE(n,"bpmn:Lane")||PE(n,"bpmn:Participant"))&&(t.balanced=!kE(e))}),e.on("resize.end",BE,function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(PE(i,"bpmn:Lane")||PE(i,"bpmn:Participant"))return r&&(o=ME(o),t.resizeLane(i,o,n.balanced)),!1})}NE.$inject=["eventBus","modeling"];var DE=NE,OE=z.getBusinessObject,LE=z.is,IE=Ip.computeChildrenBBox,jE=500;function zE(e,t,n,i){mp.call(this,e),this.executed(["shape.toggleCollapse"],jE,function(e){var t,n=e.context.shape;LE(n,"bpmn:SubProcess")&&(n.collapsed?OE(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),OE(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],jE,function(e){var t=e.context.shape;t.collapsed?OE(t).di.isExpanded=!1:OE(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],jE,function(e){var i,r=e.context.shape,o=t._getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,a=t;return n=(r=o,r.filter(function(e){return!e.hidden})).concat([e]),(i=IE(n))?(a.width=Math.max(i.width,a.width),a.height=Math.max(i.height,a.height),a.x=i.x+(i.width-a.width)/2,a.y=i.y+(i.height-a.height)/2):(a.x=e.x+(e.width-a.width)/2,a.y=e.y+(e.height-a.height)/2),a}(r,o),n.resizeShape(r,i)})}we(zE,mp),zE.$inject=["eventBus","elementFactory","modeling"];var FE=zE;var $E=l.forEach;function GE(e,t){mp.call(this,e),this.preExecute("elements.delete",function(e){var n=e.context.elements;$E(n,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}we(GE,mp),GE.$inject=["eventBus","modeling"];var WE=GE,HE=z.is,VE=z.getBusinessObject;function qE(e,t){mp.call(this,e),this.preExecute("connection.delete",function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!HE(e,"bpmn:SequenceFlow"))return!1;var n=VE(t),i=VE(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})})}we(qE,mp),qE.$inject=["eventBus","modeling"];var UE=qE;var YE=z.is,KE=500,XE=5e3;function ZE(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}mp.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,XE,function(e){(i=i||new function(){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}}).enter()}),this.postExecuted(o,KE,function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=r();t.labelTarget||(YE(t,"bpmn:Lane")&&n.addLane(t),YE(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}ZE.$inject=["eventBus","modeling","translate"],we(ZE,mp);var QE={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",Ob],appendBehavior:["type",Fb],copyPasteBehavior:["type",Hb],createBoundaryEventBehavior:["type",Ub],createDataObjectBehavior:["type",Xb],createParticipantBehavior:["type",Jb],dataInputAssociationBehavior:["type",rx],deleteLaneBehavior:["type",ux],dropOnFlowBehavior:["type",wx],importDockingFix:["type",Ax],labelBehavior:["type",oE],modelingFeedback:["type",uE],replaceConnectionBehavior:["type",wE],removeParticipantBehavior:["type",vE],replaceElementBehaviour:["type",RE],resizeLaneBehavior:["type",DE],removeElementBehavior:["type",dE],toggleElementCollapseBehaviour:["type",FE],unclaimIdBehavior:["type",WE],updateFlowNodeRefsBehavior:["type",ZE],unsetDefaultFlowBehavior:["type",UE]};function JE(e){mp.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)}),this.preExecute(["shape.move","connection.move"],function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)})}JE.prototype.getOrdering=function(e,t){return null},we(JE,mp);var e_=JE,t_=Kc.isAny,n_=l.findIndex,i_=l.find;function r_(e,t){e_.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 i(e){var t=e.order;return t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=i_(n,function(t){return t_(e,[t.type])});return t&&t.order||{level:1}}(e)),t}this.getOrdering=function(e,n){var r=i(e);r.containers&&(n=function(e,n,i){for(var r=n;r&&!t_(r,i);)r=r.parent;if(!r)throw new Error(t("no parent for {element} in {parent}",{element:e.id,parent:n.id}));return r}(e,n,r.containers));var o=n.children.indexOf(e),a=n_(n.children,function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level});return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}r_.$inject=["eventBus","translate"],we(r_,e_);var o_={__init__:["bpmnOrderingProvider"],__depends__:[Qt],bpmnOrderingProvider:["type",r_]},a_={},s_=Tc.getOrientation;a_.getBoundaryAttachment=function(e,t){var n=s_(e,t,-15);return"intersect"!==n?n:null};var c_=z.is,p_=Tc.asTRBL,l_=Xp.collectLanes,u_=Xp.getLanesRoot,h_=Math.abs,d_=Math.min,m_=Math.max;function f_(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function y_(e,t,n){return f_(e,t,n,d_)}function v_(e,t,n){return f_(e,t,n,m_)}var g_=60,b_=300,x_=20,E_=50,__=20,w_=20;a_.getParticipantSizeConstraints=function(e,t,n){var i=u_(e),r=!0,o=!0,a=l_(i,[i]),s=p_(e),c={},p={};return/e/.test(t)?p.right=s.left+b_:/w/.test(t)&&(p.left=s.right-b_),a.forEach(function(e){var i=p_(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&h_(s.top-i.bottom)<10&&v_(c,"top",i.top+g_),h_(s.top-i.top)<5&&y_(p,"top",i.bottom-g_)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&h_(s.bottom-i.top)<10&&y_(c,"bottom",i.bottom-g_),h_(s.bottom-i.bottom)<5&&v_(p,"bottom",i.top+g_))}),i.children.filter(function(e){return!e.hidden&&!e.waypoints&&(c_(e,"bpmn:FlowElement")||c_(e,"bpmn:Artifact"))}).forEach(function(e){var n=p_(e);r&&/n/.test(t)&&y_(p,"top",n.top-__),/e/.test(t)&&v_(p,"right",n.right+x_),o&&/s/.test(t)&&v_(p,"bottom",n.bottom+w_),/w/.test(t)&&y_(p,"left",n.left-E_)}),{min:p,max:c}};var S_=l.find,T_=l.some,C_=l.every,A_=l.filter,R_=l.forEach,P_=z.is,M_=Kc.isAny,k_=z.getBusinessObject,B_=$.isExpanded,N_=$.isEventSubProcess,D_=$.isInterrupting,O_=$.hasErrorEventDefinition,L_=$.hasEscalationEventDefinition,I_=$.hasCompensateEventDefinition,j_=a_.getBoundaryAttachment;function z_(e){Pp.call(this,e)}we(z_,Pp),z_.$inject=["eventBus"];var F_=z_;function $_(e){return!e||X_(e)}function G_(e,t){return e===t}function W_(e){do{if(P_(e,"bpmn:Process"))return k_(e);if(P_(e,"bpmn:Participant"))return k_(e).processRef}while(e=e.parent)}function H_(e){return P_(e,"bpmn:TextAnnotation")}function V_(e){return P_(e,"bpmn:BoundaryEvent")&&Y_(e,"bpmn:CompensateEventDefinition")}function q_(e){return k_(e).isForCompensation}function U_(e){for(var t=e;t=t.parent;){if(P_(t,"bpmn:FlowElementsContainer"))return k_(t);if(P_(t,"bpmn:Participant"))return k_(t).processRef}return null}function Y_(e,t){var n=k_(e);return!!S_(n.eventDefinitions||[],function(e){return P_(e,t)})}function K_(e,t){return(k_(e).eventDefinitions||[]).every(function(e){return P_(e,t)})}function X_(e){return e.labelTarget}function Z_(e){return e.waypoints}function Q_(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function J_(e,t,n){if($_(e)||$_(t))return null;if(G_(e,t))return!1;if(!P_(n,"bpmn:DataAssociation")){if(pw(e,t))return{type:"bpmn:MessageFlow"};if(lw(e,t))return{type:"bpmn:SequenceFlow"}}var i=uw(e,t);return i||(V_(e)&&q_(t)?{type:"bpmn:Association",associationDirection:"One"}:!!cw(e,t)&&{type:"bpmn:Association"})}function ew(e,t,n){return!(!X_(e)||Z_(t))||!(P_(t,"bpmn:Participant")&&!B_(t))&&(P_(e,"bpmn:Participant")?P_(t,"bpmn:Process")||P_(t,"bpmn:Collaboration"):P_(e,"bpmn:Lane")?P_(t,"bpmn:Participant")||P_(t,"bpmn:Lane"):!P_(e,"bpmn:BoundaryEvent")&&(P_(e,"bpmn:FlowElement")?P_(t,"bpmn:FlowElementsContainer")?B_(t):M_(t,["bpmn:Participant","bpmn:Lane"]):M_(e,["bpmn:Artifact","bpmn:DataAssociation"])?M_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!P_(e,"bpmn:MessageFlow")&&(P_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function tw(e){return!X_(e)&&P_(e,"bpmn:BoundaryEvent")}function nw(e){return P_(e,"bpmn:Lane")}function iw(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r=e[0];return!X_(r)&&(!!function(e){return tw(e)||P_(e,"bpmn:IntermediateThrowEvent")&&!e.parent}(r)&&(!t||!N_(t)&&(!(!P_(t,"bpmn:Activity")||q_(t))&&(!(i&&!j_(i,t))&&"attach"))))}function rw(e,t,n){if(!t)return!1;var i={replacements:[]};return R_(e,function(e){N_(t)||P_(e,"bpmn:StartEvent")&&"label"!==e.type&&ew(e,t)&&(D_(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(O_(e)||L_(e)||I_(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),P_(t,"bpmn:Transaction")||Y_(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(P_(e,"bpmn:EndEvent")&&ew(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),P_(e,"bpmn:BoundaryEvent")&&iw(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function ow(e,t){return!T_(e,tw)&&(!T_(e,nw)&&(!t||e.every(function(e){return ew(e,t)})))}function aw(e,t,n,i){return!!t&&(X_(t)?null:!G_(n,t)&&((!n||!Q_(n,t))&&(ew(e,t)||hw(e,t,i))))}function sw(e,t){return P_(e,"bpmn:SubProcess")?B_(e)&&(!t||t.width>=100&&t.height>=80):P_(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:P_(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!H_(e)}function cw(e,t){return!Z_(e)&&!Z_(t)&&(!(!V_(e)||!q_(t))||!Q_(t,e)&&!Q_(e,t)&&function(e,t){var n=H_(e),i=H_(t);return(n||i)&&n!==i}(e,t))}function pw(e,t){return P_(i=e,"bpmn:InteractionNode")&&(!P_(i,"bpmn:Event")||P_(i,"bpmn:ThrowEvent")&&K_(i,"bpmn:MessageEventDefinition"))&&function(e){return P_(e,"bpmn:InteractionNode")&&!q_(e)&&(!P_(e,"bpmn:Event")||P_(e,"bpmn:CatchEvent")&&K_(e,"bpmn:MessageEventDefinition"))}(t)&&(n=t,!(W_(e)===W_(n)));var n,i}function lw(e,t){return P_(o=e,"bpmn:FlowNode")&&!P_(o,"bpmn:EndEvent")&&!N_(o)&&!(P_(o,"bpmn:IntermediateThrowEvent")&&Y_(o,"bpmn:LinkEventDefinition"))&&!V_(o)&&!q_(o)&&function(e){return P_(e,"bpmn:FlowNode")&&!P_(e,"bpmn:StartEvent")&&!P_(e,"bpmn:BoundaryEvent")&&!N_(e)&&!(P_(e,"bpmn:IntermediateCatchEvent")&&Y_(e,"bpmn:LinkEventDefinition"))&&!q_(e)}(t)&&(n=t,i=U_(e),r=U_(n),i&&i===r)&&!(P_(e,"bpmn:EventBasedGateway")&&!function(e){return P_(e,"bpmn:ReceiveTask")||P_(e,"bpmn:IntermediateCatchEvent")&&(Y_(e,"bpmn:MessageEventDefinition")||Y_(e,"bpmn:TimerEventDefinition")||Y_(e,"bpmn:ConditionalEventDefinition")||Y_(e,"bpmn:SignalEventDefinition"))}(t));var n,i,r,o}function uw(e,t){return M_(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&M_(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!M_(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!M_(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function hw(e,t,n){if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return M_(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!X_(t)&&P_(e,"bpmn:FlowNode")&&!P_(e,"bpmn:BoundaryEvent")&&ew(e,t.parent)}function dw(e,t){return e&&t&&-1!==e.indexOf(t)}function mw(e,t){return!(P_(t,"bpmn:Lane")&&!dw(e,t.parent))&&!(P_(t,"bpmn:BoundaryEvent")&&!dw(e,t.host))}z_.prototype.init=function(){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 J_(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return J_(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return J_(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return sw(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return iw(n,t,null,i)||rw(n,t,i)||ow(n,t)||hw(n,t,i)}),this.addRule("shape.create",function(e){return aw(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return iw(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return mw(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?J_(r,o):iw([n],t,null,i)||aw(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(P_(t,"bpmn:Collaboration"))return C_(n,function(e){return"bpmn:Participant"===e.type});if(P_(t,"bpmn:Process"))return!(T_(n,function(e){return"bpmn:Participant"===e.type})&&t.children.length>0);if(P_(t,"bpmn:Participant")&&!B_(t))return!1;if(P_(t,"bpmn:FlowElementsContainer"))return B_(t);return M_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)}),this.addRule(["elements.delete"],function(e){return A_(e.elements,function(e){return!X_(e)})})},z_.prototype.canConnectMessageFlow=pw,z_.prototype.canConnectSequenceFlow=lw,z_.prototype.canConnectDataAssociation=uw,z_.prototype.canConnectAssociation=cw,z_.prototype.canMove=ow,z_.prototype.canAttach=iw,z_.prototype.canReplace=rw,z_.prototype.canDrop=ew,z_.prototype.canInsert=hw,z_.prototype.canCreate=aw,z_.prototype.canConnect=J_,z_.prototype.canResize=sw,z_.prototype.canCopy=mw;var fw={__depends__:[th],__init__:["bpmnRules"],bpmnRules:["type",F_]},yw=l.uniqueBy,vw=l.isArray,gw=l.assign,bw=Jr.Event;function xw(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)}xw.$inject=["eventBus","injector"];var Ew=xw;xw.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)},xw.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},xw.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed")},xw.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()}},xw.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()}},xw.prototype.register=function(e,t){this._setHandler(e,t)},xw.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)},xw.prototype.canUndo=function(){return!!this._getUndoAction()},xw.prototype.canRedo=function(){return!!this._getRedoAction()},xw.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},xw.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},xw.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)})},xw.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=gw(new bw,n),i=0;(r=a[i])&&(o=this._eventBus.fire("commandStack."+r,n),!n.cancelBubble);i++);return o},xw.prototype._createId=function(){return this._uid++},xw.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},xw.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)},xw.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)},xw.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:yw("id",n)}),n.length=0,this._fire("changed"))},xw.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=vw(e)?e:[e],t.dirty=t.dirty.concat(e))},xw.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},xw.prototype._revertedAction=function(e){this._stackIdx--},xw.prototype._getHandler=function(e){return this._handlerMap[e]},xw.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 _w={commandStack:["type",Ew]},ww=l.flatten,Sw=l.filter,Tw=l.forEach,Cw=l.groupBy,Aw=l.map,Rw=l.unionBy,Pw=pg.saveClear,Mw=Sg.getNewAttachShapeDelta,kw=251,Bw=1401;function Nw(e,t,n,i){mp.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",Bw,function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=Dw(t=r),Rw("id",t,n)),i.validatedShapes=function(e){var t=Cw(e,"id");return Sw(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(o)}),r&&t.on("shape.move.start",kw,function(e){var t=e.context,n=Dw(t.shapes);Tw(n,function(e){r.makeDraggable(t,e,!0),e.label&&r.makeDraggable(t,e.label,!0)})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.delta,r=t.newParent,o=t.closure.enclosedElements,a=Dw(o);Tw(a,function(e){o[e.id]||(i.moveShape(e,n,r),e.label&&i.moveShape(e.label,n,r))})}),this.postExecuted("elements.move",function(e){var t,n=e.context,r=n.shapes,o=n.newHost;r.length>1||(t=o?r:Sw(r,function(e){return!!e.host}),Tw(t,function(e){i.updateAttachment(e,o)}))}),this.postExecuted("elements.move",function(e){var t=e.context.shapes;Tw(t,function(e){Tw(e.attachers,function(e){Tw(e.outgoing.slice(),function(e){n.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),Tw(e.incoming.slice(),function(e){n.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute("shape.replace",function(e){var t=e.context,r=t.oldShape,o=t.newShape;Pw(r.attachers,function(e){"attach"===n.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)}),o.attachers.length&&Tw(o.attachers,function(e){var t=Mw(e,r,o);i.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;a.length&&Tw(a,function(e){var t=Mw(e,r,o);i.moveShape(e,t,e.parent),e.label&&i.moveShape(e.label,t,e.label.parent)})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;Pw(t.attachers,function(e){i.removeShape(e)}),t.host&&i.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,o=Sw(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)});Tw(o,function(e){pr.remove(r,e),e.label&&pr.remove(r,e.label)}),t.attachSupportInitialized=!0}})}function Dw(e){return ww(Aw(e,function(e){return e.attachers||[]}))}we(Nw,mp),Nw.$inject=["injector","eventBus","rules","modeling"];var Ow={__depends__:[th],__init__:["attachSupport"],attachSupport:["type",Nw]},Lw=l.forEach,Iw=l.filter,jw=l.map,zw=250,Fw=1400,$w=Tc.getMid;function Gw(e,t,n){mp.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",Fw,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=Ww(n),t.validatedShapes=Ww(i)}),i&&t.on("shape.move.start",zw,function(e){var t=e.context,n=t.shapes,r=[];Lw(n,function(e){var n=e.label;n&&!n.hidden&&-1===t.shapes.indexOf(n)&&r.push(n),e.labelTarget&&r.push(e)}),Lw(r,function(e){i.makeDraggable(t,e,!0)})}),this.postExecute("elements.move",Fw,function(e){var t=e.context,n=t.closure.enclosedElements;t.enclosedLabels=jw(n,function(e){var t=e.label;return t&&!n[t.id]?[t,$w(t)]:null}).filter(function(e){return e})}),this.postExecuted("elements.move",function(e){var t=e.context,i=t.enclosedLabels,r=t.delta;Lw(i,function(e){var t=e[0],i=e[1],o=$w(t);o.x===i.x&&o.y===i.y&&n.moveShape(t,r,t.labelTarget.parent)})})}function Ww(e){return Iw(e,function(t){return-1===e.indexOf(t.labelTarget)})}we(Gw,mp),Gw.$inject=["injector","eventBus","modeling"];var Hw={__init__:["labelSupport"],labelSupport:["type",Gw]},Vw=l.isString,qw=l.assign,Uw=l.forEach,Yw=Se.domify,Kw=Se.attr,Xw=Se.classes,Zw=Se.remove,Qw=Se.delegate,Jw=new Vo("tt");function eS(e,t){e.style.display=!1===t?"none":""}var tS=".djs-tooltip";function nS(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Jw,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=Yw('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;Qw.bind(this._tooltipRoot,tS,"mousedown",function(e){e.stopPropagation()}),Qw.bind(this._tooltipRoot,tS,"mouseover",function(e){r.trigger("mouseover",e)}),Qw.bind(this._tooltipRoot,tS,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}nS.$inject=["eventBus","canvas"];var iS=nS;nS.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=qw({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},nS.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Kw(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},nS.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},nS.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},nS.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},nS.prototype.remove=function(e){var t=this.get(e);t&&(Zw(t.html),Zw(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},nS.prototype.show=function(){eS(this._tooltipRoot)},nS.prototype.hide=function(){eS(this._tooltipRoot,!1)},nS.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},nS.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)),Vw(i)&&(i=Yw(i)),(t=Yw('<div data-tooltip-id="'+n+'" class="djs-tooltip" style="position: absolute">')).appendChild(i),e.type&&Xw(t).add("djs-tooltip-"+e.type),e.className&&Xw(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},nS.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,qw(t.style,{left:n+"px",top:i+"px"})},nS.prototype._updateTooltipVisibilty=function(e){Uw(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),eS(i,r))})},nS.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",function(t){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()})};var rS={__init__:["tooltips"],tooltips:["type",iS]},oS=l.assign,aS=Tc.getElementLineIntersection;function sS(e){return oS({original:e.point.original||e.point},e.actual)}function cS(e,t){this._elementRegistry=e,this._graphicsFactory=t}cS.$inject=["elementRegistry","graphicsFactory"];var pS=cS;cS.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(sS(i)),o.push(sS(r)),o},cS.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}},cS.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return aS(i,r,n)},cS.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},cS.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},cS.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var lS={__init__:["modeling","bpmnUpdater"],__depends__:[QE,fw,o_,ou,_w,rS,Hw,Ow,Xa,_f,Ym],bpmnFactory:["type",Uf],bpmnUpdater:["type",ky],elementFactory:["type",jy],modeling:["type",Rb],layouter:["type",_y],connectionDocking:["type",pS]},uS=l.assign;function hS(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)}var dS=hS;hS.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],hS.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(uS({type:e},a));a&&(r.businessObject.di.isExpanded=a.isExpanded),n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e,t){n.start(e,i.createParticipantShape(t))}return uS(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":p("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",c("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var mS=l.isFunction,fS=l.isArray,yS=l.forEach,vS=Se.domify,gS=Se.query,bS=Se.attr,xS=Se.clear,ES=Se.classes,_S=Se.matches,wS=Se.delegate,SS=Se.event;function TS(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())})}TS.$inject=["eventBus","canvas"];var CS=TS;TS.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},TS.prototype.getEntries=function(){var e={};return yS(this._providers,function(t){var n=t.getPaletteEntries();yS(n,function(t,n){e[n]=t})}),e},TS.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=vS(TS.HTML_MARKUP),r=this;n.appendChild(i),wS.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(_S(t,".djs-palette-toggle"))return r.toggle();r.trigger("click",e)}),SS.bind(i,"mousedown",function(e){e.stopPropagation()}),wS.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},TS.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=ES(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()})},TS.prototype._update=function(){var e=gS(".djs-palette-entries",this._container),t=this._entries=this.getEntries();xS(e),yS(t,function(t,n){var i=t.group||"default",r=gS("[data-group="+i+"]",e);r||(r=vS('<div class="group" data-group="'+i+'"></div>'),e.appendChild(r));var o,a,s,c=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),p=vS(c);r.appendChild(p),t.separator||(bS(p,"data-action",n),t.title&&bS(p,"title",t.title),t.className&&(o=p,a=t.className,s=ES(o),(fS(a)?a:a.split(/\s+/g)).forEach(function(e){s.add(e)})),t.imageUrl&&p.appendChild(vS('<img src="'+t.imageUrl+'">')))}),this.open()},TS.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[bS(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,mS(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},TS.prototype._layoutChanged=function(){this._toggleState({})},TS.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},TS.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},TS.prototype.open=function(){this._toggleState({open:!0})},TS.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},TS.prototype.isActiveTool=function(e){return e&&this._activeTool===e},TS.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=gS(".djs-palette-entries",this._container),this._toolsContainer=gS("[data-group=tools]",t)),n=this._toolsContainer,yS(n.children,function(t){var n=t.getAttribute("data-action");if(n){var i=ES(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},TS.prototype.isOpen=function(){return ES(this._container).has("open")},TS.prototype._getParentContainer=function(){return this._canvas.getContainer()},TS.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var AS={__depends__:[{__init__:["palette"],palette:["type",CS]},_h,Ym,Sm,vm,Qt,Dd],__init__:["paletteProvider"],paletteProvider:["type",dS]},RS=l.assign,PS=l.forEach,MS=Se.query,kS=250;function BS(t,n,i,r,o){mp.call(this,t),t.on("shape.move.move",kS,function(t){var a=t.context,s=a.canExecute;a.visualReplacements||(a.visualReplacements={}),s.replacements?function(t){var a=t.canExecute.replacements;PS(a,function(a){var s=a.oldElementId,c={type:a.newElementType};if(!t.visualReplacements[s]){var p=n.get(s);RS(c,{x:p.x,y:p.y});var l=i.createShape(c);r.addShape(l,p.parent);var u=MS("[data-element-id="+p.id+"]",t.dragGroup);u&&e(u,{display:"none"});var h=o.addDragger(l,t.dragGroup);t.visualReplacements[s]=h,r.removeShape(l)}})}(a):function(t){var n=t.visualReplacements;PS(n,function(i,r){var o=MS("[data-element-id="+r+"]",t.dragGroup);o&&e(o,{display:"inline"}),i.remove(),n[r]&&delete n[r]})}(a)})}BS.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],we(BS,mp);var NS={__depends__:[Pm],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",BS]},DS={},OS=Math.abs,LS=Math.round;DS.snapTo=function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],OS(r-e)<=n)return r},DS.topLeft=function(e){return{x:e.x,y:e.y}},DS.mid=function(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:LS(e.x+e.width/2),y:LS(e.y+e.height/2)}},DS.bottomRight=function(e){return{x:e.x+e.width,y:e.y+e.height}},DS.isSnapped=function(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)},DS.setSnapped=function(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};var IS=l.forEach,jS=DS.snapTo;function zS(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}zS.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},zS.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},zS.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},zS.prototype.getSnapLocations=function(){return this._snapLocations},zS.prototype.setSnapLocations=function(e){this._snapLocations=e},zS.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new $S).initDefaults(this._defaultSnaps),n};var FS=zS;function $S(e){this._snapValues={}}$S.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)},$S.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&jS(e[n],r[n],i)},$S.prototype.initDefaults=function(e){var t=this;IS(e||{},function(e,n){IS(e,function(e){t.add(n,e)})})};var GS=l.filter,WS=l.forEach,HS=l.debounce,VS=l.bind,qS=DS.mid,US=1250,YS=DS.isSnapped,KS=DS.setSnapped;function XS(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"],US,function(e){e.originalEvent&&e.originalEvent.ctrlKey||YS(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=HS(VS(this.hide,this),1e3)}XS.$inject=["eventBus","canvas"];var ZS=XS;XS.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new FS);var r=qS(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},XS.prototype.snap=function(e){var t=e.context,n=t.snapContext,i=t.shape,r=t.target,o=n.getSnapLocations();if(r){var a=n.pointsForTarget(r);a.initialized||(this.addTargetSnaps(a,i,r),a.initialized=!0);var s={x:YS(e,"x"),y:YS(e,"y")};WS(o,function(t){var i=n.getSnapOrigin(t),r={x:e.x+i.x,y:e.y+i.y};if(WS(["x","y"],function(e){var n;s[e]||void 0!==(n=a.snap(r,t,e,7))&&(s[e]={value:n,originValue:n-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),WS(["x","y"],function(t){var n=s[t];"object"==typeof n&&KS(e,t,n.originValue)})}},XS.prototype._createLine=function(t){var n=this._canvas.getLayer("snap"),i=s("path");return e(i,{d:"M0,0 L0,0"}),Ue(i).add("djs-snap-line"),re(n,i),{update:function(n){e(i,"number"!=typeof n?{display:"none"}:"horizontal"===t?{d:"M-100000,"+n+" L+100000,"+n,display:""}:{d:"M "+n+",-100000 L "+n+", +100000",display:""})}}},XS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},XS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},XS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},XS.prototype.hide=function(){WS(this._snapLines,function(e){e.update()})},XS.prototype.addTargetSnaps=function(e,t,n){var i=this.getSiblings(t,n);WS(i,function(t){e.add("mid",qS(t))})},XS.prototype.getSiblings=function(e,t){return t&&GS(t.children,function(t){return!t.hidden&&!t.labelTarget&&t.host!==e&&t!==e})};var QS=l.forEach,JS=l.assign,eT=lr.getBBox,tT=z.is,nT=Kc.isAny,iT=$.isExpanded,rT=Tc.asTRBL,oT=Math.round,aT=DS.mid,sT=DS.topLeft,cT=DS.bottomRight,pT=DS.isSnapped,lT=DS.setSnapped,uT=a_.getBoundaryAttachment,hT=a_.getParticipantSizeConstraints,dT=Xp.getLanesRoot,mT=1500;function fT(e,t,n,i){ZS.call(this,e,t),e.on("create.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();tT(i,"bpmn:Participant")&&tT(r,"bpmn:Process")&&vT(n,i,r.children)}),e.on(["create.move","create.end"],mT,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!pT(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=cT(e);a.x>=c.x?lT(n,"x",c.x+i+r):s.x<=p.x&&lT(n,"x",p.x-i-r);a.y>=c.y?lT(n,"y",c.y+o):s.y<=p.y&&lT(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();tT(i,"bpmn:Participant")&&tT(r,"bpmn:Process")&&vT(n,i,r.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],mT,function(e){var t=e.context,i=t.target,r=t.shape;i&&!pT(e)&&function(e,t,i){return"attach"===n.canAttach([e],t,null,i)}(r,i,e)&&function(e,t,n){var i=rT(n),r=uT(e,n);/top/.test(r)?lT(e,"y",i.top):/bottom/.test(r)&&lT(e,"y",i.bottom);/left/.test(r)?lT(e,"x",i.left):/right/.test(r)&&lT(e,"x",i.right)}(e,0,i)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],mT,function(e){var t=e.context.shape,n=e.hover;tT(n,"bpmn:Lane")&&!nT(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=dT(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],mT,function(e){var t=e.context,i=t.source,r=t.target,o=function(e,t){return n.canConnect(e,t)}(i,r)||{};t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition),r&&"bpmn:SequenceFlow"===o.type?(t.sourcePosition=aT(i),JS(e,aT(r))):t.sourcePosition=t.initialSourcePosition}),e.on("resize.start",mT,function(e){var t=e.context,n=t.shape;tT(n,"bpmn:SubProcess")&&iT(n)&&(t.minDimensions={width:140,height:120}),tT(n,"bpmn:Participant")&&(t.minDimensions={width:300,height:150}),(tT(n,"bpmn:Lane")||tT(n,"bpmn:Participant"))&&(t.resizeConstraints=hT(n,t.direction,t.balanced)),tT(n,"bpmn:TextAnnotation")&&(t.minDimensions={width:50,height:30})})}we(fT,ZS),fT.$inject=["eventBus","canvas","bpmnRules","elementRegistry"];var yT=fT;function vT(e,t,n){if(n.length){var i=eT(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}}fT.prototype.initSnap=function(e){var t,n,i,r,o,a=e.context,s=e.shape;o=ZS.prototype.initSnap.call(this,e),tT(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(t=aT(s,e),n={width:s.width,height:s.height,x:isNaN(s.x)?oT(t.x-s.width/2):s.x,y:isNaN(s.y)?oT(t.y-s.height/2):s.y},i=sT(n),r=cT(n),o.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),o.setSnapOrigin("bottom-right",{x:r.x-e.x,y:r.y-e.y}),QS(s.outgoing,function(t){var n=t.waypoints[0];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}),QS(s.incoming,function(t){var n=t.waypoints[t.waypoints.length-1];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}));var c=a.source;c&&o.addDefaultSnap("mid",aT(c))},fT.prototype.addTargetSnaps=function(e,t,n){tT(t,"bpmn:BoundaryEvent")&&"label"!==t.type&&(n=n.parent),tT(n,"bpmn:SequenceFlow")&&this.addTargetSnaps(e,t,n.parent);var i=this.getSiblings(t,n)||[];QS(i,function(t){tT(t,"bpmn:Lane")||(t.waypoints?QS(t.waypoints.slice(1,-1),function(n,i){var r=t.waypoints[i+2],o=t.waypoints[i];if(!r||!o)throw new Error("waypoints must exist");r.x!==n.x&&r.y!==n.y&&o.x!==n.x&&o.y!==n.y||e.add("mid",n)}):(e.add("mid",aT(t)),tT(t,"bpmn:Participant")&&(e.add("top-left",sT(t)),e.add("bottom-right",cT(t)))))}),QS(t.incoming,function(t){-1===i.indexOf(t.source)&&e.add("mid",aT(t.source));var n=t.waypoints[0];e.add(t.id+"-docking",n.original||n)}),QS(t.outgoing,function(t){-1===i.indexOf(t.target)&&e.add("mid",aT(t.target));var n=t.waypoints[t.waypoints.length-1];e.add(t.id+"-docking",n.original||n)})};var gT={__init__:["snapping"],snapping:["type",yT]},bT=l.assign;function xT(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=bT({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()})}xT.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"];var ET=xT;function _T(e,t,n){return t<e&&e<n}xT.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++)_T(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))},xT.prototype.stopScroll=function(){clearTimeout(this._scrolling)},xT.prototype.setOptions=function(e){this._opts=bT({},this._opts,e)},xT.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ma.toPoint(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var wT={__depends__:[Qu,Jh],__init__:["autoScroll"],autoScroll:["type",ET]},ST={},TT=ST.BENDPOINT_CLS="djs-bendpoint",CT=ST.SEGMENT_DRAGGER_CLS="djs-segment-dragger",AT=ee.rotate,RT=ee.translate;ST.toCanvasCoordinates=function(e,t){var n,i=ma.toPoint(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}},ST.addBendpoint=function(t,n){var i=s("g");Ue(i).add(TT),re(t,i);var r=s("circle");e(r,{cx:0,cy:0,r:4}),Ue(r).add("djs-visual"),re(i,r);var o=s("circle");return e(o,{cx:0,cy:0,r:10}),Ue(o).add("djs-hit"),re(i,o),n&&Ue(i).add(n),i},ST.addSegmentDragger=function(t,n,i){var r=s("g"),o=Hs.getMidPoint(n,i),a=Hs.pointsAligned(n,i);return re(t,r),function(t,n,i){var r=s("g");re(t,r);var o=s("rect");e(o,{x:-7,y:-1.5,width:14,height:3}),Ue(o).add("djs-visual"),re(r,o);var a=s("rect");e(a,{x:-10,y:-4.5,width:20,height:9}),Ue(a).add("djs-hit"),re(r,a),AT(r,"h"===i?90:0,0,0)}(r,0,a),Ue(r).add(CT),Ue(r).add("h"===a?"vertical":"horizontal"),RT(r,o.x,o.y),r};var PT="connect-ok",MT="connect-not-ok",kT="connect-hover",BT="djs-updating",NT="connection.updateWaypoints",DT="connection.reconnectStart",OT="connection.reconnectEnd",LT=Math.round,IT=ee.translate;function jT(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e){r.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,r,o){var a,s=t.waypoints,c=n.getGraphics(t);a={connection:t,bendpointIndex:r,insert:o,type:o||0!==r?o||r!==s.length-1?NT:OT:DT},i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:a}})},t.on("bendpoint.move.start",function(e){var t=e.context,i=t.connection,r=i.waypoints,o=r.slice(),a=t.insert,s=t.bendpointIndex;t.originalWaypoints=r,a&&o.splice(s,0,null),i.waypoints=o,t.draggerGfx=ST.addBendpoint(n.getLayer("overlays")),Ue(t.draggerGfx).add("djs-dragging"),n.addMarker(i,BT)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){n.addMarker(e.hover,kT);var i=t.allowed=o.allowed(t.type,t);i?(n.removeMarker(t.hover,MT),n.addMarker(t.hover,PT),t.target=t.hover):!1===i&&(n.removeMarker(t.hover,PT),n.addMarker(t.hover,MT),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(n.removeMarker(t,kT),n.removeMarker(t,e.context.target?PT:MT))}),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},s&&(i.hover&&(r===DT&&(t=i.hover),r===OT&&(n=i.hover)),o.waypoints=s.getCroppedWaypoints(o,t,n)),IT(i.draggerGfx,e.x,e.y),c(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,i=t.hover,r=t.connection;oe(t.draggerGfx),t.newWaypoints=r.waypoints.slice(),r.waypoints=t.originalWaypoints,n.removeMarker(r,BT),i&&(n.removeMarker(i,PT),n.removeMarker(i,MT))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],s=n.allowed;if(o.x=LT(o.x),o.y=LT(o.y),s&&n.type===DT)a.reconnectStart(n.connection,n.target,o);else if(s&&n.type===OT)a.reconnectEnd(n.connection,n.target,o);else{if(!1===s||n.type!==NT)return c(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},a.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],i=e[r+1],0===Hs.pointDistance(t,i)||Hs.pointsOnLine(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){c(e)})}jT.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var zT=jT,FT=l.assign,$T=l.forEach,GT=l.isArray,WT=Math.abs,HT=Math.round,VT=10;function qT(e){function t(e,t){if(GT(e)){for(var n=e.length;n--;)if(WT(e[n]-t)<=VT)return e[n]}else{var i=t%(e=+e);if(i<VT)return t-i;if(i>e-VT)return t-i+e}return t}function n(e){if(e.width)return{x:HT(e.width/2+e.x),y:HT(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var i,r,o=function(e){var t=e.snapPoints,i=e.connection,r=i.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,c=e.segmentEndIndex,p=e.axis;if(t)return t;var l=[r[a-1],o,s,r[c+1]];return a<2&&l.unshift(n(i.source)),c>r.length-3&&l.unshift(n(i.target)),e.snapPoints=t={horizontal:[],vertical:[]},$T(l,function(e){e&&(e=e.original||e,"y"===p&&t.horizontal.push(e.y),"x"===p&&t.vertical.push(e.x))}),t}(e.context),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));FT(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r})}}),e.on("bendpoint.move.move",1500,function(e){var i=e.context,r=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:[]},$T(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(i),o=i.target,a=o&&n(o),s=e.x,c=e.y;if(r){var p=s-t(a?r.vertical.concat([a.x]):r.vertical,s),l=c-t(a?r.horizontal.concat([a.y]):r.horizontal,c);FT(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l})}})}qT.$inject=["eventBus"];var UT=qT,YT=l.forEach,KT=Se.event,XT=Se.query,ZT=Se.queryAll,QT=Hs.pointsAligned,JT=Hs.getMidPoint,eC=ST.BENDPOINT_CLS,tC=ST.SEGMENT_DRAGGER_CLS,nC=hx.getApproxIntersection,iC=ee.translate;function rC(t,n,i,r,o){function a(e,t){var i=ST.toCanvasCoordinates(n,t);return nC(e,i)}function c(e,t){var n=t.waypoints,i=a(n,e);if(i)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(i=t[p-1],r=t[p],o=JT(i,r),a=QT(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(i,n,10)?r.start(e,t,i.index,!i.bendpoint):o.start(e,t,i.index),!0}function p(e,t,n){KT.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function l(t,i){var r=n.getLayer("overlays"),o=XT(".djs-bendpoints[data-element-id="+t.id+"]",r);return!o&&i&&(o=s("g"),e(o,{"data-element-id":t.id}),Ue(o).add("djs-bendpoints"),re(r,o),p(o,"mousedown",t),p(o,"click",t),p(o,"dblclick",t)),o}function u(e,t){t.waypoints.forEach(function(t,n){var i=ST.addBendpoint(e);re(e,i),iC(i,t.x,t.y)}),ST.addBendpoint(e,"floating")}function h(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)n=r[o-1],i=r[o],QT(n,i)&&ST.addSegmentDragger(e,n,i)}function d(e){var t=l(e);return t||(u(t=l(e,!0),e),h(t,e)),t}function m(e){var t=l(e);t&&(!function(e){YT(ZT("."+tC,e),function(e){oe(e)})}(t),function(e){YT(ZT("."+eC,e),function(e){oe(e)})}(t),h(t,e),u(t,e))}t.on("connection.changed",function(e){m(e.element)}),t.on("connection.remove",function(e){var t=l(e.element);t&&oe(t)}),t.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=d(n),e.add?Ue(t).add(e.marker):Ue(t).remove(e.marker))}),t.on("element.mousemove",function(e){var t,n,i,r=e.element,o=r.waypoints;if(o){if(t=l(r,!0),!(n=XT(".floating",t)))return;(i=a(o,e.originalEvent))&&iC(n,i.point.x,i.point.y)}}),t.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return c(t,n)}),t.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&d(t)}),t.on("element.hover",function(e){var t=e.element;t.waypoints&&(d(t),i.registerEvent(e.gfx,"mousemove","element.mousemove"))}),t.on("element.out",function(e){i.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),t.on("element.updateId",function(t){var n=t.element,i=t.newId;if(n.waypoints){var r=l(n);r&&e(r,{"data-element-id":i})}}),this.addHandles=d,this.updateHandles=m,this.getBendpointsContainer=l}rC.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var oC=rC,aC="connect-hover",sC="djs-updating",cC=ee.translate;function pC(e,t,n){return lC(e,t,e[t]+n)}function lC(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function uC(e){return"x"===e?"y":"x"}function hC(e,t,n){var i,r;return e.original?e.original:(i=Tc.getMid(t),lC(e,r=uC(n),i[r]))}function dC(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function p(e){r.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return lC(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],uC(e.axis));cC(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c=n.getGraphics(t),p=r-1,l=r,u=t.waypoints,h=u[p],d=u[l];(a=Hs.pointsAligned(h,d))&&(s="v"===a?"y":"x",0===p&&(h=hC(h,t.source,s)),l===u.length-1&&(d=hC(d,t.target,s)),o={connection:t,segmentStartIndex:p,segmentEndIndex:l,segmentStart:h,segmentEnd:d,axis:s},i.init(e,{x:(h.x+d.x)/2,y:(h.y+d.y)/2},"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=ST.addSegmentDragger(r,t.segmentStart,t.segmentEnd),Ue(t.draggerGfx).add("djs-dragging"),n.addMarker(i,sC)}),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,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),m=pC(s,h,e["d"+h]),f=pC(u,h,e["d"+h]),y=d.length,v=0;d[o]=m,d[a]=f,o<2&&(t=Tc.getOrientation(r.source,m),1===o?"intersect"===t&&(d.shift(),d[0]=m,v--):"intersect"!==t&&(d.unshift(s),v++)),a>y-3&&(n=Tc.getOrientation(r.target,f),a===y-2?"intersect"===n&&(d.pop(),d[d.length-1]=f):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=c(r,d),l(i,v,e),i.newSegmentStartIndex=o+v,p(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,n.addMarker(e.hover,aC)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&n.removeMarker(t,aC)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,i=t.connection;t.draggerGfx&&oe(t.draggerGfx),n.removeMarker(i,sC)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,o=function(e,t){var n=0;return{waypoints:e.filter(function(i,r){return!Hs.pointsOnLine(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}),segmentOffset:n}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),s=c(n,o.waypoints),p=o.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};a.updateWaypoints(n,s,l)})}dC.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var mC={__depends__:[Qu,th],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",oC],bendpointMove:["type",zT],connectionSegmentMove:["type",dC],bendpointSnapping:["type",UT]},fC=l.assign,yC=l.filter,vC=l.groupBy,gC=500,bC=1250,xC=1500,EC=ma.getOriginal,_C=Math.round;function wC(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i){if(!n.waypoints&&n.parent){var r=function(e){return{x:e.x+_C(e.width/2),y:e.y+_C(e.height/2)}}(n);return t.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:{}}}),!0}}e.on("shape.move.start",xC,function(e){var t,n,r=e.context,o=e.shape,a=i.get().slice();-1===a.indexOf(o)&&(a=[o]),n=vC(t=a,"id"),a=yC(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),fC(r,{shapes:a,validatedShapes:a,shape:o})}),e.on("shape.move.start",bC,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1}),e.on("shape.move.move",gC,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null}),e.on("shape.move.end",function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!r)return!1;i.x=_C(i.x),i.y=_C(i.y),n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})}),e.on("element.mousedown",function(e){var t=EC(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}),this.start=a}wC.$inject=["eventBus","dragging","modeling","selection","rules"];var SC=wC;var TC=l.flatten,CC=l.forEach,AC=l.filter,RC=l.find,PC=l.groupBy,MC=l.map,kC=l.matchPattern,BC=l.size,NC=ee.translate,DC=499,OC="djs-dragging",LC="drop-ok",IC="drop-not-ok",jC="new-parent",zC="attach-ok";function FC(t,n,i,r,o){function a(e){return function(e){return AC(e,function(t){return!function(e){return e.waypoints}(t)||RC(e,kC({id:t.source.id}))&&RC(e,kC({id:t.target.id}))})}(c(e))}function c(e){var t=lr.selfAndAllChildren(e,!0),n=MC(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return TC(t.concat(n),!0)}function p(e,t){[zC,LC,IC,jC].forEach(function(n){n===t?i.addMarker(e,n):i.removeMarker(e,n)})}t.on("shape.move.start",DC,function(t){var n=t.context,p=n.shapes,l=n.allDraggedElements,u=a(p);if(!n.dragGroup){var h=s("g");e(h,r.cls("djs-drag-group",["no-events"]));var d=i.getDefaultLayer();re(d,h),n.dragGroup=h}u.forEach(function(e){o.addDragger(e,n.dragGroup)}),l=l?TC(l,c(p)):c(p),CC(l,function(e){i.addMarker(e,OC)}),n.allDraggedElements=l,n.differentParents=1!==BC(PC(p,function(e){return e.parent&&e.parent.id}))}),t.on("shape.move.move",DC,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?p(i,zC):t.canExecute&&i&&i.id!==r.id?p(i,jC):p(i,t.canExecute?LC:IC)),NC(n,e.dx,e.dy)}),t.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&p(t,null)}),t.on("shape.move.cleanup",function(e){var t=e.context,n=t.allDraggedElements,r=t.dragGroup;CC(n,function(e){i.removeMarker(e,OC)}),r&&Za(r)}),this.makeDraggable=function(e,t,n){o.addDragger(t,e.dragGroup),n&&i.addMarker(t,OC),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}FC.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var $C={__depends__:[ka,Xa,Ia,th,Qu,Pm],__init__:["move","movePreview"],move:["type",SC],movePreview:["type",FC]};function GC(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}GC.$inject=["canvas","eventBus"];var WC=GC;GC.prototype.addBBoxMarker=function(t){var n={fill:"none",class:"outer-bound-marker"},i=s("rect");e(i,{x:-1e4,y:1e4,width:10,height:10}),e(i,n),re(t,i);var r=s("rect");e(r,{x:1e4,y:1e4,width:10,height:10}),e(r,n),re(t,r)};var HC={exports:{}};!function(e,t,n,i){"use strict";var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),s="function",c=Math.round,p=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(g(e,n),t)}function h(e,t,n){return!!Array.isArray(e)&&(d(e,n[t],n),!0)}function d(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m(function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e},"extend","Use `assign`."),y=m(function(e,t){return f(e,t,!0)},"merge","Use `assign`.");function v(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==s?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function E(e,t,n){d(T(t),function(t){e.addEventListener(t,n,!1)})}function _(e,t,n){d(T(t),function(t){e.removeEventListener(t,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function C(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,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];C(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function P(e,t){for(var n,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(n=o[s])?n+a:t)in e)return r;s++}return i}var M=1;function k(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var B="ontouchstart"in e,N=P(e,"PointerEvent")!==i,D=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O=25,L=1,I=2,j=4,z=8,F=1,$=2,G=4,W=8,H=16,V=$|G,q=W|H,U=V|q,Y=["x","y"],K=["clientX","clientY"];function X(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function Z(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=t&L&&r-o==0,s=t&(j|z)&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=Q(t));o>1&&!n.firstMultiple?n.firstMultiple=Q(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,u=t.center=J(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ie(c,u),t.distance=ne(c,u),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==L&&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 h=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=p(h.x)>p(h.y)?h.x:h.y,t.scale=s?(d=s.pointers,m=r,ne(m[0],m[1],K)/ne(d[0],d[1],K)):1,t.rotation=s?function(e,t){return ie(t[1],t[0],K)+ie(e[1],e[0],K)}(s.pointers,r):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,r,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=z&&(c>O||s.velocity===i)){var l=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,h=ee(c,l,u);r=h.x,o=h.y,n=p(h.x)>p(h.y)?h.x:h.y,a=te(l,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var d,m;var f=e.element;w(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(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:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:p(e)>=p(t)?e<0?$:G:t<0?W:H}function ne(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)}};var re={mousedown:L,mousemove:I,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}v(se,X,{handler:function(e){var t=re[e.type];t&L&&0===e.button&&(this.pressed=!0),t&I&&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:L,pointermove:I,pointerup:j,pointercancel:z,pointerout:z},pe={2:"touch",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=[]}e.MSPointerEvent&&!e.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),v(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="touch"==o,s=C(t,e.pointerId,"pointerId");r&L&&(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:L,touchmove:I,touchend:j,touchcancel:z},me="touchstart",fe="touchstart touchmove touchend touchcancel";function ye(){this.evTarget=me,this.evWin=fe,this.started=!1,X.apply(this,arguments)}v(ye,X,{handler:function(e){var t=de[e.type];if(t===L&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(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:"touch",srcEvent:e})}}});var ve={touchstart:L,touchmove:I,touchend:j,touchcancel:z},ge="touchstart touchmove touchend touchcancel";function be(){this.evTarget=ge,this.targetIds={},X.apply(this,arguments)}v(be,X,{handler:function(e){var t=ve[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(L|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===L)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;if(!s.length)return;return[R(o.concat(s),"identifier",!0),s]}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}});var xe=2500,Ee=25;function _e(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new be(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function we(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)},xe)}}v(_e,X,{handler:function(e,t,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,we.call(this,t)):e&(j|z)&&we.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Ee&&a<=Ee)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Se=P(a.style,"touchAction"),Te=Se!==i,Ce="auto",Ae="manipulation",Re="none",Pe="pan-x",Me="pan-y",ke=function(){if(!Te)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){t[i]=!n||e.CSS.supports("touch-action",i)}),t}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){"compute"==e&&(e=this.compute()),Te&&this.manager.element.style&&ke[e]&&(this.manager.element.style[Se]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(e){if(S(e,Re))return Re;var t=S(e,Pe),n=S(e,Me);if(t&&n)return Re;if(t||n)return t?Pe:Me;if(S(e,Ae))return Ae;return Ce}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Re)&&!ke[Re],o=S(i,Me)&&!ke[Me],a=S(i,Pe)&&!ke[Pe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&q?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ne=1,De=2,Oe=4,Le=8,Ie=Le,je=16;function ze(e){this.options=r({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Ne,this.simultaneous={},this.requireFail=[]}function Fe(e){return e&je?"cancel":e&Le?"end":e&Oe?"move":e&De?"start":""}function $e(e){return e==H?"down":e==W?"up":e==$?"left":e==G?"right":""}function Ge(e,t){var n=t.manager;return n?n.get(e):e}function We(){ze.apply(this,arguments)}function He(){We.apply(this,arguments),this.pX=null,this.pY=null}function Ve(){We.apply(this,arguments)}function qe(){ze.apply(this,arguments),this._timer=null,this._input=null}function Ue(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Ke(){ze.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Xe(e,t){return(t=t||{}).recognizers=x(t.recognizers,Xe.defaults.preset),new Ze(e,t)}ze.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ge(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)?this:(e=Ge(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===C(t,e=Ge(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Ge(e,this);var t=C(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<Le&&i(t.options.event+Fe(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=Le&&i(t.options.event+Fe(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Ne)))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);this.state&(Ie|je|32)&&(this.state=Ne),this.state=this.process(t),this.state&(De|Oe|Le|je)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(We,ze,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(De|Oe),r=this.attrTest(e);return i&&(n&z||!r)?t|je:i||r?n&j?t|Le:t&De?t|Oe:De:32}}),v(He,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:U},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Me),e&q&&t.push(Pe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&V?(r=0===o?F:o<0?$:G,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?F:a<0?W:H,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&De||!(this.state&De)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$e(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Ve,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&De)},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)}}),v(qe,ze,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},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&L)this.reset(),this._timer=u(function(){this.state=Ie,this.tryEmit()},t.time,this);else if(e.eventType&j)return Ie;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Ie&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),v(Ue,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&De)}}),v(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|q,pointers:1},getTouchAction:function(){return He.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|q)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&q&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&p(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=$e(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Ke,ze,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&L&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=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=u(function(){this.state=Ie,this.tryEmit()},t.interval,this),De):Ie}return 32},failTimeout:function(){return this._timer=u(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Ie&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[Ue,{enable:!1}],[Ve,{enable:!1},["rotate"]],[Ye,{direction:V}],[He,{direction:V},["swipe"]],[Ke],[Ke,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ze(e,t){var n;this.options=r({},Xe.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:D?be:B?_e:se))(n,Z),this.touchAction=new Be(this,this.options.touchAction),Qe(this,!0),d(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 Qe(e,t){var n,i=e.element;i.style&&(d(e.options.cssProps,function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""}),t||(e.oldCssProps={}))}Ze.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Ie)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(De|Oe|Le)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ze)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(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=C(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return d(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==i){var n=this.handlers;return d(T(e),function(e){t?n[e]&&n[e].splice(C(n[e],t),1):delete n[e]}),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var i=t.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=n,n.target.dispatchEvent(i)}(e,n);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](n),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Xe,{INPUT_START:L,INPUT_MOVE:I,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Ne,STATE_BEGAN:De,STATE_CHANGED:Oe,STATE_ENDED:Le,STATE_RECOGNIZED:Ie,STATE_CANCELLED:je,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:G,DIRECTION_UP:W,DIRECTION_DOWN:H,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:q,DIRECTION_ALL:U,Manager:Ze,Input:X,TouchAction:Be,TouchInput:be,MouseInput:se,PointerEventInput:he,TouchMouseInput:_e,SingleTouchInput:ye,Recognizer:ze,AttrRecognizer:We,Tap:Ke,Pan:He,Swipe:Ye,Pinch:Ve,Rotate:Ue,Press:qe,on:E,off:_,each:d,merge:y,extend:f,assign:r,inherit:v,bindFn:g,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Xe,HC.exports?HC.exports=Xe:e.Hammer=Xe}(window,document),HC=HC.exports;var VC=l.forEach,qC=Se.event,UC=Se.closest,YC=.2,KC=4,XC=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function ZC(e,t){return t.get(e,!1)}function QC(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function JC(e){function t(t){setTimeout(function(){VC(XC,function(t){qC.unbind(e,t,QC,!0)})},500)}qC.bind(e,"touchstart",function(t){VC(XC,function(t){qC.bind(e,t,QC,!0)})},!0),qC.bind(e,"touchend",t,!0),qC.bind(e,"touchcancel",t,!0);var n=new HC.Manager(e,{inputClass:HC.TouchInput,recognizers:[]}),i=new HC.Tap,r=new HC.Pan({threshold:10}),o=new HC.Press,a=new HC.Pinch,s=new HC.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout(function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null},0))},n.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&n.reset(!0)}),n}function eA(e,t,n,i,r){var o,a=ZC("dragging",e),s=ZC("move",e),c=ZC("contextPad",e),p=ZC("palette",e);function l(e){return function(t){r.fire(e,t)}}function u(e){return UC(e,"svg, .djs-element",!0)}function h(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=JC(e)).on("doubletap",l("element.dblclick")),o.on("tap",l("element.click")),o.on("panstart",n),o.on("press",n),o.on("pinchstart",function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(YC,Math.min(KC,r*n));t.zoom(o,i),QC(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)})}a&&n.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=ma.toPoint(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}}),c&&n.on("contextPad.create",function(e){var t=JC(e.pad.html);t.on("panstart",function(e){c.trigger("dragstart",e,!0)}),t.on("press",function(e){c.trigger("dragstart",e,!0)}),t.on("tap",function(e){c.trigger("click",e)})}),p&&n.on("palette.create",function(e){var t=JC(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),n.on("canvas.init",function(e){h(e.svg)})}eA.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"];var tA={__depends__:[{__depends__:[ka],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",eA],touchFix:["type",WC]}]},nA={};function iA(e){ms.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 we(iA,ms),(nA=iA).Viewer=ms,nA.NavigatedViewer=Ws,iA.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)},iA.prototype._createModdle=function(e){var t=ms.prototype._createModdle.call(this,e);return t.ids=new _e([32,36,1]),t},iA.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},iA.prototype._interactionModules=[As,tA,$s],iA.prototype._modelingModules=[wT,mC,$C,$f,Lp,cp,Km,wh,of,Gf,lS,AS,NS,gT],iA.prototype._modules=[].concat(iA.prototype._modules,iA.prototype._interactionModules,iA.prototype._modelingModules),nA});
1
+ /*! bpmn-js - bpmn-modeler v0.31.0 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */
2
+ !function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).BpmnJS=e()}}(function(){var e,t,n={exports:{}};e=this,t=function(e){"use strict";function t(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}function n(e,n){return n.appendChild(t(e,n)),e}var i=2,r={"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":i,"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":i,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function o(e,t,n){var o=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),a=r[o];a?(a===i&&"number"==typeof n&&(n=String(n)+"px"),e.style[o]=n):e.setAttributeNS(null,t,n)}function a(e,t,n){if("string"==typeof t){if(void 0===n)return function(e,t){return r[t]?e.style[t]:e.getAttributeNS(null,t)}(e,t);o(e,t,n)}else!function(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)o(e,i,t[i])}(e,t);return e}function s(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 c=/\s+/,p=Object.prototype.toString;function l(e){return void 0!==e}function u(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}function h(e){var t=e.parentNode;return t&&t.removeChild(e),e}function d(e){for(var t;t=e.firstChild;)h(t);return e}u.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~s(t,e)||t.push(e),l(this.el.className.baseVal)?this.el.className.baseVal=t.join(" "):this.el.className=t.join(" "),this},u.prototype.remove=function(e){if("[object RegExp]"===p.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),n=s(t,e);return~n&&t.splice(n,1),this.el.className.baseVal=t.join(" "),this},u.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},u.prototype.toggle=function(e,t){return this.list?(l(t)?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(l(t)?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},u.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(c);return""===e[0]&&e.shift(),e},u.prototype.has=u.prototype.contains=function(e){return this.list?this.list.contains(e):!!~s(this.array(),e)};var m={svg:"http://www.w3.org/2000/svg"},f='<svg xmlns="'+m.svg+'"';function y(e){return"<svg"===e.substring(0,4)?-1===e.indexOf(m.svg)&&(e=f+e.substring(4)):e=f+">"+e+"</svg>",function(e){var t;return(t=new DOMParser).async=!1,t.parseFromString(e,"text/xml")}(e)}function v(e,t){var n;return"<"===e.charAt(0)?(n=y(e).firstChild,n=document.importNode(n,!0)):n=document.createElementNS(m.svg,e),t&&a(n,t),n}var g=v("svg");function b(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}var x=/([&<>]{1})/g,E=/([\n\r"]{1})/g,_={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"'"};function w(e,t){return e.replace(t,function(e,t){return _[t]||t})}function S(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push(w(e.textContent,x));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,'="',w(o.value,E),'"');if(e.hasChildNodes()){for(t.push(">"),n=0,i=(a=e.childNodes).length;n<i;++n)S(a.item(n),t);t.push("</",e.tagName,">")}else t.push("/>");break;case 8:t.push("\x3c!--",w(e.nodeValue,x),"--\x3e");break;case 4:t.push("<![CDATA[",e.nodeValue,"]]>");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function T(e,t){return t instanceof SVGMatrix?e.createSVGTransformFromMatrix(t):t}e.append=function(e,t){return n(t,e),e},e.attr=a,e.classes=function(e){return new u(e)},e.clear=d,e.clone=function(e){return e.cloneNode(!0)},e.create=v,e.innerSVG=function(e,t){if(void 0!==t){try{!function(e,t){var i,r=y(t).documentElement;if(d(e),t)for(i=r.firstChild;i;)n(i,e),i=i.nextSibling}(e,t)}catch(e){throw new Error("error parsing SVG: "+e.message)}return e}return function(e){for(var t=e.firstChild,n=[];t;)S(t,n),t=t.nextSibling;return n.join("")}(e)},e.remove=h,e.transform=function(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(T(e,i));e.consolidate()}(n,t):n.initialize(T(n,t))},e.createMatrix=function(e,t,n,i,r,o){var a=g.createSVGMatrix();switch(arguments.length){case 0:return a;case 6:e={a:e,b:t,c:n,d:i,e:r,f:o}}return b(a,e)},e.createTransform=function(e){return e?g.createSVGTransformFromMatrix(e):g.createSVGTransform()},Object.defineProperty(e,"__esModule",{value:!0})},"object"==typeof n.exports?t(n.exports):t(e.TinySVG={});var i={},r=(n=n.exports).attr,o=n.create;function a(e){for(var t,n="",i=0;t=e[i];i++)n+=t.x+","+t.y+" ";return n}i.componentsToPath=function(e){return e.join(",").replace(/,?([A-z]),?/g,"$1")},i.createLine=function(e,t){var n=o("polyline");return r(n,{points:a(e)}),t&&r(n,t),n},i.updateLine=function(e,t){return r(e,{points:a(t)}),e};var s={exports:{}};!function(e,t){"object"==typeof s.exports?t(s.exports):t(e.MinDash={})}(this,function(e){"use strict";var t=Object.prototype.toString,n=Object.prototype.hasOwnProperty;function i(e){return null==e}function r(e){return"[object Array]"===t.call(e)}function o(e){return"[object Object]"===t.call(e)}function a(e){return"[object Function]"===t.call(e)}function s(e){if(!r(e))throw new Error("must supply array")}function c(e,t){return n.call(e,t)}function p(e,t){var n;return t=b(t),l(e,function(e,i){if(t(e,i))return n=e,!1}),n}function l(e,t){if(!i(e)){var n=r(e)?E:x;for(var o in e){if(c(e,o))if(!1===t(e[o],n(o)))return}}}function u(e,t,n){return l(e,function(e,i){n=t(n,e,i)}),n}function h(e,t){return u(e,function(e,n,i){return e&&t(n,i)},!0)}function d(e,t){var n=[];return l(e,function(e,i){n.push(t(e,i))}),n}function m(e){return e&&Object.keys(e)||[]}function f(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t=g(t),l(e,function(e){var i=t(e)||"_",r=n[i];r||(r=n[i]=[]),r.push(e)}),n}function y(e){e=g(e);for(var t={},n=arguments.length,i=Array(n>1?n-1:0),r=1;r<n;r++)i[r-1]=arguments[r];return l(i,function(n){return f(n,e,t)}),d(t,function(e,t){return e[0]})}var v=y;function g(e){return a(e)?e:function(t){return t[e]}}function b(e){return a(e)?e:function(t){return t===e}}function x(e){return e}function E(e){return Number(e)}var _=Array.prototype.slice;var w=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};e.flatten=function(e){return Array.prototype.concat.apply([],e)},e.find=p,e.findIndex=function(e,t){t=b(t);var n=r(e)?-1:void 0;return l(e,function(e,i){if(t(e,i))return n=i,!1}),n},e.filter=function(e,t){var n=[];return l(e,function(e,i){t(e,i)&&n.push(e)}),n},e.forEach=l,e.without=function(e,t){return i(e)?[]:(s(e),t=b(t),e.filter(function(e,n){return!t(e,n)}))},e.reduce=u,e.every=h,e.some=function(e,t){return!!p(e,t)},e.map=d,e.keys=m,e.size=function(e){return m(e).length},e.values=function(e){return d(e,function(e){return e})},e.groupBy=f,e.uniqueBy=y,e.unionBy=v,e.sortBy=function(e,t){t=g(t);var n=[];return l(e,function(e,i){for(var r=t(e,i),o={d:r,v:e},a=0;a<n.length;a++)if(r<n[a].d)return void n.splice(a,0,o);n.push(o)}),d(n,function(e){return e.v})},e.matchPattern=function(e){return function(t){return h(e,function(e,n){return t[n]===e})}},e.debounce=function(e,t){var n;return function(){var i=_.call(arguments);n&&clearTimeout(n),n=setTimeout(function(){e.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)}(i))},t)}},e.bind=function(e,t){return e.bind(t)},e.isArray=r,e.isObject=o,e.isNumber=function(e){return"[object Number]"===t.call(e)},e.isFunction=a,e.isString=function(e){return"[object String]"===t.call(e)},e.has=c,e.assign=function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),i=1;i<t;i++)n[i-1]=arguments[i];return w.apply(void 0,[e].concat(n))},e.pick=function(e,t){var n={},i=Object(e);return l(t,function(t){t in i&&(n[t]=e[t])}),n},e.omit=function(e,t){var n={};return l(Object(e),function(e,i){-1===t.indexOf(i)&&(n[i]=e)}),n},Object.defineProperty(e,"__esModule",{value:!0})});var c={},p=(s=s.exports).every,l=s.some,u=i.componentsToPath;function h(e){return e.businessObject.di}c.isTypedEvent=function(e,t,n){return l(e.eventDefinitions,function(i){return i.$type===t&&function(e,t){return p(t,function(t,n){return e[n]==t})}(e,n)})},c.isThrowEvent=function(e){return"bpmn:IntermediateThrowEvent"===e.$type||"bpmn:EndEvent"===e.$type},c.isCollection=function(e){var t=e.dataObjectRef;return e.isCollection||t&&t.isCollection},c.getDi=h,c.getSemantic=function(e){return e.businessObject},c.getFillColor=function(e,t){return h(e).get("bioc:fill")||t||"white"},c.getStrokeColor=function(e,t){return h(e).get("bioc:stroke")||t||"black"},c.getCirclePath=function(e){var t=e.x+e.width/2,n=e.y+e.height/2,i=e.width/2;return u([["M",t,n],["m",0,-i],["a",i,i,0,1,1,0,2*i],["a",i,i,0,1,1,0,-2*i],["z"]])},c.getRoundRectPath=function(e,t){var n=e.x,i=e.y,r=e.width,o=e.height;return u([["M",n+t,i],["l",r-2*t,0],["a",t,t,0,0,1,t,t],["l",0,o-2*t],["a",t,t,0,0,1,-t,t],["l",2*t-r,0],["a",t,t,0,0,1,-t,-t],["l",0,2*t-o],["a",t,t,0,0,1,t,-t],["z"]])},c.getDiamondPath=function(e){var t=e.width,n=e.height,i=e.x,r=e.y,o=t/2,a=n/2;return u([["M",i+o,r],["l",o,a],["l",-o,a],["l",-o,-a],["z"]])},c.getRectPath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return u([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])};var d={};function m(e){return e&&e.businessObject||e}d.is=function(e,t){var n=m(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)},d.getBusinessObject=m;var f={},y=d.is,v=d.getBusinessObject,g=s.forEach;function b(e,t){var n=v(e),i=!1;return n.eventDefinitions&&g(n.eventDefinitions,function(e){y(e,t)&&(i=!0)}),i}f.isExpanded=function(e){return!y(e,"bpmn:CallActivity")&&(y(e,"bpmn:SubProcess")?!!v(e).di.isExpanded:!y(e,"bpmn:Participant")||!!v(e).processRef)},f.isInterrupting=function(e){return e&&!1!==v(e).isInterrupting},f.isEventSubProcess=function(e){return e&&!!v(e).triggeredByEvent},f.hasErrorEventDefinition=function(e){return b(e,"bpmn:ErrorEventDefinition")},f.hasEscalationEventDefinition=function(e){return b(e,"bpmn:EscalationEventDefinition")},f.hasCompensateEventDefinition=function(e){return b(e,"bpmn:CompensateEventDefinition")};var x=1e3;function E(e,t){var n=this;t=t||x,e.on(["render.shape","render.connection"],t,function(e,t){var i=e.type,r=t.element,o=t.gfx;if(n.canRender(r))return"render.shape"===i?n.drawShape(o,r):n.drawConnection(o,r)}),e.on(["render.getShapePath","render.getConnectionPath"],t,function(e,t){if(n.canRender(t))return"render.getShapePath"===e.type?n.getShapePath(t):n.getConnectionPath(t)})}E.prototype.canRender=function(){},E.prototype.drawShape=function(){},E.prototype.drawConnection=function(){},E.prototype.getShapePath=function(){},E.prototype.getConnectionPath=function(){};var _=E,w={},S=n.transform,T=n.createTransform;w.transform=function(e,t,n,i,r){var o=T();o.setTranslate(t,n);var a=T();a.setRotate(i,0,0);var s=T();s.setScale(r||1,r||1),S(e,[o,a,s])},w.translate=function(e,t,n){var i=T();i.setTranslate(t,n),S(e,i)},w.rotate=function(e,t){var n=T();n.setRotate(t,0,0),S(e,n)};var C=s.isObject,A=s.assign,R=s.pick,P=s.forEach,M=s.reduce,k=n.append,B=n.attr,N=n.create,D=n.remove,O=0,L={width:150,height:50};function I(e,t){t.textContent=e;try{var n,i=""===e;return t.textContent=i?"dummy":e,n=R(t.getBBox(),["width","height"]),i&&(n.width=0),n}catch(e){return{width:0,height:0}}}function j(e,t,n){for(var i,r=e.shift(),o=r;;){if((i=I(o,n)).width=o?i.width:0," "===o||""===o||i.width<Math.round(t)||o.length<2)return z(e,o,r,i);o=F(o,i.width,t)}}function z(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 F(e,t,n){var i=Math.max(e.length*(n/t),1),r=function(e,t){var n,i=e.split(/(\s|-)/g),r=[],o=0;if(i.length>1)for(;n=i.shift();){if(!(n.length+o<t)){"-"===n&&r.pop();break}r.push(n),o+=n.length}return r.join("")}(e,i);return r||(r=e.slice(0,Math.max(Math.round(i-1),1))),r}function $(e){this._config=A({},{size:L,padding:O,style:{},align:"center-top"},e||{})}$.prototype.createText=function(e,t){return this.layoutText(e,t).element},$.prototype.getDimensions=function(e,t){return this.layoutText(e,t).dimensions},$.prototype.layoutText=function(e,t){var n=A({},this._config.size,t.box),i=A({},this._config.style,t.style),r=function(e){var t=e.split("-");return{horizontal:t[0]||"center",vertical:t[1]||"top"}}(t.align||this._config.align),o=function(e){return C(e)?A({top:0,left:0,right:0,bottom:0},e):{top:e,left:e,right:e,bottom:e}}(void 0!==t.padding?t.padding:this._config.padding),a=t.fitBox||!1,s=e.split(/\r?\n/g),c=[],p=n.width-o.left-o.right,l=N("text");B(l,{x:0,y:0}),B(l,i);var u=function(){var e=document.getElementById("helper-svg");return e||(e=N("svg"),B(e,{id:"helper-svg",width:0,height:0,style:"visibility: hidden; position: fixed"}),document.body.appendChild(e)),e}();for(k(u,l);s.length;)c.push(j(s,p,l));var h,d,m=M(c,function(e,t,n){return e+t.height},0),f=M(c,function(e,t,n){return t.width>e?t.width:e},0);switch(r.vertical){case"middle":h=(n.height-m)/2-c[0].height/4;break;default:h=o.top}var y=N("text");return B(y,i),P(c,function(e){switch(h+=e.height,r.horizontal){case"left":d=o.left;break;case"right":d=(a?f:p)-o.right-e.width;break;default:d=Math.max(((a?f:p)-e.width)/2+o.left,0)}var t=N("tspan");B(t,{x:d,y:h}),t.textContent=e.text,k(y,t)}),D(l),{dimensions:{width:f,height:m},element:y}};var G=$,W={},H=W=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)?H(e,t):o};function V(e){if(!(this instanceof V))return new V(e);e=e||[128,36,1],this._seed=e.length?W.rack(e[0],e[1],e[2]):e}H.rack=function(e,t,n){var i=function(i){var o=0;do{if(o++>10){if(!n)throw new Error("too many ID collisions, use more bits");e+=n}var a=H(e,t)}while(Object.hasOwnProperty.call(r,a));return r[a]=i,a},r=i.hats={};return i.get=function(e){return i.hats[e]},i.set=function(e,t){return i.hats[e]=t,i},i.bits=e||128,i.base=t||16,i};var q=V;V.prototype.next=function(e){return this._seed(e||!0)},V.prototype.nextPrefixed=function(e,t){var n;do{n=e+this.next(!0)}while(this.assigned(n));return this.claim(n,t),n},V.prototype.claim=function(e,t){this._seed.set(e,t||!0)},V.prototype.assigned=function(e){return this._seed.get(e)||!1},V.prototype.unclaim=function(e){delete this._seed.hats[e]},V.prototype.clear=function(){var e,t=this._seed.hats;for(e in t)this.unclaim(e)};var U={};U="function"==typeof Object.create?function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e};var Y={exports:{}};!function(e,t){"object"==typeof Y.exports?t(Y.exports):t(e.MinDom={})}(this,function(e){"use strict";var t=[].indexOf,n=function(e,n){if(t)return e.indexOf(n);for(var i=0;i<e.length;++i)if(e[i]===n)return i;return-1},i=/\s+/,r=Object.prototype.toString;function o(e){if(!e||!e.nodeType)throw new Error("A DOM element reference is required");this.el=e,this.list=e.classList}o.prototype.add=function(e){if(this.list)return this.list.add(e),this;var t=this.array();return~n(t,e)||t.push(e),this.el.className=t.join(" "),this},o.prototype.remove=function(e){if("[object RegExp]"==r.call(e))return this.removeMatching(e);if(this.list)return this.list.remove(e),this;var t=this.array(),i=n(t,e);return~i&&t.splice(i,1),this.el.className=t.join(" "),this},o.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},o.prototype.toggle=function(e,t){return this.list?(void 0!==t?t!==this.list.toggle(e,t)&&this.list.toggle(e):this.list.toggle(e),this):(void 0!==t?t?this.add(e):this.remove(e):this.has(e)?this.remove(e):this.add(e),this)},o.prototype.array=function(){var e=(this.el.getAttribute("class")||"").replace(/^\s+|\s+$/g,"").split(i);return""===e[0]&&e.shift(),e},o.prototype.has=o.prototype.contains=function(e){return this.list?this.list.contains(e):!!~n(this.array(),e)};var a=Element.prototype,s=a.matchesSelector||a.webkitMatchesSelector||a.mozMatchesSelector||a.msMatchesSelector||a.oMatchesSelector,c=function(e,t){if(s)return s.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 p,l=function(e,t,n){for(var i=n?e:e.parentNode;i&&i!==document;){if(c(i,t))return i;i=i.parentNode}},u=window.addEventListener?"addEventListener":"attachEvent",h=window.removeEventListener?"removeEventListener":"detachEvent",d="addEventListener"!==u?"on":"",m={bind:function(e,t,n,i){return e[u](d+t,n,i||!1),n},unbind:function(e,t,n,i){return e[h](d+t,n,i||!1),n}},f=["focus","blur"],y={bind:function(e,t,n,i,r){return-1!==f.indexOf(n)&&(r=!0),m.bind(e,n,function(n){var r=n.target||n.srcElement;n.delegateTarget=l(r,t,!0),n.delegateTarget&&i.call(e,n)},r)},unbind:function(e,t,n,i){-1!==f.indexOf(t)&&(i=!0),m.unbind(e,t,n,i)}},v=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=b[i]||b._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},g=!1;"undefined"!=typeof document&&((p=document.createElement("div")).innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>',g=!p.getElementsByTagName("link").length,p=void 0);var b={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:g?[1,"X<div>","</div>"]:[0,"",""]};b.td=b.th=[3,"<table><tbody><tr>","</tr></tbody></table>"],b.option=b.optgroup=[1,'<select multiple="multiple">',"</select>"],b.thead=b.tbody=b.colgroup=b.caption=b.tfoot=[1,"<table>","</table>"],b.polyline=b.ellipse=b.polygon=b.circle=b.text=b.line=b.path=b.rect=b.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var x="undefined"!=typeof Element?Element.prototype:{},E=x.matches||x.matchesSelector||x.webkitMatchesSelector||x.mozMatchesSelector||x.msMatchesSelector||x.oMatchesSelector,_=function(e,t){if(!e||1!==e.nodeType)return!1;if(E)return E.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i<n.length;i++)if(n[i]==e)return!0;return!1};e.attr=function(e,t,n){return 2==arguments.length?e.getAttribute(t):null===n?e.removeAttribute(t):(e.setAttribute(t,n),e)},e.classes=function(e){return new o(e)},e.clear=function(e){for(var t;e.childNodes.length;)t=e.childNodes[0],e.removeChild(t);return e},e.closest=l,e.delegate=y,e.domify=v,e.event=m,e.matches=_,e.query=function(e,t){return(t=t||document).querySelector(e)},e.queryAll=function(e,t){return(t=t||document).querySelectorAll(e)},e.remove=function(e){e.parentNode&&e.parentNode.removeChild(e)},Object.defineProperty(e,"__esModule",{value:!0})}),Y=Y.exports;var K=s.isObject,X=s.assign,Z=s.forEach,Q=d.is,J=i.createLine,ee=c.isTypedEvent,te=c.isThrowEvent,ne=c.isCollection,ie=c.getDi,re=c.getSemantic,oe=c.getCirclePath,ae=c.getRoundRectPath,se=c.getDiamondPath,ce=c.getRectPath,pe=c.getFillColor,le=c.getStrokeColor,ue=Y.query,he=n.append,de=n.attr,me=n.create,fe=n.classes,ye=w.rotate,ve=w.transform,ge=w.translate,be=new q,xe=10,Ee=3,_e={fontFamily:"Arial, sans-serif",fontSize:12},we=.95,Se=.35;function Te(e,t,n,i,r){_.call(this,e,r);var o=be.next(),a=new G({style:_e,size:{width:100}}),s={},c=t.computeStyle;function p(e,t){var n=X({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),r=t.ref||{x:0,y:0},o=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var a=me("marker");de(t.element,n),he(a,t.element),de(a,{id:e,viewBox:"0 0 20 20",refX:r.x,refY:r.y,markerWidth:20*o,markerHeight:20*o,orient:"auto"});var c=ue("defs",i._svg);c||(c=me("defs"),he(i._svg,c)),he(c,a),s[e]=a}function l(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;return s[i]||function(e,t,n){var i=e+"-"+t+"-"+n+"-"+o;if("sequenceflow-end"===e){var r=me("path");de(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),p(i,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:n,stroke:n}})}if("messageflow-start"===e){var a=me("circle");de(a,{cx:6,cy:6,r:3.5}),p(i,{element:a,attrs:{fill:t,stroke:n},ref:{x:6,y:6}})}if("messageflow-end"===e){var s=me("path");de(s,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),p(i,{element:s,attrs:{fill:t,stroke:n,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===e){var c=me("path");de(c,{d:"M 11 5 L 1 10 L 11 15"}),p(i,{element:c,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===e){var l=me("path");de(l,{d:"M 1 5 L 11 10 L 1 15"}),p(i,{element:l,attrs:{fill:"none",stroke:n,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===e){var u=me("path");de(u,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),p(i,{element:u,attrs:{fill:t,stroke:n},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===e){var h=me("path");de(h,{d:"M 6 4 L 10 16"}),p(i,{element:h,attrs:{stroke:n},ref:{x:0,y:10},scale:.5})}}(e,t,n),"url(#"+i+")"}function u(e,t,n,i,r){K(i)&&(r=i,i=0),i=i||0,r=c(r,{stroke:"black",strokeWidth:2,fill:"white"});var o=t/2,a=n/2,s=me("circle");return de(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),de(s,r),he(e,s),s}function h(e,t,n,i,r,o){K(r)&&(o=r,r=0),r=r||0,o=c(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=me("rect");return de(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),de(a,o),he(e,a),a}function d(e,t,n){n=c(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"});var i=J(t,n);return he(e,i),i}function m(e,t,n){n=c(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=me("path");return de(i,{d:t}),de(i,n),he(e,i),i}function y(e,t,n,i){return m(t,n,X({"data-marker":e},i))}function v(e){return function(t,n){return T[e](t,n)}}function g(e){return T[e]}function b(e,t){var n=re(e),i=te(n);return ee(n,"bpmn:MessageEventDefinition")?g("bpmn:MessageEventDefinition")(t,e,i):ee(n,"bpmn:TimerEventDefinition")?g("bpmn:TimerEventDefinition")(t,e,i):ee(n,"bpmn:ConditionalEventDefinition")?g("bpmn:ConditionalEventDefinition")(t,e):ee(n,"bpmn:SignalEventDefinition")?g("bpmn:SignalEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!1})?g("bpmn:MultipleEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")&&ee(n,"bpmn:TerminateEventDefinition",{parallelMultiple:!0})?g("bpmn:ParallelMultipleEventDefinition")(t,e,i):ee(n,"bpmn:EscalationEventDefinition")?g("bpmn:EscalationEventDefinition")(t,e,i):ee(n,"bpmn:LinkEventDefinition")?g("bpmn:LinkEventDefinition")(t,e,i):ee(n,"bpmn:ErrorEventDefinition")?g("bpmn:ErrorEventDefinition")(t,e,i):ee(n,"bpmn:CancelEventDefinition")?g("bpmn:CancelEventDefinition")(t,e,i):ee(n,"bpmn:CompensateEventDefinition")?g("bpmn:CompensateEventDefinition")(t,e,i):ee(n,"bpmn:TerminateEventDefinition")?g("bpmn:TerminateEventDefinition")(t,e,i):null}function x(e,t,n){var i=a.createText(t||"",n);return fe(i).add("djs-label"),he(e,i),i}function E(e,t,n){return x(e,re(t).name,{box:t,align:n,padding:5,style:{fill:le(t)}})}function w(e,t,n){var i=x(e,t,{box:{height:30,width:n.height},align:"center-middle",style:{fill:le(n)}}),r=-1*n.height;ve(i,0,-r,270)}function S(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=we),u(e,t.width,t.height,n)},"bpmn:StartEvent":function(e,t){var n={fill:pe(t),stroke:le(t)};re(t).isInterrupting||(n={strokeDasharray:"6",strokeLinecap:"round"});var i=g("bpmn:Event")(e,t,n);return b(t,e),i},"bpmn:MessageEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MESSAGE",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.235,my:.315}}),{strokeWidth:1,fill:i?le(t):pe(t),stroke:i?pe(t):le(t)})},"bpmn:TimerEventDefinition":function(e,t){var i=u(e,t.width,t.height,.2*t.height,{strokeWidth:2,fill:pe(t),stroke:le(t)});m(e,n.getScaledPath("EVENT_TIMER_WH",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),{strokeWidth:2,strokeLinecap:"square",stroke:le(t)});for(var r=0;r<12;r++){var o=n.getScaledPath("EVENT_TIMER_LINE",{xScaleFactor:.75,yScaleFactor:.75,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.5}}),a=t.width/2;m(e,o,{strokeWidth:1,strokeLinecap:"square",transform:"rotate("+30*r+","+t.height/2+","+a+")",stroke:le(t)})}return i},"bpmn:EscalationEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ESCALATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ConditionalEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_CONDITIONAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.222}}),{strokeWidth:1,stroke:le(t)})},"bpmn:LinkEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_LINK",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.57,my:.263}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:ErrorEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_ERROR",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.2,my:.722}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:CancelEventDefinition":function(e,t,i){var r=m(e,n.getScaledPath("EVENT_CANCEL_45",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.638,my:-.055}}),{strokeWidth:1,fill:i?"black":"none"});return ye(r,45),r},"bpmn:CompensateEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.22,my:.5}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:SignalEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_SIGNAL",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:t.width,containerHeight:t.height,position:{mx:.5,my:.2}}),{strokeWidth:1,fill:i?le(t):"none",stroke:le(t)})},"bpmn:MultipleEventDefinition":function(e,t,i){return m(e,n.getScaledPath("EVENT_MULTIPLE",{xScaleFactor:1.1,yScaleFactor:1.1,containerWidth:t.width,containerHeight:t.height,position:{mx:.222,my:.36}}),{strokeWidth:1,fill:i?"black":"none"})},"bpmn:ParallelMultipleEventDefinition":function(e,t){return m(e,n.getScaledPath("EVENT_PARALLEL_MULTIPLE",{xScaleFactor:1.2,yScaleFactor:1.2,containerWidth:t.width,containerHeight:t.height,position:{mx:.458,my:.194}}),{strokeWidth:1,fill:le(t),stroke:le(t)})},"bpmn:EndEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:4,fill:pe(t),stroke:le(t)});return b(t,e),n},"bpmn:TerminateEventDefinition":function(e,t){return u(e,t.width,t.height,8,{strokeWidth:4,fill:le(t),stroke:le(t)})},"bpmn:IntermediateEvent":function(e,t){var n=g("bpmn:Event")(e,t,{strokeWidth:1,fill:pe(t),stroke:le(t)});return u(e,t.width,t.height,Ee,{strokeWidth:1,fill:pe(t,"none"),stroke:le(t)}),b(t,e),n},"bpmn:IntermediateCatchEvent":v("bpmn:IntermediateEvent"),"bpmn:IntermediateThrowEvent":v("bpmn:IntermediateEvent"),"bpmn:Activity":function(e,t,n){return"fillOpacity"in(n=n||{})||(n.fillOpacity=we),h(e,t.width,t.height,xe,n)},"bpmn:Task":function(e,t){var n={fill:pe(t),stroke:le(t)},i=g("bpmn:Activity")(e,t,n);return E(e,t,"center-middle"),C(e,t),i},"bpmn:ServiceTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:12,y:18}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE_FILL",{abspos:{x:17.2,y:18}}),{strokeWidth:0,fill:pe(t)}),m(e,n.getScaledPath("TASK_TYPE_SERVICE",{abspos:{x:17,y:22}}),{strokeWidth:1,fill:pe(t),stroke:le(t)}),i},"bpmn:UserTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_USER_1",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_2",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),m(e,n.getScaledPath("TASK_TYPE_USER_3",{abspos:{x:15,y:12}}),{strokeWidth:.5,fill:le(t),stroke:le(t)}),i},"bpmn:ManualTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_MANUAL",{abspos:{x:17,y:15}}),{strokeWidth:.5,fill:pe(t),stroke:le(t)}),i},"bpmn:SendTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:1,yScaleFactor:1,containerWidth:21,containerHeight:14,position:{mx:.285,my:.357}}),{strokeWidth:1,fill:le(t),stroke:pe(t)}),i},"bpmn:ReceiveTask":function(e,t){var i,r=re(t),o=g("bpmn:Task")(e,t);return r.instantiate?(u(e,28,28,4.4,{strokeWidth:1}),i=n.getScaledPath("TASK_TYPE_INSTANTIATING_SEND",{abspos:{x:7.77,y:9.52}})):i=n.getScaledPath("TASK_TYPE_SEND",{xScaleFactor:.9,yScaleFactor:.9,containerWidth:21,containerHeight:14,position:{mx:.3,my:.4}}),m(e,i,{strokeWidth:1,fill:pe(t),stroke:le(t)}),o},"bpmn:ScriptTask":function(e,t){var i=g("bpmn:Task")(e,t);return m(e,n.getScaledPath("TASK_TYPE_SCRIPT",{abspos:{x:15,y:20}}),{strokeWidth:1,stroke:le(t)}),i},"bpmn:BusinessRuleTask":function(e,t){var i=g("bpmn:Task")(e,t),r=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_HEADER",{abspos:{x:8,y:8}}));de(r,{strokeWidth:1,fill:pe(t,"#aaaaaa"),stroke:le(t)});var o=m(e,n.getScaledPath("TASK_TYPE_BUSINESS_RULE_MAIN",{abspos:{x:8,y:8}}));return de(o,{strokeWidth:1,stroke:le(t)}),i},"bpmn:SubProcess":function(e,t,n){n=X({fill:pe(t),stroke:le(t)},n);var i=g("bpmn:Activity")(e,t,n),r=f.isExpanded(t);return f.isEventSubProcess(t)&&de(i,{strokeDasharray:"1,2"}),E(e,t,r?"center-top":"center-middle"),r?C(e,t):C(e,t,["SubProcessMarker"]),i},"bpmn:AdHocSubProcess":function(e,t){return g("bpmn:SubProcess")(e,t)},"bpmn:Transaction":function(e,n){var i=g("bpmn:SubProcess")(e,n),r=t.style(["no-fill","no-events"],{stroke:le(n)});return h(e,n.width,n.height,xe-2,Ee,r),i},"bpmn:CallActivity":function(e,t){return g("bpmn:SubProcess")(e,t,{strokeWidth:5})},"bpmn:Participant":function(e,t){var n={fillOpacity:we,fill:pe(t),stroke:le(t)},i=g("bpmn:Lane")(e,t,n);f.isExpanded(t)?(d(e,[{x:30,y:0},{x:30,y:t.height}],{stroke:le(t)}),w(e,re(t).name,t)):x(e,re(t).name,{box:t,align:"center-middle",style:{fill:le(t)}});return!!re(t).participantMultiplicity&&g("ParticipantMultiplicityMarker")(e,t),i},"bpmn:Lane":function(e,t,n){var i=h(e,t.width,t.height,0,X({fill:pe(t),fillOpacity:Se,stroke:le(t)},n)),r=re(t);"bpmn:Lane"===r.$type&&w(e,r.name,t);return i},"bpmn:InclusiveGateway":function(e,t){var n=g("bpmn:Gateway")(e,t);return u(e,t.width,t.height,.24*t.height,{strokeWidth:2.5,fill:pe(t),stroke:le(t)}),n},"bpmn:ExclusiveGateway":function(e,t){var i=g("bpmn:Gateway")(e,t),r=n.getScaledPath("GATEWAY_EXCLUSIVE",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.32,my:.3}});return ie(t).isMarkerVisible&&m(e,r,{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ComplexGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_COMPLEX",{xScaleFactor:.5,yScaleFactor:.5,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.26}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:ParallelGateway":function(e,t){var i=g("bpmn:Gateway")(e,t);return m(e,n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.6,yScaleFactor:.6,containerWidth:t.width,containerHeight:t.height,position:{mx:.46,my:.2}}),{strokeWidth:1,fill:le(t),stroke:le(t)}),i},"bpmn:EventBasedGateway":function(e,t){var i=re(t),r=g("bpmn:Gateway")(e,t);u(e,t.width,t.height,.2*t.height,{strokeWidth:1,fill:"none",stroke:le(t)});var o=i.eventGatewayType,a=!!i.instantiate;if("Parallel"===o){var s=n.getScaledPath("GATEWAY_PARALLEL",{xScaleFactor:.4,yScaleFactor:.4,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),c=m(e,s);de(c,{strokeWidth:1,fill:"none"})}else if("Exclusive"===o){if(!a){var p=u(e,t.width,t.height,.26*t.height);de(p,{strokeWidth:1,fill:"none",stroke:le(t)})}!function(){var i=n.getScaledPath("GATEWAY_EVENT_BASED",{xScaleFactor:.18,yScaleFactor:.18,containerWidth:t.width,containerHeight:t.height,position:{mx:.36,my:.44}}),r={strokeWidth:2,fill:pe(t,"none"),stroke:le(t)};m(e,i,r)}()}return r},"bpmn:Gateway":function(e,t){var n={fill:pe(t),fillOpacity:we,stroke:le(t)};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=c(i,{stroke:"black",strokeWidth:2,fill:"white"});var s=me("polygon");return de(s,{points:a}),de(s,i),he(e,s),s}(e,t.width,t.height,n)},"bpmn:SequenceFlow":function(e,t){var n,i=S(t),r=pe(t),o=le(t),a=m(e,i,{strokeLinejoin:"round",markerEnd:l("sequenceflow-end",r,o),stroke:le(t)}),s=re(t);return t.source&&(n=t.source.businessObject,s.conditionExpression&&n.$instanceOf("bpmn:Activity")&&de(a,{markerStart:l("conditional-flow-marker",r,o)}),n.default&&(n.$instanceOf("bpmn:Gateway")||n.$instanceOf("bpmn:Activity"))&&n.default===s&&de(a,{markerStart:l("conditional-default-flow-marker",r,o)})),a},"bpmn:Association":function(e,t,n){var i=re(t),r=pe(t),o=le(t);return n=X({strokeDasharray:"0.5, 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:le(t)},n||{}),"One"!==i.associationDirection&&"Both"!==i.associationDirection||(n.markerEnd=l("association-end",r,o)),"Both"===i.associationDirection&&(n.markerStart=l("association-start",r,o)),d(e,t.waypoints,n)},"bpmn:DataInputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:DataOutputAssociation":function(e,t){var n=pe(t),i=le(t);return g("bpmn:Association")(e,t,{markerEnd:l("association-end",n,i)})},"bpmn:MessageFlow":function(e,t){var i=re(t),r=ie(t),o=pe(t),a=le(t),s=m(e,S(t),{markerEnd:l("messageflow-end",o,a),markerStart:l("messageflow-start",o,a),strokeDasharray:"10, 12",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"1.5px",stroke:le(t)});if(i.messageRef){var c=s.getPointAtLength(s.getTotalLength()/2),p=n.getScaledPath("MESSAGE_FLOW_MARKER",{abspos:{x:c.x,y:c.y}}),u={strokeWidth:1};"initiating"===r.messageVisibleKind?(u.fill="white",u.stroke="black"):(u.fill="#888",u.stroke="white"),m(e,p,u)}return s},"bpmn:DataObject":function(e,t){var i=m(e,n.getScaledPath("DATA_OBJECT_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.474,my:.296}}),{fill:pe(t),fillOpacity:we,stroke:le(t)}),r=re(t);return ne(r)&&function(e,t){var i=(t.height-16)/t.height,r=n.getScaledPath("DATA_OBJECT_COLLECTION_PATH",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:.451,my:i}});m(e,r,{strokeWidth:2})}(e,t),i},"bpmn:DataObjectReference":v("bpmn:DataObject"),"bpmn:DataInput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1}),r},"bpmn:DataOutput":function(e,t){var i=n.getRawPath("DATA_ARROW"),r=g("bpmn:DataObject")(e,t);return m(e,i,{strokeWidth:1,fill:"black"}),r},"bpmn:DataStoreReference":function(e,t){return m(e,n.getScaledPath("DATA_STORE",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:.133}}),{strokeWidth:2,fill:pe(t),fillOpacity:we,stroke:le(t)})},"bpmn:BoundaryEvent":function(e,t){var n=re(t).cancelActivity,i={strokeWidth:1,fill:pe(t),stroke:le(t),fillOpacity:1};n||(i.strokeDasharray="6",i.strokeLinecap="round");var r=g("bpmn:Event")(e,t,i);return u(e,t.width,t.height,Ee,X(i,{fill:"none"})),b(t,e),r},"bpmn:Group":function(e,t){return h(e,t.width,t.height,xe,{strokeWidth:1,strokeDasharray:"8,3,1,3",fill:"none",pointerEvents:"none"})},label:function(e,t){return function(e,t){var n=re(t),i={width:90,height:30,x:t.width/2+t.x,y:t.height/2+t.y};return x(e,n.name,{box:i,fitBox:!0,style:{fontSize:"11px"}})}(e,t)},"bpmn:TextAnnotation":function(e,t){var i=h(e,t.width,t.height,0,0,{fill:"none",stroke:"none"});return m(e,n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:0,my:0}}),{stroke:le(t)}),x(e,re(t).text||"",{box:t,align:"left-top",padding:5}),i},ParticipantMultiplicityMarker:function(e,t){y("participant-multiplicity",e,n.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}}))},SubProcessMarker:function(e,t){var i=h(e,14,14,0,{strokeWidth:1,fill:pe(t),stroke:le(t)});ge(i,t.width/2-7.5,t.height-20),y("sub-process",e,n.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:pe(t),stroke:le(t)})},ParallelMarker:function(e,t,i){y("parallel",e,n.getScaledPath("MARKER_PARALLEL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.parallel)/t.width,my:(t.height-20)/t.height}}))},SequentialMarker:function(e,t,i){y("sequential",e,n.getScaledPath("MARKER_SEQUENTIAL",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.seq)/t.width,my:(t.height-19)/t.height}}))},CompensationMarker:function(e,t,i){y("compensation",e,n.getScaledPath("MARKER_COMPENSATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.compensation)/t.width,my:(t.height-13)/t.height}}),{strokeWidth:1})},LoopMarker:function(e,t,i){y("loop",e,n.getScaledPath("MARKER_LOOP",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.loop)/t.width,my:(t.height-7)/t.height}}),{strokeWidth:1,fill:"none",strokeLinecap:"round",strokeMiterlimit:.5})},AdhocMarker:function(e,t,i){y("adhoc",e,n.getScaledPath("MARKER_ADHOC",{xScaleFactor:1,yScaleFactor:1,containerWidth:t.width,containerHeight:t.height,position:{mx:(t.width/2+i.adhoc)/t.width,my:(t.height-15)/t.height}}),{strokeWidth:1,fill:"black"})}};function C(e,t,n){var i,r=re(t),o=n&&-1!==n.indexOf("SubProcessMarker");i=o?{seq:-21,parallel:-22,compensation:-42,loop:-18,adhoc:10}:{seq:-3,parallel:-6,compensation:-27,loop:0,adhoc:10},Z(n,function(n){g(n)(e,t,i)}),r.isForCompensation&&g("CompensationMarker")(e,t,i),"bpmn:AdHocSubProcess"===r.$type&&g("AdhocMarker")(e,t,i);var a=r.loopCharacteristics,s=a&&a.isSequential;a&&(void 0===s&&g("LoopMarker")(e,t,i),!1===s&&g("ParallelMarker")(e,t,i),!0===s&&g("SequentialMarker")(e,t,i))}this._drawPath=m}U(Te,_),Te.$inject=["eventBus","styles","pathMap","canvas"];var Ce=Te;Te.prototype.canRender=function(e){return Q(e,"bpmn:BaseElement")},Te.prototype.drawShape=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.drawConnection=function(e,t){var n=t.type;return(0,this.handlers[n])(e,t)},Te.prototype.getShapePath=function(e){return Q(e,"bpmn:Event")?oe(e):Q(e,"bpmn:Activity")?ae(e,xe):Q(e,"bpmn:Gateway")?se(e):ce(e)};var Ae=function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];t.abspos?(n=t.abspos.x,i=t.abspos.y):(n=t.containerWidth*t.position.mx,i=t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;l<r.heightElements.length;l++)s["y"+l]=r.heightElements[l]*c;for(var u=0;u<r.widthElements.length;u++)s["x"+u]=r.widthElements[u]*p}return o=r.d,a={mx:n,my:i,e:s},String(o).replace(Re,function(e,t){return function(e,t,n){var i=n;return t.replace(Pe,function(e,t,n,r,o){t=t||r,i&&(t in i&&(i=i[t]),"function"==typeof i&&o&&(i=i()))}),i=(null==i||i==n?e:i)+""}(e,t,a)})}},Re=/\{([^}]+)\}/g,Pe=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Me={__init__:["bpmnRenderer"],bpmnRenderer:["type",Ce],pathMap:["type",Ae]},ke={elementToString:function(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':"<null>"}},Be={},Ne=s.assign,De=d.is,Oe=Be.DEFAULT_LABEL_SIZE={width:90,height:20},Le=15;function Ie(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)],r=je(e),o=Math.atan((i.y-n.y)/(i.x-n.x)),a=r.x,s=r.y;return Math.abs(o)<Math.PI/2?s-=Le:a+=Le,{x:a,y:s}}function je(e){var t=e.length/2-1,n=e[Math.floor(t)],i=e[Math.ceil(t+.01)];return{x:n.x+(i.x-n.x)/2,y:n.y+(i.y-n.y)/2}}function ze(e){return e.waypoints?Ie(e.waypoints):{x:e.x+e.width/2,y:e.y+e.height+Oe.height/2}}Be.hasExternalLabel=function(e){return De(e,"bpmn:Event")||De(e,"bpmn:Gateway")||De(e,"bpmn:DataStoreReference")||De(e,"bpmn:DataObjectReference")||De(e,"bpmn:SequenceFlow")||De(e,"bpmn:MessageFlow")},Be.getExternalLabelMid=ze,Be.getExternalLabelBounds=function(e,t){var n,i,r,o=e.di.label;return o&&o.bounds?(r=o.bounds,i={width:Math.max(Oe.width,r.width),height:r.height},n={x:r.x+r.width/2,y:r.y+r.height/2}):(n=ze(t),i=Oe),Ne({x:n.x-i.width/2,y:n.y-i.height/2},i)};var Fe=s.assign,$e=s.map,Ge=d.is,We=Be.hasExternalLabel,He=Be.getExternalLabelBounds,Ve=f.isExpanded,qe=ke.elementToString;function Ue(e,t){return Fe({id:e.id,type:e.$type,businessObject:e},t)}function Ye(e,t,n,i){return new Error(e("element {element} referenced by {referenced}#{property} not yet drawn",{element:qe(n),referenced:qe(t),property:i}))}function Ke(e,t,n,i,r){this._eventBus=e,this._canvas=t,this._elementFactory=n,this._elementRegistry=i,this._translate=r,this._textUtil=new G}Ke.$inject=["eventBus","canvas","elementFactory","elementRegistry","translate"];var Xe=Ke;Ke.prototype.add=function(e,t){var n,i,r,o,a=e.di,s=this._translate;if(Ge(a,"bpmndi:BPMNPlane"))n=this._elementFactory.createRoot(Ue(e)),this._canvas.setRootElement(n);else if(Ge(a,"bpmndi:BPMNShape")){var c=!Ve(e);i=t&&(t.hidden||t.collapsed);var p=e.di.bounds;n=this._elementFactory.createShape(Ue(e,{collapsed:c,hidden:i,x:Math.round(p.x),y:Math.round(p.y),width:Math.round(p.width),height:Math.round(p.height)})),Ge(e,"bpmn:BoundaryEvent")&&this._attachBoundary(e,n),Ge(e,"bpmn:Lane")&&(r=0),this._canvas.addShape(n,t,r)}else{if(!Ge(a,"bpmndi:BPMNEdge"))throw new Error(s("unknown di {di} for element {semantic}",{di:qe(a),semantic:qe(e)}));var l=this._getSource(e),u=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Ue(e,{hidden:i,source:l,target:u,waypoints:(o=e.di.waypoint,$e(o,function(e){return{x:e.x,y:e.y}}))})),Ge(e,"bpmn:DataAssociation")&&(t=null),Ge(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return We(e)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Ke.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:qe(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Ye(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Ke.prototype.addLabel=function(e,t){var n,i,r;return n=He(e,t),(i=e.name)&&(n=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ze});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(n,i,this._textUtil)),r=this._elementFactory.createLabel(Ue(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)},Ke.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?Ye(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:qe(e),side:t}))},Ke.prototype._getSource=function(e){return this._getEnd(e,"source")},Ke.prototype._getTarget=function(e){return this._getEnd(e,"target")},Ke.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var Ze={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Qe={translate:["value",function(e,t){return t=t||{},e.replace(/{([^}]+)}/g,function(e,n){return t[n]||"{"+n+"}"})}]},Je={__depends__:[Me,{__depends__:[Qe],bpmnImporter:["type",Xe]}]},et={};function tt(e,t,n){Object.defineProperty(n,t.name,{enumerable:t.enumerable,value:et.extend(n[t.name]||[],e,t,n)})}function nt(e,t){if(!(this instanceof nt))return new nt(e,t);e.inverse=t,t.inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}et.extend=function(e,t,n,i){var r=n.inverse;return Object.defineProperty(e,"remove",{value:function(e){var n=this.indexOf(e);return-1!==n&&(this.splice(n,1),t.unset(e,r,i)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e){this.contains(e)||(this.push(e),t.set(e,r,i))}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},et.isExtended=function(e){return!0===e.__refs_collection},nt.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}t.collection?tt(this,t,e):function(e,t,n){var i=t.inverse,r=n[t.name];Object.defineProperty(n,t.name,{enumerable:t.enumerable,get:function(){return r},set:function(t){if(t!==r){var o=r;r=null,o&&e.unset(o,i,n),r=t,e.set(r,i,n)}}})}(this,t,e)},nt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return et.isExtended(n)||tt(this,t,e),n},nt.prototype.ensureBound=function(e,t){(function(e,t){return Object.prototype.hasOwnProperty.call(e,t.name||t)})(e,t)||this.bind(e,t)},nt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},nt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var it={};(it=nt).Collection=et;var rt=s.filter,ot=s.find,at=s.forEach,st=ke.elementToString,ct=new it({name:"bpmnElement",enumerable:!0},{name:"di"});function pt(e,t){return e.$instanceOf(t)}var lt=function(e,t){var n={},i=[];function r(e,t){return function(n){e(n,t)}}function o(e){n[e.id]=e}function a(n,i){try{var r=n.di&&function(n,i){if(n.gfx)throw new Error(t("already rendered {element}",{element:st(n)}));return e.element(n,i)}(n,i);return o(n),r}catch(e){s(e.message,{element:n,error:e}),console.error(t("failed to import {element}",{element:st(n)})),console.error(e)}}function s(t,n){e.error(t,n)}function c(e){var n=e.bpmnElement;n?n.di?s(t("multiple DI elements defined for {element}",{element:st(n)}),{element:n}):(ct.bind(n,"di"),n.di=e):s(t("no bpmnElement referenced in {element}",{element:st(e)}),{element:e})}function p(e){var t;c(t=e.plane),at(t.planeElement,l)}function l(e){c(e)}function u(e,t){w(e,t),g(e.ioSpecification,t),v(e.artifacts,t),o(e)}function h(e,t){a(e,t)}function d(e,t){a(e,t)}function m(e,t){a(e,t)}function f(e,t){a(e,t)}function y(e,t){a(e,t)}function v(e,t){at(e,function(e){pt(e,"bpmn:Association")?i.push(function(){y(e,t)}):y(e,t)})}function g(e,t){e&&(at(e.dataInputs,r(m,t)),at(e.dataOutputs,r(f,t)))}function b(e,t){var n=a(e,t);pt(e,"bpmn:SubProcess")&&function(e,t){w(e,t),v(e.artifacts,t)}(e,n||t),pt(e,"bpmn:Activity")&&g(e.ioSpecification,t),i.push(function(){at(e.dataInputAssociations,r(d,t)),at(e.dataOutputAssociations,r(d,t))})}function x(e,t){a(e,t)}function E(e,t){i.push(function(){var n=a(e,t);e.childLaneSet&&_(e.childLaneSet,n||t),function(e){at(e.flowNodeRef,function(t){var n=t.get("lanes");n&&n.push(e)})}(e)})}function _(e,t){at(e.lanes,r(E,t))}function w(e,n){!function(e,n){at(e,function(e){pt(e,"bpmn:SequenceFlow")?i.push(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:BoundaryEvent")?i.unshift(function(){!function(e,t){a(e,t)}(e,n)}):pt(e,"bpmn:FlowNode")?b(e,n):pt(e,"bpmn:DataObject")||(pt(e,"bpmn:DataStoreReference")?x(e,n):pt(e,"bpmn:DataObjectReference")?x(e,n):s(t("unrecognized flowElement {element} in context {context}",{element:st(e),context:n?st(n.businessObject):"null"}),{element:e,context:n}))})}(e.flowElements,n),e.laneSets&&function(e,t){at(e,r(_,t))}(e.laneSets,n)}function S(e,t){var n=a(e,t),i=e.processRef;i&&u(i,n||t)}return{handleDefinitions:function(o,a){var l=o.diagrams;if(a&&-1===l.indexOf(a))throw new Error(t("diagram not part of bpmn:Definitions"));if(!a&&l&&l.length&&(a=l[0]),!a)throw new Error(t("no diagram to display"));p(a);var d=a.plane;if(!d)throw new Error(t("no plane for {element}",{element:st(a)}));var m=d.bpmnElement;if(!m){if(!(m=function(e){return ot(e.rootElements,function(e){return pt(e,"bpmn:Process")||pt(e,"bpmn:Collaboration")})}(o)))throw new Error(t("no process or collaboration to display"));s(t("correcting missing bpmnElement on {plane} to {rootElement}",{plane:st(d),rootElement:st(m)})),d.bpmnElement=m,c(d)}var f,y,g=function(t,n){return e.root(t,n)}(m,d);if(pt(m,"bpmn:Process"))u(m,g);else{if(!pt(m,"bpmn:Collaboration"))throw new Error(t("unsupported bpmnElement for {plane}: {rootElement}",{plane:st(d),rootElement:st(m)}));at((y=m).participants,r(S)),v(y.artifacts),i.push(function(){var e,t;e=y.messageFlows,at(e,r(h,t))}),f=o.rootElements,rt(f,function(e){return!n[e.id]&&pt(e,"bpmn:Process")&&e.laneSets}).forEach(r(u))}!function(e){for(;e.length;)e.shift()()}(i)}}},ut={};ut.importBpmnDiagram=function(e,t,n){var i,r,o,a,s=[];try{i=e.get("bpmnImporter"),r=e.get("eventBus"),o=e.get("translate"),r.fire("import.render.start",{definitions:t}),function(e){new lt({root:function(e){return i.add(e)},element:function(e,t){return i.add(e,t)},error:function(e,t){s.push({message:e,context:t})}},o).handleDefinitions(e)}(t),r.fire("import.render.complete",{error:a,warnings:s})}catch(e){a=e}n(a,s)};var ht={},dt=Y.domify,mt=Y.delegate,ft='<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>'))+'" />';function yt(e){return e.join(";")}var vt,gt='<div class="bjs-powered-by-lightbox" style="'+yt(["z-index: 1001","position: fixed","top: 0","left: 0","right: 0","bottom: 0"])+'"><div class="backdrop" style="'+yt(["width: 100%","height: 100%","background: rgba(0,0,0,0.2)"])+'"></div><div class="notice" style="'+yt(["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">'+ft+'</a>Web-based tooling for BPMN, DMN and CMMN diagrams powered by <a href="http://bpmn.io" target="_blank">bpmn.io</a>.</div></div>';ht.open=function(){vt||(vt=dt(gt),mt.bind(vt,".backdrop","click",function(e){document.body.removeChild(vt)})),document.body.appendChild(vt)},ht.BPMNIO_IMG=ft;var bt={};bt.hasLowerCaseAlias=function(e){return e.xml&&"lowerCase"===e.xml.tagAlias},bt.DEFAULT_NS_MAP={xsi:"http://www.w3.org/2001/XMLSchema-instance"};var xt=bt.XSI_TYPE="xsi:type";function Et(e){return e.xml&&e.xml.serialize}function _t(){}bt.serializeAsType=function(e){return Et(e)===xt},bt.serializeAsProperty=function(e){return"property"===Et(e)},_t.prototype.get=function(e){return this.$model.properties.get(this,e)},_t.prototype.set=function(e,t){this.$model.properties.set(this,e,t)};var wt=_t,St=s.forEach,Tt=s.bind;function Ct(e,t){this.model=e,this.properties=t}var At=Ct;Ct.prototype.createType=function(e){var t=this.model,n=this.properties,i=Object.create(wt.prototype);St(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}),St(e,Tt(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 Rt={};function Pt(e){this.model=e}Rt.parseName=function(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}};var Mt=Pt;function kt(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}Pt.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:kt(e,i,n):e.$attrs[t]=n},Pt.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&&kt(e,n,[]),e[i]},Pt.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},Pt.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},Pt.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})};var Bt=s.pick,Nt=s.assign,Dt=s.forEach,Ot=s.bind,Lt=Rt.parseName;function It(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}var jt=It;It.prototype.build=function(){return Bt(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},It.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)},It.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},It.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=Lt(r[0],i),a=Lt(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},It.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},It.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},It.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},It.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},It.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")},It.prototype.hasProperty=function(e){return this.propertiesByName[e]},It.prototype.addTrait=function(e,t){var n=this.allTypesByName,i=this.allTypes,r=e.name;r in n||(Dt(e.properties,Ot(function(n){n=Nt({},n,{name:n.ns.localName,inherited:t}),Object.defineProperty(n,"definedBy",{value:e});var i=n.replaces,r=n.redefines;i||r?this.redefineProperty(n,i||r,i):(n.isBody&&this.setBodyProperty(n),n.isId&&this.setIdProperty(n),this.addProperty(n))},this)),i.push(e),n[r]=e)};var zt={},Ft={String:!0,Boolean:!0,Integer:!0,Real:!0,Element:!0},$t={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)}};zt.coerceType=function(e,t){var n=$t[e];return n?n(t):t},zt.isBuiltIn=function(e){return!!Ft[e]},zt.isSimple=function(e){return!!$t[e]};var Gt=s.assign,Wt=s.forEach,Ht=s.bind,Vt=Rt.parseName,qt=zt.isBuiltIn;function Ut(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,Wt(e,Ht(this.registerPackage,this))}var Yt=Ut;function Kt(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}Ut.prototype.getPackage=function(e){return this.packageMap[e]},Ut.prototype.getPackages=function(){return this.packages},Ut.prototype.registerPackage=function(e){e=Gt({},e);var t=this.packageMap;Kt(t,e,"prefix"),Kt(t,e,"uri"),Wt(e.types,Ht(function(t){this.registerType(t,e)},this)),t[e.uri]=t[e.prefix]=e,this.packages.push(e)},Ut.prototype.registerType=function(e,t){e=Gt({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:Gt(e.meta||{})});var n=Vt(e.name,t.prefix),i=n.name,r={};Wt(e.properties,Ht(function(e){var t=Vt(e.name,n.prefix),i=t.name;qt(e.type)||(e.type=Vt(e.type,t.prefix).name),Gt(e,{ns:t,name:i}),r[i]=e},this)),Gt(e,{ns:n,name:i,propertiesByName:r}),Wt(e.extends,Ht(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(i)},this)),this.definePackage(e,t),this.typeMap[i]=e},Ut.prototype.mapTypes=function(e,t,n){var i=qt(e.name)?{name:e.name}:this.typeMap[e.name],r=this;function o(e){return a(e,!0)}function a(n,i){var o=Vt(n,qt(n)?"":e.prefix);r.mapTypes(o,t,i)}if(!i)throw new Error("unknown type <"+e.name+">");Wt(i.superClass,n?o:a),t(i,!n),Wt(i.traits,o)},Ut.prototype.getEffectiveDescriptor=function(e){var t=Vt(e),n=new jt(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},Ut.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})};var Xt=s.isString,Zt=s.isObject,Qt=s.forEach,Jt=Rt.parseName;function en(e){this.properties=new Mt(this),this.factory=new At(this,this.properties),this.registry=new Yt(e,this.properties),this.typeCache={}}var tn=en;en.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},en.prototype.getType=function(e){var t=this.typeCache,n=Xt(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},en.prototype.createAny=function(e,t,n){var i=Jt(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}),Qt(n,function(e,t){Zt(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},en.prototype.getPackage=function(e){return this.registry.getPackage(e)},en.prototype.getPackages=function(){return this.registry.getPackages()},en.prototype.getElementDescriptor=function(e){return e.$descriptor},en.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},en.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},en.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var nn=tn,rn={exports:{}};!function(e,t){"object"==typeof rn.exports?t(rn.exports):t(e.Saxen={})}(this,function(e){"use strict";var t=String.fromCharCode,n=Object.prototype.hasOwnProperty,i=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,r={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function o(e,i,o,a){return a?n.call(r,a)?r[a]:"&"+a+";":t(i||parseInt(o,16))}function a(e){return e.length>3&&-1!==e.indexOf("&")?e.replace(i,o):e}Object.keys(r).forEach(function(e){r[e.toUpperCase()]=r[e]});var s="http://www.w3.org/2001/XMLSchema-instance",c="xsi",p="xsi:type";function l(e){return new Error(e)}function u(e){return"missing namespace for prefix <"+e+">"}function h(e){return{get:e,enumerable:!0}}function d(e){var t,n={};for(t in e)n[t]=e[t];return n}function m(e){return e+"$uri"}function f(){return{line:0,column:0}}function y(e){throw e}e.Parser=function e(t){if(!this)return new e(t);var n,i,r,o,v,g,b,x,E,_=t&&t.proxy,w=y,S=f,T=!1,C=!1,A=null,R=!1;function P(e){e instanceof Error||(e=l(e)),A=e,w(e,S)}function M(e){v&&(e instanceof Error||(e=l(e)),v(e,S))}this.on=function(e,t){if("function"!=typeof t)throw l("required args <name, cb>");switch(e){case"openTag":i=t;break;case"text":n=t;break;case"closeTag":r=t;break;case"error":w=t;break;case"warn":v=t;break;case"cdata":o=t;break;case"attention":x=t;break;case"question":b=t;break;case"comment":g=t;break;default:throw l("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw l("required args <nsMap={}>");var t,n={};for(t in e)n[t]=e[t];return n[s]=c,C=!0,E=n,this},this.parse=function(e){if("string"!=typeof e)throw l("required args <xml=string>");return A=null,function(e){var t,s,c,l,f,y,v,w,A,k,B=C?[]:null,N=C?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[m(n)]=t;return i}(E):null,D=[],O=0,L=!1,I=!1,j=0,z=0,F="",$=0;function G(){if(null!==k)return k;var e,t,n,i,r,o,s,c,l,h,f,y=C&&N.xmlns,v=C&&T?[]:null,g=$,b=F,x=b.length,_={},w={};e:for(;g<x;g++)if(l=!1,!(32===(h=b.charCodeAt(g))||h<14&&h>8)){for((h<65||h>122||h>90&&h<97)&&95!==h&&58!==h&&(M("illegal first char attribute name"),l=!0),f=g+1;f<x;f++)if(!((h=b.charCodeAt(f))>96&&h<123||h>64&&h<91||h>47&&h<59||46===h||45===h||95===h)){if(32===h||h<14&&h>8){M("missing attribute value"),g=f;continue e}if(61===h)break;M("illegal attribute name char"),l=!0}if("xmlns:xmlns"===(c=b.substring(g,f))&&(M("illegal declaration of xmlns"),l=!0),34===(h=b.charCodeAt(f+1)))-1===(f=b.indexOf('"',g=f+2))&&-1!==(f=b.indexOf("'",g))&&(M("attribute value quote missmatch"),l=!0);else if(39===h)-1===(f=b.indexOf("'",g=f+2))&&-1!==(f=b.indexOf('"',g))&&(M("attribute value quote missmatch"),l=!0);else for(M("missing attribute value quotes"),l=!0,f+=1;f<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++);for(-1===f&&(M("missing closing quotes"),f=x,l=!0),l||(o=b.substring(g,f)),g=f;f+1<x&&!(32===(h=b.charCodeAt(f+1))||h<14&&h>8);f++)g===f&&(M("illegal character after attribute end"),l=!0);if(g=f+1,!l)if(c in w)M("attribute <"+c+"> already defined");else if(w[c]=!0,C)if(T){if(null!==(r="xmlns"===c?"xmlns":120===c.charCodeAt(0)&&"xmlns:"===c.substr(0,6)?c.substr(6):null)){if(e=a(o),t=m(r),!(s=E[e])){if("xmlns"===r||t in N&&N[t]!==e)do{s="ns"+O++}while(void 0!==N[s]);else s=r;E[e]=s}N[r]!==s&&(i||(N=d(N),i=!0),N[r]=s,"xmlns"===r&&(N[m(s)]=e,y=s),N[t]=e),_[c]=o;continue}v.push(c,o)}else-1!==(h=c.indexOf(":"))?(n=N[c.substring(0,h)])?((c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o),_[c]=o):M(u(c.substring(0,h))):_[c]=o;else _[c]=o}if(T)for(g=0,x=v.length;g<x;g++){if(c=v[g++],o=v[g],-1!==(h=c.indexOf(":"))){if(!(n=N[c.substring(0,h)])){M(u(c.substring(0,h)));continue}(c=y===n?c.substr(h+1):n+c.substr(h))===p&&(-1!==(h=o.indexOf(":"))?(n=o.substring(0,h),n=N[n]||n,o=n+o.substring(h)):o=y+":"+o)}_[c]=o}return k=_}for(S=function(){for(var t,n,i=/(\r\n|\r|\n)/g,r=0,o=0,a=0,s=z;j>=a&&(t=i.exec(e))&&!((s=t[0].length+t.index)>j);)r+=1,a=s;return-1==j?(o=s,n=""):(o=j-a,n=-1==z?e.substring(j):e.substring(j,z+1)),{data:n,line:r,column:o}},_&&(A=Object.create({},{name:h(function(){return v}),originalName:h(function(){return w}),attrs:h(G),ns:h(function(){return N})}));-1!==z;){if(-1===(j=60===e.charCodeAt(z)?z:e.indexOf("<",z)))return D.length?P("unexpected end of file"):0===z?P("missing start tag"):void 0;if(z!==j&&n&&(n(e.substring(z,j),a,S),R))return;if(33!==(f=e.charCodeAt(j+1)))if(63!==f){if(-1==(z=e.indexOf(">",j+1)))return P("unclosed tag");if(k={},47===f){if(L=!1,I=!0,!D.length)return P("missing open tag");if(s=v=D.pop(),l=j+2+s.length,e.substring(j+2,l)!==s)return P("closing tag mismatch");for(;l<z;l++)if(!(32===(f=e.charCodeAt(l))||f>8&&f<14))return P("close tag")}else{if(47===e.charCodeAt(z-1)?(s=v=e.substring(j+1,z-1),L=!0,I=!0):(s=v=e.substring(j+1,z),L=!0,I=!1),!(f>96&&f<123||f>64&&f<91||95===f||58===f))return P("illegal first char nodeName");for(l=1,c=s.length;l<c;l++)if(!((f=s.charCodeAt(l))>96&&f<123||f>64&&f<91||f>47&&f<59||45===f||95===f)){if(32===f||f<14&&f>8){v=s.substring(0,l),k=null;break}return P("invalid nodeName")}I||D.push(v)}if(C){if(t=N,L&&(I||B.push(t),null===k&&(T=-1!==s.indexOf("xmlns",l))&&($=l,F=s,G(),T=!1)),w=v,-1!==(f=v.indexOf(":"))){if(!(y=N[v.substring(0,f)]))return P("missing namespace on <"+w+">");v=v.substr(f+1)}else y=N.xmlns;y&&(v=y+":"+v)}if(L&&($=l,F=s,i&&(_?i(A,a,I,S):i(v,G,a,I,S),R)))return;if(I){if(r&&(r(_?A:v,a,L,S),R))return;C&&(N=L?t:B.pop())}z+=1}else{if(-1===(z=e.indexOf("?>",j)))return P("unclosed question");if(b&&(b(e.substring(j,z+2),S),R))return;z+=2}else{if(91===(f=e.charCodeAt(j+2))&&"CDATA["===e.substr(j+3,6)){if(-1===(z=e.indexOf("]]>",j)))return P("unclosed cdata");if(o&&(o(e.substring(j+9,z),S),R))return;z+=3;continue}if(45===f&&45===e.charCodeAt(j+3)){if(-1===(z=e.indexOf("--\x3e",j)))return P("unclosed comment");if(g&&(g(e.substring(j+4,z),a,S),R))return;z+=3;continue}if(-1===(z=e.indexOf(">",j+1)))return P("unclosed tag");if(x&&(x(e.substring(j,z+1),a,S),R))return;z+=1}}}(e),S=f,R=!1,A},this.stop=function(){R=!0}},Object.defineProperty(e,"__esModule",{value:!0})}),rn=rn.exports;var on={};!function(e){"use strict";function t(){this.data=[null],this.top=0}function n(){return new t}t.prototype.clear=function(){return this.data=[null],this.top=0,this},t.prototype.length=function(){return this.top},t.prototype.peek=function(){return this.data[this.top]},t.prototype.pop=function(){return this.top>0?(this.top--,this.data.pop()):void 0},t.prototype.push=function(e){return this.data[++this.top]=e,this},void 0!==on?on=n:e.stack=n}(this);var an={},sn=s.forEach,cn=s.find,pn=s.assign,ln=rn.Parser,un=Rt.parseName,hn=zt.coerceType,dn=zt.isSimple,mn=bt.XSI_TYPE,fn=bt.serializeAsType,yn=bt.hasLowerCaseAlias;function vn(e,t){return yn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function gn(e){return new Error(e)}function bn(e){return e.$descriptor}function xn(){}function En(){}function _n(){}function wn(e,t){this.property=e,this.context=t}function Sn(e,t){this.element=t,this.propertyDesc=e}function Tn(){}function Cn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function An(e,t,n){Cn.call(this,e,t,n)}function Rn(e,t,n){this.model=e,this.context=n}function Pn(e){e instanceof nn&&(e={model:e}),pn(this,{lax:!1},e)}xn.prototype.handleEnd=function(){},xn.prototype.handleText=function(){},xn.prototype.handleNode=function(){},En.prototype=Object.create(xn.prototype),En.prototype.handleNode=function(){return this},_n.prototype=Object.create(xn.prototype),_n.prototype.handleText=function(e){this.body=(this.body||"")+e},wn.prototype=Object.create(_n.prototype),wn.prototype.handleNode=function(e){if(this.element)throw gn("expected no sub nodes");return this.element=this.createReference(e),this},wn.prototype.handleEnd=function(){this.element.id=this.body},wn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},Sn.prototype=Object.create(_n.prototype),Sn.prototype.handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=hn(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},Tn.prototype=Object.create(_n.prototype),Tn.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},Cn.prototype=Object.create(Tn.prototype),Cn.prototype.addReference=function(e){this.context.addReference(e)},Cn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=bn(t).bodyProperty;n&&void 0!==e&&(e=hn(n.type,e),t.set(n.name,e))},Cn.prototype.createElement=function(e){var t=e.attributes,n=this.type,i=bn(n),r=this.context,o=new n({});return sn(t,function(e,t){var n,a=i.propertiesByName[t];a&&a.isReference?a.isMany?(n=e.split(" "),sn(n,function(e){r.addReference({element:o,property:a.ns.name,id:e})})):r.addReference({element:o,property:a.ns.name,id:e}):(a&&(e=hn(a.type,e)),o.set(t,e))}),o},Cn.prototype.getPropertyForNode=function(e){var t,n,i=e.name,r=un(i),o=this.type,a=this.model,s=bn(o),c=r.name,p=s.propertiesByName[c];if(p)return fn(p)&&(t=e.attributes[mn])?(t=function(e,t){var n=un(e);return function(e,t){var n=e.name,i=e.localName,r=t.xml&&t.xml.typePrefix;return r&&0===i.indexOf(r)?e.prefix+":"+i.slice(r.length):n}(n,t.getPackage(n.prefix))}(t,a),n=a.getType(t),pn({},p,{effectiveType:bn(n).name})):p;var l=a.getPackage(r.prefix);if(l){if(t=vn(r,l),n=a.getType(t),p=cn(s.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return pn({},p,{effectiveType:bn(n).name})}else if(p=cn(s.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return p;throw gn("unrecognized element <"+r.name+">")},Cn.prototype.toString=function(){return"ElementDescriptor["+bn(this.type).name+"]"},Cn.prototype.valueHandler=function(e,t){return new Sn(e,t)},Cn.prototype.referenceHandler=function(e){return new wn(e,this.context)},Cn.prototype.handler=function(e){return"Element"===e?new Rn(this.model,e,this.context):new Cn(this.model,e,this.context)},Cn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,n=t.effectiveType||t.type,dn(n))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?(pn(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},An.prototype=Object.create(Cn.prototype),An.prototype.createElement=function(e){var t=e.name,n=un(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&vn(n,o)||t;if(!r.hasType(a))throw gn("unexpected element <"+e.originalName+">");return Cn.prototype.createElement.call(this,e)},Rn.prototype=Object.create(Tn.prototype),Rn.prototype.createElement=function(e){var t=e.name,n=un(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},Rn.prototype.handleChild=function(e){var t=new Rn(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},Rn.prototype.handleText=function(e){this.body=this.body||""+e},Rn.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},Pn.prototype.fromXML=function(e,t,n){var i=t.rootHandler;t instanceof Cn?(i=t,t={}):"string"==typeof t?(i=this.handler(t),t={}):"string"==typeof i&&(i=this.handler(i));var r=this.model,o=this.lax,a=new function(e){pn(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw gn("expected element");var t,n=this.elementsById,i=bn(e).idProperty;if(i&&(t=e.get(i.name))){if(n[t])throw gn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}(pn({},t,{rootHandler:i})),s=new ln({proxy:!0}),c=new on;function p(e,t,n){var i=t(),r=i.line,o=i.column,s=i.data;"<"===s.charAt(0)&&-1!==s.indexOf(" ")&&(s=s.slice(0,s.indexOf(" "))+">");var c="unparsable content "+(s?s+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return a.addWarning({message:c,error:e}),console.warn("could not parse node"),console.warn(e),!0;throw console.error("could not parse document"),console.error(e),gn(c)}i.context=a,c.push(i);var l=/^<\?xml /i,u=/ encoding="([^"]+)"/i,h=/^utf-8$/i;var d=r.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(d).on("openTag",function(e,t,n,i){var r=e.attrs||{},a=Object.keys(r).reduce(function(e,n){var i=t(r[n]);return e[n]=i,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){p(e,t,o)&&c.push(new En)}}({name:e.name,originalName:e.originalName,attributes:a,ns:e.ns},i)}).on("question",function(e){if(l.test(e)){var t=u.exec(e),n=t&&t[1];n&&!h.test(n)&&a.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",function(e){c.peek().handleText(e)}).on("text",function(e,t){!function(e){(e=e.trim())&&c.peek().handleText(e)}(t(e))}).on("error",p).on("warn",function(e,t){return p(e,t,!0)}),setTimeout(function(){var t;try{s.parse(e),function(){var e,t,n=a.elementsById,i=a.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],s=bn(r).propertiesByName[t.property];if(o||a.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),s.isMany){var c=r.get(s.name),p=c.indexOf(t);-1===p&&(p=c.length),o?c[p]=o:c.splice(p,1)}else r.set(s.name,o)}}()}catch(e){t=e}var r=i.element;t||r||(t=gn("failed to parse document as <"+i.type.$descriptor.name+">")),n(t,t?void 0:r,a)},0)},Pn.prototype.handler=function(e){return new An(this.model,e)},(an=Pn).ElementHandler=Cn;var Mn=s.map,kn=s.forEach,Bn=s.isString,Nn=s.filter,Dn=s.assign,On=Rt.parseName,Ln=bt.hasLowerCaseAlias,In=bt.serializeAsType,jn=bt.serializeAsProperty,zn='<?xml version="1.0" encoding="UTF-8"?>\n',Fn=/<|>|'|"|&|\n\r|\n/g,$n=/<|>|&/g,Gn=bt.DEFAULT_NS_MAP,Wn=bt.XSI_TYPE;function Hn(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function Vn(e){return Bn(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function qn(e,t){return t.isGeneric?Dn({localName:t.ns.localName},e):Dn({localName:(n=t.ns.localName,i=t.$pkg,Ln(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var Un={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},Yn={"<":"lt",">":"gt","&":"amp"};function Kn(e,t,n){return(e=Bn(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function Xn(e){this.tagName=e}function Zn(){}function Qn(e){this.tagName=e}function Jn(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function ei(e,t){Jn.call(this,e,t)}Xn.prototype.build=function(e){return this.element=e,this},Xn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"</"+this.tagName+">").appendNewLine()},Zn.prototype.serializeValue=Zn.prototype.serializeTo=function(e){e.append(this.escape?Kn(this.value,$n,Yn):this.value)},Zn.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search($n)&&(this.escape=!0),this},Hn(Qn,Zn),Qn.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("</"+this.tagName+">").appendNewLine()},Jn.prototype.build=function(e){this.element=e;var t,n,i=e.$descriptor,r=this.propertyDescriptor,o=i.isGeneric;return t=o?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=r?this.nsPropertyTagName(r):this.nsTagName(i),this.tagName=this.addTagName(this.ns),o||(n=function(e){var t=e.$descriptor;return Nn(t.properties,function(t){var n=t.name;if(t.isVirtual)return!1;if(!e.hasOwnProperty(n))return!1;var i=e[n];return i!==t.default&&null!==i&&(!t.isMany||i.length)})}(e),this.parseAttributes(Nn(n,function(e){return e.isAttr})),this.parseContainments(function(e){return Nn(e,function(e){return!e.isAttr})}(n))),this.parseGenericAttributes(e,t),this},Jn.prototype.nsTagName=function(e){return qn(this.logNamespaceUsed(e.ns),e)},Jn.prototype.nsPropertyTagName=function(e){return function(e,t){return Dn({localName:t.ns.localName},e)}(this.logNamespaceUsed(e.ns),e)},Jn.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},Jn.prototype.nsAttributeName=function(e){var t;if(t=Bn(e)?On(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}:Dn({localName:t.localName},n)},Jn.prototype.parseGeneric=function(e){var t=this,n=this.body,i=[];return kn(e,function(r,o){"$body"===o?n.push((new Zn).build({type:"String"},r)):"$children"===o?kn(r,function(e){n.push(new Jn(t).build(e))}):0!==o.indexOf("$")&&t.parseNsAttribute(e,o,r)&&i.push({name:o,value:r})}),i},Jn.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=On(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)}},Jn.prototype.parseNsAttributes=function(e,t){var n=this,i=e.$attrs,r=[];return kn(i,function(t,i){var o=n.parseNsAttribute(e,i,t);o&&r.push(o)}),r},Jn.prototype.parseGenericAttributes=function(e,t){var n=this;kn(t,function(t){if(t.name!==Wn)try{n.addAttribute(n.nsAttributeName(t.name),t.value)}catch(n){console.warn("missing namespace information for ",t.name,"=",t.value,"on",e,n)}})},Jn.prototype.parseContainments=function(e){var t=this,n=this.body,i=this.element;kn(e,function(e){var r=i.get(e.name),o=e.isReference;if(e.isMany||(r=[r]),e.isBody)n.push((new Zn).build(e,r[0]));else if(zt.isSimple(e.type))kn(r,function(i){n.push(new Qn(t.addTagName(t.nsPropertyTagName(e))).build(e,i))});else if(o)kn(r,function(i){n.push(new Xn(t.addTagName(t.nsPropertyTagName(e))).build(i))});else{var a=In(e),s=jn(e);kn(r,function(i){var r;r=a?new ei(t,e):s?new Jn(t,e):new Jn(t),n.push(r.build(i))})}})},Jn.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new function(e){var t={},n={},i={},r=[],o=[];this.byUri=function(t){return n[t]||e&&e.byUri(t)},this.add=function(e,t){n[e.uri]=e,t?r.push(e):o.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return t[e||"xmlns"]},this.mapPrefix=function(e,n){t[e||"xmlns"]=n},this.logUsed=function(e){var t=e.uri;i[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(r,o).filter(function(e){return i[e.uri]})}}(t):n=t),n},Jn.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},Jn.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=Gn[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},Jn.prototype.parseAttributes=function(e){var t=this,n=this.element;kn(e,function(e){var i=n.get(e.name);if(e.isReference)if(e.isMany){var r=[];kn(i,function(e){r.push(e.id)}),i=r.join(" ")}else i=i.id;t.addAttribute(t.nsAttributeName(e),i)})},Jn.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),Vn(e)},Jn.prototype.addAttribute=function(e,t){var n=this.attrs;Bn(t)&&(t=Kn(t,Fn,Un)),n.push({name:e,value:t})},Jn.prototype.serializeAttributes=function(e){var t=this.attrs,n=this.namespaces;n&&(t=function(e){return Mn(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})}(n).concat(t)),kn(t,function(t){e.append(" ").append(Vn(t.name)).append('="').append(t.value).append('"')})},Jn.prototype.serializeTo=function(e){var t=this.body[0],n=t&&t.constructor!==Zn;e.appendIndent().append("<"+this.tagName),this.serializeAttributes(e),e.append(t?">":" />"),t&&(n&&e.appendNewLine().indent(),kn(this.body,function(t){t.serializeTo(e)}),n&&e.unindent().appendIndent(),e.append("</"+this.tagName+">")),e.appendNewLine()},Hn(ei,Jn),ei.prototype.parseNsAttributes=function(e){var t=Jn.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(Wn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},ei.prototype.isLocalNs=function(e){return e.uri===this.typeNs.uri};var ti=function(e){return e=Dn({format:!1,preamble:!0},e||{}),{toXML:function(t,n){var i=n||new function(){this.value="",this.write=function(e){this.value+=e}},r=new function(e,t){var n=[""];this.append=function(t){return e.write(t),this},this.appendNewLine=function(){return t&&e.write("\n"),this},this.appendIndent=function(){return t&&e.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}(i,e.format);if(e.preamble&&r.append(zn),(new Jn).build(t).serializeTo(r),!n)return i.value}}},ni=s.isString,ii=s.isFunction,ri=s.assign;function oi(e,t){nn.call(this,e,t)}oi.prototype=Object.create(nn.prototype);var ai=oi;oi.prototype.fromXML=function(e,t,n,i){ni(t)||(i=n,n=t,t="bpmn:Definitions"),ii(n)&&(i=n,n={});var r=new an(ri({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)},oi.prototype.toXML=function(e,t,n){ii(t)&&(n=t,t={});var i,r,o=new ti(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var si=s.assign,ci={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"}]},{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:"Expression",xml:{serialize:"xsi:type"}}]},{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}]},{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:[]}},pi=function(e,t){return new ai(si({},ci,e),t)},li={remove:function(e,t){if(!e||!t)return-1;var n=e.indexOf(t);return-1!==n&&e.splice(n,1),n},add:function(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)}},indexOf:function(e,t){return e&&t?e.indexOf(t):-1}},ui={},hi=s.isArray,di=s.isNumber,mi=s.groupBy,fi=s.forEach;function yi(e,t,n){var i=!n||-1===e.indexOf(t);return i&&e.push(t),i}function vi(e,t,n){n=n||0,hi(e)||(e=[e]),fi(e,function(e,i){var r=t(e,i,n);hi(r)&&r.length&&vi(r,t,n+1)})}function gi(e,t,n){var i=[],r=[];return vi(e,function(e,o,a){yi(i,e,t);var s=e.children;if((-1===n||a<n)&&s&&yi(r,s,t))return s}),i}function bi(e,t){var n,i,r,o;return t=!!t,hi(e)||(e=[e]),fi(e,function(e){var a=e;e.waypoints&&!t&&(a=bi(e.waypoints,!0));var s=a.x,c=a.y,p=a.height||0,l=a.width||0;(s<n||void 0===n)&&(n=s),(c<i||void 0===i)&&(i=c),(s+l>r||void 0===r)&&(r=s+l),(c+p>o||void 0===o)&&(o=c+p)}),{x:n,y:i,height:o-i,width:r-n}}ui.eachElement=vi,ui.selfAndAllChildren=function(e,t){return gi(e,!t,-1)},ui.getBBox=bi,ui.getEnclosedElements=function(e,t){var n={};return fi(e,function(e){var i=e;i.waypoints&&(i=bi(i)),!di(t.y)&&i.x>t.x&&(n[e.id]=e),!di(t.x)&&i.y>t.y&&(n[e.id]=e),i.x>t.x&&i.y>t.y&&(di(t.width)&&di(t.height)&&i.width+i.x<t.width+t.x&&i.height+i.y<t.height+t.y?n[e.id]=e:di(t.width)&&di(t.height)||(n[e.id]=e))}),n},ui.getClosure=function(e){var t=mi(e,function(e){return e.id}),n={},i={},r={},o={};function a(e){t[e.source.id]&&t[e.target.id]&&(t[e.id]=[e]),n[e.source.id]&&n[e.target.id]&&(o[e.id]=r[e.id]=e),i[e.id]=e}return vi(e,function(e){if(r[e.id]=e,!e.waypoints)return n[e.id]=e,fi(e.incoming,a),fi(e.outgoing,a),e.children;o[e.id]=i[e.id]=e}),{allShapes:n,allConnections:i,topLevel:t,enclosedConnections:o,enclosedElements:r}},ui.getType=function(e){return"waypoints"in e?"connection":"x"in e?"shape":"root"};var xi=s.isNumber,Ei=s.assign,_i=s.forEach,wi=s.every,Si=s.debounce,Ti=s.bind,Ci=s.reduce,Ai=n.append,Ri=n.attr,Pi=n.classes,Mi=n.create,ki=n.transform,Bi=n.createMatrix;function Ni(e,t){return Math.round(e*t)/t}function Di(e){return xi(e)?e+"px":e}function Oi(e,t,n){var i=Mi("g");Pi(i).add(t);var r=void 0!==n?n:e.childNodes.length-1;return e.insertBefore(i,e.childNodes[r]),i}var Li={shape:["x","y","width","height"],connection:["waypoints"]};function Ii(e,t,n,i){this._eventBus=t,this._elementRegistry=i,this._graphicsFactory=n,this._init(e||{})}Ii.$inject=["config.canvas","eventBus","graphicsFactory","elementRegistry"];var ji=Ii;function zi(e,t){var n="matrix("+t.a+","+t.b+","+t.c+","+t.d+","+t.e+","+t.f+")";e.setAttribute("transform",n)}Ii.prototype._init=function(e){var t=this._eventBus,n=this._container=function(e){var t=(e=Ei({},{width:"100%",height:"100%"},e)).container||document.body,n=document.createElement("div");return n.setAttribute("class","djs-container"),Ei(n.style,{position:"relative",overflow:"hidden",width:Di(e.width),height:Di(e.height)}),t.appendChild(n),n}(e),i=this._svg=Mi("svg");Ri(i,{width:"100%",height:"100%"}),Ai(n,i);var r=this._viewport=Oi(i,"viewport");this._layers={},!1!==e.deferUpdate&&(this._viewboxChanged=Si(Ti(this._viewboxChanged,this),300)),t.on("diagram.init",function(){t.fire("canvas.init",{svg:i,viewport:r})},this),t.on(["shape.added","connection.added","shape.removed","connection.removed","elements.changed"],function(){delete this._cachedViewbox},this),t.on("diagram.destroy",500,this._destroy,this),t.on("diagram.clear",500,this._clear,this)},Ii.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},Ii.prototype._clear=function(){var e=this;this._elementRegistry.getAll().forEach(function(t){var n=ui.getType(t);"root"===n?e.setRootElement(null,!0):e._removeElement(t,n)}),delete this._cachedViewbox},Ii.prototype.getDefaultLayer=function(){return this.getLayer("base",0)},Ii.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},Ii.prototype._createLayer=function(e,t){t||(t=0);var n=Ci(this._layers,function(e,n){return t>=n.index&&e++,e},0);return{group:Oi(this._viewport,"layer-"+e,n),index:t}},Ii.prototype.getContainer=function(){return this._container},Ii.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(_i([i.gfx,i.secondaryGfx],function(e){e&&(n?Pi(e).add(t):Pi(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},Ii.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},Ii.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},Ii.prototype.hasMarker=function(e,t){e.id||(e=this._elementRegistry.get(e));var n=this.getGraphics(e);return Pi(n).has(t)},Ii.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},Ii.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},Ii.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e,e},Ii.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=Li[e];if(!wi(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},Ii.prototype._setParent=function(e,t,n){li.add(t.children,e,n),e.parent=t},Ii.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},Ii.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},Ii.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},Ii.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),li.remove(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},Ii.prototype.removeShape=function(e){return this._removeElement(e,"shape")},Ii.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},Ii.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},Ii.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},Ii.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},Ii.prototype.viewbox=function(e){if(void 0===e&&this._cachedViewbox)return this._cachedViewbox;var t,n,i,r,o,a,s=this._viewport,c=this.getSize();return e?(this._changeViewbox(function(){r=Math.min(c.width/e.width,c.height/e.height);var t=this._svg.createSVGMatrix().scale(r).translate(-e.x,-e.y);ki(s,t)}),e):(t=this.getDefaultLayer().getBBox(),n=(i=ki(s))?i.matrix:Bi(),r=Ni(n.a,1e3),o=Ni(-n.e||0,1e3),a=Ni(-n.f||0,1e3),e=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:t.width,height:t.height,x:t.x,y:t.y},outer:c})},Ii.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=Ei({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),zi(t,n)}),{x:n.e,y:n.f}},Ii.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)}),Ni(i.a,1e3)):this.viewbox(e).scale;var n,i},Ii.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return o.x>=0&&o.y>=0&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?n={x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),n={x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},Ii.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return t?(n=Ei(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),o=i.multiply(r)):o=c.scale(e),zi(this._viewport,o),o},Ii.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},Ii.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}},Ii.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Fi={},$i=s.assign,Gi=new it({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Wi=new it({name:"label",enumerable:!0},{name:"labelTarget"}),Hi=new it({name:"attachers",collection:!0},{name:"host"}),Vi=new it({name:"outgoing",collection:!0},{name:"source"}),qi=new it({name:"incoming",collection:!0},{name:"target"});function Ui(){Object.defineProperty(this,"businessObject",{writable:!0}),Gi.bind(this,"parent"),Wi.bind(this,"label"),Vi.bind(this,"outgoing"),qi.bind(this,"incoming")}function Yi(){Ui.call(this),Gi.bind(this,"children"),Hi.bind(this,"host"),Hi.bind(this,"attachers")}function Ki(){Yi.call(this)}function Xi(){Yi.call(this),Wi.bind(this,"labelTarget")}function Zi(){Ui.call(this),Vi.bind(this,"source"),qi.bind(this,"target")}U(Yi,Ui),U(Ki,Yi),U(Xi,Yi),U(Zi,Ui);var Qi={connection:Zi,shape:Yi,label:Xi,root:Ki};Fi.create=function(e,t){var n=Qi[e];if(!n)throw new Error("unknown type: <"+e+">");return $i(new n,t)},Fi.Base=Ui,Fi.Label=Xi;var Ji=s.assign;function er(){this._uid=12}var tr=er;er.prototype.createRoot=function(e){return this.create("root",e)},er.prototype.createLabel=function(e){return this.create("label",e)},er.prototype.createShape=function(e){return this.create("shape",e)},er.prototype.createConnection=function(e){return this.create("connection",e)},er.prototype.create=function(e,t){return(t=Ji({},t||{})).id||(t.id=e+"_"+this._uid++),Fi.create(e,t)};var nr="data-element-id",ir=n.attr;function rr(e){this._elements={},this._eventBus=e}rr.$inject=["eventBus"];var or=rr;rr.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),ir(t,nr,i),n&&ir(n,nr,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},rr.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(ir(i.gfx,nr,""),i.secondaryGfx&&ir(i.secondaryGfx,nr,""),delete t[n])},rr.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)},rr.prototype.get=function(e){var t;t="string"==typeof e?e:e&&ir(e,nr);var n=this._elements[t];return n&&n.element},rr.prototype.filter=function(e){var t=[];return this.forEach(function(n,i){e(n,i)&&t.push(n)}),t},rr.prototype.getAll=function(){return this.filter(function(e){return e})},rr.prototype.forEach=function(e){var t=this._elements;Object.keys(t).forEach(function(n){var i=t[n],r=i.element,o=i.gfx;return e(r,o)})},rr.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},rr.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 ar=s.isFunction,sr=s.isArray,cr=s.isNumber,pr=s.bind,lr=s.assign,ur=Array.prototype.slice;function hr(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}var dr=hr;function mr(){}hr.prototype.on=function(e,t,n,i){if(e=sr(e)?e:[e],ar(t)&&(i=n,n=t,t=1e3),!cr(t))throw new Error("priority must be a number");var r=n;i&&((r=pr(n,i)).__fn=n.__fn||n);var o=this,a={priority:t,callback:r};e.forEach(function(e){o._addListener(e,a)})},hr.prototype.once=function(e,t,n,i){var r=this;if(ar(t)&&(i=n,n=t,t=1e3),!cr(t))throw new Error("priority must be a number");function o(){return r.off(e,o),n.apply(i,arguments)}o.__fn=n,this.on(e,t,o)},hr.prototype.off=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.__fn!==t||o.splice(r,1);else o.length=0},hr.prototype.createEvent=function(e){var t=new mr;return t.init(e),t},hr.prototype.fire=function(e,t){var n,i,r,o;if(o=ur.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 mr?t:this.createEvent(t),o[0]=n;var a=n.type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},hr.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},hr.prototype._destroy=function(){this._listeners={}},hr.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},hr.prototype._invokeListener=function(e,t,n){var i;try{void 0!==(i=function(e,t){return e.apply(null,t)}(n.callback,t))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},hr.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)},hr.prototype._getListeners=function(e){var t=this._listeners[e];return t||(this._listeners[e]=t=[]),t},mr.prototype.stopPropagation=function(){this.cancelBubble=!0},mr.prototype.preventDefault=function(){this.defaultPrevented=!0},mr.prototype.init=function(e){lr(this,e||{})};var fr={},yr=Y.query;fr.getVisual=function(e){return yr(".djs-visual",e)},fr.getChildren=function(e){return e.parentNode.childNodes[1]};var vr=s.forEach,gr=s.reduce,br=w.translate,xr=Y.clear,Er=n.append,_r=n.attr,wr=n.classes,Sr=n.create,Tr=n.remove;function Cr(e,t){this._eventBus=e,this._elementRegistry=t}Cr.$inject=["eventBus","elementRegistry"];var Ar=Cr;function Rr(e,t,n){t.insertBefore(e,n||t.firstChild)}Cr.prototype._getChildren=function(e){var t,n=this._elementRegistry.getGraphics(e);return e.parent?(t=fr.getChildren(n))||(t=Sr("g"),wr(t).add("djs-children"),Er(n.parentNode,t)):t=n,t},Cr.prototype._clear=function(e){var t=fr.getVisual(e);return xr(t),t},Cr.prototype._createContainer=function(e,t,n){var i=Sr("g");wr(i).add("djs-group"),void 0!==n?Rr(i,t,t.childNodes[n]):Er(t,i);var r=Sr("g");wr(r).add("djs-element"),wr(r).add("djs-"+e),Er(i,r);var o=Sr("g");return wr(o).add("djs-visual"),Er(r,o),r},Cr.prototype.create=function(e,t,n){var i=this._getChildren(t.parent);return this._createContainer(e,i,n)},Cr.prototype.updateContainments=function(e){var t,n=this,i=this._elementRegistry;t=gr(e,function(e,t){return t.parent&&(e[t.parent.id]=t.parent),e},{}),vr(t,function(e){var t=e.children;if(t){var r=n._getChildren(e);vr(t.slice().reverse(),function(e){Rr(i.getGraphics(e).parentNode,r)})}})},Cr.prototype.drawShape=function(e,t){return this._eventBus.fire("render.shape",{gfx:e,element:t})},Cr.prototype.getShapePath=function(e){return this._eventBus.fire("render.getShapePath",e)},Cr.prototype.drawConnection=function(e,t){return this._eventBus.fire("render.connection",{gfx:e,element:t})},Cr.prototype.getConnectionPath=function(e){return this._eventBus.fire("render.getConnectionPath",e)},Cr.prototype.update=function(e,t,n){if(t.parent){var i=this._clear(n);if("shape"===e)this.drawShape(i,t),br(n,t.x,t.y);else{if("connection"!==e)throw new Error("unknown type: "+e);this.drawConnection(i,t)}t.hidden?_r(n,"display","none"):_r(n,"display","block")}},Cr.prototype.remove=function(e){var t=this._elementRegistry.getGraphics(e);Tr(t.parentNode)};var Pr=i.componentsToPath,Mr=i.createLine,kr=n.append,Br=n.attr,Nr=n.create,Dr=1;function Or(e,t){_.call(this,e,Dr),this.CONNECTION_STYLE=t.style(["no-fill"],{strokeWidth:5,stroke:"fuchsia"}),this.SHAPE_STYLE=t.style({fill:"white",stroke:"fuchsia",strokeWidth:2})}U(Or,_),Or.prototype.canRender=function(){return!0},Or.prototype.drawShape=function(e,t){var n=Nr("rect");return Br(n,{x:0,y:0,width:t.width||0,height:t.height||0}),Br(n,this.SHAPE_STYLE),kr(e,n),n},Or.prototype.drawConnection=function(e,t){var n=Mr(t.waypoints,this.CONNECTION_STYLE);return kr(e,n),n},Or.prototype.getShapePath=function(e){var t=e.x,n=e.y,i=e.width,r=e.height;return Pr([["M",t,n],["l",i,0],["l",0,r],["l",-i,0],["z"]])},Or.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 Pr(r)},Or.$inject=["eventBus","styles"];var Lr=Or,Ir=s.isArray,jr=s.assign,zr=s.reduce;var Fr={__depends__:[{__init__:["defaultRenderer"],defaultRenderer:["type",Lr],styles:["type",function(){var e={"no-fill":{fill:"none"},"no-border":{strokeOpacity:0},"no-events":{pointerEvents:"none"}},t=this;this.cls=function(e,t,n){var i=this.style(t,n);return jr(i,{class:e})},this.style=function(t,n){Ir(t)||n||(n=t,t=[]);var i=zr(t,function(t,n){return jr(t,e[n]||{})},{});return n?jr(i,n):i},this.computeStyle=function(e,n,i){return Ir(n)||(i=n,n=[]),t.style(n||[],jr({},i,e||{}))}}]}],__init__:["canvas"],canvas:["type",ji],elementRegistry:["type",or],elementFactory:["type",tr],eventBus:["type",dr],graphicsFactory:["type",Ar]},$r={exports:{}};!function(e,t){"object"==typeof $r.exports?t($r.exports):t(e.didi={})}(this,function(e){"use strict";var t=/^class /;function n(e){return"[object Array]"===Object.prototype.toString.call(e)}function i(){var e=Array.prototype.slice.call(arguments);1===e.length&&n(e[0])&&(e=e[0]);var t=e.pop();return t.$inject=e,t}var r=/constructor\s*[^(]*\(\s*([^)]*)\)/m,o=/^function\s*[^(]*\(\s*([^)]*)\)/m,a=/\/\*([^*]*)\*\//m;function s(e){if("function"!=typeof e)throw new Error('Cannot annotate "'+e+'". Expected a function!');var n=e.toString().match(function(e){return t.test(e.toString())}(e)?r:o);return n&&n[1]&&n[1].split(",").map(function(e){return(n=e.match(a))?n[1].trim():e.trim()})||[]}function c(){var e=[];this.factory=function(t,n){return e.push([t,"factory",n]),this},this.value=function(t,n){return e.push([t,"value",n]),this},this.type=function(t,n){return e.push([t,"type",n]),this},this.forEach=function(t){e.forEach(t)}}var p="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 l(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 u(e,t){return Object.hasOwnProperty.call(e,t)}e.Injector=function e(t,r){r=r||{get:function(e,t){if(o.push(e),!1===t)return null;throw m('No provider for "'+e+'"!')}};var o=[],a=this._providers=Object.create(r._providers||null),h=this._instances=Object.create(null),d=h.injector=this,m=function(e){var t=o.join(" -> ");return o.length=0,new Error(t?e+" (Resolving: "+t+")":e)},f=function e(t,n){if(!a[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),s=e(i.shift());i.length;)s=s[i.shift()];return s}if(u(h,t))return h[t];if(u(a,t)){if(-1!==o.indexOf(t))throw o.push(t),m("Cannot resolve circular dependency!");return o.push(t),h[t]=a[t][0](a[t][1]),o.pop(),h[t]}return r.get(t,n)},y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("function"!=typeof e){if(!n(e))throw new Error('Cannot invoke "'+e+'". Expected a function!');e=i(e.slice())}return{fn:e,dependencies:(e.$inject||s(e)).map(function(e){return u(t,e)?t[e]:f(e)})}},v=function(e){var t=y(e),n=t.dependencies,i=t.fn;return new(Function.prototype.bind.apply(i,[null].concat(l(n))))},g=function(e,t,n){var i=y(e,n),r=i.dependencies,o=i.fn;return o.call.apply(o,[t].concat(l(r)))},b=function(e){return i(function(t){return e.get(t)})},x={factory:g,type:v,value:function(e){return e}};t.forEach(function(t){function r(e,t){return"value"!==e&&n(t)&&(t=i(t.slice())),t}if(t instanceof c)t.forEach(function(e){var t=e[0],n=e[1],i=e[2];a[t]=[x[n],r(n,i),n]});else if("object"===(void 0===t?"undefined":p(t)))if(t.__exports__){var o=Object.keys(t).reduce(function(e,n){return"__"!==n.substring(0,2)&&(e[n]=t[n]),e},Object.create(null)),s=new e((t.__modules__||[]).concat([o]),d),l=i(function(e){return s.get(e)});t.__exports__.forEach(function(e){a[e]=[l,e,"private",s]})}else Object.keys(t).forEach(function(e){if("private"!==t[e][2]){var n=t[e][0],i=t[e][1];a[e]=[x[n],r(n,i),n]}else a[e]=t[e]})}),this.get=f,this.invoke=g,this.instantiate=v,this.createChild=function(t,n){if(n&&n.length){var i,r,o,s,c=Object.create(null),p=Object.create(null),l=[],u=[],h=[];for(var m in a)i=a[m],-1!==n.indexOf(m)&&("private"===i[2]?-1===(r=l.indexOf(i[3]))?(o=i[3].createChild([],n),s=b(o),l.push(i[3]),u.push(o),h.push(s),c[m]=[s,m,"private",o]):c[m]=[h[r],m,"private",u[r]]:c[m]=[i[2],i[1]],p[m]=!0),"factory"!==i[2]&&"type"!==i[2]||!i[1].$scope||n.forEach(function(e){-1!==i[1].$scope.indexOf(e)&&(c[m]=[i[2],i[1]],p[e]=!0)});n.forEach(function(e){if(!p[e])throw new Error('No provider for "'+e+'". Cannot use provider from the parent!')}),t.unshift(c)}return new e(t,d)}},Object.defineProperty(e,"__esModule",{value:!0})});var Gr=($r=$r.exports).Injector;function Wr(e){var t=[],n=[];function i(e){return t.indexOf(e)>=0}e.forEach(function e(r){i(r)||((r.__depends__||[]).forEach(e),i(r)||(function(e){t.push(e)}(r),(r.__init__||[]).forEach(function(e){n.push(e)})))});var r=new Gr(t);return n.forEach(function(e){try{r["string"==typeof e?"get":"invoke"](e)}catch(e){throw console.error("Failed to instantiate component"),console.error(e.stack),e}}),r}function Hr(e,t){this.injector=t=t||function(e){return Wr([{config:["value",e=e||{}]},Fr].concat(e.modules||[]))}(e),this.get=t.get,this.invoke=t.invoke,this.get("eventBus").fire("diagram.init")}var Vr=Hr;Hr.prototype.destroy=function(){this.get("eventBus").fire("diagram.destroy")},Hr.prototype.clear=function(){this.get("eventBus").fire("diagram.clear")};var qr=Vr;function Ur(e){this._counter=0,this._prefix=(e?e+"-":"")+Math.floor(1e9*Math.random())+"-"}var Yr=Ur;Ur.prototype.next=function(){return this._prefix+ ++this._counter};var Kr=s.isArray,Xr=s.isString,Zr=s.isObject,Qr=s.assign,Jr=s.forEach,eo=s.find,to=s.filter,no=s.matchPattern,io=Y.domify,ro=Y.classes,oo=Y.attr,ao=Y.remove,so=Y.clear,co=ui.getBBox,po=new Yr("ov");function lo(e,t,n){Qr(e.style,{left:t+"px",top:n+"px"})}function uo(e,t){e.style.display=!1===t?"none":""}function ho(e,t){e.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(n){e.style[n+"transform"]=t})}function mo(e){return void 0!==e}function fo(e,t,n,i){var r,o;this._eventBus=t,this._canvas=n,this._elementRegistry=i,this._ids=po,this._overlayDefaults=Qr({show:null,scale:!0},e&&e.defaults),this._overlays={},this._overlayContainers=[],this._overlayRoot=(r=n.getContainer(),o=io('<div class="djs-overlay-container" style="position: absolute; width: 0; height: 0;" />'),r.insertBefore(o,r.firstChild),o),this._init()}fo.$inject=["config.overlays","eventBus","canvas","elementRegistry"];var yo=fo;fo.prototype.get=function(e){if(Xr(e)&&(e={id:e}),Xr(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?to(t.overlays,no({type:e.type})):t.overlays.slice():[]}return e.type?to(this._overlays,no({type:e.type})):e.id?this._overlays[e.id]:null},fo.prototype.add=function(e,t,n){if(Zr(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=Qr({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},fo.prototype.remove=function(e){var t=this.get(e)||[];Kr(t)||(t=[t]);var n=this;Jr(t,function(e){var t=n._getOverlayContainer(e.element,!0);if(e&&(ao(e.html),ao(e.htmlContainer),delete e.htmlContainer,delete e.element,delete n._overlays[e.id]),t){var i=t.overlays.indexOf(e);-1!==i&&t.overlays.splice(i,1)}})},fo.prototype.show=function(){uo(this._overlayRoot)},fo.prototype.hide=function(){uo(this._overlayRoot,!1)},fo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],so(this._overlayRoot)},fo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=co(t);i=o.x,r=o.y}lo(n,i,r),oo(e.html,"data-container-id",t.id)},fo.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?co(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?co(o).height:o.height,s=-1*i.bottom+n);lo(r,a||0,s||0)},fo.prototype._createOverlayContainer=function(e){var t=io('<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},fo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";ho(this._overlayRoot,n)},fo.prototype._getOverlayContainer=function(e,t){var n=eo(this._overlayContainers,function(t){return t.element===e});return n||t?n:this._createOverlayContainer(e)},fo.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)),Xr(o)&&(o=io(o)),n=this._getOverlayContainer(r),(t=io('<div class="djs-overlay" data-overlay-id="'+i+'" style="position: absolute">')).appendChild(o),e.type&&ro(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())},fo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((mo(i)&&i>t.scale||mo(r)&&r<t.scale)&&(a=!1),uo(o,a)),this._updateOverlayScale(e,t)},fo.prototype._updateOverlayScale=function(e,t){var n,i,r,o=e.scale,a=e.htmlContainer,s="";!0!==o&&(!1===o?(n=1,i=1):(n=o.min,i=o.max),mo(n)&&t.scale<n&&(r=(1/t.scale||1)*n),mo(i)&&t.scale>i&&(r=(1/t.scale||1)*i)),mo(r)&&(s="scale("+r+","+r+")"),ho(a,s)},fo.prototype._updateOverlaysVisibilty=function(e){var t=this;Jr(this._overlays,function(n){t._updateOverlayVisibilty(n,e)})},fo.prototype._init=function(){var e=this._eventBus,t=this;e.on("canvas.viewbox.changing",function(e){t.hide()}),e.on("canvas.viewbox.changed",function(e){var n;n=e.viewbox,t._updateRoot(n),t._updateOverlaysVisibilty(n),t.show()}),e.on(["shape.remove","connection.remove"],function(e){var n=e.element,i=t.get({element:n});Jr(i,function(e){t.remove(e.id)});var r=t._getOverlayContainer(n);if(r){ao(r.html);var o=t._overlayContainers.indexOf(r);-1!==o&&t._overlayContainers.splice(o,1)}}),e.on("element.changed",500,function(e){var n=e.element,i=t._getOverlayContainer(n,!0);i&&(Jr(i.overlays,function(e){t._updateOverlay(e)}),t._updateOverlayContainer(i))}),e.on("element.marker.update",function(e){var n=t._getOverlayContainer(e.element,!0);n&&ro(n.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var vo={__init__:["overlays"],overlays:["type",yo]},go={};function bo(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function xo(e){return e.originalEvent||e.srcEvent}go.getOriginal=xo,go.stopPropagation=function(e,t){bo(e),bo(xo(e))},go.toPoint=function(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};var Eo={isMac:function(){return/mac/i.test(navigator.platform)}},_o={},wo=go.getOriginal,So=Eo.isMac;function To(e){return!(wo(e)||e).button}_o.isPrimaryButton=To,_o.hasPrimaryModifier=function(e){var t=wo(e)||e;return!!To(e)&&(So()?t.metaKey:t.ctrlKey)},_o.hasSecondaryModifier=function(e){var t=wo(e)||e;return To(e)&&t.shiftKey};var Co=s.forEach,Ao=Y.delegate,Ro=_o.isPrimaryButton,Po=n.append,Mo=n.attr,ko=n.create,Bo=Y.query,No=i.createLine,Do=i.updateLine;function Oo(e){return!0}var Lo=500;function Io(e,t,n){var i=n.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function r(n,i,r){var o,a;(function(e,t){return!(c[e]||Ro)(t)})(n,i)||(r?a=t.getGraphics(r):(o=i.delegateTarget||i.target)&&(a=o,r=t.get(a)),a&&r&&!1===e.fire(n,{element:r,gfx:a,originalEvent:i})&&(i.stopPropagation(),i.preventDefault()))}var o={};function a(e){return o[e]}var s={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},c={"element.contextmenu":Oo};var p="svg, .djs-element";function l(e,t,n,i){var a=o[n]=function(e){r(n,e)};i&&(c[n]=i),a.$delegate=Ao.bind(e,p,t,a)}function u(e,t,n){var i=a(n);i&&Ao.unbind(e,t,i.$delegate)}e.on("canvas.destroy",function(e){var t;t=e.svg,Co(s,function(e,n){u(t,n,e)})}),e.on("canvas.init",function(e){var t;t=e.svg,Co(s,function(e,n){l(t,n,e)})}),e.on(["shape.added","connection.added"],function(e){var t,n=e.element,r=e.gfx;n.waypoints?t=No(n.waypoints):(t=ko("rect"),Mo(t,{x:0,y:0,width:n.width,height:n.height})),Mo(t,i),Po(r,t)}),e.on("shape.changed",Lo,function(e){var t=e.element,n=e.gfx,i=Bo(".djs-hit",n);Mo(i,{width:t.width,height:t.height})}),e.on("connection.changed",function(e){var t=e.element,n=e.gfx,i=Bo(".djs-hit",n);Do(i,t.waypoints)}),this.fire=r,this.triggerMouseEvent=function(e,t,n){var i=s[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return r(i,t,n)},this.mouseHandler=a,this.registerEvent=l,this.unregisterEvent=u}Io.$inject=["eventBus","elementRegistry","styles"];var jo={__init__:["interactionEvents"],interactionEvents:["type",Io]},zo=ui.getBBox,Fo=500,$o=n.append,Go=n.attr,Wo=n.create,Ho=Y.query,Vo=s.assign;function qo(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Wo("rect");return Go(n,Vo({x:10,y:10,width:100,height:100},i)),$o(e,n),n}e.on(["shape.added","shape.changed"],Fo,function(e){var t=e.element,n=e.gfx,i=Ho(".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=Ho(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}qo.prototype.updateShapeOutline=function(e,t){Go(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},qo.prototype.updateConnectionOutline=function(e,t){var n=zo(t);Go(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},qo.$inject=["eventBus","styles","elementRegistry"];var Uo={__init__:["outline"],outline:["type",qo]},Yo=s.isArray,Ko=s.forEach;function Xo(e){this._eventBus=e,this._selectedElements=[];var t=this;e.on(["shape.remove","connection.remove"],function(e){var n=e.element;t.deselect(n)}),e.on(["diagram.clear"],function(e){t.select(null)})}Xo.$inject=["eventBus"];var Zo=Xo;Xo.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})}},Xo.prototype.get=function(){return this._selectedElements},Xo.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},Xo.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();Yo(e)||(e=e?[e]:[]),t?Ko(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 Qo=_o.hasPrimaryModifier,Jo=s.find;function ea(e,t,n,i){e.on("create.end",500,function(e){e.context.canExecute&&t.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&t.select(e.context.target)}),e.on("shape.move.end",500,function(e){var n=e.previousSelection||[],r=i.get(e.context.shape.id);Jo(n,function(e){return r.id===e.id})||t.select(r)}),e.on("element.click",function(e){var i=e.element;i===n.getRootElement()&&(i=null);var r=t.isSelected(i),o=t.get().length>1,a=Qo(e);if(r&&o)return a?t.deselect(i):t.select(i);r?t.deselect(i):t.select(i,a)})}ea.$inject=["eventBus","selection","canvas","elementRegistry"];var ta=ea,na=s.forEach,ia="hover",ra="selected";function oa(e,t,n,i){function r(e,n){t.addMarker(e,n)}function o(e,n){t.removeMarker(e,n)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,ia)}),e.on("element.out",function(e){o(e.element,ia)}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;na(t,function(e){-1===n.indexOf(e)&&o(e,ra)}),na(n,function(e){-1===t.indexOf(e)&&r(e,ra)})})}oa.$inject=["eventBus","canvas","selection","styles"];var aa={__init__:["selectionVisuals","selectionBehavior"],__depends__:[jo,Uo],selection:["type",Zo],selectionVisuals:["type",oa],selectionBehavior:["type",ta]},sa=s.assign,ca=s.isNumber,pa=s.omit,la=Y.domify,ua=Y.query,ha=Y.remove,da=n.innerSVG,ma=ut.importBpmnDiagram;var fa={width:"100%",height:"100%",position:"relative"};function ya(e){return e+(ca(e)?"px":"")}function va(e){var t,n,i;e=sa({},fa,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=ht.BPMNIO_IMG,i=la('<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">'+n+"</a>"),t.appendChild(i),ba.bind(i,"click",function(e){ht.open(),e.preventDefault()}),this._init(this._container,this._moddle,e)}U(va,qr);var ga=va;va.prototype.importXML=function(e,t){t=t||function(){};var n=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,i,r){i=n._emit("import.parse.complete",{error:e,definitions:i,context:r})||i;var o=r.warnings;if(e)return e=function(e){var t=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec(e.message);return t&&(e.message="unparsable content <"+t[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+t[2]),e}(e),n._emit("import.done",{error:e,warnings:o}),t(e,o);n.importDefinitions(i,function(e,i){var r=[].concat(o,i||[]);n._emit("import.done",{error:e,warnings:r}),t(e,r)})})},va.prototype.saveXML=function(e,t){t||(t=e,e={});var n=this._definitions;if(!n)return t(new Error("no definitions loaded"));this._moddle.toXML(n,e,t)},va.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={});try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=ua("defs",r._svg),s=da(o),c=a?"<defs>"+da(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}t(i,n)},va.prototype.importDefinitions=function(e,t){try{this._definitions&&this.clear(),this._definitions=e}catch(e){return t(e)}return ma(this,e,t)},va.prototype.getModules=function(){return this._modules},va.prototype.destroy=function(){qr.prototype.destroy.call(this),ha(this._container)},va.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},va.prototype.off=function(e,t){this.get("eventBus").off(e,t)},va.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=ua(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},va.prototype.getDefinitions=function(){return this._definitions},va.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},va.prototype._init=function(e,t,n){var i=n.modules||this.getModules(),r=n.additionalModules||[],o=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],i,r),a=sa(pa(n,["additionalModules"]),{canvas:sa({},n.canvas,{container:e}),modules:o});qr.call(this,a),n&&n.container&&this.attachTo(n.container)},va.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},va.prototype._createContainer=function(e){var t=la('<div class="bjs-container"></div>');return sa(t.style,{width:ya(e.width),height:ya(e.height),position:e.position}),t},va.prototype._createModdle=function(e){var t=sa({},this._moddleExtensions,e.moddleExtensions);return new pi(t)},va.prototype._modules=[Je,Qe,aa,vo],va.prototype._moddleExtensions={};var ba=Y.event;var xa={},Ea=5e3;xa.install=function(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Ea,n),function(){e.off(t,n)}};var _a={},wa=Y.classes,Sa=/^djs-cursor-.*$/;_a.set=function(e){var t=wa(document.body);t.removeMatching(Sa),e&&t.add("djs-cursor-"+e)},_a.unset=function(){this.set(null)};var Ta={};Ta.log10=function(e){return Math.log(e)/Math.log(10)},Ta.substract=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Ca=Ta.substract,Aa=Y.event,Ra=Y.closest;var Pa=15;function Ma(e,t){var n;function i(i){var r,o=n.start,a=go.toPoint(i),s=Ca(a,o);if(!n.dragging&&(r=s,Math.sqrt(Math.pow(r.x,2)+Math.pow(r.y,2))>Pa)&&(n.dragging=!0,xa.install(e),_a.set("grab")),n.dragging){var c=n.last||n.start;s=Ca(a,c),t.scroll({dx:s.x,dy:s.y}),n.last=a}i.preventDefault()}function r(e){Aa.unbind(document,"mousemove",i),Aa.unbind(document,"mouseup",r),n=null,_a.unset()}e.on("element.mousedown",500,function(e){return function(e){if(!Ra(e.target,".djs-draggable")&&!(e.button||e.ctrlKey||e.shiftKey||e.altKey))return n={start:go.toPoint(e)},Aa.bind(document,"mousemove",i),Aa.bind(document,"mouseup",r),!0}(e.originalEvent)})}Ma.$inject=["eventBus","canvas"];var ka={__init__:["moveCanvas"],moveCanvas:["type",Ma]},Ba={},Na=Ta.log10;Ba.getStepSize=function(e,t){var n=Na(e.min),i=Na(e.max);return(Math.abs(n)+Math.abs(i))/t},Ba.cap=function(e,t){return Math.max(e.min,Math.min(e.max,t))};var Da=Y.event,Oa=Y.closest,La=Ba.getStepSize,Ia=Ba.cap,ja=Ta.log10,za=s.bind,Fa=Math.sign||function(e){return e>=0?1:-1},$a={min:.2,max:4},Ga=.75;function Wa(e,t,n){e=e||{},this._enabled=!1,this._canvas=n,this._container=n._container,this._handleWheel=za(this._handleWheel,this),this._totalDelta=0,this._scale=e.scale||Ga;var i=this;t.on("canvas.init",function(t){i._init(!1!==e.enabled)})}Wa.$inject=["config.zoomScroll","eventBus","canvas"];var Ha=Wa;Wa.prototype.scroll=function(e){this._canvas.scroll(e)},Wa.prototype.reset=function(){this._canvas.zoom("fit-viewport")},Wa.prototype.zoom=function(e,t){var n=La($a,20);this._totalDelta+=e,Math.abs(this._totalDelta)>.1&&(this._zoom(e,t,n),this._totalDelta=0)},Wa.prototype._handleWheel=function(e){if(!Oa(e.target,".djs-scrollable",!0)){var t=this._container;e.preventDefault();var n,i=e.ctrlKey,r=e.shiftKey,o=-1*this._scale;if(o*=i?0===e.deltaMode?.02:.32:0===e.deltaMode?1:16,i){var a=t.getBoundingClientRect(),s={x:e.clientX-a.left,y:e.clientY-a.top};n=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Fa(e.deltaY)*o,this.zoom(n,s)}else n=r?{dx:o*e.deltaY,dy:0}:{dx:o*e.deltaX,dy:o*e.deltaY},this.scroll(n)}},Wa.prototype.stepZoom=function(e,t){var n=La($a,10);this._zoom(e,t,n)},Wa.prototype._zoom=function(e,t,n){var i=this._canvas,r=e>0?1:-1,o=ja(i.zoom()),a=Math.round(o/n)*n;a+=n*r;var s=Math.pow(10,a);i.zoom(Ia($a,s),t)},Wa.prototype.toggle=function(e){var t=this._container,n=this._handleWheel,i=this._enabled;return void 0===e&&(e=!i),i!==e&&Da[e?"bind":"unbind"](t,"wheel",n,!1),this._enabled=e,e},Wa.prototype._init=function(e){this.toggle(e)};var Va={__init__:["zoomScroll"],zoomScroll:["type",Ha]};function qa(e){ga.call(this,e)}U(qa,ga);var Ua=qa;qa.prototype._navigationModules=[Va,ka],qa.prototype._modules=[].concat(qa.prototype._modules,qa.prototype._navigationModules);var Ya={};function Ka(e,t){return e&&t?Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2)):-1}Ya.pointDistance=Ka,Ya.pointsOnLine=function(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=Ka(e,t);return Math.abs(r/o)<=i};var Xa=2;Ya.pointsAligned=function(e,t){return Math.abs(e.x-t.x)<=Xa?"h":Math.abs(e.y-t.y)<=Xa&&"v"},Ya.pointInRect=function(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},Ya.getMidPoint=function(e,t){return{x:Math.round(e.x+(t.x-e.x)/2),y:Math.round(e.y+(t.y-e.y)/2)}};var Za="hasOwnProperty",Qa=/,?([a-z]),?/gi,Ja=parseFloat,es=Math,ts=es.PI,ns=es.min,is=es.max,rs=es.pow,os=es.abs,as=/([a-z])[\s,]*((-?\d*\.?\d*(?:e[-+]?\d+)?[\s]*,?[\s]*)+)/gi,ss=/(-?\d*\.?\d*(?:e[-+]?\\d+)?)[\s]*,?[\s]*/gi;function cs(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 ps(e){if("function"==typeof e||Object(e)!==e)return e;var t=new e.constructor;for(var n in e)e[Za](n)&&(t[n]=ps(e[n]));return t}function ls(e){var t=ls.ps=ls.ps||{};return t[e]?t[e].sleep=100:t[e]={sleep:100},setTimeout(function(){for(var n in t)t[Za](n)&&n!=e&&(t[n].sleep--,!t[n].sleep&&delete t[n])}),t[e]}function us(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:es.min(n,i)/2,r2:es.max(n,i)/2,r0:es.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=hs,o}(e,t,n,i),vb:[e,t,n,i].join(" ")}}function hs(){return this.join(",").replace(Qa,"$1")}function ds(e){var t=ps(e);return t.toString=hs,t}function ms(e,t,n,i,r,o,a,s,c){var p=1-c,l=rs(p,3),u=rs(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*es.atan2(m-y,f-v)/ts}}function fs(e,t,n,i,r,o,a,s){cs(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(0==g?(p=6*e-12*n+6*r,c=-3*e+9*n-9*r+3*a,l=3*n-3*e):(p=6*t-12*i+6*o,c=-3*t+9*i-9*o+3*s,l=3*i-3*t),os(c)<1e-12){if(os(p)<1e-12)continue;0<(u=-l/p)&&u<1&&y.push(u)}else m=p*p-4*l*c,f=es.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,E=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]=e,v[1][E]=t,v[0][E+1]=a,v[1][E+1]=s,v[0].length=v[1].length=E+2,{min:{x:ns.apply(0,v[0]),y:ns.apply(0,v[1])},max:{x:is.apply(0,v[0]),y:is.apply(0,v[1])}}}.apply(null,e);return us(c.min.x,c.min.y,c.max.x-c.min.x,c.max.y-c.min.y)}function ys(e,t,n){return t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function vs(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 gs(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=c>1?1:c<0?0:c)/2,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],h=0,d=0;d<12;d++){var m=p*l[d]+p,f=vs(m,e,n,r,a),y=vs(m,t,i,o,s),v=f*f+y*y;h+=u[d]*es.sqrt(v)}return p*h}function bs(e,t,n,i,r,o,a,s){if(!(is(e,n)<ns(r,a)||ns(e,n)>is(r,a)||is(t,i)<ns(o,s)||ns(t,i)>is(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<+ns(e,n).toFixed(2)||u>+is(e,n).toFixed(2)||u<+ns(r,a).toFixed(2)||u>+is(r,a).toFixed(2)||h<+ns(t,i).toFixed(2)||h>+is(t,i).toFixed(2)||h<+ns(o,s).toFixed(2)||h>+is(o,s).toFixed(2)))return{x:p,y:l}}}}function xs(e,t,n){if(!function(e,t){return e=us(e),ys(t=us(t),e.x,e.y)||ys(t,e.x2,e.y)||ys(t,e.x,e.y2)||ys(t,e.x2,e.y2)||ys(e,t.x,t.y)||ys(e,t.x2,t.y)||ys(e,t.x,t.y2)||ys(e,t.x2,t.y2)||(e.x<t.x2&&e.x>t.x||t.x<e.x2&&t.x>e.x)&&(e.y<t.y2&&e.y>t.y||t.y<e.y2&&t.y>e.y)}(fs(e),fs(t)))return n?0:[];for(var i=~~(gs.apply(0,e)/5),r=~~(gs.apply(0,t)/5),o=[],a=[],s={},c=n?0:[],p=0;p<i+1;p++){var l=ms.apply(0,e.concat(p/i));o.push({x:l.x,y:l.y,t:p/i})}for(p=0;p<r+1;p++)l=ms.apply(0,t.concat(p/r)),a.push({x:l.x,y:l.y,t:p/r});for(p=0;p<i;p++)for(var u=0;u<r;u++){var h=o[p],d=o[p+1],m=a[u],f=a[u+1],y=os(d.x-h.x)<.01?"y":"x",v=os(f.x-m.x)<.01?"y":"x",g=bs(h.x,h.y,d.x,d.y,m.x,m.y,f.x,f.y);if(g){if(s[g.x.toFixed(0)]==g.y.toFixed(0))continue;s[g.x.toFixed(0)]=g.y.toFixed(0);var b=h.t+os((g[y]-h[y])/(d[y]-h[y]))*(d.t-h.t),x=m.t+os((g[v]-m[v])/(f[v]-m[v]))*(f.t-m.t);b>=0&&b<=1&&x>=0&&x<=1&&(n?c++:c.push({x:g.x,y:g.y,t1:b,t2:x}))}}return c}function Es(e,t,n,i,r){if(null==r&&null==i&&(i=n),e=+e,t=+t,n=+n,i=+i,null!=r)var o=Math.PI/180,a=e+n*Math.cos(-i*o),s=e+n*Math.cos(-r*o),c=[["M",a,t+n*Math.sin(-i*o)],["A",n,n,0,+(r-i>180),0,s,t+n*Math.sin(-r*o)]];else c=[["M",e,t],["m",0,-i],["a",n,i,0,1,1,0,2*i],["a",n,i,0,1,1,0,-2*i],["z"]];return c.toString=hs,c}function _s(e){var t=ls(e);if(t.abs)return ds(t.abs);if(cs(e,"array")&&cs(e&&e[0],"array")||(e=function(e){if(!e)return null;var t=ls(e);if(t.arr)return ps(t.arr);var n={a:7,c:6,o:2,h:1,l:2,m:2,r:4,q:4,s:4,t:2,v:1,u:3,z:0},i=[];return cs(e,"array")&&cs(e[0],"array")&&(i=ps(e)),i.length||String(e).replace(as,function(e,t,r){var o=[],a=t.toLowerCase();if(r.replace(ss,function(e,t){t&&o.push(+t)}),"m"==a&&o.length>2&&(i.push([t].concat(o.splice(0,2))),a="l",t="m"==t?"l":"L"),"o"==a&&1==o.length&&i.push([t,o[0]]),"r"==a)i.push([t].concat(o));else for(;o.length>=n[a]&&(i.push([t].concat(o.splice(0,n[a]))),n[a]););}),i.toString=ls.toString,t.arr=ps(i),i}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;h<d;h++){if(i.push(p=[]),(n=(l=e[h])[0])!=n.toUpperCase())switch(p[0]=n.toUpperCase(),p[0]){case"A":p[1]=l[1],p[2]=l[2],p[3]=l[3],p[4]=l[4],p[5]=l[5],p[6]=+l[6]+r,p[7]=+l[7]+o;break;case"V":p[1]=+l[1]+o;break;case"H":p[1]=+l[1]+r;break;case"R":for(var 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(Cs(m,u));break;case"O":i.pop(),(m=Es(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);break;case"U":i.pop(),i=i.concat(Es(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(Cs(m,u)),p=["R"].concat(l.slice(-2));else if("O"==n)i.pop(),(m=Es(r,o,l[1],l[2])).push(m[0]),i=i.concat(m);else if("U"==n)i.pop(),i=i.concat(Es(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=hs,t.abs=ds(i),i}function ws(e,t,n,i){return[e,t,n,i,n,i]}function Ss(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 Ts(e,t,n,i,r,o,a,s,c,p){var l,u,h,d,m=120*ts/180,f=ts/180*(+r||0),y=[],v=(u=function(e,t,n){return{x:e*es.cos(n)-t*es.sin(n),y:e*es.sin(n)+t*es.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[Za](n)?(function(e,t){for(var n=0,i=e.length;n<i;n++)if(e[n]===t)return e.push(e.splice(n,1)[0])}(r,n),d?d(i[n]):i[n]):(r.length>=1e3&&delete i[r.shift()],r.push(n),i[n]=u.apply(h,t),d?d(i[n]):i[n])});if(p)C=p[0],A=p[1],S=p[2],T=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);x>1&&(n*=x=es.sqrt(x),i*=x);var E=n*n,_=i*i,w=(o==a?-1:1)*es.sqrt(os((E*_-E*b*b-_*g*g)/(E*b*b+_*g*g))),S=w*n*b/i+(e+s)/2,T=w*-i*g/n+(t+c)/2,C=es.asin(((t-T)/i).toFixed(9)),A=es.asin(((c-T)/i).toFixed(9));(C=e<S?ts-C:C)<0&&(C=2*ts+C),(A=s<S?ts-A:A)<0&&(A=2*ts+A),a&&C>A&&(C-=2*ts),!a&&A>C&&(A-=2*ts)}var R=A-C;if(os(R)>m){var P=A,M=s,k=c;A=C+m*(a&&A>C?1:-1),y=Ts(s=S+n*es.cos(A),c=T+i*es.sin(A),n,i,r,0,a,M,k,[A,P,S,T])}R=A-C;var B=es.cos(C),N=es.sin(C),D=es.cos(A),O=es.sin(A),L=es.tan(R/4),I=4/3*n*L,j=4/3*i*L,z=[e,t],F=[e+I*N,t-j*B],$=[s+I*O,c-j*D],G=[s,c];if(F[0]=2*z[0]-F[0],F[1]=2*z[1]-F[1],p)return[F,$,G].concat(y);for(var W=[],H=0,V=(y=[F,$,G].concat(y).join().split(",")).length;H<V;H++)W[H]=H%2?v(y[H-1],y[H],f).y:v(y[H],y[H+1],f).x;return W}function Cs(e,t){for(var n=[],i=0,r=e.length;r-2*!t>i;i+=2){var o=[{x:+e[i-2],y:+e[i-1]},{x:+e[i],y:+e[i+1]},{x:+e[i+2],y:+e[i+3]},{x:+e[i+4],y:+e[i+5]}];t?i?r-4==i?o[3]={x:+e[0],y:+e[1]}:r-2==i&&(o[2]={x:+e[0],y:+e[1]},o[3]={x:+e[2],y:+e[3]}):o[0]={x:+e[r-2],y:+e[r-1]}:r-4==i?o[3]=o[2]:i||(o[0]={x:+e[i],y:+e[i+1]}),n.push(["C",(-o[0].x+6*o[1].x+o[2].x)/6,(-o[0].y+6*o[1].y+o[2].y)/6,(o[1].x+6*o[2].x-o[3].x)/6,(o[1].y+6*o[2].y-o[3].y)/6,o[2].x,o[2].y])}return n}function As(e,t){var n=!t&&ls(e);if(!t&&n.curve)return ds(n.curve);for(var i=_s(e),r=t&&_s(t),o={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},a={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=function(e,t,n){var i,r;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(!(e[0]in{T:1,Q:1})&&(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(Ts.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"==n||"S"==n?(i=2*t.x-t.bx,r=2*t.y-t.by):(i=t.x,r=t.y),e=["C",i,r].concat(e.slice(1));break;case"T":"Q"==n||"T"==n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(Ss(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(Ss(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(ws(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(ws(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(ws(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(ws(t.x,t.y,t.X,t.Y))}return e},c=function(e,t){if(e[t].length>7){e[t].shift();for(var n=e[t];n.length;)l[t]="A",r&&(u[t]="A"),e.splice(t++,0,["C"].concat(n.splice(0,6)));e.splice(t,1),f=is(i.length,r&&r.length||0)}},p=function(e,t,n,o,a){e&&t&&"M"==e[a][0]&&"M"!=t[a][0]&&(t.splice(a,0,["M",o.x,o.y]),n.bx=0,n.by=0,n.x=e[a][1],n.y=e[a][2],f=is(i.length,r&&r.length||0))},l=[],u=[],h="",d="",m=0,f=is(i.length,r&&r.length||0);m<f;m++){i[m]&&(h=i[m][0]),"C"!=h&&(l[m]=h,m&&(d=l[m-1])),i[m]=s(i[m],o,d),"A"!=l[m]&&"C"==h&&(l[m]="C"),c(i,m),r&&(r[m]&&(h=r[m][0]),"C"!=h&&(u[m]=h,m&&(d=u[m-1])),r[m]=s(r[m],a,d),"A"!=u[m]&&"C"==h&&(u[m]="C"),c(r,m)),p(i,r,o,a,m),p(r,i,a,o,m);var y=i[m],v=r&&r[m],g=y.length,b=r&&v.length;o.x=y[g-2],o.y=y[g-1],o.bx=Ja(y[g-4])||o.x,o.by=Ja(y[g-3])||o.y,a.bx=r&&(Ja(v[b-4])||a.x),a.by=r&&(Ja(v[b-3])||a.y),a.x=r&&v[b-2],a.y=r&&v[b-1]}return r||(n.curve=ds(i)),r?[i,r]:i}var Rs=function(e,t,n){e=As(e),t=As(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{"C"==y[0]?(i=(u=[i,r].concat(y.slice(1)))[6],r=u[7]):(u=[i,r,i,r,s,c,s,c],i=s,r=c);for(var v=0,g=t.length;v<g;v++){var b=t[v];if("M"==b[0])o=p=b[1],a=l=b[2];else{"C"==b[0]?(o=(h=[o,a].concat(b.slice(1)))[6],a=h[7]):(h=[o,a,o,a,p,l,p,l],o=p,a=l);var x=xs(u,h,n);if(n)d+=x;else{for(var E=0,_=x.length;E<_;E++)x[E].segment1=m,x[E].segment2=v,x[E].bez1=u,x[E].bez2=h;d=d.concat(x)}}}}}return d},Ps={},Ms=s.isObject,ks=s.sortBy,Bs=Ya.pointDistance;function Ns(e){return{x:Math.round(e.x),y:Math.round(e.y)}}function Ds(e){return{top:e.y,right:e.x+(e.width||0),bottom:e.y+(e.height||0),left:e.x}}function Os(e,t){return Rs(e,t)}Ps.roundBounds=function(e){return{x:Math.round(e.x),y:Math.round(e.y),width:Math.round(e.width),height:Math.round(e.height)}},Ps.roundPoint=Ns,Ps.asTRBL=Ds,Ps.asBounds=function(e){return{x:e.left,y:e.top,width:e.right-e.left,height:e.bottom-e.top}},Ps.getMid=function(e){return Ns({x:e.x+(e.width||0)/2,y:e.y+(e.height||0)/2})},Ps.getOrientation=function(e,t,n){Ms(n=n||0)||(n={x:n,y:n});var i=Ds(e),r=Ds(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"},Ps.getElementLineIntersection=function(e,t,n){var i=Os(e,t);return 1===i.length?Ns(i[0]):2===i.length&&Bs(i[0],i[1])<1?Ns(i[0]):i.length>1?Ns((i=ks(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};var Ls={},Is=d.is,js=Ps.getMid,zs=Ps.asTRBL,Fs=Ps.getOrientation,$s=s.find,Gs=s.reduce,Ws=50,Hs=250,Vs=10;function qs(e,t){var n=zs(e);function i(e){return Is(e,"bpmn:SequenceFlow")}var r,o=Gs([].concat(Qs(e,i).map((r=5,function(e){return{shape:e,weight:r,distanceTo:function(e){return zs(e).left-n.right}}})),Zs(e,i).map(function(e){return function(t){return{shape:t,weight:e,distanceTo:function(e){var t=zs(e);return n.left-t.right}}}}(1))),function(e,t){return e[t.shape.id+"__weight_"+t.weight]=t,e},{}),a=Gs(o,function(e,t){var n,i,r,o=t.shape,a=t.weight,s=t.distanceTo,c=e.fav;return(n=s(o))<0||n>Hs?e:(i=(r=e[String(n)]=e[String(n)]||{value:n,count:0}).count+=1*a,(!c||c.count<i)&&(e.fav=r),e)},{});return a.fav?a.fav.value:Ws}function Us(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e,t){var n=Xs(e);return e.host&&(n=n.concat(Xs(e.host))),e.attachers&&(n=n.concat(e.attachers.reduce(function(e,t){return e.concat(Xs(t))},[]))),n}(e);return $s(r,function(e){return e!==n&&"intersect"===Fs(e,i,Vs)})}function Ys(e,t,n,i){function r(e){var r={x:n.x,y:n.y};return["x","y"].forEach(function(a){var s=i[a];if(s){var c="x"===a?"width":"height",p=s.margin,l=s.rowSize;r[a]=p<0?Math.min(e[a]+p-t[c]/2,n[a]-l+p):Math.max(o[a]+o[c]+p+t[c]/2,n[a]+l+p)}}),r}for(var o;o=Us(e,n,t);)n=r(o);return n}function Ks(){return!0}function Xs(e,t){return[].concat(Qs(e,t),Zs(e,t))}function Zs(e,t){return t||(t=Ks),e.incoming.filter(t).map(function(e){return e.source})}function Qs(e,t){return t||(t=Ks),e.outgoing.filter(t).map(function(e){return e.target})}Ls.getFlowNodePosition=function(e,t){var n=zs(e),i=js(e),r=qs(e,t),o="left",a=30;Is(e,"bpmn:BoundaryEvent")&&"top"===(o=Fs(e,e.host,-25))&&(a*=-1);var s={left:0,right:0,top:-80,bottom:80};return Ys(e,t,{x:n.right+r+t.width/2,y:i.y+s[o]},{y:{margin:a,rowSize:80}})},Ls.getTextAnnotationPosition=function(e,t){var n=zs(e);return Ys(e,t,{x:n.right+t.width/2,y:n.top-50-t.height/2},{y:{margin:-30,rowSize:20}})},Ls.getDataElementPosition=function(e,t){var n=zs(e);return Ys(e,t,{x:n.right-10+t.width/2,y:n.bottom+40+t.width/2},{x:{margin:30,rowSize:30}})},Ls.getDefaultPosition=function(e,t){var n=zs(e),i=js(e);return{x:n.right+Ws+t.width/2,y:i.y}};var Js={},ec=s.some,tc=d.is;function nc(e,t){return ec(t,function(t){return tc(e,t)})}Js.isAny=nc,Js.getParent=function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(nc(e,t))return e;return null};var ic=d.is,rc=Js.isAny,oc=Ls.getTextAnnotationPosition,ac=Ls.getDataElementPosition,sc=Ls.getFlowNodePosition,cc=Ls.getDefaultPosition;function pc(e,t){function n(t,n){return e.fire(t,n)}this.append=function(e,i){var r=n("autoPlace",{source:e,shape:i});r||(r=function(e,t){if(ic(t,"bpmn:TextAnnotation"))return oc(e,t);if(rc(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"]))return ac(e,t);if(ic(t,"bpmn:FlowNode"))return sc(e,t);return cc(e,t)}(e,i));var o=t.appendShape(e,i,r,e.parent);return n("autoPlace.end",{shape:o}),o}}pc.$inject=["eventBus","modeling"];var lc=pc;function uc(e,t){e.on("autoPlace.end",500,function(e){t.select(e.shape)})}uc.$inject=["eventBus","selection"];var hc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",lc],autoPlaceSelectionBehavior:["type",uc]},dc=s.forEach,mc=s.isFunction,fc=s.isArray,yc=s.isNumber;function vc(e){this._eventBus=e}vc.$inject=["eventBus"];var gc=vc;vc.prototype.on=function(e,t,n,i,r,o){if((mc(t)||yc(t))&&(o=r,r=i,i=n,n=t,t=null),mc(n)&&(o=r,r=i,i=n,n=1e3),"object"==typeof r&&(o=r,r=!1),!mc(i))throw new Error("handlerFn must be a function");fc(e)||(e=[e]);var a=this._eventBus;dc(e,function(e){var s=["commandStack",e,t].filter(function(e){return e}).join(".");a.on(s,n,r?function(e,t){return function(n){return e.call(t||null,n.context,n.command,n)}}(i,o):i,o)})};dc(["canExecute","preExecute","preExecuted","execute","executed","postExecute","postExecuted","revert","reverted"],function(e){vc.prototype[e]=function(t,n,i,r,o){(mc(t)||yc(t))&&(o=r,r=i,i=n,n=t,t=null),this.on(t,e,n,i,r,o)}});var bc=ui.getBBox,xc=Ps.asTRBL,Ec=Ps.asBounds,_c=s.assign,wc=s.flatten,Sc=s.forEach,Tc=s.values,Cc=s.groupBy;function Ac(e,t,n,i){gc.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var r=this;this.postExecuted(["shape.create"],function(e){var t=e.context,n=t.hints,i=t.shape,o=t.parent||t.newParent;n&&!1===n.root||r._expand([i],o)}),this.postExecuted(["elements.move"],function(e){var t=e.context,n=wc(Tc(t.closure.topLevel)),i=t.hints;if(!i||!1!==i.autoResize){var o=Cc(n,function(e){return e.parent.id});Sc(o,function(e,t){r._expand(e,t)})}})}Ac.$inject=["eventBus","elementRegistry","modeling","rules"],U(Ac,gc);var Rc=Ac;Ac.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=xc(bc(e)),o=xc(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),Ec(_c({},o,a))},Ac.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){this.resize(t,n);var i=t.parent;i&&this._expand([t],i)}}},Ac.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Ac.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Ac.prototype.resize=function(e,t){this._modeling.resizeShape(e,t)};var Pc=d.is;function Mc(e,t,n,i){Rc.call(this,e,t,n,i)}Mc.$inject=["eventBus","elementRegistry","modeling","rules"],U(Mc,Rc);var kc=Mc;function Bc(e){gc.call(this,e),this.init()}Mc.prototype.resize=function(e,t){Pc(e,"bpmn:Participant")?this._modeling.resizeLane(e,t):this._modeling.resizeShape(e,t)},Bc.$inject=["eventBus"],U(Bc,gc);var Nc=Bc;function Dc(e){Nc.call(this,e);var t=this;this.addRule("element.autoResize",function(e){return t.canResize(e.elements,e.target)})}Bc.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){i.canExecute(e,t,function(e,t,i){return n(e)},!0)})},Bc.prototype.init=function(){},Dc.$inject=["eventBus"],U(Dc,Nc);var Oc=Dc;Dc.prototype.canResize=function(e,t){return!1};var Lc=d.is,Ic=s.forEach;function jc(e,t){Oc.call(this,e),this._modeling=t}U(jc,Oc),jc.$inject=["eventBus","modeling"];var zc=jc;jc.prototype.canResize=function(e,t){if(!Lc(t,"bpmn:Participant")&&!Lc(t,"bpmn:Lane")&&!Lc(t,"bpmn:SubProcess"))return!1;var n=!0;return Ic(e,function(e){(Lc(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var Fc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",kc],bpmnAutoResizeProvider:["type",zc]},$c={},Gc=s.filter,Wc=Math.max,Hc=Math.min,Vc=20,qc=ui.getBBox,Uc=Ps.asTRBL,Yc=Ps.asBounds;function Kc(e){return"number"==typeof e}function Xc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return Kc(r)&&(i=(/top|left/.test(e)?Hc:Wc)(i,r)),Kc(o)&&(i=(/top|left/.test(e)?Wc:Hc)(i,o)),i}function Zc(e,t){return void 0!==e?e:Vc}function Qc(e,t){var n,i,r,o;return"object"==typeof t?(n=Zc(t.left),i=Zc(t.right),r=Zc(t.top),o=Zc(t.bottom)):n=i=r=o=Zc(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}function Jc(e){return!e.waypoints&&"label"!==e.type}$c.substractTRBL=function(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}},$c.resizeBounds=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)}},$c.resizeTRBL=function(e,t){return{x:e.x+(t.left||0),y:e.y+(t.top||0),width:e.width-(t.left||0)+(t.right||0),height:e.height-(t.top||0)+(t.bottom||0)}},$c.ensureConstraints=function(e,t){if(!t)return e;var n=Uc(e);return Yc({top:Xc("top",n,t),right:Xc("right",n,t),bottom:Xc("bottom",n,t),left:Xc("left",n,t)})},$c.getMinResizeBounds=function(e,t,n,i){var r=Uc(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},a=i?Uc(i):o,s={top:Hc(o.top,a.top),left:Hc(o.left,a.left),bottom:Wc(o.bottom,a.bottom),right:Wc(o.right,a.right)};return Yc(s)},$c.computeChildrenBBox=function(e,t){var n;if((n=void 0===e.length?Gc(e.children,Jc):e).length)return Qc(qc(n),t)};var ep={},tp=d.is,np=Js.getParent,ip=Ps.asTRBL,rp=$c.substractTRBL,op=$c.resizeTRBL,ap=Math.abs;var sp=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function cp(e,t){return t=t||[],e.children.filter(function(e){tp(e,"bpmn:Lane")&&(cp(e,t),t.push(e))}),t}function pp(e){return np(e,sp)||e}ep.LANE_INDENTATION=30,ep.collectLanes=cp,ep.getChildLanes=function(e){return e.children.filter(function(e){return tp(e,"bpmn:Lane")})},ep.getLanesRoot=pp,ep.computeLanesResize=function(e,t){var n=pp(e),i=cp(n,tp(n,"bpmn:Process")?[]:[n]),r=ip(e),o=ip(t),a=function(e,t){return rp(ip(t),ip(e))}(e,t),s=[];return i.forEach(function(t){if(t!==e){var n=0,i=a.right,c=0,p=a.left,l=ip(t);a.top&&(ap(l.bottom-r.top)<10&&(c=o.top-l.bottom),ap(l.top-r.top)<5&&(n=o.top-l.top)),a.bottom&&(ap(l.top-r.bottom)<10&&(n=o.bottom-l.top),ap(l.bottom-r.bottom)<5&&(c=o.bottom-l.bottom)),(n||i||c||p)&&s.push({shape:t,newBounds:op(t,{top:n,right:i,bottom:c,left:p})})}}),s};var lp=s.assign,up=s.forEach,hp=s.isArray,dp=d.is,mp=f.isExpanded,fp=Js.isAny,yp=ep.getChildLanes,vp=f.isEventSubProcess,gp=_o.hasPrimaryModifier;function bp(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(gp(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}bp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"];var xp=bp;function Ep(e,t,n){var i=e.$instanceOf(t),r=!1,o=e.eventDefinitions||[];return up(o,function(e){e.$type===n&&(r=!0)}),i&&r}bp.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,a=this._popupMenu,s=this._canvas,c=this._rules,p=this._autoPlace,l=this._translate,u={};if("label"===e.type)return u;var h,d=e.businessObject;function m(e,t){r.start(e,t)}function f(e,t,n,r){function a(t,n){var a=i.createShape(lp({type:e},r));o.start(t,a,n)}return"string"!=typeof n&&(r=n,n=l("Append {type}",{type:e.replace(/^bpmn:/,"")})),{group:"model",className:t,title:n,action:{dragstart:a,click:p?function(t,n){var o=i.createShape(lp({type:e},r));p.append(n,o)}:a}}}function y(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(fp(d,["bpmn:Lane","bpmn:Participant"])&&mp(d)){var v=yp(e);lp(u,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add Lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&(e.height>=120&&lp(u,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two Lanes"),action:{click:y(2)}}}),e.height>=180&&lp(u,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three Lanes"),action:{click:y(3)}}})),lp(u,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add Lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}dp(d,"bpmn:FlowNode")&&(dp(d,"bpmn:EventBasedGateway")?lp(u,{"append.receive-task":f("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":f("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Ep(d,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?lp(u,{"append.compensation-activity":f("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):dp(d,"bpmn:EndEvent")||d.isForCompensation||Ep(d,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||vp(d)||lp(u,{"append.end-event":f("bpmn:EndEvent","bpmn-icon-end-event-none"),"append.gateway":f("bpmn:ExclusiveGateway","bpmn-icon-gateway-xor"),"append.append-task":f("bpmn:Task","bpmn-icon-task"),"append.intermediate-event":f("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none")})),a._providers["bpmn-replace"]&&(h=a.create("bpmn-replace",e)),h&&!h.isEmpty()&&lp(u,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change type"),action:{click:function(e,n){h.open(lp(function(e){var n=s.getContainer(),i=t.getPad(e).html,r=n.getBoundingClientRect(),o=i.getBoundingClientRect(),a=o.top-r.top;return{x:o.left-r.left,y:a+o.height+5}}(n),{cursor:{x:e.x,y:e.y}}),n)}}}}),fp(d,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&lp(u,{"append.text-annotation":f("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using "+(d.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:m,dragstart:m}}}),fp(d,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&lp(u,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using DataInputAssociation"),action:{click:m,dragstart:m}}});var g=c.allowed("elements.delete",{elements:[e]});return hp(g)&&(g=g[0]===e),g&&lp(u,{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Remove"),action:{click:function(t){n.removeElements([e])}}}}),u};var _p={},wp=d.getBusinessObject,Sp=f.isExpanded;_p.isDifferentType=function(e){return function(t){var n=t.target,i=wp(e),r=i.eventDefinitions&&i.eventDefinitions[0],o=i.$type===n.type,a=(r&&r.$type)===n.eventDefinitionType,s=i.triggeredByEvent===n.triggeredByEvent,c=void 0===n.isExpanded||n.isExpanded===Sp(i);return!(o&&a&&s&&c)}};var Tp={START_EVENT:[{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"}}],INTERMEDIATE_EVENT:[{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"}}],END_EVENT:[{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"}}],GATEWAY:[{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"}}],SUBPROCESS_EXPANDED:[{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}}],TRANSACTION:[{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}}],EVENT_SUB_PROCESS:[{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}}],TASK:[{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}}],BOUNDARY_EVENT:[{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}}],EVENT_SUB_PROCESS_START_EVENT:[{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}}],SEQUENCE_FLOW:[{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"}],PARTICIPANT:[{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}}]},Cp=d.is,Ap=f.isEventSubProcess,Rp=d.getBusinessObject,Pp=f.isExpanded,Mp=_p.isDifferentType,kp=s.forEach,Bp=s.filter;function Np(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()}Np.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Np.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Np.prototype.getEntries=function(e){var t,n=e.businessObject;if(!this._rules.allowed("shape.replace",{element:e}))return[];var i=Mp(e);return Cp(n,"bpmn:StartEvent")&&!Ap(n.$parent)?(t=Bp(Tp.START_EVENT,i),this._createEntries(e,t)):Cp(n,"bpmn:Participant")?(t=Bp(Tp.PARTICIPANT,function(e){return Pp(n)!==e.target.isExpanded}),this._createEntries(e,t)):Cp(n,"bpmn:StartEvent")&&Ap(n.$parent)?(t=Bp(Tp.EVENT_SUB_PROCESS_START_EVENT,function(t){var n=!1!==t.target.isInterrupting,r=Rp(e).isInterrupting===n;return i(t)||!i(t)&&!r}),this._createEntries(e,t)):Cp(n,"bpmn:EndEvent")?(t=Bp(Tp.END_EVENT,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Cp(n.$parent,"bpmn:Transaction"))&&i(e)}),this._createEntries(e,t)):Cp(n,"bpmn:BoundaryEvent")?(t=Bp(Tp.BOUNDARY_EVENT,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Cp(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,o=n.cancelActivity==r;return i(e)||!i(e)&&!o}),this._createEntries(e,t)):Cp(n,"bpmn:IntermediateCatchEvent")||Cp(n,"bpmn:IntermediateThrowEvent")?(t=Bp(Tp.INTERMEDIATE_EVENT,i),this._createEntries(e,t)):Cp(n,"bpmn:Gateway")?(t=Bp(Tp.GATEWAY,i),this._createEntries(e,t)):Cp(n,"bpmn:Transaction")?(t=Bp(Tp.TRANSACTION,i),this._createEntries(e,t)):Ap(n)&&Pp(n)?(t=Bp(Tp.EVENT_SUB_PROCESS,i),this._createEntries(e,t)):Cp(n,"bpmn:SubProcess")&&Pp(n)?(t=Bp(Tp.SUBPROCESS_EXPANDED,i),this._createEntries(e,t)):Cp(n,"bpmn:AdHocSubProcess")&&!Pp(n)?(t=Bp(Tp.TASK,function(t){var n=t.target,i="bpmn:SubProcess"===n.type,r=!0===n.isExpanded;return Mp(e,n)&&(!i||r)}),this._createEntries(e,t)):Cp(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Tp.SEQUENCE_FLOW):Cp(n,"bpmn:FlowNode")?(t=Bp(Tp.TASK,i),Cp(n,"bpmn:SubProcess")&&!Pp(n)&&(t=Bp(t,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(e,t)):[]},Np.prototype.getHeaderEntries=function(e){var t=[];return Cp(e,"bpmn:Activity")&&!Ap(e)&&(t=t.concat(this._getLoopEntries(e))),!Cp(e,"bpmn:SubProcess")||Cp(e,"bpmn:Transaction")||Ap(e)||t.push(this._getAdHocEntry(e)),t},Np.prototype._createEntries=function(e,t){var n=[],i=this;return kp(t,function(t){var r=i._createMenuEntry(t,e);n.push(r)}),n},Np.prototype._createSequenceFlowEntries=function(e,t){var n=Rp(e),i=[],r=this._modeling,o=this._moddle,a=this;return kp(t,function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Cp(n.sourceRef,"bpmn:ExclusiveGateway")||Cp(n.sourceRef,"bpmn:InclusiveGateway")||Cp(n.sourceRef,"bpmn:ComplexGateway")||Cp(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&Cp(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(t,e,function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}));break;default:if(Cp(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e,{conditionExpression:void 0})}));if((Cp(n.sourceRef,"bpmn:ExclusiveGateway")||Cp(n.sourceRef,"bpmn:InclusiveGateway")||Cp(n.sourceRef,"bpmn:ComplexGateway")||Cp(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(t,e,function(){r.updateProperties(e.source,{default:void 0})}))}}),i},Np.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}},Np.prototype._getLoopEntries=function(e){var t=this,n=this._translate;function i(n,i){var r;i.active?r=void 0:(r=t._moddle.create(i.options.loopCharacteristics),i.options.isSequential&&(r.isSequential=i.options.isSequential)),t._modeling.updateProperties(e,{loopCharacteristics:r})}var r,o,a,s=Rp(e).loopCharacteristics;return s&&(r=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:n("Parallel Multi Instance"),active:a,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:n("Sequential Multi Instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Np.prototype._getAdHocEntry=function(e){var t=this._translate,n=Rp(e),i=Cp(n,"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:t("Ad-hoc"),active:i,action:function(t,n){return r(e,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var Dp=Np,Op={},Lp=s.forEach;Op.IGNORED_PROPERTIES=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"],Op.getProperties=function(e,t){var n=[];return Lp(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n};var Ip=s.forEach,jp=s.filter,zp=s.some,Fp=s.sortBy,$p=s.isArray,Gp=Op.IGNORED_PROPERTIES;function Wp(e,t){this._eventBus=e,this._bpmnFactory=t}var Hp=Wp;Wp.prototype.clone=function(e,t,n){var i=this,r={newElement:t,hasNestedProperty:!1};return n=Fp(n,function(e){return"bpmn:extensionElements"===e}),Ip(n,function(n){var o,a,s,c=e.get(n),p=t.get(n),l=t.$model.getPropertyDescriptor(t,n);p!==c&&(l&&(l.isId||l.isReference)||(s=c,zp(["boolean","string","number"],function(e){return typeof s===e})||null===c?t.set(n,c):$p(c)?Ip(c,function(e){var n;r.refTopLevelProperty=e,n=i._deepClone(e,r),r.hasNestedProperty&&(n.$parent=t,p.push(n)),r.hasNestedProperty=!1}):(a=n.replace(/bpmn:/,""),r.refTopLevelProperty=c,o=i._deepClone(c,r),r.hasNestedProperty&&(t[a]=o),r.hasNestedProperty=!1)))}),t},Wp.prototype._deepClone=function(e,t){var n=this,i=this._eventBus,r=this._bpmnFactory.create(e.$type),o=jp(Object.keys(e),function(e){var t=r.$model.getPropertyDescriptor(r,e);return(!t||!t.isId&&!t.isReference)&&(-1===Gp.indexOf(e)&&"$type"!==e)});return o.length||(t.hasNestedProperty=!0),Ip(o,function(o){void 0!==e[o]&&(e[o].$type||$p(e[o]))?$p(e[o])?(r[o]=[],Ip(e[o],function(a){var s,c=e.$model.getTypeDescriptor(a.$type);if(c){if(!i.fire("property.clone",{newElement:t.newElement,refTopLevelProperty:t.refTopLevelProperty,propertyDescriptor:c})&&"bpmn:ExtensionElements"===e.$type&&c.meta&&c.meta.allowedIn&&!function(e,t){var n=e.meta.allowedIn;return 1===n.length&&"*"===n[0]||-1!==n.indexOf(t)}(c,t.newElement.$type))return!1;(s=n._deepClone(a,t)).$parent=r,r[o]||(r[o]=[]),t.hasNestedProperty=!0,r[o].push(s)}})):e[o].$type&&(r[o]=n._deepClone(e[o],t),r[o]&&(t.hasNestedProperty=!0,r[o].$parent=r)):(t.hasNestedProperty=!0,r[o]=e[o])}),r};var Vp=s.pick,qp=s.assign,Up=s.uniqueBy,Yp=s.findIndex,Kp=s.filter,Xp=s.has,Zp=d.is,Qp=Js.isAny,Jp=f.isExpanded,el=f.isEventSubProcess,tl=Op.getProperties,nl=Op.IGNORED_PROPERTIES,il=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function rl(e,t,n,i,r){var o=new Hp(r,e);this.replaceElement=function(r,a,s){s=s||{};var c=a.type,p=r.businessObject;if(al(p)&&"bpmn:SubProcess"===c&&function(e,t){var n=e&&Xp(e,"collapsed")?e.collapsed:!Jp(e);return n!==(t&&(Xp(t,"collapsed")||Xp(t,"isExpanded"))?Xp(t,"collapsed")?t.collapsed:!t.isExpanded:n)&&(e.collapsed=n,!0)}(r,a))return i.toggleCollapse(r),r;var l=e.create(c),u={type:c,businessObject:l},h=tl(p.$descriptor),d=tl(l.$descriptor,!0),m=Up(function(e){return e},Kp(h,function(e){return-1!==Yp(d,e)}));return qp(l,Vp(a,il)),m=Kp(m,function(e){var t=e.replace(/bpmn:/,"");return void 0===l[e]&&("loopCharacteristics"===t?!el(l):("processRef"!==t||!1!==a.isExpanded)&&"triggeredByEvent"!==t&&"eventDefinitions"!==t&&-1===nl.indexOf(t))}),l=o.clone(p,l,m),a.eventDefinitionType&&(u.eventDefinitionType=a.eventDefinitionType),Zp(p,"bpmn:Activity")&&(al(p)?u.isExpanded=Jp(p):a&&Xp(a,"isExpanded")&&(u.isExpanded=a.isExpanded),Jp(p)&&!Zp(p,"bpmn:Task")&&u.isExpanded&&(u.width=r.width,u.height=r.height)),al(p)&&!al(l)&&(s.moveChildren=!1),Zp(p,"bpmn:Participant")&&(!0===a.isExpanded?l.processRef=e.create("bpmn:Process"):s.moveChildren=!1,u.width=r.width,u.height=r.height),l.name=p.name,Qp(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Qp(l,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(l.default=p.default),("fill"in p.di||"stroke"in p.di)&&qp(u,{colors:Vp(p.di,["fill","stroke"])}),u=t.replaceElement(r,u,s),!1!==s.select&&n.select(u),u}}rl.$inject=["bpmnFactory","replace","selection","modeling","eventBus"];var ol=rl;function al(e){return Zp(e,"bpmn:SubProcess")}function sl(e){this._modeling=e}var cl=sl;sl.$inject=["modeling"],sl.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=Math.ceil(e.x+(t.width||e.width)/2),t.y=Math.ceil(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var pl={__depends__:[{__init__:["replace"],replace:["type",cl]},aa],bpmnReplace:["type",ol]},ll=s.forEach,ul=s.assign,hl=s.find,dl=s.matchPattern,ml=Y.delegate,fl=Y.domify,yl=Y.classes,vl=Y.attr,gl=Y.remove;function bl(e,t){this._eventBus=e,this._canvas=t,this._providers={}}bl.$inject=["eventBus","canvas"],bl.prototype.registerProvider=function(e,t){this._providers[e]=t},bl.prototype.create=function(e,t){var n=this._providers[e];if(!n)throw new Error("Provider is not registered: "+e);if(!t)throw new Error("Element is missing");var i=this._current={provider:n,className:e,element:t};return n.getHeaderEntries&&(i.headerEntries=n.getHeaderEntries(t)),i.entries=n.getEntries(t),this},bl.prototype.isEmpty=function(){var e=this._current;return 0===e.entries.length&&e.headerEntries&&0===e.headerEntries.length},bl.prototype.open=function(e){if(!e)throw new Error("the position argument is missing");this.isOpen()&&this.close();var t=this._current,n=this._canvas.getContainer();t.position=e,t.container=this._createContainer();var i=t.headerEntries||[],r=t.entries||[];return i.length&&t.container.appendChild(this._createEntries(t.headerEntries,"djs-popup-header")),r.length&&t.container.appendChild(this._createEntries(t.entries,"djs-popup-body")),this._attachContainer(t.container,n,e.cursor),this},bl.prototype.close=function(){this.isOpen()&&(this._unbindHandlers(),gl(this._current.container),this._current.container=null)},bl.prototype.isOpen=function(){return!!this._current.container},bl.prototype.trigger=function(e){e.preventDefault();var t=e.delegateTarget||e.target,n=vl(t,"data-id"),i=this._getEntry(n);if(i.action)return i.action.call(null,e,i)},bl.prototype._getEntry=function(e){var t=dl({id:e}),n=hl(this._current.entries,t)||hl(this._current.headerEntries,t);if(!n)throw new Error("entry not found");return n},bl.prototype._createContainer=function(){var e=fl('<div class="djs-popup">'),t=this._current.position,n=this._current.className;return ul(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),yl(e).add(n),e},bl.prototype._attachContainer=function(e,t,n){var i=this;ml.bind(e,".entry","click",function(e){i.trigger(e)});var r=this._canvas.zoom();e.style.transformOrigin="top left",e.style.transform="scale("+r+")",t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},bl.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"),ul(e.style,{left:n,top:i},{visibility:"visible","z-index":1e3})},bl.prototype._createEntries=function(e,t){var n=fl("<div>"),i=this;return yl(n).add(t),ll(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},bl.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=fl("<div>"),n=yl(t);if(n.add("entry"),e.className&&n.add(e.className),vl(t,"data-id",e.id),e.label){var i=fl("<span>");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(fl('<img src="'+e.imageUrl+'" />')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},bl.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)},bl.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 xl={__depends__:[{__init__:["popupMenu"],popupMenu:["type",bl]},pl],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Dp]},El=s.assign,_l=s.bind,wl=s.pick,Sl=Y.domify,Tl=Y.query,Cl=Y.event,Al=Y.remove,Rl=Math.min,Pl=Math.max;function Ml(e){e.preventDefault()}function kl(e){e.stopPropagation()}function Bl(e){this.container=e.container,this.parent=Sl('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=Tl("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=_l(this.autoResize,this),this.handlePaste=_l(this.handlePaste,this)}var Nl=Bl;Bl.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{},t=this.style=t||{};var s=wl(t,["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);El(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",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=wl(t,["fontSize","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return El(o.style,{boxSizing:"border-box",width:"100%",outline:"none"},c),i.centerVertically&&El(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,Cl.bind(o,"keydown",this.keyHandler),Cl.bind(o,"mousedown",kl),Cl.bind(o,"paste",this.handlePaste),i.autoResize&&Cl.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},Bl.prototype.handlePaste=function(e){var t,n,i=this,r=this.options,o=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),!document.execCommand("insertHTML",!1,t)){var a,s,c=this.getSelection(),p=c.startContainer,l=c.endContainer,u=c.startOffset,h=c.endOffset,d=c.commonAncestorContainer,m=(n=d.childNodes,[].slice.call(n));if(d.nodeType===Node.TEXT_NODE){var f=p.textContent;p.textContent=f.substring(0,u)+t+f.substring(h),a=p,s=u+t.length}else if(p===this.content&&l===this.content){var y=document.createTextNode(t);this.content.insertBefore(y,m[u]),a=y,s=y.textContent.length}else{var v=m.indexOf(p),g=m.indexOf(l);m.forEach(function(e,n){n===v?e.textContent=p.textContent.substring(0,u)+t+l.textContent.substring(h):n>v&&n<=g&&Al(e)}),a=p,s=u+t.length}a&&void 0!==s&&setTimeout(function(){i.setSelection(a,s)})}if(r.autoResize){var b=this.autoResize(o);b&&this.resizeHandler(b)}},Bl.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})}},Bl.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,a=parseInt(this.style.maxHeight)||1/0;if(!n){var s,c,p,l;n=this.resizeHandle=Sl('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Ml(n),kl(n);var u=Rl(Pl(p+n.clientX-s,i),o),h=Rl(Pl(l+n.clientY-c,r),a);t.style.width=u+"px",t.style.height=h+"px",e.resizeHandler({width:p,height:l,dx:n.clientX-s,dy:n.clientY-c})},h=function(e){Ml(e),kl(e),Cl.unbind(document,"mousemove",u,!1),Cl.unbind(document,"mouseup",h,!1)};Cl.bind(n,"mousedown",function(e){Ml(e),kl(e),s=e.clientX,c=e.clientY;var n=t.getBoundingClientRect();p=n.width,l=n.height,Cl.bind(document,"mousemove",u),Cl.bind(document,"mouseup",h)})}El(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Bl.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),Cl.unbind(t,"keydown",this.keyHandler),Cl.unbind(t,"mousedown",kl),Cl.unbind(t,"input",this.autoResize),Cl.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),Al(n)),Al(e)},Bl.prototype.getValue=function(){return this.content.innerText},Bl.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Bl.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)};var Dl=s.bind,Ol=s.find;function Ll(e,t){this._eventBus=e,this._providers=[],this._textbox=new Nl({container:t.getContainer(),keyHandler:Dl(this._handleKey,this),resizeHandler:Dl(this._handleResize,this)})}Ll.$inject=["eventBus","canvas"],Ll.prototype.registerProvider=function(e){this._providers.push(e)},Ll.prototype.isActive=function(){return!!this._active},Ll.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Ll.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Ll.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},Ll.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()}},Ll.prototype.getValue=function(){return this._textbox.getValue()},Ll.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())},Ll.prototype._handleResize=function(e){this._fire("resize",e)},Ll.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=Ol(this._providers,function(n){return(t=n.activate(e))?n:null});return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Il={__depends__:[jo],__init__:["directEditing"],directEditing:["type",Ll]},jl=Ps.getElementLineIntersection,zl=Ps.getMid,Fl="connect-ok",$l="connect-not-ok",Gl=n.append,Wl=n.attr,Hl=n.create,Vl=n.remove;function ql(e,t,n,i,r,o){function a(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.move",function(e){var t,n=e.context,i=n.source,r=n.target,a=n.visual;t=function(e,t,n,i){var r=o.getShapePath(n),a=i&&o.getShapePath(i),s=o.getConnectionPath({waypoints:[e,t]});return[e=jl(r,s,!0)||e,t=i&&jl(a,s,!1)||t]}(n.sourcePosition,{x:e.x,y:e.y},i,r),Wl(a,{points:[t[0].x,t[0].y,t[1].x,t[1].y]})}),e.on("connect.hover",function(e){var t,n=e.context,i=n.source,o=e.hover;null!==(t=n.canExecute=a(i,o))&&(n.target=o,r.addMarker(o,t?Fl:$l))}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target&&r.removeMarker(t.target,t.canExecute?Fl:$l),t.target=null,t.canExecute=!1}),e.on("connect.cleanup",function(e){var t=e.context;t.visual&&Vl(t.visual)}),e.on("connect.start",function(e){var t,n=e.context;t=Hl("polyline"),Wl(t,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),Gl(r.getDefaultLayer(),t),n.visual=t}),e.on("connect.end",function(e){var t=e.context,i=t.source,r=t.sourcePosition,o=t.target,s={x:e.x,y:e.y},c=t.canExecute||a(i,o);if(!c)return!1;var p=null,l={connectionStart:r,connectionEnd:s};"object"==typeof c&&(p=c),n.connect(i,o,p,l)}),this.start=function(e,n,i,r){"object"!=typeof i&&(r=i,i=zl(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{source:n,sourcePosition:i}}})}}ql.$inject=["eventBus","dragging","modeling","rules","canvas","graphicsFactory"];var Ul=ql,Yl=Math.round,Kl=s.assign,Xl=Y.event,Zl="djs-drag-active";function Ql(e){e.preventDefault()}function Jl(e){go.stopPropagation(e)}function eu(e,t){return{x:e.x-t.x,y:e.y-t.y}}function tu(e,t,n){var i,r={threshold:5,trapClick:!0};function o(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+Yl((e.x-i.left)/n.scale),y:n.y+Yl((e.y-i.top)/n.scale)}}function a(t,n){n=n||i;var r=e.createEvent(Kl({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function s(e,r){var s,c=i.payload,p=i.displacement,l=i.globalStart,u=go.toPoint(e),h=eu(u,l),d=i.localStart,f=o(u),y=eu(f,d);if(!i.active&&(r||(s=h,Math.sqrt(Math.pow(s.x,2)+Math.pow(s.y,2))>i.threshold))){if(Kl(c,{x:d.x+p.x,y:d.y+p.y,dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(c.previousSelection=n.get(),n.select(null)),i.cursor&&_a.set(i.cursor),t.addMarker(t.getRootElement(),Zl)}Jl(e),i.active&&(Kl(c,{x:f.x+p.x,y:f.y+p.y,dx:y.x,dy:y.y},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,Jl(e)),t=a("end")),!1===t&&a("rejected"),a("ended",f(!0!==t))}function p(e){27===e.which&&(e.preventDefault(),m())}function l(t){var n;i.active&&(n=xa.install(e),setTimeout(n,400)),c(t)}function u(e){s(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function d(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=f(e),n&&a("canceled",t)}}function f(r){var o,f;a("cleanup"),_a.unset(),f=i.trapClick?l:c,Xl.unbind(document,"mousemove",s),Xl.unbind(document,"dragstart",Ql),Xl.unbind(document,"selectstart",Ql),Xl.unbind(document,"mousedown",f,!0),Xl.unbind(document,"mouseup",f,!0),Xl.unbind(document,"keyup",p),Xl.unbind(document,"touchstart",u,!0),Xl.unbind(document,"touchcancel",m,!0),Xl.unbind(document,"touchmove",s,!0),Xl.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",d),t.removeMarker(t.getRootElement(),Zl);var y=i.payload.previousSelection;return!1!==r&&y&&!n.get().length&&n.select(y),o=i,i=null,o}e.on("diagram.destroy",m),this.init=function(t,n,f,y){i&&m(!1),"string"==typeof n&&(y=f,f=n,n=null);var v,g,b,x,E,_=(y=Kl({},r,y||{})).data||{};x=y.trapClick?l:c,t?(v=go.getOriginal(t)||t,g=go.toPoint(t),Jl(t),"dragstart"===v.type&&Ql(v)):(v=null,g={x:0,y:0}),b=o(g),n||(n=b),E=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),i=Kl({prefix:f,data:_,payload:{},globalStart:g,displacement:eu(n,b),localStart:b,isTouch:E},y),y.manual||(E?(Xl.bind(document,"touchstart",u,!0),Xl.bind(document,"touchcancel",m,!0),Xl.bind(document,"touchmove",s,!0),Xl.bind(document,"touchend",c,!0)):(Xl.bind(document,"mousemove",s),Xl.bind(document,"dragstart",Ql),Xl.bind(document,"selectstart",Ql),Xl.bind(document,"mousedown",x,!0),Xl.bind(document,"mouseup",x,!0)),Xl.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",d)),a("init"),y.autoActivate&&s(t,!0)},this.move=s,this.hover=h,this.out=d,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){Kl(r,e)}}tu.$inject=["eventBus","canvas","selection"];var nu=tu,iu=Y.closest;function ru(e,t,n){var i=this;e.on("drag.start",function(t){e.once("drag.move",function(){e.once("drag.move",function(e){i.ensureHover(e)})})}),this.ensureHover=function(e){if(!e.hover){var i,r,o,a=e.originalEvent;a instanceof MouseEvent&&(i=go.toPoint(a),(o=function(e){return iu(e,"svg, .djs-element",!0)}(document.elementFromPoint(i.x,i.y)))&&(r=n.get(o),t.hover({element:r,gfx:o})))}}}ru.$inject=["eventBus","dragging","elementRegistry"];var ou={__init__:["hoverFix"],__depends__:[aa],dragging:["type",nu],hoverFix:["type",ru]};function au(e){this._commandStack=e.get("commandStack",!1)}au.$inject=["injector"];var su=au;au.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var cu={__init__:["rules"],rules:["type",su]},pu={__depends__:[aa,cu,ou],connect:["type",Ul]},lu=s.isFunction,uu=s.isArray,hu=s.forEach,du=Y.delegate,mu=Y.event,fu=Y.attr,yu=Y.query,vu=Y.classes,gu=Y.domify;function bu(e,t){this._providers=[],this._eventBus=e,this._overlays=t,this._current=null,this._init()}bu.$inject=["eventBus","overlays"];var xu=bu;bu.prototype._init=function(){var e=this._eventBus,t=this;e.on("selection.changed",function(e){var n=e.newSelection;1===n.length?t.open(n[0]):t.close()}),e.on("elements.delete",function(e){var n=e.elements;hu(n,function(e){t.isOpen(e)&&t.close()})}),e.on("element.changed",function(e){var n=e.element,i=t._current;i&&i.element===n&&t.open(n,!0)})},bu.prototype.registerProvider=function(e){this._providers.push(e)},bu.prototype.getEntries=function(e){var t={};return hu(this._providers,function(n){var i=n.getContextPadEntries(e);hu(i,function(e,n){t[n]=e})}),t},bu.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[fu(s,"data-action")].action,r=t.originalEvent||t,lu(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},bu.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},bu.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),i=n.html;hu(t,function(e,t){var n,r,o,a,s=e.group||"default",c=gu(e.html||'<div class="entry" draggable="true"></div>');fu(c,"data-action",t),(n=yu("[data-group="+s+"]",i))||(n=gu('<div class="group" data-group="'+s+'"></div>'),i.appendChild(n)),n.appendChild(c),e.className&&(r=c,o=e.className,a=vu(r),(uu(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.title&&fu(c,"title",e.title),e.imageUrl&&c.appendChild(gu('<img src="'+e.imageUrl+'">'))}),vu(i).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},bu.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=gu('<div class="djs-context-pad"></div>');du.bind(i,".entry","click",function(e){t.trigger("click",e)}),du.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),mu.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",{position:{right:-9,top:-6},html:i});var r=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:r}),r},bu.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},bu.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var Eu={__depends__:[jo,vo],contextPad:["type",xu]},_u=750,wu="drop-ok",Su="drop-not-ok",Tu="attach-ok",Cu="new-parent",Au=n.append,Ru=n.attr,Pu=n.classes,Mu=n.create,ku=n.remove,Bu=w.translate;function Nu(e,t,n,i,r,o,a){function s(e,t){[Tu,wu,Su,Cu].forEach(function(n){n===t?r.addMarker(e,n):r.removeMarker(e,n)})}e.on("create.move",function(e){var t,i=e.context,r=e.hover,o=i.shape,a=i.source,c={x:e.x,y:e.y};t=i.canExecute=r&&function(e,t,i,r){if(!t)return!1;var o,a,s,c={source:i,shape:e,target:t,position:r};return(a=n.allowed("shape.attach",c))||(o=n.allowed("shape.create",c)),(o||a)&&(s=i&&n.allowed("connection.create",{source:i,target:e,hints:{targetParent:t,targetAttach:a}})),!(!o&&!a)&&{attach:a,connect:s}}(o,r,a,c),r&&null!==t&&(i.target=r,t&&t.attach?s(r,Tu):s(r,t?Cu:Su))}),e.on("create.move",_u,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;t=Mu("g"),Ru(t,o.cls("djs-drag-group",["no-events"])),Au(r.getDefaultLayer(),t),n=Mu("g"),Pu(n).add("djs-dragger"),Au(t,n),Bu(n,e.width/-2,e.height/-2);var s=Mu("g");return Pu(s).add("djs-visual"),Au(n,s),i=s,a.drawShape(i,e),t}(n)),Bu(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,r=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect,p={x:e.x,y:e.y};if(!a)return!1;r=c?i.appendShape(n,r,p,o,{attach:s,connection:!0===c?{}:c}):i.createShape(r,p,o,{attach:s}),t.shape=r}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&ku(t.visual)}),this.start=function(e,n,i){t.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:n,context:{shape:n,source:i}}})}}Nu.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var Du={__depends__:[ou,aa,cu],create:["type",Nu]},Ou={__depends__:[Il,Eu,aa,pu,Du,xl],__init__:["contextPadProvider"],contextPadProvider:["type",xp]},Lu=d.getBusinessObject,Iu=d.is,ju=Op.getProperties,zu=Op.IGNORED_PROPERTIES,Fu=s.filter,$u=s.forEach;function Gu(e,t,n){$u(n,function(n){void 0!==t[n]&&(e[n]=t[n])})}function Wu(e,t,n,i,r,o){var a=new Hp(t,e);n.registerDescriptor(function(e,t){var n=t.oldBusinessObject=Lu(e),i={};return t.type=e.type,Gu(t,n.di,["isExpanded"]),Gu(i,n.di,["fill","stroke"]),t.colors=i,"label"===e.type?t:(Gu(t,n,["processRef","triggeredByEvent"]),n.default&&(t.default=n.default.id),t)}),t.on("element.paste",function(t){var n,i,s,c,p=t.descriptor,l=t.createdElements,u=p.parent,h=r.getRootElement(),d=p.oldBusinessObject;n=e.create(d.$type);var m=ju(d.$descriptor);m=Fu(m,function(e){return-1===zu.indexOf(e.replace(/bpmn:/,""))}),p.businessObject=a.clone(d,n,m),"label"!==p.type&&(Iu(u,"bpmn:Process")&&(p.parent=Iu(h,"bpmn:Collaboration")?h:u),"bpmn:DataOutputAssociation"!==p.type&&"bpmn:DataInputAssociation"!==p.type&&"bpmn:MessageFlow"!==p.type||(p.parent=h),Iu(u,"bpmn:Lane")&&(p.parent=u.parent),p.waypoints&&(i=l[p.source],s=l[p.target],i&&s&&(i=i.element,s=s.element),(c=o.canConnect(i,s))&&(p.type=c.type)),delete n.id,e._ensureId(n),"bpmn:Participant"===p.type&&p.processRef&&(p.processRef=n.processRef=e.create("bpmn:Process")),Gu(n,p,["isExpanded","triggeredByEvent"]),function(e,t){$u(t,function(t){e[t]&&delete e[t]})}(p,["triggeredByEvent"]))})}Wu.$inject=["bpmnFactory","eventBus","copyPaste","clipboard","canvas","bpmnRules"];var Hu=Wu;function Vu(){}var qu=Vu;Vu.prototype.get=function(){return this._data},Vu.prototype.set=function(e){this._data=e},Vu.prototype.clear=function(){var e=this._data;return delete this._data,e},Vu.prototype.isEmpty=function(){return!this._data};var Uu={clipboard:["type",qu]},Yu={},Ku=s.forEach;Yu.getTopLevel=function(e){var t={},n=[],i=[],r=[];return Ku(e,function(e){var i=e.parent;t[i.id]||(t[i.id]=[]),-1===n.indexOf(i.id)&&n.push(i.id),t[i.id].push(e)}),Ku(n,function(e){Ku(t[e],function(e){t[e.id]&&r.push(e.id)})}),Ku(n,function(e){-1===r.indexOf(e)&&(i=i.concat(t[e]))}),i};var Xu={};Xu.center=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}},Xu.delta=function(e,t){return{x:e.x-t.x,y:e.y-t.y}};var Zu=s.isArray,Qu=s.forEach,Ju=s.map,eh=s.matchPattern,th=s.find,nh=s.findIndex,ih=s.sortBy,rh=s.reduce,oh=ui.getBBox;function ah(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,t){return t.priority=1,t.id=e.id,e.parent&&(t.parent=e.parent.id),e.labelTarget&&(t.priority=4,t.labelTarget=e.labelTarget.id),e.host&&(t.priority=2,t.host=e.host.id),"number"==typeof e.x&&(t.x=e.x,t.y=e.y),e.width&&(t.width=e.width,t.height=e.height),e.waypoints&&(t.priority=3,t.waypoints=[],Qu(e.waypoints,function(e){var n={x:e.x,y:e.y};e.original&&(n.original={x:e.original.x,y:e.original.y}),t.waypoints.push(n)})),e.source&&e.target&&(t.source=e.source.id,t.target=e.target.id),t})}ah.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"];var sh=ah;ah.prototype.copy=function(e){var t,n,i=this._clipboard;if(Zu(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),n=this._bbox=Xu.center(oh(t.allShapes)),delete t.allShapes,Qu(t,function(e){Qu(e,function(t){var i,r;t.labelTarget?(r=th(e,eh({id:t.labelTarget})),i=r.waypoints?Xu.delta(t,r.waypoints[0]):Xu.delta(t,r)):3===t.priority?(i=[],Qu(t.waypoints,function(e){var t=Xu.delta(e,n);i.push(t)})):i=Xu.delta(t,n),t.delta=i})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?i.clear():i.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},ah.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=rh(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)?e:(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}}))},ah.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Xu.delta(t,t.labelTarget):(3===t.priority?(i=[],Qu(t.waypoints,function(e){var t=Xu.delta(e,n);i.push(t)})):i=Xu.delta(t,n),i)},ah.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=th(e,eh({id:t.source.id})),i=th(e,eh({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!th(e,eh({id:t.labelTarget.id})))},ah.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)},ah.prototype._executeDescriptors=function(e){return e.descriptor||(e.descriptor={}),Qu(this._descriptors,function(t){e.descriptor=t(e.element,e.descriptor)}),e},ah.prototype.createTree=function(e){var t,n=this._rules,i=this,r={},o=[],a=Yu.getTopLevel(e);function s(e){var t=nh(o,eh({element:e.element}));if(-1===t)return o.push(e);o[t].depth<e.depth&&(o.splice(t,1),o.push(e))}return r.allShapes=[],ui.eachElement(a,function(e,t,n){var i,r=e.children;if(!e.labelTarget)return e.label&&s({element:e.label,depth:n}),i=[e.attachers,e.incoming,e.outgoing],Qu(i,function(e){e&&e.length&&Qu(e,function(e){e.label&&s({element:e.label,depth:n}),s({element:e,depth:n})})}),s({element:e,depth:n}),r||void 0}),o=Ju(o,function(e){return i._executeDescriptors(e)}),o=ih(o,function(e){return e.descriptor.priority}),t=Ju(o,function(e){return e.element}),Qu(o,function(e){var o,a,s=e.depth;i.hasRelations(r.allShapes,e.element)&&(o=t,a=e.element,n.allowed("element.copy",{collection:o,element:a})&&(r.allShapes.push(e.element),r[s]||(r[s]=[]),r[s].push(e.descriptor)))}),r};var ch=s.bind;function ph(e,t){this._eventBus=e,this._canvas=t,this._init()}ph.$inject=["eventBus","canvas"];var lh=ph;ph.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)}}},ph.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=ch(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)},ph.prototype._setHoverElement=function(e){this._hoverElement=e.element},ph.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var uh={__init__:["mouseTracking"],mouseTracking:["type",lh]},hh={__depends__:[Uu,cu,uh],__init__:["copyPaste"],copyPaste:["type",sh]},dh={__depends__:[hh],__init__:["bpmnCopyPaste"],bpmnCopyPaste:["type",Hu]},mh=s.filter,fh=Js.isAny;function yh(e){e.registerFilter(function(e){return mh(e,function(e){var t=fh(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}yh.$inject=["distributeElements"];var vh=yh,gh=s.sortBy,bh=s.forEach,xh=s.filter,Eh={horizontal:["x","width"],vertical:["y","height"]};function _h(e){this._modeling=e,this._filters=[],this.registerFilter(function(e,t,n){var i,r=0,o=0;return bh(e,function(e){e.waypoints||e.labelTarget||(r+=e[n],o+=1)}),i=Math.round(r/o),xh(e,function(e){return e[n]<i+50})})}var wh=_h;_h.$inject=["modeling"],_h.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},_h.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},_h.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(bh(t,function(e){r=e(r,n,i)}),r):e},_h.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');var o=gh(e,i);return bh(o,function(e,o){var a,s=n._findRange(e,i,r),c=t[t.length-1];c&&n._hasIntersection(c.range,s)?t[t.length-1].elements.push(e):(a={range:s,elements:[e]},t.push(a))}),t},_h.prototype._setOrientation=function(e){var t=Eh[e];this._axis=t[0],this._dimension=t[1]},_h.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)},_h.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Sh={__depends__:[{__init__:["distributeElements"],distributeElements:["type",wh]}],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",vh]},Th=s.forEach,Ch=s.isArray;function Ah(e,t,n,i,r,o,a,s,c){this._actions={undo:function(){t.undo()},redo:function(){t.redo()},copy:function(){var e=i.get();o.copy(e)},paste:function(){var e=c.getHoverContext();o.paste(e)},stepZoom:function(e){r.stepZoom(e.value)},zoom:function(e){a.zoom(e.value)},removeSelection:function(){var e=i.get();if(e.length){var t,r=s.allowed("elements.delete",{elements:e});if(!1===r)return;(t=Ch(r)?r:e).length&&n.removeElements(t.slice())}},moveCanvas:function(e){var t=0,n=0,i=e.invertY,r=e.speed/Math.min(Math.sqrt(a.viewbox().scale),1);switch(e.direction){case"left":t=r;break;case"up":n=r;break;case"right":t=-r;break;case"down":n=-r}n&&i&&(n=-n),a.scroll({dx:t,dy:n})}}}Ah.$inject=["eventBus","commandStack","modeling","selection","zoomScroll","copyPaste","canvas","rules","mouseTracking"];var Rh=Ah;function Ph(e,t){return new Error(e+" "+t)}Ah.prototype.trigger=function(e,t){if(!this._actions[e])throw Ph(e,"is not a registered action");return this._actions[e](t)},Ah.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);Th(e,function(e,t){n._registerAction(t,e)})},Ah.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw Ph(e,"is already registered");this._actions[e]=t},Ah.prototype.unregister=function(e){if(!this.isRegistered(e))throw Ph(e,"is not a registered action");this._actions[e]=void 0},Ah.prototype.length=function(){return Object.keys(this._actions).length},Ah.prototype.isRegistered=function(e){return!!this._actions[e]};var Mh=s.filter,kh=d.is,Bh=ui.getBBox;function Nh(e,t,n,i,r,o,a,s,c,p,l,u,h){e.invoke(Rh,this),this.register({selectElements:function(){var e=t.getRootElement(),r=n.filter(function(t){return t!==e});return i.select(r),r},spaceTool:function(){r.toggle()},lassoTool:function(){o.toggle()},handTool:function(){a.toggle()},globalConnectTool:function(){s.toggle()},distributeElements:function(e){var t=i.get(),n=e.type;t.length&&c.trigger(t,n)},alignElements:function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=Mh(t,function(e){return!kh(e,"bpmn:Lane")}),p.trigger(n,r))},setColor:function(e){var t=i.get();t.length&&h.setColor(t,e)},directEditing:function(){var e=i.get();e.length&&l.activate(e[0])},find:function(){u.toggle()},moveToOrigin:function(){var e,i,r=t.getRootElement();i=kh(r,"bpmn:Collaboration")?n.filter(function(e){return kh(e.parent,"bpmn:Collaboration")}):n.filter(function(e){return e!==r&&!kh(e.parent,"bpmn:SubProcess")}),e=Bh(i),h.moveElements(i,{x:-e.x,y:-e.y},r)}})}U(Nh,Rh),Nh.$inject=["injector","canvas","elementRegistry","selection","spaceTool","lassoTool","handTool","globalConnect","distributeElements","alignElements","directEditing","searchPad","modeling"];var Dh=Nh,Oh=Js.isAny;function Lh(e){e.registerProvider(this)}Lh.$inject=["globalConnect"];var Ih=Lh;Lh.prototype.canStartConnect=function(e){if(!(t=e)||function(e){return e.labelTarget}(t))return null;var t,n=e.businessObject;return Oh(n,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])};var jh="connect-ok",zh="connect-not-ok";function Fh(e,t,n,i,r){var o=this;this._dragging=t,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",function(e){var t=e.context,n=e.hover,r=t.canStartConnect=o.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?jh:zh))}),e.on(["global-connect.out","global-connect.cleanup"],function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?jh:zh)}),e.on(["global-connect.ended"],function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(o.canStartConnect(i))return e.once("element.out",function(){e.once(["connect.ended","connect.canceled"],function(){e.fire("global-connect.drag.ended")}),n.start(null,i,r)}),!1})}Fh.$inject=["eventBus","dragging","connect","canvas","toolManager"];var $h=Fh;Fh.prototype.start=function(e){this._dragging.init(e,"global-connect",{trapClick:!1,data:{context:{}}})},Fh.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.start()},Fh.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Fh.prototype.registerProvider=function(e){this._provider=e},Fh.prototype.canStartConnect=function(e){return this._provider.canStartConnect(e)};var Gh=s.forEach;function Wh(e,t){this._eventBus=e,this._dragging=t,this._tools=[],this._active=null}Wh.$inject=["eventBus","dragging"];var Hh=Wh;Wh.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)},Wh.prototype.isActive=function(e){return e&&this._active===e},Wh.prototype.length=function(e){return this._tools.length},Wh.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Wh.prototype.bindEvents=function(e,t){var n=this._eventBus,i=this._dragging,r=[];n.on(t.tool+".init",function(t){if(!t.context.reactivate&&this.isActive(e))return this.setActive(null),void i.cancel();this.setActive(e)},this),Gh(t,function(e){r.push(e+".ended"),r.push(e+".canceled")}),n.on(r,250,function(e){var t=e.originalEvent;!this._active||t&&"tools"===t.target.parentNode.getAttribute("data-group")||this.setActive(null)},this)};var Vh={__depends__:[ou],__init__:["toolManager"],toolManager:["type",Hh]},qh={__depends__:[{__depends__:[pu,cu,ou,Vh],globalConnect:["type",$h]}],__init__:["bpmnGlobalConnect"],bpmnGlobalConnect:["type",Ih]},Uh={},Yh=d.is;function Kh(e){return Yh(e,"bpmn:FlowElement")||Yh(e,"bpmn:Participant")||Yh(e,"bpmn:Lane")||Yh(e,"bpmn:SequenceFlow")||Yh(e,"bpmn:MessageFlow")?"name":Yh(e,"bpmn:TextAnnotation")?"text":void 0}Uh.getLabel=function(e){var t=e.businessObject,n=Kh(t);if(n)return t[n]||""},Uh.setLabel=function(e,t,n){var i=e.businessObject,r=Kh(i);return r&&(i[r]=t),n&&(e.hidden=!t),e};var Xh=s.map,Zh=s.filter,Qh=s.sortBy;function Jh(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}var ed=Jh;function td(e){return Zh(e,function(e){return!!e.matched}).length>0}function nd(e,t){var n=[],i=e;if(!e)return n;e=e.toLowerCase(),t=t.toLowerCase();var r=e.indexOf(t);return r>-1?(0!==r&&n.push({normal:i.substr(0,r)}),n.push({matched:i.substr(r,t.length)}),t.length+r<e.length&&n.push({normal:i.substr(t.length+r,e.length)})):n.push({normal:i}),n}Jh.$inject=["elementRegistry","searchPad","canvas"],Jh.prototype.find=function(e){var t=this._canvas.getRootElement(),n=this._elementRegistry.filter(function(e){return!e.labelTarget});return n=Zh(n,function(e){return e!==t}),n=Xh(n,function(t){return{primaryTokens:nd(Uh.getLabel(t),e),secondaryTokens:nd(t.id,e),element:t}}),n=Zh(n,function(e){return td(e.primaryTokens)||td(e.secondaryTokens)}),n=Qh(n,function(e){return Uh.getLabel(e.element)+e.element.id})};var id=Y.clear,rd=Y.delegate,od=Y.query,ad=Y.classes,sd=Y.attr,cd=Y.domify,pd=ui.getBBox;function ld(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=cd(ld.BOX_HTML),this._searchInput=od(ld.INPUT_SELECTOR,this._container),this._resultsContainer=od(ld.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}ld.$inject=["canvas","eventBus","overlays","selection"],ld.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:rd.bind(t,n,i,r)})}t(document,"html","click",function(t){e.close()}),t(this._container,ld.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),t(this._container,ld.RESULT_SELECTOR,"mouseover",function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)}),t(this._container,ld.RESULT_SELECTOR,"click",function(t){t.stopPropagation(),e._select(t.delegateTarget)}),t(this._container,ld.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),t(this._container,ld.INPUT_SELECTOR,"keyup",function(t){if(27===t.keyCode)return e.close();if(13===t.keyCode){var n=e._getCurrentResult();return n?e._select(n):e.close()}return 38===t.keyCode?e._scrollToDirection(!0):40===t.keyCode?e._scrollToDirection():void(37!==t.keyCode&&39!==t.keyCode&&e._search(t.delegateTarget.value))})},ld.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){rd.unbind(e.el,e.type,e.listener)})},ld.prototype._search=function(e){var t=this;if(this._clearResults(),e&&""!==e){var n=this._searchProvider.find(e);if(n.length){n.forEach(function(e){var n=e.element.id,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}});var i=od(ld.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}}},ld.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},ld.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)}},ld.prototype._clearResults=function(){id(this._resultsContainer),this._results=[],this._resetOverlay(),this._eventBus.fire("searchPad.cleared")},ld.prototype._getCurrentResult=function(){return od(ld.RESULT_SELECTED_SELECTOR,this._resultsContainer)},ld.prototype._createResultNode=function(e,t){var n=cd(ld.RESULT_HTML);return e.primaryTokens.length>0&&hd(n,e.primaryTokens,ld.RESULT_PRIMARY_HTML),hd(n,e.secondaryTokens,ld.RESULT_SECONDARY_HTML),sd(n,ld.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},ld.prototype.registerProvider=function(e){this._searchProvider=e},ld.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._bindEvents(),this._open=!0,ad(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},ld.prototype.close=function(){this.isOpen()&&(this._unbindEvents(),this._open=!1,ad(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._resetOverlay(),this._eventBus.fire("searchPad.closed"))},ld.prototype.toggle=function(){this.isOpen()?this.close():this.open()},ld.prototype.isOpen=function(){return this._open},ld.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&ad(t).remove(ld.RESULT_SELECTED_CLASS);var n=sd(e,ld.RESULT_ID_ATTRIBUTE),i=this._results[n].element;ad(e).add(ld.RESULT_SELECTED_CLASS),this._resetOverlay(i),this._centerViewbox(i),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},ld.prototype._select=function(e){var t=sd(e,ld.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)},ld.prototype._centerViewbox=function(e){var t=this._canvas.viewbox(),n=pd(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)},ld.prototype._resetOverlay=function(e){if(this._overlayId&&this._overlays.remove(this._overlayId),e){var t=function(e){var t=e.width+12,n=e.height+12,i=["width: "+t+"px","height: "+n+"px"].join("; ");return{position:{bottom:n-6,right:t-6},show:!0,html:'<div style="'+i+'" class="'+ld.OVERLAY_CLASS+'"></div>'}}(pd(e));this._overlayId=this._overlays.add(e,t)}};var ud=ld;function hd(e,t,n){var i=function(e){var t="";return e.forEach(function(e){e.matched?t+='<strong class="'+ld.RESULT_HIGHLIGHT_CLASS+'">'+e.matched+"</strong>":t+=e.normal}),""!==t?t:null}(t),r=cd(n);r.innerHTML=i,e.appendChild(r)}ld.CONTAINER_SELECTOR=".djs-search-container",ld.INPUT_SELECTOR=".djs-search-input input",ld.RESULTS_CONTAINER_SELECTOR=".djs-search-results",ld.RESULT_SELECTOR=".djs-search-result",ld.RESULT_SELECTED_CLASS="djs-search-result-selected",ld.RESULT_SELECTED_SELECTOR="."+ld.RESULT_SELECTED_CLASS,ld.RESULT_ID_ATTRIBUTE="data-result-id",ld.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",ld.OVERLAY_CLASS="djs-search-overlay",ld.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>',ld.RESULT_HTML='<div class="djs-search-result"></div>',ld.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',ld.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var dd={__depends__:[{__depends__:[vo,aa],searchPad:["type",ud]}],__init__:["bpmnSearch"],bpmnSearch:["type",ed]},md=s.filter,fd=s.forEach,yd=s.sortBy;function vd(e){return e&&e[e.length-1]}function gd(e){return e.y}function bd(e){return e.x}var xd={left:bd,center:bd,right:function(e){return e.x+e.width},top:gd,middle:gd,bottom:function(e){return e.y+e.height}};function Ed(e){this._modeling=e}var _d=Ed;Ed.$inject=["modeling"],Ed.prototype._getOrientationDetails=function(e){var t="x",n="width";return-1!==["top","bottom","middle"].indexOf(e)&&(t="y",n="height"),{axis:t,dimension:n}},Ed.prototype._isType=function(e,t){return-1!==t.indexOf(e)},Ed.prototype._alignmentPosition=function(e,t){var n,i,r,o=this._getOrientationDetails(e),a=o.axis,s=o.dimension,c={},p={},l=!1;if(this._isType(e,["left","top"]))c[e]=t[0][a];else if(this._isType(e,["right","bottom"]))r=vd(t),c[e]=r[a]+r[s];else if(this._isType(e,["center","middle"])){if(fd(t,function(e){var t=e[a]+Math.round(e[s]/2);p[t]?p[t].elements.push(e):p[t]={elements:[e],center:t}}),n=yd(p,function(e){return e.elements.length>1&&(l=!0),e.elements.length}),l)return c[e]=vd(n).center,c;i=t[0],r=vd(t=yd(t,function(e){return e[a]+e[s]})),c[e]=function(e,t){return Math.round((e[a]+t[a]+t[s])/2)}(i,r)}return c},Ed.prototype.trigger=function(e,t){var n=this._modeling,i=md(e,function(e){return!(e.waypoints||e.host||e.labelTarget)}),r=yd(i,xd[t]),o=this._alignmentPosition(t,r);n.alignElements(r,o)};var wd={__init__:["alignElements"],alignElements:["type",_d]},Sd={__depends__:[aa,hh,Va],__init__:["editorActions"],editorActions:["type",Rh]},Td=_o.hasPrimaryModifier,Cd=1500;function Ad(e,t,n,i){this._dragging=n,i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Cd,function(e){if(Td(e))return this.activateMove(e.originalEvent),!1},this),e.on("hand.end",function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",function(){this.activateMove(t.originalEvent,{reactivate:!0})},this)},this),e.on("hand.move.move",function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})}),e.on("hand.move.end",function(t){var n=t.context.reactivate;return!Td(t)&&n&&e.once("hand.move.ended",function(e){this.activateHand(e.originalEvent,!0,!0)},this),!1},this)}Ad.$inject=["eventBus","canvas","dragging","toolManager"];var Rd=Ad;Ad.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||{}}})},Ad.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:"grab",data:{context:{reactivate:n}}})},Ad.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateHand()},Ad.prototype.isActive=function(){var e=this._dragging.context();return e&&/^hand/.test(e.prefix)};var Pd={__depends__:[Vh],__init__:["handTool"],handTool:["type",Rd]},Md=s.values,kd=ui.getEnclosedElements,Bd=_o.hasSecondaryModifier,Nd=n.append,Dd=n.attr,Od=n.create,Ld=n.remove;function Id(e,t,n,i,r,o){this._selection=r,this._dragging=n;var a=this,s=function(e){var n,i=t.getDefaultLayer();n=e.frame=Od("rect"),Dd(n,{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),Nd(i,n)},c=function(e){var t=e.frame,n=e.bbox;Dd(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ld(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",function(){a.activateLasso(t.originalEvent,!0)})}),e.on("lasso.end",function(e){var t=zd(e),n=i.filter(function(e){return e});a.select(n,t)}),e.on("lasso.start",function(e){var t=e.context;t.bbox=zd(e),s(t)}),e.on("lasso.move",function(e){var t=e.context;t.bbox=zd(e),c(t)}),e.on("lasso.cleanup",function(e){var t=e.context;p(t)}),e.on("element.mousedown",1500,function(e){if(Bd(e))return a.activateLasso(e.originalEvent),!0})}Id.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager"];var jd=Id;function zd(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Id.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:"crosshair",data:{context:{}}})},Id.prototype.activateSelection=function(e){this._dragging.init(e,"lasso.selection",{trapClick:!1,cursor:"crosshair",data:{context:{}}})},Id.prototype.select=function(e,t){var n=kd(e,t);this._selection.select(Md(n))},Id.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},Id.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Fd={__depends__:[Vh],__init__:["lassoTool"],lassoTool:["type",jd]},$d=s.forEach,Gd=n.append,Wd=n.attr,Hd=n.clone,Vd=n.create;function qd(e,t,n){this._elementRegistry=e,this._canvas=t,this._styles=n}var Ud=qd;qd.$inject=["elementRegistry","canvas","styles"],qd.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},qd.prototype.addDragger=function(e,t){var n=this.getGfx(e),i=Hd(n),r=n.getBoundingClientRect();return e.waypoints&&function e(t){t.children&&$d(t.children,function(t){e(t)});t.style.markerStart="";t.style.markerEnd=""}(i),Wd(i,this._styles.cls("djs-dragger",[],{x:r.top,y:r.left})),Gd(t,i),i},qd.prototype.addFrame=function(e,t){var n=Vd("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return Gd(t,n),n};var Yd={__init__:["previewSupport"],previewSupport:["type",Ud]},Kd={};Kd.getDirection=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null},Kd.resizeBounds=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)}};var Xd=_o.hasPrimaryModifier,Zd=Math.abs,Qd=Math.round,Jd=1500,em={x:"width",y:"height"},tm={x:"y",y:"x"},nm=ui.selfAndAllChildren,im=s.assign,rm=s.forEach;function om(e,t,n,i,r,o){this._canvas=n,this._dragging=t,this._modeling=i,this._rules=r,this._toolManager=o;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),e.on("spaceTool.selection.end",function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("spaceTool.selection.ended",function(){a.activateMakeSpace(t.originalEvent)})}),e.on("spaceTool.move",Jd,function(e){var t=e.context;t.initialized||(t.initialized=a.initializeMakeSpace(e,t))}),e.on("spaceTool.end",function(t){var n=t.context,i=n.axis,r=n.direction,o=n.movingShapes,s=n.resizingShapes;if(n.initialized){var c={x:Qd(t.dx),y:Qd(t.dy)};c[tm[i]]=0;var p=!0;rm(s,function(e){("w"===r&&t.x>e.x+e.width||"e"===r&&t.x<e.x||"n"===r&&t.y>e.y+e.height||"s"===r&&t.y<e.y)&&(p=!1)}),p&&a.makeSpace(o,s,c,r),e.once("spaceTool.ended",function(e){a.activateSelection(e.originalEvent,!0,!0)})}})}om.$inject=["eventBus","dragging","canvas","modeling","rules","toolManager"];var am=om;om.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{trapClick:!1,cursor:"crosshair",autoActivate:t,data:{context:{reactivate:n}}})},om.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:"crosshair",data:{context:{}}})},om.prototype.makeSpace=function(e,t,n,i){return this._modeling.createSpace(e,t,n,i)},om.prototype.initializeMakeSpace=function(e,t){var n=Zd(e.dx)>Zd(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Zd(i)<5)return!1;i<0&&(i*=-1),Xd(e)&&(i*=-1);var o=this._canvas.getRootElement(),a=nm(o,!0),s=this.calculateAdjustments(a,n,i,r);return im(t,s,{axis:n,direction:Kd.getDirection(n,i)}),_a.set("resize-"+("x"===n?"ew":"ns")),!0},om.prototype.calculateAdjustments=function(e,t,n,i){var r=[],o=[],a=this._rules;return e.forEach(function(e){var s=e[t],c=s+e[em[t]];if(e.parent&&!e.waypoints)return n>0&&s>i?r.push(e):n<0&&c<i?r.push(e):s<i&&c>i&&a.allowed("shape.resize",{shape:e})?o.push(e):void 0}),{movingShapes:r,resizingShapes:o}},om.prototype.toggle=function(){this.isActive()?this._dragging.cancel():this.activateSelection()},om.prototype.isActive=function(){var e=this._dragging.context();return e&&/^spaceTool/.test(e.prefix)};var sm=s.forEach,cm="djs-dragging",pm="djs-resizing",lm=250,um=n.append,hm=n.attr,dm=n.classes,mm=n.create,fm=n.remove,ym=w.translate;function vm(e,t,n,i,r){function o(e,t){sm(e,function(e){r.addDragger(e,t),n.addMarker(e,cm)})}e.on("spaceTool.selection.start",function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",a="M -10000,0 L 10000,0",s=mm("g");hm(s,i.cls("djs-crosshair-group",["no-events"])),um(t,s);var c=mm("path");hm(c,"d",o),dm(c).add("djs-crosshair"),um(s,c);var p=mm("path");hm(p,"d",a),dm(p).add("djs-crosshair"),um(s,p),r.crosshairGroup=s}),e.on("spaceTool.selection.move",function(e){var t=e.context.crosshairGroup;ym(t,e.x,e.y)}),e.on("spaceTool.selection.cleanup",function(e){var t=e.context.crosshairGroup;t&&fm(t)}),e.on("spaceTool.move",lm,function(e){var a=e.context,s=a.line,c=a.axis,p=a.movingShapes,l=a.resizingShapes;if(a.initialized){if(!a.dragGroup){var u=n.getLayer("space");s=mm("path"),hm(s,"d","M0,0 L0,0"),dm(s).add("djs-crosshair"),um(u,s),a.line=s;var h=mm("g");hm(h,i.cls("djs-drag-group",["no-events"])),um(n.getDefaultLayer(),h),o(p,h),o(a.movingConnections=t.filter(function(e){var t=!1;sm(p,function(n){sm(n.outgoing,function(n){e===n&&(t=!0)})});var n=!1;sm(p,function(t){sm(t.incoming,function(t){e===t&&(n=!0)})});var i=!1;sm(l,function(t){sm(t.outgoing,function(t){e===t&&(i=!0)})});var r=!1;return sm(l,function(t){sm(t.incoming,function(t){e===t&&(r=!0)})}),function(e){return e.waypoints}(e)&&(t||i)&&(n||r)}),h),a.dragGroup=h}if(!a.frameGroup){var d=mm("g");hm(d,i.cls("djs-frame-group",["no-events"])),um(n.getDefaultLayer(),d);var m=[];sm(l,function(e){var t=r.addFrame(e,d);m.push({element:t,initialWidth:t.getBBox().width,initialHeight:t.getBBox().height}),n.addMarker(e,pm)}),a.frameGroup=d,a.frames=m}var f={x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y};hm(s,{path:f[c],display:""});var y={x:e.dx,y:e.dy};y[{x:"y",y:"x"}[a.axis]]=0,ym(a.dragGroup,y.x,y.y),sm(a.frames,function(e){e.initialWidth+y.x>5&&hm(e.element,{width:e.initialWidth+y.x}),e.initialHeight+y.y>5&&hm(e.element,{height:e.initialHeight+y.y})})}}),e.on("spaceTool.cleanup",function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,a=t.line,s=t.dragGroup,c=t.frameGroup;sm(i,function(e){n.removeMarker(e,cm)}),sm(r,function(e){n.removeMarker(e,cm)}),s&&(fm(a),fm(s)),sm(o,function(e){n.removeMarker(e,pm)}),c&&fm(c)})}vm.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var gm={__init__:["spaceToolPreview"],__depends__:[ou,cu,Vh,Yd],spaceTool:["type",am],spaceToolPreview:["type",vm]},bm={__depends__:[wd,Sd,Pd,Fd,gm,Il,qh,dh,Sh,dd],editorActions:["type",Dh]};function xm(e,t){e.addListener(function(n,i){return 65===n&&e.isCmd(i)?(t.trigger("selectElements"),!0):70===n&&e.isCmd(i)?(t.trigger("find"),!0):e.hasModifier(i)?void 0:83===n?(t.trigger("spaceTool"),!0):76===n?(t.trigger("lassoTool"),!0):72===n?(t.trigger("handTool"),!0):67===n?(t.trigger("globalConnectTool"),!0):69===n?(t.trigger("directEditing"),!0):void 0})}xm.$inject=["keyboard","editorActions"];var Em=xm,_m=Y.event,wm=Y.matches;function Sm(e,t,n){var i=this;this._config=e||{},this._eventBus=t,this._editorActions=n,this._listeners=[],this._keyHandler=function(e){var t,n,r=e.target,o=i._listeners,a=e.keyCode||e.charCode||-1;if(!r||!wm(r,"input, textarea")&&"true"!==r.contentEditable)for(t=0;n=o[t];t++)n(a,e)&&(e.preventDefault(),e.stopPropagation())},t.on("diagram.destroy",function(){i._fire("destroy"),i.unbind(),i._listeners=null}),t.on("diagram.init",function(){i._fire("init")}),t.on("attach",function(){e&&e.bindTo&&i.bind(e.bindTo)}),t.on("detach",function(){i.unbind()}),this._init()}Sm.$inject=["config.keyboard","eventBus","editorActions"];var Tm=Sm;function Cm(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Am(e){return e.shiftKey}Sm.prototype.bind=function(e){this.unbind(),this._node=e,_m.bind(e,"keydown",this._keyHandler,!0),this._fire("bind")},Sm.prototype.getBinding=function(){return this._node},Sm.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),_m.unbind(e,"keydown",this._keyHandler,!0)),this._node=null},Sm.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node,listeners:this._listeners})},Sm.prototype._init=function(){var e=this._listeners,t=this._editorActions,n=this._config;e.push(function(e,n){if(Cm(n)&&!Am(n)&&90===e)return t.trigger("undo"),!0}),e.push(function(e,n){if(Cm(n)&&(89===e||90===e&&Am(n)))return t.trigger("redo"),!0}),e.push(function(e,n){if(Cm(n)&&67===e)return t.trigger("copy"),!0}),e.push(function(e,n){if(Cm(n)&&86===e)return t.trigger("paste"),!0}),e.push(function(e,n){if(46===e)return t.trigger("removeSelection"),!0}),e.push(function(e,n){if((107===e||187===e||171===e||61===e)&&Cm(n))return t.trigger("stepZoom",{value:1}),!0}),e.push(function(e,n){if((109===e||189===e||173===e)&&Cm(n))return t.trigger("stepZoom",{value:-1}),!0}),e.push(function(e,n){if((96===e||48===e)&&Cm(n))return t.trigger("zoom",{value:1}),!0}),e.push(function(e,i){if([37,38,39,40].indexOf(e)>=0){var r={invertY:n.invertY,speed:n.speed||50};switch(e){case 37:r.direction="left";break;case 38:r.direction="up";break;case 39:r.direction="right";break;case 40:r.direction="down"}return t.trigger("moveCanvas",r),!0}})},Sm.prototype.addListener=function(e){this._listeners.push(e)},Sm.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Sm.prototype.isCmd=Cm,Sm.prototype.isShift=Am;var Rm={__depends__:[{__init__:["keyboard"],keyboard:["type",Tm]}],__init__:["bpmnKeyBindings"],bpmnKeyBindings:["type",Em]},Pm=n.append,Mm=n.attr,km=n.create,Bm=n.remove,Nm=d.getBusinessObject,Dm=d.is,Om=w.translate,Lm="djs-element-hidden",Im="djs-label-hidden";function jm(e,t,n,i){var r,o,a,s=this,c=t.getDefaultLayer();e.on("directEditing.activate",function(e){var n=e.active;if(r=n.element.label||n.element,Dm(r,"bpmn:TextAnnotation")){o=t.getAbsoluteBBox(r),a=km("g");var p=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),l=s.path=km("path");Mm(l,{d:p,strokeWidth:2,stroke:function(e,t){return Nm(e).di.get("stroke")||t||"black"}(r)}),Pm(a,l),Pm(c,a),Om(a,r.x,r.y)}Dm(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Lm):(Dm(r,"bpmn:Task")||Dm(r,"bpmn:CallActivity")||Dm(r,"bpmn:SubProcess")||Dm(r,"bpmn:Participant"))&&t.addMarker(r,Im)}),e.on("directEditing.resize",function(e){if(Dm(r,"bpmn:TextAnnotation")){var t=e.height,n=e.dy,a=Math.max(r.height/o.height*(t+n),0),c=i.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Mm(s.path,{d:c})}}),e.on(["directEditing.complete","directEditing.cancel"],function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Lm),t.removeMarker(r,Im)),r=void 0,o=void 0,a&&(Bm(a),a=void 0)})}jm.$inject=["eventBus","canvas","elementRegistry","pathMap"];var zm=jm,Fm=s.assign,$m=d.is,Gm=Js.isAny,Wm=f.isExpanded;function Hm(e,t,n,i,r){function o(e,t){(t||Gm(e,["bpmn:Task","bpmn:TextAnnotation"])||qm(e))&&n.activate(e)}this._canvas=t,this._modeling=i,n.registerProvider(this),e.on("element.dblclick",function(e){o(e.element,!0)}),e.on(["element.mousedown","drag.init","canvas.viewbox.changing","autoPlace"],function(e){n.complete()}),e.on(["commandStack.changed"],function(e){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&&o(t)}),e.on("autoPlace.end",500,function(e){o(e.shape)})}Hm.$inject=["eventBus","canvas","directEditing","modeling","resizeHandles"];var Vm=Hm;function qm(e){return $m(e,"bpmn:SubProcess")&&!Wm(e)}Hm.prototype.activate=function(e){var t=Uh.getLabel(e);if(void 0!==t){var n={text:t},i=this.getEditingBBox(e);Fm(n,i);var r=e.label||e,o={};return(Gm(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||qm(e))&&Fm(o,{centerVertically:!0}),r.labelTarget&&Fm(o,{autoResize:!0}),$m(e,"bpmn:TextAnnotation")&&Fm(o,{resizable:!0,autoResize:!0}),Fm(n,{options:o}),n}},Hm.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,a={x:i.x,y:i.y},s=t.zoom(),c=11*s,p=13*s,l=12*s,u=14*s,h={};if(($m(e,"bpmn:Lane")||function(e){return $m(e,"bpmn:Participant")&&Wm(e)}(e))&&(Fm(a,{width:i.height,height:30*s,x:i.x-i.height/2+15*s,y:o-30*s/2}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",transform:"rotate(-90deg)"})),(Gm(e,["bpmn:Task","bpmn:CallActivity"])||function(e){return $m(e,"bpmn:Participant")&&!Wm(e)}(e)||qm(e))&&(Fm(a,{width:i.width,height:i.height}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),function(e){return $m(e,"bpmn:SubProcess")&&Wm(e)}(e)&&(Fm(a,{width:i.width,x:i.x}),Fm(h,{fontSize:l+"px",lineHeight:u+"px",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px"})),n.labelTarget){var d=90*s,m=7*s,f=4*s;Fm(a,{width:d,height:i.height+m+f,x:r-d/2,y:i.y-m}),Fm(h,{fontSize:c+"px",lineHeight:p+"px",paddingTop:m+"px",paddingBottom:f+"px"})}return $m(e,"bpmn:TextAnnotation")&&(Fm(a,{width:i.width,height:i.height,minWidth:30*s,minHeight:10*s}),Fm(h,{textAlign:"left",paddingTop:7*s+"px",paddingBottom:7*s+"px",paddingLeft:5*s+"px",paddingRight:5*s+"px",fontSize:l+"px",lineHeight:u+"px"})),{bounds:a,style:h}},Hm.prototype.update=function(e,t,n,i){var r,o;$m(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}),this._modeling.updateLabel(e,t,r)};var Um=ui.getType;function Ym(e,t,n,i){e.on("element.changed",function(i){var r=i.element;(r.parent||r===t.getRootElement())&&(i.gfx=n.getGraphics(r)),i.gfx&&e.fire(Um(r)+".changed",i)}),e.on("elements.changed",function(t){var n=t.elements;n.forEach(function(t){e.fire("element.changed",{element:t})}),i.updateContainments(n)}),e.on("shape.changed",function(e){i.update("shape",e.element,e.gfx)}),e.on("connection.changed",function(e){i.update("connection",e.element,e.gfx)})}Ym.$inject=["eventBus","canvas","elementRegistry","graphicsFactory"];var Km={__init__:["changeSupport"],changeSupport:["type",Ym]},Xm=s.pick,Zm=s.assign,Qm=Ps.asTRBL,Jm=Ps.roundBounds;function ef(e,t,n,i){this._dragging=i,this._rules=t;var r=this;e.on("resize.start",function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:Qm(i)})}),e.on("resize.move",function(e){var t={x:e.dx,y:e.dy};!function(e,t){var n,i=e.shape,o=e.direction,a=e.resizeConstraints;e.delta=t,n=$c.resizeBounds(i,o,t),e.newBounds=$c.ensureConstraints(n,a),e.canExecute=r.canResize(e)}(e.context,t)}),e.on("resize.end",function(e){var t,i,r,o;t=e.context,i=t.shape,r=t.canExecute,o=t.newBounds,r&&(o=Jm(o),n.resizeShape(i,o))})}ef.prototype.canResize=function(e){var t=this._rules,n=Xm(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},ef.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=Zm({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}})},ef.prototype.computeMinResizeBox=function(e){var t,n,i=e.shape,r=e.direction;return t=e.minDimensions||{width:10,height:10},n=$c.computeChildrenBBox(i,e.childrenBoxPadding),$c.getMinResizeBounds(r,i,t,n)},ef.$inject=["eventBus","rules","modeling","dragging"];var tf=ef,nf=s.bind,rf=s.forEach,of=n.append,af=n.attr,sf=n.classes,cf=n.clear,pf=n.create,lf=Y.event,uf=_o.isPrimaryButton,hf=Ps.asTRBL,df=w.transform;function mf(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&&rf(t,nf(r.addResizer,r))}),e.on("shape.changed",function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))})}mf.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){uf(t)&&i.activate(t,e,n)}lf.bind(t,"mousedown",r),lf.bind(t,"touchstart",r)},mf.prototype._createResizer=function(e,t,n,i,r){var o=this._getResizersParent(),a=pf("g");sf(a).add("djs-resizer"),sf(a).add("djs-resizer-"+e.id),sf(a).add("djs-resizer-"+r),of(o,a);var s=pf("rect");af(s,{x:-7,y:-7,width:5,height:5}),sf(s).add("djs-resizer-visual"),of(a,s);var c=pf("rect");return af(c,{x:-7,y:-7,width:20,height:20}),sf(c).add("djs-resizer-hit"),of(a,c),df(a,t,n,i),a},mf.prototype.createResizer=function(e,t){var n,i=hf(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)},mf.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"))},mf.prototype.removeResizers=function(){var e=this._getResizersParent();cf(e)},mf.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},mf.$inject=["eventBus","canvas","selection","resize"];var ff=mf,yf="djs-resizing",vf="resize-not-ok",gf=500,bf=n.attr,xf=n.remove,Ef=n.classes;function _f(e,t,n){e.on("resize.move",gf,function(e){var i,r,o,a;i=e.context,r=i.shape,o=i.newBounds,(a=i.frame)||(a=i.frame=n.addFrame(r,t.getDefaultLayer()),t.addMarker(r,yf)),o.width>5&&bf(a,{x:o.x,width:o.width}),o.height>5&&bf(a,{y:o.y,height:o.height}),i.canExecute?Ef(a).remove(vf):Ef(a).add(vf)}),e.on("resize.cleanup",function(e){var n,i;n=e.context,i=n.shape,n.frame&&xf(n.frame),t.removeMarker(i,yf)})}_f.$inject=["eventBus","canvas","previewSupport"];var wf={__depends__:[cu,ou,Yd],__init__:["resize","resizePreview","resizeHandles"],resize:["type",tf],resizePreview:["type",_f],resizeHandles:["type",ff]},Sf={__depends__:[Km,wf,Il],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Vm],labelEditingPreview:["type",zm]},Tf=s.map,Cf=s.assign,Af=s.pick;function Rf(e){this._model=e}Rf.$inject=["moddle"],Rf.prototype._needsId=function(e){return e.$instanceOf("bpmn:RootElement")||e.$instanceOf("bpmn:FlowElement")||e.$instanceOf("bpmn:MessageFlow")||e.$instanceOf("bpmn:DataAssociation")||e.$instanceOf("bpmn:Artifact")||e.$instanceOf("bpmn:Participant")||e.$instanceOf("bpmn:Lane")||e.$instanceOf("bpmn:Process")||e.$instanceOf("bpmn:Collaboration")||e.$instanceOf("bpmndi:BPMNShape")||e.$instanceOf("bpmndi:BPMNEdge")||e.$instanceOf("bpmndi:BPMNDiagram")||e.$instanceOf("bpmndi:BPMNPlane")||e.$instanceOf("bpmn:Property")},Rf.prototype._ensureId=function(e){var t=(e.$type||"").replace(/^[^:]*:/g,"")+"_";!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e))},Rf.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},Rf.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},Rf.prototype.createDiShape=function(e,t,n){return this.create("bpmndi:BPMNShape",Cf({bpmnElement:e,bounds:this.createDiBounds(t)},n))},Rf.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},Rf.prototype.createDiWaypoints=function(e){var t=this;return Tf(e,function(e){return t.createDiWaypoint(e)})},Rf.prototype.createDiWaypoint=function(e){return this.create("dc:Point",Af(e,["x","y"]))},Rf.prototype.createDiEdge=function(e,t,n){return this.create("bpmndi:BPMNEdge",Cf({bpmnElement:e},n))},Rf.prototype.createDiPlane=function(e){return this.create("bpmndi:BPMNPlane",{bpmnElement:e})};var Pf=Rf,Mf=Ps.getMid;function kf(){}var Bf=kf;kf.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||Mf(e.source),t.connectionEnd||Mf(e.target)]};var Nf={},Df=s.isArray,Of=s.find,Lf=s.without,If=s.assign,jf=Ps.getOrientation,zf=Ps.getMid,Ff=Ya.pointsAligned,$f=Ya.pointInRect,Gf=Ya.pointDistance,Wf=20,Hf={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Vf(e,t,n){var i,r;if("h:v"===(n=n||"h:h"))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=Math.round((t.x-e.x)/2+e.x),y:e.y},{x:i,y:t.y}];if("v:v"===n)return r=Math.round((t.y-e.y)/2+e.y),[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("unknown directions: <"+n+">: directions must be specified as {a direction}:{b direction} (direction in h|v)")}function qf(e,t,n){var i=[];return Ff(e,t)||(i=Vf(e,t,n)),i.unshift(e),i.push(t),i}function Uf(e,t,n,i,r){var o=r&&r.preferredLayouts||[],a=Lf(o,"straight")[0]||"h:h",s=Hf[a]||0,c=jf(e,t,s),p=function(e,t){switch(e){case"intersect":return null;case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(c,a);if(n=n||zf(e),i=i||zf(t),p){if("h:h"===p)switch(c){case"top-right":case"right":case"bottom-right":n={original:n,x:e.x,y:n.y},i={original:i,x:t.x+t.width,y:i.y};break;case"top-left":case"left":case"bottom-left":n={original:n,x:e.x+e.width,y:n.y},i={original:i,x:t.x,y:i.y}}if("v:v"===p)switch(c){case"top-left":case"top":case"top-right":n={original:n,x:n.x,y:e.y+e.height},i={original:i,x:i.x,y:t.y};break;case"bottom-left":case"bottom":case"bottom-right":n={original:n,x:n.x,y:e.y},i={original:i,x:i.x,y:t.y+t.height}}return qf(n,i,p)}}function Yf(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function Kf(e,t,n,i,r){var o,a,s={};return a=jf(e,t),/^(top|bottom|left|right)$/.test(a)?(/top|bottom/.test(a)&&(o="x"),/left|right/.test(a)&&(o="y"),"target"===r.preserveDocking?Yf(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:Yf(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):null}function Xf(e,t,n,i){if(function(e,t,n){return n.length<3||!(n.length>4)&&!!Of(n,function(e,t){var i=n[t-1];return i&&Gf(e,i)<3})}(0,0,i))return null;var r,o=i[0],a=i.slice();return a[0]=n,a[1]=function(e,t,n){switch(Ff(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}}(a[1],o,n),(r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if($f(e[i],t,Wf)||$f(e[i],n,Wf))return e.slice(i);return e}(a,e,t))!==a?Xf(e,t,n,r):a}Nf.repairConnection=function(e,t,n,i,r,o){var a;return Df(n)&&(r=n,o=i,n=zf(e),i=zf(t)),r=r||[],-1!==(o=If({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&(a=Kf(e,t,n,i,o)),a||(o.connectionEnd?a=(a=Xf(t,e,i,r.slice().reverse()))&&a.reverse():o.connectionStart?a=Xf(e,t,n,r):r&&r.length&&(a=r)),a||(a=Uf(e,t,n,i,o)),a};var Zf=s.assign,Qf=Ya.pointsOnLine,Jf=f.isExpanded,ey=Ps.getMid,ty=Ps.getOrientation,ny=d.is;function iy(){}U(iy,Bf);var ry=iy;function oy(e,t){return e?e.original||e:ey(t)}function ay(e){var t=e.source,n=e.target;return ny(n,"bpmn:Activity")&&ny(t,"bpmn:BoundaryEvent")&&n.businessObject.isForCompensation}function sy(e){return ny(e,"bpmn:SubProcess")&&Jf(e)}iy.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;if(p||(p=oy(c&&c[0],a)),l||(l=oy(c&&c[c.length-1],s)),(ny(e,"bpmn:Association")||ny(e,"bpmn:DataAssociation"))&&c&&!ay(e))return[].concat([p],c.slice(1,-1),[l]);if(ny(e,"bpmn:MessageFlow"))n={preferredLayouts:["v:v"]},ny(s,"bpmn:Participant")&&(n={preferredLayouts:["straight","v:v"]}),sy(s)&&(n={preferredLayouts:["straight","v:v"]}),sy(a)&&ny(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:sy(s)?"source":"target"}),ny(a,"bpmn:Participant")&&ny(s,"bpmn:FlowNode")&&(n={preferredLayouts:["straight","v:v"],preserveDocking:"target"}),ny(s,"bpmn:Event")&&(n={preferredLayouts:["v:v"]});else if(ny(e,"bpmn:SequenceFlow")||ay(e))if(ny(a,"bpmn:BoundaryEvent")){var u=(o=(r=a).host,ty(ey(r),o,-10));/left|right/.test(u)?n={preferredLayouts:["h:v"]}:/top|bottom/.test(u)&&(n={preferredLayouts:["v:h"]})}else n=ny(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:ny(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]};return n&&(n=Zf(n,t),i=(i=Nf.repairConnection(a,s,p,l,c,n))&&i.reduce(function(e,t,n){var r=e[e.length-1],o=i[n+1];return Qf(r,o,t,0)||e.push(t),e},[])),i||[p,l]};var cy=s.assign,py=s.forEach,ly=d.getBusinessObject,uy=d.is;function hy(e,t,n,i){gc.call(this,e),this._bpmnFactory=t,this._translate=i;var r=this;function o(e){var t=e.context.oldRoot.children;py(t,function(e){uy(e,"bpmn:BaseElement")&&r.updateParent(e)})}function a(e){var t=e.context.shape;uy(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,i=e.context;i.cropped||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)}),this.reverted(["connection.layout"],function(e){delete e.context.cropped}),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],my(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"],my(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"],my(function(e){"label"!==e.context.shape.type&&a(e)})),this.reverted(["shape.move","shape.create","shape.resize"],my(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"],my(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnectEnd","connection.reconnectStart"],my(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],my(c)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints","connection.reconnectEnd","connection.reconnectStart"],my(c)),this.executed(["connection.reconnectEnd","connection.reconnectStart"],my(function(e){var t=e.context,n=t.connection,i=ly(n),r=ly(t.oldSource),o=ly(t.oldTarget),a=ly(n.source),s=ly(n.target);r!==a&&o!==s&&(r&&r.default===i&&(t.default=r.default,r.default=void 0),i.sourceRef&&i.sourceRef.default&&!(uy(s,"bpmn:Activity")||uy(s,"bpmn:EndEvent")||uy(s,"bpmn:Gateway")||uy(s,"bpmn:IntermediateThrowEvent"))&&(t.default=i.sourceRef.default,i.sourceRef.default=void 0),r&&i.conditionExpression&&!uy(a,"bpmn:Activity")&&!uy(a,"bpmn:Gateway")&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0),o&&i.conditionExpression&&!(uy(s,"bpmn:Activity")||uy(s,"bpmn:EndEvent")||uy(s,"bpmn:Gateway")||uy(s,"bpmn:IntermediateThrowEvent"))&&(t.conditionExpression=i.conditionExpression,i.conditionExpression=void 0))})),this.reverted(["connection.reconnectEnd","connection.reconnectStart"],my(function(e){var t=e.context,n=t.connection,i=ly(n),r=ly(n.source);t.default&&(uy(r,"bpmn:ExclusiveGateway")||uy(r,"bpmn:InclusiveGateway")||uy(r,"bpmn:Activity"))&&(r.default=t.default),t.conditionExpression&&uy(r,"bpmn:Activity")&&(i.conditionExpression=t.conditionExpression)})),this.executed(["element.updateAttachment"],my(p)),this.reverted(["element.updateAttachment"],my(p))}U(hy,gc);var dy=hy;function my(e){return function(t){var n=t.context,i=n.shape||n.connection;uy(i,"bpmn:BaseElement")&&e(t)}}hy.$inject=["eventBus","bpmnFactory","connectionDocking","translate"],hy.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},hy.prototype.updateParent=function(e,t){if(!(e instanceof Fi.Label)){var n=e.parent,i=e.businessObject,r=n&&n.businessObject,o=r&&r.di;uy(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,r,t&&t.businessObject),uy(e,"bpmn:DataOutputAssociation")&&(r=e.source?e.source.businessObject:null),uy(e,"bpmn:DataInputAssociation")&&(r=e.target?e.target.businessObject:null),this.updateSemanticParent(i,r),uy(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,r),this.updateDiParent(i.di,o)}},hy.prototype.updateBounds=function(e){var t=e.businessObject.di,n=e instanceof Fi.Label?this._getLabel(t).bounds:t.bounds;cy(n,{x:e.x,y:e.y,width:e.width,height:e.height})},hy.prototype.updateFlowNodeRefs=function(e,t,n){var i,r;n!==t&&(uy(n,"bpmn:Lane")&&(i=n.get("flowNodeRef"),li.remove(i,e)),uy(t,"bpmn:Lane")&&(r=t.get("flowNodeRef"),li.add(r,e)))},hy.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)},hy.prototype.updateDiParent=function(e,t){if(t&&!uy(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(li.remove(n,e),e.$parent=null)}},hy.prototype.getLaneSet=function(e){var t,n;return uy(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(uy(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},hy.prototype.updateSemanticParent=function(e,t,n){var i,r=this._translate;if(e.$parent!==t){if(uy(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(uy(e,"bpmn:FlowElement")){if(t)if(uy(t,"bpmn:Participant"))t=t.processRef;else if(uy(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(uy(t,"bpmn:Lane"));i="flowElements"}else if(uy(e,"bpmn:Artifact")){for(;t&&!uy(t,"bpmn:Process")&&!uy(t,"bpmn:SubProcess")&&!uy(t,"bpmn:Collaboration");){if(uy(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(uy(e,"bpmn:MessageFlow"))i="messageFlows";else if(uy(e,"bpmn:Participant")){i="participants";var o,a=e.processRef;a&&(o=function(e){for(;e&&!uy(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(li.remove(o.get("rootElements"),a),a.$parent=null),t&&(li.add(o.get("rootElements"),a),a.$parent=o))}else uy(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":uy(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&&(s=e.$parent.get(i),li.remove(s,e)),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var c=n.get(i);li.remove(s,e),t&&(c||(c=[],t.set(i,c)),c.push(e))}}},hy.prototype.updateConnectionWaypoints=function(e){e.businessObject.di.set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},hy.prototype.updateConnection=function(e){var t,n=e.connection,i=ly(n),r=ly(n.source),o=ly(n.target);if(uy(i,"bpmn:DataAssociation"))uy(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=r,t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,parent.businessObject)):uy(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||r,this.updateSemanticParent(i,r,t),i.targetRef=o);else{var a=uy(i,"bpmn:SequenceFlow");i.sourceRef!==r&&(a&&(li.remove(i.sourceRef&&i.sourceRef.get("outgoing"),i),r&&r.get("outgoing")&&r.get("outgoing").push(i)),i.sourceRef=r),i.targetRef!==o&&(a&&(li.remove(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)},hy.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label};var fy=s.assign,yy=s.forEach,vy=d.is,gy=f.isExpanded;function by(e,t,n){tr.call(this),this._bpmnFactory=e,this._moddle=t,this._translate=n}U(by,tr),by.$inject=["bpmnFactory","moddle","translate"];var xy=by;function Ey(e,t,n){e[n]=t[n],delete t[n]}by.prototype.baseCreate=tr.prototype.create,by.prototype.create=function(e,t){return"label"===e?this.baseCreate(e,fy({type:"label"},Be.DEFAULT_LABEL_SIZE,t)):this.createBpmnElement(e,t)},by.prototype.createBpmnElement=function(e,t){var n,i,r,o=this._translate,a=(t=t||{}).businessObject;if(!a){if(!t.type)throw new Error(o("no shape type specified"));a=this._bpmnFactory.create(t.type)}return a.di||(a.di="root"===e?this._bpmnFactory.createDiPlane(a,[],{id:a.id+"_di"}):"connection"===e?this._bpmnFactory.createDiEdge(a,[],{id:a.id+"_di"}):this._bpmnFactory.createDiShape(a,{},{id:a.id+"_di"})),t.colors&&(fy(a.di,t.colors),delete t.colors),function(e,t,n){yy(n,function(n){void 0!==t[n]&&Ey(e,t,n)})}(a,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&Ey(a.di,t,"isExpanded"),vy(a,"bpmn:ExclusiveGateway")&&(a.di.isMarkerVisible=!0),t.eventDefinitionType&&(i=a.get("eventDefinitions")||[],r=this._moddle.create(t.eventDefinitionType),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._moddle.create("bpmn:FormalExpression")),i.push(r),r.$parent=a,a.eventDefinitions=i,delete t.eventDefinitionType),n=this._getDefaultSize(a),t=fy({businessObject:a,id:a.id},n,t),this.baseCreate(e,t)},by.prototype._getDefaultSize=function(e){return vy(e,"bpmn:SubProcess")?gy(e)?{width:350,height:200}:{width:100,height:80}:vy(e,"bpmn:Task")?{width:100,height:80}:vy(e,"bpmn:Gateway")?{width:50,height:50}:vy(e,"bpmn:Event")?{width:36,height:36}:vy(e,"bpmn:Participant")?gy(e)?{width:600,height:250}:{width:400,height:100}:vy(e,"bpmn:Lane")?{width:400,height:100}:vy(e,"bpmn:DataObjectReference")?{width:36,height:50}:vy(e,"bpmn:DataStoreReference")?{width:50,height:50}:vy(e,"bpmn:TextAnnotation")?{width:100,height:30}:{width:100,height:80}},by.prototype.createParticipantShape=function(e){var t={type:"bpmn:Participant"};return e||(t.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(t)};var _y=Be.hasExternalLabel,wy=d.getBusinessObject,Sy=d.is,Ty={width:0,height:0};function Cy(e){var t=new G;function n(e,t){var n=e.label||e,i=e.labelTarget||e;return Uh.setLabel(n,t,i!==n),[n,i]}this.execute=function(e){return e.oldLabel=Uh.getLabel(e.element),n(e.element,e.newLabel)},this.revert=function(e){return n(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newBounds;if(_y(i)||Sy(i,"bpmn:TextAnnotation")){var a=wy(r),s=a.name||a.text;s&&(void 0===o&&(o=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ry});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(r,s,t)),o&&e.resizeShape(r,o,Ty))}}}Cy.$inject=["modeling"];var Ay=Cy,Ry={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Py=s.filter,My=ep.getLanesRoot,ky=ep.getChildLanes,By=ep.LANE_INDENTATION;function Ny(e,t){this._modeling=e,this._spaceTool=t}Ny.$inject=["modeling","spaceTool"];var Dy=Ny;function Oy(e){this._moddle=e}Ny.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=My(i),a=o===i,s=a?i:i.parent;ky(s).length||n.createShape({type:"bpmn:Lane"},{x:i.x+By,y:i.y,width:i.width-By,height:i.height},s);var c=[];ui.eachElement(o,function(e){return c.push(e),e===i?[]:Py(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?By:0),y:l-("top"===r?120:0),width:i.width-(a?By:0),height:120},s)},Oy.$inject=["moddle"];var Ly=Oy;Oy.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;e.claiming?t.claim(n,i):t.unclaim(n)},Oy.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 Iy=d.is,jy=ep.getLanesRoot,zy=ep.computeLanesResize,Fy=ui.eachElement,$y=Ps.asTRBL,Gy=$c.substractTRBL;function Wy(e,t){this._modeling=e,this._spaceTool=t}Wy.$inject=["modeling","spaceTool"];var Hy=Wy;Wy.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},Wy.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=zy(e,t);n.resizeShape(e,t),i.forEach(function(e){n.resizeShape(e.shape,e.newBounds)})},Wy.prototype.resizeSpace=function(e,t){var n,i,r,o,a,s=this._spaceTool,c=$y(e),p=$y(t),l=Gy(p,c),u=jy(e),h=[],d=[];Fy(u,function(e){return h.push(e),(Iy(e,"bpmn:Lane")||Iy(e,"bpmn:Participant"))&&d.push(e),e.children}),(l.bottom||l.top)&&(n=l.bottom||l.top,i=e.y+(l.bottom?e.height:0)+(l.bottom?-10:10),r=l.bottom?"s":"n",o=l.top>0||l.bottom<0?-n:n,a=s.calculateAdjustments(h,"y",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:0,y:n},r)),(l.left||l.right)&&(n=l.right||l.left,i=e.x+(l.right?e.width:0)+(l.right?-10:100),r=l.right?"e":"w",o=l.left>0||l.right<0?-n:n,a=s.calculateAdjustments(d,"x",o,i),s.makeSpace(a.movingShapes,a.resizingShapes,{x:n,y:0},r))};var Vy=s.assign,qy=s.forEach,Uy={fill:void 0,stroke:void 0};function Yy(e){this._commandStack=e}Yy.$inject=["commandStack"];var Ky=Yy;Yy.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Uy,i=this,r={};"fill"in n&&Vy(r,{fill:n.fill}),"stroke"in n&&Vy(r,{stroke:n.stroke}),qy(t,function(e){i._commandStack.execute("element.updateProperties",{element:e,properties:{di:r}})})};var Xy=ep.getChildLanes,Zy=ep.LANE_INDENTATION;function Qy(e,t){this._modeling=e,this._translate=t}Qy.$inject=["modeling","translate"];var Jy=Qy;function ev(e,t){this._canvas=e,this._modeling=t}Qy.prototype.preExecute=function(e){var t=this._modeling,n=this._translate,i=e.shape,r=e.count,o=Xy(i),a=o.length;if(a>r)throw new Error(n("more than {count} child lanes",{count:r}));var s,c,p,l,u,h=Math.round(i.height/r);for(u=0;u<r;u++)s=i.y+u*h,c=u===r-1?i.height-h*u:h,p={x:i.x+Zy,y:s,width:i.width-Zy,height:c},u<a?t.resizeShape(o[u],p):(l={type:"bpmn:Lane"},t.createShape(l,p,i))},ev.$inject=["canvas","modeling"];var tv=ev;ev.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),li.add(a.rootElements,i),i.$parent=a,li.remove(a.rootElements,o),o.$parent=null,o.di=null,s.bpmnElement=i,i.di=s,e.oldRoot=r},ev.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),li.remove(o.rootElements,n),n.$parent=null,li.add(o.rootElements,r),r.$parent=o,n.di=null,a.bpmnElement=r,r.di=a};var nv=ep.collectLanes,iv=ep.getLanesRoot,rv=d.is,ov=Ps.asTRBL;function av(e){this._elementRegistry=e}av.$inject=["elementRegistry"];var sv=av;av.prototype.computeUpdates=function(e,t){var n={},i=[],r={},o=[];function a(e){n[e.id]||(o.push(e),n[e.id]=e)}function s(e){return e.parent?function(e){var t=iv(e);return r[t.id]||(r[t.id]=nv(t)),r[t.id]}(e).filter(function(t){return n=e,i=ov(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o}).map(function(e){return e.businessObject}):[]}return t.forEach(function(e){var t=iv(e);t&&!n[t.id]&&(t.children.filter(function(e){return rv(e,"bpmn:FlowNode")}).forEach(a),n[t.id]=t)}),e.forEach(a),o.forEach(function(e){var t=e.businessObject,n=t.get("lanes").slice(),r=s(e);i.push({flowNode:t,remove:n,add:r})}),t.forEach(function(e){var t=e.businessObject;e.parent||t.get("flowNodeRef").forEach(function(e){i.push({flowNode:e,remove:[t],add:[]})})}),i},av.prototype.execute=function(e){var t=e.updates;t||(t=e.updates=this.computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.remove.forEach(function(e){li.remove(n,e),li.remove(e.get("flowNodeRef"),t)}),e.add.forEach(function(e){li.add(n,e),li.add(e.get("flowNodeRef"),t)})})},av.prototype.revert=function(e){e.updates.forEach(function(e){var t=e.flowNode,n=t.get("lanes");e.add.forEach(function(e){li.remove(n,e),li.remove(e.get("flowNodeRef"),t)}),e.remove.forEach(function(e){li.add(n,e),li.add(e.get("flowNodeRef"),t)})})};var cv=s.reduce,pv=s.keys,lv=s.forEach,uv=s.assign,hv=d.getBusinessObject,dv="id",mv="di",fv={width:0,height:0};function yv(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._translate=n,this._modeling=i,this._textUtil=new G}yv.$inject=["elementRegistry","moddle","translate","modeling"];var vv=yv;function gv(e,t){return dv in e&&e[dv]!==t[dv]}function bv(e,t){lv(t,function(t,n){var i;n!==mv?e.set(n,t):e.di&&(i=e.di,lv(t,function(e,t){i.set(t,e)}))})}yv.prototype.execute=function(e){var t=e.element,n=[t],i=this._translate;if(!t)throw new Error(i("element required"));var r=this._elementRegistry,o=this._moddle.ids,a=t.businessObject,s=function(e){var t=uv({},e);return xv.forEach(function(n){n in e&&(t[n]=hv(t[n]))}),t}(e.properties),c=e.oldProperties||function(e,t){var n=pv(t);return cv(n,function(n,i){var r,o;return n[i]=i!==mv?e.get(i):(r=e.di,o=pv(t.di),cv(o,function(e,t){return e[t]=r.get(t),e},{})),n},{})}(a,s);return gv(s,a)&&(o.unclaim(a[dv]),r.updateId(t,s[dv]),o.claim(s[dv],a)),"default"in s&&(s.default&&n.push(r.get(s.default.id)),a.default&&n.push(r.get(a.default.id))),"name"in s&&t.label&&(n.push(t.label),t.label.hidden=!s.name),bv(a,s),e.oldProperties=c,e.changed=n,n},yv.prototype.postExecute=function(e){var t=e.element.label,n=t&&hv(t).name;if(n){var i=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Ev});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(t,n,this._textUtil);this._modeling.resizeShape(t,i,fv)}},yv.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 bv(r,i),gv(n,r)&&(a.unclaim(n[dv]),o.updateId(t,i[dv]),a.claim(i[dv],r)),e.changed};var xv=["default"];var Ev={fontFamily:"Arial, sans-serif",fontSize:"11px"};var _v=s.forEach;function wv(e,t){this._modeling=e,this._canvas=t}wv.$inject=["modeling","canvas"];var Sv=wv;function Tv(){}wv.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;_v(n,function(e){var n={x:0,y:0};i.left?n.x=i.left-e.x:i.right?n.x=i.right-e.width-e.x:i.center?n.x=i.center-Math.round(e.width/2)-e.x:i.top?n.y=i.top-e.y:i.bottom?n.y=i.bottom-e.height-e.y:i.middle&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)})},wv.prototype.postExecute=function(e){};var Cv=Tv;Tv.prototype.execute=function(){},Tv.prototype.revert=function(){};var Av=s.some;function Rv(e){this._modeling=e}U(Rv,Cv),Rv.$inject=["modeling"];var Pv=Rv;function Mv(e,t){this._canvas=e,this._layouter=t}Rv.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},Rv.prototype.postExecute=function(e){var t,n,i=e.connectionParent||e.shape.parent;t=e.source,n=e.shape,Av(t.outgoing,function(e){return e.target===n})||this._modeling.connect(e.source,e.shape,e.connection,i)},Mv.$inject=["canvas","layouter"];var kv=Mv;Mv.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},Mv.prototype.revert=function(e){var t=e.connection;this._canvas.removeConnection(t),t.source=null,t.target=null};var Bv=s.assign,Nv=Math.round;function Dv(e){this._canvas=e}Dv.$inject=["canvas"];var Ov=Dv;function Lv(e){Ov.call(this,e)}Dv.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?Bv(t,n):Bv(t,{x:n.x-Nv(t.width/2),y:n.y-Nv(t.height/2)}),this._canvas.addShape(t,i,r),t},Dv.prototype.revert=function(e){this._canvas.removeShape(e.shape)},U(Lv,Ov),Lv.$inject=["canvas"];var Iv=Lv,jv=Ov.prototype.execute;Lv.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach(function(t){void 0===e[t]&&(e[t]=0)})}(t),t.labelTarget=e.labelTarget,jv.call(this,e)};var zv=Ov.prototype.revert;function Fv(e,t){this._canvas=e,this._modeling=t}Lv.prototype.revert=function(e){return e.shape.labelTarget=null,zv.call(this,e)},Fv.$inject=["canvas","modeling"];var $v=Fv;Fv.prototype.preExecute=function(e){var t=e.connection;t.label&&this._modeling.removeShape(t.label)},Fv.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=li.indexOf(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t.label=null,t},Fv.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,li.add(n.children,t,i),this._canvas.addConnection(t,n),t};var Gv=s.forEach;function Wv(e,t){this._modeling=e,this._elementRegistry=t}U(Wv,Cv),Wv.$inject=["modeling","elementRegistry"];var Hv=Wv;Wv.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry,i=e.elements;Gv(i,function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))})};var Vv={saveClear:function(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}}},qv=Vv.saveClear;function Uv(e,t){this._canvas=e,this._modeling=t}Uv.$inject=["canvas","modeling"];var Yv=Uv;Uv.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=n.label;n.labelTarget&&(e.labelTarget=n.labelTarget,n.labelTarget=null),i&&this._modeling.removeShape(i,{nested:!0}),qv(n.incoming,function(e){t.removeConnection(e,{nested:!0})}),qv(n.outgoing,function(e){t.removeConnection(e,{nested:!0})}),qv(n.children,function(e){e.waypoints?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})})},Uv.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=li.indexOf(i.children,n),n.label=null,t.removeShape(n),n},Uv.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex,o=e.labelTarget;return li.add(i.children,n,r),o&&(o.label=n),t.addShape(n,i),n};var Kv=s.forEach,Xv=s.sortBy;function Zv(e){this._modeling=e}Zv.$inject=["modeling"];var Qv=Zv,Jv={x:"y",y:"x"};Zv.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function a(e){return e[i]+e[r]/2}function s(e){return e.length-1}function c(e){return e.max-e.min}var p,l,u=n[0],h=s(n),d=n[h],m=0;Kv(n,function(e,p){var l,u,d;e.elements.length<2?p&&p!==n.length-1&&(o(e,e.elements[0]),m+=c(e.range)):(u=(l=Xv(e.elements,i))[0],p===h&&(u=l[s(l)]),d=a(u),e.range=null,Kv(l,function(n){!function(e,n){var r={y:0};r[i]=e-a(n),r[i]&&(r[Jv[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}}),p&&p!==n.length-1&&(m+=c(e.range)))}),l=Math.abs(d.range.min-u.range.max),(p=Math.round((l-m)/(n.length-1)))<n.length-1||Kv(n,function(e,o){var a,s={};e!==u&&e!==d&&(a=n[o-1],e.range.max=0,Kv(e.elements,function(n,o){s[Jv[i]]=0,s[i]=a.range.max-n[i]+p,e.range.min!==n[i]&&(s[i]+=n[i]-e.range.min),s[i]&&t.moveElements([n],s,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)}))})},Zv.prototype.postExecute=function(e){};var eg=s.assign;function tg(e,t){this._layouter=e,this._canvas=t}tg.$inject=["layouter","canvas"];var ng=tg;tg.prototype.execute=function(e){var t=e.connection,n=t.waypoints;return eg(e,{oldWaypoints:n}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},tg.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t};var ig=s.forEach;function rg(){}var og=rg;rg.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=li.remove(o.children,t),li.add(i.children,t,r),t.parent=i,ig(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},rg.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return li.remove(n.children,t),li.add(i.children,t,r),t.parent=i,ig(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};var ag={},sg=Ps.roundPoint,cg=Xu.center,pg=Xu.delta;ag.getNewAttachPoint=function(e,t,n){var i=cg(t),r=cg(n),o=pg(e,i),a=o.x*(n.width/t.width),s=o.y*(n.height/t.height);return sg({x:r.x+a,y:r.y+s})},ag.getNewAttachShapeDelta=function(e,t,n){var i=cg(e),r=cg(t),o=cg(n),a=pg(e,i),s=pg(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 sg({x:l+a.x-e.x,y:u+a.y-e.y})};var lg={},ug=ag.getNewAttachPoint;function hg(e,t,n){var i=fg(e)[0];return ug(i.original||i,n,t)}function dg(e,t,n){var i=fg(e),r=i[i.length-1];return ug(r.original||r,n,t)}function mg(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function fg(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}lg.getResizedSourceAnchor=hg,lg.getResizedTargetAnchor=dg,lg.getMovedSourceAnchor=function(e,t,n){return hg(e,t,mg(t,n))},lg.getMovedTargetAnchor=function(e,t,n){return dg(e,t,mg(t,n))};var yg=s.forEach,vg=lg.getMovedSourceAnchor,gg=lg.getMovedTargetAnchor;function bg(e){this._modeling=e}var xg=bg;function Eg(e){this._helper=new xg(e)}bg.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},bg.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,a=e.allShapes,s=e.allConnections,c=e.enclosedConnections,p=e.topLevel,l=!1;r&&r.parent===n&&(l=!0),yg(a,function(e){o.moveShape(e,t,p[e.id]&&!l&&n,{recurse:!1,layout:!1})}),yg(s,function(e){var i=!!a[e.source.id],r=!!a[e.target.id];c[e.id]&&i&&r?o.moveConnection(e,t,p[e.id]&&!l&&n):o.layoutConnection(e,{connectionStart:i&&vg(e,e.source,t),connectionEnd:r&&gg(e,e.target,t)})})},bg.prototype.getClosure=function(e){return ui.getClosure(e)},Eg.$inject=["modeling"];var _g=Eg;Eg.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Eg.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)},Eg.prototype.execute=function(e){},Eg.prototype.revert=function(e){};var wg=s.assign,Sg=s.forEach,Tg=s.pick,Cg=lg.getMovedSourceAnchor,Ag=lg.getMovedTargetAnchor;function Rg(e){this._modeling=e,this._helper=new xg(e)}Rg.$inject=["modeling"];var Pg=Rg;Rg.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=Tg(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=li.remove(o.children,t),li.add(i.children,t,r),wg(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},Rg.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(Sg(t.incoming,function(e){r.layoutConnection(e,{connectionEnd:Ag(e,t,n)})}),Sg(t.outgoing,function(e){r.layoutConnection(e,{connectionStart:Cg(e,t,n)})})),!1!==i.recurse&&this.moveChildren(e)},Rg.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return li.add(n.children,t,i),wg(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},Rg.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Rg.prototype.getNewParent=function(e){return e.newParent||e.shape.parent};var Mg=s.forEach,kg=s.map,Bg=s.sortBy,Ng=s.assign;function Dg(e,t){Mg(t,function(t){e[t]&&delete e[t]})}function Og(e,t,n,i,r,o){this._eventBus=e,this._canvas=t,this._selection=n,this._elementFactory=i,this._modeling=r,this._rules=o}U(Og,Cv),Og.$inject=["eventBus","canvas","selection","elementFactory","modeling","rules"];var Lg=Og;Og.prototype.preExecute=function(e){var t=this._eventBus,n=this,i=e.tree,r=e.topParent,o=e.position;i.createdElements={},i.labels=[],Mg(i,function(e,a){var s=parseInt(a,10);isNaN(s)||(s||(e=kg(e,function(e){return e.parent=r,e})),e=Bg(e,"priority"),Mg(e,function(e){var a,c=e.id,p=e.parent,l={},u=Ng({},e);if(s&&(u.parent=n._getCreatedElement(p,i)),p)if(t.fire("element.paste",{createdElements:i.createdElements,descriptor:u}),p=u.parent,u.waypoints)(u=n._createConnection(u,p,o,i))&&(i.createdElements[c]={element:u,descriptor:e});else{if(u.parent!==r&&(l.root=!1),u.host&&(l.attach=!0,p=n._getCreatedElement(u.host,i)),u.labelTarget)return i.labels.push(u);a={x:Math.round(o.x+u.delta.x+u.width/2),y:Math.round(o.y+u.delta.y+u.height/2)},Dg(u,["id","parent","delta","host","priority"]),(u=n._createShape(u,p,a,l))&&(i.createdElements[c]={element:u,descriptor:e})}}))})},Og.prototype.postExecute=function(e){var t=this._modeling,n=this._selection,i=this,r=e.tree,o=r.labels,a=[];Mg(o,function(e){var n,o,a,s=i._getCreatedElement(e.labelTarget,r);s&&(n=s.label)&&(o={x:s.x,y:s.y},s.waypoints&&(o=s.waypoints[0]),a={x:Math.round(o.x-n.x+e.delta.x),y:Math.round(o.y-n.y+e.delta.y)},t.moveShape(n,a,s.parent))}),Mg(r[0],function(e){var t=e.id,n=r.createdElements[t];n&&a.push(n.element)}),n.select(a)},Og.prototype._createConnection=function(e,t,n,i){var r,o,a=this._modeling,s=this._rules;return e.waypoints=kg(e.waypoints,function(t,i){return{x:Math.round(n.x+e.delta[i].x),y:Math.round(n.y+e.delta[i].y)}}),r=this._getCreatedElement(e.source,i),o=this._getCreatedElement(e.target,i),r&&o&&s.allowed("element.paste",{source:r,target:o})?(Dg(e,["id","parent","delta","source","target","width","height","priority"]),a.createConnection(r,o,e,t)):null},Og.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},Og.prototype._getCreatedElement=function(e,t){return t.createdElements[e]&&t.createdElements[e].element};var Ig=s.isArray;function jg(){}jg.$inject=[];var zg=jg;jg.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,Ig(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},jg.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};var Fg=s.forEach;function $g(e,t){this._modeling=e,this._rules=t}$g.$inject=["modeling","rules"];var Gg=$g;$g.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,a=e.newData,s=e.hints;function c(e,t,n,i){return r.allowed(e,{source:t,target:n,connection:i})}var p,l={x:a.x,y:a.y};t=e.newShape=e.newShape||n.createShape(a,l,o.parent),o.host&&i.updateAttachment(t,o.host),!1!==s.moveChildren&&(p=o.children.slice(),i.moveElements(p,{x:0,y:0},t));var u=o.incoming.slice(),h=o.outgoing.slice();Fg(u,function(e){var i=e.waypoints,r=i[i.length-1];c("connection.reconnectEnd",e.source,t,e)&&n.reconnectEnd(e,t,r)}),Fg(h,function(e){var i=e.waypoints[0],r=e.target;c("connection.reconnectStart",t,r,e)&&n.reconnectStart(e,t,i)})},$g.prototype.postExecute=function(e){var t=this._modeling,n=e.oldShape,i=e.newShape;Fg(i.incoming,function(e){t.layoutConnection(e,{endChanged:!0})}),Fg(i.outgoing,function(e){t.layoutConnection(e,{startChanged:!0})}),t.removeShape(n)},$g.prototype.execute=function(e){},$g.prototype.revert=function(e){},$g.prototype.createShape=function(e,t,n){return this._modeling.createShape(e,t,n)},$g.prototype.reconnectStart=function(e,t,n){this._modeling.reconnectStart(e,t,n)},$g.prototype.reconnectEnd=function(e,t,n){this._modeling.reconnectEnd(e,t,n)};var Wg=s.assign,Hg=s.forEach,Vg=lg.getResizedSourceAnchor,qg=lg.getResizedTargetAnchor;function Ug(e){this._modeling=e}Ug.$inject=["modeling"];var Yg=Ug;Ug.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},Wg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Ug.prototype.postExecute=function(e){var t=e.shape,n=e.oldBounds,i=this._modeling;Hg(t.incoming,function(e){i.layoutConnection(e,{connectionEnd:qg(e,t,n)})}),Hg(t.outgoing,function(e){i.layoutConnection(e,{connectionStart:Vg(e,t,n)})})},Ug.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return Wg(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t};var Kg=s.forEach;function Xg(e){this._modeling=e}Xg.$inject=["modeling"];var Zg=Xg;function Qg(e){this._modeling=e}Xg.prototype.preExecute=function(e){var t=this._modeling,n=e.resizingShapes,i=e.delta,r=e.direction;Kg(n,function(e){var n=Kd.resizeBounds(e,r,i);t.resizeShape(e,n)})},Xg.prototype.postExecute=function(e){var t=this._modeling,n=e.movingShapes,i=e.delta;t.moveElements(n,i,void 0,{autoResize:!1,attach:!1})},Xg.prototype.execute=function(e){},Xg.prototype.revert=function(e){},Qg.$inject=["modeling"];var Jg=Qg;function eb(e){this._modeling=e}Qg.prototype.execute=function(e){var t,n=e.shape,i=n.children;return e.oldChildrenVisibility=(t={},i.forEach(function(e){t[e.id]=e.hidden}),t),n.collapsed=!n.collapsed,function(e,t){e.forEach(function(e){e.hidden=t})}(i,n.collapsed),[n].concat(i)},Qg.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)};var tb=eb;function nb(e,t){return li.remove(e&&e.attachers,t)}function ib(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),li.add(i,t,n)}}function rb(){}eb.$inject=["modeling"],eb.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=nb(i,t),ib(n,t),t.host=n,t},eb.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,nb(n,t),ib(i,t,r),t};var ob=rb;rb.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},rb.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t};var ab=s.forEach;function sb(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",function(){i.registerHandlers(n)})}sb.$inject=["eventBus","elementFactory","commandStack"];var cb=sb;sb.prototype.getHandlers=function(){return{"shape.append":Pv,"shape.create":Ov,"shape.delete":Yv,"shape.move":Pg,"shape.resize":Yg,"shape.replace":Gg,"shape.toggleCollapse":Jg,spaceTool:Zg,"label.create":Iv,"connection.create":kv,"connection.delete":$v,"connection.move":og,"connection.layout":ng,"connection.updateWaypoints":ob,"connection.reconnectStart":zg,"connection.reconnectEnd":zg,"elements.move":_g,"elements.delete":Hv,"elements.distribute":Qv,"elements.align":Sv,"element.updateAttachment":tb,"elements.paste":Lg}},sb.prototype.registerHandlers=function(e){ab(this.getHandlers(),function(t,n){e.registerHandler(n,t)})},sb.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)},sb.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},sb.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,a=n;!0===o?(r=n,a=n.parent):!1===o&&(r=null);var s={shapes:e,delta:t,newParent:a,newHost:r,hints:i};this._commandStack.execute("elements.move",s)},sb.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)},sb.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},sb.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},sb.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},sb.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},sb.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},sb.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},sb.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},sb.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},sb.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},sb.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},sb.prototype.pasteElements=function(e,t,n){var i={tree:e,topParent:t,position:n};this._commandStack.execute("elements.paste",i)},sb.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},sb.prototype.resizeShape=function(e,t,n){var i={shape:e,newBounds:t,minBounds:n};this._commandStack.execute("shape.resize",i)},sb.prototype.createSpace=function(e,t,n,i){var r={movingShapes:e,resizingShapes:t,delta:n,direction:i};this._commandStack.execute("spaceTool",r)},sb.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},sb.prototype.reconnectStart=function(e,t,n){var i={connection:e,newSource:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectStart",i)},sb.prototype.reconnectEnd=function(e,t,n){var i={connection:e,newTarget:t,dockingOrPoints:n};this._commandStack.execute("connection.reconnectEnd",i)},sb.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},sb.prototype._create=function(e,t){return t instanceof Fi.Base?t:this._elementFactory.create(e,t)},sb.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)};function pb(e,t,n,i){cb.call(this,e,t,n),this._bpmnRules=i}U(pb,cb),pb.$inject=["eventBus","elementFactory","commandStack","bpmnRules"];var lb=pb;pb.prototype.getHandlers=function(){var e=cb.prototype.getHandlers.call(this);return e["element.updateProperties"]=vv,e["canvas.updateRoot"]=tv,e["lane.add"]=Dy,e["lane.resize"]=Hy,e["lane.split"]=Jy,e["lane.updateRefs"]=sv,e["id.updateClaim"]=Ly,e["element.setColor"]=Ky,e["element.updateLabel"]=Ay,e},pb.prototype.updateLabel=function(e,t,n){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n})},pb.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)},pb.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},pb.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},pb.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},pb.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},pb.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},pb.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},pb.prototype.makeProcess=function(){var e={newRoot:this._create("root",{type:"bpmn:Process"})};this._commandStack.execute("canvas.updateRoot",e)},pb.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},pb.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},pb.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})};var ub=Ps.getOrientation,hb=Ps.getMid,db=Ps.asTRBL,mb=Ta.substract,fb=Be.hasExternalLabel;function yb(e,t){function n(e){if(fb(e)){var n=function(e){var t=hb(e.label),n=hb(e),i=bb(n,t);if(r=i,-1===gb.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 bb(n,e)}),a=gb.filter(function(e){return-1===o.indexOf(e)});if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var r,o=hb(e),a=e.label,s=hb(a),c=db(e);switch(n){case"top":r={x:o.x,y:c.top-i-a.height/2};break;case"left":r={x:c.left-i-a.width/2,y:o.y};break;case"bottom":r={x:o.x,y:c.bottom+i+a.height/2};break;case"right":r={x:c.right+i+a.width/2,y:o.y}}var p=mb(r,s);t.moveShape(a,p)}(e,n)}}gc.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var t=e.context.connection,i=t.source,r=t.target;n(i),n(r)});var i=10}U(yb,gc),yb.$inject=["eventBus","modeling"];var vb=yb;var gb=["top","bottom","left","right"];function bb(e,t){return ub(t,e,5)}var xb=d.is;function Eb(e,t,n){gc.call(this,e),this.preExecute("shape.append",function(e){var t=e.source,n=e.shape;e.position||(xb(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)}Eb.$inject=["eventBus","elementFactory","bpmnRules"],U(Eb,gc);var _b=Eb,wb=s.forEach,Sb=d.is;function Tb(e,t,n){gc.call(this,e),this.preExecute("elements.paste",1500,function(e){var t=e.topParent;if(t.parent||(e.topParent=n.getRootElement()),Sb(t,"bpmn:Lane"))do{t=e.topParent=t.parent}while(Sb(t,"bpmn:Lane")||!Sb(t,"bpmn:Participant"))},!0),this.postExecute("elements.paste",function(e){var n=e.tree.createdElements;wb(n,function(e){var i,r=e.element,o=r.businessObject,a=e.descriptor;(Sb(o,"bpmn:ExclusiveGateway")||Sb(o,"bpmn:InclusiveGateway")||Sb(o,"bpmn:Activity"))&&a.default&&(i=(i=n[a.default])?i.element:void 0,delete r.default,t.updateProperties(r,{default:i}))})},!0)}Tb.$inject=["eventBus","modeling","canvas"],U(Tb,gc);var Cb=Tb,Ab=d.is;function Rb(e,t,n,i){gc.call(this,e),this.preExecute("shape.create",function(e){var t,r=e.shape,o=e.host,a={cancelActivity:!0};o&&Ab(r,"bpmn:IntermediateThrowEvent")&&(a.attachedToRef=o.businessObject,t={type:"bpmn:BoundaryEvent",businessObject:i.create("bpmn:BoundaryEvent",a)},e.shape=n.createShape(t))},!0)}Rb.$inject=["eventBus","modeling","elementFactory","bpmnFactory"],U(Rb,gc);var Pb=Rb,Mb=d.is;function kb(e,t,n){gc.call(this,e),this.preExecute("shape.create",function(e){var n=e.context.shape;if(Mb(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}})}kb.$inject=["eventBus","bpmnFactory","moddle"],U(kb,gc);var Bb=kb,Nb=d.is;function Db(e,t,n,i,r){gc.call(this,e),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape,o=e.position,a=r.getRootElement();if(Nb(n,"bpmn:Process")&&Nb(i,"bpmn:Participant")&&!Nb(a,"bpmn:Collaboration")){var s=t.makeCollaboration();e.position=o,e.parent=s,e.processRoot=n}},!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 n=e.processRoot,i=e.shape;if(n){var r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}},!0)}Db.$inject=["eventBus","modeling","elementFactory","bpmnFactory","canvas"],U(Db,gc);var Ob=Db,Lb=s.find,Ib=d.is,jb="__targetRef_placeholder";function zb(e,t){function n(e,n){var i=e.get("properties"),r=Lb(i,function(e){return e.name===jb});return!r&&n&&(r=t.create("bpmn:Property",{name:jb}),li.add(i,r)),r}function i(e,t){var i=n(e);i&&(function(e,t,n){var i=e.get("dataInputAssociations");return Lb(i,function(e){return e!==n&&e.targetRef===t})}(e,i,t)||li.remove(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,a=o.businessObject,s=o.target,c=s&&s.businessObject,p=r.newTarget,l=p&&p.businessObject,u=r.oldTarget||r.target,h=u&&u.businessObject,d=o.businessObject;h&&h!==c&&i(h,a),l&&l!==c&&i(l,a),c?(t=n(c,!0),d.targetRef=t):d.targetRef=null}gc.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],$b(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnectEnd"],$b(r))}zb.$inject=["eventBus","bpmnFactory"],U(zb,gc);var Fb=zb;function $b(e){return function(t){var n=t.context.connection;if(Ib(n,"bpmn:DataInputAssociation"))return e(t)}}var Gb=d.is,Wb=ep.getChildLanes,Hb=ui.eachElement,Vb=500;function qb(e,t,n){gc.call(this,e),this.postExecuted("shape.delete",Vb,function(e){var t=e.context,i=t.hints,r=t.shape,o=t.oldParent;Gb(r,"bpmn:Lane")&&(i&&i.nested||function(e,t){var i,r,o,a=Wb(t),s=[],c=[];Hb(a,function(t){return t.y>e.y?c.push(t):s.push(t),t.children}),a.length&&(i=c.length&&s.length?e.height/2:e.height,s.length&&(r=n.calculateAdjustments(s,"y",i,e.y-10),n.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),c.length&&(o=n.calculateAdjustments(c,"y",-i,e.y+e.height+10),n.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")))}(r,o))})}qb.$inject=["eventBus","modeling","spaceTool"],U(qb,gc);var Ub=qb,Yb={},Kb=Ya.pointDistance,Xb=Math.round,Zb=Math.max;var Qb=10;Yb.getApproxIntersection=function(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Kb(i,t)<=Qb)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r,o,a=Rs((r=Qb,[["M",(i=t).x,i.y],["m",0,-r],["a",r,r,0,1,1,0,2*r],["a",r,r,0,1,1,0,-2*r],["z"]]),(n=[],e.forEach(function(e,t){n.push([0===t?"M":"L",e.x,e.y])}),n)),s=a[0],c=a[a.length-1];return s?s!==c?s.segment2!==c.segment2?{point:e[o=Zb(s.segment2,c.segment2)-1],bendpoint:!0,index:o}:{point:{x:Xb(s.x+c.x)/2,y:Xb(s.y+c.y)/2},index:s.segment2}:{point:{x:Xb(s.x),y:Xb(s.y)},index:s.segment2}:null}(e,t)};var Jb=s.assign,ex=s.find,tx=Yb.getApproxIntersection;function nx(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 ix(e){return Jb({},e)}function rx(e,t,n){function i(e,i,r){var o,a,s,c,p,l,u=i.waypoints,h=tx(u,r);if(h){if(o=u.slice(0,h.index),a=u.slice(h.index+(h.bendpoint?1:0)),!o.length||!a.length)return;s=h.bendpoint?u[h.index]:r,nx(e,o[o.length-1])||o.push(ix(s)),nx(e,a[0])||a.unshift(ix(s))}c=i.source,p=i.target,t.canConnect(c,e,i)&&(n.reconnectEnd(i,e,o||r),l=!0),t.canConnect(e,p,i)&&(l?n.connect(e,p,{type:i.type,waypoints:a}):n.reconnectStart(i,e,a||r))}gc.call(this,e),this.preExecute("elements.move",function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var a,s=(a=o,{x:Math.round(a.x+a.width/2),y:Math.round(a.y+a.height/2)}),c={x:s.x+r.x,y:s.y+r.y},p=ex(n.children,function(e){return t.canInsert(i,e)&&tx(e.waypoints,c)});p&&(e.targetFlow=p,e.position=c)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)},!0),this.preExecute("shape.create",function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)},!0)}U(rx,gc),rx.$inject=["eventBus","bpmnRules","modeling"];var ox=rx,ax=function(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))})},sx=Ps.getMid;function cx(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=ax(e,t,n,r),s=ax(e,t,n,o);i=a&&s?lx(a,n)>lx(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],sx(n.source)),t(i[i.length-1],i[i.length-2],sx(n.target)))})}cx.$inject=["eventBus"];var px=cx;function lx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}var ux={};function hx(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}ux.getAngle=function(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))},ux.rotateVector=function(e,t){return t?{x:Math.cos(t)*e.x-Math.sin(t)*e.y,y:Math.sin(t)*e.x+Math.cos(t)*e.y}:e},ux.getDistancePointPoint=function(e,t){return hx({x:e.x-t.x,y:e.y-t.y})};var dx={},mx=Math.sqrt,fx=Math.min,yx=Math.max,vx=Math.abs;function gx(e){return Math.pow(e,2)}function bx(e,t){return mx(gx(e.x-t.x)+gx(e.y-t.y))}function xx(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,a=n.x-e.x,s=n.y-e.y,c=r*r+o*o,p=(r*a+o*s)/c,l=p*p-(a*a+s*s-i*i)/c;if(l<0&&l>-1e-6&&(l=0),l<0)return[];var u=mx(l),h=-p+u,d=-p-u,m={x:e.x-r*h,y:e.y-o*h};return 0===l?[m]:[m,{x:e.x-r*d,y:e.y-o*d}].filter(function(n){return function(e,t,n){return Ex(e.x,t.x,n.x)&&Ex(e.y,t.y,n.y)}(n,e,t)})}function Ex(e,t,n){return e>=fx(t,n)-_x&&e<=yx(t,n)+_x}dx.getAttachment=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(wx(n=t[m],i=t[m+1])?s=[n]:(r=bx(e,n),o=bx(e,i),s=xx(n,i,e,fx(r,o))),s.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:wx(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:bx(n,a)/bx(n,i)}),p=bx(c.position,e),(!u||l>p)&&(u=c,l=p)}return u};var _x=.1;function wx(e,t){return vx(e.x-t.x)<=_x&&vx(e.y-t.y)<=_x}var Sx={},Tx=ux.getDistancePointPoint,Cx=ux.rotateVector,Ax=ux.getAngle,Rx=dx.getAttachment,Px=Ps.roundPoint;function Mx(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var a=i.segmentMove.segmentStartIndex,s=i.segmentMove.newSegmentStartIndex;return r===a?s:r>=s?r+o<s?s:r+o:r}if(i.bendpointMove){var c,p=i.bendpointMove.insert,l=i.bendpointMove.bendpointIndex;if(0===o)return r;if(r>=l&&(c=p?r+1:r-1),r<l)if(c=r,p&&"bendpoint"!==n.type&&l-1===r)kx(t,l)<n.relativeLocation&&c++;return c}return 0===o?r:i.connectionStart?0===r?0:null:i.connectionEnd&&r===e.length-2?t.length-2:null}function kx(e,t){var n=Tx(e[t-1],e[t]);return n/(n+Tx(e[t],e[t+1]))}function Bx(e,t){return[e[t],e[t+1]]}Sx.getLabelAdjustment=function(e,t,n,i){var r=0,o=0,a=function(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}(e),s=Rx(a,n),c=s.segmentIndex,p=Mx(n,t,s,i);if(null===p)return{x:r,y:o};if(p<0||p>t.length-2)return{x:r,y:o};var l,u,h,d,m,f,y=Bx(n,c),v=Bx(t,p),g=s.position,b=(d=g,m=Tx((h=y)[0],h[1]),f=Tx(h[0],d),0===m?0:f/m),x=(l=v,u=Ax(y),Ax(l)-u);if("bendpoint"===s.type){var E=t.length-n.length,_=s.bendpointIndex,w=n[_];if(-1!==t.indexOf(w))return{x:r,y:o};if(0===E){var S=t[_];return{x:S.x-s.position.x,y:S.y-s.position.y}}E<0&&0!==_&&_<n.length-1&&(b=kx(n,_))}var T=(v[1].x-v[0].x)*b+v[0].x,C=(v[1].y-v[0].y)*b+v[0].y,A=Cx({x:a.x-g.x,y:a.y-g.y},x);return r=T+A.x-a.x,o=C+A.y-a.y,Px({x:r,y:o})};var Nx=s.assign,Dx=d.is,Ox=d.getBusinessObject,Lx=Be.hasExternalLabel,Ix=Be.getExternalLabelMid,jx=Sx.getLabelAdjustment,zx={width:90,height:20};function Fx(e,t,n){gc.call(this,e);var i=new G;this.postExecute(["shape.create","connection.create"],function(e){var n=e.context,r=n.shape||n.connection,o=r.businessObject;if(Lx(r)){var a=Ix(r),s=function(e,t,n){var i=n.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:Gx});return{x:Math.round(e.x+e.width/2-i.width/2),y:Math.round(e.y),width:Math.ceil(i.width),height:Math.ceil(i.height)}}(zx,o.name||"",i);t.createLabel(r,a,{id:o.id+"_label",hidden:!o.name,businessObject:o,width:s.width,height:s.height})}}),this.executed(["label.create"],function(e){var t,i=e.context.shape;i.labelTarget&&Dx(i.labelTarget||i,"bpmn:BaseElement")&&((t=i.businessObject.di).label||(t.label=n.create("bpmndi:BPMNLabel",{bounds:n.create("dc:Bounds")})),Nx(t.label.bounds,{x:i.x,y:i.y,width:i.width,height:i.height}))}),this.postExecute(["connection.layout","connection.reconnectEnd","connection.reconnectStart","connection.updateWaypoints"],function(e){var n,i=e.context.connection.label;i&&(n=i.hidden?function(e){var t=e.context.connection,n=t.label,i=Ix(t);return{x:i.x-n.x-n.width/2,y:i.y-n.y-n.height/2}}(e):function(e){var t=e.command,n=e.context,i=n.connection,r=i.label,o=Nx({},n.hints),a=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===o.startChanged&&(o.startChanged="connection.reconnectStart"===t),void 0===o.endChanged&&(o.endChanged="connection.reconnectEnd"===t),jx(r,a,s,o)}(e),t.moveShape(i,n))}),this.postExecute(["shape.replace"],function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Ox(n);r&&Lx(r)&&(n.label.x=i.label.x,n.label.y=i.label.y)})}U(Fx,gc),Fx.$inject=["eventBus","modeling","bpmnFactory"];var $x=Fx,Gx={fontFamily:"Arial, sans-serif",fontSize:"11px"};var Wx=d.is,Hx="flow elements must be children of pools/participants",Vx="participants cannot be pasted onto a non-empty process diagram";function qx(e,t,n){function i(e,n,i){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:i||2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,r=t.shape,o=t.target;Wx(o,"bpmn:Collaboration")&&Wx(r,"bpmn:FlowNode")&&i(e,n(Hx))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,r=t.position,o=t.target;Wx(o,"bpmn:Collaboration")&&i(r,n(Hx)),Wx(o,"bpmn:Process")&&i(r,n(Vx),3e3)})}qx.$inject=["eventBus","tooltips","translate"];var Ux=qx;function Yx(e,t,n){gc.call(this,e),this.preExecute("shape.delete",function(e){var i,r,o,a=e.context.shape;if(1==a.incoming.length&&1==a.outgoing.length){var s=a.incoming[0],c=a.outgoing[0];if(t.canConnect(s.source,c.target,s)){var p=(i=s.waypoints,r=c.waypoints,(o=ax(Xx(i[i.length-2]),Xx(i[i.length-1]),Xx(r[1]),Xx(r[0])))?[].concat(i.slice(0,i.length-1),[o],r.slice(1)):[Xx(i[0]),Xx(r[r.length-1])]);n.reconnectEnd(s,c.target,p)}}})}U(Yx,gc),Yx.$inject=["eventBus","bpmnRules","modeling"];var Kx=Yx;function Xx(e){return e.original||e}var Zx=d.is;function Qx(e,t){gc.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Zx(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var n=e.collaborationRoot;n&&!n.businessObject.participants.length&&t.makeProcess()},!0)}Qx.$inject=["eventBus","modeling"],U(Qx,gc);var Jx=Qx,eE=s.forEach,tE=s.find,nE=s.matchPattern,iE=d.is;function rE(e,t,n){function i(e){var i,r,o=e.source,a=e.target;e.parent&&(iE(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,a)||(r=!0),n.canConnectMessageFlow(o,a)&&(i="bpmn:MessageFlow")),iE(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,a)||(r=!0),n.canConnectSequenceFlow(o,a)&&(i="bpmn:SequenceFlow")),iE(e,"bpmn:Association")&&!n.canConnectAssociation(o,a)&&(r=!0),r&&t.removeConnection(e),i&&t.connect(o,a,{type:i,waypoints:e.waypoints.slice()}))}gc.call(this,e),this.postExecuted("elements.move",function(e){var t=e.closure.allConnections;eE(t,i)},!0),this.postExecuted(["connection.reconnectStart","connection.reconnectEnd"],function(e){i(e.context.connection)}),this.postExecuted("element.updateProperties",function(e){var n,i=e.context,r=i.properties,o=i.element,a=o.businessObject;r.default&&(n=tE(o.outgoing,nE({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&a.sourceRef.default===a&&t.updateProperties(o.source,{default:void 0})})}U(rE,gc),rE.$inject=["eventBus","modeling","bpmnRules"];var oE=rE,aE=s.forEach,sE=f.isEventSubProcess,cE=d.is;function pE(e,t,n,i,r,o){gc.call(this,e),this._bpmnReplace=t,this._elementRegistry=i,this._selection=r,this._modeling=o,this.postExecuted(["elements.move"],500,function(e){var t=e.context,i=t.newParent,r=t.newHost,o=[];aE(t.closure.topLevel,function(e){o=sE(e)?o.concat(e.children):o.concat(e)}),1===o.length&&r&&(i=r);var a=n.canReplace(o,i);a&&this.replaceElements(o,a.replacements,r)},this),this.postExecute(["shape.replace"],1500,function(e){var t,i=e.context,r=i.oldShape,o=i.newShape,a=r.attachers;a&&a.length&&(t=n.canReplace(a,o),this.replaceElements(a,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;o.unclaimId(n.businessObject.id,n.businessObject),o.updateProperties(i,{id:n.id})})}U(pE,gc),pE.prototype.replaceElements=function(e,t,n){var i=this._elementRegistry,r=this._bpmnReplace,o=this._selection,a=this._modeling;aE(t,function(t){var o={type:t.newElementType},s=i.get(t.oldElementId);n&&cE(s,"bpmn:BoundaryEvent")&&a.updateAttachment(s,null);var c=e.indexOf(s);e[c]=r.replaceElement(s,o,{select:!1}),n&&cE(e[c],"bpmn:BoundaryEvent")&&a.updateAttachment(e[c],n)}),t&&o.select(e)},pE.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var lE=pE,uE=d.is,hE=Ps.roundBounds,dE=_o.hasPrimaryModifier,mE=1001;function fE(e,t){e.on("resize.start",mE+500,function(e){var t=e.context,n=t.shape;(uE(n,"bpmn:Lane")||uE(n,"bpmn:Participant"))&&(t.balanced=!dE(e))}),e.on("resize.end",mE,function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(uE(i,"bpmn:Lane")||uE(i,"bpmn:Participant"))return r&&(o=hE(o),t.resizeLane(i,o,n.balanced)),!1})}fE.$inject=["eventBus","modeling"];var yE=fE,vE=d.getBusinessObject,gE=d.is,bE=$c.computeChildrenBBox,xE=500;function EE(e,t,n,i){gc.call(this,e),this.executed(["shape.toggleCollapse"],xE,function(e){var t,n=e.context.shape;gE(n,"bpmn:SubProcess")&&(n.collapsed?vE(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),vE(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],xE,function(e){var t=e.context.shape;t.collapsed?vE(t).di.isExpanded=!1:vE(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],xE,function(e){var i,r=e.context.shape,o=t._getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,a=t;return n=(r=o,r.filter(function(e){return!e.hidden})).concat([e]),(i=bE(n))?(a.width=Math.max(i.width,a.width),a.height=Math.max(i.height,a.height),a.x=i.x+(i.width-a.width)/2,a.y=i.y+(i.height-a.height)/2):(a.x=e.x+(e.width-a.width)/2,a.y=e.y+(e.height-a.height)/2),a}(r,o),n.resizeShape(r,i)})}U(EE,gc),EE.$inject=["eventBus","elementFactory","modeling"];var _E=EE;var wE=s.forEach;function SE(e,t){gc.call(this,e),this.preExecute("elements.delete",function(e){var n=e.context.elements;wE(n,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}U(SE,gc),SE.$inject=["eventBus","modeling"];var TE=SE,CE=d.is,AE=d.getBusinessObject;function RE(e,t){gc.call(this,e),this.preExecute("connection.delete",function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!CE(e,"bpmn:SequenceFlow"))return!1;var n=AE(t),i=AE(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})})}U(RE,gc),RE.$inject=["eventBus","modeling"];var PE=RE;var ME=d.is,kE=500,BE=5e3;function NE(e,t,n){var i;function r(){if(!i)throw new Error(n("out of bounds release"));return i}gc.call(this,e);var o=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(o,BE,function(e){(i=i||new function(){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}}).enter()}),this.postExecuted(o,kE,function(e){!function(){if(!i)throw new Error(n("out of bounds release"));var e=i.leave();e&&(t.updateLaneRefs(i.flowNodes,i.lanes),i=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=r();t.labelTarget||(ME(t,"bpmn:Lane")&&n.addLane(t),ME(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}NE.$inject=["eventBus","modeling","translate"],U(NE,gc);var DE={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","copyPasteBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","deleteLaneBehavior","dropOnFlowBehavior","importDockingFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeLaneBehavior","toggleElementCollapseBehaviour","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",vb],appendBehavior:["type",_b],copyPasteBehavior:["type",Cb],createBoundaryEventBehavior:["type",Pb],createDataObjectBehavior:["type",Bb],createParticipantBehavior:["type",Ob],dataInputAssociationBehavior:["type",Fb],deleteLaneBehavior:["type",Ub],dropOnFlowBehavior:["type",ox],importDockingFix:["type",px],labelBehavior:["type",$x],modelingFeedback:["type",Ux],replaceConnectionBehavior:["type",oE],removeParticipantBehavior:["type",Jx],replaceElementBehaviour:["type",lE],resizeLaneBehavior:["type",yE],removeElementBehavior:["type",Kx],toggleElementCollapseBehaviour:["type",_E],unclaimIdBehavior:["type",TE],updateFlowNodeRefsBehavior:["type",NE],unsetDefaultFlowBehavior:["type",PE]};function OE(e){gc.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)}),this.preExecute(["shape.move","connection.move"],function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)})}OE.prototype.getOrdering=function(e,t){return null},U(OE,gc);var LE=OE,IE=Js.isAny,jE=s.findIndex,zE=s.find;function FE(e,t){LE.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 i(e){var t=e.order;return t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=zE(n,function(t){return IE(e,[t.type])});return t&&t.order||{level:1}}(e)),t}this.getOrdering=function(e,n){var r=i(e);r.containers&&(n=function(e,n,i){for(var r=n;r&&!IE(r,i);)r=r.parent;if(!r)throw new Error(t("no parent for {element} in {parent}",{element:e.id,parent:n.id}));return r}(e,n,r.containers));var o=n.children.indexOf(e),a=jE(n.children,function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level});return-1!==a&&-1!==o&&o<a&&(a-=1),{index:a,parent:n}}}FE.$inject=["eventBus","translate"],U(FE,LE);var $E={__init__:["bpmnOrderingProvider"],__depends__:[Qe],bpmnOrderingProvider:["type",FE]},GE={},WE=Ps.getOrientation;GE.getBoundaryAttachment=function(e,t){var n=WE(e,t,-15);return"intersect"!==n?n:null};var HE=d.is,VE=Ps.asTRBL,qE=ep.collectLanes,UE=ep.getLanesRoot,YE=Math.abs,KE=Math.min,XE=Math.max;function ZE(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function QE(e,t,n){return ZE(e,t,n,KE)}function JE(e,t,n){return ZE(e,t,n,XE)}var e_=60,t_=300,n_=20,i_=50,r_=20,o_=20;GE.getParticipantSizeConstraints=function(e,t,n){var i=UE(e),r=!0,o=!0,a=qE(i,[i]),s=VE(e),c={},p={};return/e/.test(t)?p.right=s.left+t_:/w/.test(t)&&(p.left=s.right-t_),a.forEach(function(e){var i=VE(e);/n/.test(t)&&(i.top<s.top-10&&(r=!1),n&&YE(s.top-i.bottom)<10&&JE(c,"top",i.top+e_),YE(s.top-i.top)<5&&QE(p,"top",i.bottom-e_)),/s/.test(t)&&(i.bottom>s.bottom+10&&(o=!1),n&&YE(s.bottom-i.top)<10&&QE(c,"bottom",i.bottom-e_),YE(s.bottom-i.bottom)<5&&JE(p,"bottom",i.top+e_))}),i.children.filter(function(e){return!e.hidden&&!e.waypoints&&(HE(e,"bpmn:FlowElement")||HE(e,"bpmn:Artifact"))}).forEach(function(e){var n=VE(e);r&&/n/.test(t)&&QE(p,"top",n.top-r_),/e/.test(t)&&JE(p,"right",n.right+n_),o&&/s/.test(t)&&JE(p,"bottom",n.bottom+o_),/w/.test(t)&&QE(p,"left",n.left-i_)}),{min:p,max:c}};var a_=s.find,s_=s.some,c_=s.every,p_=s.filter,l_=s.forEach,u_=d.is,h_=Js.isAny,d_=d.getBusinessObject,m_=f.isExpanded,f_=f.isEventSubProcess,y_=f.isInterrupting,v_=f.hasErrorEventDefinition,g_=f.hasEscalationEventDefinition,b_=f.hasCompensateEventDefinition,x_=GE.getBoundaryAttachment;function E_(e){Nc.call(this,e)}U(E_,Nc),E_.$inject=["eventBus"];var __=E_;function w_(e){return!e||B_(e)}function S_(e,t){return e===t}function T_(e){do{if(u_(e,"bpmn:Process"))return d_(e);if(u_(e,"bpmn:Participant"))return d_(e).processRef}while(e=e.parent)}function C_(e){return u_(e,"bpmn:TextAnnotation")}function A_(e){return u_(e,"bpmn:BoundaryEvent")&&M_(e,"bpmn:CompensateEventDefinition")}function R_(e){return d_(e).isForCompensation}function P_(e){for(var t=e;t=t.parent;){if(u_(t,"bpmn:FlowElementsContainer"))return d_(t);if(u_(t,"bpmn:Participant"))return d_(t).processRef}return null}function M_(e,t){var n=d_(e);return!!a_(n.eventDefinitions||[],function(e){return u_(e,t)})}function k_(e,t){return(d_(e).eventDefinitions||[]).every(function(e){return u_(e,t)})}function B_(e){return e.labelTarget}function N_(e){return e.waypoints}function D_(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function O_(e,t,n){if(w_(e)||w_(t))return null;if(S_(e,t))return!1;if(!u_(n,"bpmn:DataAssociation")){if(V_(e,t))return{type:"bpmn:MessageFlow"};if(q_(e,t))return{type:"bpmn:SequenceFlow"}}var i=U_(e,t);return i||(A_(e)&&R_(t)?{type:"bpmn:Association",associationDirection:"One"}:!!H_(e,t)&&{type:"bpmn:Association"})}function L_(e,t,n){return!(!B_(e)||N_(t))||!(u_(t,"bpmn:Participant")&&!m_(t))&&(u_(e,"bpmn:Participant")?u_(t,"bpmn:Process")||u_(t,"bpmn:Collaboration"):u_(e,"bpmn:Lane")?u_(t,"bpmn:Participant")||u_(t,"bpmn:Lane"):!u_(e,"bpmn:BoundaryEvent")&&(u_(e,"bpmn:FlowElement")?u_(t,"bpmn:FlowElementsContainer")?m_(t):h_(t,["bpmn:Participant","bpmn:Lane"]):h_(e,["bpmn:Artifact","bpmn:DataAssociation"])?h_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!u_(e,"bpmn:MessageFlow")&&(u_(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function I_(e){return!B_(e)&&u_(e,"bpmn:BoundaryEvent")}function j_(e){return u_(e,"bpmn:Lane")}function z_(e,t,n,i){if(Array.isArray(e)||(e=[e]),n)return!1;if(1!==e.length)return!1;var r=e[0];return!B_(r)&&(!!function(e){return I_(e)||u_(e,"bpmn:IntermediateThrowEvent")&&!e.parent}(r)&&(!t||!f_(t)&&(!(!u_(t,"bpmn:Activity")||R_(t))&&(!(i&&!x_(i,t))&&"attach"))))}function F_(e,t,n){if(!t)return!1;var i={replacements:[]};return l_(e,function(e){f_(t)||u_(e,"bpmn:StartEvent")&&"label"!==e.type&&L_(e,t)&&(y_(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(v_(e)||g_(e)||b_(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),u_(t,"bpmn:Transaction")||M_(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(u_(e,"bpmn:EndEvent")&&L_(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),u_(e,"bpmn:BoundaryEvent")&&z_(e,t,null,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!i.replacements.length&&i}function $_(e,t){return!s_(e,I_)&&(!s_(e,j_)&&(!t||e.every(function(e){return L_(e,t)})))}function G_(e,t,n,i){return!!t&&(B_(t)?null:!S_(n,t)&&((!n||!D_(n,t))&&(L_(e,t)||Y_(e,t,i))))}function W_(e,t){return u_(e,"bpmn:SubProcess")?m_(e)&&(!t||t.width>=100&&t.height>=80):u_(e,"bpmn:Lane")?!t||t.width>=130&&t.height>=60:u_(e,"bpmn:Participant")?!t||t.width>=250&&t.height>=50:!!C_(e)}function H_(e,t){return!N_(e)&&!N_(t)&&(!(!A_(e)||!R_(t))||!D_(t,e)&&!D_(e,t)&&function(e,t){var n=C_(e),i=C_(t);return(n||i)&&n!==i}(e,t))}function V_(e,t){return u_(i=e,"bpmn:InteractionNode")&&(!u_(i,"bpmn:Event")||u_(i,"bpmn:ThrowEvent")&&k_(i,"bpmn:MessageEventDefinition"))&&function(e){return u_(e,"bpmn:InteractionNode")&&!R_(e)&&(!u_(e,"bpmn:Event")||u_(e,"bpmn:CatchEvent")&&k_(e,"bpmn:MessageEventDefinition"))}(t)&&(n=t,!(T_(e)===T_(n)));var n,i}function q_(e,t){return u_(o=e,"bpmn:FlowNode")&&!u_(o,"bpmn:EndEvent")&&!f_(o)&&!(u_(o,"bpmn:IntermediateThrowEvent")&&M_(o,"bpmn:LinkEventDefinition"))&&!A_(o)&&!R_(o)&&function(e){return u_(e,"bpmn:FlowNode")&&!u_(e,"bpmn:StartEvent")&&!u_(e,"bpmn:BoundaryEvent")&&!f_(e)&&!(u_(e,"bpmn:IntermediateCatchEvent")&&M_(e,"bpmn:LinkEventDefinition"))&&!R_(e)}(t)&&(n=t,i=P_(e),r=P_(n),i&&i===r)&&!(u_(e,"bpmn:EventBasedGateway")&&!function(e){return u_(e,"bpmn:ReceiveTask")||u_(e,"bpmn:IntermediateCatchEvent")&&(M_(e,"bpmn:MessageEventDefinition")||M_(e,"bpmn:TimerEventDefinition")||M_(e,"bpmn:ConditionalEventDefinition")||M_(e,"bpmn:SignalEventDefinition"))}(t));var n,i,r,o}function U_(e,t){return h_(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&h_(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!h_(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!h_(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Y_(e,t,n){if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return h_(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!B_(t)&&u_(e,"bpmn:FlowNode")&&!u_(e,"bpmn:BoundaryEvent")&&L_(e,t.parent)}function K_(e,t){return e&&t&&-1!==e.indexOf(t)}function X_(e,t){return!(u_(t,"bpmn:Lane")&&!K_(e,t.parent))&&!(u_(t,"bpmn:BoundaryEvent")&&!K_(e,t.host))}E_.prototype.init=function(){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 O_(t,n)}finally{r&&(n.parent=null)}}),this.addRule("connection.reconnectStart",function(e){var t=e.connection;return O_(e.hover||e.source,t.target,t)}),this.addRule("connection.reconnectEnd",function(e){var t=e.connection;return O_(t.source,e.hover||e.target,t)}),this.addRule("connection.updateWaypoints",function(e){return null}),this.addRule("shape.resize",function(e){return W_(e.shape,e.newBounds)}),this.addRule("elements.move",function(e){var t=e.target,n=e.shapes,i=e.position;return z_(n,t,null,i)||F_(n,t,i)||$_(n,t)||Y_(n,t,i)}),this.addRule("shape.create",function(e){return G_(e.shape,e.target,e.source,e.position)}),this.addRule("shape.attach",function(e){return z_(e.shape,e.target,null,e.position)}),this.addRule("element.copy",function(e){return X_(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?O_(r,o):z_([n],t,null,i)||G_(n,t,null,i)}),this.addRule("elements.paste",function(e){return function(e,t){var n=e[0];if(u_(t,"bpmn:Collaboration"))return c_(n,function(e){return"bpmn:Participant"===e.type});if(u_(t,"bpmn:Process"))return!(s_(n,function(e){return"bpmn:Participant"===e.type})&&t.children.length>0);if(u_(t,"bpmn:Participant")&&!m_(t))return!1;if(u_(t,"bpmn:FlowElementsContainer"))return m_(t);return h_(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"])}(e.tree,e.target)}),this.addRule(["elements.delete"],function(e){return p_(e.elements,function(e){return!B_(e)})})},E_.prototype.canConnectMessageFlow=V_,E_.prototype.canConnectSequenceFlow=q_,E_.prototype.canConnectDataAssociation=U_,E_.prototype.canConnectAssociation=H_,E_.prototype.canMove=$_,E_.prototype.canAttach=z_,E_.prototype.canReplace=F_,E_.prototype.canDrop=L_,E_.prototype.canInsert=Y_,E_.prototype.canCreate=G_,E_.prototype.canConnect=O_,E_.prototype.canResize=W_,E_.prototype.canCopy=X_;var Z_={__depends__:[cu],__init__:["bpmnRules"],bpmnRules:["type",__]},Q_=s.uniqueBy,J_=s.isArray;function ew(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)}ew.$inject=["eventBus","injector"];var tw=ew;ew.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)},ew.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},ew.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed")},ew.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()}},ew.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()}},ew.prototype.register=function(e,t){this._setHandler(e,t)},ew.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)},ew.prototype.canUndo=function(){return!!this._getUndoAction()},ew.prototype.canRedo=function(){return!!this._getRedoAction()},ew.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},ew.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},ew.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)})},ew.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},ew.prototype._createId=function(){return this._uid++},ew.prototype._atomicDo=function(e){var t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},ew.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)},ew.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)},ew.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:Q_("id",n)}),n.length=0,this._fire("changed"))},ew.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=J_(e)?e:[e],t.dirty=t.dirty.concat(e))},ew.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},ew.prototype._revertedAction=function(e){this._stackIdx--},ew.prototype._getHandler=function(e){return this._handlerMap[e]},ew.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 nw={commandStack:["type",tw]},iw=s.flatten,rw=s.filter,ow=s.forEach,aw=s.groupBy,sw=s.map,cw=s.unionBy,pw=Vv.saveClear,lw=ag.getNewAttachShapeDelta,uw=251,hw=1401;function dw(e,t,n,i){gc.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",hw,function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=mw(t=r),cw("id",t,n)),i.validatedShapes=function(e){var t=aw(e,"id");return rw(e,function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0})}(o)}),r&&t.on("shape.move.start",uw,function(e){var t=e.context,n=mw(t.shapes);ow(n,function(e){r.makeDraggable(t,e,!0),e.label&&r.makeDraggable(t,e.label,!0)})}),this.postExecuted("elements.move",function(e){var t=e.context,n=t.delta,r=t.newParent,o=t.closure.enclosedElements,a=mw(o);ow(a,function(e){o[e.id]||(i.moveShape(e,n,r),e.label&&i.moveShape(e.label,n,r))})}),this.postExecuted("elements.move",function(e){var t,n=e.context,r=n.shapes,o=n.newHost;r.length>1||(t=o?r:rw(r,function(e){return!!e.host}),ow(t,function(e){i.updateAttachment(e,o)}))}),this.postExecuted("elements.move",function(e){var t=e.context.shapes;ow(t,function(e){ow(e.attachers,function(e){ow(e.outgoing.slice(),function(e){n.allowed("connection.reconnectStart",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}),ow(e.incoming.slice(),function(e){n.allowed("connection.reconnectEnd",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})})})}),this.postExecute("shape.create",function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)}),this.postExecute("shape.replace",function(e){var t=e.context,r=t.oldShape,o=t.newShape;pw(r.attachers,function(e){"attach"===n.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)}),o.attachers.length&&ow(o.attachers,function(e){var t=lw(e,r,o);i.moveShape(e,t,e.parent)})}),this.postExecute("shape.resize",function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,a=n.attachers;a.length&&ow(a,function(e){var t=lw(e,r,o);i.moveShape(e,t,e.parent),e.label&&i.moveShape(e.label,t,e.label.parent)})}),this.preExecute("shape.delete",function(e){var t=e.context.shape;pw(t.attachers,function(e){i.removeShape(e)}),t.host&&i.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,o=rw(r,function(e){var t=e.host;return t&&-1===r.indexOf(t)});ow(o,function(e){li.remove(r,e),e.label&&li.remove(r,e.label)}),t.attachSupportInitialized=!0}})}function mw(e){return iw(sw(e,function(e){return e.attachers||[]}))}U(dw,gc),dw.$inject=["injector","eventBus","rules","modeling"];var fw={__depends__:[cu],__init__:["attachSupport"],attachSupport:["type",dw]},yw=s.forEach,vw=s.filter,gw=s.map,bw=250,xw=1400,Ew=Ps.getMid;function _w(e,t,n){gc.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",xw,function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=ww(n),t.validatedShapes=ww(i)}),i&&t.on("shape.move.start",bw,function(e){var t=e.context,n=t.shapes,r=[];yw(n,function(e){var n=e.label;n&&!n.hidden&&-1===t.shapes.indexOf(n)&&r.push(n),e.labelTarget&&r.push(e)}),yw(r,function(e){i.makeDraggable(t,e,!0)})}),this.postExecute("elements.move",xw,function(e){var t=e.context,n=t.closure.enclosedElements;t.enclosedLabels=gw(n,function(e){var t=e.label;return t&&!n[t.id]?[t,Ew(t)]:null}).filter(function(e){return e})}),this.postExecuted("elements.move",function(e){var t=e.context,i=t.enclosedLabels,r=t.delta;yw(i,function(e){var t=e[0],i=e[1],o=Ew(t);o.x===i.x&&o.y===i.y&&n.moveShape(t,r,t.labelTarget.parent)})})}function ww(e){return vw(e,function(t){return-1===e.indexOf(t.labelTarget)})}U(_w,gc),_w.$inject=["injector","eventBus","modeling"];var Sw={__init__:["labelSupport"],labelSupport:["type",_w]},Tw=s.isString,Cw=s.assign,Aw=s.forEach,Rw=Y.domify,Pw=Y.attr,Mw=Y.classes,kw=Y.remove,Bw=Y.delegate,Nw=new Yr("tt");function Dw(e,t){e.style.display=!1===t?"none":""}var Ow=".djs-tooltip";function Lw(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Nw,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=Rw('<div class="djs-tooltip-container" style="position: absolute; width: 0; height: 0;" />'),n.insertBefore(i,n.firstChild),i);var r=this;Bw.bind(this._tooltipRoot,Ow,"mousedown",function(e){e.stopPropagation()}),Bw.bind(this._tooltipRoot,Ow,"mouseover",function(e){r.trigger("mouseover",e)}),Bw.bind(this._tooltipRoot,Ow,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Lw.$inject=["eventBus","canvas"];var Iw=Lw;Lw.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=Cw({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Lw.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(Pw(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Lw.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Lw.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Lw.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Lw.prototype.remove=function(e){var t=this.get(e);t&&(kw(t.html),kw(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Lw.prototype.show=function(){Dw(this._tooltipRoot)},Lw.prototype.hide=function(){Dw(this._tooltipRoot,!1)},Lw.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},Lw.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)),Tw(i)&&(i=Rw(i)),(t=Rw('<div data-tooltip-id="'+n+'" class="djs-tooltip" style="position: absolute">')).appendChild(i),e.type&&Mw(t).add("djs-tooltip-"+e.type),e.className&&Mw(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Lw.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,Cw(t.style,{left:n+"px",top:i+"px"})},Lw.prototype._updateTooltipVisibilty=function(e){Aw(this._tooltips,function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Dw(i,r))})},Lw.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",function(t){e.hide()}),this._eventBus.on("canvas.viewbox.changed",function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()})};var jw={__init__:["tooltips"],tooltips:["type",Iw]},zw=s.assign,Fw=Ps.getElementLineIntersection;function $w(e){return zw({original:e.point.original||e.point},e.actual)}function Gw(e,t){this._elementRegistry=e,this._graphicsFactory=t}Gw.$inject=["elementRegistry","graphicsFactory"];var Ww=Gw;Gw.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($w(i)),o.push($w(r)),o},Gw.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}},Gw.prototype._getIntersection=function(e,t,n){var i=this._getShapePath(e),r=this._getConnectionPath(t);return Fw(i,r,n)},Gw.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},Gw.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},Gw.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var Hw={__init__:["modeling","bpmnUpdater"],__depends__:[DE,Z_,$E,pl,nw,jw,Sw,fw,aa,Km,gm],bpmnFactory:["type",Pf],bpmnUpdater:["type",dy],elementFactory:["type",xy],modeling:["type",lb],layouter:["type",ry],connectionDocking:["type",Ww]},Vw=s.assign;function qw(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)}var Uw=qw;qw.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],qw.prototype.getPaletteEntries=function(e){var t={},n=this._create,i=this._elementFactory,r=this._spaceTool,o=this._lassoTool,a=this._handTool,s=this._globalConnect,c=this._translate;function p(e,t,r,o,a){function s(t){var r=i.createShape(Vw({type:e},a));a&&(r.businessObject.di.isExpanded=a.isExpanded),n.start(t,r)}var p=e.replace(/^bpmn:/,"");return{group:t,className:r,title:o||c("Create {type}",{type:p}),action:{dragstart:s,click:s}}}function l(e,t){n.start(e,i.createParticipantShape(t))}return Vw(t,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:c("Activate the hand tool"),action:{click:function(e){a.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:c("Activate the lasso tool"),action:{click:function(e){o.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:c("Activate the create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:c("Activate the global connect tool"),action:{click:function(e){s.toggle(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":p("bpmn:StartEvent","event","bpmn-icon-start-event-none"),"create.intermediate-event":p("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",c("Create Intermediate/Boundary Event")),"create.end-event":p("bpmn:EndEvent","event","bpmn-icon-end-event-none"),"create.exclusive-gateway":p("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",c("Create Gateway")),"create.task":p("bpmn:Task","activity","bpmn-icon-task"),"create.data-object":p("bpmn:DataObjectReference","data-object","bpmn-icon-data-object"),"create.data-store":p("bpmn:DataStoreReference","data-store","bpmn-icon-data-store"),"create.subprocess-expanded":p("bpmn:SubProcess","activity","bpmn-icon-subprocess-expanded",c("Create expanded SubProcess"),{isExpanded:!0}),"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:c("Create Pool/Participant"),action:{dragstart:l,click:l}}}),t};var Yw=s.isFunction,Kw=s.isArray,Xw=s.forEach,Zw=Y.domify,Qw=Y.query,Jw=Y.attr,eS=Y.clear,tS=Y.classes,nS=Y.matches,iS=Y.delegate,rS=Y.event;function oS(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())})}oS.$inject=["eventBus","canvas"];var aS=oS;oS.prototype.registerProvider=function(e){this._providers.push(e),this._diagramInitialized&&(this._container||this._init(),this._update())},oS.prototype.getEntries=function(){var e={};return Xw(this._providers,function(t){var n=t.getPaletteEntries();Xw(n,function(t,n){e[n]=t})}),e},oS.prototype._init=function(){var e=this._canvas,t=this._eventBus,n=e.getContainer(),i=this._container=Zw(oS.HTML_MARKUP),r=this;n.appendChild(i),iS.bind(i,".djs-palette-toggle, .entry","click",function(e){var t=e.delegateTarget;if(nS(t,".djs-palette-toggle"))return r.toggle();r.trigger("click",e)}),rS.bind(i,"mousedown",function(e){e.stopPropagation()}),iS.bind(i,".entry","dragstart",function(e){r.trigger("dragstart",e)}),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},oS.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=tS(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()})},oS.prototype._update=function(){var e=Qw(".djs-palette-entries",this._container),t=this._entries=this.getEntries();eS(e),Xw(t,function(t,n){var i=t.group||"default",r=Qw("[data-group="+i+"]",e);r||(r=Zw('<div class="group" data-group="'+i+'"></div>'),e.appendChild(r));var o,a,s,c=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),p=Zw(c);r.appendChild(p),t.separator||(Jw(p,"data-action",n),t.title&&Jw(p,"title",t.title),t.className&&(o=p,a=t.className,s=tS(o),(Kw(a)?a:a.split(/\s+/g)).forEach(function(e){s.add(e)})),t.imageUrl&&p.appendChild(Zw('<img src="'+t.imageUrl+'">')))}),this.open()},oS.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[Jw(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,Yw(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},oS.prototype._layoutChanged=function(){this._toggleState({})},oS.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},oS.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},oS.prototype.open=function(){this._toggleState({open:!0})},oS.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},oS.prototype.isActiveTool=function(e){return e&&this._activeTool===e},oS.prototype.updateToolHighlight=function(e){var t,n;this._toolsContainer||(t=Qw(".djs-palette-entries",this._container),this._toolsContainer=Qw("[data-group=tools]",t)),n=this._toolsContainer,Xw(n.children,function(t){var n=t.getAttribute("data-action");if(n){var i=tS(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}})},oS.prototype.isOpen=function(){return tS(this._container).has("open")},oS.prototype._getParentContainer=function(){return this._canvas.getContainer()},oS.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var sS={__depends__:[{__init__:["palette"],palette:["type",aS]},Du,gm,Fd,Pd,Qe,qh],__init__:["paletteProvider"],paletteProvider:["type",Uw]},cS=s.assign,pS=s.forEach,lS=Y.query,uS=n.attr,hS=250;function dS(e,t,n,i,r){gc.call(this,e),e.on("shape.move.move",hS,function(e){var o=e.context,a=o.canExecute;o.visualReplacements||(o.visualReplacements={}),a.replacements?function(e){var o=e.canExecute.replacements;pS(o,function(o){var a=o.oldElementId,s={type:o.newElementType};if(!e.visualReplacements[a]){var c=t.get(a);cS(s,{x:c.x,y:c.y});var p=n.createShape(s);i.addShape(p,c.parent);var l=lS("[data-element-id="+c.id+"]",e.dragGroup);l&&uS(l,{display:"none"});var u=r.addDragger(p,e.dragGroup);e.visualReplacements[a]=u,i.removeShape(p)}})}(o):function(e){var t=e.visualReplacements;pS(t,function(n,i){var r=lS("[data-element-id="+i+"]",e.dragGroup);r&&uS(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]})}(o)})}dS.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],U(dS,gc);var mS={__depends__:[Yd],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",dS]},fS={},yS=Math.abs,vS=Math.round;fS.snapTo=function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],yS(r-e)<=n)return r},fS.topLeft=function(e){return{x:e.x,y:e.y}},fS.mid=function(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:vS(e.x+e.width/2),y:vS(e.y+e.height/2)}},fS.bottomRight=function(e){return{x:e.x+e.width,y:e.y+e.height}},fS.isSnapped=function(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)},fS.setSnapped=function(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};var gS=s.forEach,bS=fS.snapTo;function xS(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}xS.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},xS.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},xS.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},xS.prototype.getSnapLocations=function(){return this._snapLocations},xS.prototype.setSnapLocations=function(e){this._snapLocations=e},xS.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new _S).initDefaults(this._defaultSnaps),n};var ES=xS;function _S(e){this._snapValues={}}_S.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)},_S.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&bS(e[n],r[n],i)},_S.prototype.initDefaults=function(e){var t=this;gS(e||{},function(e,n){gS(e,function(e){t.add(n,e)})})};var wS=s.filter,SS=s.forEach,TS=s.debounce,CS=s.bind,AS=fS.mid,RS=1250,PS=fS.isSnapped,MS=fS.setSnapped,kS=n.append,BS=n.attr,NS=n.classes,DS=n.create;function OS(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"],RS,function(e){e.originalEvent&&e.originalEvent.ctrlKey||PS(e)||n.snap(e)}),e.on(["shape.move.cleanup","create.cleanup"],function(e){n.hide()}),this._asyncHide=TS(CS(this.hide,this),1e3)}OS.$inject=["eventBus","canvas"];var LS=OS;OS.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.snapContext;i||(i=t.snapContext=new ES);var r=AS(n,e);return i.setSnapOrigin("mid",{x:r.x-e.x,y:r.y-e.y}),i},OS.prototype.snap=function(e){var t=e.context,n=t.snapContext,i=t.shape,r=t.target,o=n.getSnapLocations();if(r){var a=n.pointsForTarget(r);a.initialized||(this.addTargetSnaps(a,i,r),a.initialized=!0);var s={x:PS(e,"x"),y:PS(e,"y")};SS(o,function(t){var i=n.getSnapOrigin(t),r={x:e.x+i.x,y:e.y+i.y};if(SS(["x","y"],function(e){var n;s[e]||void 0!==(n=a.snap(r,t,e,7))&&(s[e]={value:n,originValue:n-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),SS(["x","y"],function(t){var n=s[t];"object"==typeof n&&MS(e,t,n.originValue)})}},OS.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=DS("path");return BS(n,{d:"M0,0 L0,0"}),NS(n).add("djs-snap-line"),kS(t,n),{update:function(t){BS(n,"number"!=typeof t?{display:"none"}:"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""})}}},OS.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},OS.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},OS.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},OS.prototype.hide=function(){SS(this._snapLines,function(e){e.update()})},OS.prototype.addTargetSnaps=function(e,t,n){var i=this.getSiblings(t,n);SS(i,function(t){e.add("mid",AS(t))})},OS.prototype.getSiblings=function(e,t){return t&&wS(t.children,function(t){return!t.hidden&&!t.labelTarget&&t.host!==e&&t!==e})};var IS=s.forEach,jS=s.assign,zS=ui.getBBox,FS=d.is,$S=Js.isAny,GS=f.isExpanded,WS=Ps.asTRBL,HS=Math.round,VS=fS.mid,qS=fS.topLeft,US=fS.bottomRight,YS=fS.isSnapped,KS=fS.setSnapped,XS=GE.getBoundaryAttachment,ZS=GE.getParticipantSizeConstraints,QS=ep.getLanesRoot,JS=1500;function eT(e,t,n,i){LS.call(this,e,t),e.on("create.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();FS(i,"bpmn:Participant")&&FS(r,"bpmn:Process")&&nT(n,i,r.children)}),e.on(["create.move","create.end"],JS,function(e){var t=e.context,n=t.shape,i=t.participantSnapBox;!YS(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=US(e);a.x>=c.x?KS(n,"x",c.x+i+r):s.x<=p.x&&KS(n,"x",p.x-i-r);a.y>=c.y?KS(n,"y",c.y+o):s.y<=p.y&&KS(n,"y",p.y-o)}(i,n,e)}),e.on("shape.move.start",function(e){var n=e.context,i=n.shape,r=t.getRootElement();FS(i,"bpmn:Participant")&&FS(r,"bpmn:Process")&&nT(n,i,r.children)}),e.on(["create.move","create.end","shape.move.move","shape.move.end"],JS,function(e){var t=e.context,i=t.target,r=t.shape;i&&!YS(e)&&function(e,t,i){return"attach"===n.canAttach([e],t,null,i)}(r,i,e)&&function(e,t,n){var i=WS(n),r=XS(e,n);/top/.test(r)?KS(e,"y",i.top):/bottom/.test(r)&&KS(e,"y",i.bottom);/left/.test(r)?KS(e,"x",i.left):/right/.test(r)&&KS(e,"x",i.right)}(e,0,i)}),e.on(["shape.move.hover","shape.move.move","shape.move.end","create.hover","create.move","create.end"],JS,function(e){var t=e.context.shape,n=e.hover;FS(n,"bpmn:Lane")&&!$S(t,["bpmn:Lane","bpmn:Participant"])&&(e.hover=QS(n),e.hoverGfx=i.getGraphics(e.hover))}),e.on(["connect.move","connect.hover","connect.end"],JS,function(e){var t=e.context,i=t.source,r=t.target,o=function(e,t){return n.canConnect(e,t)}(i,r)||{};t.initialSourcePosition||(t.initialSourcePosition=t.sourcePosition),r&&"bpmn:SequenceFlow"===o.type?(t.sourcePosition=VS(i),jS(e,VS(r))):t.sourcePosition=t.initialSourcePosition}),e.on("resize.start",JS,function(e){var t=e.context,n=t.shape;FS(n,"bpmn:SubProcess")&&GS(n)&&(t.minDimensions={width:140,height:120}),FS(n,"bpmn:Participant")&&(t.minDimensions={width:300,height:150}),(FS(n,"bpmn:Lane")||FS(n,"bpmn:Participant"))&&(t.resizeConstraints=ZS(n,t.direction,t.balanced)),FS(n,"bpmn:TextAnnotation")&&(t.minDimensions={width:50,height:30})})}U(eT,LS),eT.$inject=["eventBus","canvas","bpmnRules","elementRegistry"];var tT=eT;function nT(e,t,n){if(n.length){var i=zS(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}}eT.prototype.initSnap=function(e){var t,n,i,r,o,a=e.context,s=e.shape;o=LS.prototype.initSnap.call(this,e),FS(s,"bpmn:Participant")&&o.setSnapLocations(["top-left","bottom-right","mid"]),s&&(t=VS(s,e),n={width:s.width,height:s.height,x:isNaN(s.x)?HS(t.x-s.width/2):s.x,y:isNaN(s.y)?HS(t.y-s.height/2):s.y},i=qS(n),r=US(n),o.setSnapOrigin("top-left",{x:i.x-e.x,y:i.y-e.y}),o.setSnapOrigin("bottom-right",{x:r.x-e.x,y:r.y-e.y}),IS(s.outgoing,function(t){var n=t.waypoints[0];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}),IS(s.incoming,function(t){var n=t.waypoints[t.waypoints.length-1];n=n.original||n,o.setSnapOrigin(t.id+"-docking",{x:n.x-e.x,y:n.y-e.y})}));var c=a.source;c&&o.addDefaultSnap("mid",VS(c))},eT.prototype.addTargetSnaps=function(e,t,n){FS(t,"bpmn:BoundaryEvent")&&"label"!==t.type&&(n=n.parent),FS(n,"bpmn:SequenceFlow")&&this.addTargetSnaps(e,t,n.parent);var i=this.getSiblings(t,n)||[];IS(i,function(t){FS(t,"bpmn:Lane")||(t.waypoints?IS(t.waypoints.slice(1,-1),function(n,i){var r=t.waypoints[i+2],o=t.waypoints[i];if(!r||!o)throw new Error("waypoints must exist");r.x!==n.x&&r.y!==n.y&&o.x!==n.x&&o.y!==n.y||e.add("mid",n)}):(e.add("mid",VS(t)),FS(t,"bpmn:Participant")&&(e.add("top-left",qS(t)),e.add("bottom-right",US(t)))))}),IS(t.incoming,function(t){-1===i.indexOf(t.source)&&e.add("mid",VS(t.source));var n=t.waypoints[0];e.add(t.id+"-docking",n.original||n)}),IS(t.outgoing,function(t){-1===i.indexOf(t.target)&&e.add("mid",VS(t.target));var n=t.waypoints[t.waypoints.length-1];e.add(t.id+"-docking",n.original||n)})};var iT={__init__:["snapping"],snapping:["type",tT]},rT=s.assign;function oT(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=rT({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()})}oT.$inject=["config.autoScroll","eventBus","canvas","mouseTracking"];var aT=oT;function sT(e,t,n){return t<e&&e<n}oT.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++)sT(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))},oT.prototype.stopScroll=function(){clearTimeout(this._scrolling)},oT.prototype.setOptions=function(e){this._opts=rT({},this._opts,e)},oT.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=go.toPoint(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var cT={__depends__:[ou,uh],__init__:["autoScroll"],autoScroll:["type",aT]},pT={},lT=pT.BENDPOINT_CLS="djs-bendpoint",uT=pT.SEGMENT_DRAGGER_CLS="djs-segment-dragger",hT=n.append,dT=n.attr,mT=n.classes,fT=n.create,yT=w.rotate,vT=w.translate;pT.toCanvasCoordinates=function(e,t){var n,i=go.toPoint(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}},pT.addBendpoint=function(e,t){var n=fT("g");mT(n).add(lT),hT(e,n);var i=fT("circle");dT(i,{cx:0,cy:0,r:4}),mT(i).add("djs-visual"),hT(n,i);var r=fT("circle");return dT(r,{cx:0,cy:0,r:10}),mT(r).add("djs-hit"),hT(n,r),t&&mT(n).add(t),n},pT.addSegmentDragger=function(e,t,n){var i=fT("g"),r=Ya.getMidPoint(t,n),o=Ya.pointsAligned(t,n);return hT(e,i),function(e,t,n){var i=fT("g");hT(e,i);var r=fT("rect");dT(r,{x:-7,y:-1.5,width:14,height:3}),mT(r).add("djs-visual"),hT(i,r);var o=fT("rect");dT(o,{x:-10,y:-4.5,width:20,height:9}),mT(o).add("djs-hit"),hT(i,o),yT(i,"h"===n?90:0,0,0)}(i,0,o),mT(i).add(uT),mT(i).add("h"===o?"vertical":"horizontal"),vT(i,r.x,r.y),i};var gT="connect-ok",bT="connect-not-ok",xT="connect-hover",ET="djs-updating",_T="connection.updateWaypoints",wT="connection.reconnectStart",ST="connection.reconnectEnd",TT=Math.round,CT=n.classes,AT=n.remove,RT=w.translate;function PT(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e){r.update("connection",e.connection,e.connectionGfx)}this.start=function(e,t,r,o){var a,s=t.waypoints,c=n.getGraphics(t);a={connection:t,bendpointIndex:r,insert:o,type:o||0!==r?o||r!==s.length-1?_T:ST:wT},i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:c,context:a}})},t.on("bendpoint.move.start",function(e){var t=e.context,i=t.connection,r=i.waypoints,o=r.slice(),a=t.insert,s=t.bendpointIndex;t.originalWaypoints=r,a&&o.splice(s,0,null),i.waypoints=o,t.draggerGfx=pT.addBendpoint(n.getLayer("overlays")),CT(t.draggerGfx).add("djs-dragging"),n.addMarker(i,ET)}),t.on("bendpoint.move.hover",function(e){var t=e.context;if(t.hover=e.hover,e.hover){n.addMarker(e.hover,xT);var i=t.allowed=o.allowed(t.type,t);i?(n.removeMarker(t.hover,bT),n.addMarker(t.hover,gT),t.target=t.hover):!1===i&&(n.removeMarker(t.hover,gT),n.addMarker(t.hover,bT),t.target=null)}}),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],function(e){var t=e.context.hover;t&&(n.removeMarker(t,xT),n.removeMarker(t,e.context.target?gT:bT))}),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},s&&(i.hover&&(r===wT&&(t=i.hover),r===ST&&(n=i.hover)),o.waypoints=s.getCroppedWaypoints(o,t,n)),RT(i.draggerGfx,e.x,e.y),c(e)}),t.on(["bendpoint.move.end","bendpoint.move.cancel"],function(e){var t=e.context,i=t.hover,r=t.connection;AT(t.draggerGfx),t.newWaypoints=r.waypoints.slice(),r.waypoints=t.originalWaypoints,n.removeMarker(r,ET),i&&(n.removeMarker(i,gT),n.removeMarker(i,bT))}),t.on("bendpoint.move.end",function(e){var t,n=e.context,i=n.newWaypoints,r=n.bendpointIndex,o=i[r],s=n.allowed;if(o.x=TT(o.x),o.y=TT(o.y),s&&n.type===wT)a.reconnectStart(n.connection,n.target,o);else if(s&&n.type===ST)a.reconnectEnd(n.connection,n.target,o);else{if(!1===s||n.type!==_T)return c(e),!1;t={bendpointMove:{insert:e.context.insert,bendpointIndex:r}},a.updateWaypoints(n.connection,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],i=e[r+1],0===Ya.pointDistance(t,i)||Ya.pointsOnLine(n,i,t)?e.splice(r,1):r++;return e}(i),t)}}),t.on("bendpoint.move.cancel",function(e){c(e)})}PT.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var MT=PT,kT=s.assign,BT=s.forEach,NT=s.isArray,DT=Math.abs,OT=Math.round,LT=10;function IT(e){function t(e,t){if(NT(e)){for(var n=e.length;n--;)if(DT(e[n]-t)<=LT)return e[n]}else{var i=t%(e=+e);if(i<LT)return t-i;if(i>e-LT)return t-i+e}return t}function n(e){if(e.width)return{x:OT(e.width/2+e.x),y:OT(e.height/2+e.y)}}e.on("connectionSegment.move.move",1500,function(e){var i,r,o=function(e){var t=e.snapPoints,i=e.connection,r=i.waypoints,o=e.segmentStart,a=e.segmentStartIndex,s=e.segmentEnd,c=e.segmentEndIndex,p=e.axis;if(t)return t;var l=[r[a-1],o,s,r[c+1]];return a<2&&l.unshift(n(i.source)),c>r.length-3&&l.unshift(n(i.target)),e.snapPoints=t={horizontal:[],vertical:[]},BT(l,function(e){e&&(e=e.original||e,"y"===p&&t.horizontal.push(e.y),"x"===p&&t.vertical.push(e.x))}),t}(e.context),a=e.x,s=e.y;if(o){var c=a-(i=t(o.vertical,a)),p=s-(r=t(o.horizontal,s));kT(e,{dx:e.dx-c,dy:e.dy-p,x:i,y:r})}}),e.on("bendpoint.move.move",1500,function(e){var i=e.context,r=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:[]},BT(r,function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))}),t}(i),o=i.target,a=o&&n(o),s=e.x,c=e.y;if(r){var p=s-t(a?r.vertical.concat([a.x]):r.vertical,s),l=c-t(a?r.horizontal.concat([a.y]):r.horizontal,c);kT(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l})}})}IT.$inject=["eventBus"];var jT=IT,zT=s.forEach,FT=Y.event,$T=Y.query,GT=Y.queryAll,WT=Ya.pointsAligned,HT=Ya.getMidPoint,VT=pT.BENDPOINT_CLS,qT=pT.SEGMENT_DRAGGER_CLS,UT=Yb.getApproxIntersection,YT=n.append,KT=n.attr,XT=n.classes,ZT=n.create,QT=n.remove,JT=w.translate;function eC(e,t,n,i,r){function o(e,n){var i=pT.toCanvasCoordinates(t,n);return UT(e,i)}function a(e,t){var n=t.waypoints,a=o(n,e);if(a)return!function(e,t,n){var i,r,o,a,s,c,p=e.index,l=e.point;return!(p<=0||e.bendpoint)&&(i=t[p-1],r=t[p],o=HT(i,r),a=WT(i,r),s=Math.abs(l.x-o.x),c=Math.abs(l.y-o.y),a&&s<=n&&c<=n)}(a,n,10)?i.start(e,t,a.index,!a.bendpoint):r.start(e,t,a.index),!0}function s(e,t,i){FT.bind(e,t,function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()})}function c(e,n){var i=t.getLayer("overlays"),r=$T(".djs-bendpoints[data-element-id="+e.id+"]",i);return!r&&n&&(r=ZT("g"),KT(r,{"data-element-id":e.id}),XT(r).add("djs-bendpoints"),YT(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}function p(e,t){t.waypoints.forEach(function(t,n){var i=pT.addBendpoint(e);YT(e,i),JT(i,t.x,t.y)}),pT.addBendpoint(e,"floating")}function l(e,t){for(var n,i,r=t.waypoints,o=1;o<r.length;o++)n=r[o-1],i=r[o],WT(n,i)&&pT.addSegmentDragger(e,n,i)}function u(e){var t=c(e);return t||(p(t=c(e,!0),e),l(t,e)),t}function h(e){var t=c(e);t&&(!function(e){zT(GT("."+qT,e),function(e){QT(e)})}(t),function(e){zT(GT("."+VT,e),function(e){QT(e)})}(t),l(t,e),p(t,e))}e.on("connection.changed",function(e){h(e.element)}),e.on("connection.remove",function(e){var t=c(e.element);t&&QT(t)}),e.on("element.marker.update",function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?XT(t).add(e.marker):XT(t).remove(e.marker))}),e.on("element.mousemove",function(e){var t,n,i,r=e.element,a=r.waypoints;if(a){if(t=c(r,!0),!(n=$T(".floating",t)))return;(i=o(a,e.originalEvent))&&JT(n,i.point.x,i.point.y)}}),e.on("element.mousedown",function(e){var t=e.originalEvent,n=e.element,i=n.waypoints;if(i)return a(t,n)}),e.on("selection.changed",function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)}),e.on("element.hover",function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))}),e.on("element.out",function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")}),e.on("element.updateId",function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=c(t);i&&KT(i,{"data-element-id":n})}}),this.addHandles=u,this.updateHandles=h,this.getBendpointsContainer=c}eC.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var tC=eC,nC="connect-hover",iC="djs-updating",rC=n.classes,oC=n.remove,aC=w.translate;function sC(e,t,n){return cC(e,t,e[t]+n)}function cC(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function pC(e){return"x"===e?"y":"x"}function lC(e,t,n){var i,r;return e.original?e.original:(i=Ps.getMid(t),cC(e,r=pC(n),i[r]))}function uC(e,t,n,i,r,o,a){var s=e.get("connectionDocking",!1);function c(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function p(e){r.update("connection",e.connection,e.connectionGfx)}function l(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return cC(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],pC(e.axis));aC(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,a,s,c=n.getGraphics(t),p=r-1,l=r,u=t.waypoints,h=u[p],d=u[l];(a=Ya.pointsAligned(h,d))&&(s="v"===a?"y":"x",0===p&&(h=lC(h,t.source,s)),l===u.length-1&&(d=lC(d,t.target,s)),o={connection:t,segmentStartIndex:p,segmentEndIndex:l,segmentStart:h,segmentEnd:d,axis:s},i.init(e,{x:(h.x+d.x)/2,y:(h.y+d.y)/2},"connectionSegment.move",{cursor:"x"===s?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",function(e){var t=e.context,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=pT.addSegmentDragger(r,t.segmentStart,t.segmentEnd),rC(t.draggerGfx).add("djs-dragging"),n.addMarker(i,iC)}),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,u=i.segmentEnd,h=i.axis,d=i.originalWaypoints.slice(),m=sC(s,h,e["d"+h]),f=sC(u,h,e["d"+h]),y=d.length,v=0;d[o]=m,d[a]=f,o<2&&(t=Ps.getOrientation(r.source,m),1===o?"intersect"===t&&(d.shift(),d[0]=m,v--):"intersect"!==t&&(d.unshift(s),v++)),a>y-3&&(n=Ps.getOrientation(r.target,f),a===y-2?"intersect"===n&&(d.pop(),d[d.length-1]=f):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=c(r,d),l(i,v,e),i.newSegmentStartIndex=o+v,p(e)}),t.on("connectionSegment.move.hover",function(e){e.context.hover=e.hover,n.addMarker(e.hover,nC)}),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],function(e){var t=e.context.hover;t&&n.removeMarker(t,nC)}),t.on("connectionSegment.move.cleanup",function(e){var t=e.context,i=t.connection;t.draggerGfx&&oC(t.draggerGfx),n.removeMarker(i,iC)}),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,p(e)}),t.on("connectionSegment.move.end",function(e){var t=e.context,n=t.connection,i=t.newWaypoints,r=t.newSegmentStartIndex,o=function(e,t){var n=0;return{waypoints:e.filter(function(i,r){return!Ya.pointsOnLine(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}),segmentOffset:n}}(i=i.map(function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}),r),s=c(n,o.waypoints),p=o.segmentOffset,l={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+p}};a.updateWaypoints(n,s,l)})}uC.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","rules","modeling"];var hC={__depends__:[ou,cu],__init__:["bendpoints","bendpointSnapping"],bendpoints:["type",tC],bendpointMove:["type",MT],connectionSegmentMove:["type",uC],bendpointSnapping:["type",jT]},dC=s.assign,mC=s.filter,fC=s.groupBy,yC=500,vC=1250,gC=1500,bC=go.getOriginal,xC=Math.round;function EC(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function a(e,n,i){if(!n.waypoints&&n.parent){var r=function(e){return{x:e.x+xC(e.width/2),y:e.y+xC(e.height/2)}}(n);return t.init(e,r,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:{}}}),!0}}e.on("shape.move.start",gC,function(e){var t,n,r=e.context,o=e.shape,a=i.get().slice();-1===a.indexOf(o)&&(a=[o]),n=fC(t=a,"id"),a=mC(t,function(e){for(;e=e.parent;)if(n[e.id])return!1;return!0}),dC(r,{shapes:a,validatedShapes:a,shape:o})}),e.on("shape.move.start",vC,function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1}),e.on("shape.move.move",yC,function(e){var t,n=e.context,i=n.validatedShapes,r=e.hover,a={x:e.dx,y:e.dy};t=o(i,a,{x:e.x,y:e.y},r),n.delta=a,n.canExecute=t,n.target=null!==t?r:null}),e.on("shape.move.end",function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,a=t.shapes;if(!r)return!1;i.x=xC(i.x),i.y=xC(i.y),n.moveElements(a,i,t.target,{primaryShape:t.shape,attach:o})}),e.on("element.mousedown",function(e){var t=bC(e);if(!t)throw new Error("must supply DOM mousedown event");return a(t,e.element)}),this.start=a}EC.$inject=["eventBus","dragging","modeling","selection","rules"];var _C=EC;var wC=s.flatten,SC=s.forEach,TC=s.filter,CC=s.find,AC=s.groupBy,RC=s.map,PC=s.matchPattern,MC=s.size,kC=n.append,BC=n.attr,NC=n.clear,DC=n.create,OC=w.translate,LC=499,IC="djs-dragging",jC="drop-ok",zC="drop-not-ok",FC="new-parent",$C="attach-ok";function GC(e,t,n,i,r){function o(e){return function(e){return TC(e,function(t){return!function(e){return e.waypoints}(t)||CC(e,PC({id:t.source.id}))&&CC(e,PC({id:t.target.id}))})}(a(e))}function a(e){var t=ui.selfAndAllChildren(e,!0),n=RC(t,function(e){return(e.incoming||[]).concat(e.outgoing||[])});return wC(t.concat(n),!0)}function s(e,t){[$C,jC,zC,FC].forEach(function(i){i===t?n.addMarker(e,i):n.removeMarker(e,i)})}e.on("shape.move.start",LC,function(e){var t=e.context,s=t.shapes,c=t.allDraggedElements,p=o(s);if(!t.dragGroup){var l=DC("g");BC(l,i.cls("djs-drag-group",["no-events"]));var u=n.getDefaultLayer();kC(u,l),t.dragGroup=l}p.forEach(function(e){r.addDragger(e,t.dragGroup)}),c=c?wC(c,a(s)):a(s),SC(c,function(e){n.addMarker(e,IC)}),t.allDraggedElements=c,t.differentParents=1!==MC(AC(s,function(e){return e.parent&&e.parent.id}))}),e.on("shape.move.move",LC,function(e){var t=e.context,n=t.dragGroup,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?s(i,$C):t.canExecute&&i&&i.id!==r.id?s(i,FC):s(i,t.canExecute?jC:zC)),OC(n,e.dx,e.dy)}),e.on(["shape.move.out","shape.move.cleanup"],function(e){var t=e.context.target;t&&s(t,null)}),e.on("shape.move.cleanup",function(e){var t=e.context,i=t.allDraggedElements,r=t.dragGroup;SC(i,function(e){n.removeMarker(e,IC)}),r&&NC(r)}),this.makeDraggable=function(e,t,i){r.addDragger(t,e.dragGroup),i&&n.addMarker(t,IC),e.allDraggedElements?e.allDraggedElements.push(t):e.allDraggedElements=[t]}}GC.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var WC={__depends__:[jo,aa,Uo,cu,ou,Yd],__init__:["move","movePreview"],move:["type",_C],movePreview:["type",GC]},HC=n.append,VC=n.attr,qC=n.create;function UC(e,t){var n=this;t.on("canvas.init",function(e){n.addBBoxMarker(e.svg)})}UC.$inject=["canvas","eventBus"];var YC=UC;UC.prototype.addBBoxMarker=function(e){var t={fill:"none",class:"outer-bound-marker"},n=qC("rect");VC(n,{x:-1e4,y:1e4,width:10,height:10}),VC(n,t),HC(e,n);var i=qC("rect");VC(i,{x:1e4,y:1e4,width:10,height:10}),VC(i,t),HC(e,i)};var KC={exports:{}};!function(e,t,n,i){"use strict";var r,o=["","webkit","Moz","MS","ms","o"],a=t.createElement("div"),s="function",c=Math.round,p=Math.abs,l=Date.now;function u(e,t,n){return setTimeout(g(e,n),t)}function h(e,t,n){return!!Array.isArray(e)&&(d(e,n[t],n),!0)}function d(e,t,n){var r;if(e)if(e.forEach)e.forEach(t,n);else if(e.length!==i)for(r=0;r<e.length;)t.call(n,e[r],r,e),r++;else for(r in e)e.hasOwnProperty(r)&&t.call(n,e[r],r,e)}function m(t,n,i){var r="DEPRECATED METHOD: "+n+"\n"+i+" AT \n";return function(){var n=new Error("get-stack-trace"),i=n&&n.stack?n.stack.replace(/^[^\(]+?[\n$]/gm,"").replace(/^\s+at\s+/gm,"").replace(/^Object.<anonymous>\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",o=e.console&&(e.console.warn||e.console.log);return o&&o.call(e.console,r,i),t.apply(this,arguments)}}r="function"!=typeof Object.assign?function(e){if(e===i||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;n<arguments.length;n++){var r=arguments[n];if(r!==i&&null!==r)for(var o in r)r.hasOwnProperty(o)&&(t[o]=r[o])}return t}:Object.assign;var f=m(function(e,t,n){for(var r=Object.keys(t),o=0;o<r.length;)(!n||n&&e[r[o]]===i)&&(e[r[o]]=t[r[o]]),o++;return e},"extend","Use `assign`."),y=m(function(e,t){return f(e,t,!0)},"merge","Use `assign`.");function v(e,t,n){var i,o=t.prototype;(i=e.prototype=Object.create(o)).constructor=e,i._super=o,n&&r(i,n)}function g(e,t){return function(){return e.apply(t,arguments)}}function b(e,t){return typeof e==s?e.apply(t&&t[0]||i,t):e}function x(e,t){return e===i?t:e}function E(e,t,n){d(T(t),function(t){e.addEventListener(t,n,!1)})}function _(e,t,n){d(T(t),function(t){e.removeEventListener(t,n,!1)})}function w(e,t){for(;e;){if(e==t)return!0;e=e.parentNode}return!1}function S(e,t){return e.indexOf(t)>-1}function T(e){return e.trim().split(/\s+/g)}function C(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,t,n){for(var i=[],r=[],o=0;o<e.length;){var a=t?e[o][t]:e[o];C(r,a)<0&&i.push(e[o]),r[o]=a,o++}return n&&(i=t?i.sort(function(e,n){return e[t]>n[t]}):i.sort()),i}function P(e,t){for(var n,r,a=t[0].toUpperCase()+t.slice(1),s=0;s<o.length;){if((r=(n=o[s])?n+a:t)in e)return r;s++}return i}var M=1;function k(t){var n=t.ownerDocument||t;return n.defaultView||n.parentWindow||e}var B="ontouchstart"in e,N=P(e,"PointerEvent")!==i,D=B&&/mobile|tablet|ip(ad|hone|od)|android/i.test(navigator.userAgent),O=25,L=1,I=2,j=4,z=8,F=1,$=2,G=4,W=8,H=16,V=$|G,q=W|H,U=V|q,Y=["x","y"],K=["clientX","clientY"];function X(e,t){var n=this;this.manager=e,this.callback=t,this.element=e.element,this.target=e.options.inputTarget,this.domHandler=function(t){b(e.options.enable,[e])&&n.handler(t)},this.init()}function Z(e,t,n){var r=n.pointers.length,o=n.changedPointers.length,a=t&L&&r-o==0,s=t&(j|z)&&r-o==0;n.isFirst=!!a,n.isFinal=!!s,a&&(e.session={}),n.eventType=t,function(e,t){var n=e.session,r=t.pointers,o=r.length;n.firstInput||(n.firstInput=Q(t));o>1&&!n.firstMultiple?n.firstMultiple=Q(t):1===o&&(n.firstMultiple=!1);var a=n.firstInput,s=n.firstMultiple,c=s?s.center:a.center,u=t.center=J(r);t.timeStamp=l(),t.deltaTime=t.timeStamp-a.timeStamp,t.angle=ie(c,u),t.distance=ne(c,u),function(e,t){var n=t.center,i=e.offsetDelta||{},r=e.prevDelta||{},o=e.prevInput||{};t.eventType!==L&&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 h=ee(t.deltaTime,t.deltaX,t.deltaY);t.overallVelocityX=h.x,t.overallVelocityY=h.y,t.overallVelocity=p(h.x)>p(h.y)?h.x:h.y,t.scale=s?(d=s.pointers,m=r,ne(m[0],m[1],K)/ne(d[0],d[1],K)):1,t.rotation=s?function(e,t){return ie(t[1],t[0],K)+ie(e[1],e[0],K)}(s.pointers,r):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,r,o,a,s=e.lastInterval||t,c=t.timeStamp-s.timeStamp;if(t.eventType!=z&&(c>O||s.velocity===i)){var l=t.deltaX-s.deltaX,u=t.deltaY-s.deltaY,h=ee(c,l,u);r=h.x,o=h.y,n=p(h.x)>p(h.y)?h.x:h.y,a=te(l,u),e.lastInterval=t}else n=s.velocity,r=s.velocityX,o=s.velocityY,a=s.direction;t.velocity=n,t.velocityX=r,t.velocityY=o,t.direction=a}(n,t);var d,m;var f=e.element;w(t.srcEvent.target,f)&&(f=t.srcEvent.target);t.target=f}(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:c(e.pointers[n].clientX),clientY:c(e.pointers[n].clientY)},n++;return{timeStamp:l(),pointers:t,center:J(t),deltaX:e.deltaX,deltaY:e.deltaY}}function J(e){var t=e.length;if(1===t)return{x:c(e[0].clientX),y:c(e[0].clientY)};for(var n=0,i=0,r=0;r<t;)n+=e[r].clientX,i+=e[r].clientY,r++;return{x:c(n/t),y:c(i/t)}}function ee(e,t,n){return{x:t/e||0,y:n/e||0}}function te(e,t){return e===t?F:p(e)>=p(t)?e<0?$:G:t<0?W:H}function ne(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return Math.sqrt(i*i+r*r)}function ie(e,t,n){n||(n=Y);var i=t[n[0]]-e[n[0]],r=t[n[1]]-e[n[1]];return 180*Math.atan2(r,i)/Math.PI}X.prototype={handler:function(){},init:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(k(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(k(this.element),this.evWin,this.domHandler)}};var re={mousedown:L,mousemove:I,mouseup:j},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}v(se,X,{handler:function(e){var t=re[e.type];t&L&&0===e.button&&(this.pressed=!0),t&I&&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:L,pointermove:I,pointerup:j,pointercancel:z,pointerout:z},pe={2:"touch",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=[]}e.MSPointerEvent&&!e.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),v(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="touch"==o,s=C(t,e.pointerId,"pointerId");r&L&&(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:L,touchmove:I,touchend:j,touchcancel:z},me="touchstart",fe="touchstart touchmove touchend touchcancel";function ye(){this.evTarget=me,this.evWin=fe,this.started=!1,X.apply(this,arguments)}v(ye,X,{handler:function(e){var t=de[e.type];if(t===L&&(this.started=!0),this.started){var n=function(e,t){var n=A(e.touches),i=A(e.changedTouches);t&(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:"touch",srcEvent:e})}}});var ve={touchstart:L,touchmove:I,touchend:j,touchcancel:z},ge="touchstart touchmove touchend touchcancel";function be(){this.evTarget=ge,this.targetIds={},X.apply(this,arguments)}v(be,X,{handler:function(e){var t=ve[e.type],n=function(e,t){var n=A(e.touches),i=this.targetIds;if(t&(L|I)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=A(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===L)for(r=0;r<o.length;)i[o[r].identifier]=!0,r++;r=0;for(;r<a.length;)i[a[r].identifier]&&s.push(a[r]),t&(j|z)&&delete i[a[r].identifier],r++;if(!s.length)return;return[R(o.concat(s),"identifier",!0),s]}.call(this,e,t);n&&this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:"touch",srcEvent:e})}});var xe=2500,Ee=25;function _e(){X.apply(this,arguments);var e=g(this.handler,this);this.touch=new be(this.manager,e),this.mouse=new se(this.manager,e),this.primaryTouch=null,this.lastTouches=[]}function we(e){var t=e.changedPointers[0];if(t.identifier===this.primaryTouch){var n={x:t.clientX,y:t.clientY};this.lastTouches.push(n);var i=this.lastTouches;setTimeout(function(){var e=i.indexOf(n);e>-1&&i.splice(e,1)},xe)}}v(_e,X,{handler:function(e,t,n){var i="touch"==n.pointerType,r="mouse"==n.pointerType;if(!(r&&n.sourceCapabilities&&n.sourceCapabilities.firesTouchEvents)){if(i)(function(e,t){e&L?(this.primaryTouch=t.changedPointers[0].identifier,we.call(this,t)):e&(j|z)&&we.call(this,t)}).call(this,t,n);else if(r&&function(e){for(var t=e.srcEvent.clientX,n=e.srcEvent.clientY,i=0;i<this.lastTouches.length;i++){var r=this.lastTouches[i],o=Math.abs(t-r.x),a=Math.abs(n-r.y);if(o<=Ee&&a<=Ee)return!0}return!1}.call(this,n))return;this.callback(e,t,n)}},destroy:function(){this.touch.destroy(),this.mouse.destroy()}});var Se=P(a.style,"touchAction"),Te=Se!==i,Ce="auto",Ae="manipulation",Re="none",Pe="pan-x",Me="pan-y",ke=function(){if(!Te)return!1;var t={},n=e.CSS&&e.CSS.supports;return["auto","manipulation","pan-y","pan-x","pan-x pan-y","none"].forEach(function(i){t[i]=!n||e.CSS.supports("touch-action",i)}),t}();function Be(e,t){this.manager=e,this.set(t)}Be.prototype={set:function(e){"compute"==e&&(e=this.compute()),Te&&this.manager.element.style&&ke[e]&&(this.manager.element.style[Se]=e),this.actions=e.toLowerCase().trim()},update:function(){this.set(this.manager.options.touchAction)},compute:function(){var e=[];return d(this.manager.recognizers,function(t){b(t.options.enable,[t])&&(e=e.concat(t.getTouchAction()))}),function(e){if(S(e,Re))return Re;var t=S(e,Pe),n=S(e,Me);if(t&&n)return Re;if(t||n)return t?Pe:Me;if(S(e,Ae))return Ae;return Ce}(e.join(" "))},preventDefaults:function(e){var t=e.srcEvent,n=e.offsetDirection;if(this.manager.session.prevented)t.preventDefault();else{var i=this.actions,r=S(i,Re)&&!ke[Re],o=S(i,Me)&&!ke[Me],a=S(i,Pe)&&!ke[Pe];if(r){var s=1===e.pointers.length,c=e.distance<2,p=e.deltaTime<250;if(s&&c&&p)return}if(!a||!o)return r||o&&n&V||a&&n&q?this.preventSrc(t):void 0}},preventSrc:function(e){this.manager.session.prevented=!0,e.preventDefault()}};var Ne=1,De=2,Oe=4,Le=8,Ie=Le,je=16;function ze(e){this.options=r({},this.defaults,e||{}),this.id=M++,this.manager=null,this.options.enable=x(this.options.enable,!0),this.state=Ne,this.simultaneous={},this.requireFail=[]}function Fe(e){return e&je?"cancel":e&Le?"end":e&Oe?"move":e&De?"start":""}function $e(e){return e==H?"down":e==W?"up":e==$?"left":e==G?"right":""}function Ge(e,t){var n=t.manager;return n?n.get(e):e}function We(){ze.apply(this,arguments)}function He(){We.apply(this,arguments),this.pX=null,this.pY=null}function Ve(){We.apply(this,arguments)}function qe(){ze.apply(this,arguments),this._timer=null,this._input=null}function Ue(){We.apply(this,arguments)}function Ye(){We.apply(this,arguments)}function Ke(){ze.apply(this,arguments),this.pTime=!1,this.pCenter=!1,this._timer=null,this._input=null,this.count=0}function Xe(e,t){return(t=t||{}).recognizers=x(t.recognizers,Xe.defaults.preset),new Ze(e,t)}ze.prototype={defaults:{},set:function(e){return r(this.options,e),this.manager&&this.manager.touchAction.update(),this},recognizeWith:function(e){if(h(e,"recognizeWith",this))return this;var t=this.simultaneous;return t[(e=Ge(e,this)).id]||(t[e.id]=e,e.recognizeWith(this)),this},dropRecognizeWith:function(e){return h(e,"dropRecognizeWith",this)?this:(e=Ge(e,this),delete this.simultaneous[e.id],this)},requireFailure:function(e){if(h(e,"requireFailure",this))return this;var t=this.requireFail;return-1===C(t,e=Ge(e,this))&&(t.push(e),e.requireFailure(this)),this},dropRequireFailure:function(e){if(h(e,"dropRequireFailure",this))return this;e=Ge(e,this);var t=C(this.requireFail,e);return t>-1&&this.requireFail.splice(t,1),this},hasRequireFailures:function(){return this.requireFail.length>0},canRecognizeWith:function(e){return!!this.simultaneous[e.id]},emit:function(e){var t=this,n=this.state;function i(n){t.manager.emit(n,e)}n<Le&&i(t.options.event+Fe(n)),i(t.options.event),e.additionalEvent&&i(e.additionalEvent),n>=Le&&i(t.options.event+Fe(n))},tryEmit:function(e){if(this.canEmit())return this.emit(e);this.state=32},canEmit:function(){for(var e=0;e<this.requireFail.length;){if(!(this.requireFail[e].state&(32|Ne)))return!1;e++}return!0},recognize:function(e){var t=r({},e);if(!b(this.options.enable,[this,t]))return this.reset(),void(this.state=32);this.state&(Ie|je|32)&&(this.state=Ne),this.state=this.process(t),this.state&(De|Oe|Le|je)&&this.tryEmit(t)},process:function(e){},getTouchAction:function(){},reset:function(){}},v(We,ze,{defaults:{pointers:1},attrTest:function(e){var t=this.options.pointers;return 0===t||e.pointers.length===t},process:function(e){var t=this.state,n=e.eventType,i=t&(De|Oe),r=this.attrTest(e);return i&&(n&z||!r)?t|je:i||r?n&j?t|Le:t&De?t|Oe:De:32}}),v(He,We,{defaults:{event:"pan",threshold:10,pointers:1,direction:U},getTouchAction:function(){var e=this.options.direction,t=[];return e&V&&t.push(Me),e&q&&t.push(Pe),t},directionTest:function(e){var t=this.options,n=!0,i=e.distance,r=e.direction,o=e.deltaX,a=e.deltaY;return r&t.direction||(t.direction&V?(r=0===o?F:o<0?$:G,n=o!=this.pX,i=Math.abs(e.deltaX)):(r=0===a?F:a<0?W:H,n=a!=this.pY,i=Math.abs(e.deltaY))),e.direction=r,n&&i>t.threshold&&r&t.direction},attrTest:function(e){return We.prototype.attrTest.call(this,e)&&(this.state&De||!(this.state&De)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=$e(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),v(Ve,We,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||this.state&De)},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)}}),v(qe,ze,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return[Ce]},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&L)this.reset(),this._timer=u(function(){this.state=Ie,this.tryEmit()},t.time,this);else if(e.eventType&j)return Ie;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){this.state===Ie&&(e&&e.eventType&j?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=l(),this.manager.emit(this.options.event,this._input)))}}),v(Ue,We,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Re]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||this.state&De)}}),v(Ye,We,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:V|q,pointers:1},getTouchAction:function(){return He.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(V|q)?t=e.overallVelocity:n&V?t=e.overallVelocityX:n&q&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&p(t)>this.options.velocity&&e.eventType&j},emit:function(e){var t=$e(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),v(Ke,ze,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[Ae]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distance<t.threshold,r=e.deltaTime<t.time;if(this.reset(),e.eventType&L&&0===this.count)return this.failTimeout();if(i&&r&&n){if(e.eventType!=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=u(function(){this.state=Ie,this.tryEmit()},t.interval,this),De):Ie}return 32},failTimeout:function(){return this._timer=u(function(){this.state=32},this.options.interval,this),32},reset:function(){clearTimeout(this._timer)},emit:function(){this.state==Ie&&(this._input.tapCount=this.count,this.manager.emit(this.options.event,this._input))}}),Xe.VERSION="2.0.7",Xe.defaults={domEvents:!1,touchAction:"compute",enable:!0,inputTarget:null,inputClass:null,preset:[[Ue,{enable:!1}],[Ve,{enable:!1},["rotate"]],[Ye,{direction:V}],[He,{direction:V},["swipe"]],[Ke],[Ke,{event:"doubletap",taps:2},["tap"]],[qe]],cssProps:{userSelect:"none",touchSelect:"none",touchCallout:"none",contentZooming:"none",userDrag:"none",tapHighlightColor:"rgba(0,0,0,0)"}};function Ze(e,t){var n;this.options=r({},Xe.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:D?be:B?_e:se))(n,Z),this.touchAction=new Be(this,this.options.touchAction),Qe(this,!0),d(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 Qe(e,t){var n,i=e.element;i.style&&(d(e.options.cssProps,function(r,o){n=P(i.style,o),t?(e.oldCssProps[n]=i.style[n],i.style[n]=r):i.style[n]=e.oldCssProps[n]||""}),t||(e.oldCssProps={}))}Ze.prototype={set:function(e){return r(this.options,e),e.touchAction&&this.touchAction.update(),e.inputTarget&&(this.input.destroy(),this.input.target=e.inputTarget,this.input.init()),this},stop:function(e){this.session.stopped=e?2:1},recognize:function(e){var t=this.session;if(!t.stopped){var n;this.touchAction.preventDefaults(e);var i=this.recognizers,r=t.curRecognizer;(!r||r&&r.state&Ie)&&(r=t.curRecognizer=null);for(var o=0;o<i.length;)n=i[o],2===t.stopped||r&&n!=r&&!n.canRecognizeWith(r)?n.reset():n.recognize(e),!r&&n.state&(De|Oe|Le)&&(r=t.curRecognizer=n),o++}},get:function(e){if(e instanceof ze)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(h(e,"add",this))return this;var t=this.get(e.options.event);return t&&this.remove(t),this.recognizers.push(e),e.manager=this,this.touchAction.update(),e},remove:function(e){if(h(e,"remove",this))return this;if(e=this.get(e)){var t=this.recognizers,n=C(t,e);-1!==n&&(t.splice(n,1),this.touchAction.update())}return this},on:function(e,t){if(e!==i&&t!==i){var n=this.handlers;return d(T(e),function(e){n[e]=n[e]||[],n[e].push(t)}),this}},off:function(e,t){if(e!==i){var n=this.handlers;return d(T(e),function(e){t?n[e]&&n[e].splice(C(n[e],t),1):delete n[e]}),this}},emit:function(e,n){this.options.domEvents&&function(e,n){var i=t.createEvent("Event");i.initEvent(e,!0,!0),i.gesture=n,n.target.dispatchEvent(i)}(e,n);var i=this.handlers[e]&&this.handlers[e].slice();if(i&&i.length){n.type=e,n.preventDefault=function(){n.srcEvent.preventDefault()};for(var r=0;r<i.length;)i[r](n),r++}},destroy:function(){this.element&&Qe(this,!1),this.handlers={},this.session={},this.input.destroy(),this.element=null}},r(Xe,{INPUT_START:L,INPUT_MOVE:I,INPUT_END:j,INPUT_CANCEL:z,STATE_POSSIBLE:Ne,STATE_BEGAN:De,STATE_CHANGED:Oe,STATE_ENDED:Le,STATE_RECOGNIZED:Ie,STATE_CANCELLED:je,STATE_FAILED:32,DIRECTION_NONE:F,DIRECTION_LEFT:$,DIRECTION_RIGHT:G,DIRECTION_UP:W,DIRECTION_DOWN:H,DIRECTION_HORIZONTAL:V,DIRECTION_VERTICAL:q,DIRECTION_ALL:U,Manager:Ze,Input:X,TouchAction:Be,TouchInput:be,MouseInput:se,PointerEventInput:he,TouchMouseInput:_e,SingleTouchInput:ye,Recognizer:ze,AttrRecognizer:We,Tap:Ke,Pan:He,Swipe:Ye,Pinch:Ve,Rotate:Ue,Press:qe,on:E,off:_,each:d,merge:y,extend:f,assign:r,inherit:v,bindFn:g,prefixed:P}),(void 0!==e?e:"undefined"!=typeof self?self:{}).Hammer=Xe,KC.exports?KC.exports=Xe:e.Hammer=Xe}(window,document),KC=KC.exports;var XC=s.forEach,ZC=Y.event,QC=Y.closest,JC=.2,eA=4,tA=["mousedown","mouseup","mouseover","mouseout","click","dblclick"];function nA(e,t){return t.get(e,!1)}function iA(e){e.preventDefault(),e.stopPropagation(),"function"==typeof e.stopImmediatePropagation&&e.stopImmediatePropagation()}function rA(e){function t(t){setTimeout(function(){XC(tA,function(t){ZC.unbind(e,t,iA,!0)})},500)}ZC.bind(e,"touchstart",function(t){XC(tA,function(t){ZC.bind(e,t,iA,!0)})},!0),ZC.bind(e,"touchend",t,!0),ZC.bind(e,"touchcancel",t,!0);var n=new KC.Manager(e,{inputClass:KC.TouchInput,recognizers:[]}),i=new KC.Tap,r=new KC.Pan({threshold:10}),o=new KC.Press,a=new KC.Pinch,s=new KC.Tap({event:"doubletap",taps:2});return a.requireFailure(r),a.requireFailure(o),n.add([r,o,a,s,i]),n.reset=function(e){var t=this.recognizers,i=this.session;i.stopped||(n.stop(e),setTimeout(function(){var e,n;for(e=0;n=t[e];e++)n.reset(),n.state=8;i.curRecognizer=null},0))},n.on("hammer.input",function(e){e.srcEvent.defaultPrevented&&n.reset(!0)}),n}function oA(e,t,n,i,r){var o,a=nA("dragging",e),s=nA("move",e),c=nA("contextPad",e),p=nA("palette",e);function l(e){return function(t){r.fire(e,t)}}function u(e){return QC(e,"svg, .djs-element",!0)}function h(e){function n(e){var n=u(e.target),r=n&&i.get(n);if(s&&t.getRootElement()!==r)return s.start(e,r,!0);!function(e){var n=0,i=0;function r(e){var r=e.deltaX-n,o=e.deltaY-i;t.scroll({dx:r,dy:o}),n=e.deltaX,i=e.deltaY}function a(e){o.off("panmove",r),o.off("panend",a),o.off("pancancel",a)}o.on("panmove",r),o.on("panend",a),o.on("pancancel",a)}()}(o=rA(e)).on("doubletap",l("element.dblclick")),o.on("tap",l("element.click")),o.on("panstart",n),o.on("press",n),o.on("pinchstart",function(e){var n=t.zoom(),i=e.center;function r(e){var r=1-(1-e.scale)/1.5,o=Math.max(JC,Math.min(eA,r*n));t.zoom(o,i),iA(e)}function a(e){o.off("pinchmove",r),o.off("pinchend",a),o.off("pinchcancel",a),o.reset(!0)}o.on("pinchmove",r),o.on("pinchend",a),o.on("pinchcancel",a)})}a&&n.on("drag.move",function(e){var t=e.originalEvent;if(t&&!(t instanceof MouseEvent)){var n=go.toPoint(t),r=u(document.elementFromPoint(n.x,n.y)),o=r&&i.get(r);o!==e.hover&&(e.hover&&a.out(e),o&&(a.hover({element:o,gfx:r}),e.hover=o,e.hoverGfx=r))}}),c&&n.on("contextPad.create",function(e){var t=rA(e.pad.html);t.on("panstart",function(e){c.trigger("dragstart",e,!0)}),t.on("press",function(e){c.trigger("dragstart",e,!0)}),t.on("tap",function(e){c.trigger("click",e)})}),p&&n.on("palette.create",function(e){var t=rA(e.container);t.on("panstart",function(e){p.trigger("dragstart",e,!0)}),t.on("press",function(e){p.trigger("dragstart",e,!0)}),t.on("tap",function(e){p.trigger("click",e)})}),n.on("canvas.init",function(e){h(e.svg)})}oA.$inject=["injector","canvas","eventBus","elementRegistry","interactionEvents","touchFix"];var aA={__depends__:[{__depends__:[jo],__init__:["touchInteractionEvents"],touchInteractionEvents:["type",oA],touchFix:["type",YC]}]},sA={};function cA(e){ga.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 U(cA,ga),(sA=cA).Viewer=ga,sA.NavigatedViewer=Ua,cA.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)},cA.prototype._createModdle=function(e){var t=ga.prototype._createModdle.call(this,e);return t.ids=new q([32,36,1]),t},cA.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},cA.prototype._interactionModules=[ka,aA,Va],cA.prototype._modelingModules=[cT,hC,WC,wf,Fc,hc,bm,Ou,Rm,Sf,Hw,sS,mS,iT],cA.prototype._modules=[].concat(cA.prototype._modules,cA.prototype._interactionModules,cA.prototype._modelingModules),sA});