/*! bpmn-js - bpmn-modeler v4.0.4 | Copyright (c) 2014-present, camunda Services GmbH | bpmn.io/license */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).BpmnJS=t()}(this,function(){"use strict";var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function e(e,t){return e(t={exports:{}},t.exports),t.exports}var t=e(function(e){"function"==typeof Object.create?e.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:e.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}});var n,r=(function(e){var c=e.exports=function(e,t){if(t||(t=16),void 0===e&&(e=128),e<=0)return"0";for(var n=Math.log(Math.pow(2,e))/Math.log(t),i=2;n===1/0;i*=2)n=Math.log(Math.pow(2,e/i))/Math.log(t)*i;var r=n-Math.floor(n),o="";for(i=0;i=Math.pow(2,e)?c(e,t):o};c.rack=function(i,r,o){var n=function(e){var t=0;do{if(10
a',ce=!J.getElementsByTagName("link").length,J=void 0);var pe={legend:[1,"
","
"],tr:[2,"","
"],col:[2,"","
"],_default:ce?[1,"X
","
"]:[0,"",""]};pe.td=pe.th=[3,"","
"],pe.option=pe.optgroup=[1,'"],pe.thead=pe.tbody=pe.colgroup=pe.caption=pe.tfoot=[1,"","
"],pe.polyline=pe.ellipse=pe.polygon=pe.circle=pe.text=pe.line=pe.path=pe.rect=pe.g=[1,'',""];var le="undefined"!=typeof Element?Element.prototype:{},ue=le.matches||le.matchesSelector||le.webkitMatchesSelector||le.mozMatchesSelector||le.msMatchesSelector||le.oMatchesSelector,he=function(e,t){if(!e||1!==e.nodeType)return!1;if(ue)return ue.call(e,t);for(var n=e.parentNode.querySelectorAll(t),i=0;i"+e+"",t=!0);var n,i,r=(n=e,(i=new DOMParser).async=!1,i.parseFromString(n,"text/xml"));if(!t)return r;for(var o=document.createDocumentFragment(),a=r.firstChild;a.firstChild;)o.appendChild(a.firstChild);return o}function Ne(e,t){var n;return n="<"===e.charAt(0)?(n=Be(e).firstChild,document.importNode(n,!0)):document.createElementNS(Me.svg,e),t&&_e(n,t),n}var Oe=Ne("svg");function Le(e,t){var n,i,r=Object.keys(t);for(n=0;i=r[n];n++)e[i]=t[i];return e}function je(e){return e?Oe.createSVGTransformFromMatrix(e):Oe.createSVGTransform()}var Ie=/([&<>]{1})/g,ze=/([\n\r"]{1})/g,Fe={"&":"&","<":"<",">":">",'"':"'"};function $e(e,t){return e.replace(t,function(e,t){return Fe[t]||t})}function Ge(e,t){var n,i,r,o,a;switch(e.nodeType){case 3:t.push($e(e.textContent,Ie));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(n=0,i=(r=e.attributes).length;n"),n=0,i=(a=e.childNodes).length;n")}else t.push("/>");break;case 8:t.push("\x3c!--",$e(e.nodeValue,Ie),"--\x3e");break;case 4:t.push("");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function He(e,t){var n=Be(t);if(Pe(e),t){"#document-fragment"!==n.nodeName&&(n=n.documentElement);for(var i,r=(i=n.childNodes,Array.prototype.slice.call(i)),o=0;o ");return a.length=0,new Error(t?e+" (Resolving: "+t+")":e)},n=function e(t,n){if(!h[t]&&-1!==t.indexOf(".")){for(var i=t.split("."),r=e(i.shift());i.length;)r=r[i.shift()];return r}if(nt(s,t))return s[t];if(nt(h,t)){if(-1!==a.indexOf(t))throw a.push(t),c("Cannot resolve circular dependency!");return a.push(t),s[t]=h[t][0](h[t][1]),a.pop(),s[t]}return o.get(t,n)},p=function(e){var t=1 already created at index <"+t+">");return n.group},St.prototype._createLayer=function(e,n){n||(n=0);var t=x(this._layers,function(e,t){return n>=t.index&&e++,e},0);return{group:Et(this._viewport,"layer-"+e,t),index:n}},St.prototype.getContainer=function(){return this._container},St.prototype._updateMarker=function(e,t,n){var i;e.id||(e=this._elementRegistry.get(e)),(i=this._elementRegistry._elements[e.id])&&(M([i.gfx,i.secondaryGfx],function(e){e&&(n?Te(e).add(t):Te(e).remove(t))}),this._eventBus.fire("element.marker.update",{element:e,gfx:i.gfx,marker:t,add:!!n}))},St.prototype.addMarker=function(e,t){this._updateMarker(e,t,!0)},St.prototype.removeMarker=function(e,t){this._updateMarker(e,t,!1)},St.prototype.hasMarker=function(e,t){return e.id||(e=this._elementRegistry.get(e)),Te(this.getGraphics(e)).has(t)},St.prototype.toggleMarker=function(e,t){this.hasMarker(e,t)?this.removeMarker(e,t):this.addMarker(e,t)},St.prototype.getRootElement=function(){return this._rootElement||this.setRootElement({id:"__implicitroot",children:[]}),this._rootElement},St.prototype.setRootElement=function(e,t){e&&this._ensureValid("root",e);var n=this._rootElement,i=this._elementRegistry,r=this._eventBus;if(n){if(!t)throw new Error("rootElement already set, need to specify override");r.fire("root.remove",{element:n}),r.fire("root.removed",{element:n}),i.remove(n)}if(e){var o=this.getDefaultLayer();r.fire("root.add",{element:e}),i.add(e,o,this._svg),r.fire("root.added",{element:e,gfx:o})}return this._rootElement=e},St.prototype._ensureValid=function(e,t){if(!t.id)throw new Error("element must have an id");if(this._elementRegistry.get(t.id))throw new Error("element with id "+t.id+" already exists");var n=wt[e];if(!y(n,function(e){return void 0!==t[e]}))throw new Error("must supply { "+n.join(", ")+" } with "+e)},St.prototype._setParent=function(e,t,n){gt(t.children,e,n),e.parent=t},St.prototype._addElement=function(e,t,n,i){n=n||this.getRootElement();var r=this._eventBus,o=this._graphicsFactory;this._ensureValid(e,t),r.fire(e+".add",{element:t,parent:n}),this._setParent(t,n,i);var a=o.create(e,t,i);return this._elementRegistry.add(t,a),o.update(e,t,a),r.fire(e+".added",{element:t,gfx:a}),t},St.prototype.addShape=function(e,t,n){return this._addElement("shape",e,t,n)},St.prototype.addConnection=function(e,t,n){return this._addElement("connection",e,t,n)},St.prototype._removeElement=function(e,t){var n=this._elementRegistry,i=this._graphicsFactory,r=this._eventBus;if(e=n.get(e.id||e))return r.fire(t+".remove",{element:e}),i.remove(e),vt(e.parent&&e.parent.children,e),e.parent=null,r.fire(t+".removed",{element:e}),n.remove(e),e},St.prototype.removeShape=function(e){return this._removeElement(e,"shape")},St.prototype.removeConnection=function(e){return this._removeElement(e,"connection")},St.prototype.getGraphics=function(e,t){return this._elementRegistry.getGraphics(e,t)},St.prototype._changeViewbox=function(e){this._eventBus.fire("canvas.viewbox.changing"),e.apply(this),this._cachedViewbox=null,this._viewboxChanged()},St.prototype._viewboxChanged=function(){this._eventBus.fire("canvas.viewbox.changed",{viewbox:this.viewbox()})},St.prototype.viewbox=function(t){if(void 0===t&&this._cachedViewbox)return this._cachedViewbox;var e,n,i,r,o,a,s=this._viewport,c=this.getSize();return t?(this._changeViewbox(function(){r=Math.min(c.width/t.width,c.height/t.height);var e=this._svg.createSVGMatrix().scale(r).translate(-t.x,-t.y);We(s,e)}),t):(e=this.getDefaultLayer().getBBox(),n=(i=We(s))?i.matrix:function(e,t,n,i,r,o){var a=Oe.createSVGMatrix();switch(arguments.length){case 0:return a;case 1:return Le(a,e);case 6:return Le(a,{a:e,b:t,c:n,d:i,e:r,f:o})}}(),r=xt(n.a,1e3),o=xt(-n.e||0,1e3),a=xt(-n.f||0,1e3),t=this._cachedViewbox={x:o?o/r:0,y:a?a/r:0,width:c.width/r,height:c.height/r,scale:r,inner:{width:e.width,height:e.height,x:e.x,y:e.y},outer:c})},St.prototype.scroll=function(e){var t=this._viewport,n=t.getCTM();return e&&this._changeViewbox(function(){e=F({dx:0,dy:0},e||{}),n=this._svg.createSVGMatrix().translate(e.dx,e.dy).multiply(n),Ct(t,n)}),{x:n.e,y:n.f}},St.prototype.zoom=function(e,t){return e?"fit-viewport"===e?this._fitViewport(t):(this._changeViewbox(function(){"object"!=typeof t&&(n=this.viewbox().outer,t={x:n.width/2,y:n.height/2}),i=this._setZoom(e,t)}),xt(i.a,1e3)):this.viewbox(e).scale;var n,i},St.prototype._fitViewport=function(e){var t,n,i=this.viewbox(),r=i.outer,o=i.inner;return n=0<=o.x&&0<=o.y&&o.x+o.width<=r.width&&o.y+o.height<=r.height&&!e?{x:0,y:0,width:Math.max(o.width+o.x,r.width),height:Math.max(o.height+o.y,r.height)}:(t=Math.min(1,r.width/o.width,r.height/o.height),{x:o.x+(e?o.width/2-r.width/t/2:0),y:o.y+(e?o.height/2-r.height/t/2:0),width:r.width/t,height:r.height/t}),this.viewbox(n),this.viewbox(!1).scale},St.prototype._setZoom=function(e,t){var n,i,r,o,a=this._svg,s=this._viewport,c=a.createSVGMatrix(),p=a.createSVGPoint(),l=(i=s.getCTM()).a;return o=t?(n=F(p,t).matrixTransform(i.inverse()),r=c.translate(n.x,n.y).scale(1/l*e).translate(-n.x,-n.y),i.multiply(r)):c.scale(e),Ct(this._viewport,o),o},St.prototype.getSize=function(){return{width:this._container.clientWidth,height:this._container.clientHeight}},St.prototype.getAbsoluteBBox=function(e){var t,n=this.viewbox();e.waypoints?t=this.getGraphics(e).getBBox():t=e;return{x:t.x*n.scale-n.x*n.scale,y:t.y*n.scale-n.y*n.scale,width:t.width*n.scale,height:t.height*n.scale}},St.prototype.resized=function(){delete this._cachedViewbox,this._eventBus.fire("canvas.resized")};var Tt="data-element-id";function Rt(e){this._elements={},this._eventBus=e}Rt.$inject=["eventBus"],Rt.prototype.add=function(e,t,n){var i=e.id;this._validateId(i),_e(t,Tt,i),n&&_e(n,Tt,i),this._elements[i]={element:e,gfx:t,secondaryGfx:n}},Rt.prototype.remove=function(e){var t=this._elements,n=e.id||e,i=n&&t[n];i&&(_e(i.gfx,Tt,""),i.secondaryGfx&&_e(i.secondaryGfx,Tt,""),delete t[n])},Rt.prototype.updateId=function(e,t){this._validateId(t),"string"==typeof e&&(e=this.get(e)),this._eventBus.fire("element.updateId",{element:e,newId:t});var n=this.getGraphics(e),i=this.getGraphics(e,!0);this.remove(e),e.id=t,this.add(e,n,i)},Rt.prototype.get=function(e){var t;t="string"==typeof e?e:e&&_e(e,Tt);var n=this._elements[t];return n&&n.element},Rt.prototype.filter=function(n){var i=[];return this.forEach(function(e,t){n(e,t)&&i.push(e)}),i},Rt.prototype.getAll=function(){return this.filter(function(e){return e})},Rt.prototype.forEach=function(r){var o=this._elements;Object.keys(o).forEach(function(e){var t=o[e],n=t.element,i=t.gfx;return r(n,i)})},Rt.prototype.getGraphics=function(e,t){var n=e.id||e,i=this._elements[n];return i&&(t?i.secondaryGfx:i.gfx)},Rt.prototype._validateId=function(e){if(!e)throw new Error("element must have an id");if(this._elements[e])throw new Error("element with id "+e+" already added")};var At={extend:function(e,i,t,r){var o=t.inverse;return Object.defineProperty(e,"remove",{value:function(e){var t=this.indexOf(e);return-1!==t&&(this.splice(t,1),i.unset(e,o,r)),e}}),Object.defineProperty(e,"contains",{value:function(e){return-1!==this.indexOf(e)}}),Object.defineProperty(e,"add",{value:function(e,t){var n=this.indexOf(e);if(void 0===t){if(-1!==n)return;t=this.length}-1!==n&&this.splice(n,1),this.splice(t,0,e),-1===n&&i.set(e,o,r)}}),Object.defineProperty(e,"__refs_collection",{value:!0}),e},isExtended:function(e){return!0===e.__refs_collection}};function Pt(t,n,i){var e=At.extend(i[n.name]||[],t,n,i);Object.defineProperty(i,n.name,{enumerable:n.enumerable,value:e}),e.length&&e.forEach(function(e){t.set(e,n.inverse,i)})}function kt(e,t){if(!(this instanceof kt))return new kt(e,t);(e.inverse=t).inverse=e,this.props={},this.props[e.name]=e,this.props[t.name]=t}kt.prototype.bind=function(e,t){if("string"==typeof t){if(!this.props[t])throw new Error("no property <"+t+"> in ref");t=this.props[t]}var n,i,r,o,a;t.collection?Pt(this,t,e):(n=this,r=e,o=(i=t).inverse,a=r[i.name],Object.defineProperty(r,i.name,{configurable:i.configurable,enumerable:i.enumerable,get:function(){return a},set:function(e){if(e!==a){var t=a;a=null,t&&n.unset(t,o,r),a=e,n.set(a,o,r)}}}))},kt.prototype.ensureRefsCollection=function(e,t){var n=e[t.name];return At.isExtended(n)||Pt(this,t,e),n},kt.prototype.ensureBound=function(e,t){var n,i;n=e,i=t,Object.prototype.hasOwnProperty.call(n,i.name||i)||this.bind(e,t)},kt.prototype.unset=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).remove(n):e[t.name]=void 0)},kt.prototype.set=function(e,t,n){e&&(this.ensureBound(e,t),t.collection?this.ensureRefsCollection(e,t).add(n):e[t.name]=n)};var Mt=kt,Dt=At;Mt.Collection=Dt;var Bt=new Mt({name:"children",enumerable:!0,collection:!0},{name:"parent"}),Nt=new Mt({name:"labels",enumerable:!0,collection:!0},{name:"labelTarget"}),Ot=new Mt({name:"attachers",collection:!0},{name:"host"}),Lt=new Mt({name:"outgoing",collection:!0},{name:"source"}),jt=new Mt({name:"incoming",collection:!0},{name:"target"});function It(){Object.defineProperty(this,"businessObject",{writable:!0}),Object.defineProperty(this,"label",{get:function(){return this.labels[0]},set:function(e){var t=this.label,n=this.labels;!e&&t?n.remove(t):n.add(e,0)}}),Bt.bind(this,"parent"),Nt.bind(this,"labels"),Lt.bind(this,"outgoing"),jt.bind(this,"incoming")}function zt(){It.call(this),Bt.bind(this,"children"),Ot.bind(this,"host"),Ot.bind(this,"attachers")}function Ft(){zt.call(this)}function $t(){zt.call(this),Nt.bind(this,"labelTarget")}function Gt(){It.call(this),Lt.bind(this,"source"),jt.bind(this,"target")}t(zt,It),t(Ft,zt),t($t,zt),t(Gt,It);var Ht={connection:Gt,shape:zt,label:$t,root:Ft};function Vt(){this._uid=12}Vt.prototype.createRoot=function(e){return this.create("root",e)},Vt.prototype.createLabel=function(e){return this.create("label",e)},Vt.prototype.createShape=function(e){return this.create("shape",e)},Vt.prototype.createConnection=function(e){return this.create("connection",e)},Vt.prototype.create=function(e,t){return(t=F({},t||{})).id||(t.id=e+"_"+this._uid++),function(e,t){var n=Ht[e];if(!n)throw new Error("unknown type: <"+e+">");return F(new n,t)}(e,t)};var Wt="__fn",Ut=Array.prototype.slice;function qt(){this._listeners={},this.on("diagram.destroy",1,this._destroy,this)}function Yt(){}function Kt(e){return de(".djs-visual",e)}function Xt(e,t,n,i,r){var o=je();o.setTranslate(t,n);var a=je();a.setRotate(i,0,0);var s=je();s.setScale(r||1,r||1),We(e,[o,a,s])}function Zt(e,t,n){var i=je();i.setTranslate(t,n),We(e,i)}function Qt(e,t){var n=je();n.setRotate(t,0,0),We(e,n)}function Jt(e,t){this._eventBus=e,this._elementRegistry=t}function en(e,t,n){var i=n||t.firstChild;e!==i&&t.insertBefore(e,i)}qt.prototype.on=function(e,t,n,i){if(e=g(e)?e:[e],u(t)&&(i=n,n=t,t=1e3),!l(t))throw new Error("priority must be a number");var r=n;i&&((r=I(n,i))[Wt]=n[Wt]||n);var o=this;e.forEach(function(e){o._addListener(e,{priority:t,callback:r,next:null})})},qt.prototype.once=function(t,e,n,i){var r=this;if(u(e)&&(i=n,n=e,e=1e3),!l(e))throw new Error("priority must be a number");function o(){var e=n.apply(i,arguments);return r.off(t,o),e}o[Wt]=n,this.on(t,e,o)},qt.prototype.off=function(e,t){e=g(e)?e:[e];var n=this;e.forEach(function(e){n._removeListener(e,t)})},qt.prototype.createEvent=function(e){var t=new Yt;return t.init(e),t},qt.prototype.fire=function(e,t){var n,i,r,o;if(o=Ut.call(arguments),"object"==typeof e&&(e=(n=e).type),!e)throw new Error("no event type specified");if(i=this._listeners[e]){n=t instanceof Yt?t:this.createEvent(t);var a=(o[0]=n).type;e!==a&&(n.type=e);try{r=this._invokeListeners(n,o,i)}finally{e!==a&&(n.type=a)}return void 0===r&&n.defaultPrevented&&(r=!1),r}},qt.prototype.handleError=function(e){return!1===this.fire("error",{error:e})},qt.prototype._destroy=function(){this._listeners={}},qt.prototype._invokeListeners=function(e,t,n){for(var i;n&&!e.cancelBubble;)i=this._invokeListener(e,t,n),n=n.next;return i},qt.prototype._invokeListener=function(e,t,n){var i,r,o;try{r=n.callback,o=t,void 0!==(i=r.apply(null,o))&&(e.returnValue=i,e.stopPropagation()),!1===i&&e.preventDefault()}catch(e){if(!this.handleError(e))throw console.error("unhandled error in event listener"),console.error(e.stack),e}return i},qt.prototype._addListener=function(e,t){var n,i=this._getListeners(e);if(i){for(;i;){if(i.priority or , got "+e);n=r[1],i=r[0]}return{name:e=(i?i+":":"")+n,prefix:i,localName:n}}function dn(e){this.ns=e,this.name=e.name,this.allTypes=[],this.allTypesByName={},this.properties=[],this.propertiesByName={}}function mn(e,t){this.packageMap={},this.typeMap={},this.packages=[],this.properties=t,M(e,I(this.registerPackage,this))}function fn(e,t,n){var i=t[n];if(i in e)throw new Error("package with "+n+" <"+i+"> already defined")}function yn(e){this.model=e}function vn(e,t,n){Object.defineProperty(e,t.name,{enumerable:!t.isReference,writable:!0,value:n,configurable:!0})}function gn(e){this.properties=new yn(this),this.factory=new an(this,this.properties),this.registry=new mn(e,this.properties),this.typeCache={}}dn.prototype.build=function(){return $(this,["ns","name","allTypes","allTypesByName","properties","propertiesByName","bodyProperty","idProperty"])},dn.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)},dn.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},dn.prototype.redefineProperty=function(e,t,n){var i=e.ns.prefix,r=t.split("#"),o=hn(r[0],i),a=hn(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},dn.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},dn.prototype.removeNamedProperty=function(e){var t=e.ns,n=this.propertiesByName;delete n[t.name],delete n[t.localName]},dn.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},dn.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},dn.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")},dn.prototype.hasProperty=function(e){return this.propertiesByName[e]},dn.prototype.addTrait=function(i,r){var e=this.allTypesByName,t=this.allTypes,n=i.name;n in e||(M(i.properties,I(function(e){e=F({},e,{name:e.ns.localName,inherited:r}),Object.defineProperty(e,"definedBy",{value:i});var t=e.replaces,n=e.redefines;t||n?this.redefineProperty(e,t||n,t):(e.isBody&&this.setBodyProperty(e),e.isId&&this.setIdProperty(e),this.addProperty(e))},this)),t.push(i),e[n]=i)},mn.prototype.getPackage=function(e){return this.packageMap[e]},mn.prototype.getPackages=function(){return this.packages},mn.prototype.registerPackage=function(t){t=F({},t);var e=this.packageMap;fn(e,t,"prefix"),fn(e,t,"uri"),M(t.types,I(function(e){this.registerType(e,t)},this)),e[t.uri]=e[t.prefix]=t,this.packages.push(t)},mn.prototype.registerType=function(e,t){var i=hn((e=F({},e,{superClass:(e.superClass||[]).slice(),extends:(e.extends||[]).slice(),properties:(e.properties||[]).slice(),meta:F(e.meta||{})})).name,t.prefix),n=i.name,r={};M(e.properties,I(function(e){var t=hn(e.name,i.prefix),n=t.name;ln(e.type)||(e.type=hn(e.type,t.prefix).name),F(e,{ns:t,name:n}),r[n]=e},this)),F(e,{ns:i,name:n,propertiesByName:r}),M(e.extends,I(function(e){var t=this.typeMap[e];t.traits=t.traits||[],t.traits.push(n)},this)),this.definePackage(e,t),this.typeMap[n]=e},mn.prototype.mapTypes=function(i,r,e){var t=ln(i.name)?{name:i.name}:this.typeMap[i.name],o=this;function n(e){return a(e,!0)}function a(e,t){var n=hn(e,ln(e)?"":i.prefix);o.mapTypes(n,r,t)}if(!t)throw new Error("unknown type <"+i.name+">");M(t.superClass,e?n:a),r(t,!e),M(t.traits,n)},mn.prototype.getEffectiveDescriptor=function(e){var t=hn(e),n=new dn(t);this.mapTypes(t,function(e,t){n.addTrait(e,t)});var i=n.build();return this.definePackage(i,i.allTypes[i.allTypes.length-1].$pkg),i},mn.prototype.definePackage=function(e,t){this.properties.define(e,"$pkg",{value:t})},yn.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:vn(e,i,n):e.$attrs[t]=n},yn.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&&vn(e,n,[]),e[i]},yn.prototype.define=function(e,t,n){Object.defineProperty(e,t,n)},yn.prototype.defineDescriptor=function(e,t){this.define(e,"$descriptor",{value:t})},yn.prototype.defineModel=function(e,t){this.define(e,"$model",{value:t})},gn.prototype.create=function(e,t){var n=this.getType(e);if(!n)throw new Error("unknown type <"+e+">");return new n(t)},gn.prototype.getType=function(e){var t=this.typeCache,n=d(e)?e:e.ns.name,i=t[n];return i||(e=this.registry.getEffectiveDescriptor(n),i=t[n]=this.factory.createType(e)),i},gn.prototype.createAny=function(e,t,n){var i=hn(e),r={$type:e,$instanceOf:function(e){return e===this.$type}},o={name:e,isGeneric:!0,ns:{prefix:i.prefix,localName:i.localName,uri:t}};return this.properties.defineDescriptor(r,o),this.properties.defineModel(r,this),this.properties.define(r,"$parent",{enumerable:!1,writable:!0}),M(n,function(e,t){P(e)&&void 0!==e.value?r[e.name]=e.value:r[t]=e}),r},gn.prototype.getPackage=function(e){return this.registry.getPackage(e)},gn.prototype.getPackages=function(){return this.registry.getPackages()},gn.prototype.getElementDescriptor=function(e){return e.$descriptor},gn.prototype.hasType=function(e,t){return void 0===t&&(t=e,e=this),t in e.$model.getElementDescriptor(e).allTypesByName},gn.prototype.getPropertyDescriptor=function(e,t){return this.getElementDescriptor(e).propertiesByName[t]},gn.prototype.getTypeDescriptor=function(e){return this.registry.typeMap[e]};var bn=String.fromCharCode,xn=Object.prototype.hasOwnProperty,_n=/&#(\d+);|&#x([0-9a-f]+);|&(\w+);/gi,En={amp:"&",apos:"'",gt:">",lt:"<",quot:'"'};function wn(e,t,n,i){return i?xn.call(En,i)?En[i]:"&"+i+";":bn(t||parseInt(n,16))}function Sn(e){return 3"}function Mn(e){return{get:e,enumerable:!0}}function Dn(e){var t,n={};for(t in e)n[t]=e[t];return n}function Bn(e){return e+"$uri"}function Nn(){return{line:0,column:0}}function On(e){throw e}function Ln(e){if(!this)return new Ln(e);var v,w,S,C,n,T,R,A,P,k=e&&e.proxy,i=On,M=Nn,D=!1,B=!1,t=null,N=!1;function O(e){e instanceof Error||(e=Pn(e)),i(t=e,M)}function L(e){n&&(e instanceof Error||(e=Pn(e)),n(e,M))}this.on=function(e,t){if("function"!=typeof t)throw Pn("required args ");switch(e){case"openTag":w=t;break;case"text":v=t;break;case"closeTag":S=t;break;case"error":i=t;break;case"warn":n=t;break;case"cdata":C=t;break;case"attention":A=t;break;case"question":R=t;break;case"comment":T=t;break;default:throw Pn("unsupported event: "+e)}return this},this.ns=function(e){if(void 0===e&&(e={}),"object"!=typeof e)throw Pn("required args ");var t,n={};for(t in e)n[t]=e[t];return n[Cn]=Tn,B=!0,P=n,this},this.parse=function(e){if("string"!=typeof e)throw Pn("required args ");return t=null,function(a){var e,t,n,i,r,o,s,c,p,g,l=B?[]:null,b=B?function(e){var t,n,i={};for(t in e)i[n=e[t]]=n,i[Bn(n)]=t;return i}(P):null,u=[],x=0,h=!1,d=!1,m=0,f=0,_="",E=0;function y(){if(null!==g)return g;var e,t,n,i,r,o,a,s,c,p,l,u=B&&b.xmlns,h=B&&D?[]:null,d=E,m=_,f=m.length,y={},v={};e:for(;d already defined");else if(v[s]=!0,B)if(D){if(null!==(r="xmlns"===s?"xmlns":120===s.charCodeAt(0)&&"xmlns:"===s.substr(0,6)?s.substr(6):null)){if(e=Sn(o),t=Bn(r),!(a=P[e])){if("xmlns"===r||t in b&&b[t]!==e)for(;a="ns"+x++,void 0!==b[a];);else a=r;P[e]=a}b[r]!==a&&(i||(b=Dn(b),i=!0),b[r]=a,"xmlns"===r&&(b[Bn(a)]=e,u=a),b[t]=e),y[s]=o;continue}h.push(s,o)}else-1!==(p=s.indexOf(":"))?(n=b[s.substring(0,p)])?((s=u===n?s.substr(p+1):n+s.substr(p))===Rn&&(o=-1!==(p=o.indexOf(":"))?(n=o.substring(0,p),(n=b[n]||n)+o.substring(p)):u+":"+o),y[s]=o):L(kn(s.substring(0,p))):y[s]=o;else y[s]=o}if(D)for(d=0,f=h.length;d",m+1)))return O("unclosed tag");if(g={},47===r){if(d=!(h=!1),!u.length)return O("missing open tag");if(t=s=u.pop(),i=m+2+t.length,a.substring(m+2,i)!==t)return O("closing tag mismatch");for(;i");s=s.substr(r+1)}else o=b.xmlns;o&&(s=o+":"+s)}if(h&&(E=i,_=t,w&&(k?w(p,Sn,d,M):w(s,y,Sn,d,M),N)))return;if(d){if(S&&(S(k?p:s,Sn,h,M),N))return;B&&(b=h?e:l.pop())}f+=1}else{if(-1===(f=a.indexOf("?>",m)))return O("unclosed question");if(R&&(R(a.substring(m,f+2),M),N))return;f+=2}else{if(91===(r=a.charCodeAt(m+2))&&"CDATA["===a.substr(m+3,6)){if(-1===(f=a.indexOf("]]>",m)))return O("unclosed cdata");if(C&&(C(a.substring(m+9,f),M),N))return;f+=3;continue}if(45===r&&45===a.charCodeAt(m+3)){if(-1===(f=a.indexOf("--\x3e",m)))return O("unclosed comment");if(T&&(T(a.substring(m+4,f),Sn,M),N))return;f+=3;continue}if(-1===(f=a.indexOf(">",m+1)))return O("unclosed tag");if(A&&(A(a.substring(m,f+1),Sn,M),N))return;f+=1}}}(e),M=Nn,N=!1,t},this.stop=function(){N=!0}}function jn(e){return e.xml&&"lowerCase"===e.xml.tagAlias}var In={xsi:"http://www.w3.org/2001/XMLSchema-instance"},zn="xsi:type";function Fn(e){return e.xml&&e.xml.serialize}function $n(e){return Fn(e)===zn}function Gn(e,t){return jn(t)?e.prefix+":"+((n=e.localName).charAt(0).toUpperCase()+n.slice(1)):e.name;var n}function Hn(e){return new Error(e)}function Vn(e){return e.$descriptor}function Wn(e){F(this,e),this.elementsById={},this.references=[],this.warnings=[],this.addReference=function(e){this.references.push(e)},this.addElement=function(e){if(!e)throw Hn("expected element");var t,n=this.elementsById,i=Vn(e).idProperty;if(i&&(t=e.get(i.name))){if(!/^([a-z][\w-.]*:)?[a-z_][\w-.]*$/i.test(t))throw new Error("illegal ID <"+t+">");if(n[t])throw Hn("duplicate ID <"+t+">");n[t]=e}},this.addWarning=function(e){this.warnings.push(e)}}function Un(){}function qn(){}function Yn(){}function Kn(e,t){this.property=e,this.context=t}function Xn(e,t){this.element=t,this.propertyDesc=e}function Zn(){}function Qn(e,t,n){this.model=e,this.type=e.getType(t),this.context=n}function Jn(e,t,n){Qn.call(this,e,t,n)}function ei(e,t,n){this.model=e,this.context=n}function ti(e){e instanceof gn&&(e={model:e}),F(this,{lax:!1},e)}Un.prototype.handleEnd=function(){},Un.prototype.handleText=function(){},Un.prototype.handleNode=function(){},(qn.prototype=Object.create(Un.prototype)).handleNode=function(){return this},(Yn.prototype=Object.create(Un.prototype)).handleText=function(e){this.body=(this.body||"")+e},(Kn.prototype=Object.create(Yn.prototype)).handleNode=function(e){if(this.element)throw Hn("expected no sub nodes");return this.element=this.createReference(e),this},Kn.prototype.handleEnd=function(){this.element.id=this.body},Kn.prototype.createReference=function(e){return{property:this.property.ns.name,id:""}},(Xn.prototype=Object.create(Yn.prototype)).handleEnd=function(){var e=this.body||"",t=this.element,n=this.propertyDesc;e=pn(n.type,e),n.isMany?t.get(n.name).push(e):t.set(n.name,e)},(Zn.prototype=Object.create(Yn.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},(Qn.prototype=Object.create(Zn.prototype)).addReference=function(e){this.context.addReference(e)},Qn.prototype.handleText=function(e){if(!Vn(this.element).bodyProperty)throw Hn("unexpected body text <"+e+">");Yn.prototype.handleText.call(this,e)},Qn.prototype.handleEnd=function(){var e=this.body,t=this.element,n=Vn(t).bodyProperty;n&&void 0!==e&&(e=pn(n.type,e),t.set(n.name,e))},Qn.prototype.createElement=function(e){var i,t=e.attributes,n=this.type,r=Vn(n),o=this.context,a=new n({}),s=this.model;return M(t,function(e,t){var n=r.propertiesByName[t];n&&n.isReference?n.isMany?M(e.split(" "),function(e){o.addReference({element:a,property:n.ns.name,id:e})}):o.addReference({element:a,property:n.ns.name,id:e}):(n?e=pn(n.type,e):"xmlns"!==t&&(i=hn(t,r.ns.prefix),s.getPackage(i.prefix)&&o.addWarning({message:"unknown attribute <"+t+">",element:a,property:t,value:e})),a.set(t,e))}),a},Qn.prototype.getPropertyForNode=function(e){var t,n,i,r,o,a,s,c,p,l,u=hn(e.name),h=this.type,d=this.model,m=Vn(h),f=u.name,y=m.propertiesByName[f];if(y)return $n(y)&&(t=e.attributes[zn])?(i=d,p=hn(t),l=i.getPackage(p.prefix),o=l,a=(r=p).name,s=r.localName,t=(c=o.xml&&o.xml.typePrefix)&&0===s.indexOf(c)?r.prefix+":"+s.slice(c.length):a,F({},y,{effectiveType:Vn(n=d.getType(t)).name})):y;var v=d.getPackage(u.prefix);if(v){if(t=Gn(u,v),n=d.getType(t),y=A(m.properties,function(e){return!e.isVirtual&&!e.isReference&&!e.isAttribute&&n.hasType(e.type)}))return F({},y,{effectiveType:Vn(n).name})}else if(y=A(m.properties,function(e){return!e.isReference&&!e.isAttribute&&"Element"===e.type}))return y;throw Hn("unrecognized element <"+u.name+">")},Qn.prototype.toString=function(){return"ElementDescriptor["+Vn(this.type).name+"]"},Qn.prototype.valueHandler=function(e,t){return new Xn(e,t)},Qn.prototype.referenceHandler=function(e){return new Kn(e,this.context)},Qn.prototype.handler=function(e){return"Element"===e?new ei(this.model,e,this.context):new Qn(this.model,e,this.context)},Qn.prototype.handleChild=function(e){var t,n,i,r;if(t=this.getPropertyForNode(e),i=this.element,un(n=t.effectiveType||t.type))return this.valueHandler(t,i);var o=(r=t.isReference?this.referenceHandler(t).handleNode(e):this.handler(n).handleNode(e)).element;return void 0!==o&&(t.isMany?i.get(t.name).push(o):i.set(t.name,o),t.isReference?(F(o,{element:i}),this.context.addReference(o)):o.$parent=i),r},(Jn.prototype=Object.create(Qn.prototype)).createElement=function(e){var t=e.name,n=hn(t),i=this.model,r=this.type,o=i.getPackage(n.prefix),a=o&&Gn(n,o)||t;if(!r.hasType(a))throw Hn("unexpected element <"+e.originalName+">");return Qn.prototype.createElement.call(this,e)},(ei.prototype=Object.create(Zn.prototype)).createElement=function(e){var t=e.name,n=hn(t).prefix,i=e.ns[n+"$uri"],r=e.attributes;return this.model.createAny(t,i,r)},ei.prototype.handleChild=function(e){var t=new ei(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},ei.prototype.handleEnd=function(){this.body&&(this.element.$body=this.body)},ti.prototype.fromXML=function(n,e,i){var r=e.rootHandler;e instanceof Qn?(r=e,e={}):"string"==typeof e?(r=this.handler(e),e={}):"string"==typeof r&&(r=this.handler(r));var t,o=this.model,a=this.lax,p=new Wn(F({},e,{rootHandler:r})),s=new Ln({proxy:!0}),c=(t=[],Object.defineProperty(t,"peek",{value:function(){return this[this.length-1]}}),t);function l(e,t,n){var i=t(),r=i.line,o=i.column,a=i.data;"<"===a.charAt(0)&&-1!==a.indexOf(" ")&&(a=a.slice(0,a.indexOf(" "))+">");var s="unparsable content "+(a?a+" ":"")+"detected\n\tline: "+r+"\n\tcolumn: "+o+"\n\tnested error: "+e.message;if(n)return p.addWarning({message:s,error:e}),!0;throw Hn(s)}function u(e,t){return l(e,t,!0)}r.context=p,c.push(r);var h=/^<\?xml /i,d=/ encoding="([^"]+)"/i,m=/^utf-8$/i;function f(e,t){try{c.peek().handleText(e)}catch(e){u(e,t)}}var y=o.getPackages().reduce(function(e,t){return e[t.uri]=t.prefix,e},{});s.ns(y).on("openTag",function(e,i,t,n){var r=e.attrs||{},o=Object.keys(r).reduce(function(e,t){var n=i(r[t]);return e[t]=n,e},{});!function(e,t){var n=c.peek();try{c.push(n.handleNode(e))}catch(e){l(e,t,a)&&c.push(new qn)}}({name:e.name,originalName:e.originalName,attributes:o,ns:e.ns},n)}).on("question",function(e){if(h.test(e)){var t=d.exec(e),n=t&&t[1];n&&!m.test(n)&&p.addWarning({message:"unsupported document encoding <"+n+">, falling back to UTF-8"})}}).on("closeTag",function(){c.pop().handleEnd()}).on("cdata",f).on("text",function(e,t,n){var i,r;i=t(e),r=n,(i=i.trim())&&f(i,r)}).on("error",l).on("warn",u),setTimeout(function(){var t;try{s.parse(n),function(){var e,t,n=p.elementsById,i=p.references;for(e=0;t=i[e];e++){var r=t.element,o=n[t.id],a=Vn(r).propertiesByName[t.property];if(o||p.addWarning({message:"unresolved reference <"+t.id+">",element:t.element,property:t.property,value:t.id}),a.isMany){var s=r.get(a.name),c=s.indexOf(t);-1===c&&(c=s.length),o?s[c]=o:s.splice(c,1)}else r.set(a.name,o)}}()}catch(e){t=e}var e=r.element;t||e||(t=Hn("failed to parse document as <"+r.type.$descriptor.name+">")),i(t,t?void 0:e,p)},0)},ti.prototype.handler=function(e){return new Jn(this.model,e)};var ni=/<|>|'|"|&|\n\r|\n/g,ii=/<|>|&/g;function ri(t){var n={},i={},r={},o=[],a=[];this.byUri=function(e){return i[e]||t&&t.byUri(e)},this.add=function(e,t){i[e.uri]=e,t?o.push(e):a.push(e),this.mapPrefix(e.prefix,e.uri)},this.uriByPrefix=function(e){return n[e||"xmlns"]},this.mapPrefix=function(e,t){n[e||"xmlns"]=t},this.logUsed=function(e){var t=e.uri;r[t]=this.byUri(t)},this.getUsed=function(e){return[].concat(o,a).filter(function(e){return r[e.uri]})}}function oi(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}function ai(e){return d(e)?e:(e.prefix?e.prefix+":":"")+e.localName}function si(e,t){return t.isGeneric?F({localName:t.ns.localName},e):F({localName:(n=t.ns.localName,i=t.$pkg,jn(i)?(r=n).charAt(0).toLowerCase()+r.slice(1):n)},e);var n,i,r}var ci={"\n":"#10","\n\r":"#10",'"':"#34","'":"#39","<":"#60",">":"#62","&":"#38"},pi={"<":"lt",">":"gt","&":"amp"};function li(e,t,n){return(e=d(e)?e:""+e).replace(t,function(e){return"&"+n[e]+";"})}function ui(e){this.tagName=e}function hi(){}function di(e){this.tagName=e}function mi(e,t){this.body=[],this.attrs=[],this.parent=e,this.propertyDescriptor=t}function fi(e,t){mi.call(this,e,t)}function yi(){this.value="",this.write=function(e){this.value+=e}}function vi(t,e){var n=[""];this.append=function(e){return t.write(e),this},this.appendNewLine=function(){return e&&t.write("\n"),this},this.appendIndent=function(){return e&&t.write(n.join(" ")),this},this.indent=function(){return n.push(""),this},this.unindent=function(){return n.pop(),this}}function gi(r){return r=F({format:!1,preamble:!0},r||{}),{toXML:function(e,t){var n=t||new yi,i=new vi(n,r.format);if(r.preamble&&i.append('\n'),(new mi).build(e).serializeTo(i),!t)return n.value}}}function bi(e,t){gn.call(this,e,t)}ui.prototype.build=function(e){return this.element=e,this},ui.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"+this.element.id+"").appendNewLine()},hi.prototype.serializeValue=hi.prototype.serializeTo=function(e){e.append(this.escape?li(this.value,ii,pi):this.value)},hi.prototype.build=function(e,t){return this.value=t,"String"===e.type&&-1!==t.search(ii)&&(this.escape=!0),this},oi(di,hi),di.prototype.serializeTo=function(e){e.appendIndent().append("<"+this.tagName+">"),this.serializeValue(e),e.append("").appendNewLine()},mi.prototype.build=function(e){var t,n,i,r=(this.element=e).$descriptor,o=this.propertyDescriptor,a=r.isGeneric;return t=a?this.parseGeneric(e):this.parseNsAttributes(e),this.ns=o?this.nsPropertyTagName(o):this.nsTagName(r),this.tagName=this.addTagName(this.ns),a||(n=k((i=e).$descriptor.properties,function(e){var t=e.name;if(e.isVirtual)return!1;if(!i.hasOwnProperty(t))return!1;var n=i[t];return n!==e.default&&null!==n&&(!e.isMany||n.length)}),this.parseAttributes(k(n,function(e){return e.isAttr})),this.parseContainments(k(n,function(e){return!e.isAttr}))),this.parseGenericAttributes(e,t),this},mi.prototype.nsTagName=function(e){return si(this.logNamespaceUsed(e.ns),e)},mi.prototype.nsPropertyTagName=function(e){var t,n=this.logNamespaceUsed(e.ns);return t=n,F({localName:e.ns.localName},t)},mi.prototype.isLocalNs=function(e){return e.uri===this.ns.uri},mi.prototype.nsAttributeName=function(e){var t;if(t=d(e)?hn(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}:F({localName:t.localName},n)},mi.prototype.parseGeneric=function(n){var i=this,r=this.body,o=[];return M(n,function(e,t){"$body"===t?r.push((new hi).build({type:"String"},e)):"$children"===t?M(e,function(e){r.push(new mi(i).build(e))}):0!==t.indexOf("$")&&i.parseNsAttribute(n,t,e)&&o.push({name:t,value:e})}),o},mi.prototype.parseNsAttribute=function(e,t,n){var i,r=e.$model,o=hn(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)}},mi.prototype.parseNsAttributes=function(i,e){var r=this,t=i.$attrs,o=[];return M(t,function(e,t){var n=r.parseNsAttribute(i,t,e);n&&o.push(n)}),o},mi.prototype.parseGenericAttributes=function(n,e){var i=this;M(e,function(t){if(t.name!==zn)try{i.addAttribute(i.nsAttributeName(t.name),t.value)}catch(e){console.warn("missing namespace information for ",t.name,"=",t.value,"on",n,e)}})},mi.prototype.parseContainments=function(e){var o=this,a=this.body,s=this.element;M(e,function(n){var e=s.get(n.name),t=n.isReference;if(n.isMany||(e=[e]),n.isBody)a.push((new hi).build(n,e[0]));else if(un(n.type))M(e,function(e){a.push(new di(o.addTagName(o.nsPropertyTagName(n))).build(n,e))});else if(t)M(e,function(e){a.push(new ui(o.addTagName(o.nsPropertyTagName(n))).build(e))});else{var i=$n(n),r="property"===Fn(n);M(e,function(e){var t;t=i?new fi(o,n):r?new mi(o,n):new mi(o),a.push(t.build(e))})}})},mi.prototype.getNamespaces=function(e){var t,n=this.namespaces,i=this.parent;return n||(t=i&&i.getNamespaces(),e||!t?this.namespaces=n=new ri(t):n=t),n},mi.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},mi.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=In[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},mi.prototype.parseAttributes=function(e){var i=this,r=this.element;M(e,function(e){var t=r.get(e.name);if(e.isReference)if(e.isMany){var n=[];M(t,function(e){n.push(e.id)}),t=n.join(" ")}else t=t.id;i.addAttribute(i.nsAttributeName(e),t)})},mi.prototype.addTagName=function(e){var t=this.logNamespaceUsed(e);return this.getNamespaces().logUsed(t),ai(e)},mi.prototype.addAttribute=function(e,t){var n=this.attrs;d(t)&&(t=li(t,ni,ci)),n.push({name:e,value:t})},mi.prototype.serializeAttributes=function(t){var e,n=this.attrs,i=this.namespaces;i&&(n=(e=i,b(e.getUsed(),function(e){return{name:"xmlns"+(e.prefix?":"+e.prefix:""),value:e.uri}})).concat(n)),M(n,function(e){t.append(" ").append(ai(e.name)).append('="').append(e.value).append('"')})},mi.prototype.serializeTo=function(t){var e=this.body[0],n=e&&e.constructor!==hi;t.appendIndent().append("<"+this.tagName),this.serializeAttributes(t),t.append(e?">":" />"),e&&(n&&t.appendNewLine().indent(),M(this.body,function(e){e.serializeTo(t)}),n&&t.unindent().appendIndent(),t.append("")),t.appendNewLine()},oi(fi,mi),fi.prototype.parseNsAttributes=function(e){var t=mi.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(zn),(i.prefix?i.prefix+":":"")+o+n.ns.localName),t},fi.prototype.isLocalNs=function(e){return e.uri===(this.typeNs||this.ns).uri},(bi.prototype=Object.create(gn.prototype)).fromXML=function(e,t,n,i){d(t)||(i=n,n=t,t="bpmn:Definitions"),u(n)&&(i=n,n={});var r=new ti(F({model:this,lax:!0},n)),o=r.handler(t);r.fromXML(e,o,i)};bi.prototype.toXML=function(e,t,n){u(t)&&(n=t,t={});var i,r,o=new gi(t);try{i=o.toXML(e)}catch(e){r=e}return n(r,i)};var xi={bpmn:{name:"BPMN20",uri:"http://www.omg.org/spec/BPMN/20100524/MODEL",associations:[],types:[{name:"Interface",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"operations",type:"Operation",isMany:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"Operation",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"inMessageRef",type:"Message",isReference:!0},{name:"outMessageRef",type:"Message",isReference:!0},{name:"errorRef",type:"Error",isMany:!0,isReference:!0},{name:"implementationRef",type:"String",isAttr:!0}]},{name:"EndPoint",superClass:["RootElement"]},{name:"Auditing",superClass:["BaseElement"]},{name:"GlobalTask",superClass:["CallableElement"],properties:[{name:"resources",type:"ResourceRole",isMany:!0}]},{name:"Monitoring",superClass:["BaseElement"]},{name:"Performer",superClass:["ResourceRole"]},{name:"Process",superClass:["FlowElementsContainer","CallableElement"],properties:[{name:"processType",type:"ProcessType",isAttr:!0},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"properties",type:"Property",isMany:!0},{name:"laneSets",type:"LaneSet",isMany:!0,replaces:"FlowElementsContainer#laneSets"},{name:"flowElements",type:"FlowElement",isMany:!0,replaces:"FlowElementsContainer#flowElements"},{name:"artifacts",type:"Artifact",isMany:!0},{name:"resources",type:"ResourceRole",isMany:!0},{name:"correlationSubscriptions",type:"CorrelationSubscription",isMany:!0},{name:"supports",type:"Process",isMany:!0,isReference:!0},{name:"definitionalCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"isExecutable",isAttr:!0,type:"Boolean"}]},{name:"LaneSet",superClass:["BaseElement"],properties:[{name:"lanes",type:"Lane",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Lane",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"partitionElementRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"partitionElement",type:"BaseElement"},{name:"flowNodeRef",type:"FlowNode",isMany:!0,isReference:!0},{name:"childLaneSet",type:"LaneSet",xml:{serialize:"xsi:type"}}]},{name:"GlobalManualTask",superClass:["GlobalTask"]},{name:"ManualTask",superClass:["Task"]},{name:"UserTask",superClass:["Task"],properties:[{name:"renderings",type:"Rendering",isMany:!0},{name:"implementation",isAttr:!0,type:"String"}]},{name:"Rendering",superClass:["BaseElement"]},{name:"HumanPerformer",superClass:["Performer"]},{name:"PotentialOwner",superClass:["HumanPerformer"]},{name:"GlobalUserTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"renderings",type:"Rendering",isMany:!0}]},{name:"Gateway",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"gatewayDirection",type:"GatewayDirection",default:"Unspecified",isAttr:!0}]},{name:"EventBasedGateway",superClass:["Gateway"],properties:[{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"eventGatewayType",type:"EventBasedGatewayType",isAttr:!0,default:"Exclusive"}]},{name:"ComplexGateway",superClass:["Gateway"],properties:[{name:"activationCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ExclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"InclusiveGateway",superClass:["Gateway"],properties:[{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0}]},{name:"ParallelGateway",superClass:["Gateway"]},{name:"RootElement",isAbstract:!0,superClass:["BaseElement"]},{name:"Relationship",superClass:["BaseElement"],properties:[{name:"type",isAttr:!0,type:"String"},{name:"direction",type:"RelationshipDirection",isAttr:!0},{name:"source",isMany:!0,isReference:!0,type:"Element"},{name:"target",isMany:!0,isReference:!0,type:"Element"}]},{name:"BaseElement",isAbstract:!0,properties:[{name:"id",isAttr:!0,type:"String",isId:!0},{name:"documentation",type:"Documentation",isMany:!0},{name:"extensionDefinitions",type:"ExtensionDefinition",isMany:!0,isReference:!0},{name:"extensionElements",type:"ExtensionElements"}]},{name:"Extension",properties:[{name:"mustUnderstand",default:!1,isAttr:!0,type:"Boolean"},{name:"definition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"extensionAttributeDefinitions",type:"ExtensionAttributeDefinition",isMany:!0}]},{name:"ExtensionAttributeDefinition",properties:[{name:"name",isAttr:!0,type:"String"},{name:"type",isAttr:!0,type:"String"},{name:"isReference",default:!1,isAttr:!0,type:"Boolean"},{name:"extensionDefinition",type:"ExtensionDefinition",isAttr:!0,isReference:!0}]},{name:"ExtensionElements",properties:[{name:"valueRef",isAttr:!0,isReference:!0,type:"Element"},{name:"values",type:"Element",isMany:!0},{name:"extensionAttributeDefinition",type:"ExtensionAttributeDefinition",isAttr:!0,isReference:!0}]},{name:"Documentation",superClass:["BaseElement"],properties:[{name:"text",type:"String",isBody:!0},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Event",isAbstract:!0,superClass:["FlowNode","InteractionNode"],properties:[{name:"properties",type:"Property",isMany:!0}]},{name:"IntermediateCatchEvent",superClass:["CatchEvent"]},{name:"IntermediateThrowEvent",superClass:["ThrowEvent"]},{name:"EndEvent",superClass:["ThrowEvent"]},{name:"StartEvent",superClass:["CatchEvent"],properties:[{name:"isInterrupting",default:!0,isAttr:!0,type:"Boolean"}]},{name:"ThrowEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"inputSet",type:"InputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"CatchEvent",isAbstract:!0,superClass:["Event"],properties:[{name:"parallelMultiple",isAttr:!0,type:"Boolean",default:!1},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"outputSet",type:"OutputSet"},{name:"eventDefinitions",type:"EventDefinition",isMany:!0},{name:"eventDefinitionRef",type:"EventDefinition",isMany:!0,isReference:!0}]},{name:"BoundaryEvent",superClass:["CatchEvent"],properties:[{name:"cancelActivity",default:!0,isAttr:!0,type:"Boolean"},{name:"attachedToRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"EventDefinition",isAbstract:!0,superClass:["RootElement"]},{name:"CancelEventDefinition",superClass:["EventDefinition"]},{name:"ErrorEventDefinition",superClass:["EventDefinition"],properties:[{name:"errorRef",type:"Error",isAttr:!0,isReference:!0}]},{name:"TerminateEventDefinition",superClass:["EventDefinition"]},{name:"EscalationEventDefinition",superClass:["EventDefinition"],properties:[{name:"escalationRef",type:"Escalation",isAttr:!0,isReference:!0}]},{name:"Escalation",properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"escalationCode",isAttr:!0,type:"String"}],superClass:["RootElement"]},{name:"CompensateEventDefinition",superClass:["EventDefinition"],properties:[{name:"waitForCompletion",isAttr:!0,type:"Boolean",default:!0},{name:"activityRef",type:"Activity",isAttr:!0,isReference:!0}]},{name:"TimerEventDefinition",superClass:["EventDefinition"],properties:[{name:"timeDate",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeCycle",type:"Expression",xml:{serialize:"xsi:type"}},{name:"timeDuration",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"LinkEventDefinition",superClass:["EventDefinition"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"target",type:"LinkEventDefinition",isAttr:!0,isReference:!0},{name:"source",type:"LinkEventDefinition",isMany:!0,isReference:!0}]},{name:"MessageEventDefinition",superClass:["EventDefinition"],properties:[{name:"messageRef",type:"Message",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"ConditionalEventDefinition",superClass:["EventDefinition"],properties:[{name:"condition",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"SignalEventDefinition",superClass:["EventDefinition"],properties:[{name:"signalRef",type:"Signal",isAttr:!0,isReference:!0}]},{name:"Signal",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ImplicitThrowEvent",superClass:["ThrowEvent"]},{name:"DataState",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"ItemAwareElement",superClass:["BaseElement"],properties:[{name:"itemSubjectRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"dataState",type:"DataState"}]},{name:"DataAssociation",superClass:["BaseElement"],properties:[{name:"assignment",type:"Assignment",isMany:!0},{name:"sourceRef",type:"ItemAwareElement",isMany:!0,isReference:!0},{name:"targetRef",type:"ItemAwareElement",isReference:!0},{name:"transformation",type:"FormalExpression",xml:{serialize:"property"}}]},{name:"DataInput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"inputSetRef",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithOptional",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"inputSetWithWhileExecuting",type:"InputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"DataOutput",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"outputSetRef",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithOptional",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0},{name:"outputSetWithWhileExecuting",type:"OutputSet",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"InputSet",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"dataInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"optionalInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"whileExecutingInputRefs",type:"DataInput",isMany:!0,isReference:!0},{name:"outputSetRefs",type:"OutputSet",isMany:!0,isReference:!0}]},{name:"OutputSet",superClass:["BaseElement"],properties:[{name:"dataOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"inputSetRefs",type:"InputSet",isMany:!0,isReference:!0},{name:"optionalOutputRefs",type:"DataOutput",isMany:!0,isReference:!0},{name:"whileExecutingOutputRefs",type:"DataOutput",isMany:!0,isReference:!0}]},{name:"Property",superClass:["ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"}]},{name:"DataInputAssociation",superClass:["DataAssociation"]},{name:"DataOutputAssociation",superClass:["DataAssociation"]},{name:"InputOutputSpecification",superClass:["BaseElement"],properties:[{name:"dataInputs",type:"DataInput",isMany:!0},{name:"dataOutputs",type:"DataOutput",isMany:!0},{name:"inputSets",type:"InputSet",isMany:!0},{name:"outputSets",type:"OutputSet",isMany:!0}]},{name:"DataObject",superClass:["FlowElement","ItemAwareElement"],properties:[{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"}]},{name:"InputOutputBinding",properties:[{name:"inputDataRef",type:"InputSet",isAttr:!0,isReference:!0},{name:"outputDataRef",type:"OutputSet",isAttr:!0,isReference:!0},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"Assignment",superClass:["BaseElement"],properties:[{name:"from",type:"Expression",xml:{serialize:"xsi:type"}},{name:"to",type:"Expression",xml:{serialize:"xsi:type"}}]},{name:"DataStore",superClass:["RootElement","ItemAwareElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"capacity",isAttr:!0,type:"Integer"},{name:"isUnlimited",default:!0,isAttr:!0,type:"Boolean"}]},{name:"DataStoreReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataStoreRef",type:"DataStore",isAttr:!0,isReference:!0}]},{name:"DataObjectReference",superClass:["ItemAwareElement","FlowElement"],properties:[{name:"dataObjectRef",type:"DataObject",isAttr:!0,isReference:!0}]},{name:"ConversationLink",superClass:["BaseElement"],properties:[{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"ConversationAssociation",superClass:["BaseElement"],properties:[{name:"innerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0},{name:"outerConversationNodeRef",type:"ConversationNode",isAttr:!0,isReference:!0}]},{name:"CallConversation",superClass:["ConversationNode"],properties:[{name:"calledCollaborationRef",type:"Collaboration",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"Conversation",superClass:["ConversationNode"]},{name:"SubConversation",superClass:["ConversationNode"],properties:[{name:"conversationNodes",type:"ConversationNode",isMany:!0}]},{name:"ConversationNode",isAbstract:!0,superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"messageFlowRefs",type:"MessageFlow",isMany:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0}]},{name:"GlobalConversation",superClass:["Collaboration"]},{name:"PartnerEntity",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"PartnerRole",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"participantRef",type:"Participant",isMany:!0,isReference:!0}]},{name:"CorrelationProperty",superClass:["RootElement"],properties:[{name:"correlationPropertyRetrievalExpression",type:"CorrelationPropertyRetrievalExpression",isMany:!0},{name:"name",isAttr:!0,type:"String"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Error",superClass:["RootElement"],properties:[{name:"structureRef",type:"ItemDefinition",isAttr:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"},{name:"errorCode",isAttr:!0,type:"String"}]},{name:"CorrelationKey",superClass:["BaseElement"],properties:[{name:"correlationPropertyRef",type:"CorrelationProperty",isMany:!0,isReference:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Expression",superClass:["BaseElement"],isAbstract:!1,properties:[{name:"body",type:"String",isBody:!0}]},{name:"FormalExpression",superClass:["Expression"],properties:[{name:"language",isAttr:!0,type:"String"},{name:"evaluatesToTypeRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"Message",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"itemRef",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"ItemDefinition",superClass:["RootElement"],properties:[{name:"itemKind",type:"ItemKind",isAttr:!0},{name:"structureRef",type:"String",isAttr:!0},{name:"isCollection",default:!1,isAttr:!0,type:"Boolean"},{name:"import",type:"Import",isAttr:!0,isReference:!0}]},{name:"FlowElement",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"auditing",type:"Auditing"},{name:"monitoring",type:"Monitoring"},{name:"categoryValueRef",type:"CategoryValue",isMany:!0,isReference:!0}]},{name:"SequenceFlow",superClass:["FlowElement"],properties:[{name:"isImmediate",isAttr:!0,type:"Boolean"},{name:"conditionExpression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"sourceRef",type:"FlowNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"FlowNode",isAttr:!0,isReference:!0}]},{name:"FlowElementsContainer",isAbstract:!0,superClass:["BaseElement"],properties:[{name:"laneSets",type:"LaneSet",isMany:!0},{name:"flowElements",type:"FlowElement",isMany:!0}]},{name:"CallableElement",isAbstract:!0,superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"supportedInterfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"ioBinding",type:"InputOutputBinding",isMany:!0,xml:{serialize:"property"}}]},{name:"FlowNode",isAbstract:!0,superClass:["FlowElement"],properties:[{name:"incoming",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"outgoing",type:"SequenceFlow",isMany:!0,isReference:!0},{name:"lanes",type:"Lane",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"CorrelationPropertyRetrievalExpression",superClass:["BaseElement"],properties:[{name:"messagePath",type:"FormalExpression"},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"CorrelationPropertyBinding",superClass:["BaseElement"],properties:[{name:"dataPath",type:"FormalExpression"},{name:"correlationPropertyRef",type:"CorrelationProperty",isAttr:!0,isReference:!0}]},{name:"Resource",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"resourceParameters",type:"ResourceParameter",isMany:!0}]},{name:"ResourceParameter",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isRequired",isAttr:!0,type:"Boolean"},{name:"type",type:"ItemDefinition",isAttr:!0,isReference:!0}]},{name:"CorrelationSubscription",superClass:["BaseElement"],properties:[{name:"correlationKeyRef",type:"CorrelationKey",isAttr:!0,isReference:!0},{name:"correlationPropertyBinding",type:"CorrelationPropertyBinding",isMany:!0}]},{name:"MessageFlow",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"sourceRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"targetRef",type:"InteractionNode",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"MessageFlowAssociation",superClass:["BaseElement"],properties:[{name:"innerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0},{name:"outerMessageFlowRef",type:"MessageFlow",isAttr:!0,isReference:!0}]},{name:"InteractionNode",isAbstract:!0,properties:[{name:"incomingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0},{name:"outgoingConversationLinks",type:"ConversationLink",isVirtual:!0,isMany:!0,isReference:!0}]},{name:"Participant",superClass:["InteractionNode","BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"interfaceRef",type:"Interface",isMany:!0,isReference:!0},{name:"participantMultiplicity",type:"ParticipantMultiplicity"},{name:"endPointRefs",type:"EndPoint",isMany:!0,isReference:!0},{name:"processRef",type:"Process",isAttr:!0,isReference:!0}]},{name:"ParticipantAssociation",superClass:["BaseElement"],properties:[{name:"innerParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"outerParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"ParticipantMultiplicity",properties:[{name:"minimum",default:0,isAttr:!0,type:"Integer"},{name:"maximum",default:1,isAttr:!0,type:"Integer"}],superClass:["BaseElement"]},{name:"Collaboration",superClass:["RootElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"isClosed",isAttr:!0,type:"Boolean"},{name:"participants",type:"Participant",isMany:!0},{name:"messageFlows",type:"MessageFlow",isMany:!0},{name:"artifacts",type:"Artifact",isMany:!0},{name:"conversations",type:"ConversationNode",isMany:!0},{name:"conversationAssociations",type:"ConversationAssociation"},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0},{name:"messageFlowAssociations",type:"MessageFlowAssociation",isMany:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"choreographyRef",type:"Choreography",isMany:!0,isReference:!0},{name:"conversationLinks",type:"ConversationLink",isMany:!0}]},{name:"ChoreographyActivity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"participantRef",type:"Participant",isMany:!0,isReference:!0},{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0},{name:"correlationKeys",type:"CorrelationKey",isMany:!0},{name:"loopType",type:"ChoreographyLoopType",default:"None",isAttr:!0}]},{name:"CallChoreography",superClass:["ChoreographyActivity"],properties:[{name:"calledChoreographyRef",type:"Choreography",isAttr:!0,isReference:!0},{name:"participantAssociations",type:"ParticipantAssociation",isMany:!0}]},{name:"SubChoreography",superClass:["ChoreographyActivity","FlowElementsContainer"],properties:[{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"ChoreographyTask",superClass:["ChoreographyActivity"],properties:[{name:"messageFlowRef",type:"MessageFlow",isMany:!0,isReference:!0}]},{name:"Choreography",superClass:["Collaboration","FlowElementsContainer"]},{name:"GlobalChoreographyTask",superClass:["Choreography"],properties:[{name:"initiatingParticipantRef",type:"Participant",isAttr:!0,isReference:!0}]},{name:"TextAnnotation",superClass:["Artifact"],properties:[{name:"text",type:"String"},{name:"textFormat",default:"text/plain",isAttr:!0,type:"String"}]},{name:"Group",superClass:["Artifact"],properties:[{name:"categoryValueRef",type:"CategoryValue",isAttr:!0,isReference:!0}]},{name:"Association",superClass:["Artifact"],properties:[{name:"associationDirection",type:"AssociationDirection",isAttr:!0},{name:"sourceRef",type:"BaseElement",isAttr:!0,isReference:!0},{name:"targetRef",type:"BaseElement",isAttr:!0,isReference:!0}]},{name:"Category",superClass:["RootElement"],properties:[{name:"categoryValue",type:"CategoryValue",isMany:!0},{name:"name",isAttr:!0,type:"String"}]},{name:"Artifact",isAbstract:!0,superClass:["BaseElement"]},{name:"CategoryValue",superClass:["BaseElement"],properties:[{name:"categorizedFlowElements",type:"FlowElement",isVirtual:!0,isMany:!0,isReference:!0},{name:"value",isAttr:!0,type:"String"}]},{name:"Activity",isAbstract:!0,superClass:["FlowNode"],properties:[{name:"isForCompensation",default:!1,isAttr:!0,type:"Boolean"},{name:"default",type:"SequenceFlow",isAttr:!0,isReference:!0},{name:"ioSpecification",type:"InputOutputSpecification",xml:{serialize:"property"}},{name:"boundaryEventRefs",type:"BoundaryEvent",isMany:!0,isReference:!0},{name:"properties",type:"Property",isMany:!0},{name:"dataInputAssociations",type:"DataInputAssociation",isMany:!0},{name:"dataOutputAssociations",type:"DataOutputAssociation",isMany:!0},{name:"startQuantity",default:1,isAttr:!0,type:"Integer"},{name:"resources",type:"ResourceRole",isMany:!0},{name:"completionQuantity",default:1,isAttr:!0,type:"Integer"},{name:"loopCharacteristics",type:"LoopCharacteristics"}]},{name:"ServiceTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0}]},{name:"SubProcess",superClass:["Activity","FlowElementsContainer","InteractionNode"],properties:[{name:"triggeredByEvent",default:!1,isAttr:!0,type:"Boolean"},{name:"artifacts",type:"Artifact",isMany:!0}]},{name:"LoopCharacteristics",isAbstract:!0,superClass:["BaseElement"]},{name:"MultiInstanceLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"isSequential",default:!1,isAttr:!0,type:"Boolean"},{name:"behavior",type:"MultiInstanceBehavior",default:"All",isAttr:!0},{name:"loopCardinality",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopDataInputRef",type:"ItemAwareElement",isReference:!0},{name:"loopDataOutputRef",type:"ItemAwareElement",isReference:!0},{name:"inputDataItem",type:"DataInput",xml:{serialize:"property"}},{name:"outputDataItem",type:"DataOutput",xml:{serialize:"property"}},{name:"complexBehaviorDefinition",type:"ComplexBehaviorDefinition",isMany:!0},{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"oneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0},{name:"noneBehaviorEventRef",type:"EventDefinition",isAttr:!0,isReference:!0}]},{name:"StandardLoopCharacteristics",superClass:["LoopCharacteristics"],properties:[{name:"testBefore",default:!1,isAttr:!0,type:"Boolean"},{name:"loopCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"loopMaximum",type:"Integer",isAttr:!0}]},{name:"CallActivity",superClass:["Activity"],properties:[{name:"calledElement",type:"String",isAttr:!0}]},{name:"Task",superClass:["Activity","InteractionNode"]},{name:"SendTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ReceiveTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"},{name:"instantiate",default:!1,isAttr:!0,type:"Boolean"},{name:"operationRef",type:"Operation",isAttr:!0,isReference:!0},{name:"messageRef",type:"Message",isAttr:!0,isReference:!0}]},{name:"ScriptTask",superClass:["Task"],properties:[{name:"scriptFormat",isAttr:!0,type:"String"},{name:"script",type:"String"}]},{name:"BusinessRuleTask",superClass:["Task"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"AdHocSubProcess",superClass:["SubProcess"],properties:[{name:"completionCondition",type:"Expression",xml:{serialize:"xsi:type"}},{name:"ordering",type:"AdHocOrdering",isAttr:!0},{name:"cancelRemainingInstances",default:!0,isAttr:!0,type:"Boolean"}]},{name:"Transaction",superClass:["SubProcess"],properties:[{name:"protocol",isAttr:!0,type:"String"},{name:"method",isAttr:!0,type:"String"}]},{name:"GlobalScriptTask",superClass:["GlobalTask"],properties:[{name:"scriptLanguage",isAttr:!0,type:"String"},{name:"script",isAttr:!0,type:"String"}]},{name:"GlobalBusinessRuleTask",superClass:["GlobalTask"],properties:[{name:"implementation",isAttr:!0,type:"String"}]},{name:"ComplexBehaviorDefinition",superClass:["BaseElement"],properties:[{name:"condition",type:"FormalExpression"},{name:"event",type:"ImplicitThrowEvent"}]},{name:"ResourceRole",superClass:["BaseElement"],properties:[{name:"resourceRef",type:"Resource",isReference:!0},{name:"resourceParameterBindings",type:"ResourceParameterBinding",isMany:!0},{name:"resourceAssignmentExpression",type:"ResourceAssignmentExpression"},{name:"name",isAttr:!0,type:"String"}]},{name:"ResourceParameterBinding",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}},{name:"parameterRef",type:"ResourceParameter",isAttr:!0,isReference:!0}],superClass:["BaseElement"]},{name:"ResourceAssignmentExpression",properties:[{name:"expression",type:"Expression",xml:{serialize:"xsi:type"}}],superClass:["BaseElement"]},{name:"Import",properties:[{name:"importType",isAttr:!0,type:"String"},{name:"location",isAttr:!0,type:"String"},{name:"namespace",isAttr:!0,type:"String"}]},{name:"Definitions",superClass:["BaseElement"],properties:[{name:"name",isAttr:!0,type:"String"},{name:"targetNamespace",isAttr:!0,type:"String"},{name:"expressionLanguage",default:"http://www.w3.org/1999/XPath",isAttr:!0,type:"String"},{name:"typeLanguage",default:"http://www.w3.org/2001/XMLSchema",isAttr:!0,type:"String"},{name:"imports",type:"Import",isMany:!0},{name:"extensions",type:"Extension",isMany:!0},{name:"rootElements",type:"RootElement",isMany:!0},{name:"diagrams",isMany:!0,type:"bpmndi:BPMNDiagram"},{name:"exporter",isAttr:!0,type:"String"},{name:"relationships",type:"Relationship",isMany:!0},{name:"exporterVersion",isAttr:!0,type:"String"}]}],enumerations:[{name:"ProcessType",literalValues:[{name:"None"},{name:"Public"},{name:"Private"}]},{name:"GatewayDirection",literalValues:[{name:"Unspecified"},{name:"Converging"},{name:"Diverging"},{name:"Mixed"}]},{name:"EventBasedGatewayType",literalValues:[{name:"Parallel"},{name:"Exclusive"}]},{name:"RelationshipDirection",literalValues:[{name:"None"},{name:"Forward"},{name:"Backward"},{name:"Both"}]},{name:"ItemKind",literalValues:[{name:"Physical"},{name:"Information"}]},{name:"ChoreographyLoopType",literalValues:[{name:"None"},{name:"Standard"},{name:"MultiInstanceSequential"},{name:"MultiInstanceParallel"}]},{name:"AssociationDirection",literalValues:[{name:"None"},{name:"One"},{name:"Both"}]},{name:"MultiInstanceBehavior",literalValues:[{name:"None"},{name:"One"},{name:"All"},{name:"Complex"}]},{name:"AdHocOrdering",literalValues:[{name:"Parallel"},{name:"Sequential"}]}],prefix:"bpmn",xml:{tagAlias:"lowerCase",typePrefix:"t"}},bpmndi:{name:"BPMNDI",uri:"http://www.omg.org/spec/BPMN/20100524/DI",types:[{name:"BPMNDiagram",properties:[{name:"plane",type:"BPMNPlane",redefines:"di:Diagram#rootElement"},{name:"labelStyle",type:"BPMNLabelStyle",isMany:!0}],superClass:["di:Diagram"]},{name:"BPMNPlane",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"}],superClass:["di:Plane"]},{name:"BPMNShape",properties:[{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"isHorizontal",isAttr:!0,type:"Boolean"},{name:"isExpanded",isAttr:!0,type:"Boolean"},{name:"isMarkerVisible",isAttr:!0,type:"Boolean"},{name:"label",type:"BPMNLabel"},{name:"isMessageVisible",isAttr:!0,type:"Boolean"},{name:"participantBandKind",type:"ParticipantBandKind",isAttr:!0},{name:"choreographyActivityShape",type:"BPMNShape",isAttr:!0,isReference:!0}],superClass:["di:LabeledShape"]},{name:"BPMNEdge",properties:[{name:"label",type:"BPMNLabel"},{name:"bpmnElement",isAttr:!0,isReference:!0,type:"bpmn:BaseElement",redefines:"di:DiagramElement#modelElement"},{name:"sourceElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#source"},{name:"targetElement",isAttr:!0,isReference:!0,type:"di:DiagramElement",redefines:"di:Edge#target"},{name:"messageVisibleKind",type:"MessageVisibleKind",isAttr:!0,default:"initiating"}],superClass:["di:LabeledEdge"]},{name:"BPMNLabel",properties:[{name:"labelStyle",type:"BPMNLabelStyle",isAttr:!0,isReference:!0,redefines:"di:DiagramElement#style"}],superClass:["di:Label"]},{name:"BPMNLabelStyle",properties:[{name:"font",type:"dc:Font"}],superClass:["di:Style"]}],enumerations:[{name:"ParticipantBandKind",literalValues:[{name:"top_initiating"},{name:"middle_initiating"},{name:"bottom_initiating"},{name:"top_non_initiating"},{name:"middle_non_initiating"},{name:"bottom_non_initiating"}]},{name:"MessageVisibleKind",literalValues:[{name:"initiating"},{name:"non_initiating"}]}],associations:[],prefix:"bpmndi"},dc:{name:"DC",uri:"http://www.omg.org/spec/DD/20100524/DC",types:[{name:"Boolean"},{name:"Integer"},{name:"Real"},{name:"String"},{name:"Font",properties:[{name:"name",type:"String",isAttr:!0},{name:"size",type:"Real",isAttr:!0},{name:"isBold",type:"Boolean",isAttr:!0},{name:"isItalic",type:"Boolean",isAttr:!0},{name:"isUnderline",type:"Boolean",isAttr:!0},{name:"isStrikeThrough",type:"Boolean",isAttr:!0}]},{name:"Point",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0}]},{name:"Bounds",properties:[{name:"x",type:"Real",default:"0",isAttr:!0},{name:"y",type:"Real",default:"0",isAttr:!0},{name:"width",type:"Real",isAttr:!0},{name:"height",type:"Real",isAttr:!0}]}],prefix:"dc",associations:[]},di:{name:"DI",uri:"http://www.omg.org/spec/DD/20100524/DI",types:[{name:"DiagramElement",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"extension",type:"Extension"},{name:"owningDiagram",type:"Diagram",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"owningElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"modelElement",isReadOnly:!0,isVirtual:!0,isReference:!0,type:"Element"},{name:"style",type:"Style",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"ownedElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Node",isAbstract:!0,superClass:["DiagramElement"]},{name:"Edge",isAbstract:!0,superClass:["DiagramElement"],properties:[{name:"source",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"target",type:"DiagramElement",isReadOnly:!0,isVirtual:!0,isReference:!0},{name:"waypoint",isUnique:!1,isMany:!0,type:"dc:Point",xml:{serialize:"xsi:type"}}]},{name:"Diagram",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0},{name:"rootElement",type:"DiagramElement",isReadOnly:!0,isVirtual:!0},{name:"name",isAttr:!0,type:"String"},{name:"documentation",isAttr:!0,type:"String"},{name:"resolution",isAttr:!0,type:"Real"},{name:"ownedStyle",type:"Style",isReadOnly:!0,isVirtual:!0,isMany:!0}]},{name:"Shape",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Plane",isAbstract:!0,superClass:["Node"],properties:[{name:"planeElement",type:"DiagramElement",subsettedProperty:"DiagramElement-ownedElement",isMany:!0}]},{name:"LabeledEdge",isAbstract:!0,superClass:["Edge"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"LabeledShape",isAbstract:!0,superClass:["Shape"],properties:[{name:"ownedLabel",type:"Label",isReadOnly:!0,subsettedProperty:"DiagramElement-ownedElement",isVirtual:!0,isMany:!0}]},{name:"Label",isAbstract:!0,superClass:["Node"],properties:[{name:"bounds",type:"dc:Bounds"}]},{name:"Style",isAbstract:!0,properties:[{name:"id",type:"String",isAttr:!0,isId:!0}]},{name:"Extension",properties:[{name:"values",type:"Element",isMany:!0}]}],associations:[],prefix:"di",xml:{tagAlias:"lowerCase"}},bioc:{name:"bpmn.io colors for BPMN",uri:"http://bpmn.io/schema/bpmn/biocolor/1.0",prefix:"bioc",types:[{name:"ColoredShape",extends:["bpmndi:BPMNShape"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]},{name:"ColoredEdge",extends:["bpmndi:BPMNEdge"],properties:[{name:"stroke",isAttr:!0,type:"String"},{name:"fill",isAttr:!0,type:"String"}]}],enumerations:[],associations:[]}};function _i(e,t){return new bi(F({},xi,e),t)}function Ei(e){return e?"<"+e.$type+(e.id?' id="'+e.id:"")+'" />':""}var wi=new Mt({name:"bpmnElement",enumerable:!0},{name:"di",configurable:!0});function Si(e,t){return e.$instanceOf(t)}function Ci(u,h){var d={},m=[];function f(t,n){return function(e){t(e,n)}}function i(e){d[e.id]=e}function o(t,e){try{var n=t.di&&function(e,t){if(e.gfx)throw new Error(h("already rendered {element}",{element:Ei(e)}));return u.element(e,t)}(t,e);return i(t),n}catch(e){y(e.message,{element:t,error:e}),console.error(h("failed to import {element}",{element:Ei(t)})),console.error(e)}}function y(e,t){u.error(e,t)}function v(e){var t=e.bpmnElement;t?t.di?y(h("multiple DI elements defined for {element}",{element:Ei(t)}),{element:t}):(wi.bind(t,"di"),t.di=e):y(h("no bpmnElement referenced in {element}",{element:Ei(e)}),{element:e})}function g(e){var t;v(t=e.plane),M(t.planeElement,n)}function n(e){v(e)}function b(){for(;m.length;)m.shift()()}function x(e,t){T(e,t),p(e.ioSpecification,t),E(e.artifacts,t),i(e)}function _(e,t){o(e,t)}function a(e,t){o(e,t)}function r(e,t){o(e,t)}function s(e,t){o(e,t)}function c(e,t){o(e,t)}function E(e,t){M(e,function(e){Si(e,"bpmn:Association")?m.push(function(){c(e,t)}):c(e,t)})}function p(e,t){e&&(M(e.dataInputs,f(r,t)),M(e.dataOutputs,f(s,t)))}function l(e,t){T(e,t),E(e.artifacts,t)}function w(e,t){o(e,t)}function S(t,i){m.push(function(){var n,e=o(t,i);t.childLaneSet&&C(t.childLaneSet,e||i),M((n=t).flowNodeRef,function(e){var t=e.get("lanes");t&&t.push(n)})})}function C(e,t){M(e.lanes,f(S,t))}function T(e,t){var n,r;n=e.flowElements,r=t,M(n,function(e){var t,n,i;Si(e,"bpmn:SequenceFlow")?m.push(function(){o(e,r)}):Si(e,"bpmn:BoundaryEvent")?m.unshift(function(){o(e,r)}):Si(e,"bpmn:FlowNode")?(i=o(t=e,n=r),Si(t,"bpmn:SubProcess")&&l(t,i||n),Si(t,"bpmn:Activity")&&p(t.ioSpecification,n),m.push(function(){M(t.dataInputAssociations,f(a,n)),M(t.dataOutputAssociations,f(a,n))})):Si(e,"bpmn:DataObject")||(Si(e,"bpmn:DataStoreReference")?w(e,r):Si(e,"bpmn:DataObjectReference")?w(e,r):y(h("unrecognized flowElement {element} in context {context}",{element:Ei(e),context:r?Ei(r.businessObject):"null"}),{element:e,context:r}))}),e.laneSets&&M(e.laneSets,f(C,t))}function R(e,t){var n=o(e,t),i=e.processRef;i&&x(i,n||t)}return{handleDeferred:b,handleDefinitions:function(e,t){var n=e.diagrams;if(t&&-1===n.indexOf(t))throw new Error(h("diagram not part of bpmn:Definitions"));if(!t&&n&&n.length&&(t=n[0]),!t)throw new Error(h("no diagram to display"));g(t);var i=t.plane;if(!i)throw new Error(h("no plane for {element}",{element:Ei(t)}));var r=i.bpmnElement;if(!r){if(!(r=A(e.rootElements,function(e){return Si(e,"bpmn:Process")||Si(e,"bpmn:Collaboration")})))throw new Error(h("no process or collaboration to display"));y(h("correcting missing bpmnElement on {plane} to {rootElement}",{plane:Ei(i),rootElement:Ei(r)})),i.bpmnElement=r,v(i)}var o,a,s,c,p,l=(o=r,a=i,u.root(o,a));if(Si(r,"bpmn:Process"))x(r,l);else{if(!Si(r,"bpmn:Collaboration"))throw new Error(h("unsupported bpmnElement for {plane}: {rootElement}",{plane:Ei(i),rootElement:Ei(r)}));M((p=r).participants,f(R)),E(p.artifacts),m.push(function(){var e;M(p.messageFlows,f(_,e))}),s=e.rootElements,c=l,k(s,function(e){return!d[e.id]&&Si(e,"bpmn:Process")&&e.laneSets}).forEach(f(x,c))}b()},handleSubProcess:l,registerDi:v}}function Ti(e,t){var n=Ri(e);return n&&"function"==typeof n.$instanceOf&&n.$instanceOf(t)}function Ri(e){return e&&e.businessObject||e}function Ai(e){return!Ti(e,"bpmn:CallActivity")&&(Ti(e,"bpmn:SubProcess")?!!Ri(e).di.isExpanded:!Ti(e,"bpmn:Participant")||!!Ri(e).processRef)}function Pi(e){return e&&!!Ri(e).triggeredByEvent}function ki(e,t){var n=Ri(e),i=!1;return n.eventDefinitions&&M(n.eventDefinitions,function(e){Ti(e,t)&&(i=!0)}),i}function Mi(e){return Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Participant")||Ti(e,"bpmn:Lane")||Ti(e,"bpmn:SequenceFlow")||Ti(e,"bpmn:MessageFlow")||Ti(e,"bpmn:DataInput")||Ti(e,"bpmn:DataOutput")?"name":Ti(e,"bpmn:TextAnnotation")?"text":Ti(e,"bpmn:Group")?"categoryValueRef":void 0}function Di(e){var t,n=e.businessObject,i=Mi(n);if(i)return"categoryValueRef"===i?(t=n.categoryValueRef)&&t.value||"":n[i]||""}function Bi(t,i,r){return v(t.eventDefinitions,function(e){return e.$type===i&&(n=t,y(r,function(e,t){return n[t]==e}));var n})}function Ni(e){return e.businessObject.di}function Oi(e){return e.businessObject}function Li(e,t){return Ni(e).get("bioc:fill")||t||"white"}function ji(e,t){return Ni(e).get("bioc:stroke")||t||"black"}var Ii=new o;function zi(e,t,r,l,s,o,n){rt.call(this,t,n);var u=e&&e.defaultFillColor,h=e&&e.defaultStrokeColor,a=Ii.next(),c={},p=r.computeStyle;function d(e,t){var n=F({fill:"black",strokeWidth:1,strokeLinecap:"round",strokeDasharray:"none"},t.attrs),i=t.ref||{x:0,y:0},r=t.scale||1;"none"===n.strokeDasharray&&(n.strokeDasharray=[1e4,1]);var o=Ne("marker");_e(t.element,n),ve(o,t.element),_e(o,{id:e,viewBox:"0 0 20 20",refX:i.x,refY:i.y,markerWidth:20*r,markerHeight:20*r,orient:"auto"});var a=de("defs",s._svg);a||(a=Ne("defs"),ve(s._svg,a)),ve(a,o),c[e]=o}function m(e){return e.replace(/[()\s,#]+/g,"_")}function f(e,t,n){var i=e+"-"+m(t)+"-"+m(n)+"-"+a;return c[i]||function(e,t,n,i){if("sequenceflow-end"===t){var r=Ne("path");_e(r,{d:"M 1 5 L 11 10 L 1 15 Z"}),d(e,{element:r,ref:{x:11,y:10},scale:.5,attrs:{fill:i,stroke:i}})}if("messageflow-start"===t){var o=Ne("circle");_e(o,{cx:6,cy:6,r:3.5}),d(e,{element:o,attrs:{fill:n,stroke:i},ref:{x:6,y:6}})}if("messageflow-end"===t){var a=Ne("path");_e(a,{d:"m 1 5 l 0 -3 l 7 3 l -7 3 z"}),d(e,{element:a,attrs:{fill:n,stroke:i,strokeLinecap:"butt"},ref:{x:8.5,y:5}})}if("association-start"===t){var s=Ne("path");_e(s,{d:"M 11 5 L 1 10 L 11 15"}),d(e,{element:s,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:1,y:10},scale:.5})}if("association-end"===t){var c=Ne("path");_e(c,{d:"M 1 5 L 11 10 L 1 15"}),d(e,{element:c,attrs:{fill:"none",stroke:i,strokeWidth:1.5},ref:{x:12,y:10},scale:.5})}if("conditional-flow-marker"===t){var p=Ne("path");_e(p,{d:"M 0 10 L 8 6 L 16 10 L 8 14 Z"}),d(e,{element:p,attrs:{fill:n,stroke:i},ref:{x:-1,y:10},scale:.5})}if("conditional-default-flow-marker"===t){var l=Ne("path");_e(l,{d:"M 6 4 L 10 16"}),d(e,{element:l,attrs:{stroke:i},ref:{x:0,y:10},scale:.5})}}(i,e,t,n),"url(#"+i+")"}function y(e,t,n,i,r){P(i)&&(r=i,i=0),i=i||0,"none"===(r=p(r,{stroke:"black",strokeWidth:2,fill:"white"})).fill&&delete r.fillOpacity;var o=t/2,a=n/2,s=Ne("circle");return _e(s,{cx:o,cy:a,r:Math.round((t+n)/4-i)}),_e(s,r),ve(e,s),s}function v(e,t,n,i,r,o){P(r)&&(o=r,r=0),r=r||0,o=p(o,{stroke:"black",strokeWidth:2,fill:"white"});var a=Ne("rect");return _e(a,{x:r,y:r,width:t-2*r,height:n-2*r,rx:i,ry:i}),_e(a,o),ve(e,a),a}function g(e,t,n){var i=st(t,n=p(n,["no-fill"],{stroke:"black",strokeWidth:2,fill:"none"}));return ve(e,i),i}function b(e,t,n){n=p(n,["no-fill"],{strokeWidth:2,stroke:"black"});var i=Ne("path");return _e(i,{d:t}),_e(i,n),ve(e,i),i}function i(e,t,n,i){return b(t,n,F({"data-marker":e},i))}function x(n){return function(e,t){return R[n](e,t)}}function _(e){return R[e]}function E(e,t){var n,i=Oi(e),r="bpmn:IntermediateThrowEvent"===(n=i).$type||"bpmn:EndEvent"===n.$type;return i.eventDefinitions&&1e?t.width:e},0),g=p.top;"middle"===c.vertical&&(g+=(a.height-y)/2),g-=(u||d[0].height)/4;var b=Ne("text");return _e(b,s),M(d,function(e){var t;switch(g+=u||e.height,c.horizontal){case"left":t=p.left;break;case"right":t=(l?v:m)-p.right-e.width;break;default:t=Math.max(((l?v:m)-e.width)/2+p.left,0)}var n=Ne("tspan");_e(n,{x:t,y:g}),n.textContent=e.text,ve(b,n)}),Ae(f),{dimensions:{width:v,height:y},element:b}};function qi(e){var i=F({fontFamily:"Arial, sans-serif",fontSize:12,fontWeight:"normal",lineHeight:1.2},e&&e.defaultStyle||{}),t=parseInt(i.fontSize,10)-1,r=F({},i,{fontSize:t},e&&e.externalStyle||{}),o=new Ui({style:i});this.getExternalLabelBounds=function(e,t){var n=o.getDimensions(t,{box:{width:90,height:30,x:e.width/2+e.x,y:e.height/2+e.y},style:r});return{x:Math.round(e.x+e.width/2-n.width/2),y:Math.round(e.y),width:Math.ceil(n.width),height:Math.ceil(n.height)}},this.getTextAnnotationBounds=function(e,t){var n=o.getDimensions(t,{box:e,style:i,align:"left-top",padding:5});return{x:e.x,y:e.y,width:e.width,height:Math.max(30,Math.round(n.height))}},this.createText=function(e,t){return o.createText(e,t||{})},this.getDefaultStyle=function(){return i},this.getExternalStyle=function(){return r}}qi.$inject=["config.textRenderer"];var Yi=/\{([^}]+)\}/g,Ki=/(?:(?:^|\.)(.+?)(?=\[|\.|$|\()|\[('|")(.+?)\2\])(\(\))?/g;var Xi={__init__:["bpmnRenderer"],bpmnRenderer:["type",zi],textRenderer:["type",qi],pathMap:["type",function(){this.pathMap={EVENT_MESSAGE:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:36,width:36,heightElements:[6,14],widthElements:[10.5,21]},EVENT_SIGNAL:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x1},0 Z",height:36,width:36,heightElements:[18],widthElements:[10,20]},EVENT_ESCALATION:{d:"M {mx},{my} l {e.x0},{e.y0} l -{e.x0},-{e.y1} l -{e.x0},{e.y1} Z",height:36,width:36,heightElements:[20,7],widthElements:[8]},EVENT_CONDITIONAL:{d:"M {e.x0},{e.y0} l {e.x1},0 l 0,{e.y2} l -{e.x1},0 Z M {e.x2},{e.y3} l {e.x0},0 M {e.x2},{e.y4} l {e.x0},0 M {e.x2},{e.y5} l {e.x0},0 M {e.x2},{e.y6} l {e.x0},0 M {e.x2},{e.y7} l {e.x0},0 M {e.x2},{e.y8} l {e.x0},0 ",height:36,width:36,heightElements:[8.5,14.5,18,11.5,14.5,17.5,20.5,23.5,26.5],widthElements:[10.5,14.5,12.5]},EVENT_LINK:{d:"m {mx},{my} 0,{e.y0} -{e.x1},0 0,{e.y1} {e.x1},0 0,{e.y0} {e.x0},-{e.y2} -{e.x0},-{e.y2} z",height:36,width:36,heightElements:[4.4375,6.75,7.8125],widthElements:[9.84375,13.5]},EVENT_ERROR:{d:"m {mx},{my} {e.x0},-{e.y0} {e.x1},-{e.y1} {e.x2},{e.y2} {e.x3},-{e.y3} -{e.x4},{e.y4} -{e.x5},-{e.y5} z",height:36,width:36,heightElements:[.023,8.737,8.151,16.564,10.591,8.714],widthElements:[.085,6.672,6.97,4.273,5.337,6.636]},EVENT_CANCEL_45:{d:"m {mx},{my} -{e.x1},0 0,{e.x0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:36,width:36,heightElements:[4.75,8.5],widthElements:[4.75,8.5]},EVENT_COMPENSATION:{d:"m {mx},{my} {e.x0},-{e.y0} 0,{e.y1} z m {e.x1},-{e.y2} {e.x2},-{e.y3} 0,{e.y1} -{e.x2},-{e.y3} z",height:36,width:36,heightElements:[6.5,13,.4,6.1],widthElements:[9,9.3,8.7]},EVENT_TIMER_WH:{d:"M {mx},{my} l {e.x0},-{e.y0} m -{e.x0},{e.y0} l {e.x1},{e.y1} ",height:36,width:36,heightElements:[10,2],widthElements:[3,7]},EVENT_TIMER_LINE:{d:"M {mx},{my} m {e.x0},{e.y0} l -{e.x1},{e.y1} ",height:36,width:36,heightElements:[10,3],widthElements:[0,0]},EVENT_MULTIPLE:{d:"m {mx},{my} {e.x1},-{e.y0} {e.x1},{e.y0} -{e.x0},{e.y1} -{e.x2},0 z",height:36,width:36,heightElements:[6.28099,12.56199],widthElements:[3.1405,9.42149,12.56198]},EVENT_PARALLEL_MULTIPLE:{d:"m {mx},{my} {e.x0},0 0,{e.y1} {e.x1},0 0,{e.y0} -{e.x1},0 0,{e.y1} -{e.x0},0 0,-{e.y1} -{e.x1},0 0,-{e.y0} {e.x1},0 z",height:36,width:36,heightElements:[2.56228,7.68683],widthElements:[2.56228,7.68683]},GATEWAY_EXCLUSIVE:{d:"m {mx},{my} {e.x0},{e.y0} {e.x1},{e.y0} {e.x2},0 {e.x4},{e.y2} {e.x4},{e.y1} {e.x2},0 {e.x1},{e.y3} {e.x0},{e.y3} {e.x3},0 {e.x5},{e.y1} {e.x5},{e.y2} {e.x3},0 z",height:17.5,width:17.5,heightElements:[8.5,6.5312,-6.5312,-8.5],widthElements:[6.5,-6.5,3,-3,5,-5]},GATEWAY_PARALLEL:{d:"m {mx},{my} 0,{e.y1} -{e.x1},0 0,{e.y0} {e.x1},0 0,{e.y1} {e.x0},0 0,-{e.y1} {e.x1},0 0,-{e.y0} -{e.x1},0 0,-{e.y1} -{e.x0},0 z",height:30,width:30,heightElements:[5,12.5],widthElements:[5,12.5]},GATEWAY_EVENT_BASED:{d:"m {mx},{my} {e.x0},{e.y0} {e.x0},{e.y1} {e.x1},{e.y2} {e.x2},0 z",height:11,width:11,heightElements:[-6,6,12,-12],widthElements:[9,-3,-12]},GATEWAY_COMPLEX:{d:"m {mx},{my} 0,{e.y0} -{e.x0},-{e.y1} -{e.x1},{e.y2} {e.x0},{e.y1} -{e.x2},0 0,{e.y3} {e.x2},0 -{e.x0},{e.y1} l {e.x1},{e.y2} {e.x0},-{e.y1} 0,{e.y0} {e.x3},0 0,-{e.y0} {e.x0},{e.y1} {e.x1},-{e.y2} -{e.x0},-{e.y1} {e.x2},0 0,-{e.y3} -{e.x2},0 {e.x0},-{e.y1} -{e.x1},-{e.y2} -{e.x0},{e.y1} 0,-{e.y0} -{e.x3},0 z",height:17.125,width:17.125,heightElements:[4.875,3.4375,2.125,3],widthElements:[3.4375,2.125,4.875,3]},DATA_OBJECT_PATH:{d:"m 0,0 {e.x1},0 {e.x0},{e.y0} 0,{e.y1} -{e.x2},0 0,-{e.y2} {e.x1},0 0,{e.y0} {e.x0},0",height:61,width:51,heightElements:[10,50,60],widthElements:[10,40,50,60]},DATA_OBJECT_COLLECTION_PATH:{d:"m {mx}, {my} m 0 15 l 0 -15 m 4 15 l 0 -15 m 4 15 l 0 -15 ",height:61,width:51,heightElements:[12],widthElements:[1,6,12,15]},DATA_ARROW:{d:"m 5,9 9,0 0,-3 5,5 -5,5 0,-3 -9,0 z",height:61,width:51,heightElements:[],widthElements:[]},DATA_STORE:{d:"m {mx},{my} l 0,{e.y2} c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 l 0,-{e.y2} c -{e.x0},-{e.y1} -{e.x1},-{e.y1} -{e.x2},0c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0 m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0m -{e.x2},{e.y0}c {e.x0},{e.y1} {e.x1},{e.y1} {e.x2},0",height:61,width:61,heightElements:[7,10,45],widthElements:[2,58,60]},TEXT_ANNOTATION:{d:"m {mx}, {my} m 10,0 l -10,0 l 0,{e.y0} l 10,0",height:30,width:10,heightElements:[30],widthElements:[10]},MARKER_SUB_PROCESS:{d:"m{mx},{my} m 7,2 l 0,10 m -5,-5 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_PARALLEL:{d:"m{mx},{my} m 3,2 l 0,10 m 3,-10 l 0,10 m 3,-10 l 0,10",height:10,width:10,heightElements:[],widthElements:[]},MARKER_SEQUENTIAL:{d:"m{mx},{my} m 0,3 l 10,0 m -10,3 l 10,0 m -10,3 l 10,0",height:10,width:10,heightElements:[],widthElements:[]},MARKER_COMPENSATION:{d:"m {mx},{my} 7,-5 0,10 z m 7.1,-0.3 6.9,-4.7 0,10 -6.9,-4.7 z",height:10,width:21,heightElements:[],widthElements:[]},MARKER_LOOP:{d:"m {mx},{my} c 3.526979,0 6.386161,-2.829858 6.386161,-6.320661 0,-3.490806 -2.859182,-6.320661 -6.386161,-6.320661 -3.526978,0 -6.38616,2.829855 -6.38616,6.320661 0,1.745402 0.714797,3.325567 1.870463,4.469381 0.577834,0.571908 1.265885,1.034728 2.029916,1.35457 l -0.718163,-3.909793 m 0.718163,3.909793 -3.885211,0.802902",height:13.9,width:13.7,heightElements:[],widthElements:[]},MARKER_ADHOC:{d:"m {mx},{my} m 0.84461,2.64411 c 1.05533,-1.23780996 2.64337,-2.07882 4.29653,-1.97997996 2.05163,0.0805 3.85579,1.15803 5.76082,1.79107 1.06385,0.34139996 2.24454,0.1438 3.18759,-0.43767 0.61743,-0.33642 1.2775,-0.64078 1.7542,-1.17511 0,0.56023 0,1.12046 0,1.6807 -0.98706,0.96237996 -2.29792,1.62393996 -3.6918,1.66181996 -1.24459,0.0927 -2.46671,-0.2491 -3.59505,-0.74812 -1.35789,-0.55965 -2.75133,-1.33436996 -4.27027,-1.18121996 -1.37741,0.14601 -2.41842,1.13685996 -3.44288,1.96782996 z",height:4,width:15,heightElements:[],widthElements:[]},TASK_TYPE_SEND:{d:"m {mx},{my} l 0,{e.y1} l {e.x1},0 l 0,-{e.y1} z l {e.x0},{e.y0} l {e.x0},-{e.y0}",height:14,width:21,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_SCRIPT:{d:"m {mx},{my} c 9.966553,-6.27276 -8.000926,-7.91932 2.968968,-14.938 l -8.802728,0 c -10.969894,7.01868 6.997585,8.66524 -2.968967,14.938 z m -7,-12 l 5,0 m -4.5,3 l 4.5,0 m -3,3 l 5,0m -4,3 l 5,0",height:15,width:12.6,heightElements:[6,14],widthElements:[10.5,21]},TASK_TYPE_USER_1:{d:"m {mx},{my} c 0.909,-0.845 1.594,-2.049 1.594,-3.385 0,-2.554 -1.805,-4.62199999 -4.357,-4.62199999 -2.55199998,0 -4.28799998,2.06799999 -4.28799998,4.62199999 0,1.348 0.974,2.562 1.89599998,3.405 -0.52899998,0.187 -5.669,2.097 -5.794,4.7560005 v 6.718 h 17 v -6.718 c 0,-2.2980005 -5.5279996,-4.5950005 -6.0509996,-4.7760005 zm -8,6 l 0,5.5 m 11,0 l 0,-5"},TASK_TYPE_USER_2:{d:"m {mx},{my} m 2.162,1.009 c 0,2.4470005 -2.158,4.4310005 -4.821,4.4310005 -2.66499998,0 -4.822,-1.981 -4.822,-4.4310005 "},TASK_TYPE_USER_3:{d:"m {mx},{my} m -6.9,-3.80 c 0,0 2.25099998,-2.358 4.27399998,-1.177 2.024,1.181 4.221,1.537 4.124,0.965 -0.098,-0.57 -0.117,-3.79099999 -4.191,-4.13599999 -3.57499998,0.001 -4.20799998,3.36699999 -4.20699998,4.34799999 z"},TASK_TYPE_MANUAL:{d:"m {mx},{my} c 0.234,-0.01 5.604,0.008 8.029,0.004 0.808,0 1.271,-0.172 1.417,-0.752 0.227,-0.898 -0.334,-1.314 -1.338,-1.316 -2.467,-0.01 -7.886,-0.004 -8.108,-0.004 -0.014,-0.079 0.016,-0.533 0,-0.61 0.195,-0.042 8.507,0.006 9.616,0.002 0.877,-0.007 1.35,-0.438 1.353,-1.208 0.003,-0.768 -0.479,-1.09 -1.35,-1.091 -2.968,-0.002 -9.619,-0.013 -9.619,-0.013 v -0.591 c 0,0 5.052,-0.016 7.225,-0.016 0.888,-0.002 1.354,-0.416 1.351,-1.193 -0.006,-0.761 -0.492,-1.196 -1.361,-1.196 -3.473,-0.005 -10.86,-0.003 -11.0829995,-0.003 -0.022,-0.047 -0.045,-0.094 -0.069,-0.139 0.3939995,-0.319 2.0409995,-1.626 2.4149995,-2.017 0.469,-0.4870005 0.519,-1.1650005 0.162,-1.6040005 -0.414,-0.511 -0.973,-0.5 -1.48,-0.236 -1.4609995,0.764 -6.5999995,3.6430005 -7.7329995,4.2710005 -0.9,0.499 -1.516,1.253 -1.882,2.19 -0.37000002,0.95 -0.17,2.01 -0.166,2.979 0.004,0.718 -0.27300002,1.345 -0.055,2.063 0.629,2.087 2.425,3.312 4.859,3.318 4.6179995,0.014 9.2379995,-0.139 13.8569995,-0.158 0.755,-0.004 1.171,-0.301 1.182,-1.033 0.012,-0.754 -0.423,-0.969 -1.183,-0.973 -1.778,-0.01 -5.824,-0.004 -6.04,-0.004 10e-4,-0.084 0.003,-0.586 10e-4,-0.67 z"},TASK_TYPE_INSTANTIATING_SEND:{d:"m {mx},{my} l 0,8.4 l 12.6,0 l 0,-8.4 z l 6.3,3.6 l 6.3,-3.6"},TASK_TYPE_SERVICE:{d:"m {mx},{my} v -1.71335 c 0.352326,-0.0705 0.703932,-0.17838 1.047628,-0.32133 0.344416,-0.14465 0.665822,-0.32133 0.966377,-0.52145 l 1.19431,1.18005 1.567487,-1.57688 -1.195028,-1.18014 c 0.403376,-0.61394 0.683079,-1.29908 0.825447,-2.01824 l 1.622133,-0.01 v -2.2196 l -1.636514,0.01 c -0.07333,-0.35153 -0.178319,-0.70024 -0.323564,-1.04372 -0.145244,-0.34406 -0.321407,-0.6644 -0.522735,-0.96217 l 1.131035,-1.13631 -1.583305,-1.56293 -1.129598,1.13589 c -0.614052,-0.40108 -1.302883,-0.68093 -2.022633,-0.82247 l 0.0093,-1.61852 h -2.241173 l 0.0042,1.63124 c -0.353763,0.0736 -0.705369,0.17977 -1.049785,0.32371 -0.344415,0.14437 -0.665102,0.32092 -0.9635006,0.52046 l -1.1698628,-1.15823 -1.5667691,1.5792 1.1684265,1.15669 c -0.4026573,0.61283 -0.68308,1.29797 -0.8247287,2.01713 l -1.6588041,0.003 v 2.22174 l 1.6724648,-0.006 c 0.073327,0.35077 0.1797598,0.70243 0.3242851,1.04472 0.1452428,0.34448 0.3214064,0.6644 0.5227339,0.96066 l -1.1993431,1.19723 1.5840256,1.56011 1.1964668,-1.19348 c 0.6140517,0.40346 1.3028827,0.68232 2.0233517,0.82331 l 7.19e-4,1.69892 h 2.226848 z m 0.221462,-3.9957 c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_SERVICE_FILL:{d:"m {mx},{my} c -1.788948,0.7502 -3.8576,-0.0928 -4.6097055,-1.87438 -0.7521065,-1.78321 0.090598,-3.84627 1.8802645,-4.59604 1.78823,-0.74936 3.856881,0.0929 4.608987,1.87437 0.752106,1.78165 -0.0906,3.84612 -1.879546,4.59605 z"},TASK_TYPE_BUSINESS_RULE_HEADER:{d:"m {mx},{my} 0,4 20,0 0,-4 z"},TASK_TYPE_BUSINESS_RULE_MAIN:{d:"m {mx},{my} 0,12 20,0 0,-12 zm 0,8 l 20,0 m -13,-4 l 0,8"},MESSAGE_FLOW_MARKER:{d:"m {mx},{my} m -10.5 ,-7 l 0,14 l 21,0 l 0,-14 z l 10.5,6 l 10.5,-6"}},this.getRawPath=function(e){return this.pathMap[e].d},this.getScaledPath=function(e,t){var n,i,r=this.pathMap[e];i=t.abspos?(n=t.abspos.x,t.abspos.y):(n=t.containerWidth*t.position.mx,t.containerHeight*t.position.my);var o,a,s={};if(t.position){for(var c=t.containerHeight/r.height*t.yScaleFactor,p=t.containerWidth/r.width*t.xScaleFactor,l=0;lt.x-n&&e.y>t.y-n&&e.x=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height}function Mr(e,t,n,i,r){return e*(e*(-3*t+9*n-9*i+3*r)+6*t-12*n+6*i)-3*t+3*n}function Dr(e,t,n,i,r,o,a,s,c){null==c&&(c=1);for(var p=(c=1vr(r,a)||vr(t,i)vr(o,s))){var c=(e-n)*(o-s)-(t-i)*(r-a);if(c){var p=((e*i-t*n)*(r-a)-(e-n)*(r*s-o*a))/c,l=((e*i-t*n)*(o-s)-(t-i)*(r*s-o*a))/c,u=+p.toFixed(2),h=+l.toFixed(2);if(!(u<+yr(e,n).toFixed(2)||u>+vr(e,n).toFixed(2)||u<+yr(r,a).toFixed(2)||u>+vr(r,a).toFixed(2)||h<+yr(t,i).toFixed(2)||h>+vr(t,i).toFixed(2)||h<+yr(o,s).toFixed(2)||h>+vr(o,s).toFixed(2)))return{x:p,y:l}}}}function Nr(e,t,n){var i,r,o=Pr(e),a=Pr(t);if(r=a,i=Cr(i=o),!(kr(r=Cr(r),i.x,i.y)||kr(r,i.x2,i.y)||kr(r,i.x,i.y2)||kr(r,i.x2,i.y2)||kr(i,r.x,r.y)||kr(i,r.x2,r.y)||kr(i,r.x,r.y2)||kr(i,r.x2,r.y2)||(i.xr.x||r.xi.x)&&(i.yr.y||r.yi.y)))return n?0:[];for(var s=~~(Dr.apply(0,e)/5),c=~~(Dr.apply(0,t)/5),p=[],l=[],u={},h=n?0:[],d=0;d=o[r]&&(a.push([t].concat(i.splice(0,o[r]))),o[r]););}),a.toString=Sr.toString,t.arr=wr(a),a}(e)),!e||!e.length)return[["M",0,0]];var n,i=[],r=0,o=0,a=0,s=0,c=0;"M"==e[0][0]&&(a=r=+e[0][1],s=o=+e[0][2],c++,i[0]=["M",r,o]);for(var p,l,u=3==e.length&&"M"==e[0][0]&&"R"==e[1][0].toUpperCase()&&"Z"==e[2][0].toUpperCase(),h=c,d=e.length;hm){var P=R,k=s,M=c;R=T+m*(a&&T=r.right,s=i.top-n.y>=r.bottom,c=o?"top":s?"bottom":null,p=i.right+n.x<=r.left?"left":a?"right":null;return p&&c?c+"-"+p:p||c||"intersect"}function Kr(e,t,n){var i=Gr(e,t);return 1===i.length?Vr(i[0]):2===i.length&&or(i[0],i[1])<1?Vr(i[0]):1=p.x&&u<=p.x+p.width&&h>=p.y&&h<=p.y+p.height||(t=this._canvas.getRootElement())),this._canvas.addShape(n,t,r)}else{if(!Ti(d,"bpmndi:BPMNEdge"))throw new Error(m("unknown di {di} for element {semantic}",{di:Ei(d),semantic:Ei(e)}));var v=this._getSource(e),g=this._getTarget(e);i=t&&(t.hidden||t.collapsed),n=this._elementFactory.createConnection(Zr(e,{hidden:i,source:v,target:g,waypoints:(o=e,a=v,s=g,c=o.di.waypoint,!c||c.length<2?[qr(a),qr(s)]:c.map(function(e){return{x:e.x,y:e.y}}))})),Ti(e,"bpmn:DataAssociation")&&(t=null),Ti(e,"bpmn:SequenceFlow")&&(r=0),this._canvas.addConnection(n,t,r)}return er(e)&&Di(n)&&this.addLabel(e,n),this._eventBus.fire("bpmnElement.added",{element:n}),n},Jr.prototype._attachBoundary=function(e,t){var n=this._translate,i=e.attachedToRef;if(!i)throw new Error(n("missing {semantic}#attachedToRef",{semantic:Ei(e)}));var r=this._elementRegistry.get(i.id),o=r&&r.attachers;if(!r)throw Qr(n,e,i,"attachedToRef");t.host=r,o||(r.attachers=o=[]),-1===o.indexOf(t)&&o.push(t)},Jr.prototype.addLabel=function(e,t){var n,i,r,o,a,s,c,p;return o=t,(p=e.di.label)&&p.bounds?(c=p.bounds,s={width:Math.max(Qi.width,c.width),height:c.height},a={x:c.x+c.width/2,y:c.y+c.height/2}):(a=ir(o),s=Qi),n=F({x:a.x-s.width/2,y:a.y-s.height/2},s),(i=Di(t))&&(n=this._textRenderer.getExternalLabelBounds(n,i)),r=this._elementFactory.createLabel(Zr(e,{id:e.id+"_label",labelTarget:t,type:"label",hidden:t.hidden||!Di(t),x:Math.round(n.x),y:Math.round(n.y),width:Math.round(n.width),height:Math.round(n.height)})),this._canvas.addShape(r,t.parent)},Jr.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?Qr(o,e,i,t+"Ref"):new Error(o("{semantic}#{side} Ref not specified",{semantic:Ei(e),side:t}))},Jr.prototype._getSource=function(e){return this._getEnd(e,"source")},Jr.prototype._getTarget=function(e){return this._getEnd(e,"target")},Jr.prototype._getElement=function(e){return this._elementRegistry.get(e.id)};var eo={__depends__:[Xi,{__depends__:[Zi],bpmnImporter:["type",Jr]}]};function to(e){e&&"function"==typeof e.stopPropagation&&e.stopPropagation()}function no(e){return e.originalEvent||e.srcEvent}function io(e,t){to(e),to(no(e))}function ro(e){return e.pointers&&e.pointers.length&&(e=e.pointers[0]),e.touches&&e.touches.length&&(e=e.touches[0]),e?{x:e.clientX,y:e.clientY}:null}function oo(e){return!(no(e)||e).button}function ao(e){var t=no(e)||e;return!!oo(e)&&(/mac/i.test(navigator.platform)?t.metaKey:t.ctrlKey)}function so(e){return!0}function co(a,s,e){var r=e.cls("djs-hit",["no-fill","no-border"],{stroke:"white",strokeWidth:15});function o(e,t,n){var i,r,o;(i=t,(u[e]||oo)(i))&&(n?o=s.getGraphics(n):(r=t.delegateTarget||t.target)&&(o=r,n=s.get(o)),o&&n&&!1===a.fire(e,{element:n,gfx:o,originalEvent:t})&&(t.stopPropagation(),t.preventDefault()))}var c={};function p(e){return c[e]}var l={mouseover:"element.hover",mouseout:"element.out",click:"element.click",dblclick:"element.dblclick",mousedown:"element.mousedown",mousemove:"element.mousemove",mouseup:"element.mouseup",contextmenu:"element.contextmenu"},u={"element.contextmenu":so};var h="svg, .djs-element";function i(e,t,n,i){var r=c[n]=function(e){o(n,e)};i&&(u[n]=i),r.$delegate=ae.bind(e,h,t,r)}function d(e,t,n){var i=p(n);i&&ae.unbind(e,t,i.$delegate)}a.on("canvas.destroy",function(e){var n;n=e.svg,M(l,function(e,t){d(n,t,e)})}),a.on("canvas.init",function(e){var n;n=e.svg,M(l,function(e,t){i(n,t,e)})}),a.on(["shape.added","connection.added"],function(e){var t,n=e.element,i=e.gfx;n.waypoints?t=st(n.waypoints):_e(t=Ne("rect"),{x:0,y:0,width:n.width,height:n.height}),_e(t,r),ve(i,t)}),a.on("shape.changed",500,function(e){var t=e.element;_e(de(".djs-hit",e.gfx),{width:t.width,height:t.height})}),a.on("connection.changed",function(e){var t,n,i=e.element,r=de(".djs-hit",e.gfx);t=r,n=i.waypoints,_e(t,{points:at(n)})}),this.fire=o,this.triggerMouseEvent=function(e,t,n){var i=l[e];if(!i)throw new Error("unmapped DOM event name <"+e+">");return o(i,t,n)},this.mouseHandler=p,this.registerEvent=i,this.unregisterEvent=d}co.$inject=["eventBus","elementRegistry","styles"];var po={__init__:["interactionEvents"],interactionEvents:["type",co]};function lo(e,t,n){this.offset=6;var i=t.cls("djs-outline",["no-fill"]),r=this;function o(e,t){var n=Ne("rect");return _e(n,F({x:10,y:10,width:100,height:100},i)),ve(e,n),n}e.on(["shape.added","shape.changed"],500,function(e){var t=e.element,n=e.gfx,i=de(".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=de(".djs-outline",n);i||(i=o(n)),r.updateConnectionOutline(i,t)})}lo.prototype.updateShapeOutline=function(e,t){_e(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},lo.prototype.updateConnectionOutline=function(e,t){var n=ut(t);_e(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},lo.$inject=["eventBus","styles","elementRegistry"];var uo={__init__:["outline"],outline:["type",lo]};function ho(e){this._eventBus=e,this._selectedElements=[];var n=this;e.on(["shape.remove","connection.remove"],function(e){var t=e.element;n.deselect(t)}),e.on(["diagram.clear"],function(e){n.select(null)})}ho.$inject=["eventBus"],ho.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})}},ho.prototype.get=function(){return this._selectedElements},ho.prototype.isSelected=function(e){return-1!==this._selectedElements.indexOf(e)},ho.prototype.select=function(e,t){var n=this._selectedElements,i=n.slice();g(e)||(e=e?[e]:[]),t?M(e,function(e){-1===n.indexOf(e)&&n.push(e)}):this._selectedElements=n=e.slice(),this._eventBus.fire("selection.changed",{oldSelection:i,newSelection:n})};var mo="selected";function fo(e,n,t,i){function r(e,t){n.addMarker(e,t)}function o(e,t){n.removeMarker(e,t)}this._multiSelectionBox=null,e.on("element.hover",function(e){r(e.element,"hover")}),e.on("element.out",function(e){o(e.element,"hover")}),e.on("selection.changed",function(e){var t=e.oldSelection,n=e.newSelection;M(t,function(e){-1===n.indexOf(e)&&o(e,mo)}),M(n,function(e){-1===t.indexOf(e)&&r(e,mo)})})}function yo(e,o,a,i){e.on("create.end",500,function(e){e.context.canExecute&&o.select(e.context.shape)}),e.on("connect.end",500,function(e){e.context.canExecute&&e.context.target&&o.select(e.context.target)}),e.on("shape.move.end",500,function(e){var t=e.previousSelection||[],n=i.get(e.context.shape.id);A(t,function(e){return n.id===e.id})||o.select(n)}),e.on("element.click",function(e){var t=e.element;t===a.getRootElement()&&(t=null);var n=o.isSelected(t),i=1'),r.insertBefore(o,r.firstChild),o),this._init()}function _o(e,t,n){F(e.style,{left:t+"px",top:n+"px"})}function Eo(e,t){e.style.display=!1===t?"none":""}function wo(t,n){t.style["transform-origin"]="top left",["","-ms-","-webkit-"].forEach(function(e){t.style[e+"transform"]=n})}xo.$inject=["config.overlays","eventBus","canvas","elementRegistry"],xo.prototype.get=function(e){if(d(e)&&(e={id:e}),d(e.element)&&(e.element=this._elementRegistry.get(e.element)),e.element){var t=this._getOverlayContainer(e.element,!0);return t?e.type?k(t.overlays,D({type:e.type})):t.overlays.slice():[]}return e.type?k(this._overlays,D({type:e.type})):e.id?this._overlays[e.id]:null},xo.prototype.add=function(e,t,n){if(P(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=F({},this._overlayDefaults,n,{id:i,type:t,element:e,html:n.html}),this._addOverlay(n),i},xo.prototype.remove=function(e){var t=this.get(e)||[];g(t)||(t=[t]);var i=this;M(t,function(e){var t=i._getOverlayContainer(e.element,!0);if(e&&(fe(e.html),fe(e.htmlContainer),delete e.htmlContainer,delete e.element,delete i._overlays[e.id]),t){var n=t.overlays.indexOf(e);-1!==n&&t.overlays.splice(n,1)}})},xo.prototype.show=function(){Eo(this._overlayRoot)},xo.prototype.hide=function(){Eo(this._overlayRoot,!1)},xo.prototype.clear=function(){this._overlays={},this._overlayContainers=[],K(this._overlayRoot)},xo.prototype._updateOverlayContainer=function(e){var t=e.element,n=e.html,i=t.x,r=t.y;if(t.waypoints){var o=ut(t);i=o.x,r=o.y}_o(n,i,r),G(e.html,"data-container-id",t.id)},xo.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?ut(o).width:o.width,a=-1*i.right+t);void 0!==i.bottom&&(n=o.waypoints?ut(o).height:o.height,s=-1*i.bottom+n);_o(r,a||0,s||0)},xo.prototype._createOverlayContainer=function(e){var t=se('
');this._overlayRoot.appendChild(t);var n={html:t,element:e,overlays:[]};return this._updateOverlayContainer(n),this._overlayContainers.push(n),n},xo.prototype._updateRoot=function(e){var t=e.scale||1,n="matrix("+[t,0,0,t,-1*e.x*t,-1*e.y*t].join(",")+")";wo(this._overlayRoot,n)},xo.prototype._getOverlayContainer=function(t,e){var n=A(this._overlayContainers,function(e){return e.element===t});return n||e?n:this._createOverlayContainer(t)},xo.prototype._addOverlay=function(e){var t,n,i=e.id,r=e.element,o=e.html;o.get&&o.constructor.prototype.jquery&&(o=o.get(0)),d(o)&&(o=se(o)),n=this._getOverlayContainer(r),(t=se('
')).appendChild(o),e.type&&q(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())},xo.prototype._updateOverlayVisibilty=function(e,t){var n=e.show,i=n&&n.minZoom,r=n&&n.maxZoom,o=e.htmlContainer,a=!0;n&&((c(i)&&i>t.scale||c(r)&&ri&&(r=(1/t.scale||1)*i)),c(r)&&(s="scale("+r+","+r+")"),wo(a,s)},xo.prototype._updateOverlaysVisibilty=function(t){var n=this;M(this._overlays,function(e){n._updateOverlayVisibilty(e,t)})},xo.prototype._init=function(){var e=this._eventBus,r=this;e.on("canvas.viewbox.changing",function(e){r.hide()}),e.on("canvas.viewbox.changed",function(e){var t;t=e.viewbox,r._updateRoot(t),r._updateOverlaysVisibilty(t),r.show()}),e.on(["shape.remove","connection.remove"],function(e){var t=e.element;M(r.get({element:t}),function(e){r.remove(e.id)});var n=r._getOverlayContainer(t);if(n){fe(n.html);var i=r._overlayContainers.indexOf(n);-1!==i&&r._overlayContainers.splice(i,1)}}),e.on("element.changed",500,function(e){var t=e.element,n=r._getOverlayContainer(t,!0);n&&(M(n.overlays,function(e){r._updateOverlay(e)}),r._updateOverlayContainer(n))}),e.on("element.marker.update",function(e){var t=r._getOverlayContainer(e.element,!0);t&&q(t.html)[e.add?"add":"remove"](e.marker)}),e.on("diagram.clear",this.clear,this)};var So={__init__:["overlays"],overlays:["type",xo]},Co=''))+'" />'; /** * This file must not be changed or exchanged. * * @see http://bpmn.io/license for more information. */function To(e){return e.join(";")}var Ro,Ao='
'+Co+'Web-based tooling for BPMN, DMN and CMMN diagrams powered by bpmn.io.
';var Po={width:"100%",height:"100%",position:"relative"};function ko(e){return e+(l(e)?"px":"")}function Mo(e){ /** * Adds the project logo to the diagram container as * required by the bpmn.io license. * * @see http://bpmn.io/license * * @param {Element} container */ var t,n;e=F({},Po,e),this._moddle=this._createModdle(e),this._container=this._createContainer(e),t=this._container,n=se(''+Co+""),t.appendChild(n),re.bind(n,"click",function(e){Ro||(Ro=se(Ao),ae.bind(Ro,".backdrop","click",function(e){document.body.removeChild(Ro)})),document.body.appendChild(Ro),e.preventDefault()}),this._init(this._container,this._moddle,e)}function Do(e){return!e.altKey&&(e.ctrlKey||e.metaKey)}function Bo(e,t){return-1<(e=g(e)?e:[e]).indexOf(t.key)}function No(e){return e.shiftKey}t(Mo,rn),Mo.prototype.importXML=function(e,a,s){u(a)&&(s=a,a=null),s=s||function(){};var c=this;e=this._emit("import.parse.start",{xml:e})||e,this._moddle.fromXML(e,"bpmn:Definitions",function(e,t,n){t=c._emit("import.parse.complete",{error:e,definitions:t,context:n})||t;var i,r,o=n.warnings;if(e)return(r=/unparsable content <([^>]+)> detected([\s\S]*)$/.exec((i=e).message))&&(i.message="unparsable content <"+r[1]+"> detected; this may indicate an invalid BPMN 2.0 diagram file"+r[2]),e=i,c._emit("import.done",{error:e,warnings:o}),s(e,o);c.importDefinitions(t,a,function(e,t){var n=[].concat(o,t||[]);c._emit("import.done",{error:e,warnings:n}),s(e,n)})})},Mo.prototype.importDefinitions=function(e,t,n){return u(t)&&(n=t,t=null),n=n||function(){},this._setDefinitions(e),this.open(t,n)},Mo.prototype.open=function(e,t){u(e)&&(t=e,e=null);var n,i,r=this._definitions,o=e;if(t=t||function(){},!r)return t(new Error("no XML imported"));if("string"==typeof e&&(n=r,!(o=(i=e)&&A(n.diagrams,function(e){return e.id===i})||null)))return t(new Error("BPMNDiagram <"+e+"> not found"));try{this.clear()}catch(e){return t(e)}return function(e,t,n,i){var r,o,a;u(n)&&(i=n,n=null);var s,c,p,l=[];try{r=e.get("bpmnImporter"),o=e.get("eventBus"),a=e.get("translate"),o.fire("import.render.start",{definitions:t}),c=t,p=n,new Ci({root:function(e){return r.add(e)},element:function(e,t){return r.add(e,t)},error:function(e,t){l.push({message:e,context:t})}},a).handleDefinitions(c,p),o.fire("import.render.complete",{error:s,warnings:l})}catch(e){s=e}i(s,l)}(this,r,o,t)},Mo.prototype.saveXML=function(e,n){n||(n=e,e={});var i=this,t=this._definitions;if(!t)return n(new Error("no definitions loaded"));t=this._emit("saveXML.start",{definitions:t})||t,this._moddle.toXML(t,e,function(e,t){try{t=i._emit("saveXML.serialized",{error:e,xml:t})||t,i._emit("saveXML.done",{error:e,xml:t})}catch(e){console.error("error in saveXML life-cycle listener",e)}n(e,t)})},Mo.prototype.saveSVG=function(e,t){var n,i;t||(t=e,e={}),this._emit("saveSVG.start");try{var r=this.get("canvas"),o=r.getDefaultLayer(),a=de("defs",r._svg),s=Ve(o),c=a?""+Ve(a)+"":"",p=o.getBBox();n='\n\x3c!-- created with bpmn-js / http://bpmn.io --\x3e\n\n'+c+s+""}catch(e){i=e}this._emit("saveSVG.done",{error:i,svg:n}),t(i,n)},Mo.prototype._setDefinitions=function(e){this._definitions=e},Mo.prototype.getModules=function(){return this._modules},Mo.prototype.clear=function(){this.get("elementRegistry").forEach(function(e){var t=e.businessObject;t&&t.di&&delete t.di}),rn.prototype.clear.call(this)},Mo.prototype.destroy=function(){rn.prototype.destroy.call(this),fe(this._container)},Mo.prototype.on=function(e,t,n,i){return this.get("eventBus").on(e,t,n,i)},Mo.prototype.off=function(e,t){this.get("eventBus").off(e,t)},Mo.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=de(e)),e.appendChild(this._container),this._emit("attach",{}),this.get("canvas").resized()},Mo.prototype.getDefinitions=function(){return this._definitions},Mo.prototype.detach=function(){var e=this._container,t=e.parentNode;t&&(this._emit("detach",{}),t.removeChild(e))},Mo.prototype._init=function(e,t,n){var i,r,o=n.modules||this.getModules(),a=n.additionalModules||[],s=[].concat([{bpmnjs:["value",this],moddle:["value",t]}],o,a),c=F((i=["additionalModules"],r={},M(Object(n),function(e,t){-1===i.indexOf(t)&&(r[t]=e)}),r),{canvas:F({},n.canvas,{container:e}),modules:s});rn.call(this,c),n&&n.container&&this.attachTo(n.container)},Mo.prototype._emit=function(e,t){return this.get("eventBus").fire(e,t)},Mo.prototype._createContainer=function(e){var t=se('
');return F(t.style,{width:ko(e.width),height:ko(e.height),position:e.position}),t},Mo.prototype._createModdle=function(e){return new _i(F({},this._moddleExtensions,e.moddleExtensions))},Mo.prototype._modules=[eo,Zi,vo,So],Mo.prototype._moddleExtensions={};var Oo="keyboard.keydown";function Lo(e,t){var n=this;this._config=e||{},this._eventBus=t,this._keydownHandler=this._keydownHandler.bind(this),this._keyupHandler=this._keyupHandler.bind(this),t.on("diagram.destroy",function(){n._fire("destroy"),n.unbind()}),t.on("diagram.init",function(){n._fire("init")}),t.on("attach",function(){e&&e.bindTo&&n.bind(e.bindTo)}),t.on("detach",function(){n.unbind()})}Lo.$inject=["config.keyboard","eventBus"],Lo.prototype._keydownHandler=function(e){this._keyHandler(e,Oo)},Lo.prototype._keyupHandler=function(e){this._keyHandler(e,"keyboard.keyup")},Lo.prototype._keyHandler=function(e,t){var n=e.target;if(!(i=n)||!he(i,"input, textarea")&&"true"!==i.contentEditable){var i,r={keyEvent:e};this._eventBus.fire(t||Oo,r)&&e.preventDefault()}},Lo.prototype.bind=function(e){this.unbind(),this._node=e,re.bind(e,"keydown",this._keydownHandler,!0),re.bind(e,"keyup",this._keyupHandler,!0),this._fire("bind")},Lo.prototype.getBinding=function(){return this._node},Lo.prototype.unbind=function(){var e=this._node;e&&(this._fire("unbind"),re.unbind(e,"keydown",this._keydownHandler,!0),re.unbind(e,"keyup",this._keyupHandler,!0)),this._node=null},Lo.prototype._fire=function(e){this._eventBus.fire("keyboard."+e,{node:this._node})},Lo.prototype.addListener=function(e,t,n){u(e)&&(n=t,t=e,e=1e3),this._eventBus.on(n||Oo,e,t)},Lo.prototype.removeListener=function(e,t){this._eventBus.off(t||Oo,e)},Lo.prototype.hasModifier=function(e){return e.ctrlKey||e.metaKey||e.shiftKey||e.altKey},Lo.prototype.isCmd=Do,Lo.prototype.isShift=No,Lo.prototype.isKey=Bo;var jo=500;function Io(e,n){var i=this;e.on("editorActions.init",jo,function(e){var t=e.editorActions;i.registerBindings(n,t)})}Io.$inject=["eventBus","keyboard"],Io.prototype.registerBindings=function(n,i){function e(e,t){i.isRegistered(e)&&n.addListener(t)}e("undo",function(e){var t=e.keyEvent;if(Do(t)&&!No(t)&&Bo(["z","Z"],t))return i.trigger("undo"),!0}),e("redo",function(e){var t=e.keyEvent;if(Do(t)&&(Bo(["y","Y"],t)||Bo(["z","Z"],t)&&No(t)))return i.trigger("redo"),!0}),e("copy",function(e){var t=e.keyEvent;if(Do(t)&&Bo(["c","C"],t))return i.trigger("copy"),!0}),e("paste",function(e){var t=e.keyEvent;if(Do(t)&&Bo(["v","V"],t))return i.trigger("paste"),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Bo(["+","Add"],t)&&Do(t))return i.trigger("stepZoom",{value:1}),!0}),e("stepZoom",function(e){var t=e.keyEvent;if(Bo(["-","Subtract"],t)&&Do(t))return i.trigger("stepZoom",{value:-1}),!0}),e("zoom",function(e){var t=e.keyEvent;if(Bo("0",t)&&Do(t))return i.trigger("zoom",{value:1}),!0}),e("removeSelection",function(e){if(Bo(["Delete","Del"],e.keyEvent))return i.trigger("removeSelection"),!0})};var zo={__init__:["keyboard","keyboardBindings"],keyboard:["type",Lo],keyboardBindings:["type",Io]},Fo={moveSpeed:50,moveSpeedAccelerated:200};function $o(e,o,r){var a=this;this._config=F({},Fo,e||{}),o.addListener(function(e){var t=e.keyEvent,n=a._config;if(!o.isCmd(t))return;if(o.isKey(["ArrowLeft","Left","ArrowUp","Up","ArrowDown","Down","ArrowRight","Right"],t)){var i,r=o.isShift(t)?n.moveSpeedAccelerated:n.moveSpeed;switch(t.key){case"ArrowLeft":case"Left":i="left";break;case"ArrowUp":case"Up":i="up";break;case"ArrowRight":case"Right":i="right";break;case"ArrowDown":case"Down":i="down"}return a.moveCanvas({speed:r,direction:i}),!0}}),this.moveCanvas=function(e){var t=0,n=0,i=e.speed/Math.min(Math.sqrt(r.viewbox().scale),1);switch(e.direction){case"left":t=i;break;case"up":n=i;break;case"right":t=-i;break;case"down":n=-i}r.scroll({dx:t,dy:n})}}$o.$inject=["config.keyboardMove","keyboard","canvas"];var Go={__depends__:[zo],__init__:["keyboardMove"],keyboardMove:["type",$o]},Ho=/^djs-cursor-.*$/;function Vo(e){var t=q(document.body);t.removeMatching(Ho),e&&t.add("djs-cursor-"+e)}function Wo(){Vo(null)}var Uo=5e3;function qo(e,t){function n(){return!1}return t=t||"element.click",e.once(t,Uo,n),function(){e.off(t,n)}}function Yo(e){return{x:e.x+e.width/2,y:e.y+e.height/2}}function Ko(e,t){return{x:e.x-t.x,y:e.y-t.y}}function Xo(o,a){var s;function t(e){var t,n=s.start,i=ro(e),r=Ko(i,n);(!s.dragging&&(t=r,15\s*\(/gm,"{anonymous}()@"):"Unknown Stack Trace",n=o.console&&(o.console.warn||o.console.log);return n&&n.call(o.console,r,t),i.apply(this,arguments)}}a="function"!=typeof Object.assign?function(e){if(e===f||null===e)throw new TypeError("Cannot convert undefined or null to object");for(var t=Object(e),n=1;nt[n]}):i.sort()),i}function P(e,t){for(var n,i,r=t[0].toUpperCase()+t.slice(1),o=0;oy(p.y)?p.x:p.y,t.scale=a?(h=a.pointers,d=i,ne(d[0],d[1],K)/ne(h[0],h[1],K)):1,t.rotation=a?(l=a.pointers,u=i,ie(u[1],u[0],K)+ie(l[1],l[0],K)):0,t.maxPointers=n.prevInput?t.pointers.length>n.prevInput.maxPointers?t.pointers.length:n.prevInput.maxPointers:t.pointers.length,function(e,t){var n,i,r,o,a=e.lastInterval||t,s=t.timeStamp-a.timeStamp;if(t.eventType!=z&&(Ly(l.y)?l.x:l.y,o=te(c,p),e.lastInterval=t}else n=a.velocity,i=a.velocityX,r=a.velocityY,o=a.direction;t.velocity=n,t.velocityX=i,t.velocityY=r,t.direction=o}(n,t);var l,u;var h,d;var m=e.element;w(t.srcEvent.target,m)&&(m=t.srcEvent.target);t.target=m}(e,n),e.emit("hammer.input",n),e.recognize(n),e.session.prevInput=n}function Q(e){for(var t=[],n=0;n=y(t)?e<0?$:G:t<0?H:V}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&&_(this.element,this.evEl,this.domHandler),this.evTarget&&_(this.target,this.evTarget,this.domHandler),this.evWin&&_(M(this.element),this.evWin,this.domHandler)},destroy:function(){this.evEl&&E(this.element,this.evEl,this.domHandler),this.evTarget&&E(this.target,this.evTarget,this.domHandler),this.evWin&&E(M(this.element),this.evWin,this.domHandler)}};var re={mousedown:j,mousemove:2,mouseup:I},oe="mousedown",ae="mousemove mouseup";function se(){this.evEl=oe,this.evWin=ae,this.pressed=!1,X.apply(this,arguments)}m(se,X,{handler:function(e){var t=re[e.type];t&j&&0===e.button&&(this.pressed=!0),2&t&&1!==e.which&&(t=I),this.pressed&&(t&I&&(this.pressed=!1),this.callback(this.manager,t,{pointers:[e],changedPointers:[e],pointerType:"mouse",srcEvent:e}))}});var ce={pointerdown:j,pointermove:2,pointerup:I,pointercancel:z,pointerout:z},pe={2:O,3:"pen",4:"mouse",5:"kinect"},le="pointerdown",ue="pointermove pointerup pointercancel";function he(){this.evEl=le,this.evWin=ue,X.apply(this,arguments),this.store=this.manager.session.pointerEvents=[]}o.MSPointerEvent&&!o.PointerEvent&&(le="MSPointerDown",ue="MSPointerMove MSPointerUp MSPointerCancel"),m(he,X,{handler:function(e){var t=this.store,n=!1,i=e.type.toLowerCase().replace("ms",""),r=ce[i],o=pe[e.pointerType]||e.pointerType,a=o==O,s=T(t,e.pointerId,"pointerId");r&j&&(0===e.button||a)?s<0&&(t.push(e),s=t.length-1):r&(I|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:j,touchmove:2,touchend:I,touchcancel:z};function me(){this.evTarget="touchstart",this.evWin="touchstart touchmove touchend touchcancel",this.started=!1,X.apply(this,arguments)}m(me,X,{handler:function(e){var t=de[e.type];if(t===j&&(this.started=!0),this.started){var n=function(e,t){var n=R(e.touches),i=R(e.changedTouches);t&(I|z)&&(n=A(n.concat(i),"identifier",!0));return[n,i]}.call(this,e,t);t&(I|z)&&n[0].length-n[1].length==0&&(this.started=!1),this.callback(this.manager,t,{pointers:n[0],changedPointers:n[1],pointerType:O,srcEvent:e})}}});var fe={touchstart:j,touchmove:2,touchend:I,touchcancel:z},ye="touchstart touchmove touchend touchcancel";function ve(){this.evTarget=ye,this.targetIds={},X.apply(this,arguments)}m(ve,X,{handler:function(e){var t=fe[e.type],n=function(e,t){var n=R(e.touches),i=this.targetIds;if(t&(2|j)&&1===n.length)return i[n[0].identifier]=!0,[n,n];var r,o,a=R(e.changedTouches),s=[],c=this.target;if(o=n.filter(function(e){return w(e.target,c)}),t===j)for(r=0;rt.threshold&&r&t.direction},attrTest:function(e){return Ne.prototype.attrTest.call(this,e)&&(2&this.state||!(2&this.state)&&this.directionTest(e))},emit:function(e){this.pX=e.deltaX,this.pY=e.deltaY;var t=De(e.direction);t&&(e.additionalEvent=this.options.event+t),this._super.emit.call(this,e)}}),m(Le,Ne,{defaults:{event:"pinch",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.scale-1)>this.options.threshold||2&this.state)},emit:function(e){if(1!==e.scale){var t=e.scale<1?"in":"out";e.additionalEvent=this.options.event+t}this._super.emit.call(this,e)}}),m(je,ke,{defaults:{event:"press",pointers:1,time:251,threshold:9},getTouchAction:function(){return["auto"]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distancet.time;if(this._input=e,!i||!n||e.eventType&(I|z)&&!r)this.reset();else if(e.eventType&j)this.reset(),this._timer=l(function(){this.state=8,this.tryEmit()},t.time,this);else if(e.eventType&I)return 8;return 32},reset:function(){clearTimeout(this._timer)},emit:function(e){8===this.state&&(e&&e.eventType&I?this.manager.emit(this.options.event+"up",e):(this._input.timeStamp=v(),this.manager.emit(this.options.event,this._input)))}}),m(Ie,Ne,{defaults:{event:"rotate",threshold:0,pointers:2},getTouchAction:function(){return[Se]},attrTest:function(e){return this._super.attrTest.call(this,e)&&(Math.abs(e.rotation)>this.options.threshold||2&this.state)}}),m(ze,Ne,{defaults:{event:"swipe",threshold:10,velocity:.3,direction:W|U,pointers:1},getTouchAction:function(){return Oe.prototype.getTouchAction.call(this)},attrTest:function(e){var t,n=this.options.direction;return n&(W|U)?t=e.overallVelocity:n&W?t=e.overallVelocityX:n&U&&(t=e.overallVelocityY),this._super.attrTest.call(this,e)&&n&e.offsetDirection&&e.distance>this.options.threshold&&e.maxPointers==this.options.pointers&&y(t)>this.options.velocity&&e.eventType&I},emit:function(e){var t=De(e.offsetDirection);t&&this.manager.emit(this.options.event+t,e),this.manager.emit(this.options.event,e)}}),m(Fe,ke,{defaults:{event:"tap",pointers:1,taps:1,interval:300,time:250,threshold:9,posThreshold:10},getTouchAction:function(){return[we]},process:function(e){var t=this.options,n=e.pointers.length===t.pointers,i=e.distancet.top&&(n=n.concat("n"));e.rightt.left&&(n=n.concat("e"));return n}($(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:o});var a=t.parent;a&&this._expand([t],a)}}},Na.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},Na.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},Na.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Oa.$inject=["injector"],t(Oa,Na),Oa.prototype.resize=function(e,t,n){Ti(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},La.$inject=["eventBus"],t(La,Ba),La.prototype.addRule=function(e,t,i){var n=this;"string"==typeof e&&(e=[e]),e.forEach(function(e){n.canExecute(e,t,function(e,t,n){return i(e)},!0)})},La.prototype.init=function(){},ja.$inject=["eventBus"],t(ja,La),ja.prototype.canResize=function(e,t){return!1},t(Ia,ja),Ia.$inject=["eventBus","modeling"],Ia.prototype.canResize=function(e,t){if(!Ti(t,"bpmn:Participant")&&!Ti(t,"bpmn:Lane")&&!Ti(t,"bpmn:SubProcess"))return!1;var n=!0;return M(e,function(e){(Ti(e,"bpmn:Lane")||e.labelTarget)&&(n=!1)}),n};var za={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Oa],bpmnAutoResizeProvider:["type",Ia]},Fa=Math.round,$a="djs-drag-active";function Ga(e){e.preventDefault()}function Ha(u,h,d){var m,f={threshold:5,trapClick:!0};function y(e){var t=h.viewbox(),n=h._container.getBoundingClientRect();return{x:t.x+(e.x-n.left)/t.scale,y:t.y+(e.y-n.top)/t.scale}}function v(e,t){t=t||m;var n=u.createEvent(F({},t.payload,t.data,{isTouch:t.isTouch}));return!1!==u.fire("drag."+e,n)&&u.fire(t.prefix+"."+e,n)}function g(e,t){var n,i=m.payload,r=m.displacement,o=m.globalStart,a=ro(e),s=Ko(a,o),c=m.localStart,p=y(a),l=Ko(p,c);if(!m.active&&(t||(n=s,Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))>m.threshold))){if(F(i,{x:Fa(c.x+r.x),y:Fa(c.y+r.y),dx:0,dy:0},{originalEvent:e}),!1===v("start"))return C();m.active=!0,m.keepSelection||(i.previousSelection=d.get(),d.select(null)),m.cursor&&Vo(m.cursor),h.addMarker(h.getRootElement(),$a)}io(e),m.active&&(F(i,{x:Fa(p.x+r.x),y:Fa(p.y+r.y),dx:Fa(l.x),dy:Fa(l.y)},{originalEvent:e}),v("move"))}function b(e){var t=!0;m.active&&(e&&io(m.payload.originalEvent=e),t=v("end")),!1===t&&v("rejected"),v("ended",i(!0!==t))}function x(e){27===e.which&&(Ga(e),C())}function _(e){var t;m.active&&(t=qo(u),setTimeout(t,400),Ga(e)),b(e)}function E(e){g(e)}function w(e){var t=m.payload;t.hoverGfx=e.gfx,t.hover=e.element,v("hover")}function S(e){v("out");var t=m.payload;t.hoverGfx=null,t.hover=null}function C(e){var t;if(m){var n=m.active;n&&v("cancel"),t=i(e),n&&v("canceled",t)}}function i(e){var t,n;v("cleanup"),Wo(),n=m.trapClick?_:b,re.unbind(document,"mousemove",g),re.unbind(document,"dragstart",Ga),re.unbind(document,"selectstart",Ga),re.unbind(document,"mousedown",n,!0),re.unbind(document,"mouseup",n,!0),re.unbind(document,"keyup",x),re.unbind(document,"touchstart",E,!0),re.unbind(document,"touchcancel",C,!0),re.unbind(document,"touchmove",g,!0),re.unbind(document,"touchend",b,!0),u.off("element.hover",w),u.off("element.out",S),h.removeMarker(h.getRootElement(),$a);var i=m.payload.previousSelection;return!1!==e&&i&&!d.get().length&&d.select(i),t=m,m=null,t}u.on("diagram.destroy",C),this.init=function(e,t,n,i){m&&C(!1),"string"==typeof t&&(i=n,n=t,t=null);var r,o,a,s,c,p,l=(i=F({},f,i||{})).data||{};s=i.trapClick?_:b,e?(r=no(e)||e,o=ro(e),io(e),"dragstart"===r.type&&Ga(r)):(r=null,o={x:0,y:0}),a=y(o),t||(t=a),p=r,c="undefined"!=typeof TouchEvent&&p instanceof TouchEvent,m=F({prefix:n,data:l,payload:{},globalStart:o,displacement:Ko(t,a),localStart:a,isTouch:c},i),i.manual||(c?(re.bind(document,"touchstart",E,!0),re.bind(document,"touchcancel",C,!0),re.bind(document,"touchmove",g,!0),re.bind(document,"touchend",b,!0)):(re.bind(document,"mousemove",g),re.bind(document,"dragstart",Ga),re.bind(document,"selectstart",Ga),re.bind(document,"mousedown",s,!0),re.bind(document,"mouseup",s,!0)),re.bind(document,"keyup",x),u.on("element.hover",w),u.on("element.out",S)),v("init"),i.autoActivate&&g(e,!0)},this.move=g,this.hover=w,this.out=S,this.end=b,this.cancel=C,this.context=function(){return m},this.setOptions=function(e){F(f,e)}}Ha.$inject=["eventBus","canvas","selection"];function Va(o,a,s){var t=this;o.on("drag.start",function(e){o.once("drag.move",function(){o.once("drag.move",function(e){t.ensureHover(e)})})}),o.on("drag.init",function(){var n,i;function e(e){n=e.hover,i=e.hoverGfx}function t(){i=n=null}function r(){if(n){var e=n,t=i;i=n=null,a.out({element:e,gfx:t})}}o.on("drag.hover",e),o.on("element.out",t),o.on("element.hover",1500,r),o.once("drag.cleanup",function(){o.off("drag.hover",e),o.off("element.out",t),o.off("element.hover",r)})}),this.ensureHover=function(e){if(!e.hover){var t,n,i,r,o=e.originalEvent;if(o instanceof MouseEvent)t=ro(o),n=document.elementFromPoint(t.x,t.y),(r=ee(n,"svg, .djs-element",!0))&&(i=s.get(r),a.hover({element:i,gfx:r}))}}}Va.$inject=["eventBus","dragging","elementRegistry"];var Wa={__init__:["hoverFix"],__depends__:[vo],dragging:["type",Ha],hoverFix:["type",Va]};function Ua(e,t){this._eventBus=e,this._canvas=t,this._init()}Ua.$inject=["eventBus","canvas"],Ua.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)}}},Ua.prototype._init=function(){var e=this._eventBus,t=this._canvas.getContainer();this._setMousePosition=I(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)},Ua.prototype._setHoverElement=function(e){this._hoverElement=e.element},Ua.prototype._setMousePosition=function(e){this._mouseX=e.layerX,this._mouseY=e.layerY};var qa={__init__:["mouseTracking"],mouseTracking:["type",Ua]};function Ya(e,t,n,i){this._canvas=n,this._mouseTracking=i,this._opts=F({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var r=this;t.on("drag.move",function(e){var t=r._toBorderPoint(e);r.startScroll(t)}),t.on(["drag.cleanup"],function(){r.stopScroll()})}function Ka(e,t,n){return t":">",'"':""","'":"'"};function hs(e){return(e=""+e)&&e.replace(/[&<>"']/g,function(e){return us[e]})}function ds(e,x,i,_,E){function r(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m,f,y,v,g=t.waypoints,b=os(x,g,e);if(b)return i=b,a=t.waypoints,n=i.index<=0||i.bendpoint?null:(o=cr((r={start:a[i.index-1],end:a[i.index]}).start,r.end))?ps("h"===o?r.end.x-r.start.x:r.end.y-r.start.y)/2:null,c=g,p=n,y=(s=b).index,v=s.point,!(y<=0||s.bendpoint)&&(h=lr(l=c[y-1],u=c[y]),d=cr(l,u),m=Math.abs(v.x-h.x),f=Math.abs(v.y-h.y),d&&m<=p&&f<=p)?E.start(e,t,b.index):_.start(e,t,b.index,!b.bendpoint),!0}function s(e,t,n){re.bind(e,t,function(e){i.triggerMouseEvent(t,e,n),e.stopPropagation()})}function b(e,t){var n=x.getLayer("overlays"),i=de('.djs-bendpoints[data-element-id="'+ls(e.id)+'"]',n);return!i&&t&&(_e(i=Ne("g"),{"data-element-id":e.id}),Te(i).add("djs-bendpoints"),ve(n,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function w(e,t){return de('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function n(i,e){e.waypoints.forEach(function(e,t){var n=as(i);ve(i,n),Zt(n,e.x,e.y)}),as(i,"floating")}function o(e,t){for(var n,i,r,o=t.waypoints,a=1;ai.length-3&&p.unshift(h(n.target)),e.snapPoints=t={horizontal:[],vertical:[]},M(p,function(e){e&&(e=e.original||e,"y"===c&&t.horizontal.push(e.y),"x"===c&&t.vertical.push(e.x))}),t}(e.context),r=e.x,o=e.y;if(i){var a=r-(t=u(i.vertical,r)),s=o-(n=u(i.horizontal,o));F(e,{dx:e.dx-a,dy:e.dy-s,x:t,y:n}),(a||-1!==i.vertical.indexOf(r))&&Fs(e,"x",t),(s||-1!==i.horizontal.indexOf(o))&&Fs(e,"y",n)}}),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,function(e){var t,n,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:[]},M(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&&h(o),s=e.x,c=e.y;if(r){var p=s-(t=u(a?r.vertical.concat([a.x]):r.vertical,s)),l=c-(n=u(a?r.horizontal.concat([a.y]):r.horizontal,c));F(e,{dx:e.dx-p,dy:e.dy-l,x:e.x-p,y:e.y-l}),(p||-1!==r.vertical.indexOf(s))&&Fs(e,"x",t),(l||-1!==r.horizontal.indexOf(c))&&Fs(e,"y",n)}})}Vs.$inject=["eventBus"];var Ws={__depends__:[Wa,Qa],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",ds],bendpointMove:["type",gs],bendpointMovePreview:["type",Ts],connectionSegmentMove:["type",Bs],bendpointSnapping:["type",Vs]};function Us(e,r,p,n){function l(e,t){return n.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",function(e){var t=e.context,n=t.source,i=e.hover;null!==(t.canExecute=l(n,i))&&(t.target=i)}),e.on(["connect.out","connect.cleanup"],function(e){var t=e.context;t.target=null,t.canExecute=!1}),e.on("connect.end",function(e){var t=e.context,n=t.source,i=t.sourcePosition,r=t.target,o={x:e.x,y:e.y},a=t.canExecute||l(n,r);if(!a)return!1;var s=null,c={connectionStart:i,connectionEnd:o};"object"==typeof a&&(s=a),p.connect(n,r,s,c)}),this.start=function(e,t,n,i){"object"!=typeof n&&(i=n,n=qr(t)),r.init(e,"connect",{autoActivate:i,data:{shape:t,context:{source:t,sourcePosition:n}}})}}Us.$inject=["eventBus","dragging","modeling","rules"];var qs="connect-ok",Ys="connect-not-ok";function Ks(e,t,r){var a=e.get("connectionPreview",!1);t.on("connect.move",function(e){var t=e.context,n=t.source,i=t.target,r=t.canExecute,o={x:e.x,y:e.y};a&&a.drawPreview(t,r,{source:n,target:i,connectionEnd:o})}),t.on("connect.hover",900,function(e){var t=e.context,n=e.hover,i=t.canExecute;null!==i&&r.addMarker(n,i?qs:Ys)}),t.on(["connect.out","connect.cleanup"],1100,function(e){var t=e.context;t.target&&r.removeMarker(t.target,t.canExecute?qs:Ys)}),t.on("connect.cleanup",function(e){a&&a.cleanUp(e.context)})}Ks.$inject=["injector","eventBus","canvas"];var Xs={__depends__:[vo,Qa,Wa],__init__:["connectPreview"],connect:["type",Us],connectPreview:["type",Ks]};function Zs(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Zs.$inject=["injector","canvas","graphicsFactory","elementFactory"],Zs.prototype.drawPreview=function(e,t,n){n=n||{};var i,r,o,a=e.connectionPreviewGfx,s=e.getConnection,c=n.source,p=n.target,l=n.waypoints,u=n.connectionStart,h=n.connectionEnd,d=n.noLayout,m=n.noCropping,f=n.noNoop,y=this;a||(a=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Pe(a),s||(s=e.getConnection=(r=function(e,t,n){return y.getConnection(e,t,n)},o={},function(e){var t=JSON.stringify(e),n=o[t];return n||(n=o[t]=r.apply(null,arguments)),n})),t&&(i=s(t,c,p)),i?(i.waypoints=l||[],this._layouter&&!d&&(i.waypoints=this._layouter.layoutConnection(i,{source:c,target:p,connectionStart:u,connectionEnd:h})),i.waypoints&&i.waypoints.length||(i.waypoints=[c?qr(c):u,p?qr(p):h]),this._connectionDocking&&(c||p)&&!m&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,c,p)),this._graphicsFactory.drawConnection(a,i)):!f&&this.drawNoopPreview(a,n)},Zs.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||qr(n),o=t.connectionEnd||qr(i),a=this.cropWaypoints(r,o,n,i);ve(e,this.createNoopConnection(a[0],a[1]))},Zs.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),a=i&&r.getShapePath(i),s=r.getConnectionPath({waypoints:[e,t]});return[e=n&&Kr(o,s,!0)||e,t=i&&Kr(a,s,!1)||t]},Zs.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ae(e.connectionPreviewGfx)},Zs.prototype.getConnection=function(e){var t,n=P(t=e)?t:{};return this._elementFactory.createConnection(n)},Zs.prototype.createConnectionPreviewGfx=function(){var e=Ne("g");return _e(e,{pointerEvents:"none"}),Te(e).add("djs-connection-preview"),ve(this._canvas.getDefaultLayer(),e),e},Zs.prototype.createNoopConnection=function(e,t){var n=Ne("polyline");return _e(n,{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"}),_e(n,{points:[e.x,e.y,t.x,t.y]}),n};var Qs={__init__:["connectionPreview"],connectionPreview:["type",Zs]},Js=Math.min,ec=Math.max;function tc(e){e.preventDefault()}function nc(e){e.stopPropagation()}function ic(e){this.container=e.container,this.parent=se('
'),this.content=de("[contenteditable]",this.parent),this.keyHandler=e.keyHandler||function(){},this.resizeHandler=e.resizeHandler||function(){},this.autoResize=I(this.autoResize,this),this.handlePaste=I(this.handlePaste,this)}function rc(e,t){this._eventBus=e,this._providers=[],this._textbox=new ic({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}ic.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,a=this.container;i=this.options=i||{};var s=$(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);F(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},s);var c=$(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return F(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},c),i.centerVertically&&F(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},c),o.innerText=n,re.bind(o,"keydown",this.keyHandler),re.bind(o,"mousedown",nc),re.bind(o,"paste",this.handlePaste),i.autoResize&&re.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),a.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},ic.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},ic.prototype.insertText=function(e){document.execCommand("insertText",!1,e)||this._insertTextIE(e)},ic.prototype._insertTextIE=function(n){var e,t,i,r=this.getSelection(),o=r.startContainer,a=r.endContainer,s=r.startOffset,c=r.endOffset,p=r.commonAncestorContainer,l=(e=p.childNodes,[].slice.call(e));if(p.nodeType===Node.TEXT_NODE){var u=o.textContent;o.textContent=u.substring(0,s)+n+u.substring(c),t=o,i=s+n.length}else if(o===this.content&&a===this.content){var h=document.createTextNode(n);this.content.insertBefore(h,l[s]),i=(t=h).textContent.length}else{var d=l.indexOf(o),m=l.indexOf(a);l.forEach(function(e,t){t===d?e.textContent=o.textContent.substring(0,s)+n+a.textContent.substring(c):de.offsetHeight||t.scrollHeight
');var n=function(e){tc(e),nc(e);var t=Js(ec(u+e.clientX-p,o),s),n=Js(ec(h+e.clientY-l,a),c);r.style.width=t+"px",r.style.height=n+"px",i.resizeHandler({width:u,height:h,dx:e.clientX-p,dy:e.clientY-l})},d=function(e){tc(e),nc(e),re.unbind(document,"mousemove",n,!1),re.unbind(document,"mouseup",d,!1)};re.bind(e,"mousedown",function(e){tc(e),nc(e),p=e.clientX,l=e.clientY;var t=r.getBoundingClientRect();u=t.width,h=t.height,re.bind(document,"mousemove",n),re.bind(document,"mouseup",d)})}F(e.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),r.appendChild(e)},ic.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),re.unbind(t,"keydown",this.keyHandler),re.unbind(t,"mousedown",nc),re.unbind(t,"input",this.autoResize),re.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),fe(n)),fe(e)},ic.prototype.getValue=function(){return this.content.innerText.trim()},ic.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},ic.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)},rc.$inject=["eventBus","canvas"],rc.prototype.registerProvider=function(e){this._providers.push(e)},rc.prototype.isActive=function(){return!!this._active},rc.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},rc.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},rc.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0},rc.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},rc.prototype.getValue=function(){return this._textbox.getValue()},rc.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())},rc.prototype._handleResize=function(e){this._fire("resize",e)},rc.prototype.activate=function(t){var n;this.isActive()&&this.cancel();var e=A(this._providers,function(e){return(n=e.activate(t))?e:null});return n&&(this.$textbox=this._textbox.create(n.bounds,n.style,n.text,n.options),this._active={element:t,context:n,provider:e},n.options&&n.options.resizable&&(this.resizable=!0),this._fire("activate")),!!n};var oc={__depends__:[po],__init__:["directEditing"],directEditing:["type",rc]};function ac(e,t,n){this._providers=[],this._eventBus=t,this._overlays=n;var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._overlaysConfig={position:{right:-9,top:-6},scale:i},this._current=null,this._init()}ac.$inject=["config.contextPad","eventBus","overlays"],ac.prototype._init=function(){var e=this._eventBus,i=this;e.on("selection.changed",function(e){var t=e.newSelection;1===t.length?i.open(t[0]):i.close()}),e.on("elements.delete",function(e){M(e.elements,function(e){i.isOpen(e)&&i.close()})}),e.on("element.changed",function(e){var t=e.element,n=i._current;n&&n.element===t&&i.open(t,!0)})},ac.prototype.registerProvider=function(e){this._providers.push(e)},ac.prototype.getEntries=function(t){var n={};return M(this._providers,function(e){M(e.getContextPadEntries(t),function(e,t){n[t]=e})}),n},ac.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[G(s,"data-action")].action,r=t.originalEvent||t,u(i)){if("click"===e)return i(r,o,n)}else if(i[e])return i[e](r,o,n);t.preventDefault()},ac.prototype.open=function(e,t){!t&&this.isOpen(e)||(this.close(),this._updateAndOpen(e))},ac.prototype._updateAndOpen=function(e){var t=this.getEntries(e),n=this.getPad(e),c=n.html;M(t,function(e,t){var n,i,r,o,a=e.group||"default",s=se(e.html||'
');G(s,"data-action",t),(n=de("[data-group="+a+"]",c))||(n=se('
'),c.appendChild(n)),n.appendChild(s),e.className&&(i=s,r=e.className,o=q(i),(g(r)?r:r.split(/\s+/g)).forEach(function(e){o.add(e)})),e.title&&G(s,"title",e.title),e.imageUrl&&s.appendChild(se(''))}),q(c).add("open"),this._current={element:e,pad:n,entries:t},this._eventBus.fire("contextPad.open",{current:this._current})},ac.prototype.getPad=function(e){if(this.isOpen())return this._current.pad;var t=this,n=this._overlays,i=se('
'),r=F({html:i},this._overlaysConfig);ae.bind(i,".entry","click",function(e){t.trigger("click",e)}),ae.bind(i,".entry","dragstart",function(e){t.trigger("dragstart",e)}),re.bind(i,"mousedown",function(e){e.stopPropagation()}),this._overlayId=n.add(e,"context-pad",r);var o=n.get(this._overlayId);return this._eventBus.fire("contextPad.create",{element:e,pad:o}),o},ac.prototype.close=function(){this.isOpen()&&(this._overlays.remove(this._overlayId),this._overlayId=null,this._eventBus.fire("contextPad.close",{current:this._current}),this._current=null)},ac.prototype.isOpen=function(e){return!(!this._current||e&&this._current.element!==e)};var sc={__depends__:[po,So],contextPad:["type",ac]},cc="drop-ok",pc="drop-not-ok",lc="attach-ok",uc="new-parent";function hc(e,r,s,l,o,a,c){function p(t,n){[lc,cc,pc,uc].forEach(function(e){e===n?o.addMarker(t,e):o.removeMarker(t,e)})}e.on("create.move",function(e){var t,n=e.context,i=e.hover,r=n.shape,o=n.source;dc(e);var a={x:e.x,y:e.y};t=n.canExecute=i&&function(e,t,n,i){if(!t)return!1;var r,o,a={source:n,shape:e,target:t,position:i};return(o=s.allowed("shape.attach",a))||(r=s.allowed("shape.create",a)),r||o?{attach:o,connect:n&&s.allowed("connection.create",{source:n,target:e,hints:{targetParent:t,targetAttach:o}})}:(null===r||null===o)&&null}(r,i,o,a),i&&null!==t&&(n.target=i,t&&t.attach?p(i,lc):p(i,t?uc:pc))}),e.on("create.move",750,function(e){var t=e.context,n=t.shape,i=t.visual;i||(i=t.visual=function(e){var t,n,i;_e(t=Ne("g"),a.cls("djs-drag-group",["no-events"])),ve(o.getDefaultLayer(),t),Te(n=Ne("g")).add("djs-dragger"),ve(t,n),Zt(n,e.width/-2,e.height/-2);var r=Ne("g");return Te(r).add("djs-visual"),ve(n,r),i=r,c.drawShape(i,e),t}(n)),Zt(i,e.x,e.y)}),e.on(["create.end","create.out","create.cleanup"],function(e){var t=e.context.target;t&&p(t,null)}),e.on("create.end",function(e){var t=e.context,n=t.source,i=t.hints,r=t.shape,o=t.target,a=t.canExecute,s=a&&a.attach,c=a&&a.connect;if(!1===a||!o)return!1;dc(e);var p={x:e.x,y:e.y};r=c?l.appendShape(n,r,p,o,{attach:s,connection:!0===c?{}:c}):l.createShape(r,p,o,F({},i,{attach:s})),t.shape=r}),e.on("create.cleanup",function(e){var t=e.context;t.visual&&Ae(t.visual)}),this.start=function(e,t,n){var i;i=!n||n instanceof zt?{hints:{},shape:t,source:n}:F({hints:{},shape:t},n),r.init(e,"create",{cursor:"grabbing",autoActivate:!0,data:{shape:t,context:i}})}}function dc(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}hc.$inject=["eventBus","dragging","rules","modeling","canvas","styles","graphicsFactory"];var mc={__depends__:[Wa,vo,Qa],create:["type",hc]},fc="data-id";function yc(e,t,n){var i=c(e&&e.scale)?e.scale:{min:1,max:1.5};this._config={scale:i},this._eventBus=t,this._canvas=n,this._providers={},this._current={}}yc.$inject=["config.popupMenu","eventBus","canvas"],yc.prototype.registerProvider=function(e,t){this._providers[e]=t},yc.prototype.isEmpty=function(e,t){if(!e)throw new Error("element parameter is missing");if(!t)throw new Error("providerId parameter is missing");var n=this._providers[t],i=n.getEntries(e),r=n.getHeaderEntries&&n.getHeaderEntries(e),o=0'),t=this._current.position,n=this._current.className;return F(e.style,{position:"absolute",left:t.x+"px",top:t.y+"px",visibility:"hidden"}),q(e).add(n),e},yc.prototype._attachContainer=function(e,t,n){var i=this;ae.bind(e,".entry","click",function(e){i.trigger(e)}),this._updateScale(e),t.appendChild(e),n&&this._assureIsInbounds(e,n),this._bindHandlers()},yc.prototype._updateScale=function(e){var t,n,i,r,o=this._canvas.zoom(),a=this._config.scale,s=o;!0!==a&&(n=!1===a?t=1:(t=a.min,a.max),c(t)&&or.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"),i=this;return q(n).add(t),M(e,function(e){var t=i._createEntry(e,n);n.appendChild(t)}),n},yc.prototype._createEntry=function(e){if(!e.id)throw new Error("every entry must have the id property set");var t=se("
"),n=q(t);if(n.add("entry"),e.className&&e.className.split(" ").forEach(function(e){n.add(e)}),G(t,fc,e.id),e.label){var i=se("");i.textContent=e.label,t.appendChild(i)}return e.imageUrl&&t.appendChild(se('')),!0===e.active&&n.add("active"),!0===e.disabled&&n.add("disabled"),e.title&&(t.title=e.title),t},yc.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)},yc.prototype._unbindHandlers=function(){var e=this._eventBus,t=this;function n(){t.close()}e.off("contextPad.close",n),e.off("canvas.viewbox.changed",n),e.off("commandStack.changed",n)};var vc={__init__:["popupMenu"],popupMenu:["type",yc]},gc=Math.round;function bc(e){this._modeling=e}bc.$inject=["modeling"],bc.prototype.replaceElement=function(e,t,n){var i=this._modeling,r=null;return e.waypoints||(t.x=gc(e.x+(t.width||e.width)/2),t.y=gc(e.y+(t.height||e.height)/2),r=i.replaceShape(e,t,n)),r};var xc={__init__:["replace"],replace:["type",bc]},_c=["lanes","incoming","outgoing","artifacts","default","flowElements","dataInputAssociations","dataOutputAssociations"];function Ec(e,t){var n=[];return M(e.properties,function(e){t&&e.default||n.push(e.ns.name)}),n}function wc(e,t){this._eventBus=e,this._bpmnFactory=t}wc.prototype.clone=function(s,c,e){var p=this,l={newElement:c,hasNestedProperty:!1};return M(e=R(e,function(e){return"bpmn:extensionElements"===e}),function(e){var t,n,i,r=s.get(e),o=c.get(e),a=c.$model.getPropertyDescriptor(c,e);o!==r&&(a&&(a.isId||a.isReference)||(i=r,v(["boolean","string","number"],function(e){return typeof i===e})||null===r?c.set(e,r):g(r)?M(r,function(e){var t;l.refTopLevelProperty=e,t=p._deepClone(e,l),l.hasNestedProperty&&(t.$parent=c,o.push(t)),l.hasNestedProperty=!1}):(n=e.replace(/bpmn:/,""),l.refTopLevelProperty=r,t=p._deepClone(r,l),l.hasNestedProperty&&(t.$parent=c).set(n,t),l.hasNestedProperty=!1)))}),c},wc.prototype._deepClone=function(s,c){var p=this,l=this._eventBus,u=this._bpmnFactory.create(s.$type),e=k(Object.keys(s),function(e){var t=u.$model.getPropertyDescriptor(u,e);return(!t||!t.isId&&!t.isReference)&&(-1===_c.indexOf(e)&&"$type"!==e)});return e.length||(c.hasNestedProperty=!0),M(e,function(a){void 0!==s[a]&&(s[a].$type||g(s[a]))?g(s[a])?(u[a]=[],M(s[a],function(e){var t,n=s.$model.getTypeDescriptor(e.$type);if(n){var i,r,o;if(!l.fire("property.clone",{newElement:c.newElement,refTopLevelProperty:c.refTopLevelProperty,propertyDescriptor:n})&&"bpmn:ExtensionElements"===s.$type&&n.meta&&n.meta.allowedIn&&(i=n,r=c.newElement.$type,(1!==(o=i.meta.allowedIn).length||"*"!==o[0])&&-1===o.indexOf(r)))return!1;((t=p._deepClone(e,c)).$parent=u)[a]||(u[a]=[]),c.hasNestedProperty=!0,u[a].push(t)}})):s[a].$type&&(u[a]=p._deepClone(s[a],c),u[a]&&(c.hasNestedProperty=!0,u[a].$parent=u)):(c.hasNestedProperty=!0,u[a]=s[a])}),u};var Sc=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Cc(f,y,v,g,b,e){var x=new wc(e,f);this.replaceElement=function(n,i,e){e=e||{};var t,r,o,a=i.type,s=n.businessObject;if(Tc(s)&&"bpmn:SubProcess"===a&&(r=i,(o=(t=n)&&_(t,"collapsed")?t.collapsed:!Ai(t))!==(r&&(_(r,"collapsed")||_(r,"isExpanded"))?_(r,"collapsed")?r.collapsed:!r.isExpanded:o)&&(t.collapsed=o,1)))return b.toggleCollapse(n),n;var c,p=f.create(a),l={type:a,businessObject:p},u=Ec(s.$descriptor),h=Ec(p.$descriptor,!0),d=(c=h,u.filter(function(e){return-1!==c.indexOf(e)}));F(p,$(i,Sc));var m=k(d,function(e){var t=e.replace(/bpmn:/,"");return"eventDefinitions"===t?Rc(n,i.eventDefinitionType):"loopCharacteristics"===t?!Pi(p):!(e in p||"processRef"===t&&!1===i.isExpanded||"triggeredByEvent"===t||-1!==_c.indexOf(t))});return p=x.clone(s,p,m),i.eventDefinitionType&&(Rc(p,i.eventDefinitionType)||(l.eventDefinitionType=i.eventDefinitionType)),Ti(s,"bpmn:Activity")&&(Tc(s)?l.isExpanded=Ai(s):i&&_(i,"isExpanded")&&(l.isExpanded=i.isExpanded),Ai(s)&&!Ti(s,"bpmn:Task")&&l.isExpanded&&(l.width=n.width,l.height=n.height)),Tc(s)&&!Tc(p)&&(e.moveChildren=!1),Ti(s,"bpmn:Participant")&&(!0===i.isExpanded?p.processRef=f.create("bpmn:Process"):e.moveChildren=!1,l.width=n.width,l.height=y._getDefaultSize(p).height),p.name=s.name,ba(s,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&ba(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(p.default=s.default),i.host&&!Ti(s,"bpmn:BoundaryEvent")&&Ti(p,"bpmn:BoundaryEvent")&&(l.host=i.host),("fill"in s.di||"stroke"in s.di)&&F(l,{colors:$(s.di,["fill","stroke"])}),l=v.replaceElement(n,l,e),!1!==e.select&&g.select(l),l}}function Tc(e){return Ti(e,"bpmn:SubProcess")}function Rc(e,t){var n=Ri(e);return t&&n.get("eventDefinitions").some(function(e){return Ti(e,t)})}Cc.$inject=["bpmnFactory","elementFactory","replace","selection","modeling","eventBus"];var Ac={__depends__:[vo,xc],bpmnReplace:["type",Cc]};function Pc(c){return function(e){var t=e.target,n=Ri(c),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=n.triggeredByEvent===t.triggeredByEvent,s=void 0===t.isExpanded||t.isExpanded===Ai(n);return!(r&&o&&a&&s)}}var kc=[{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"}}],Mc=[{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"}}],Dc=[{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"}}],Bc=[{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"}}],Nc=[{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}}],Oc=[{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}}],Lc=[{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}}],jc=[{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}}],Ic=[{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}}],zc=[{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}}],Fc=[{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"}],$c=[{label:"Expanded Pool",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:"Collapsed Pool",actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}];function Gc(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()}Gc.$inject=["popupMenu","modeling","moddle","bpmnReplace","rules","translate"],Gc.prototype.register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Gc.prototype.getEntries=function(r){var e,o=r.businessObject;if(!this._rules.allowed("shape.replace",{element:r}))return[];var a=Pc(r);return Ti(o,"bpmn:StartEvent")&&!Pi(o.$parent)?(e=k(kc,a),this._createEntries(r,e)):Ti(o,"bpmn:Participant")?(e=k($c,function(e){return Ai(o)!==e.target.isExpanded}),this._createEntries(r,e)):Ti(o,"bpmn:StartEvent")&&Pi(o.$parent)?(e=k(zc,function(e){var t=!1!==e.target.isInterrupting,n=Ri(r).isInterrupting===t;return a(e)||!a(e)&&!n}),this._createEntries(r,e)):Ti(o,"bpmn:EndEvent")?(e=k(Dc,function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Ti(o.$parent,"bpmn:Transaction"))&&a(e)}),this._createEntries(r,e)):Ti(o,"bpmn:BoundaryEvent")?(e=k(Ic,function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinition&&!Ti(o.attachedToRef,"bpmn:Transaction"))return!1;var n=!1!==t.cancelActivity,i=o.cancelActivity==n;return a(e)||!a(e)&&!i}),this._createEntries(r,e)):Ti(o,"bpmn:IntermediateCatchEvent")||Ti(o,"bpmn:IntermediateThrowEvent")?(e=k(Mc,a),this._createEntries(r,e)):Ti(o,"bpmn:Gateway")?(e=k(Bc,a),this._createEntries(r,e)):Ti(o,"bpmn:Transaction")?(e=k(Oc,a),this._createEntries(r,e)):Pi(o)&&Ai(o)?(e=k(Lc,a),this._createEntries(r,e)):Ti(o,"bpmn:SubProcess")&&Ai(o)?(e=k(Nc,a),this._createEntries(r,e)):Ti(o,"bpmn:AdHocSubProcess")&&!Ai(o)?(e=k(jc,function(e){var t=e.target,n="bpmn:SubProcess"===t.type,i=!0===t.isExpanded;return Pc(r)&&(!n||i)}),this._createEntries(r,e)):Ti(o,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(r,Fc):Ti(o,"bpmn:FlowNode")?(e=k(jc,a),Ti(o,"bpmn:SubProcess")&&!Ai(o)&&(e=k(e,function(e){return"Sub Process (collapsed)"!==e.label})),this._createEntries(r,e)):[]},Gc.prototype.getHeaderEntries=function(e){var t=[];return Ti(e,"bpmn:Activity")&&!Pi(e)&&(t=t.concat(this._getLoopEntries(e))),!Ti(e,"bpmn:SubProcess")||Ti(e,"bpmn:Transaction")||Pi(e)||t.push(this._getAdHocEntry(e)),t},Gc.prototype._createEntries=function(n,e){var i=[],r=this;return M(e,function(e){var t=r._createMenuEntry(e,n);i.push(t)}),i},Gc.prototype._createSequenceFlowEntries=function(t,e){var n=Ri(t),i=[],r=this._modeling,o=this._moddle,a=this;return M(e,function(e){switch(e.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Ti(n.sourceRef,"bpmn:ExclusiveGateway")||Ti(n.sourceRef,"bpmn:InclusiveGateway")||Ti(n.sourceRef,"bpmn:ComplexGateway")||Ti(n.sourceRef,"bpmn:Activity"))&&i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:n})}));break;case"replace-with-conditional-flow":!n.conditionExpression&&Ti(n.sourceRef,"bpmn:Activity")&&i.push(a._createMenuEntry(e,t,function(){var e=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(t,{conditionExpression:e})}));break;default:if(Ti(n.sourceRef,"bpmn:Activity")&&n.conditionExpression)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t,{conditionExpression:void 0})}));if((Ti(n.sourceRef,"bpmn:ExclusiveGateway")||Ti(n.sourceRef,"bpmn:InclusiveGateway")||Ti(n.sourceRef,"bpmn:ComplexGateway")||Ti(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n)return i.push(a._createMenuEntry(e,t,function(){r.updateProperties(t.source,{default:void 0})}))}}),i},Gc.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}},Gc.prototype._getLoopEntries=function(i){var r=this,e=this._translate;function t(e,t){var n;t.active?n=void 0:(n=r._moddle.create(t.options.loopCharacteristics),t.options.isSequential&&(n.isSequential=t.options.isSequential)),r._modeling.updateProperties(i,{loopCharacteristics:n})}var n,o,a,s=Ri(i).loopCharacteristics;return s&&(n=s.isSequential,o=void 0===s.isSequential,a=void 0!==s.isSequential&&!s.isSequential),[{id:"toggle-parallel-mi",className:"bpmn-icon-parallel-mi-marker",title:e("Parallel Multi Instance"),active:a,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},{id:"toggle-sequential-mi",className:"bpmn-icon-sequential-mi-marker",title:e("Sequential Multi Instance"),active:n,action:t,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},{id:"toggle-loop",className:"bpmn-icon-loop-marker",title:e("Loop"),active:o,action:t,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}]},Gc.prototype._getAdHocEntry=function(n){var e=this._translate,i=Ti(Ri(n),"bpmn:AdHocSubProcess"),r=this._bpmnReplace.replaceElement;return{id:"toggle-adhoc",className:"bpmn-icon-ad-hoc-marker",title:e("Ad-hoc"),active:i,action:function(e,t){return r(n,i?{type:"bpmn:SubProcess"}:{type:"bpmn:AdHocSubProcess"})}}};var Hc={__depends__:[vc,Ac],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Gc]},Vc=Math.max,Wc=Math.min,Uc=20;function qc(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Yc(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return l(r)&&(i=(/top|left/.test(e)?Wc:Vc)(i,r)),l(o)&&(i=(/top|left/.test(e)?Vc:Wc)(i,o)),i}function Kc(e,t){return void 0!==e?e:Uc}function Xc(e){return!e.waypoints&&"label"!==e.type}function Zc(e,t){var n,i,r,o,a,s,c;if((n=void 0===e.length?k(e.children,Xc):e).length)return i=ut(n),"object"==typeof(r=t)?(o=Kc(r.left),a=Kc(r.right),s=Kc(r.top),c=Kc(r.bottom)):o=a=s=c=Kc(r),{x:i.x-o,y:i.y-s,width:i.width+o+a,height:i.height+s+c}}var Qc=Math.abs;var Jc=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"];function ep(e,t){return t=t||[],e.children.filter(function(e){Ti(e,"bpmn:Lane")&&(ep(e,t),t.push(e))}),t}function tp(e){return e.children.filter(function(e){return Ti(e,"bpmn:Lane")})}function np(e){return function(e,t){for("string"==typeof t&&(t=[t]);e=e.parent;)if(ba(e,t))return e;return null}(e,Jc)||e}function ip(c,e){var t,n=np(c),i=ep(n,Ti(n,"bpmn:Process")?[]:[n]),p=Wr(c),l=Wr(e),u=(t=c,qc(Wr(e),Wr(t))),h=[];return i.forEach(function(e){if(e!==c){var t,n,i=0,r=u.right,o=0,a=u.left,s=Wr(e);u.top&&(Qc(s.bottom-p.top)<10&&(o=l.top-s.bottom),Qc(s.top-p.top)<5&&(i=l.top-s.top)),u.bottom&&(Qc(s.top-p.bottom)<10&&(i=l.bottom-s.top),Qc(s.bottom-p.bottom)<5&&(o=l.bottom-s.bottom)),(i||r||o||a)&&h.push({shape:e,newBounds:(t=e,n={top:i,right:r,bottom:o,left:a},{x:t.x+(n.left||0),y:t.y+(n.top||0),width:t.width-(n.left||0)+(n.right||0),height:t.height-(n.top||0)+(n.bottom||0)})})}}),h}function rp(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(ao(e)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})}function op(e,t,n){var i=e.$instanceOf(t),r=!1;return M(e.eventDefinitions||[],function(e){e.$type===n&&(r=!0)}),i&&r}rp.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate"],rp.prototype.getContextPadEntries=function(t){var p=this._contextPad,i=this._modeling,o=this._elementFactory,n=this._connect,a=this._create,l=this._popupMenu,u=this._canvas,e=this._rules,s=this._autoPlace,c=this._translate,r={};if("label"===t.type)return r;var h=t.businessObject;function d(e,t){n.start(e,t)}function m(i,e,t,r){function n(e,t){var n=o.createShape(F({type:i},r));a.start(e,n,t)}return"string"!=typeof t&&(r=t,t=c("Append {type}",{type:i.replace(/^bpmn:/,"")})),{group:"model",className:e,title:t,action:{dragstart:n,click:s?function(e,t){var n=o.createShape(F({type:i},r));s.append(t,n)}:n}}}function f(n){return function(e,t){i.splitLane(t,n),p.open(t,!0)}}if(ba(h,["bpmn:Lane","bpmn:Participant"])&&Ai(h)){var y=tp(t);F(r,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:c("Add Lane above"),action:{click:function(e,t){i.addLane(t,"top")}}}}),y.length<2&&(120<=t.height&&F(r,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:c("Divide into two Lanes"),action:{click:f(2)}}}),180<=t.height&&F(r,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:c("Divide into three Lanes"),action:{click:f(3)}}})),F(r,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:c("Add Lane below"),action:{click:function(e,t){i.addLane(t,"bottom")}}}})}Ti(h,"bpmn:FlowNode")&&(Ti(h,"bpmn:EventBasedGateway")?F(r,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task"),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",c("Append MessageIntermediateCatchEvent"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",c("Append TimerIntermediateCatchEvent"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condtion-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",c("Append ConditionIntermediateCatchEvent"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",c("Append SignalIntermediateCatchEvent"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):op(h,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?F(r,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",c("Append compensation activity"),{isForCompensation:!0})}):Ti(h,"bpmn:EndEvent")||h.isForCompensation||op(h,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Pi(h)||F(r,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",c("Append EndEvent")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",c("Append Gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",c("Append Task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",c("Append Intermediate/Boundary Event"))})),l.isEmpty(t,"bpmn-replace")||F(r,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:c("Change type"),action:{click:function(e,t){var n,i,r,o,a,s,c=F((n=t,i=u.getContainer(),r=p.getPad(n).html,o=i.getBoundingClientRect(),a=r.getBoundingClientRect(),s=a.top-o.top,{x:a.left-o.left,y:s+a.height+5}),{cursor:{x:e.x,y:e.y}});l.open(t,"bpmn-replace",c)}}}}),ba(h,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(r,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation"),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using "+(h.isForCompensation?"":"Sequence/MessageFlow or ")+"Association"),action:{click:d,dragstart:d}}}),ba(h,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&F(r,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:c("Connect using DataInputAssociation"),action:{click:d,dragstart:d}}});var v=e.allowed("elements.delete",{elements:[t]});return g(v)&&(v=v[0]===t),v&&F(r,{delete:{group:"edit",className:"bpmn-icon-trash",title:c("Remove"),action:{click:function(e){i.removeElements([t])}}}}),r};var ap={__depends__:[oc,sc,vo,Xs,mc,Hc],__init__:["contextPadProvider"],contextPadProvider:["type",rp]};function sp(){}sp.prototype.get=function(){return this._data},sp.prototype.set=function(e){this._data=e},sp.prototype.clear=function(){var e=this._data;return delete this._data,e},sp.prototype.isEmpty=function(){return!this._data};var cp={clipboard:["type",sp]};function pp(e,t,n,i,r,o){this._eventBus=e,this._modeling=t,this._elementFactory=n,this._rules=i,this._canvas=o,this._clipboard=r,this._descriptors=[],this.registerDescriptor(function(e,n){return n.priority=1,n.id=e.id,e.parent&&(n.parent=e.parent.id),e.labelTarget&&(n.priority=4,n.labelTarget=e.labelTarget.id),e.host&&(n.priority=2,n.host=e.host.id),"number"==typeof e.x&&(n.x=e.x,n.y=e.y),e.width&&(n.width=e.width,n.height=e.height),e.waypoints&&(n.priority=3,n.waypoints=[],M(e.waypoints,function(e){var t={x:e.x,y:e.y};e.original&&(t.original={x:e.original.x,y:e.original.y}),n.waypoints.push(t)})),e.source&&e.target&&(n.source=e.source.id,n.target=e.target.id),n})}pp.$inject=["eventBus","modeling","elementFactory","rules","clipboard","canvas"],pp.prototype.copy=function(e){var t,r,n=this._clipboard;if(g(e)||(e=e?[e]:[]),e.length)return t=this.createTree(e),r=this._bbox=Yo(ut(t.allShapes)),delete t.allShapes,M(t,function(i){M(i,function(e){var n,t;e.labelTarget?(t=A(i,D({id:e.labelTarget})),n=t.waypoints?Ko(e,t.waypoints[0]):Ko(e,t)):3===e.priority?(n=[],M(e.waypoints,function(e){var t=Ko(e,r);n.push(t)})):n=Ko(e,r),e.delta=n})}),this._eventBus.fire("elements.copy",{context:{tree:t}}),0===Object.keys(t).length?n.clear():n.set(t),this._eventBus.fire("elements.copied",{context:{tree:t}}),t},pp.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=x(a,function(e,t,n){var i=parseInt(n,10);return isNaN(i)||(e[i]=t),e},{}),o.allowed("elements.paste",{tree:t,target:s})?i.pasteElements(t,s,c):r.fire("elements.paste.rejected",{context:{tree:t,position:c,target:s}}))},pp.prototype._computeDelta=function(e,t){var n=this._bbox,i={};return t.labelTarget?Ko(t,t.labelTarget):(3===t.priority?(i=[],M(t.waypoints,function(e){var t=Ko(e,n);i.push(t)})):i=Ko(t,n),i)},pp.prototype.hasRelations=function(e,t){var n,i;return!(t.waypoints&&(n=A(e,D({id:t.source.id})),i=A(e,D({id:t.target.id})),!n||!i))&&!(t.labelTarget&&!A(e,D({id:t.labelTarget.id})))},pp.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)},pp.prototype._executeDescriptors=function(t){return t.descriptor||(t.descriptor={}),M(this._descriptors,function(e){t.descriptor=e(t.element,t.descriptor)}),t},pp.prototype.createTree=function(e){var r,n,i,t,o,a=this._rules,s=this,c={},p=[],l=(n={},i=[],t=[],o=[],M(e,function(e){var t=e.parent;n[t.id]||(n[t.id]=[]),-1===i.indexOf(t.id)&&i.push(t.id),n[t.id].push(e)}),M(i,function(e){M(n[e],function(e){n[e.id]&&o.push(e.id)})}),M(i,function(e){-1===o.indexOf(e)&&(t=t.concat(n[e]))}),t);function u(e){var t=m(p,D({element:e.element}));if(-1===t)return p.push(e);p[t].depth=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},fp.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var yp={__init__:["distributeElements"],distributeElements:["type",fp]};function vp(e){e.registerFilter(function(e){return k(e,function(e){var t=ba(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:Participant","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})})}vp.$inject=["distributeElements"];var gp={__depends__:[yp],__init__:["bpmnDistributeElements"],bpmnDistributeElements:["type",vp]},bp="is not a registered action";function xp(e,t){this._actions={};var n=this;e.on("diagram.init",function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})})}function _p(e,t){return new Error(e+" "+t)}xp.$inject=["eventBus","injector"],xp.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),i=e.get("modeling",!1),r=e.get("selection",!1),n=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),a=e.get("canvas",!1),s=e.get("rules",!1),c=e.get("mouseTracking",!1),p=e.get("keyboardMove",!1),l=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",function(){t.undo()}),this.register("redo",function(){t.redo()})),o&&r&&this.register("copy",function(){var e=r.get();o.copy(e)}),c&&o&&this.register("paste",function(){var e=c.getHoverContext();o.paste(e)}),n&&this.register("stepZoom",function(e){n.stepZoom(e.value)}),a&&this.register("zoom",function(e){a.zoom(e.value)}),i&&r&&s&&this.register("removeSelection",function(){var e=r.get();if(e.length){var t,n=s.allowed("elements.delete",{elements:e});!1!==n&&(t=g(n)?n:e).length&&i.removeElements(t.slice())}}),p&&this.register("moveCanvas",function(e){p.moveCanvas(e)}),l&&this.register("moveSelection",function(e){l.moveSelection(e.direction,e.accelerated)})},xp.prototype.trigger=function(e,t){if(!this._actions[e])throw _p(e,bp);return this._actions[e](t)},xp.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);M(e,function(e,t){n._registerAction(t,e)})},xp.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw _p(e,"is already registered");this._actions[e]=t},xp.prototype.unregister=function(e){if(!this.isRegistered(e))throw _p(e,bp);this._actions[e]=void 0},xp.prototype.getActions=function(){return Object.keys(this._actions)},xp.prototype.isRegistered=function(e){return!!this._actions[e]};var Ep={__init__:["editorActions"],editorActions:["type",xp]};function wp(e){e.invoke(xp,this)}t(wp,xp),wp.$inject=["injector"],wp.prototype._registerDefaultActions=function(e){xp.prototype._registerDefaultActions.call(this,e);var i=e.get("canvas",!1),r=e.get("elementRegistry",!1),o=e.get("selection",!1),t=e.get("spaceTool",!1),n=e.get("lassoTool",!1),a=e.get("handTool",!1),s=e.get("globalConnect",!1),c=e.get("distributeElements",!1),p=e.get("alignElements",!1),l=e.get("directEditing",!1),u=e.get("searchPad",!1),h=e.get("modeling",!1);i&&r&&o&&this._registerAction("selectElements",function(){var t=i.getRootElement(),e=r.filter(function(e){return e!==t});return o.select(e),e}),t&&this._registerAction("spaceTool",function(){t.toggle()}),n&&this._registerAction("lassoTool",function(){n.toggle()}),a&&this._registerAction("handTool",function(){a.toggle()}),s&&this._registerAction("globalConnectTool",function(){s.toggle()}),o&&c&&this._registerAction("distributeElements",function(e){var t=o.get(),n=e.type;t.length&&c.trigger(t,n)}),o&&p&&this._registerAction("alignElements",function(e){var t=o.get(),n=[],i=e.type;t.length&&(n=k(t,function(e){return!Ti(e,"bpmn:Lane")}),p.trigger(n,i))}),o&&h&&this._registerAction("setColor",function(e){var t=o.get();t.length&&h.setColor(t,e)}),o&&l&&this._registerAction("directEditing",function(){var e=o.get();e.length&&l.activate(e[0])}),u&&this._registerAction("find",function(){u.toggle()}),i&&h&&this._registerAction("moveToOrigin",function(){var e,t,n=i.getRootElement();e=ut(t=Ti(n,"bpmn:Collaboration")?r.filter(function(e){return Ti(e.parent,"bpmn:Collaboration")}):r.filter(function(e){return e!==n&&!Ti(e.parent,"bpmn:SubProcess")})),h.moveElements(t,{x:-e.x,y:-e.y},n)})};var Sp={__depends__:[Ep],editorActions:["type",wp]};function Cp(e){e.on(["create.init","shape.move.init"],function(e){var t=e.context;ba(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")})}Cp.$inject=["eventBus"];function Tp(e,t,n){return n||(n="round"),Math[n](e/t)*t}function Rp(e,t){var n=!t||!1!==t.active;this._eventBus=e;var o=this;e.on("diagram.init",800,function(){o.setActive(n)}),e.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,function(i){var e=i.originalEvent;if(!(!o.active||e&&Do(e))){var r=i.context;["x","y"].forEach(function(e){var t={};r.gridSnappingContext&&r.gridSnappingContext.snapLocation&&F(t,{offset:function(e,t){var n=e.context,i=e.shape,r=(n.gridSnappingContext||{}).snapLocation;if(!i||!r)return 0;if("x"===t){if(/left/.test(r))return-i.width/2;if(/right/.test(r))return i.width/2}else{if(/top/.test(r))return-i.height/2;if(/bottom/.test(r))return i.height/2}return 0}(i,e)});var n=function(e,t){var n=e.context,i=n.createConstraints,r=n.resizeConstraints||{},o=n.direction,a=null;i&&(a={},Ap(t)?(a.min=i.left,a.max=i.right):(a.min=i.top,a.max=i.bottom));var s=r.min,c=r.max;s&&(a={},Ap(t)?kp(o)?a.max=s.left:a.min=s.right:Pp(o)?a.max=s.top:a.min=s.bottom);c&&(a={},Ap(t)?kp(o)?a.min=c.left:a.max=c.right:Pp(o)?a.min=c.top:a.max=c.bottom);return a}(i,e);n&&F(t,n),zs(i,e)||o.snapEvent(i,e,t)})}})}function Ap(e){return"x"===e}function Pp(e){return"n"===e.charAt(0)}function kp(e){return"w"===e.charAt(1)}Rp.prototype.snapEvent=function(e,t,n){Fs(e,t,this.snapValue(e[t],n))},Rp.prototype.getGridSpacing=function(){return 10},Rp.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=Tp(e+=r,10),t&&t.min&&l(n=t.min)&&(n=Tp(n+r,10,"ceil"),e=Math.max(e,n)),t&&t.max&&l(i=t.max)&&(i=Tp(i+r,10,"floor"),e=Math.min(e,i)),e-=r},Rp.prototype.isActive=function(){return this.active},Rp.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},Rp.prototype.toggleActive=function(){this.setActive(!this.active)},Rp.$inject=["eventBus","config.gridSnapping"];function Mp(e,o){Ba.call(this,e),this.preExecute("elements.paste",2e3,function(e){var t=e.context,n=t.position,i=t.tree;if(i[0]){var r=qr(ut(i[0]));n.x=o.snapValue(n.x)+r.x%10,n.y=o.snapValue(n.y)+r.y%10}})}function Dp(e,t){Ba.call(this,e),this._gridSnapping=t;var o=this;this.preExecute("shape.resize",function(e){var t=e.context,n=(t.hints||{}).autoResize;if(n){var i=t.shape,r=t.newBounds;d(n)?t.newBounds=o.snapComplex(r,n):t.newBounds=o.snapSimple(i,r)}})}Mp.$inject=["eventBus","gridSnapping"],t(Mp,Ba),Dp.$inject=["eventBus","gridSnapping","modeling"],t(Dp,Ba),Dp.prototype.snapSimple=function(e,t){var n=this._gridSnapping;return t.width=n.snapValue(t.width,{min:t.width}),t.height=n.snapValue(t.height,{min:t.height}),t.x=e.x+e.width/2-t.width/2,t.y=e.y+e.height/2-t.height/2,t},Dp.prototype.snapComplex=function(e,t){return/w|e/.test(t)&&(e=this.snapHorizontally(e,t)),/n|s/.test(t)&&(e=this.snapVertically(e,t)),e},Dp.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),F(e,o),e},Dp.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),F(e,o),e};function Bp(e,n){e.on(["spaceTool.move","spaceTool.end"],2e3,function(e){var t=e.context;t.initialized&&("x"===t.axis?e.dx=n.snapValue(e.dx):e.dy=n.snapValue(e.dy))})}Bp.$inject=["eventBus","gridSnapping"];var Np={__depends__:[{__init__:["gridSnappingPasteBehavior","gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingPasteBehavior:["type",Mp],gridSnappingResizeBehavior:["type",Dp],gridSnappingSpaceToolBehavior:["type",Bp]}],__init__:["gridSnapping"],gridSnapping:["type",Rp]};function Op(e,a){e.on("autoPlace",function(e){var t=e.source,i=qr(t),r=e.shape,o=wa(t,r);return["x","y"].forEach(function(e){var t,n={};o[e]!==i[e]&&(o[e]>i[e]?n.min=o[e]:n.max=o[e],Ti(r,"bpmn:TextAnnotation")&&(t=e,n.offset="x"===t?-r.width/2:-r.height/2),o[e]=a.snapValue(o[e],n))}),o})}Op.$inject=["eventBus","gridSnapping"];function Lp(r,e,o){e.on(["create.start","shape.move.start"],1750,function(e){var t=e.context,n=t.shape,i=r.getRootElement();Ti(n,"bpmn:Participant")&&Ti(i,"bpmn:Process")&&i.children.length&&(t.createConstraints&&(n.width=o.snapValue(n.width,{min:n.width}),n.height=o.snapValue(n.height,{min:n.height})))})}Lp.$inject=["canvas","eventBus","gridSnapping"];function jp(e,t,o){Ba.call(this,e),this._gridSnapping=t;var a=this;this.postExecuted(["connection.create","connection.layout"],3e3,function(e){var t=e.context,n=t.connection,i=t.hints||{},r=n.waypoints;i.connectionStart||i.connectionEnd||3t.y?s.push(e):a.push(e),e.children}),o.length&&(n=s.length&&a.length?t.height/2:t.height,a.length&&(i=h.calculateAdjustments(a,"y",n,t.y-10),h.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:n},"s")),s.length&&(r=h.calculateAdjustments(s,"y",-n,t.y+t.height+10),h.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:-n},"n")))))})}function Bl(e,c){Ba.call(this,e),this.preExecute("elements.move",function(e){var t,n,i,r,o,a=e.shapes,s=e.newHost;1===a.length&&(rr(t=a[0])||s||!Ti(t,"bpmn:BoundaryEvent")||(i=(n=(o=Ri(t))&&o.eventDefinitions&&o.eventDefinitions[0])?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:n.$type}:{type:"bpmn:IntermediateThrowEvent"},r=c.replaceElement(t,i,{layoutConnection:!1}),e.shapes=[r]))},!0)}function Nl(e,f,y){function r(e,t,n){var i,r,o,a,s,c,p,l=t.waypoints,u=e.outgoing.slice(),h=e.incoming.slice(),d=ns(l,n);if(d){if(i=l.slice(0,d.index),r=l.slice(d.index+(d.bendpoint?1:0)),!i.length||!r.length)return;o=d.bendpoint?l[d.index]:n,Ol(e,i[i.length-1])||i.push(Ll(o)),Ol(e,r[0])||r.unshift(Ll(o))}a=t.source,s=t.target,f.canConnect(a,e,t)&&(y.reconnectEnd(t,e,i||n),c=t),f.canConnect(e,s,t)&&(p=c?y.connect(e,s,{type:t.type,waypoints:r}):(y.reconnectStart(t,e,r||n),t));var m=[].concat(c&&k(h,function(e){return e.source===c.source})||[],p&&k(u,function(e){return e.source===p.source})||[]);m.length&&y.removeElements(m)}Ba.call(this,e),this.preExecute("elements.move",function(e){var t=e.newParent,n=e.shapes,i=e.delta,r=n[0];if(r&&t){t&&t.waypoints&&(e.newParent=t=t.parent);var o,a=(o=r,{x:Math.round(o.x+o.width/2),y:Math.round(o.y+o.height/2)}),s={x:a.x+i.x,y:a.y+i.y},c=A(t.children,function(e){return f.canInsert(n,e)&&ns(e.waypoints,s)});c&&(e.targetFlow=c,e.position=s)}},!0),this.postExecuted("elements.move",function(e){var t=e.shapes,n=e.targetFlow,i=e.position;n&&r(t[0],n,i)},!0),this.preExecute("shape.create",function(e){var t=e.parent,n=e.shape;f.canInsert(n,t)&&(e.targetFlow=t,e.parent=t.parent)},!0),this.postExecuted("shape.create",function(e){var t=e.shape,n=e.targetFlow,i=e.position;n&&r(t,n,i)},!0)}function Ol(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 Ll(e){return F({},e)}function jl(e,r){Ba.call(this,e),this.preExecuted("connection.create",function(e){var t=e.context.source,n=e.context.target,i=n.incoming.slice();Ti(t,"bpmn:EventBasedGateway")&&n.incoming.length&&i.filter(Il).forEach(function(e){r.removeConnection(e)})}),this.preExecuted("shape.replace",function(e){var t=e.context.newShape;Ti(t,"bpmn:EventBasedGateway")&&t.outgoing.filter(Il).map(function(e){return e.target}).reduce(function(e,t){var n=t.incoming.filter(Il);return e.concat(n)},[]).forEach(function(e){e.source!==t&&r.removeConnection(e)})})}function Il(e){return Ti(e,"bpmn:SequenceFlow")}function zl(e,o,t,a){function s(){return Ri(t.getRootElement()).$parent}function c(e){var t,n=Ri(e).categoryValueRef,i=n.$parent;n&&(vt(i.categoryValue,n),i&&!i.categoryValue.length&&(t=i,vt(s().get("rootElements"),t)))}Ba.call(this,e),this.executed("shape.delete",function(e){var n,t=e.context.shape;if(Ti(t,"bpmn:Group")){var i=Ri(t).categoryValueRef,r=a.filter(function(e){return Ti(e,"bpmn:Group")});n=i,r.some(function(e){var t=Ri(e);return t.categoryValueRef&&t.categoryValueRef===n})||c(t)}}),this.reverted("shape.delete",function(e){var t=e.context.shape;if(Ti(t,"bpmn:Group")){var n=Ri(t).categoryValueRef,i=s(),r=n?n.$parent:null;gt(r.get("categoryValue"),n),gt(i.get("rootElements"),r)}}),this.execute("shape.create",function(e){var t=e.context.shape,n=Ri(t),i=t.oldBusinessObject;if(Ti(n,"bpmn:Group")&&!n.categoryValueRef){var r=al(s(),o);i&&i.categoryValueRef&&(r.value=i.categoryValueRef.value),n.categoryValueRef=r}}),this.revert("shape.create",function(e){var t=e.context.shape;Ti(t,"bpmn:Group")&&(c(t),delete Ri(t).categoryValueRef)})}function Fl(e,t,n,i){var r,o,a,s;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,a=e.x-n.x,s=((i.x-n.x)*o-(i.y-n.y)*a)/r,{x:Math.round(e.x+s*(t.x-e.x)),y:Math.round(e.y+s*(t.y-e.y))})}function $l(e){function r(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},a=Fl(e,t,n,r),s=Fl(e,t,n,o);i=a&&s?Gl(a,n)>Gl(s,n)?s:a:a||s,e.original=i}e.on("bpmnElement.added",function(e){var t,n,i=e.element;i.waypoints&&(r((n=(t=i).waypoints)[0],n[1],qr(t.source)),r(n[n.length-1],n[n.length-2],qr(t.target)))})}function Gl(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Hl(e){Ba.call(this,e);var n=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],function(e){var t=Ri(e.context.shape);ba(t,n)&&!t.di.get("isHorizontal")&&t.di.set("isHorizontal",!0)})}function Vl(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Wl(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Ul(e,t){var n,i,r,o,a=t[0],s=t[1],c={x:s.x-a.x,y:s.y-a.y},p=(n=[a.x,a.y],i=[c.x,c.y],r=[e.x,e.y],-((o=[{n:n[0]-r[0],lambda:i[0]},{n:n[1]-r[1],lambda:i[1]}])[0].n*i[0]+o[1].n*i[1])/(o[0].lambda*i[0]+o[1].lambda*i[1]));return{x:a.x+p*c.x,y:a.y+p*c.y}}function ql(e,t){return Vl({x:e.x-t.x,y:e.y-t.y})}Dl.$inject=["eventBus","modeling","spaceTool"],t(Dl,Ba),Bl.$inject=["eventBus","bpmnReplace"],t(Bl,Ba),t(Nl,Ba),Nl.$inject=["eventBus","bpmnRules","modeling"],jl.$inject=["eventBus","modeling"],t(jl,Ba),zl.$inject=["eventBus","bpmnFactory","canvas","elementRegistry"],t(zl,Ba),$l.$inject=["eventBus"],Hl.$inject=["eventBus"],t(Hl,Ba);var Yl=Math.sqrt,Kl=Math.min,Xl=Math.max,Zl=Math.abs;function Ql(e){return Math.pow(e,2)}function Jl(e,t){return Yl(Ql(e.x-t.x)+Ql(e.y-t.y))}function eu(r,o,e,t){var n=o.x-r.x,i=o.y-r.y,a=e.x-r.x,s=e.y-r.y,c=n*n+i*i,p=(n*a+i*s)/c,l=p*p-(a*a+s*s-t*t)/c;if(l<0&&-1e-6=Kl(t,n)-nu&&e<=Xl(t,n)+nu}var nu=.1;function iu(e,t){return Zl(e.x-t.x)<=nu&&Zl(e.y-t.y)<=nu}function ru(e,t,n,i){var r,o=0,a=0,s={x:(r=e).x+r.width/2,y:r.y+r.height/2},c=function(e,t){var n,i,r,o,a,s,c,p,l,u,h,d,m=0;for(m=0;m line intersections");1===s.length&&(c={type:"bendpoint",position:s[0],segmentIndex:m,bendpointIndex:iu(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:Jl(n,a)/Jl(n,i)}),p=Jl(c.position,e),(!u||pt.length-2)return{x:o,y:a};var u,h,d,m,f,y,v=au(n,p),g=au(t,l),b=c.position,x=(m=b,f=ql((d=v)[0],d[1]),y=ql(d[0],m),0===f?0:y/f),_=(u=g,h=Wl(v),Wl(u)-h);if("bendpoint"===c.type){var E=t.length-n.length,w=c.bendpointIndex,S=n[w];if(-1!==t.indexOf(S))return{x:o,y:a};if(0===E){var C=t[w];return{x:C.x-c.position.x,y:C.y-c.position.y}}E<0&&0!==w&&w"+t+"
"})}e.on(["shape.move.rejected","create.rejected"],function(e){var t=e.context,n=t.shape;Ti(t.target,"bpmn:Collaboration")&&Ti(n,"bpmn:FlowNode")&&o(e,r(uu))}),e.on(["elements.paste.rejected"],function(e){var t=e.context,n=t.position,i=t.target;Ti(i,"bpmn:Collaboration")&&o(n,r(uu)),Ti(i,"bpmn:Process")&&o(n,r("participants cannot be pasted onto a non-empty process diagram"),3e3)})}function du(e,h,d,t){Ba.call(this,e);var m=t.get("dragging",!1);function n(e){var t,n,i=e.source,r=e.target;e.parent&&(Ti(e,"bpmn:SequenceFlow")&&(d.canConnectSequenceFlow(i,r)||(n=!0),d.canConnectMessageFlow(i,r)&&(t="bpmn:MessageFlow")),Ti(e,"bpmn:MessageFlow")&&(d.canConnectMessageFlow(i,r)||(n=!0),d.canConnectSequenceFlow(i,r)&&(t="bpmn:SequenceFlow")),Ti(e,"bpmn:Association")&&!d.canConnectAssociation(i,r)&&(n=!0),n&&h.removeConnection(e),t&&h.connect(i,r,{type:t,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",function(e){M(e.closure.allConnections,n)},!0),this.preExecute(["connection.reconnectStart","connection.reconnectEnd"],function(e){var t,n,i=e.context,r=i.connection,o=i.newSource||r.source,a=i.newTarget||r.target;(t=d.canConnect(o,a))&&t.type!==r.type&&(n=h.connect(o,a,{type:t.type,waypoints:r.waypoints.slice()}),h.removeConnection(r),i.connection=n,m&&(s=r,c=n,l=m.context(),u=l&&l.payload.previousSelection,u&&u.length&&-1!==(p=u.indexOf(s))&&u.splice(p,1,c)));var s,c,p,l,u}),this.postExecuted("element.updateProperties",function(e){var t,n=e.context,i=n.properties,r=n.element,o=r.businessObject;i.default&&(t=A(r.outgoing,D({id:r.businessObject.default.id})))&&h.updateProperties(t,{conditionExpression:void 0}),i.conditionExpression&&o.sourceRef.default===o&&h.updateProperties(r.source,{default:void 0})})}function mu(e,n){Ba.call(this,e),this.preExecute("shape.delete",function(e){var t=e.shape,n=t.parent;Ti(t,"bpmn:Participant")&&(e.collaborationRoot=n)},!0),this.postExecute("shape.delete",function(e){var t=e.collaborationRoot;t&&!t.businessObject.participants.length&&n.makeProcess()},!0)}function fu(e,t,a,n,i,r){Ba.call(this,e),this._bpmnReplace=t,this._elementRegistry=n,this._selection=i,this._modeling=r,this.postExecuted(["elements.move"],500,function(e){var t=e.context,n=t.newParent,i=t.newHost,r=[];M(t.closure.topLevel,function(e){r=Pi(e)?r.concat(e.children):r.concat(e)}),1===r.length&&i&&(n=i);var o=a.canReplace(r,n);o&&this.replaceElements(r,o.replacements,i)},this),this.postExecute(["shape.replace"],1500,function(e){var t,n=e.context,i=n.oldShape,r=n.newShape,o=i.attachers;o&&o.length&&(t=a.canReplace(o,r),this.replaceElements(o,t.replacements))},this),this.postExecuted(["shape.replace"],1500,function(e){var t=e.context,n=t.oldShape,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})})}hu.$inject=["eventBus","tooltips","translate"],t(du,Ba),du.$inject=["eventBus","modeling","bpmnRules","injector"],mu.$inject=["eventBus","modeling"],t(mu,Ba),t(fu,Ba),fu.prototype.replaceElements=function(r,e,o){var a=this._elementRegistry,s=this._bpmnReplace,t=this._selection,c=this._modeling;M(e,function(e){var t={type:e.newElementType},n=a.get(e.oldElementId);o&&Ti(n,"bpmn:BoundaryEvent")&&c.updateAttachment(n,null);var i=r.indexOf(n);r[i]=s.replaceElement(n,t,{select:!1}),o&&Ti(r[i],"bpmn:BoundaryEvent")&&c.updateAttachment(r[i],o)}),e&&t.select(r)},fu.$inject=["eventBus","bpmnReplace","bpmnRules","elementRegistry","selection","modeling"];var yu=Math.abs,vu=Math.min,gu=Math.max;function bu(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function xu(e,t,n){return bu(e,t,n,vu)}function _u(e,t,n){return bu(e,t,n,gu)}var Eu=60,wu=300,Su=20,Cu=50,Tu=20,Ru=20;var Au={width:300,height:150},Pu={width:140,height:120},ku={width:50,height:30};function Mu(e){e.on("resize.start",1500,function(e){var t,n,i,r,o,a,s,c,p,l,u=e.context,h=u.shape,d=u.direction,m=u.balanced;(Ti(h,"bpmn:Lane")||Ti(h,"bpmn:Participant"))&&(u.resizeConstraints=(n=d,i=m,r=np(t=h),a=o=!0,s=ep(r,[r]),c=Wr(t),p={},l={},/e/.test(n)?l.right=c.left+wu:/w/.test(n)&&(l.left=c.right-wu),s.forEach(function(e){var t=Wr(e);/n/.test(n)&&(t.topc.bottom+10&&(a=!1),i&&yu(c.bottom-t.top)<10&&xu(p,"bottom",t.bottom-Eu),yu(c.bottom-t.bottom)<5&&_u(l,"bottom",t.top+Eu))}),r.children.filter(function(e){return!e.hidden&&!e.waypoints&&(Ti(e,"bpmn:FlowElement")||Ti(e,"bpmn:Artifact"))}).forEach(function(e){var t=Wr(e);o&&/n/.test(n)&&xu(l,"top",t.top-Tu),/e/.test(n)&&_u(l,"right",t.right+Su),a&&/s/.test(n)&&_u(l,"bottom",t.bottom+Ru),/w/.test(n)&&xu(l,"left",t.left-Cu)}),{min:l,max:p})),Ti(h,"bpmn:Participant")&&(u.minDimensions=Au),Ti(h,"bpmn:SubProcess")&&Ai(h)&&(u.minDimensions=Pu),Ti(h,"bpmn:TextAnnotation")&&(u.minDimensions=ku)})}Mu.$inject=["eventBus"];function Du(e,o){e.on("resize.start",1501,function(e){var t=e.context,n=t.shape;(Ti(n,"bpmn:Lane")||Ti(n,"bpmn:Participant"))&&(t.balanced=!ao(e))}),e.on("resize.end",1001,function(e){var t=e.context,n=t.shape,i=t.canExecute,r=t.newBounds;if(Ti(n,"bpmn:Lane")||Ti(n,"bpmn:Participant"))return i&&(r=Hr(r),o.resizeLane(n,r,t.balanced)),!1})}function Bu(e,c,p){Ba.call(this,e),this.preExecute("shape.delete",function(e){var t=e.context.shape;if(1===t.incoming.length&&1===t.outgoing.length){var n,i,r,o=t.incoming[0],a=t.outgoing[0];if(Ti(o,"bpmn:SequenceFlow")&&Ti(a,"bpmn:SequenceFlow"))if(c.canConnect(o.source,a.target,o)){var s=(n=o.waypoints,i=a.waypoints,(r=Fl(Nu(n[n.length-2]),Nu(n[n.length-1]),Nu(i[1]),Nu(i[0])))?[].concat(n.slice(0,n.length-1),[r],i.slice(1)):[Nu(n[0]),Nu(i[i.length-1])]);p.reconnectEnd(o,a.target,s)}}})}function Nu(e){return e.original||e}function Ou(e,r){Ba.call(this,e),e.on("create.start",function(e){var t=e.context.shape;e.context.hints.shouldAddStartEvent=Ti(t,"bpmn:SubProcess")&&Ai(t)}),this.postExecuted("shape.create",function(e){var t,n=e.context.shape;e.context.hints.shouldAddStartEvent&&(t=Lu(n),r.createShape({type:"bpmn:StartEvent"},t,n))}),this.postExecuted("shape.replace",function(e){var t,n=e.context.oldShape,i=e.context.newShape;Ti(i,"bpmn:SubProcess")&&Ti(n,"bpmn:Task")&&Ai(i)&&(t=Lu(i),r.createShape({type:"bpmn:StartEvent"},t,i))})}function Lu(e){return{x:e.x+e.width/6,y:e.y+e.height/2}}Du.$inject=["eventBus","modeling"],t(Bu,Ba),Bu.$inject=["eventBus","bpmnRules","modeling"],Ou.$inject=["eventBus","modeling"],t(Ou,Ba);function ju(e,h,d,t){Ba.call(this,e),this.executed(["shape.toggleCollapse"],500,function(e){var t,n=e.context.shape;Ti(n,"bpmn:SubProcess")&&(n.collapsed?Ri(n).di.isExpanded=!1:((t=n.children).length&&t.forEach(function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)}),Ri(n).di.isExpanded=!0))}),this.reverted(["shape.toggleCollapse"],500,function(e){var t=e.context.shape;t.collapsed?Ri(t).di.isExpanded=!1:Ri(t).di.isExpanded=!0}),this.postExecuted(["shape.toggleCollapse"],500,function(e){var t,n,i,r,o,a,s,c,p,l=e.context.shape,u=h._getDefaultSize(l);t=l.collapsed?(p=u,{x:(c=l).x+(c.width-p.width)/2,y:c.y+(c.height-p.height)/2,width:p.width,height:p.height}):(i=u,a=(n=l).children,s=i,r=Zc((o=a,o.filter(function(e){return!e.hidden})).concat([n])),s.y=r?(s.width=Math.max(r.width,s.width),s.height=Math.max(r.height,s.height),s.x=r.x+(r.width-s.width)/2,r.y+(r.height-s.height)/2):(s.x=n.x+(n.width-s.width)/2,n.y+(n.height-s.height)/2),s),d.resizeShape(l,t,null,{autoResize:!l.collapsed&&"nwse"})})}function Iu(e,t){Ba.call(this,e),this.preExecute("elements.delete",function(e){M(e.context.elements,function(e){t.unclaimId(e.businessObject.id,e.businessObject)})})}t(ju,Ba),ju.$inject=["eventBus","elementFactory","modeling"],t(Iu,Ba),Iu.$inject=["eventBus","modeling"];function zu(e,t,i){var r;Ba.call(this,e);var n=["spaceTool","lane.add","lane.resize","lane.split","elements.move","elements.delete","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(n,5e3,function(e){(r=r||new Fu).enter()}),this.postExecuted(n,500,function(e){!function(){if(!r)throw new Error(i("out of bounds release"));var e=r.leave();e&&(t.updateLaneRefs(r.flowNodes,r.lanes),r=null)}()}),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],function(e){var t=e.context.shape,n=function(){if(!r)throw new Error(i("out of bounds release"));return r}();t.labelTarget||(Ti(t,"bpmn:Lane")&&n.addLane(t),Ti(t,"bpmn:FlowNode")&&n.addFlowNode(t))})}function Fu(){this.flowNodes=[],this.lanes=[],this.counter=0,this.addLane=function(e){this.lanes.push(e)},this.addFlowNode=function(e){this.flowNodes.push(e)},this.enter=function(){this.counter++},this.leave=function(){return this.counter--,!this.counter}}function $u(e,i){Ba.call(this,e),this.preExecute("connection.delete",function(e){var t=e.context.connection,n=t.source;(function(e,t){if(!Ti(e,"bpmn:SequenceFlow"))return!1;var n=Ri(t),i=Ri(e);return n.get("default")===i})(t,n)&&i.updateProperties(n,{default:null})})}zu.$inject=["eventBus","modeling","translate"],t(zu,Ba),t($u,Ba),$u.$inject=["eventBus","modeling"];var Gu={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","attachEventBehavior","boundaryEventBehavior","copyPasteBehavior","fixHoverBehavior","createBoundaryEventBehavior","createDataObjectBehavior","createParticipantBehavior","dataStoreBehavior","dataInputAssociationBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","modelingFeedback","removeElementBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","toggleElementCollapseBehaviour","subProcessStartEventBehavior","unclaimIdBehavior","unsetDefaultFlowBehavior","updateFlowNodeRefsBehavior"],adaptiveLabelPositioningBehavior:["type",ml],appendBehavior:["type",yl],attachEventBehavior:["type",vl],boundaryEventBehavior:["type",gl],copyPasteBehavior:["type",bl],fixHoverBehavior:["type",xl],createBoundaryEventBehavior:["type",_l],createDataObjectBehavior:["type",El],createParticipantBehavior:["type",Tl],dataInputAssociationBehavior:["type",Al],dataStoreBehavior:["type",Ml],deleteLaneBehavior:["type",Dl],detachEventBehavior:["type",Bl],dropOnFlowBehavior:["type",Nl],eventBasedGatewayBehavior:["type",jl],groupBehavior:["type",zl],importDockingFix:["type",$l],isHorizontalFix:["type",Hl],labelBehavior:["type",lu],modelingFeedback:["type",hu],replaceConnectionBehavior:["type",du],removeParticipantBehavior:["type",mu],replaceElementBehaviour:["type",fu],resizeBehavior:["type",Mu],resizeLaneBehavior:["type",Du],removeElementBehavior:["type",Bu],toggleElementCollapseBehaviour:["type",ju],subProcessStartEventBehavior:["type",Ou],unclaimIdBehavior:["type",Iu],updateFlowNodeRefsBehavior:["type",zu],unsetDefaultFlowBehavior:["type",$u]};function Hu(e,t){var n=Yr(e,t,-15);return"intersect"!==n?n:null}function Vu(e){La.call(this,e)}function Wu(e){return!e||rr(e)}function Uu(e){do{if(Ti(e,"bpmn:Process"))return Ri(e);if(Ti(e,"bpmn:Participant"))return Ri(e).processRef||Ri(e)}while(e=e.parent)}function qu(e){return Ti(e,"bpmn:TextAnnotation")}function Yu(e){return Ti(e,"bpmn:Group")&&!e.labelTarget}function Ku(e){return Ti(e,"bpmn:BoundaryEvent")&&Qu(e,"bpmn:CompensateEventDefinition")}function Xu(e){return Ri(e).isForCompensation}function Zu(e){for(var t=e;t=t.parent;){if(Ti(t,"bpmn:FlowElementsContainer"))return Ri(t);if(Ti(t,"bpmn:Participant"))return Ri(t).processRef}return null}function Qu(e,t){return!!A(Ri(e).eventDefinitions||[],function(e){return Ti(e,t)})}function Ju(e,t){return(Ri(e).eventDefinitions||[]).every(function(e){return Ti(e,t)})}function eh(e){return Ti(e,"bpmn:ReceiveTask")||Ti(e,"bpmn:IntermediateCatchEvent")&&(Qu(e,"bpmn:MessageEventDefinition")||Qu(e,"bpmn:TimerEventDefinition")||Qu(e,"bpmn:ConditionalEventDefinition")||Qu(e,"bpmn:SignalEventDefinition"))}function th(e){return e.waypoints}function nh(e,t){return-1!==function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t).indexOf(e)}function ih(e,t,n){if(Wu(e)||Wu(t))return null;if(!Ti(n,"bpmn:DataAssociation")){if(fh(e,t))return{type:"bpmn:MessageFlow"};if(yh(e,t))return{type:"bpmn:SequenceFlow"}}var i=vh(e,t);return i||(Ku(e)&&Xu(t)?{type:"bpmn:Association",associationDirection:"One"}:!!mh(e,t)&&{type:"bpmn:Association"})}function rh(e,t,n){return!(!rr(e)&&!Yu(e))||!(Ti(t,"bpmn:Participant")&&!Ai(t))&&(Ti(e,"bpmn:Participant")?Ti(t,"bpmn:Process")||Ti(t,"bpmn:Collaboration"):ba(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Ti(e,"bpmn:Lane")?Ti(t,"bpmn:Participant")||Ti(t,"bpmn:Lane"):!(Ti(e,"bpmn:BoundaryEvent")&&(!Ri(i=e).cancelActivity||!sh(i)&&!ch(i)))&&(Ti(e,"bpmn:FlowElement")&&!Ti(e,"bpmn:DataStoreReference")?Ti(t,"bpmn:FlowElementsContainer")?Ai(t):ba(t,["bpmn:Participant","bpmn:Lane"]):ba(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?ba(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Ti(e,"bpmn:MessageFlow")&&(Ti(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)));var i}function oh(e){return Ti(e,"bpmn:Lane")}function ah(e){return!(rr(t=e)||!Ti(t,"bpmn:BoundaryEvent"))||(!(!Ti(e,"bpmn:IntermediateThrowEvent")||!sh(e))||Ti(e,"bpmn:IntermediateCatchEvent")&&ch(e));var t}function sh(e){var t=Ri(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function ch(e){return t=e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"].some(function(e){return Qu(t,e)});var t}function ph(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r,o=e[0];return!rr(o)&&(!!ah(o)&&(!Pi(t)&&(!(!Ti(t,"bpmn:Activity")||Xu(t))&&(!(i&&!Hu(i,t))&&((!Ti(r=t,"bpmn:ReceiveTask")||!A(r.incoming,function(e){return Ti(e.source,"bpmn:EventBasedGateway")}))&&"attach")))))}function lh(e,n,i){if(!n)return!1;var r={replacements:[]};return M(e,function(e){var t;Pi(n)||Ti(e,"bpmn:StartEvent")&&"label"!==e.type&&rh(e,n)&&((t=e)&&!1!==Ri(t).isInterrupting||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(ki(e,"bpmn:ErrorEventDefinition")||ki(e,"bpmn:EscalationEventDefinition")||ki(e,"bpmn:CompensateEventDefinition"))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Ti(n,"bpmn:Transaction")||Qu(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Ti(e,"bpmn:EndEvent")&&rh(e,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Ti(e,"bpmn:BoundaryEvent")&&ph(e,n,0,i)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))}),!!r.replacements.length&&r}function uh(e,t){return!v(e,oh)&&(!t||e.every(function(e){return rh(e,t)}))}function hh(e,t,n,i){return!!t&&(!(!rr(e)&&!Yu(e))||n!==t&&((!n||!nh(n,t))&&(rh(e,t)||gh(e,t))))}function dh(e,t){return Ti(e,"bpmn:SubProcess")?Ai(e)&&(!t||100<=t.width&&80<=t.height):Ti(e,"bpmn:Lane")?!t||130<=t.width&&60<=t.height:Ti(e,"bpmn:Participant")?!t||250<=t.width&&50<=t.height:!!qu(e)||!!Yu(e)}function mh(e,t){return!th(e)&&!th(t)&&(!(!Ku(e)||!Xu(t))||!nh(t,e)&&!nh(e,t)&&(n=t,i=qu(e),r=qu(n),(i||r)&&i!==r));var n,i,r}function fh(e,t){return!!t.parent&&(Ti(r=e,"bpmn:InteractionNode")&&(!Ti(r,"bpmn:Event")||Ti(r,"bpmn:ThrowEvent")&&Ju(r,"bpmn:MessageEventDefinition"))&&(Ti(i=t,"bpmn:InteractionNode")&&!Xu(i)&&(!Ti(i,"bpmn:Event")||Ti(i,"bpmn:CatchEvent")&&Ju(i,"bpmn:MessageEventDefinition")))&&(n=t,!(Uu(e)===Uu(n))));var n,i,r}function yh(e,t){return!(eh(t)&&0");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)},Th.prototype._pushAction=function(e){var t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in or phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},Th.prototype._popAction=function(){var e=this._currentExecution,t=e.actions,n=e.dirty;t.pop(),t.length||(this._eventBus.fire("elements.changed",{elements:C("id",n)}),n.length=0,this._fire("changed"))},Th.prototype._markDirty=function(e){var t=this._currentExecution;e&&(e=g(e)?e:[e],t.dirty=t.dirty.concat(e))},Th.prototype._executedAction=function(e,t){var n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},Th.prototype._revertedAction=function(e){this._stackIdx--},Th.prototype._getHandler=function(e){return this._handlerMap[e]},Th.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 Rh={commandStack:["type",Th]},Ah=new go("tt");function Ph(e,t){e.style.display=!1===t?"none":""}var kh="djs-tooltip",Mh="."+kh;function Dh(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Ah,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),i=se('
'),n.insertBefore(i,n.firstChild),i);var r=this;ae.bind(this._tooltipRoot,Mh,"mousedown",function(e){e.stopPropagation()}),ae.bind(this._tooltipRoot,Mh,"mouseover",function(e){r.trigger("mouseover",e)}),ae.bind(this._tooltipRoot,Mh,"mouseout",function(e){r.trigger("mouseout",e)}),this._init()}Dh.$inject=["eventBus","canvas"],Dh.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=F({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Dh.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(G(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Dh.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Dh.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Dh.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout(function(){t.remove(e)},e.timeout)}},Dh.prototype.remove=function(e){var t=this.get(e);t&&(fe(t.html),fe(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Dh.prototype.show=function(){Ph(this._tooltipRoot)},Dh.prototype.hide=function(){Ph(this._tooltipRoot,!1)},Dh.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},Dh.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=se(i)),(t=se('
')).appendChild(i),e.type&&q(t).add("djs-tooltip-"+e.type),e.className&&q(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Dh.prototype._updateTooltip=function(e){var t,n,i,r=e.position,o=e.htmlContainer;t=o,n=r.x,i=r.y,F(t.style,{left:n+"px",top:i+"px"})},Dh.prototype._updateTooltipVisibilty=function(r){M(this._tooltips,function(e){var t=e.show,n=e.htmlContainer,i=!0;t&&((t.minZoom>r.scale||t.maxZoome.x+e.width||"e"===i&&t.xe.y+e.height||"s"===i&&t.yVh(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(Vh(i)<5)return!1;i<0&&(i*=-1),ao(e)&&(i*=-1);var o=lt(this._canvas.getRootElement(),!0);return F(t,this.calculateAdjustments(o,n,i,r),{axis:n,direction:function(e,t){if("x"===e){if(0n.left&&in.top&&r: must be specified as : with start/end in { h,v,t,r,b,l }");var i,r;if(wm(n)){var o=ym(e,t,n),a={waypoints:(r=ym(t,e,vm(n))).waypoints.slice().reverse(),directions:vm(r.directions),turnNextDirections:r.turnNextDirections},s=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:gm(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(o,a);return[].concat(o.waypoints,s.waypoints,a.waypoints)}return function(e,t,n){var i=dm((t.x-e.x)/2+e.x),r=dm((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function bm(e,t,n,i,r){var o=f(r&&r.preferredLayouts||[],"straight")[0]||"h:h",a=Yr(e,t,fm[o]||0),s=function(e,t){if(wm(t))return t;switch(e){case"intersect":return"t:t";case"top":case"bottom":return"v:v";case"left":case"right":return"h:h";default:return t}}(a,o);n=n||qr(e),i=i||qr(t);var c,p,l,u=s.split(":"),h=Sm(n,e,u[0],{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[a]),d=Sm(i,t,u[1],a);return(l=gm(c=h,p=d,s)).unshift(c),l.push(p),Cm(l)}function xm(e,t,n,i,r,o){var a,s,c,p,l;return g(n)&&(r=n,o=i,n=qr(e),i=qr(t)),r=r||[],(a=-1!==(o=F({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,a,s={};if(a=Yr(e,t),!/^(top|bottom|left|right)$/.test(a))return null;/top|bottom/.test(a)&&(o="x");/left|right/.test(a)&&(o="y");return"target"===r.preserveDocking?_m(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:_m(o,n,t)?(s[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y,original:{x:void 0!==s.x?s.x:i.x,y:void 0!==s.y?s.y:i.y}}]):null}(e,t,n,i,o))?a:(a=o.connectionEnd&&(s=t,c=e,p=i,l=r.slice().reverse(),(l=Em(s,c,p,l))?l.reverse():null))?a:(a=o.connectionStart&&Em(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:bm(e,t,n,i,o))}function _m(e,t,n){var i,r,o;return i=t[e],r=n[e],o=n[e]+n[{x:"width",y:"height"}[e]],r<=i&&i<=o}function Em(e,t,n,i){if((r=i).length<3||!(4")}function Cm(i){return i.reduce(function(e,t,n){return ar(e[e.length-1],i[n+1],t,0)||e.push(t),e},[])}var Tm=40;function Rm(){}function Am(e,t){return e?e.original||e:qr(t)}function Pm(e,t){return Ti(t,"bpmn:Activity")&&Ti(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function km(e){return Ti(e,"bpmn:SubProcess")&&Ai(e)}function Mm(e,t){return e===t}t(Rm,lm),Rm.prototype.layoutConnection=function(e,t){var n,i,r,o,a=(t=t||{}).source||e.source,s=t.target||e.target,c=e.waypoints,p=t.connectionStart,l=t.connectionEnd;return p||(p=Am(c&&c[0],a)),l||(l=Am(c&&c[c.length-1],s)),(Ti(e,"bpmn:Association")||Ti(e,"bpmn:DataAssociation"))&&c&&!Pm(a,s)?[].concat([p],c.slice(1,-1),[l]):(Ti(e,"bpmn:MessageFlow")?n={preferredLayouts:["straight","v:v"],preserveDocking:(r=a,o=s,Ti(o,"bpmn:Participant")?"source":Ti(r,"bpmn:Participant")?"target":km(o)?"source":km(r)?"target":Ti(o,"bpmn:Event")?"target":Ti(r,"bpmn:Event")?"source":null)}:(Ti(e,"bpmn:SequenceFlow")||Pm(a,s))&&(n=a===s?{preferredLayouts:["b:l"]}:Ti(a,"bpmn:BoundaryEvent")?{preferredLayouts:function(e,t,n){var i,r,o=qr(e),a=qr(t),s=(d=e,m=d.host,Yr(qr(d),m,-10)),c=Mm(e.host,t),p=(u=s,h=["top","right","bottom","left"],-1!==h.indexOf(u)),l=Yr(a,o,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});var u,h;var d,m;if(c)return function(e,t,n,i,r){var o,a=Bm[t?e:Om(e)];o=t?Lm(e)?jm("y",n,i,r)?"h":"b":jm("x",n,i,r)?"v":"l":"v";return[a+":"+o]}(s,p,e,t,n);return S=s,C=l,T=p,i=T?Bm[S]:Mm(Om(S),Om(C))||(R=Nm(S),A=Nm(C),Dm[R]===A)?Bm[Om(S)]:Bm[Nm(S)],f=s,y=l,v=p,r=v?Lm(f)?(_=y,E=Nm(f),w=Dm[E],-1!==_.indexOf(w)||Mm(f,y)?"h":"v"):(g=y,b=Om(f),x=Dm[b],-1!==g.indexOf(x)||Mm(f,y)?"v":"h"):Lm(y)||Mm(Om(f),Om(y))&&Nm(y)?"h":"v",[i+":"+r];var f,y,v,g,b,x,_,E,w;var S,C,T,R,A}(a,s,l)}:Ti(a,"bpmn:Gateway")?{preferredLayouts:["v:h"]}:Ti(s,"bpmn:Gateway")?{preferredLayouts:["h:v"]}:{preferredLayouts:["h:h"]}),n&&(i=Cm(xm(a,s,p,l,c,n=F(n,t)))),i||[p,l])};var Dm={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Bm={top:"t",right:"r",bottom:"b",left:"l"};function Nm(e){var t=/right|left/.exec(e);return t&&t[0]}function Om(e){var t=/top|bottom/.exec(e);return t&&t[0]}function Lm(e){return"right"===e||"left"===e}function jm(e,t,n,i){var r=Tm;return!(Im(e,i,n,r)||Im(e,i,{x:n.x+n.width,y:n.y+n.height},r)||Im(e,i,qr(t),r))}function Im(e,t,n,i){return Math.abs(t[e]-n[e])
'),p.appendChild(i));var r,o,a,s=e.html||(e.separator?'
':'
'),c=se(s);i.appendChild(c),e.separator||(G(c,"data-action",t),e.title&&G(c,"title",e.title),e.className&&(r=c,o=e.className,a=q(r),(g(o)?o:o.split(/\s+/g)).forEach(function(e){a.add(e)})),e.imageUrl&&c.appendChild(se('')))}),this.open()},Qm.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[G(s,"data-action")])&&(r=i.action,o=t.originalEvent||t,u(r)?"click"===e&&r(o,n):r[e]&&r[e](o,n),t.preventDefault())},Qm.prototype._layoutChanged=function(){this._toggleState({})},Qm.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Qm.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Qm.prototype.open=function(){this._toggleState({open:!0})},Qm.prototype.toggle=function(e){this.isOpen()?this.close():this.open()},Qm.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Qm.prototype.updateToolHighlight=function(i){var e;this._toolsContainer||(e=de(".djs-palette-entries",this._container),this._toolsContainer=de("[data-group=tools]",e)),M(this._toolsContainer.children,function(e){var t=e.getAttribute("data-action");if(t){var n=q(e);t=t.replace("-tool",""),n.contains("entry")&&t===i?n.add("highlighted-entry"):n.remove("highlighted-entry")}})},Qm.prototype.isOpen=function(){return q(this._container).has("open")},Qm.prototype._getParentContainer=function(){return this._canvas.getContainer()},Qm.HTML_MARKUP='
';var Jm={__init__:["palette"],palette:["type",Qm]},ef="crosshair";function tf(n,i,e,r,t,o){this._selection=t,this._dragging=e;var a=this,s=function(e){var t,n=i.getDefaultLayer();_e(t=e.frame=Ne("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),ve(n,t)},c=function(e){var t=e.frame,n=e.bbox;_e(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ae(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),n.on("lasso.selection.end",function(e){var t=e.originalEvent.target;(e.hover||t instanceof SVGElement)&&n.once("lasso.selection.ended",function(){a.activateLasso(e.originalEvent,!0)})}),n.on("lasso.end",function(e){var t=nf(e),n=r.filter(function(e){return e});a.select(n,t)}),n.on("lasso.start",function(e){var t=e.context;t.bbox=nf(e),s(t)}),n.on("lasso.move",function(e){var t=e.context;t.bbox=nf(e),c(t)}),n.on("lasso.cleanup",function(e){var t=e.context;p(t)}),n.on("element.mousedown",1500,function(e){if(n=no(t=e)||t,oo(t)&&n.shiftKey)return a.activateLasso(e.originalEvent),!0;var t,n})}function nf(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.yn.x&&(i[e.id]=e),!l(n.x)&&t.y>n.y&&(i[e.id]=e),t.x>n.x&&t.y>n.y&&(l(n.width)&&l(n.height)&&t.width+t.xo[e]+n-a&&(t=o[e]+n-a),t&&Fs(r,e,t)})),i&&(p=l,v(["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"],function(e){return wf(p,e)}))?(t.sourcePosition=Is(n),ba(i,["bpmn:Event","bpmn:Gateway"])&&Ef(e,Is(i)),Ti(i,"bpmn:Task")&&(s=e,c=i,y(bf,function(e){var t=s[e],n=Sf(e,c);return t>c[e]+gf&&tr[e]?r[e]+yf:r[e]-yf,Fs(i,e,t))})}(e,n,i)):wf(l,"bpmn:MessageFlow")?(Ti(n,"bpmn:Event")&&(t.sourcePosition=Is(n)),Ti(i,"bpmn:Event")&&Ef(e,Is(i))):t.sourcePosition=t.initialSourcePosition}})}function Ef(e,t){Fs(e,"x",t.x),Fs(e,"y",t.y)}function wf(e,t){return e&&e.type===t}function Sf(e,t){return"x"===e?t.width:t.height}function Cf(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Tf(e){this._snapValues={}}_f.$inject=["eventBus","rules"],Cf.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Cf.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Cf.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Cf.prototype.getSnapLocations=function(){return this._snapLocations},Cf.prototype.setSnapLocations=function(e){this._snapLocations=e},Cf.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Tf).initDefaults(this._defaultSnaps),n},Tf.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)},Tf.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i=e.x||i&&i<=e.x)&&Fs(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Fs(e,"y",e.y)}}function Df(e,t){return-1!==e.indexOf(t)}t(kf,Af),kf.$inject=["bpmnRules","eventBus","injector"],kf.prototype.initSnap=function(n){var i=Af.prototype.initSnap.call(this,n),e=n.shape;return M(e.outgoing,function(e){var t=e.waypoints[0];t=t.original||t,i.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),M(e.incoming,function(e){var t=e.waypoints[e.waypoints.length-1];t=t.original||t,i.setSnapOrigin(e.id+"-docking",{x:t.x-n.x,y:t.y-n.y})}),Ti(e,"bpmn:Participant")&&i.setSnapLocations(["top-left","bottom-right","mid"]),i},kf.prototype.addSnapTargetPoints=function(n,i,e){Af.prototype.addSnapTargetPoints.call(this,n,i,e);var r=this.getSnapTargets(i,e);return M(r,function(e){var t;(function(e){if(Ti(e,"bpmn:SubProcess")&&Ai(e))return!0;return Ti(e,"bpmn:Participant")}(e)||(t="bpmn:TextAnnotation",[i,e].every(function(e){return Ti(e,t)})))&&(n.add("top-left",Ls(e)),n.add("bottom-right",js(e)))}),M(i.incoming,function(e){Df(r,e.source)||n.add("mid",qr(e.source));var t=e.waypoints[0];n.add(e.id+"-docking",t.original||t)}),M(i.outgoing,function(e){Df(r,e.target)||n.add("mid",qr(e.target));var t=e.waypoints[e.waypoints.length-1];n.add(e.id+"-docking",t.original||t)}),Ti(e,"bpmn:SequenceFlow")&&(n=this.addSnapTargetPoints(n,i,e.parent)),n},kf.prototype.getSnapTargets=function(e,t){return Af.prototype.getSnapTargets.call(this,e,t).filter(function(e){return!Ti(e,"bpmn:Lane")})};function Bf(e,s){var c=this;e.on(["resize.start"],function(e){c.initSnap(e)}),e.on(["resize.move","resize.end"],1250,function(e){var t=e.context,n=t.shape,i=n.parent,r=t.direction,o=t.snapContext;if(!(e.originalEvent&&Do(e.originalEvent)||zs(e))){var a=o.pointsForTarget(i);a.initialized||((a=c.addSnapTargetPoints(a,n,i,r)).initialized=!0),s.snap(e,a)}}),e.on(["resize.cleanup"],function(){s.hide()})}function Nf(e,t){return"nw"===t?Ls(e):"ne"===t?{x:(i=e).x+i.width,y:i.y}:"sw"===t?{x:(n=e).x,y:n.y+n.height}:js(e);var n,i}Bf.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Cf);var o=Nf(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},Bf.prototype.addSnapTargetPoints=function(t,e,n,i){return M(this.getSnapTargets(e,n),function(e){t.add("corner",js(e)),t.add("corner",Ls(e))}),t.add("corner",Nf(e,i)),t},Bf.$inject=["eventBus","snapping"],Bf.prototype.getSnapTargets=function(n,e){return $s(e).filter(function(e){return!(t=n,e.host===t||e.waypoints||e.hidden||e.labelTarget);var t})};function Of(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}Of.$inject=["canvas"],Of.prototype.snap=function(o,a){var e=o.context.snapContext,t=e.getSnapLocations(),s={x:zs(o,"x"),y:zs(o,"y")};M(t,function(n){var i=e.getSnapOrigin(n),r={x:o.x+i.x,y:o.y+i.y};if(M(["x","y"],function(e){var t;s[e]||void 0!==(t=a.snap(r,n,e,7))&&(s[e]={value:t,originValue:t-i[e]})}),s.x&&s.y)return!1}),this.showSnapLine("vertical",s.x&&s.x.value),this.showSnapLine("horizontal",s.y&&s.y.value),M(["x","y"],function(e){var t=s[e];P(t)&&Fs(o,e,t.originValue)})},Of.prototype._createLine=function(t){var e=this._canvas.getLayer("snap"),n=Ne("path");return _e(n,{d:"M0,0 L0,0"}),Te(n).add("djs-snap-line"),ve(e,n),{update:function(e){l(e)?_e(n,"horizontal"===t?{d:"M-100000,"+e+" L+100000,"+e,display:""}:{d:"M "+e+",-100000 L "+e+", +100000",display:""}):_e(n,{display:"none"})}}},Of.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},Of.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},Of.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},Of.prototype.hide=function(){M(this._snapLines,function(e){e.update()})};var Lf={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",Af],resizeSnapping:["type",Bf],snapping:["type",Of]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",_f],createMoveSnapping:["type",kf]};function jf(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=se(jf.BOX_HTML),this._searchInput=de(jf.INPUT_SELECTOR,this._container),this._resultsContainer=de(jf.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy"],this.close,this)}function If(e,t,n){var i,r=(i="",t.forEach(function(e){e.matched?i+=''+hs(e.matched)+"":i+=hs(e.normal)}),""!==i?i:null),o=se(n);o.innerHTML=r,e.appendChild(o)}jf.$inject=["canvas","eventBus","overlays","selection"],jf.prototype._bindEvents=function(){var r=this;function e(e,t,n,i){r._eventMaps.push({el:e,type:n,listener:ae.bind(e,t,n,i)})}e(document,"html","click",function(e){r.close()}),e(this._container,jf.INPUT_SELECTOR,"click",function(e){e.stopPropagation(),e.delegateTarget.focus()}),e(this._container,jf.RESULT_SELECTOR,"mouseover",function(e){e.stopPropagation(),r._scrollToNode(e.delegateTarget),r._preselect(e.delegateTarget)}),e(this._container,jf.RESULT_SELECTOR,"click",function(e){e.stopPropagation(),r._select(e.delegateTarget)}),e(this._container,jf.INPUT_SELECTOR,"keydown",function(e){38===e.keyCode&&e.preventDefault(),40===e.keyCode&&e.preventDefault()}),e(this._container,jf.INPUT_SELECTOR,"keyup",function(e){if(27===e.keyCode)return r.close();if(13!==e.keyCode)return 38===e.keyCode?r._scrollToDirection(!0):40===e.keyCode?r._scrollToDirection():void(37!==e.keyCode&&39!==e.keyCode&&r._search(e.delegateTarget.value));var t=r._getCurrentResult();return t?r._select(t):r.close()})},jf.prototype._unbindEvents=function(){this._eventMaps.forEach(function(e){ae.unbind(e.el,e.type,e.listener)})},jf.prototype._search=function(e){var i=this;if(this._clearResults(),e&&""!==e){var t=this._searchProvider.find(e);if(t.length){t.forEach(function(e){var t=e.element.id,n=i._createResultNode(e,t);i._results[t]={element:e.element,node:n}});var n=de(jf.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(n),this._preselect(n)}}},jf.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},jf.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
'});this._overlayId=this._overlays.add(e,n)}var i,r,o,a},jf.CONTAINER_SELECTOR=".djs-search-container",jf.INPUT_SELECTOR=".djs-search-input input",jf.RESULTS_CONTAINER_SELECTOR=".djs-search-results",jf.RESULT_SELECTOR=".djs-search-result",jf.RESULT_SELECTED_SELECTOR="."+(jf.RESULT_SELECTED_CLASS="djs-search-result-selected"),jf.RESULT_ID_ATTRIBUTE="data-result-id",jf.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",jf.OVERLAY_CLASS="djs-search-overlay",jf.BOX_HTML='
',jf.RESULT_HTML='
',jf.RESULT_PRIMARY_HTML='
',jf.RESULT_SECONDARY_HTML='

';var zf={__depends__:[So,vo],searchPad:["type",jf]};function Ff(e,t,n){this._elementRegistry=e,this._canvas=n,t.registerProvider(this)}function $f(e){return 0',e)},Vf.prototype._createModdle=function(e){var t=Mo.prototype._createModdle.call(this,e);return t.ids=new o([32,36,1]),t},Vf.prototype._collectIds=function(e,t){var n,i=e.$model.ids;for(n in i.clear(),t.elementsById)i.claim(n,t.elementsById[n])},Vf.prototype._modules=[].concat(Vf.prototype._modules,Vf.prototype._interactionModules=[Go,Zo,ha,ia],Vf.prototype._modelingModules=[ga,Da,Xa,za,Ws,Xs,Qs,ap,dp,mc,gp,Sp,zp,$p,Up,hl,$m,Xm,df,ff,ol,Lf,Hf]),Vf});