camunda-bpmn-js 5.6.1 → 5.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base-modeler.development.js +8 -2
- package/dist/base-modeler.production.min.js +1 -1
- package/dist/camunda-cloud-modeler.development.js +8 -2
- package/dist/camunda-cloud-modeler.production.min.js +1 -1
- package/dist/camunda-platform-modeler.development.js +8 -2
- package/dist/camunda-platform-modeler.production.min.js +1 -1
- package/package.json +3 -3
|
@@ -168,7 +168,7 @@
|
|
|
168
168
|
searchFn=${this._search}
|
|
169
169
|
...${{...o}}
|
|
170
170
|
/>
|
|
171
|
-
`,this._current.container)},Ul.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Ul.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Ul.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Ul.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ul.prototype.reset=function(){const e=this._current.container;ol(null,e),we(e)},Ul.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ul.prototype._onOpened=function(){this._emit("opened")},Ul.prototype._onClosed=function(){this._emit("closed")},Ul.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Ul.prototype._bindAutoClose=function(){this._eventBus.once(Hl,this.close,this)},Ul.prototype._unbindAutoClose=function(){this._eventBus.off(Hl,this.close,this)},Ul.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Ul.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Ul.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},Ul.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Ul.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ul.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Ul.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Ul.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Ul.prototype.isOpen=function(){return!!this._current},Ul.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Ul.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Xl={search:["value",function(e,t,n){const{keys:r}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const i=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:r,tokens:i}=n.reduce(((n,r)=>{const i=e[r],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],r={},i=t.map(Yl),o=[`(?<all>${i.join("\\s+")})`,...i].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[i]=a,o=a.index,s=a.index+i.length,c=0===o,p=s===e.length,u=!!a.groups.all,d=c||/\s/.test(e.charAt(o-1)),h=p||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:i,index:a.index,match:!0,wordStart:d,wordEnd:h,start:c,end:p,all:u});const f=u?t:[i];for(const e of f)r[e.toLowerCase()]=!0;l=a.index+i.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:r}}(i,t);return{tokens:{...n.tokens,[r]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(r).length!==t.length)return null;return i}(e,i,r);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const r of e){const e=Wl(t.tokens[r],n.tokens[r]);if(0!==e)return e;const i=Ql(t.item[r],n.item[r]);if(0!==i)return i}return 0}}(r))}]},Zl={__depends__:[Xl],__init__:["popupMenu"],popupMenu:["type",Ul]},Kl={align:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">\n <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Jl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Jl.$inject=["contextPad","popupMenu","translate","canvas"],Jl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Jl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Jl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Kl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);L(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Jl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var ec=["left","center","right","top","middle","bottom"];function tc(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function nc(e){Uo.call(this,e),this.init()}function rc(e){nc.call(this,e)}tc.$inject=["popupMenu","alignElements","translate","rules"],tc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},tc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},tc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(ec,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Kl[o],action:function(){t.trigger(e,o),r.close()}}})),i},nc.$inject=["eventBus"],e(nc,Uo),nc.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},nc.prototype.init=function(){},rc.$inject=["eventBus"],e(rc,nc),rc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=ht(t)).length<2)&&t}))};var ic={__depends__:[wa,Da,Zl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Jl],alignElementsMenuProvider:["type",tc],bpmnAlignElements:["type",rc]},oc=10,sc=50,ac=250;function lc(e,t,n,r){for(var i;i=pc(e,n,t);)n=r(t,n,i);return n}function cc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function pc(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=uc(e);e.host&&(t=t.concat(uc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(uc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===_n(e,r,oc)}))}function uc(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function dc(){return!0}function hc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||sc,i=xn(e),o=vn(e);return{x:o.right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function fc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}hc.$inject=["eventBus","modeling","canvas"],fc.$inject=["eventBus","selection"];var mc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hc],autoPlaceSelectionBehavior:["type",fc]};function gc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Oi(e,t))return e;return null}function yc(e,t){var n=gc(e,"bpmn:Process");if(n)return!0;var r,i=["bpmn:Participant","bpmn:Lane"];if(n=gc(e,i))return Ui(n);if(Oi(e,i))return Ui(e);for(r=Pi(e);r&&!ki(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find((function(e){var t=Pi(e);return t&&t.get("processRef")===r}));return!o||Ui(o)}function vc(e,t,n){var r=yc(e,n);return ki(t,"bpmn:TextAnnotation")?function(e,t,n){var r=vn(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};fn(e)&&(i=xn(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return lc(e,t,i,cc(s))}(e,t,r):Oi(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var r=vn(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return lc(e,t,i,cc(s))}(e,t,r):ki(t,"bpmn:FlowNode")?function(e,t,n){var r=vn(e),i=xn(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},s=function(e,t){t||(t={});var n=t.defaultDistance||sc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||ac,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===r?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===r?"start"===a?vn(t).top-vn(e).bottom:"center"===a?xn(t).y-vn(e).bottom:vn(t).bottom-vn(e).bottom:"start"===a?vn(t).left-vn(e).right:"center"===a?xn(t).x-vn(e).right:vn(t).right-vn(e).right}i||(i=dc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return ki(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;ki(e,"bpmn:BoundaryEvent")&&-1!==(c=_n(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:r.right+s+t.width/2,y:i.y+bc(c,l,o)}:{x:i.x+bc(c,l,o),y:r.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return lc(e,t,p,cc(d))}(e,t,r):void 0}function bc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function wc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return vc(e.source,n,t)}))}wc.$inject=["eventBus","elementRegistry"];var xc={__depends__:[mc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",wc]};function _c(e,t,n,i){Uo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function Ec(e){e.invoke(_c,this)}function kc(e){nc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Oc(e,t){kc.call(this,e),this._modeling=t}_c.$inject=["eventBus","elementRegistry","modeling","rules"],e(_c,Uo),_c.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=vn(vt(e)),o=vn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),bn(L({},o,s))},_c.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=vn(e),t=vn(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}(B(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},_c.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},_c.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},_c.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Ec.$inject=["injector"],e(Ec,_c),Ec.prototype.resize=function(e,t,n){ki(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},kc.$inject=["eventBus"],e(kc,nc),kc.prototype.canResize=function(e,t){return!1},e(Oc,kc),Oc.$inject=["eventBus","modeling"],Oc.prototype.canResize=function(e,t){if(ki(t.di,"bpmndi:BPMNPlane"))return!1;if(!ki(t,"bpmn:Participant")&&!ki(t,"bpmn:Lane")&&!ki(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(ki(e,"bpmn:Lane")||mn(e))&&(n=!1)})),n};var Pc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Ec],bpmnAutoResizeProvider:["type",Oc]};function Sc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),s.hover({element:i,gfx:r}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ys(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Sc.$inject=["elementRegistry","eventBus","injector"];var Cc={__init__:["hoverFix"],hoverFix:["type",Sc]},Tc=Math.round,Mc="djs-drag-active";function Ac(e){e.preventDefault()}function Dc(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function a(t,n){n=n||i;var r=e.createEvent(L({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=ys(e),d=oa(u,p),h=i.localStart,f=s(u),g=oa(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(L(l,{x:Tc(h.x+c.x),y:Tc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&ea(i.cursor),t.addMarker(t.getRootElement(),Mc)}gs(e),i.active&&(L(l,{x:Tc(f.x+c.x),y:Tc(f.y+c.y),dx:Tc(g.x),dy:Tc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,gs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Bs("Escape",e)&&(Ac(e),m())}function u(t){var n;i.active&&(n=ra(e),setTimeout(n,400),Ac(t)),c(t)}function d(e){l(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),ta(),g=i.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",Ac),ce.unbind(document,"selectstart",Ac),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",m,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Mc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=L({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=ms(t)||t,v=ys(t),gs(t),"dragstart"===y.type&&Ac(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=L({prefix:r,data:_,payload:{},globalStart:v,displacement:oa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",m,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",Ac),ce.bind(document,"selectstart",Ac),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){L(o,e)}}Dc.$inject=["eventBus","canvas","selection","elementRegistry"];var Nc={__depends__:[Cc,Ns],dragging:["type",Dc]};function Rc(e,t,n){this._canvas=n,this._opts=L({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 jc(e,t,n){return t<e&&e<n}Rc.$inject=["config.autoScroll","eventBus","canvas"],Rc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)jc(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Rc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Rc.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},Rc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ys(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Ic={__depends__:[Nc],__init__:["autoScroll"],autoScroll:["type",Rc]};function Lc(e){this._commandStack=e.get("commandStack",!1)}Lc.$inject=["injector"],Lc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var $c={__init__:["rules"],rules:["type",Lc]},zc=Math.round,Bc=Math.max;var qc=10;function Fc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Ct(r,t)<=qc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=an(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,qc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:zc(o.x+s.x)/2,y:zc(o.y+s.y)/2},index:o.segment2}:{point:{x:zc(o.x),y:zc(o.y)},index:o.segment2}:null}(e,t)}function Vc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Hc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Uc(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function Wc(e,t){var n=Uc(e,t);return Vc({x:n.x-e.x,y:n.y-e.y})}function Gc(e,t){return Vc({x:e.x-t.x,y:e.y-t.y})}var Qc="djs-bendpoint",Yc="djs-segment-dragger";function Xc(e,t,n){var r=function(e,t){var n,r=ys(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n);return Fc(t,r)}function Zc(e,t){var n=Re("g");Se(n).add(Qc),xe(e,n);var r=Re("circle");Oe(r,{cx:0,cy:0,r:4}),Se(r).add("djs-visual"),xe(n,r);var i=Re("circle");return Oe(i,{cx:0,cy:0,r:10}),Se(i).add("djs-hit"),xe(n,i),t&&Se(n).add(t),n}function Kc(e,t,n,r){var i=Re("g");xe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return ep("h"===n?r:i)}(t,n,r),s=Re("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(i,s);var a=Re("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(i,a),Jn(i,"v"===r?90:0),i}function Jc(e,t,n){var r=Re("g"),i=Rt(t,n),o=At(t,n);return xe(e,r),Kc(r,t,n,o),Se(r).add(Yc),Se(r).add("h"===o?"horizontal":"vertical"),Kn(r,i.x,i.y),r}function ep(e){return Math.abs(Math.round(2*e/3))}function tp(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Wc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return Uc(e,n)}function np(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Xc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=At((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?ep("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Rt(r=t[c-1],i=t[c]),s=At(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Yo(e.id)+'"]',r);return!i&&n&&(Oe(i=Re("g"),{"data-element-id":e.id}),Se(i).add("djs-bendpoints"),xe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Zc(e);xe(e,r),Kn(r,t.x,t.y)})),Zc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)At(n=o[a-1],r=o[a])&&(Oe(i=Jc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(be("."+Yc,e),(function(e){Ue(e)}))}(t),function(e){v(be("."+Qc,e),(function(e){Ue(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Rt(s,a),u=At(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Kn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ue(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Xc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Kn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(ws(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=a(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}np.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var rp=Math.round,ip="reconnectStart",op="reconnectEnd",sp="updateWaypoints";function ap(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,d=(a=s||0!==o?s||o!==u.length-1?sp:op:ip)===sp?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=i.allowed(d,{connection:t,source:p,target:c})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===sp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===ip?a:o,target:l===op?a:s}))return n.source=l===ip?a:o,void(n.target=l===op?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===op?a:s,target:l===ip?a:o})),t&&(n.source=l===op?a:s,n.target=l===ip?a:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==sp&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:rp(e.x),y:rp(e.y)};if(!n)return!1;p===sp?(s?a.splice(r,0,d):a[r]=d,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===Ct(t,r=e[i+1])||Tt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===ip?(u.docking="source",lp(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===op&&(u.docking="target",lp(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function lp(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===ip?t&&r&&t===r&&n!==r:i===op?t&&n&&t===n&&n!==r:void 0}ap.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ap.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var cp="updateWaypoints",pp="connect-ok",up="connect-not-ok",dp="connect-hover",hp="djs-updating",fp="djs-dragging";function mp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Se(t.draggerGfx=Zc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,fp),r.addMarker(i,hp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,dp),o===cp)return;n?(r.removeMarker(i,up),r.addMarker(i,pp)):!1===n&&(r.removeMarker(i,pp),r.addMarker(i,up))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,dp),r.removeMarker(n,i?pp:up))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?lp(n)?(m.connectionEnd=m.connectionEnd||h,m.source=u,m.target=a||p,d=d.reverse()):(m.connectionStart=m.connectionStart||h,m.source=a||p,m.target=u):"reconnectEnd"===l?lp(n)?(m.connectionStart=m.connectionStart||h,m.source=a||u,m.target=p,d=d.reverse()):(m.connectionEnd=m.connectionEnd||h,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,d[o]=h),l===cp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),Kn(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Ue(o),r.removeMarker(n,hp),r.removeMarker(n,fp),s&&(r.removeMarker(s,pp),r.removeMarker(s,a?pp:up)),i&&i.cleanUp(t)}))}mp.$inject=["bendpointMove","injector","eventBus","canvas"];var gp="connect-hover",yp="djs-updating";function vp(e,t,n){return bp(e,t,e[t]+n)}function bp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function wp(e){return"x"===e?"y":"x"}function xp(e,t,n){var r,i;return e.original?e.original:(r=xn(t),bp(e,i=wp(n),r[i]))}function _p(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return bp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],wp(e.axis));Kn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,d=t.waypoints,h=d[p],f=d[u],m=Xc(n,d,e);(s=At(h,f))&&(a="v"===s?"x":"y",0===p&&(h=xp(h,t.source,a)),u===d.length-1&&(f=xp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(h.x+f.x)/2,y:(h.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Jc(i,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(r,yp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),f=vp(p,d,e["d"+d]),m=vp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=_n(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=_n(i.target,m),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=m):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=a(i,h),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,gp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,gp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ue(t.draggerGfx),n.removeMarker(r,yp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Tt(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}_p.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Ep=Math.abs,kp=Math.round;function Op(e){return{x:e.x,y:e.y}}function Pp(e){return{x:e.x+e.width,y:e.y+e.height}}function Sp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:kp(e.x+e.width/2),y:kp(e.y+e.height/2)}}function Cp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Tp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Mp(e){return e.children||[]}var Ap=Math.abs,Dp=Math.round;function Np(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Ap(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e,t){return e.waypoints?tp(t,e):e.width?{x:Dp(e.width/2+e.x),y:Dp(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));L(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Tp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Tp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);fn(t)&&r&&r.x&&r.y&&(Tp(e,"x",r.x),Tp(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));L(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Tp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Tp(e,"y",i)}}))}Np.$inject=["eventBus"];var Rp={__depends__:[Nc,$c],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",np],bendpointMove:["type",ap],bendpointMovePreview:["type",mp],connectionSegmentMove:["type",_p],bendpointSnapping:["type",Np]};function jp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:Ip(t)?o:i,connectionEnd:Ip(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=xn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Ip(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}jp.$inject=["eventBus","dragging","modeling","rules"];var Lp="connect-ok",$p="connect-not-ok";function zp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,d=p;Ip(t)&&(u=p,d=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Lp:$p)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Lp),n.removeMarker(t,$p))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}zp.$inject=["injector","eventBus","canvas"];var Bp={__depends__:[Ns,$c,Nc],__init__:["connectPreview"],connect:["type",jp],connectPreview:["type",zp]};function qp(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}qp.$inject=["injector","canvas","graphicsFactory","elementFactory"],qp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?xn(s):c,a?xn(a):p]),this._connectionDocking&&(s||a)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(i,n)},qp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||xn(n),o=t.connectionEnd||xn(r),s=this.cropWaypoints(i,o,n,r);xe(e,this.createNoopConnection(s[0],s[1]))},qp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=r&&En(s,a,!1)||t]},qp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ue(e.connectionPreviewGfx)},qp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},qp.prototype.createConnectionPreviewGfx=function(){var e=Re("g");return Oe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},qp.prototype.createNoopConnection=function(e,t){return ut([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Fp={__init__:["connectionPreview"],connectionPreview:["type",qp]};const Vp=new Io("ps");var Hp=["marker-start","marker-mid","marker-end"],Up=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Wp(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}Wp.$inject=["elementRegistry","eventBus","canvas","styles"],Wp.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Wp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Wp.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Xn(i),r),Oe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),xe(t,i),Oe(i,"data-preview-support-element-id",e.id),i},Wp.prototype.addFrame=function(e,t){var n=Re("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Oe(n,"data-preview-support-element-id",e.id),n},Wp.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach((e=>{r._cloneMarkers(e,t,n)})),function(e){return-1!==Up.indexOf(e.nodeName)}(e)&&Hp.forEach((function(i){if(Oe(e,i)){var o=function(e,t,n){var r=(i=Oe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}}))},Wp.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,Vp.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Me(n);a.id=o,Se(a).add(i);var l=ve(":scope > defs",e);l||xe(e,l=Re("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,r,c)};var Gp={__init__:["previewSupport"],previewSupport:["type",Wp]};const Qp="complex-preview";class Yp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Qp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;fn(e)?(t=this._graphicsFactory._createContainer("connection",Re("g")),this._graphicsFactory.drawConnection(Xn(t),e)):(t=this._graphicsFactory._createContainer("shape",Re("g")),this._graphicsFactory.drawShape(Xn(t),e),Kn(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);fn(e)?Kn(n,t.x,t.y):Kn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Re("g"));this._graphicsFactory.drawShape(Xn(n),e,{width:t.width,height:t.height}),Kn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer(Qp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Qp)}hide(){this._canvas.hideLayer(Qp)}}Yp.$inject=["canvas","graphicsFactory","previewSupport"];var Xp={__depends__:[Gp],__init__:["complexPreview"],complexPreview:["type",Yp]},Zp=["top","bottom","left","right"],Kp=10;function Jp(e,t){function n(e){if(Ki(e)&&!fn(e)){var n=function(e){var t=xn(e.label),n=xn(e),r=eu(n,t);if(i=r,-1===Zp.indexOf(i))return;var i;var o=function(e){var t=xn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return eu(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=xn(e),i=_n(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Zp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Zp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=xn(e),i=e.label,o=xn(i);if(!i.parent)return;var s,a=vn(e);switch(n){case"top":s={x:r.x,y:a.top-Kp-i.height/2};break;case"left":s={x:a.left-Kp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Kp+i.height/2};break;case"right":s={x:a.right+Kp+i.width/2,y:r.y}}var l=oa(s,o);t.moveShape(i,l)}(e,n)}}Uo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function eu(e,t){return _n(t,e,5)}function tu(e){Uo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(ki(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function nu(e,t){e.invoke(Uo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return ki(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Jp,Uo),Jp.$inject=["eventBus","modeling"],e(tu,Uo),tu.$inject=["eventBus"],e(nu,Uo),nu.$inject=["injector","modeling"];function ru(e,t){t.invoke(Uo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return iu(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];iu(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function iu(e,t){return!mn(e)&&Oi(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ou(e,t){function n(e){return y(e.attachers,(function(e){return ki(e,"bpmn:BoundaryEvent")}))}Uo.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);ki(r,"bpmn:EventBasedGateway")&&ki(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;ki(r,"bpmn:Gateway")&&ki(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);ki(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function su(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}Uo.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(lu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>au(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!lu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>cu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>ki(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;lu(i)&&cu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>ki(e,"bpmn:Association"))),i=r.filter((e=>au(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;lu(t)&&au(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;au(o)&&i(o),lu(e)&&cu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;au(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):cu(r)&&function(e){const n=e.incoming.filter((e=>lu(e.source)));t.removeElements(n)}(r)}),!0)}function au(e){const t=Pi(e);return t&&t.get("isForCompensation")}function lu(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Qi(e,"bpmn:CompensateEventDefinition")}function cu(e){return e&&ki(e,"bpmn:Activity")&&!Gi(e)}function pu(e){e.invoke(Uo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;ki(n,"bpmn:Lane")&&!ki(r,"bpmn:Lane")&&(t.parent=gc(n,"bpmn:Participant"))}))}function uu(e,t){Uo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(ki(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}ru.$inject=["bpmnReplace","injector"],e(ru,Uo),ru.prototype._replaceShape=function(e,t){var n,r=(n=Pi(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},ou.$inject=["eventBus","modeling"],e(ou,Uo),e(su,Uo),su.$inject=["eventBus","modeling","bpmnRules"],pu.$inject=["injector"],e(pu,Uo),uu.$inject=["eventBus","bpmnFactory"],e(uu,Uo);var du=20,hu=20,fu=30,mu=2e3;function gu(e,t,n){function r(){var t=e.getRootElement();return ki(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Uo.call(this,t),t.on(["create.start","shape.move.start"],mu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!ki(e,"bpmn:Group")&&!mn(e)&&!fn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*du+fu,height:t.height+2*hu};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,s);L(r,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-hu,left:t.right-e.width/2+du,top:t.bottom-e.height/2+hu,right:t.left+e.width/2-du-fu}}(r,s)}}})),t.on("create.start",mu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&(t.on("element.hover",mu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",mu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return ki(e,"bpmn:Participant")}))}(n);o&&ki(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Pi(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;ki(n,"bpmn:Participant")&&ki(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Pi(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Pi(r).set("processRef",Pi(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Pi(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}gu.$inject=["canvas","eventBus","modeling"],e(gu,Uo);var yu="__targetRef_placeholder";function vu(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===yu}));return!i&&n&&Pt(r,i=t.create("bpmn:Property",{name:yu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Ot(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&r(d,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}Uo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],bu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],bu(i))}function bu(e){return function(t){if(ki(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function wu(e){this._bpmnUpdater=e}function xu(e,t,n,r){function i(e){return e.children.filter((function(e){return ki(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return ki(e,"bpmn:Participant")&&Pi(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Si(e),newSemanticParent:o.processRef||o,newDiParent:Si(r)})}}Uo.call(this,r),t.registerHandler("dataStore.updateContainment",wu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return ki(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!ki(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;ki(t,"bpmn:DataStoreReference")&&"label"!==t.type&&ki(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!ki(r,"bpmn:Collaboration")&&ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&ki(i,"bpmn:Collaboration")){var s=ki(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(ki(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Oi(n,["bpmn:Participant","bpmn:SubProcess"])&&ki(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){ki(r,"bpmn:Process")&&o(e,r)}))}))}vu.$inject=["eventBus","bpmnFactory"],e(vu,Uo),wu.$inject=["bpmnUpdater"],wu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},wu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},xu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(xu,Uo);var _u=Math.max,Eu=Math.min,ku=20;function Ou(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Pu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?Eu:_u)(r,i)),u(o)&&(r=(/top|left/.test(e)?_u:Eu)(r,o)),r}function Su(e,t){return void 0!==e?e:ku}function Cu(e){return!e.waypoints&&"label"!==e.type}function Tu(e,t){var n;if((n=void 0===e.length?y(e.children,Cu):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Su(t.left),r=Su(t.right),i=Su(t.top),o=Su(t.bottom)):n=r=i=o=Su(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(vt(n),t)}var Mu=Math.abs;var Au=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Du=30;function Nu(e,t){return t=t||[],e.children.filter((function(e){ki(e,"bpmn:Lane")&&(Nu(e,t),t.push(e))})),t}function Ru(e){return e.children.filter((function(e){return ki(e,"bpmn:Lane")}))}function ju(e){return gc(e,Au)||e}function Iu(e,t){var n=ju(e),r=Nu(n,ki(n,"bpmn:Process")?[]:[n]),i=vn(e),o=vn(t),s=function(e,t){return Ou(vn(t),vn(e))}(e,t),a=[],l=Ui(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=vn(t);s.top&&(Mu(h.bottom-i.top)<10&&(u=o.top-h.bottom),Mu(h.top-i.top)<5&&(c=o.top-h.top)),s.left&&(Mu(h.right-i.left)<10&&(p=o.left-h.right),Mu(h.left-i.left)<5&&(d=o.left-h.left)),s.bottom&&(Mu(h.top-i.bottom)<10&&(c=o.bottom-h.top),Mu(h.bottom-i.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Mu(h.left-i.right)<10&&(d=o.right-h.left),Mu(h.right-i.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:d},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),a}function Lu(e,t){Uo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;ki(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Ui(e),c=Ru(n),p=[],u=[],d=[],h=[];gt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),d.length&&(s=t.calculateAdjustments(d,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Lu.$inject=["eventBus","spaceTool"],e(Lu,Uo);function $u(e,t){t.invoke(Uo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return zu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n._replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,s=e.host;zu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function zu(e,t){return!mn(e)&&ki(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function r(e,r,i){var o,s,a,l,c,p,d,h,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=Fc(f,h=u(i.width)?xn(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:h,1!==o.length&&qu(e,o[o.length-1])||o.push(Fu(a)),1!==s.length&&qu(e,s[0])||s.unshift(Fu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||h),p=r),t.canConnect(e,c,r)&&(p?d=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||h),d=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}Uo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&Fc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!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 n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.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 qu(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function Fu(e){return L({},e)}function Vu(e,t){Uo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Hu(r)){(ki(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Hu(e))):o.incoming.filter((e=>e!==r&&Hu(e)&&ki(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;ki(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Hu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Hu).forEach((function(r){const i=e.incoming.filter(Hu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Hu(e){return ki(e,"bpmn:SequenceFlow")}$u.$inject=["bpmnReplace","injector"],e($u,Uo),$u.prototype._replaceShape=function(e){var t,n,r=(n=Pi(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Uo),Bu.$inject=["eventBus","bpmnRules","modeling"],Vu.$inject=["eventBus","modeling"],e(Vu,Uo);var Uu=1500;function Wu(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Uu,(function(t){var r=t.context.shape||t.shape,i=t.hover;ki(i,"bpmn:Lane")&&!Oi(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=ju(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Oi(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Uu,(function(t){var n=t.hover;ki(n,"bpmn:Lane")&&(t.hover=ju(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Uu,(function(t){var n=t.context,r=t.hover,i=n.type;ki(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=ju(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Uu,(function(e){var t=e.context,n=t.start;ki(n,"bpmn:Lane")&&(t.start=ju(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;ki(t,"bpmn:Lane")&&(e.shape=ju(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&ki(t,"bpmn:Lane")&&(e.hover=ju(t))}))}Wu.$inject=["elementRegistry","eventBus","canvas"];function Gu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return ki(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Pi(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Ot(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Pi(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Ot(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Pi(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Pi(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(Uo,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Pi(n);if(ki(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Pi(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Pi(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Pi(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=Pi(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Qu(e,t,n,r){var i,o,s,a;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Yu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Qu(e,t,n,i),a=Qu(e,t,n,o);r=s&&a?Xu(s,n)>Xu(a,n)?a:s:s||a,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],xn(n.source)),t(r[r.length-1],r[r.length-2],xn(n.target)))}))}function Xu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zu(e){Uo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Pi(n),i=Si(n);if(Oi(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Gu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Gu,Uo),Yu.$inject=["eventBus"],Zu.$inject=["eventBus"],e(Zu,Uo);var Ku=Math.sqrt,Ju=Math.min,ed=Math.max,td=Math.abs;function nd(e){return Math.pow(e,2)}function rd(e,t){return Ku(nd(e.x-t.x)+nd(e.y-t.y))}function id(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Ku(p),d=-c+u,h=-c-u,f={x:e.x-i*d,y:e.y-o*d};return 0===p?[f]:[f,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return od(e.x,t.x,n.x)&&od(e.y,t.y,n.y)}(n,e,t)}))}function od(e,t,n){return e>=Ju(t,n)-sd&&e<=ed(t,n)+sd}var sd=.1;function ad(e,t){return td(e.x-t.x)<=sd&&td(e.y-t.y)<=sd}function ld(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,d,h,f=0;for(f=0;f<t.length-1;f++){if(ad(n=t[f],r=t[f+1])?a=[n]:(i=rd(e,n),o=rd(e,r),a=id(n,r,e,Ju(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:ad(n,a[0])?f:f+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:f,relativeLocation:rd(n,s)/rd(n,r)}),c=rd(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&cd(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,d=pd(n,l),h=pd(t,c),f=a.position,m=function(e,t){var n=Gc(e[0],e[1]),r=Gc(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=Hc(d),Hc(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=cd(n,v))}var x,_,E={x:(h[1].x-h[0].x)*m+h[0].x,y:(h[1].y-h[0].y)*m+h[0].y},k=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=E.x+k.x-e.x,o=E.y+k.y-e.y,{point:yn(E),delta:yn({x:i,y:o})}}function cd(e,t){var n=Gc(e[t-1],e[t]);return n/(n+Gc(e[t],e[t+1]))}function pd(e,t){return[e[t],e[t+1]]}function ud(e,t,n){var r=ia(t),i=ia(n),o=oa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return yn({x:i.x+s,y:i.y+a})}function dd(e,t,n){var r=ia(e),i=ia(t),o=ia(n),s=oa(e,r),a=oa(r,i),l=function(e,t,n){var r=vn(t),i=vn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,s,a,l=_n(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=_n(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,d=o.y+p;return yn({x:u+s.x-e.x,y:d+s.y-e.y})}var hd="name",fd="text";function md(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(hd in o&&t.updateLabel(i,o[hd]),fd in o&&ki(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[fd]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=L({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ld(xn(e),t,n,r).delta}(r,o,s,i)}Uo.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Pi(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!mn(r)&&Zi(r)&&no(r)&&t.updateLabel(r,no(r))}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Pi(n);i&&Zi(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,s=r.oldBounds;if(Ki(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Wc(e,t)}}));return T(n,"distance")[0].line}(e,t);return Uc(e,n)}(xn(a),[[{x:(n=s).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),c=gd(l,s,o);t.moveShape(a,c)}}))}function gd(e,t,n){return yn(oa(ud(e,t,n),e))}function yd(e,t){function n(e,t){var n=e.context,r=n.connection,i=L({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ld(e,t,n,r).point}(t,o,s,i)}Uo.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function vd(e,t,n){var r=Ed(e),i=kd(r,t),o=r[0];return i.length?i[i.length-1]:ud(o.original||o,n,t)}function bd(e,t,n){var r=Ed(e),i=kd(r,t),o=r[r.length-1];return i.length?i[0]:ud(o.original||o,n,t)}function wd(e,t,n){var r=Ed(e),i=_d(t,n),o=r[0];return ud(o.original||o,i,t)}function xd(e,t,n){var r=Ed(e),i=_d(t,n),o=r[r.length-1];return ud(o.original||o,i,t)}function _d(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ed(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function kd(e,t){return y(E(e,Od),(function(e){return function(e,t){return"intersect"===_n(t,e,1)}(e,t)}))}function Od(e){return e.original||e}function Pd(e,t){Uo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return ki(e,"bpmn:Participant")&&Hi(e)&&ki(t,"bpmn:Participant")&&!Hi(t)}(n,r)){var i,o,s,a,l=(o=yt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){ki(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){ki(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=bd(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=vd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(md,Uo),md.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(yd,Uo),yd.$inject=["eventBus","modeling"],Pd.$inject=["eventBus","modeling"],e(Pd,Uo);const Sd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Cd(e){const t=Pi(e);if(!(ki(t,"bpmn:BoundaryEvent")||ki(t,"bpmn:StartEvent")&&Gi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Sd.some((e=>ki(n[0],e)))}function Td(e){return ki(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Md(e,t){e.invoke(Uo,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Cd(r))return;const o=Td(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Pi(n).get(o);s!==Pi(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Ad(e,t){Uo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Si(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Dd(e,t,n){Uo.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(ki(i,"bpmn:SequenceFlow")&&ki(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Qu(Nd(e[e.length-2]),Nd(e[e.length-1]),Nd(t[1]),Nd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Nd(e[0]),Nd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Nd(e){return e.original||e}function Rd(e,t){Uo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;ki(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}}),!0)}function jd(e,t,n,r){Uo.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(ki(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),ki(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Id(e,t,n,r,i,o){r.invoke(Uo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Gi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Md.$inject=["injector","modeling"],e(Md,Uo),e(Ad,Uo),Ad.$inject=["eventBus","modeling"],e(Dd,Uo),Dd.$inject=["eventBus","bpmnRules","modeling"],Rd.$inject=["eventBus","modeling"],e(Rd,Uo),e(jd,Uo),jd.$inject=["eventBus","modeling","bpmnRules","injector"],e(Id,Uo),Id.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Id.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ld={width:140,height:120},$d={width:300,height:60},zd={width:60,height:300},Bd={width:300,height:150},qd={width:150,height:300},Fd={width:140,height:120},Vd={width:50,height:30};function Hd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=ju(e),i=!0,o=!0,s=Nu(r,[r]),a=vn(e),l={},c={},p=Ui(e),u=p?$d:zd;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=vn(e);p?(r.top<a.top-10&&(i=!1),r.bottom>a.bottom+10&&(o=!1)):(r.left<a.left-10&&(i=!1),r.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Ud(a.top-r.bottom)<10&&Xd(l,"top",r.top+u.height),Ud(a.top-r.top)<5&&Yd(c,"top",r.bottom-u.height)),/e/.test(t)&&(n&&Ud(a.right-r.left)<10&&Yd(l,"right",r.right-u.width),Ud(a.right-r.right)<5&&Xd(c,"right",r.left+u.width)),/s/.test(t)&&(n&&Ud(a.bottom-r.top)<10&&Yd(l,"bottom",r.bottom-u.height),Ud(a.bottom-r.bottom)<5&&Xd(c,"bottom",r.top+u.height)),/w/.test(t)&&(n&&Ud(a.left-r.right)<10&&Xd(l,"left",r.left+u.width),Ud(a.left-r.left)<5&&Yd(c,"left",r.right-u.width))}));var d=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(ki(e,"bpmn:FlowElement")||ki(e,"bpmn:Artifact"))})),h=p?Zd:Kd;return d.forEach((function(e){var n=vn(e);!/n/.test(t)||p&&!i||Yd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Xd(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Xd(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||i)&&Yd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,r,i)),ki(n,"bpmn:SubProcess")&&Hi(n)&&(t.minDimensions=Fd),ki(n,"bpmn:TextAnnotation")&&(t.minDimensions=Vd)}))}Hd.$inject=["eventBus"];var Ud=Math.abs,Wd=Math.min,Gd=Math.max;function Qd(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Yd(e,t,n){return Qd(e,t,n,Wd)}function Xd(e,t,n){return Qd(e,t,n,Gd)}var Zd={top:20,left:50,right:20,bottom:20},Kd={top:50,left:20,right:20,bottom:20};function Jd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.balanced=!xs(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(ki(r,"bpmn:Lane")||ki(r,"bpmn:Participant"))return i&&(o=gn(o),t.resizeLane(r,o,n.balanced)),!1}))}Jd.$inject=["eventBus","modeling"];function eh(e,t,n,r,i){function o(e){return Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Qi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return ki(e,"bpmn:ErrorEventDefinition")?"errorRef":ki(e,"bpmn:EscalationEventDefinition")?"escalationRef":ki(e,"bpmn:MessageEventDefinition")?"messageRef":ki(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Uo,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Pi(n));r&&!s(r)&&(Pt(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Ot(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Pi(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(a(n),t)}(n,o),delete t.referencedRootElement)}))}eh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(eh,Uo);var th=Math.max;function nh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;ki(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Ui(e);if(i=e,!Ru(i).length)return r?Bd:qd;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?Bd:{width:ih(e,n,o),height:qd.height}:r?{width:Bd.width,height:rh(e,n,o)}:qd;return s}(e,n,r)),ki(e,"bpmn:Lane")&&(i[t]=Ui(e)?$d:zd),ki(e,"bpmn:SubProcess")&&Hi(e)&&(i[t]=Fd),ki(e,"bpmn:TextAnnotation")&&(i[t]=Vd),ki(e,"bpmn:Group")&&(i[t]=Ld)})),i}))}function rh(e,t,n){var r;return r=function(e,t,n){var r,i=Ru(e);return r=oh(i,t,n),e.height-r.height+$d.height}(e,t,n),th(Bd.height,r)}function ih(e,t,n){var r;return r=function(e,t,n){var r,i=Ru(e);return r=oh(i,t,n),e.width-r.width+zd.width}(e,t,n),th(qd.width,r)}function oh(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Ru(i)).length?oh(o,t,n):i}nh.$inject=["eventBus"];var sh=180,ah=160;function lh(e,t,n,r,i,o,s){Uo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return ki(e,"bpmn:SubProcess")&&!Hi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Pi(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Pi(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(es(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(es(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(es(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(es(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ns(t))return s.updateId(t,ts(i)),void s.updateId(r,i);s.get(ts(r))&&s.updateId(ts(r),ts(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ns(t))return s.updateId(t,ts(r)),void s.updateId(i,r);var o=s.get(ts(i));o&&s.updateId(o,ts(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ns(n)){var r=n,i=s.get(Jo(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Hi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Hi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(ki(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Hi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=es(t),i=s.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(ki(Si(i),"bpmndi:BPMNPlane")){var o=Jo(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function ch(e,t){e.invoke(Uo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(ki(r,"bpmn:SubProcess")&&(ki(n,"bpmn:Task")||ki(n,"bpmn:CallActivity"))&&Hi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function ph(e){Uo.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;ki(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&ki(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function uh(e,t){Uo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Hi(n)){var r=yt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(lh,Uo),lh.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=vt(o);if(t.x){var a=xn(t),l=xn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:sh-s.x,y:ah-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},lh.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},lh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},lh.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:es(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},lh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=m(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},lh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],ch.$inject=["injector","modeling"],e(ch,Uo),e(ph,Uo),ph.$inject=["eventBus"],e(uh,Uo),uh.$inject=["eventBus","modeling"];function dh(e,t,n){Uo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;ki(n,"bpmn:SubProcess")&&(n.collapsed?Si(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Si(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Si(t).isExpanded=!1:Si(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Tu(n))?(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,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function hh(e,t,n,r){t.invoke(Uo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;mn(t)||(ki(t,"bpmn:Participant")&&Hi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;ki(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function fh(e,t){Uo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!ki(e,"bpmn:SequenceFlow"))return!1;var n=Pi(t),r=Pi(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(dh,Uo),dh.$inject=["eventBus","elementFactory","modeling"],e(hh,Uo),hh.$inject=["canvas","injector","moddle","modeling"],e(fh,Uo),fh.$inject=["eventBus","modeling"];function mh(e,t){var n;function r(){if(!n)throw new Error("out of bounds release");return n}Uo.call(this,e);var i=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(i,5e3,(function(e){(n=n||new gh).enter()})),this.postExecuted(i,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(ki(t,"bpmn:Lane")&&n.addLane(t),ki(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function gh(){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 yh(e,t){Uo.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)vh(e)&&!bh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function vh(e){const t=Pi(e);return t&&t.isForCompensation}function bh(e){return e.incoming.filter((e=>function(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Qi(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}mh.$inject=["eventBus","modeling"],e(mh,Uo),e(yh,Uo),yh.$inject=["eventBus","modeling"];var wh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Jp],appendBehavior:["type",tu],associationBehavior:["type",nu],attachEventBehavior:["type",ru],boundaryEventBehavior:["type",ou],compensateBoundaryEventBehaviour:["type",su],createBehavior:["type",pu],createDataObjectBehavior:["type",uu],createParticipantBehavior:["type",gu],dataInputAssociationBehavior:["type",vu],dataStoreBehavior:["type",xu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",$u],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",Vu],fixHoverBehavior:["type",Wu],groupBehavior:["type",Gu],importDockingFix:["type",Yu],isHorizontalFix:["type",Zu],labelBehavior:["type",md],layoutConnectionBehavior:["type",yd],messageFlowBehavior:["type",Pd],nonInterruptingBehavior:["type",Md],removeElementBehavior:["type",Dd],removeEmbeddedLabelBoundsBehavior:["type",Ad],removeParticipantBehavior:["type",Rd],replaceConnectionBehavior:["type",jd],replaceElementBehaviour:["type",Id],resizeBehavior:["type",Hd],resizeLaneBehavior:["type",Jd],rootElementReferenceBehavior:["type",eh],spaceToolBehavior:["type",nh],subProcessPlaneBehavior:["type",lh],subProcessStartEventBehavior:["type",ch],textAnnotationBehavior:["type",ph],toggleCollapseConnectionBehaviour:["type",uh],toggleElementCollapseBehaviour:["type",dh],unclaimIdBehavior:["type",hh],unsetDefaultFlowBehavior:["type",fh],updateFlowNodeRefsBehavior:["type",mh],setCompensationActivityAfterPasteBehavior:["type",yh]};function xh(e,t){var n=_n(e,t,-15);return"intersect"!==n?n:null}function _h(e){nc.call(this,e)}function Eh(e){return!e||mn(e)}function kh(e){do{if(ki(e,"bpmn:Process"))return Pi(e);if(ki(e,"bpmn:Participant"))return Pi(e).processRef||Pi(e)}while(e=e.parent)}function Oh(e){return ki(e,"bpmn:TextAnnotation")}function Ph(e){return ki(e,"bpmn:Group")&&!e.labelTarget}function Sh(e){return ki(e,"bpmn:BoundaryEvent")&&Ah(e,"bpmn:CompensateEventDefinition")}function Ch(e){return Pi(e).isForCompensation}function Th(e){for(var t=e;t=t.parent;){if(ki(t,"bpmn:FlowElementsContainer"))return Pi(t);if(ki(t,"bpmn:Participant"))return Pi(t).processRef}return null}function Mh(e,t){return Th(e)===Th(t)}function Ah(e,t){return!!m(Pi(e).eventDefinitions||[],(function(e){return ki(e,t)}))}function Dh(e,t){return(Pi(e).eventDefinitions||[]).every((function(e){return ki(e,t)}))}function Nh(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function Rh(e,t,n){if(Eh(e)||Eh(t))return null;if(!ki(n,"bpmn:DataAssociation")){if(Qh(e,t))return{type:"bpmn:MessageFlow"};if(Yh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Xh(e,t);return r||(Gh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Wh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function jh(e,t){return!(!mn(e)&&!Ph(e))||!(ki(t,"bpmn:Participant")&&!Hi(t))&&(ki(e,"bpmn:Participant")?ki(t,"bpmn:Process")||ki(t,"bpmn:Collaboration"):Oi(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:ki(e,"bpmn:Lane")?ki(t,"bpmn:Participant")||ki(t,"bpmn:Lane"):!(ki(e,"bpmn:BoundaryEvent")&&!function(e){return Pi(e).cancelActivity&&($h(e)||zh(e))}(e))&&(ki(e,"bpmn:FlowElement")&&!ki(e,"bpmn:DataStoreReference")?ki(t,"bpmn:FlowElementsContainer")?Hi(t):Oi(t,["bpmn:Participant","bpmn:Lane"]):ki(e,"bpmn:DataStoreReference")&&ki(t,"bpmn:Collaboration")?_(Pi(t).get("participants"),(function(e){return!!e.get("processRef")})):Oi(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Oi(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!ki(e,"bpmn:MessageFlow")&&(ki(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Ih(e){return ki(e,"bpmn:Lane")}function Lh(e){return!!function(e){return!mn(e)&&ki(e,"bpmn:BoundaryEvent")}(e)||(!(!ki(e,"bpmn:IntermediateThrowEvent")||!$h(e))||ki(e,"bpmn:IntermediateCatchEvent")&&zh(e))}function $h(e){var t=Pi(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zh(e){return Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bh(e,t){return t.some((function(t){return Ah(e,t)}))}function qh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!mn(i)&&(!!Lh(i)&&(!Gi(t)&&(!(!ki(t,"bpmn:Activity")||Ch(t))&&(!(r&&!xh(r,t))&&(!function(e){return ki(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return ki(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Fh(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Gi(t)||ki(e,"bpmn:StartEvent")&&"label"!==e.type&&jh(e,t)&&(Wi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Qi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Qi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Qi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&ki(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),ki(t,"bpmn:Transaction")||Ah(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(ki(e,"bpmn:EndEvent")&&jh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),ki(e,"bpmn:BoundaryEvent")&&qh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Vh(e,t){return!_(e,Ih)&&(!t||e.every((function(e){return jh(e,t)})))}function Hh(e,t,n,r){return!!t&&(!(!mn(e)&&!Ph(e))||!function(e,t){return e===t}(n,t)&&((!n||!Nh(n,t))&&(jh(e,t)||Zh(e,t))))}function Uh(e,t){return ki(e,"bpmn:SubProcess")?Hi(e)&&(!t||t.width>=100&&t.height>=80):!!ki(e,"bpmn:Lane")||(!!ki(e,"bpmn:Participant")||(!!Oh(e)||!!Ph(e)))}function Wh(e,t){return!Nh(t,e)&&!Nh(e,t)&&(!!function(e,t){var n=Oh(e),r=Oh(t);return(n||r)&&n!==r}(e,t)||!!Xh(e,t))}function Gh(e,t){return Mh(e,t)&&Sh(e)&&ki(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Gi(t);var n}function Qh(e,t){return!(Jh(e)&&!Jh(t))&&(ki(n=e,"bpmn:InteractionNode")&&!ki(n,"bpmn:BoundaryEvent")&&(!ki(n,"bpmn:Event")||ki(n,"bpmn:ThrowEvent")&&Dh(n,"bpmn:MessageEventDefinition"))&&function(e){return ki(e,"bpmn:InteractionNode")&&!Ch(e)&&(!ki(e,"bpmn:Event")||ki(e,"bpmn:CatchEvent")&&Dh(e,"bpmn:MessageEventDefinition"))&&!(ki(e,"bpmn:BoundaryEvent")&&!Ah(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Yh(e,t){return ki(n=e,"bpmn:FlowNode")&&!ki(n,"bpmn:EndEvent")&&!Gi(n)&&!(ki(n,"bpmn:IntermediateThrowEvent")&&Ah(n,"bpmn:LinkEventDefinition"))&&!Sh(n)&&!Ch(n)&&function(e){return ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:StartEvent")&&!ki(e,"bpmn:BoundaryEvent")&&!Gi(e)&&!(ki(e,"bpmn:IntermediateCatchEvent")&&Ah(e,"bpmn:LinkEventDefinition"))&&!Ch(e)}(t)&&Mh(e,t)&&!(ki(e,"bpmn:EventBasedGateway")&&!function(e){return ki(e,"bpmn:ReceiveTask")||ki(e,"bpmn:IntermediateCatchEvent")&&(Ah(e,"bpmn:MessageEventDefinition")||Ah(e,"bpmn:TimerEventDefinition")||Ah(e,"bpmn:ConditionalEventDefinition")||Ah(e,"bpmn:SignalEventDefinition"))}(t));var n}function Xh(e,t){return Oi(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Oi(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Oi(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Oi(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Zh(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(Oi(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mn(t)&&ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:BoundaryEvent")&&jh(e,t.parent))}function Kh(e,t){return!!mn(t)||!(ki(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Jh(e){return gc(e,"bpmn:Process")||gc(e,"bpmn:Collaboration")}e(_h,nc),_h.$inject=["eventBus"],_h.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Eh(e))return null;return Oi(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Rh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Rh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Uh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(fn(r)&&!Zh(t,r))&&x(t,(function(e){return fn(e)?Rh(e.source,e.target,e):e.host?qh(e,e.host,null,n):Hh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return qh(n,t,null,r)||Fh(n,t,r)||Vh(n,t)||Zh(n,t)})),this.addRule("shape.create",(function(e){return Hh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return qh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Kh(e.elements,t)}))},_h.prototype.canConnectMessageFlow=Qh,_h.prototype.canConnectSequenceFlow=Yh,_h.prototype.canConnectDataAssociation=Xh,_h.prototype.canConnectAssociation=Wh,_h.prototype.canConnectCompensationAssociation=Gh,_h.prototype.canMove=Vh,_h.prototype.canAttach=qh,_h.prototype.canReplace=Fh,_h.prototype.canDrop=jh,_h.prototype.canInsert=Zh,_h.prototype.canCreate=Hh,_h.prototype.canConnect=Rh,_h.prototype.canResize=Uh,_h.prototype.canCopy=Kh;var ef={__depends__:[$c],__init__:["bpmnRules"],bpmnRules:["type",_h]};function tf(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Si(e);t=E(y(yt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Si),n.set("planeElement",t)}))}))}tf.$inject=["eventBus","canvas"];var nf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",tf]};function rf(e){Uo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function of(e,t){rf.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=m(n,(function(t){return Oi(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error(`no order for <${e.id}>`);return t}this.getOrdering=function(e,n){if(e.labelTarget||ki(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var r=t;r&&!Oi(r,n);)r=r.parent;if(!r)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}rf.prototype.getOrdering=function(e,t){return null},e(rf,Uo),of.$inject=["eventBus","canvas"],e(of,rf);var sf={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",of]};function af(){}af.prototype.get=function(){return this._data},af.prototype.set=function(e){this._data=e},af.prototype.clear=function(){var e=this._data;return delete this._data,e},af.prototype.isEmpty=function(){return!this._data};var lf={clipboard:["type",af]},cf="drop-ok",pf="drop-not-ok",uf="attach-ok",df="new-parent",hf="create";function ff(e,t,n,r,i){function o(t,n){[uf,cf,pf,df].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===hf&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);mf(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||mn(t)&&-1!==e.indexOf(n))})),(function(e){return!fn(e)})),a=!1,l=!1,c=!1;gf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=gf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,uf):o(r,c?df:pf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;mf(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,L({},p,{attach:l})),(function(e){return!fn(e)})),L(t,{elements:o,shape:i}),L(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!fn(e)}));if(i){r=L({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(y(n,(function(e){return!e.hidden})));v(n,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),L(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,hf,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function mf(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function gf(e){return e&&1===e.length&&!fn(e[0])}ff.$inject=["canvas","dragging","eventBus","modeling","rules"];function yf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Re("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Re("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Xn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Xn(i),e),Kn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Kn(l,t.x,t.y)):Ue(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ue(t)}))}yf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var vf={__depends__:[Nc,Gp,$c,Ns],__init__:["create","createPreview"],create:["type",ff],createPreview:["type",yf]};function bf(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}bf.$inject=["eventBus"],bf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var wf={__init__:["mouse"],mouse:["type",bf]};function xf(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),fn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return E(e.waypoints,(function(e){return(e=_f(e)).original&&(e.original=_f(e.original)),e}))}(n)),mn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){L(e.hints,{createElementsBehavior:!1})}))}function _f(e){return L({},e)}function Ef(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}xf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],xf.prototype.copy=function(e){var t,n;return c(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(c(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},xf.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},xf.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=vt(e);return v(e,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),L(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,L({},r))},xf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=L({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),fn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):mn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},xf.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},xf.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},xf.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},xf.prototype.hasRelations=function(e,t){var n,r;return!(fn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(mn(e)&&!m(t,M({id:e.labelTarget.id})))},xf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return gt(ht(e),(function(e,t,r){if(!mn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=E(i,(function(e){return e.element})),i=E(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=E(i,(function(e){return e.element})),v(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?Ef(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):Ef(i.element,e)})),r};var kf={__depends__:[lf,vf,wf,$c],__init__:["copyPaste"],copyPaste:["type",xf]};function Of(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Pf(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Pi(n);if(mn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Si(n),!0);s.bpmnElement=o,Of(o,t,"name"),Of(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(mn(n))return n.businessObject=Pi(t[n.labelTarget]),void(n.di=Si(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Of(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Participant")){var i=Pi(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Pi(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Pi(e).attachedToRef=Pi(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}Pf.$inject=["bpmnFactory","eventBus","moddleCopy"];var Sf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Cf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Sf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&d(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function Tf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Cf.$inject=["eventBus","bpmnFactory","moddle"],Cf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Tf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},Cf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},Cf.prototype._copyId=function(e,t,n=!1){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var Mf={__depends__:[kf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Pf],moddleCopy:["type",Cf]},Af=Math.round;function Df(e,t){this._modeling=e,this._eventBus=t}function Nf(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Df.$inject=["modeling","eventBus"],Df.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=Af(a+o/2),p=Af(l+s/2),u=r.replaceShape(e,L({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Nf.$inject=["selection","eventBus"];var Rf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Nf],replace:["type",Df]};var jf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function If(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Lf(d)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Hi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),m={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Tf(d.$descriptor),Tf(h.$descriptor,!0));L(h,B(l,jf));var b=y(g,(function(e){return"eventDefinitions"===e?$f(a,l.eventDefinitionType):"loopCharacteristics"===e?!Gi(h):!f(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Gi(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&($f(h,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),ki(d,"bpmn:Activity")){if(Lf(d))m.isExpanded=Hi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Hi(a)&&!ki(d,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Lf(d)&&!Lf(h)&&(p.moveChildren=!1),ki(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Ui(a);Si(a).isHorizontal||(Si(m).isHorizontal=x),m.width=x?a.width:t.getDefaultSize(m).width,m.height=x?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:h})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),h.name=d.name,Oi(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Oi(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!ki(d,"bpmn:BoundaryEvent")&&ki(h,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Lf(e){return ki(e,"bpmn:SubProcess")}function $f(e,t){var n=Pi(e);return t&&n.get("eventDefinitions").some((function(e){return ki(e,t)}))}If.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var zf={__depends__:[Mf,Rf,Ns],bpmnReplace:["type",If]};function Bf(e){this._eventBus=e,this._tools=[],this._active=null}Bf.$inject=["eventBus"],Bf.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Bf.prototype.isActive=function(e){return e&&this._active===e},Bf.prototype.length=function(e){return this._tools.length},Bf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Bf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var qf={__depends__:[Nc],__init__:["toolManager"],toolManager:["type",Bf]};function Ff(e,t){return-1!==e.indexOf(t)}var Vf=Math.abs,Hf=Math.round,Uf={x:"width",y:"height"},Wf="crosshair",Gf={n:"top",w:"left",s:"bottom",e:"right"},Qf=1500,Yf={n:"s",w:"e",s:"n",e:"w"},Xf=20;function Zf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",Qf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Jf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Jf(e);var c={x:0,y:0};c[r]=Hf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Kf(e){return{top:e.top-Xf,right:e.right+Xf,bottom:e.bottom+Xf,left:e.left-Xf}}function Jf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function em(e,t){return-1!==e.indexOf(t)}Zf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Zf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Wf,data:{context:{reactivate:n}},trapClick:!1})},Zf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Wf,data:{context:{}}})},Zf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Zf.prototype.init=function(e,t){var n=Vf(e.dx)>Vf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Vf(r)<5)return!1;r<0&&(r*=-1),xs(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),s=this._canvas.getRootElement();!_s(e)&&e.hover&&(s=e.hover);var a=[...yt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,f,m,g,v=e.attachers,b=e.children,w=vn(e),x=y(b,(function(e){return!(fn(e)||mn(e)||em(o,e)||em(s,e))})),_=y(b,(function(e){return!fn(e)&&!mn(e)&&em(o,e)})),E=[],k=[];x.length&&(d=Kf(vn(vt(x))),p=r-w[Gf[n]]+d[Gf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(h=Kf(vn(vt(_))),p=r-h[Gf[Yf[n]]]+w[Gf[Yf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){em(o,e)?E.push(e):k.push(e)})),E.length&&(f=vn(vt(E.map(xn))),m=w[Gf[Yf[n]]]-(f[Gf[Yf[n]]]-r)),k.length&&(g=vn(vt(k.map(xn)))[Gf[n]]-(w[Gf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Uf[t]]-O[Uf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Uf[t]]-O[Uf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Uf[t]]+O[Uf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Uf[t]]+O[Uf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return L(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),ea("resize-"+("x"===n?"ew":"ns")),!0},Zf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!mn(e))if(fn(e))l.push(e);else{var o=e[t],p=o+e[Uf[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>r||n<0&&xn(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;em(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;em(p,t)&&em(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Zf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Zf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var tm="djs-dragging",nm="djs-resizing",rm=Math.max;function im(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,tm)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Re("g");Oe(a,r.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Re("path");Oe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Re("path");Oe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Kn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ue(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Oe(a=Re("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Re("g");Oe(d,r.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),fn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Re("g");Oe(h,r.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var f=[];v(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,nm)})),s.frameGroup=h,s.frames=f}Oe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Kn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Oe(r,{width:rm(i.width+m.x,5)}):Oe(r,{width:t=rm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Oe(r,{height:rm(i.height+m.y,5)}):Oe(r,{height:n=rm(i.height-m.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,tm)})),v(i,(function(e){n.removeMarker(e,tm)})),a&&(Ue(s),Ue(a)),v(o,(function(e){n.removeMarker(e,nm)})),l&&Ue(l)}))}im.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var om={__init__:["spaceToolPreview"],__depends__:[Nc,$c,qf,Gp,wf],spaceTool:["type",Zf],spaceToolPreview:["type",im]};function sm(e,t){e.invoke(Zf,this),this._canvas=t}sm.$inject=["injector","canvas"],e(sm,Zf),sm.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],s=[];o&&(s=O(bt(i.children.filter((e=>ki(e,"bpmn:Artifact"))),vt(o))));const a=[...e,...s];var l=Zf.prototype.calculateAdjustments.call(this,a,t,n,r);return l.resizingShapes=l.resizingShapes.filter((function(e){return!ki(e,"bpmn:TextAnnotation")&&(!function(e){return ki(e,"bpmn:Participant")&&!Pi(e).processRef}(e)||!("y"===t&&Ui(e)||"x"===t&&!Ui(e)))})),l};var am={__depends__:[om],spaceTool:["type",sm]};function lm(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}lm.$inject=["eventBus","injector"],lm.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},lm.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},lm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},lm.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},lm.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},lm.prototype.register=function(e,t){this._setHandler(e,t)},lm.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},lm.prototype.canUndo=function(){return!!this._getUndoAction()},lm.prototype.canRedo=function(){return!!this._getRedoAction()},lm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},lm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},lm.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},lm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},lm.prototype._createId=function(){return this._uid++},lm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},lm.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},lm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},lm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},lm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},lm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},lm.prototype._revertedAction=function(e){this._stackIdx--},lm.prototype._getHandler=function(e){return this._handlerMap[e]},lm.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 cm={commandStack:["type",lm]};function pm(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function um(e,t,n){Uo.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=dm(n),t.validatedShapes=dm(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;pm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=St(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Pt(r.labels,n,i),n.labelTarget=r)}))}function dm(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(um,Uo),um.$inject=["injector","eventBus","modeling"];var hm={__init__:["labelSupport"],labelSupport:["type",um]},fm="attach-ok";function mm(e,t,n,r,i){Uo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=gm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;v(gm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,fm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,fm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(gm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,r=t.newHost;r&&1!==n.length||v(r?n:y(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;pm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=dd(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=dd(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;pm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function gm(e){return r(E(e,(function(e){return e.attachers||[]})))}e(mm,Uo),mm.$inject=["injector","eventBus","canvas","rules","modeling"];var ym={__depends__:[$c],__init__:["attachSupport"],attachSupport:["type",mm]};function vm(e){this._model=e}function bm(e,t,n){Uo.call(this,e),this._bpmnFactory=t;var r=this;function i(e){v(e.context.oldRoot.children,(function(e){ki(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function o(e){var t=e.context.shape;ki(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function a(e){r.updateConnectionWaypoints(e.context.connection)}function l(e){r.updateAttachment(e.context)}function c(e){const{element:n}=e.context,r=no(n),i=Si(n),o=i&&i.get("label");Zi(n)||ns(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wm((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wm((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],i),this.reverted(["canvas.updateRoot"],i),this.executed(["shape.move","shape.create","shape.resize"],wm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],wm((function(e){"label"!==e.context.shape.type&&o(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&o({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],wm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],wm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],wm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],wm(a)),this.executed("connection.reconnect",wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Pi(n),s=Pi(r),a=Pi(i);o.conditionExpression&&!Oi(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Pi(n),s=Pi(r),a=Pi(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],wm(l)),this.reverted(["element.updateAttachment"],wm(l)),this.executed("element.updateLabel",wm(c)),this.reverted("element.updateLabel",wm(c))}function wm(e){return function(t){var n=t.context;ki(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function xm(e,t){Un.call(this),this._bpmnFactory=e,this._moddle=t}function _m(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function Em(e,t){this._modeling=e,this._canvas=t}function km(e){this._modeling=e}function Om(e,t){this._canvas=e,this._layouter=t}vm.$inject=["moddle"],vm.prototype._needsId=function(e){return Oi(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},vm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=ki(e,"bpmn:Activity")?"Activity":ki(e,"bpmn:Event")?"Event":ki(e,"bpmn:Gateway")?"Gateway":Oi(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},vm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},vm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},vm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},vm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},vm.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},vm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",B(e,["x","y"]))},vm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},vm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))},e(bm,Uo),bm.$inject=["eventBus","bpmnFactory","connectionDocking"],bm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},bm.prototype.updateParent=function(e,t){if(!(mn(e)||ki(e,"bpmn:DataStoreReference")&&e.parent&&ki(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Si(e),o=n&&n.businessObject,s=Si(n);ki(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),ki(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),ki(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),ki(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},bm.prototype.updateBounds=function(e){var t=Si(e),n=function(e){if(!ki(e,"bpmn:Activity"))return;var t=Si(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=oa(n,t.get("bounds"));L(n,{x:e.x+r.x,y:e.y+r.y})}var i=mn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},bm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(ki(n,"bpmn:Lane")&&Ot(n.get("flowNodeRef"),e),ki(t,"bpmn:Lane")&&Pt(t.get("flowNodeRef"),e))},bm.prototype.updateDiConnection=function(e,t,n){var r=Si(e),i=Si(t),o=Si(n);r.sourceElement&&r.sourceElement.bpmnElement!==Pi(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Pi(n)&&(r.targetElement=n&&o)},bm.prototype.updateDiParent=function(e,t){if(t&&!ki(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ot(n,e),e.$parent=null)}},bm.prototype.getLaneSet=function(e){var t,n;return ki(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(ki(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},bm.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&(!ki(e,"bpmn:DataInput")&&!ki(e,"bpmn:DataOutput")||(ki(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(ki(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(ki(e,"bpmn:FlowElement")){if(t)if(ki(t,"bpmn:Participant"))t=t.processRef;else if(ki(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(ki(t,"bpmn:Lane"));r="flowElements"}else if(ki(e,"bpmn:Artifact")){for(;t&&!ki(t,"bpmn:Process")&&!ki(t,"bpmn:SubProcess")&&!ki(t,"bpmn:Collaboration");){if(ki(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(ki(e,"bpmn:MessageFlow"))r="messageFlows";else if(ki(e,"bpmn:Participant")){r="participants";var i,o=e.processRef;o&&(i=function(e){for(;e&&!ki(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Ot(i.get("rootElements"),o),o.$parent=null),t&&(Pt(i.get("rootElements"),o),o.$parent=i))}else ki(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":ki(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Ot(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(r);Ot(s,e),t&&(a||(a=[],t.set(r,a)),a.push(e))}}},bm.prototype.updateConnectionWaypoints=function(e){Si(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},bm.prototype.updateConnection=function(e){var t,n=e.connection,r=Pi(n),i=n.source,o=Pi(i),s=n.target,a=Pi(n.target);if(ki(r,"bpmn:DataAssociation"))ki(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):ki(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=ki(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Ot(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Ot(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},bm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(xm,Un),xm.$inject=["bpmnFactory","moddle"],xm.prototype._baseCreate=Un.prototype.create,xm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Yi,t))}return this.createElement(e,t)},xm.prototype.createElement=function(e,t){var n,r,i,o=(t=L({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");xi(o=this._bpmnFactory.create(t.type))}if(!Oi(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=L({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return ki(o,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=_m(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=_m(s,t,"isExpanded")),Oi(o,["bpmn:Lane","bpmn:Participant"])&&(t=_m(s,t,"isHorizontal")),ki(o,"bpmn:SubProcess")&&(t.collapsed=!Hi(o,s)),ki(o,"bpmn:ExclusiveGateway")&&(f(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=o.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=o,o.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=L({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},xm.prototype.getDefaultSize=function(e,t){var n=Pi(e);if(t=t||Si(e),ki(n,"bpmn:SubProcess"))return Hi(n,t)?{width:350,height:200}:{width:100,height:80};if(ki(n,"bpmn:Task"))return{width:100,height:80};if(ki(n,"bpmn:Gateway"))return{width:50,height:50};if(ki(n,"bpmn:Event"))return{width:36,height:36};if(ki(n,"bpmn:Participant")){var r=void 0===t.isHorizontal||!0===t.isHorizontal;return Hi(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return ki(n,"bpmn:Lane")?{width:400,height:100}:ki(n,"bpmn:DataObjectReference")?{width:36,height:50}:ki(n,"bpmn:DataStoreReference")?{width:50,height:50}:ki(n,"bpmn:TextAnnotation")?{width:100,height:30}:ki(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},xm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=L({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Em.$inject=["modeling","canvas"],Em.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},Em.prototype.postExecute=function(e){},km.$inject=["modeling"],km.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},km.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Om.$inject=["canvas","layouter"],Om.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,i,o),t},Om.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Pm=Math.round;function Sm(e){this._modeling=e}Sm.$inject=["modeling"],Sm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(y(t,(function(e){return!e.hidden})));v(t,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:Pm(e.x-a.x-a.width/2+i.x),y:Pm(e.y-a.y-a.height/2+i.y)}}))),L(e,{x:Pm(e.x-a.x-a.width/2+i.x),y:Pm(e.y-a.y-a.height/2+i.y)})}));var l=ht(t),c={};v(t,(function(e){if(fn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=L({},o);-1===l.indexOf(e)&&(t.autoResize=!1),mn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,B(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,B(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var Cm=Math.round;function Tm(e){this._canvas=e}function Mm(e){Tm.call(this,e)}Tm.$inject=["canvas"],Tm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?L(t,n):L(t,{x:n.x-Cm(t.width/2),y:n.y-Cm(t.height/2)}),this._canvas.addShape(t,r,i),t},Tm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Mm,Tm),Mm.$inject=["canvas"];var Am=Tm.prototype.execute;Mm.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,Am.call(this,e)};var Dm=Tm.prototype.revert;function Nm(e,t){this._canvas=e,this._modeling=t}function Rm(e,t){this._modeling=e,this._elementRegistry=t}function jm(e,t){this._canvas=e,this._modeling=t}function Im(e){this._modeling=e}Mm.prototype.revert=function(e){return e.shape.labelTarget=null,Dm.call(this,e)},Nm.$inject=["canvas","modeling"],Nm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Nm.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=St(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Nm.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,r),this._canvas.addConnection(t,n),t},Rm.$inject=["modeling","elementRegistry"],Rm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},jm.$inject=["canvas","modeling"],jm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.children,(function(e){fn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},jm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=St(r.children,n),t.removeShape(n),n},jm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Pt(r.children,n,i),t.addShape(n,r),n},Im.$inject=["modeling"];var Lm={x:"y",y:"x"};function $m(e,t){this._layouter=e,this._canvas=t}function zm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function qm(e){this._modeling=e}function Fm(e){this._helper=new qm(e)}function Vm(e){this._modeling=e,this._helper=new qm(e)}function Hm(e){this._modeling=e}function Um(e){return e.original||e}function Wm(e,t){this._modeling=e,this._rules=t}function Gm(e){this._modeling=e}function Qm(e){this._modeling=e}function Ym(e){return L({},e)}function Xm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Zm(e,t,n){var r=Xm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Km(e,t){return-1!==e.indexOf(t)}function Jm(e){this._modeling=e}function eg(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=L({},t,eg(e.children)))})),t}function tg(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(tg(e.children,e.collapsed||t)))})),n}function ng(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(ng(e.children,t)))})),n}function rg(e){this._modeling=e}function ig(e,t){return Ot(e&&e.attachers,t)}function og(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Pt(r,t,n)}}function sg(){}function ag(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function lg(e){this._elementRegistry=e}function cg(e,t){v(t,(function(t,n){e.set(n,t)}))}Im.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],f=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Lm[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Lm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},Im.prototype.postExecute=function(e){},$m.$inject=["layouter","canvas"],$m.prototype.execute=function(e){var t=e.connection;return L(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},$m.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},zm.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},zm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Ot(n.children,t),Pt(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},Bm.prototype.add=function(e,t){return this.addAll([e],t)},Bm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=_t((n=n||{}).allShapes),i=_t(n.allConnections),o=_t(n.enclosedElements),a=_t(n.enclosedConnections),l=_t(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return gt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return L(this,n),this},qm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},qm.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&wd(e,e.source,t),connectionEnd:i&&xd(e,e.target,t)})}))},qm.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},Fm.$inject=["modeling"],Fm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Fm.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},Vm.$inject=["modeling"],Vm.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=B(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(r.children,t,i),L(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Vm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:xd(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:wd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Vm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Pt(n.children,t,r),L(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Vm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Vm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Hm.$inject=["modeling"],Hm.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},Hm.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Um(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Um(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Hm.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},Wm.$inject=["modeling","rules"],Wm.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,bd(e,t,u),a)})),v(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,vd(e,t,u),a)}))},Wm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Wm.prototype.execute=function(e){},Wm.prototype.revert=function(e){},Wm.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Wm.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Wm.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Gm.$inject=["modeling"],Gm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Gm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:bd(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:vd(e,n,r)})})))},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Qm.$inject=["modeling"],Qm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(Ff(e,i)||Ff(e,o)||Ff(t,i)||Ff(t,o))&&(Ff(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Qm.prototype.execute=function(){},Qm.prototype.revert=function(){},Qm.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Qm.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Qm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=Ym(e)).original&&(e.original=Ym(e.original)),e}))}(e),d=Xm(n),h={};Km(l,c)&&Km(l,p)?(u=E(u,(function(e){return Zm(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Zm(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Km(l,c)||Km(l,p))&&(Km(i,c)?h.connectionStart=wd(e,c,t):Km(i,p)?h.connectionEnd=xd(e,p,t):Km(o,c)?h.connectionStart=vd(e,c,s[c.id]):Km(o,p)&&(h.connectionEnd=bd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},Jm.$inject=["modeling"],Jm.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=eg(n),t.collapsed=!t.collapsed;var r=tg(n,t.collapsed);return[t].concat(r)},Jm.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=ng(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},rg.$inject=["modeling"],rg.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=ig(r,t),og(n,t),t.host=n,t},rg.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,ig(n,t),og(r,t,i),t},sg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},sg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},ag.$inject=["eventBus","elementFactory","commandStack"],ag.prototype.getHandlers=function(){return{"shape.append":km,"shape.create":Tm,"shape.delete":jm,"shape.move":Vm,"shape.resize":Gm,"shape.replace":Wm,"shape.toggleCollapse":Jm,spaceTool:Qm,"label.create":Mm,"connection.create":Om,"connection.delete":Nm,"connection.move":zm,"connection.layout":$m,"connection.updateWaypoints":sg,"connection.reconnect":Hm,"elements.create":Sm,"elements.move":Fm,"elements.delete":Rm,"elements.distribute":Im,"elements.align":Em,"element.updateAttachment":rg}},ag.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},ag.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},ag.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ag.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},ag.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},ag.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ag.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},ag.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},ag.prototype.createElements=function(e,t,n,r,i){c(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},ag.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},ag.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},ag.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ag.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},ag.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ag.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ag.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},ag.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ag.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},ag.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},ag.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},ag.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},ag.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,L(r,{docking:"source"}))},ag.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,L(r,{docking:"target"}))},ag.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},ag.prototype._create=function(e,t){return t instanceof zn?t:this._elementFactory.create(e,t)},ag.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},lg.$inject=["elementRegistry"],lg.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,k(r));return cg(n,r),e.oldProperties=o,e.changed=i,i},lg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return cg(n,t),r},lg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return ki(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return ki(t,"bpmn:DataObjectReference")&&Pi(t).dataObjectRef===e}))}(e,t):[]};var pg="default",ug="id",dg="di",hg={width:0,height:0};function fg(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}function mg(e,t){return ug in e&&e[ug]!==t[ug]}function gg(e,t){var n=e.businessObject,r=Si(e);v(t,(function(e,t){t!==dg?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}fg.$inject=["elementRegistry","moddle","modeling","textRenderer"],fg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,s=function(e){var t=L({},e);return yg.forEach((function(n){n in e&&(t[n]=Pi(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=k(t),r=e.businessObject,i=Si(e);return w(n,(function(e,n){return e[n]=n!==dg?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,k(t.di)),e}),{})}(t,s);return mg(s,o)&&(i.unclaim(o[ug]),r.updateId(t,s[ug]),i.claim(s[ug],o)),pg in s&&(s[pg]&&n.push(r.get(s[pg].id)),o[pg]&&n.push(r.get(o[pg].id))),gg(t,s),e.oldProperties=a,e.changed=n,n},fg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Pi(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,hg)}},fg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return gg(t,r),mg(n,i)&&(s.unclaim(n[ug]),o.updateId(t,r[ug]),s.claim(r[ug],i)),e.changed};var yg=["default"];function vg(e,t){this._canvas=e,this._modeling=t}function bg(e,t){this._modeling=e,this._spaceTool=t}function wg(e){this._modeling=e}function xg(e,t){this._modeling=e,this._spaceTool=t}vg.$inject=["canvas","modeling"],vg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Si(i);return t.setRootElement(n),t.removeRootElement(i),Pt(s.rootElements,r),r.$parent=s,Ot(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},vg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Si(n);return t.setRootElement(i),t.removeRootElement(n),Ot(s.rootElements,r),r.$parent=null,Pt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},bg.$inject=["modeling","spaceTool"],bg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=ju(r),s=o===r,a=s?r:r.parent,l=Ru(a),c=Ui(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Du,y:r.y,width:r.width-Du,height:r.height}:{x:r.x,y:r.y+Du,width:r.width,height:r.height-Du};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,f,m,g=[];gt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,h=(d=r.y)+10,f="n",m="y"):"left"===i?(u=-120,h=(d=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,h=(d=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,h=(d=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,h);var w=c?{x:r.x+(s?Du:0),y:d-("top"===i?120:0),width:r.width-(s?Du:0),height:120}:{x:d-("left"===i?120:0),y:r.y+(s?Du:0),width:120,height:r.height-(s?Du:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},wg.$inject=["modeling"],wg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Ru(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var s,a,l,c,p=Ui(n),u=p?n.height:n.width,d=Math.round(u/r);for(c=0;c<r;c++)s=c===r-1?u-d*c:d,a=p?{x:n.x+Du,y:n.y+c*d,width:n.width-Du,height:s}:{x:n.x+c*d,y:n.y+Du,width:s,height:n.height-Du},c<o?t.resizeShape(i[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},xg.$inject=["modeling","spaceTool"],xg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},xg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Iu(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},xg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=vn(e),c=Ou(vn(t),l),p=ju(e),u=[],d=[];gt(p,(function(e){return u.push(e),(ki(e,"bpmn:Lane")||ki(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var _g="flowNodeRef",Eg="lanes";function kg(e){this._elementRegistry=e}function Og(e){this._moddle=e}kg.$inject=["elementRegistry"],kg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=ju(e);return i[t.id]||(i[t.id]=Nu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=vn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=ju(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return ki(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(Eg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(_g).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},kg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(Eg);e.remove.forEach((function(e){Ot(n,e),Ot(e.get(_g),t)})),e.add.forEach((function(e){Pt(n,e),Pt(e.get(_g),t)}))})),[]},kg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Eg);e.add.forEach((function(e){Ot(n,e),Ot(e.get(_g),t)})),e.remove.forEach((function(e){Pt(n,e),Pt(e.get(_g),t)}))})),[]},Og.$inject=["moddle"],Og.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},Og.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var Pg={fill:void 0,stroke:void 0};function Sg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error(`invalid color value: ${e}`)}}}Sg.$inject=["commandStack"],Sg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Pg,r=this,i={};"fill"in n&&L(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=fn(e)?B(i,["border-color"]):i,n=Si(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),mn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Oi(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Cg={width:0,height:0};function Tg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return ro(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!mn(n)&&Zi(n)&&!Ki(n)&&!Mg(i)){var o=eo(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=no(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(mn(i)||ki(i,"bpmn:TextAnnotation"))if(mn(i)&&Mg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=no(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Cg)}}}function Mg(e){return!e||!e.trim()}function Ag(e,t,n,r){ag.call(this,e,t,n),this._bpmnRules=r}function Dg(){}Tg.$inject=["modeling","textRenderer","bpmnFactory"],e(Ag,ag),Ag.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ag.prototype.getHandlers=function(){var e=ag.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=lg,e["element.updateProperties"]=fg,e["canvas.updateRoot"]=vg,e["lane.add"]=bg,e["lane.resize"]=xg,e["lane.split"]=wg,e["lane.updateRefs"]=kg,e["id.updateClaim"]=Og,e["element.setColor"]=Sg,e["element.updateLabel"]=Tg,e},Ag.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},Ag.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},Ag.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ag.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ag.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ag.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ag.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ag.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ag.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ag.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ag.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ag.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ag.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Dg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var Ng=20,Rg=5,jg=Math.round,Ig=20,Lg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function $g(e,t,n){var r,i,o,s=_n(t,e,Rg),a=n.split(":")[0],l=jg((t.x-e.x)/2+e.x),c=jg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),d=!1,h=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",d?u?(h=c===e.y,r={x:e.x+Ng*(/l/.test(a)?-1:1),y:h?c+Ng:c}):r={x:(h=l===e.x)?l+Ng:l,y:e.y+Ng*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Bg(e,r,i).concat(r),directions:i,turnNextDirections:h}}function zg(e){return e.split(":").reverse().join(":")}function Bg(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ug(n)){var r=function(e,t,n){return $g(e,t,n)}(e,t,n),i=function(e,t,n){var r=$g(t,e,zg(n));return{waypoints:r.waypoints.slice().reverse(),directions:zg(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=jg((t.x-e.x)/2+e.x),i=jg((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:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function qg(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=_n(e,t,Lg[o]||0),a=function(e,t){if(Ug(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}}(s,o);n=n||xn(e),r=r||xn(t);var l=a.split(":"),c=Wg(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var r=Bg(e,t,n);return r.unshift(e),r.push(t),Gg(r)}(c,Wg(r,t,l[1],s),a)}function Fg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=xn(e),r=xn(t)),i=i||[],s=-1!==(o=L({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=_n(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?Vg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:Vg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Hg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Hg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:qg(e,t,n,r,o))))}function Vg(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function Hg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&Ct(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(At(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(s[1],o,n),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Nt(e[r],t,Ig)||Nt(e[r],n,Ig))return e.slice(r);return e}(s,e,t),i!==s&&(s=Hg(e,t,n,i)),s&&At(s)?null:s}function Ug(e){return e&&/t|r|b|l/.test(e)}function Wg(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Gg(e){return e.reduce((function(t,n,r){return Tt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Qg=-10,Yg=40,Xg={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},Zg={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Kg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Jg={top:"t",right:"r",bottom:"b",left:"l"};function ey(e){this._elementRegistry=e}function ty(e,t){return ki(t,"bpmn:Participant")?"source":ki(e,"bpmn:Participant")?"target":oy(t)?"source":oy(e)||ki(t,"bpmn:Event")?"target":ki(e,"bpmn:Event")?"source":null}function ny(e){return oy(e)?"target":"source"}function ry(e,t){return e?e.original||e:xn(t)}function iy(e,t){return ki(t,"bpmn:Activity")&&ki(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function oy(e){return ki(e,"bpmn:SubProcess")&&Hi(e)}function sy(e,t){return e===t}function ay(e){var t=/right|left/.exec(e);return t&&t[0]}function ly(e){var t=/top|bottom/.exec(e);return t&&t[0]}function cy(e,t){return Kg[e]===t}function py(e){return"right"===e||"left"===e}function uy(e,t,n){var r=t.waypoints,i=r&&r.length&&_n(r[0],e);return"top"===i?n.loop.fromTop:"right"===i?n.loop.fromRight:"left"===i?n.loop.fromLeft:n.loop.fromBottom}function dy(e,t,n,r){var i,o,s,a,l=xn(e),c=xn(t),p=(a=(s=e).host,_n(xn(s),a,Qg)),u=sy(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=_n(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,r,i,o){var s,a=t?e:o.isHorizontal?ly(e):ay(e),l=Jg[a];s=t?py(e)?hy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:hy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,r):(i=function(e,t,n,r){if(n)return Jg[e];var i=ly(e),o=ay(e),s=ly(t),a=ay(t);if(r){if(sy(i,s)||cy(o,a))return Jg[i]}else if(sy(o,a)||cy(i,s))return Jg[o];return Jg[r?o:i]}(p,h,d,r.isHorizontal),o=function(e,t,n,r){if(n)return py(e)?function(e,t){var n=ay(e),r=Kg[n];return-1!==t.indexOf(r)}(e,t)||sy(e,t)?"h":"v":function(e,t){var n=ly(e),r=Kg[n];return-1!==t.indexOf(r)}(e,t)||sy(e,t)?"v":"h";return r?sy(ly(e),ly(t))?"h":"v":sy(ay(e),ay(t))?"v":"h"}(p,h,d,r.isHorizontal),[i+":"+o])}function hy(e,t,n,r){var i=Yg;return!(fy(e,r,n,i)||fy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||fy(e,r,xn(t),i))}function fy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function my(e){return L({original:e.point.original||e.point},e.actual)}function gy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(ey,Dg),ey.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd,c=this._elementRegistry;if(a||(a=ry(s&&s[0],i)),l||(l=ry(s&&s[s.length-1],o)),(ki(e,"bpmn:Association")||ki(e,"bpmn:DataAssociation"))&&s&&!iy(i,o))return[].concat([a],s.slice(1,-1),[l]);var p=yc(i,c)?Xg:Zg;return ki(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:ty(e,t)}}(i,o,p):(ki(e,"bpmn:SequenceFlow")||iy(i,o))&&(n=i===o?{preferredLayouts:uy(i,e,p)}:ki(i,"bpmn:BoundaryEvent")?{preferredLayouts:dy(i,o,l,p)}:oy(i)||oy(o)?{preferredLayouts:p.subProcess,preserveDocking:ny(i)}:ki(i,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:ki(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(r=Gg(Fg(i,o,a,l,s,n=L(n,t)))),r||[a,l]},ey.$inject=["elementRegistry"],gy.$inject=["elementRegistry","graphicsFactory"],gy.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(my(r)),o.push(my(i)),o},gy.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},gy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},gy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var yy={__init__:["modeling","bpmnUpdater"],__depends__:[wh,ef,nf,sf,zf,cm,hm,ym,Ns,Ho,am],bpmnFactory:["type",vm],bpmnUpdater:["type",bm],elementFactory:["type",xm],modeling:["type",Ag],layouter:["type",ey],connectionDocking:["type",gy]};const vy=Math.round;function by(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}by.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(L({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;L(p,{x:u.x-vy(p.width/2),y:u.y-vy(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=i.getCroppedWaypoints(h,e,p)),r.create({created:[p,h].filter((e=>!l(e)))})},by.prototype.cleanUp=function(){this._complexPreview.cleanUp()},by.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var wy={__depends__:[xc,Xp,yy],__init__:["appendPreview"],appendPreview:["type",by]},xy=Math.min,_y=Math.max;function Ey(e){e.preventDefault()}function ky(e){e.stopPropagation()}function Oy(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[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 Py(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Oy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}Oy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=B(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(i.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"},a);var l=B(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&L(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ky),ce.bind(o,"paste",this.handlePaste),r.autoResize&&ce.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Oy.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Oy.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Oy.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,r=d.textContent.length}else{var h=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Oy.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Oy.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Ey(n),ky(n);var u=xy(_y(c+n.clientX-a,r),o),d=xy(_y(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){Ey(e),ky(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){Ey(e),ky(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}L(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Oy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ky),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},Oy.prototype.getValue=function(){return this.content.innerText.trim()},Oy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Oy.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Py.$inject=["eventBus","canvas"],Py.prototype.registerProvider=function(e){this._providers.push(e)},Py.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Py.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Py.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Py.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Py.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Py.prototype.getValue=function(){return this._textbox.getValue()},Py.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())},Py.prototype._handleResize=function(e){this._fire("resize",e)},Py.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=m(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Sy={__depends__:[Ps],__init__:["directEditing"],directEditing:["type",Py]};var Cy=[{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"}}],Ty=[{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"}}],My=[{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",eventDefinitionAttrs:{name:""}}},{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",eventDefinitionAttrs:{name:""}}},{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"}}],Ay=[{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"}}],Dy=[{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"}}],Ny=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ry=[{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}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],jy=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",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}}],Iy=jy,Ly=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{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:"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:"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}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],$y=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],zy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],By=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{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}}],qy=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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}}],Fy=[{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"}],Vy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}],Hy={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{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:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{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"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{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"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{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"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{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:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{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:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]},Uy={"start-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)">\n <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>\n </g>\n </svg>',"intermediate-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">\n <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>\n <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>\n </g>\n </svg>'};function Wy(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Wy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Wy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Wy.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,r=this._rules,i=[],o=[];if(c(e)||!r.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Pi(s),r=n.eventDefinitions&&n.eventDefinitions[0],i=n.$type===t.type,o=(r&&r.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Hi(s);return!(i&&o&&a&&l)});return ki(n,"bpmn:DataObjectReference")?this._createEntries(e,$y):ki(n,"bpmn:DataStoreReference")&&!ki(e.parent,"bpmn:Collaboration")?this._createEntries(e,zy):(ki(n,"bpmn:Event")&&!ki(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,i=Hy[t]||[],!Gi(n.$parent)&&ki(n.$parent,"bpmn:SubProcess")&&(i=y(i,(function(e){return"bpmn:StartEvent"!==e.target.type})))),ki(n,"bpmn:StartEvent")&&!ki(n.$parent,"bpmn:SubProcess")?(o=y(Cy.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:Participant")?(o=y(Vy,(function(t){return Hi(e)!==t.target.isExpanded})),this._createEntries(e,o)):ki(n,"bpmn:StartEvent")&&Gi(n.$parent)?(o=y(qy.concat(i),(function(e){var t=!1!==e.target.isInterrupting,r=n.isInterrupting===t;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):ki(n,"bpmn:StartEvent")&&!Gi(n.$parent)&&ki(n.$parent,"bpmn:SubProcess")?(o=y(Ty.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:EndEvent")?(o=y(Ay.concat(i),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!ki(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):ki(n,"bpmn:BoundaryEvent")?(o=y(By,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!ki(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,i=n.cancelActivity==r;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):ki(n,"bpmn:IntermediateCatchEvent")||ki(n,"bpmn:IntermediateThrowEvent")?(o=y(My.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:Gateway")?(o=y(Dy,a),this._createEntries(e,o)):ki(n,"bpmn:Transaction")?(o=y(jy,a),this._createEntries(e,o)):Gi(n)&&Hi(e)?(o=y(Iy,a),this._createEntries(e,o)):ki(n,"bpmn:AdHocSubProcess")&&Hi(e)?(o=y(Ry,a),this._createEntries(e,o)):ki(n,"bpmn:SubProcess")&&Hi(e)?(o=y(Ny,a),this._createEntries(e,o)):ki(n,"bpmn:SubProcess")&&!Hi(e)?(o=y(Ly,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):ki(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Fy):ki(n,"bpmn:FlowNode")?(o=y(Ly,a),this._createEntries(e,o)):{})},Wy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return ki(e,"bpmn:Activity")&&!Gi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),ki(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),ki(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Cd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Wy.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Wy.prototype._createSequenceFlowEntries=function(e,t){var n=Pi(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&ki(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:ki(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Wy.prototype._createEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,action:n}},Wy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var i=e.businessObject.get("loopCharacteristics");i&&ki(i,r.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,i,{isSequential:r.options.isSequential}):(i=t._moddle.create(r.options.loopCharacteristics,{isSequential:r.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:i}))}}var i,o,s,a=Pi(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Wy.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}}},Wy.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:r("Participant multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Wy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Pi(e),r=this,i=Td(e),o=ki(e,"bpmn:BoundaryEvent")?Uy["intermediate-event-non-interrupting"]:Uy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Gy={__depends__:[Zl,zf,xc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Wy]};function Qy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(xs(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Yy(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Qy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Qy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Qy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&L(p,f()),p;var u=e.businessObject;function d(e,t){i.start(e,t)}function h(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function m(e,t,n,i){function s(t,n){var s=r.createShape(L({type:e},i));o.start(t,s,{source:n})}var l=a?function(t,n){var o=r.createShape(L({type:e},i));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,i),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Oi(u,["bpmn:Lane","bpmn:Participant"])&&Hi(e)){var y=Ru(e);L(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Ui(e)?e.height>=120:e.width>=120)&&L(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Ui(e)?e.height>=180:e.width>=180)&&L(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),L(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return ki(u,"bpmn:FlowNode")&&(ki(u,"bpmn:EventBasedGateway")?L(p,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Yy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(p,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):ki(u,"bpmn:EndEvent")||u.isForCompensation||Yy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Gi(u)||L(p,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||L(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var r=L(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:l("Change element"),width:300,search:!0})}}}}),ki(u,"bpmn:SequenceFlow")&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Oi(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:TextAnnotation")&&L(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Oi(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:Group")&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&L(p,f()),p};var Xy={__depends__:[wy,Sy,Da,Ns,Bp,vf,Gy],__init__:["contextPadProvider"],contextPadProvider:["type",Qy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Ky(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return c(n)?n:n?e:[]}))}Ky.$inject=["modeling","rules"],Ky.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Ky.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Ky.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},Ky.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Ky.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Ky.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ky.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Jy={__init__:["distributeElements"],distributeElements:["type",Ky]};function ev(e){nc.call(this,e)}ev.$inject=["eventBus"],e(ev,nc),ev.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=ht(t=y(t,(function(e){var t=Oi(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})))).length<3)&&t}))};var tv={horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function nv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}nv.$inject=["popupMenu","distributeElements","translate","rules"],nv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},nv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},nv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:tv.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:tv.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var rv={__depends__:[Zl,Jy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ev],distributeElementsMenuProvider:["type",nv]},iv="is not a registered action";function ov(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function sv(e,t){return new Error(e+" "+t)}ov.$inject=["eventBus","injector"],ov.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=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();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},ov.prototype.trigger=function(e,t){if(!this._actions[e])throw sv(e,iv);return this._actions[e](t)},ov.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},ov.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw sv(e,"is already registered");this._actions[e]=t},ov.prototype.unregister=function(e){if(!this.isRegistered(e))throw sv(e,iv);this._actions[e]=void 0},ov.prototype.getActions=function(){return Object.keys(this._actions)},ov.prototype.isRegistered=function(e){return!!this._actions[e]};var av={__init__:["editorActions"],editorActions:["type",ov]};function lv(e){e.invoke(ov,this)}e(lv,ov),lv.$inject=["injector"],lv.prototype._registerDefaultActions=function(e){ov.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!ki(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=vt(r=ki(i,"bpmn:Collaboration")?n.filter((function(e){return ki(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!ki(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var cv={__depends__:[av],editorActions:["type",lv]};function pv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Oi(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}pv.$inject=["eventBus"];var uv=10;function dv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function hv(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!i.active||n&&zs(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(fv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(fv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(fv(t)?gv(a)?s.x.max=l.left:s.x.min=l.right:mv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(fv(t)?gv(a)?s.x.min=c.left:s.x.max=c.right:mv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&L(r,s),Cp(t,n)||i.snapEvent(t,n,r)}))}}))}function fv(e){return"x"===e}function mv(e){return-1!==e.indexOf("n")}function gv(e){return-1!==e.indexOf("w")}function yv(e,t){Uo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;h(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}hv.prototype.snapEvent=function(e,t,n){Tp(e,t,this.snapValue(e[t],n))},hv.prototype.getGridSpacing=function(){return uv},hv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=dv(e+=i,uv),t&&t.min&&u(n=t.min)&&(n=dv(n+i,uv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=dv(r+i,uv,"floor"),e=Math.min(e,r)),e-=i},hv.prototype.isActive=function(){return this.active},hv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},hv.prototype.toggleActive=function(){this.setActive(!this.active)},hv.$inject=["elementRegistry","eventBus","config.gridSnapping"],yv.$inject=["eventBus","gridSnapping","modeling"],e(yv,Uo),yv.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},yv.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},yv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(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),L(e,o),e},yv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(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),L(e,o),e};function vv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}vv.$inject=["eventBus","gridSnapping"];var bv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",yv],gridSnappingSpaceToolBehavior:["type",vv]}],__init__:["gridSnapping"],gridSnapping:["type",hv]};function wv(e,t,n){e.on("autoPlace",2e3,(function(e){var r=e.source,i=xn(r),o=e.shape,s=vc(r,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==i[e]&&(s[e]>i[e]?n.min=s[e]:n.max=s[e],ki(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}wv.$inject=["eventBus","gridSnapping","elementRegistry"];function xv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();ki(i,"bpmn:Participant")&&ki(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}xv.$inject=["canvas","eventBus","gridSnapping"];function _v(e,t,n){Uo.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function Ev(e,t,n){var r=At(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=L({},t,i),n=L({},n,i)),[t,n]}_v.$inject=["eventBus","gridSnapping","modeling"],e(_v,Uo),_v.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Ev(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var kv={__depends__:[bv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",wv],gridSnappingParticipantBehavior:["type",xv],gridSnappingLayoutConnectionBehavior:["type",_v]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",pv]};function Ov(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return ki(t,"bpmn:Lane")?n._createParticipantHit(t,r):ki(t,"bpmn:Participant")?Hi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):ki(t,"bpmn:SubProcess")?Hi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}Ov.$inject=["eventBus","interactionEvents"],Ov.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ov.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Ui(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ov.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var Pv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ov]};function Sv(e){e.invoke(Qs,this)}e(Sv,Qs),Sv.$inject=["injector"],Sv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Qs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var Cv={__depends__:[Ys],__init__:["keyboardBindings"],keyboardBindings:["type",Sv]},Tv={moveSpeed:1,moveSpeedAccelerated:10},Mv="left",Av="right",Dv="down",Nv={ArrowLeft:Mv,Left:Mv,ArrowUp:"up",Up:"up",ArrowRight:Av,Right:Av,ArrowDown:Dv,Down:Dv},Rv={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function jv(e,t,n,r,i){var o=this;this._config=L({},Tv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Nv[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Rv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}jv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Iv={__depends__:[Ys,Ns],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",jv]};function Lv(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return bn({top:Pu("top",n,t),right:Pu("right",n,t),bottom:Pu("bottom",n,t),left:Pu("left",n,t)})}(n,s),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:vn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=gn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function $v(e,t){var n=xn(e),r=vn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function zv(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Lv.prototype.canResize=function(e){var t=this._rules,n=B(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Lv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=L({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,$v(t,i),"resize",{autoActivate:!0,cursor:zv(i),data:{shape:t,context:r}})},Lv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=vn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},s=r?vn(r):o;return bn({top:Eu(o.top,s.top),left:Eu(o.left,s.left),bottom:_u(o.bottom,s.bottom),right:_u(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Tu(t,e.childrenBoxPadding))},Lv.$inject=["eventBus","rules","modeling","dragging"];var Bv="djs-resizing",qv="resize-not-ok";function Fv(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,Bv)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),r.canExecute?Se(s).remove(qv):Se(s).add(qv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ue(n.frame),t.removeMarker(r,Bv)}))}Fv.$inject=["eventBus","canvas","previewSupport"];var Vv=-6,Hv="djs-resizer",Uv=["n","w","s","e","nw","ne","se","sw"];function Wv(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&v(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Wv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){ws(t)&&r.activate(t,e,n)}ce.bind(t,"mousedown",i),ce.bind(t,"touchstart",i)},Wv.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=Vv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Vv);return t}(r),s=Re("g");Se(s).add(Hv),Se(s).add(Hv+"-"+e.id),Se(s).add(Hv+"-"+r),xe(i,s);var a=Re("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Hv+"-visual"),xe(s,a);var l=Re("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Hv+"-hit"),xe(s,l),Zn(s,t,n),s},Wv.prototype.createResizer=function(e,t){var n=$v(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Wv.prototype.addResizer=function(e){var t=this;!fn(e)&&this._resize.canResize({shape:e})&&v(Uv,(function(n){t.createResizer(e,n)}))},Wv.prototype.removeResizers=function(){Te(this._getResizersParent())},Wv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Wv.$inject=["eventBus","canvas","selection","resize"];var Gv={__depends__:[$c,Nc,Gp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Lv],resizePreview:["type",Fv],resizeHandles:["type",Wv]};function Qv(e,t,n,r,i,o,s){function a(e,t){(t||Oi(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Yv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Yv(e){return ki(e,"bpmn:SubProcess")&&!Hi(e)}Qv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Qv.prototype.activate=function(e){var t=no(e);if(void 0!==t){var n={text:t};L(n,this.getEditingBBox(e));var r={},i=n.style||{};return L(i,{backgroundColor:null,border:null}),(Oi(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Yv(e))&&L(r,{centerVertically:!0}),Zi(e)&&(L(r,{autoResize:!0}),L(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),ki(e,"bpmn:TextAnnotation")&&(L(r,{resizable:!0,autoResize:!0}),L(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),L(n,{options:r,style:i}),n}},Qv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(ki(e,"bpmn:Lane")||function(e){return ki(e,"bpmn:Participant")&&Hi(e)}(e)){var m=Ui(e);L(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return ki(e,"bpmn:Participant")&&!Hi(e)}(e)){var g=Ui(e);L(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Oi(e,["bpmn:Task","bpmn:CallActivity"])||Yv(e))&&(L(s,{width:r.width,height:r.height}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return ki(e,"bpmn:SubProcess")&&Hi(e)}(e)&&(L(s,{width:r.width,x:r.x}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(L(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Zi(n)&&!Ki(n)&&!mn(n)){var w=eo(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;L(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return ki(e,"bpmn:TextAnnotation")&&(L(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),L(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Qv.prototype.update=function(e,t,n,r){var i,o,s;ki(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var Xv="djs-element-hidden",Zv="djs-label-hidden";function Kv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(ki(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Re("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Re("path");Oe(p,{d:c,strokeWidth:2,stroke:Jv(r)}),xe(o,p),xe(a,o),Kn(o,r.x,r.y)}ki(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Xv):(ki(r,"bpmn:Task")||ki(r,"bpmn:CallActivity")||ki(r,"bpmn:SubProcess")||ki(r,"bpmn:Participant")||ki(r,"bpmn:Lane"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(ki(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Xv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ue(o),o=void 0)}))}function Jv(e,t){return Si(e).get("stroke")||t||"black"}Kv.$inject=["eventBus","canvas","pathMap"];var eb={__depends__:[Ho,Gv,Sy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Qv],labelEditingPreview:["type",Kv]},tb=new Io("tt");function nb(e,t){e.style.display=!1===t?"none":""}var rb="djs-tooltip",ib="."+rb;function ob(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=tb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Y(r=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;de.bind(this._tooltipRoot,ib,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,ib,"mouseover",(function(e){i.trigger("mouseover",e)})),de.bind(this._tooltipRoot,ib,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}ob.$inject=["eventBus","canvas"],ob.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=L({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ob.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(X(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},ob.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},ob.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ob.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},ob.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ob.prototype.show=function(){nb(this._tooltipRoot)},ob.prototype.hide=function(){nb(this._tooltipRoot,!1)},ob.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},ob.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),h(r)&&(r=ge(r)),Y(t=ge('<div data-tooltip-id="'+n+'" class="'+rb+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},ob.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Y(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},ob.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),nb(r,i))}))},ob.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",(function(t){e.hide()})),this._eventBus.on("canvas.viewbox.changed",(function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}))};var sb={__init__:["tooltips"],tooltips:["type",ob]};function ab(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var r,i,o=e.context,s=o.shape;ki(o.target,"bpmn:Collaboration")&&ki(s,"bpmn:FlowNode")&&(r=e,i=n("flow elements must be children of pools/participants"),t.add({position:{x:r.x+5,y:r.y+5},type:"error",timeout:2e3,html:"<div>"+i+"</div>"}))}))}ab.$inject=["eventBus","tooltips","translate"];var lb={__depends__:[sb],__init__:["modelingFeedback"],modelingFeedback:["type",ab]};function cb(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Re("rect");return Oe(t,L({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=i()),r.updateConnectionOutline(o,t)}))}cb.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},cb.prototype.updateConnectionOutline=function(e,t){var n=vt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},cb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},cb.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cb.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},cb.$inject=["eventBus","styles","elementRegistry"];function pb(e,t,n){this._canvas=t;var r=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)}))}pb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),i=Re("rect");Oe(i,L({rx:3},r)),Se(i).add("djs-selection-outline"),xe(t,i)}},pb.$inject=["eventBus","canvas","selection"];var ub={__depends__:[Ns],__init__:["outline","multiSelectionOutline"],outline:["type",cb],multiSelectionOutline:["type",pb]},db=Math.round;function hb(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+db(e.width/2),y:e.y+db(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),L(t,{shapes:i,validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,s=t.shapes;if(!1===i)return!1;r.x=db(r.x),r.y=db(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(ws(e)){var t=ms(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}hb.$inject=["eventBus","dragging","modeling","selection","rules"];var fb="djs-dragging",mb="drop-ok",gb="drop-not-ok",yb="new-parent",vb="attach-ok";function bb(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!fn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=yt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),r=t.concat(n);return[...new Set(r)]}function a(e,n){[vb,mb,gb,yb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var d=Re("g");Oe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,fb)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),k(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?a(r,vb):t.canExecute&&i&&r.id!==i.id?a(r,yb):a(r,t.canExecute?mb:gb)),Kn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,fb)})),i&&Ue(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,fb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}bb.$inject=["eventBus","canvas","styles","previewSupport"];var wb={__depends__:[Ps,Ns,ub,$c,Nc,Gp],__init__:["move","movePreview"],move:["type",hb],movePreview:["type",bb]},xb=".djs-palette-toggle",_b=".entry",Eb=xb+", "+_b,kb="djs-palette-",Ob="open",Pb="two-column";function Sb(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",(function(e){var t=e.tool;n.updateToolHighlight(t)})),e.on("i18n.changed",(function(){n._update()})),e.on("diagram.init",(function(){n._diagramInitialized=!0,n._rebuild()}))}function Cb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Sb.$inject=["eventBus","canvas"],Sb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Sb.prototype.getEntries=function(){return this._getProviders().reduce(Cb,{})},Sb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Sb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ge(Sb.HTML_MARKUP);n.appendChild(r),K(n).add(kb+"shown"),de.bind(r,Eb,"click",(function(t){if(ye(t.delegateTarget,xb))return e.toggle();e.trigger("click",t)})),ce.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,_b,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Sb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Sb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Pb,t),s.toggle(kb+Pb,t),"open"in e&&(o.toggle(Ob,e.open),s.toggle(kb+Ob,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Sb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+Yo(r)+"]",e);i||(X(i=ge('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(i.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Sb.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=X(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Sb.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(d(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},Sb.prototype._layoutChanged=function(){this._toggleState({})},Sb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Sb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Sb.prototype.open=function(){this._toggleState({open:!0})},Sb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Sb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Sb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Sb.prototype.isOpen=function(){return K(this._container).has(Ob)},Sb.prototype._getParentContainer=function(){return this._canvas.getContainer()},Sb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Tb={__init__:["palette"],palette:["type",Sb]},Mb="crosshair";function Ab(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Re("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ue(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=Db(e),i=r.filter((function(e){return e})),o=_s(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Db(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Db(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(_s(e))return a.activateLasso(e.originalEvent),!0}))}function Db(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Ab.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Ab.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Mb,data:{context:{}}})},Ab.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Mb,data:{context:{}},keepSelection:!0})},Ab.prototype.select=function(e,t,n=[]){var r=bt(e,t);this._selection.select([...n,...O(r)])},Ab.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ab.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Nb={__depends__:[qf,wf],__init__:["lassoTool"],lassoTool:["type",Ab]},Rb=1500,jb="grab";function Ib(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Rb,(function(e){if(xs(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Rb,(function(e){if(Lb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Rb,(function(e){Lb(e.keyEvent)&&s.isActive()&&s.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",(function(){s.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context.reactivate;return!xs(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Lb(e){return Bs("Space",e)}Ib.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ib.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:jb,data:{context:n||{}}})},Ib.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:jb,data:{context:{reactivate:n}}})},Ib.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ib.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var $b={__depends__:[qf,wf],__init__:["handTool"],handTool:["type",Ib]},zb="connect-ok",Bb="connect-not-ok";function qb(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?zb:Bb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?zb:Bb)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}qb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],qb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},qb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},qb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},qb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Fb={__depends__:[Bp,$c,Nc,qf,wf],globalConnect:["type",qb]};function Vb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Vb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Vb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(L({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return L(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var Hb={__depends__:[Tb,vf,am,Nb,$b,Fb,Mo],__init__:["paletteProvider"],paletteProvider:["type",Vb]};function Ub(e,t,n,r,i){Uo.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);L(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+Yo(l.id)+'"]',e.dragGroup);p&&Oe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+Yo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Ub.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ub,Uo);var Wb={__depends__:[Gp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ub]},Gb=40,Qb=20,Yb=10,Xb=20,Zb=["x","y"],Kb=Math.abs;function Jb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Zb.forEach((function(r){var i=nw(r,t);e[r]<t[r]+n?Tp(e,r,t[r]+n):e[r]>t[r]+i-n&&Tp(e,r,t[r]+i-n)}))}(e,i,function(e){return ki(e,"bpmn:Task")?Yb:Qb}(i)),i&&function(e,t){return _(t,(function(t){return tw(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Sp(r),Oi(i,["bpmn:Event","bpmn:Gateway"])&&ew(e,Sp(i)),Oi(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Sp(t);Zb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+Xb&&e[n]<t[n]+nw(n,t)-Xb})(e,t,r)&&Tp(e,r,n[r])}))}(e,i),ki(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=Sp(n),o=_n(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Kb(r-i[t])<Gb&&(n=r>i[t]?i[t]+Gb:i[t]-Gb,Tp(e,t,n))}))}(e)):tw(n,"bpmn:MessageFlow")?(ki(r,"bpmn:Event")&&(t.connectionStart=Sp(r)),ki(i,"bpmn:Event")&&ew(e,Sp(i))):t.connectionStart=t.initialConnectionStart)}))}function ew(e,t){Tp(e,"x",t.x),Tp(e,"y",t.y)}function tw(e,t){return e&&e.type===t}function nw(e,t){return"x"===e?t.width:t.height}function rw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function iw(){this._snapValues={}}Jb.$inject=["eventBus"],rw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},rw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},rw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},rw.prototype.getSnapLocations=function(){return this._snapLocations},rw.prototype.setSnapLocations=function(e){this._snapLocations=e},rw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new iw).initDefaults(this._defaultSnaps),n},iw.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)},iw.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],Ep(i-e)<=n)return i}(e[n],i[n],r)},iw.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var ow=1250;function sw(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],ow,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!Cp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}sw.$inject=["elementRegistry","eventBus","snapping"],sw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new rw);var s=(t=n.get(i.id)?Sp(i,e):{x:e.x+Sp(i).x,y:e.y+Sp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),mn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},sw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(mn(n))mn(t)&&e.add("mid",Sp(n));else if(fn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Sp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Sp(t)),e):e},sw.prototype.getSnapTargets=function(e,t){return Mp(t).filter((function(e){return!e.hidden}))};function aw(e,t){t.invoke(sw,this),e.on(["create.move","create.end"],1500,lw),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!Cp(e)&&function(e,t){var n,r=vn(t),i=xh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(i)?Tp(e,"y",r.top-n.y):/bottom/.test(i)&&Tp(e,"y",r.bottom-n.y);/left/.test(i)?Tp(e,"x",r.left-n.x):/right/.test(i)&&Tp(e,"x",r.right-n.x)}(e,r)}))}function lw(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Tp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Tp(e,"y",e.y)}}function cw(e,t){return-1!==e.indexOf(t)}function pw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(aw,sw),aw.$inject=["eventBus","injector"],aw.prototype.initSnap=function(e){var t=sw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",pw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",pw(i,r,e))})),ki(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},aw.prototype.addSnapTargetPoints=function(e,t,n){sw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(ki(e,"bpmn:SubProcess")&&Hi(e))return!0;return ki(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return ki(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",Op(n)),e.add("bottom-right",Pp(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){cw(r,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){cw(r,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),ki(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},aw.prototype.getSnapTargets=function(e,t){return sw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!ki(e,"bpmn:Lane")}))};function uw(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||Cp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Tp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Tp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function dw(e,t){var n=xn(e),r=vn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}uw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new rw);var o=dw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},uw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",Pp(t)),e.add("corner",Op(t))})),e.add("corner",dw(t,r)),e},uw.$inject=["eventBus","snapping"],uw.prototype.getSnapTargets=function(e,t){return Mp(t).filter((function(t){return!(n=t,r=e,n.host===r||fn(t)||function(e){return!!e.hidden}(t)||mn(t));var n,r}))};function hw(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}hw.$inject=["canvas"],hw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Cp(e,"x"),y:Cp(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),v(["x","y"],(function(t){var n=i[t];p(n)&&Tp(e,t,n.originValue)}))},hw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Re("path");return Oe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},hw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var fw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",sw],resizeSnapping:["type",uw],snapping:["type",hw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Jb],createMoveSnapping:["type",aw]};function mw(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ve(mw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(mw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function gw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){var n=Zo(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?'<b class="'+mw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),i=ge(n);i.innerHTML=r,e.appendChild(i)}mw.$inject=["canvas","eventBus","selection","translate"],mw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,mw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,mw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,mw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,mw.INPUT_SELECTOR,"keydown",(function(e){Bs("ArrowUp",e)&&e.preventDefault(),Bs("ArrowDown",e)&&e.preventDefault()})),t(this._container,mw.INPUT_SELECTOR,"keyup",(function(t){if(Bs("Escape",t))return e.close();if(Bs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return Bs("ArrowUp",t)?e._scrollToDirection(!0):Bs("ArrowDown",t)?e._scrollToDirection():void(Bs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},mw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},mw.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(mw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}else this._selection.select(null)}},mw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},mw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},mw.prototype._clearResults=function(){ee(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},mw.prototype._getCurrentResult=function(){return ve(mw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},mw.prototype._createResultNode=function(e,t){var n=ge(mw.RESULT_HTML);return e.primaryTokens.length>0&&gw(n,e.primaryTokens,mw.RESULT_PRIMARY_HTML),gw(n,e.secondaryTokens,mw.RESULT_SECONDARY_HTML),X(n,mw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},mw.prototype.registerProvider=function(e){this._searchProvider=e},mw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,K(this._canvas.getContainer()).add("djs-search-open"),K(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},mw.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,K(this._canvas.getContainer()).remove("djs-search-open"),K(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},mw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},mw.prototype.isOpen=function(){return this._open},mw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(mw.RESULT_SELECTED_CLASS);var n=X(e,mw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(mw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:300}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},mw.prototype._select=function(e){var t=X(e,mw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},mw.prototype._getBoxHtml=function(){const e=ge(mw.BOX_HTML),t=ve(mw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},mw.CONTAINER_SELECTOR=".djs-search-container",mw.INPUT_SELECTOR=".djs-search-input input",mw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",mw.RESULT_SELECTOR=".djs-search-result",mw.RESULT_SELECTED_CLASS="djs-search-result-selected",mw.RESULT_SELECTED_SELECTOR="."+mw.RESULT_SELECTED_CLASS,mw.RESULT_ID_ATTRIBUTE="data-result-id",mw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",mw.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',mw.RESULT_HTML='<div class="djs-search-result"></div>',mw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',mw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var yw={__depends__:[Mo,Fo,Ns],searchPad:["type",mw]};function vw(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}function bw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}vw.$inject=["elementRegistry","searchPad","canvas","search"],vw.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!mn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:no(e),id:e.id}))),e,{keys:["label","id"]}).map(bw)};var ww={__depends__:[yw,Xl],__init__:["bpmnSearch"],bpmnSearch:["type",vw]};const xw={width:36,height:50},_w={width:50,height:50};function Ew(e,t,n){return Re("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function kw(e,t){this._styles=t,e.registerProvider(this)}function Ow(e,t){var n;return"bpmn:DataObjectReference"===t?n=xw:"bpmn:DataStoreReference"===t&&(n=_w),e.width===n.width&&e.height===n.height}kw.$inject=["outline","styles"],kw.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!mn(e))return ki(e,"bpmn:Gateway")?(L((n=Re("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,L({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Oi(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=Re("rect"),L({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):ki(e,"bpmn:EndEvent")?Oe(n=Re("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):ki(e,"bpmn:Event")?Oe(n=Re("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):ki(e,"bpmn:DataObjectReference")&&Ow(e,"bpmn:DataObjectReference")?n=Ew("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):ki(e,"bpmn:DataStoreReference")&&Ow(e,"bpmn:DataStoreReference")&&(n=Ew("M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",{x:-6,y:-6},t)),n},kw.prototype.updateOutline=function(e,t){if(!mn(e))return Oi(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Oi(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Pw={__depends__:[ub],__init__:["outlineProvider"],outlineProvider:["type",kw]};function Sw(e){Vi.call(this,e)}e(Sw,Vi),Sw.Viewer=Rs,Sw.NavigatedViewer=fa,Sw.prototype.createDiagram=function(){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>')},Sw.prototype._interactionModules=[Ks,aa,ha],Sw.prototype._modelingModules=[ic,xc,Ic,Pc,Rp,Bp,Fp,Xy,Mf,vf,rv,cv,kv,Pv,Cv,Iv,eb,yy,lb,wb,Hb,Wb,Gv,fw,ww,Pw],Sw.prototype._modules=[].concat(Rs.prototype._modules,Sw.prototype._interactionModules,Sw.prototype._modelingModules);var Cw=new Io,Tw={min:.2,max:4};function Mw(e,t,n,r,i){var o=this;function s(e){o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Dw(Aw({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function a(e){return function(t){var n=Bw(t);o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var i=Aw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=r.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(i,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};L(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ce.bind(document,"mousemove",l),ce.bind(document,"mouseup",c)}}function l(e){var t=Bw(e);if(o._state.isDragging){o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,r=o._state.viewportClientRect,i=o._state.parentClientRect;L(o._viewportDom.style,{top:t.y-n.y-i.top+"px",left:t.x-n.x-i.left+"px"});var s=Lw(i,{top:t.y-n.y-i.top,left:t.x-n.x-i.left,width:r.width,height:r.height});L(o._overlay.style,{clipPath:s});var a=Aw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Dw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=Bw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),L(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ce.unbind(document,"mousemove",l),ce.unbind(document,"mouseup",c))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=Cw.next(),this._init(),this.toggle(e&&e.open||!1),ce.bind(this._viewportDom,"mousedown",a(!1)),ce.bind(this._svg,"mousedown",a(!0)),ce.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i=0===e.deltaMode?.02:.32,s=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Iw(e.deltaY)*-i;if(o._state.zoomDelta+=s,Math.abs(o._state.zoomDelta)>.1){var a=s>0?1:-1,l=Math.log(r.zoom())/Math.log(10),c=function(e,t){var n=Math.log(e.min)/Math.log(10),r=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(r))/t}(Tw,20),p=Math.round(l/c)*c;p+=c*a;var u=Math.pow(10,p);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Tw,u),d),o._state.zoomDelta=0;var d=Aw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Dw(d,o._canvas),o._update()}}})),ce.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function Aw(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=L({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);L(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;L(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Nw(e.x,0,r.width,i.x,i.x+i.width),y:Nw(e.y,0,r.height,i.y,i.y+i.height)}}function Dw(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Nw(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Rw(e,t,n){var r=function(e){var t=ve(".children",e);t||xe(e,t=Re("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function jw(e){return 0===e.width&&0===e.height}Mw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Mw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");K(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");K(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");K(r).add("map"),t.appendChild(r);var i=this._svg=Re("svg");Oe(i,{width:"100%",height:"100%"}),xe(r,i),xe(i,this._elementsGroup=Re("g"));var o=this._viewportGroup=Re("g");xe(i,o);var s=this._viewport=Re("rect");Se(s).add("viewport"),xe(o,s),ce.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");K(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");K(l).add("overlay"),this._parent.appendChild(l)},Mw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(zw(e)){var r,i,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(r=t.x-a/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-l/2,s=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,s=t.height),r-=50,i-=50,o+=100,s+=100,this._lastViewbox={x:r,y:i,width:o,height:s},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};L(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Lw(c,u);L(this._overlay.style,{clipPath:d})}},Mw.prototype.open=function(){L(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Mw.prototype.close=function(){L(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Mw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Mw.prototype.isOpen=function(){return this._state.isOpen},Mw.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Mw.prototype._updateElementId=function(e,t){try{var n=ve("#"+Yo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Mw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Mw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,r,i,o=this._createElement(e),s=ve("#"+Yo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Rw(o,s,a):Rw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,s&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Mw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&Ue(t)},Mw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Xn(n))){var r=function(e){return be("[id]",e).forEach((function(e){e.remove()})),e}(Me(t));return Oe(r,{id:this._prefixId(e.id)}),r}},Mw.prototype._clear=function(){Te(this._elementsGroup)},Mw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Iw=Math.sign||function(e){return e>=0?1:-1};function Lw(e,t){return"polygon("+[$w(t.left,t.top),$w(t.left+t.width,t.top),$w(t.left+t.width,t.top+t.height),$w(t.left,t.top+t.height),$w(t.left,e.height),$w(e.width,e.height),$w(e.width,0),$w(0,0),$w(0,e.height),$w(t.left,e.height)].join(", ")+")"}function $w(e,t){return e+"px "+t+"px"}function zw(e){return x(e,(function(e){return p(e)?zw(e):u(e)&&isFinite(e)}))}function Bw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var qw={__init__:["minimap"],minimap:["type",Mw]},Fw=1e5,Vw=1e5;function Hw(e,t){this._canvas=e;var n=this;t.on("diagram.init",(function(){n._init(),n.toggle(!0)})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}Hw.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=Re("defs"),xe(this._canvas._svg,e));var t=this._pattern=Re("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:uv,height:uv,patternUnits:"userSpaceOnUse"});var r=this._circle=Re("circle");Oe(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,r),xe(e,t),Oe(this._gfx=Re("rect"),{x:-Fw/2,y:-Vw/2,width:Fw,height:Vw,fill:`url(#${n})`})},Hw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=xn(e);Oe(this._gfx,{x:-Fw/2+dv(t.x,uv),y:-Vw/2+dv(t.y,uv)})},Hw.prototype.isVisible=function(){return this._visible},Hw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Te(t),this._visible=e}},Hw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},Hw.$inject=["canvas","eventBus"];var Uw={__init__:["grid"],grid:["type",Hw]};function Ww(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Yw("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Yw("path",{class:Qw("border"),d:Gw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Yw("path",{d:Gw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Qw("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=Yw("text",{x:-40,y:-10,fill:o,class:Qw("label")})).textContent="(0, 0)",xe(n,r)}function Gw(e){return e.join(" ")}function Qw(e){return"djs-origin-"+e}function Yw(e,t){var n=Re(e);return Oe(n,t),n}Ww.$inject=["config.origin","canvas"];var Xw={__init__:[Ww]},Zw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Kw(e,t,n,r,i,o){function s(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+r[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<i?0:s})),o}function a(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var c,p,d;e=function(e){var t=L({},Zw,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Kw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Jw={__init__:["alignToOrigin"],alignToOrigin:["type",Kw]};function ex(e){function t(e){if(!e.labelTarget){var t=Pi(e);ki(t,"bpmn:Participant")&&(t=t.processRef),ki(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}ex.$inject=["eventBus"];var tx,nx,rx,ix,ox,sx,ax,lx,cx={__init__:[ex]},px={},ux=[],dx=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hx=Array.isArray;function fx(e,t){for(var n in t)e[n]=t[n];return e}function mx(e){var t=e.parentNode;t&&t.removeChild(e)}function gx(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?tx.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return yx(e,s,r,i,null)}function yx(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++rx:i,__i:-1,__u:0};return null==i&&null!=nx.vnode&&nx.vnode(o),o}function vx(e){return e.children}function bx(e,t){this.props=e,this.context=t}function wx(e,t){if(null==t)return e.__?wx(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?wx(e):null}function xx(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return xx(e)}}function _x(e){(!e.__d&&(e.__d=!0)&&ix.push(e)&&!Ex.__r++||ox!==nx.debounceRendering)&&((ox=nx.debounceRendering)||sx)(Ex)}function Ex(){var e,t,n,r,i,o,s,a,l;for(ix.sort(ax);e=ix.shift();)e.__d&&(t=ix.length,r=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=fx({},i)).__v=i.__v+1,nx.vnode&&nx.vnode(r),Dx(s,r,i,n.__n,void 0!==s.ownerSVGElement,32&i.__u?[o]:null,a,null==o?wx(i):o,!!(32&i.__u),l),r.__.__k[r.__i]=r,Nx(a,r,l),r.__e!=o&&xx(r)),ix.length>t&&ix.sort(ax));Ex.__r=0}function kx(e,t,n,r,i,o,s,a,l,c,p){var u,d,h,f,m,g=r&&r.__k||ux,y=t.length;for(n.__d=l,function(e,t,n){var r,i,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],r=0;r<l;r++)null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?yx(null,i,null,null,i):hx(i)?yx(vx,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?yx(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=Sx(i,n,s=r+u,p),i.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof i.type&&(i.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==r+u&&(i.__u|=65536))):(o=n[r])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=wx(o)),jx(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<c;r++)null!=(o=n[r])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=wx(o)),jx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?px:g[h.__i]||px,h.__i=u,Dx(e,h,d,i,o,s,a,l,c,p),f=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Rx(d.ref,null,h),p.push(h.ref,h.__c||f,h)),null==m&&null!=f&&(m=f),65536&h.__u||d.__k===h.__k?l=Ox(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:f&&(l=f.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=m}function Ox(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=Ox(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Px(e,t){return t=t||[],null==e||"boolean"==typeof e||(hx(e)?e.some((function(e){Px(e,t)})):t.push(e)),t}function Sx(e,t,n,r){var i=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&i==l.key&&o===l.type)return a;a++}}return-1}function Cx(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||dx.test(t)?n:n+"px"}function Tx(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Cx(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Cx(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?Ax:Mx,o)):e.removeEventListener(t,o?Ax:Mx,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Mx(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(nx.event?nx.event(e):e)}function Ax(e){return this.l[e.type+!0](nx.event?nx.event(e):e)}function Dx(e,t,n,r,i,o,s,a,l,c){var p,u,d,h,f,m,g,y,v,b,w,x,_,E,k,O=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=nx.__b)&&p(t);e:if("function"==typeof O)try{if(y=t.props,v=(p=O.contextType)&&r[p.__c],b=p?v?v.props.value:p.__:r,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(y,b):(t.__c=u=new bx(y,b),u.constructor=O,u.render=Ix),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=r,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=fx({},u.__s)),fx(u.__s,O.getDerivedStateFromProps(y,u.__s))),h=u.props,f=u.state,u.__v=t,d)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,f,m)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=nx.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),E=0;E<u._sb.length;E++)u.__h.push(u._sb[E]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(r=fx(fx({},r),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(h,f)),kx(e,hx(k=null!=p&&p.type===vx&&null==p.key?p.props.children:p)?k:[k],t,n,r,i,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),nx.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a,l){var c,p,u,d,h,f,m,g=n.props,y=t.props,v=t.type;if("svg"===v&&(i=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&tx.call(e.childNodes),g=n.props||px,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Tx(e,c,null,h,i));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?f=h:"checked"==c?m=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Tx(e,c,h,g[c],i);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),kx(e,hx(d)?d:[d],t,n,r,i&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&wx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&mx(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===v&&!f||"option"===v&&f!==g[c])&&Tx(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Tx(e,c,m,g[c],!1))}return e}(n.__e,t,n,r,i,o,s,l,c);(p=nx.diffed)&&p(t)}function Nx(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Rx(n[r],n[++r],n[++r]);nx.__c&&nx.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){nx.__e(e,t.__v)}}))}function Rx(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){nx.__e(e,n)}}function jx(e,t,n){var r,i;if(nx.unmount&&nx.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Rx(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){nx.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&jx(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||mx(e.__e),e.__=e.__e=e.__d=void 0}function Ix(e,t,n){return this.constructor(e,n)}function Lx(e,t,n){var r,i,o,s;nx.__&&nx.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Dx(t,e=(!r&&n||t).__k=gx(vx,null,[e]),i||px,px,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?tx.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Nx(o,e,s)}function $x(e,t){var n={__c:t="__cC"+lx++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,_x(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}tx=ux.slice,nx={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},rx=0,bx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=fx({},this.state),"function"==typeof e&&(e=e(fx({},n),this.props)),e&&fx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),_x(this))},bx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_x(this))},bx.prototype.render=vx,ix=[],sx="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ax=function(e,t){return e.__v.__b-t.__v.__b},Ex.__r=0,lx=0;var zx,Bx,qx,Fx,Vx=0,Hx=[],Ux=[],Wx=nx.__b,Gx=nx.__r,Qx=nx.diffed,Yx=nx.__c,Xx=nx.unmount;function Zx(e,t){nx.__h&&nx.__h(Bx,e,Vx||t),Vx=0;var n=Bx.__H||(Bx.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Ux}),n.__[e]}function Kx(e){return Vx=1,Jx(d_,e)}function Jx(e,t,n){var r=Zx(zx++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):d_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Bx,!Bx.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};Bx.u=!0;var o=Bx.shouldComponentUpdate,s=Bx.componentWillUpdate;Bx.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}s&&s.call(this,e,t,n)},Bx.shouldComponentUpdate=i}return r.__N||r.__}function e_(e,t){var n=Zx(zx++,3);!nx.__s&&u_(n.__H,t)&&(n.__=e,n.i=t,Bx.__H.__h.push(n))}function t_(e,t){var n=Zx(zx++,4);!nx.__s&&u_(n.__H,t)&&(n.__=e,n.i=t,Bx.__h.push(n))}function n_(e){return Vx=5,r_((function(){return{current:e}}),[])}function r_(e,t){var n=Zx(zx++,7);return u_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function i_(e,t){return Vx=8,r_((function(){return e}),t)}function o_(e){var t=Bx.context[e.__c],n=Zx(zx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Bx)),t.props.value):e.__}function s_(){for(var e;e=Hx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(c_),e.__H.__h.forEach(p_),e.__H.__h=[]}catch(t){e.__H.__h=[],nx.__e(t,e.__v)}}nx.__b=function(e){Bx=null,Wx&&Wx(e)},nx.__r=function(e){Gx&&Gx(e),zx=0;var t=(Bx=e.__c).__H;t&&(qx===Bx?(t.__h=[],Bx.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Ux,e.__N=e.i=void 0}))):(t.__h.forEach(c_),t.__h.forEach(p_),t.__h=[],zx=0)),qx=Bx},nx.diffed=function(e){Qx&&Qx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Hx.push(t)&&Fx===nx.requestAnimationFrame||((Fx=nx.requestAnimationFrame)||l_)(s_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Ux&&(e.__=e.__V),e.i=void 0,e.__V=Ux}))),qx=Bx=null},nx.__c=function(e,t){t.some((function(e){try{e.__h.forEach(c_),e.__h=e.__h.filter((function(e){return!e.__||p_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],nx.__e(n,e.__v)}})),Yx&&Yx(e,t)},nx.unmount=function(e){Xx&&Xx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{c_(e)}catch(e){t=e}})),n.__H=void 0,t&&nx.__e(t,n.__v))};var a_="function"==typeof requestAnimationFrame;function l_(e){var t,n=function(){clearTimeout(r),a_&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);a_&&(t=requestAnimationFrame(n))}function c_(e){var t=Bx,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Bx=t}function p_(e){var t=Bx;e.__c=e.__(),Bx=t}function u_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function d_(e,t){return"function"==typeof t?t(e):t}function h_(e,t){for(var n in t)e[n]=t[n];return e}function f_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function m_(e){this.props=e}(m_.prototype=new bx).isPureReactComponent=!0,m_.prototype.shouldComponentUpdate=function(e,t){return f_(this.props,e)||f_(this.state,t)};var g_=nx.__b;nx.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),g_&&g_(e)};var y_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function v_(e){function t(t){var n=h_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=y_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var b_=nx.__e;nx.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);b_(e,t,n,r)};var w_=nx.unmount;function x_(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=h_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return x_(e,t,n)}))),e}function __(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return __(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function E_(){this.__u=0,this.t=null,this.__b=null}function k_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function O_(){this.u=null,this.o=null}nx.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),w_&&w_(e)},(E_.prototype=new bx).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=k_(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=__(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},E_.prototype.componentWillUnmount=function(){this.t=[]},E_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=x_(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&gx(vx,null,e.fallback);return i&&(i.__u&=-33),[gx(vx,null,t.__a?null:e.children),i]};var P_=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function S_(e){return this.getChildContext=function(){return e.context},e.children}function C_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Lx(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),Lx(gx(S_,{context:t.context},e.__v),t.l)}function T_(e,t){var n=gx(C_,{__v:e,i:t});return n.containerInfo=t,n}(O_.prototype=new bx).__a=function(e){var t=this,n=k_(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),P_(t,e,r)):i()};n?n(o):o()}},O_.prototype.render=function(e){this.u=null,this.o=new Map;var t=Px(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},O_.prototype.componentDidUpdate=O_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){P_(e,n,t)}))};var M_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,A_=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,D_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,N_=/[A-Z0-9]/g,R_="undefined"!=typeof document,j_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};bx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(bx.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var I_=nx.event;function L_(){}function $_(){return this.cancelBubble}function z_(){return this.defaultPrevented}nx.event=function(e){return I_&&(e=I_(e)),e.persist=L_,e.isPropagationStopped=$_,e.isDefaultPrevented=z_,e.nativeEvent=e};var B_={enumerable:!1,configurable:!0,get:function(){return this.class}},q_=nx.vnode;nx.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={};for(var i in t){var o=t[i];if(!("value"===i&&"defaultValue"in t&&null==o||R_&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===o?o="":"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||j_(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":D_.test(i)?i=s:-1===n.indexOf("-")&&A_.test(i)?i=i.replace(N_,"-$&").toLowerCase():null===o&&(o=void 0):s=i="oninput","oninput"===s&&r[i=s]&&(i="oninputCapture"),r[i]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Px(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=Px(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",B_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=M_,q_&&q_(e)};var F_=nx.__r;nx.__r=function(e){F_&&F_(e),e.__c};var V_=nx.diffed;nx.diffed=function(e){V_&&V_(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),null};var H_=gx,U_=0;function W_(e,t,n,r,i,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--U_,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return nx.vnode&&nx.vnode(c),c}var G_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Q_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y_,X_={exports:{}};
|
|
171
|
+
`,this._current.container)},Ul.prototype.open=function(e,t,n,r){if(!e)throw new Error("target is missing");if(!t)throw new Error("providers for <"+t+"> not found");if(!n)throw new Error("position is missing");this.isOpen()&&this.close();const{entries:i,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:i,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:r},this._emit("open"),this._bindAutoClose(),this._render()},Ul.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:r,emptyPlaceholder:i}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:r,emptyPlaceholder:i},this._emit("refresh"),this._render()},Ul.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const r=this._getEntries(e,n),i=this._getHeaderEntries(e,n);return{entries:r,headerEntries:i,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(r).length||Object.keys(i).length)}},Ul.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Ul.prototype.reset=function(){const e=this._current.container;ol(null,e),we(e)},Ul.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Ul.prototype._onOpened=function(){this._emit("opened")},Ul.prototype._onClosed=function(){this._emit("closed")},Ul.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=ge(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Ul.prototype._bindAutoClose=function(){this._eventBus.once(Hl,this.close,this)},Ul.prototype._unbindAutoClose=function(){this._eventBus.off(Hl,this.close,this)},Ul.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),r=this._config.scale,i=n;return!0!==r&&(!1===r?(e=1,t=1):(e=r.min,t=r.max),a(e)&&n<e&&(i=e),a(t)&&n>t&&(i=t)),i},Ul.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),r=e.getBoundingClientRect(),i={},o=t.x,s=t.y;return t.x+r.width>n.width&&(i.x=!0),t.y+r.height>n.height&&(i.y=!0),i.x&&i.y?(o=t.x-r.width,s=t.y-r.height):i.x?(o=t.x-r.width,s=t.y):i.y&&t.y<r.height?(o=t.x,s=10):i.y&&(o=t.x,s=t.y-r.height),t.y<n.top&&(s=t.y+r.height),{x:o,y:s}},Ul.prototype.isEmpty=function(e,t){if(!e)throw new Error("target is missing");if(!t)throw new Error("provider ID is missing");const n=this._getProviders(t);return!n||!n.length||this._getContext(e,t).empty},Ul.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Ul.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Ul.prototype._getEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuEntries){var r=t.getPopupMenuEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else v(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))})),n},Ul.prototype._getHeaderEntries=function(e,t){var n={};return v(t,(function(t){if(t.getPopupMenuHeaderEntries){var r=t.getPopupMenuHeaderEntries(e);d(r)?n=r(n):v(r,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;v(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=q(e,["id"])}))}})),n},Ul.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>d(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Ul.prototype.isOpen=function(){return!!this._current},Ul.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=X(te(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const r=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(d(r)){if("click"===n)return r(e,t)}else if(r[n])return r[n](e,t)},Ul.prototype._getEntry=function(e){var t=this._current.entries[e]||this._current.headerEntries[e];if(!t)throw new Error("entry not found");return t};var Xl={search:["value",function(e,t,n){const{keys:r}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const i=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:r,tokens:i}=n.reduce(((n,r)=>{const i=e[r],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],r={},i=t.map(Yl),o=[`(?<all>${i.join("\\s+")})`,...i].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[i]=a,o=a.index,s=a.index+i.length,c=0===o,p=s===e.length,u=!!a.groups.all,d=c||/\s/.test(e.charAt(o-1)),h=p||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:i,index:a.index,match:!0,wordStart:d,wordEnd:h,start:c,end:p,all:u});const f=u?t:[i];for(const e of f)r[e.toLowerCase()]=!0;l=a.index+i.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:r}}(i,t);return{tokens:{...n.tokens,[r]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(r).length!==t.length)return null;return i}(e,i,r);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const r of e){const e=Wl(t.tokens[r],n.tokens[r]);if(0!==e)return e;const i=Ql(t.item[r],n.item[r]);if(0!==i)return i}return 0}}(r))}]},Zl={__depends__:[Xl],__init__:["popupMenu"],popupMenu:["type",Ul]},Kl={align:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000">\n <line x1="200" y1="150" x2="200" y2="1850" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="500" y="150" width="1300" height="700" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1150" width="700" height="700" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',bottom:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="1650" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="350" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="850" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',center:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="900" y1="150" x2="900" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="250" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="500" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="100" y1="150" x2="100" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="100" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="100" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="1650" y1="150" x2="1650" y2="1650" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="350" y="150" width="1300" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="850" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',top:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="150" x2="1650" y2="150" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="150" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="150" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',middle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <line x1="150" y1="900" x2="1650" y2="900" style="stroke:currentColor;stroke-width:100;stroke-linecap:round;"/>\n <rect x="150" y="250" width="600" height="1300" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="500" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function Jl(e,t,n,r){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=r}Jl.$inject=["contextPad","popupMenu","translate","canvas"],Jl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},Jl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Jl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Kl.align}</div>`,action:{click:function(t,n){var r=e._getMenuPosition(n);L(r,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",r)}}}}},Jl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var ec=["left","center","right","top","middle","bottom"];function tc(e,t,n,r){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",this)}function nc(e){Uo.call(this,e),this.init()}function rc(e){nc.call(this,e)}tc.$inject=["popupMenu","alignElements","translate","rules"],tc.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},tc.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},tc.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,r=this._popupMenu,i={};return v(ec,(function(o){i["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Kl[o],action:function(){t.trigger(e,o),r.close()}}})),i},nc.$inject=["eventBus"],e(nc,Uo),nc.prototype.addRule=function(e,t,n){var r=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){r.canExecute(e,t,(function(e,t,r){return n(e)}),!0)}))},nc.prototype.init=function(){},rc.$inject=["eventBus"],e(rc,nc),rc.prototype.init=function(){this.addRule("elements.align",(function(e){var t=y(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=ht(t)).length<2)&&t}))};var ic={__depends__:[wa,Da,Zl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Jl],alignElementsMenuProvider:["type",tc],bpmnAlignElements:["type",rc]},oc=10,sc=50,ac=250;function lc(e,t,n,r){for(var i;i=pc(e,n,t);)n=r(t,n,i);return n}function cc(e){return function(t,n,r){var i={x:n.x,y:n.y};return["x","y"].forEach((function(o){var s=e[o];if(s){var a="x"===o?"width":"height",l=s.margin,c=s.minDistance;i[o]=l<0?Math.min(r[o]+l-t[a]/2,n[o]-c+l):Math.max(r[o]+r[a]+l+t[a]/2,n[o]+c+l)}})),i}}function pc(e,t,n){var r={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},i=function(e){var t=uc(e);e.host&&(t=t.concat(uc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(uc(t))}),[])));return t}(e);return m(i,(function(e){return e!==n&&"intersect"===_n(e,r,oc)}))}function uc(e){return(t=e,t.outgoing.map((function(e){return e.target}))).concat(function(e){return e.incoming.map((function(e){return e.source}))}(e));var t}function dc(){return!0}function hc(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var r=n.defaultDistance||sc,i=xn(e),o=vn(e);return{x:o.right+r+t.width/2,y:i.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,r,i){e.fire("autoPlace.start",{source:n,shape:r});var o=e.fire("autoPlace",{source:n,shape:r}),s=t.appendShape(n,r,o,n.parent,i);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function fc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}hc.$inject=["eventBus","modeling","canvas"],fc.$inject=["eventBus","selection"];var mc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",hc],autoPlaceSelectionBehavior:["type",fc]};function gc(e,t){for(h(t)&&(t=[t]);e=e.parent;)if(Oi(e,t))return e;return null}function yc(e,t){var n=gc(e,"bpmn:Process");if(n)return!0;var r,i=["bpmn:Participant","bpmn:Lane"];if(n=gc(e,i))return Ui(n);if(Oi(e,i))return Ui(e);for(r=Pi(e);r&&!ki(r,"bpmn:Process");r=r.$parent);if(!t)return!0;var o=t.find((function(e){var t=Pi(e);return t&&t.get("processRef")===r}));return!o||Ui(o)}function vc(e,t,n){var r=yc(e,n);return ki(t,"bpmn:TextAnnotation")?function(e,t,n){var r=vn(e),i=n?{x:r.right+t.width/2,y:r.top-50-t.height/2}:{x:r.right+50+t.width/2,y:r.bottom+t.height/2};fn(e)&&(i=xn(e),n?(i.x+=100,i.y-=50):(i.x+=100,i.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return lc(e,t,i,cc(s))}(e,t,r):Oi(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var r=vn(e),i=n?{x:r.right-10+t.width/2,y:r.bottom+40+t.width/2}:{x:r.left-40-t.width/2,y:r.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return lc(e,t,i,cc(s))}(e,t,r):ki(t,"bpmn:FlowNode")?function(e,t,n){var r=vn(e),i=xn(e),o=n?{directionHint:"e",minDistance:80,baseOrientation:"left",boundaryOrientation:"top",start:"top",end:"bottom"}:{directionHint:"s",minDistance:90,baseOrientation:"top",boundaryOrientation:"left",start:"left",end:"right"},s=function(e,t){t||(t={});var n=t.defaultDistance||sc,r=t.direction||"e",i=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||ac,a=t.reference||"start";function l(e,t){return"n"===r?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===r?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===r?"start"===a?vn(t).top-vn(e).bottom:"center"===a?xn(t).y-vn(e).bottom:vn(t).bottom-vn(e).bottom:"start"===a?vn(t).left-vn(e).right:"center"===a?xn(t).x-vn(e).right:vn(t).right-vn(e).right}i||(i=dc);var c=e.incoming.filter(i).map((function(t){var n=o(t),r=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:r,weight:n}})),p=e.outgoing.filter(i).map((function(t){var n=o(t),r=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:r,weight:n}})),u=w(c.concat(p).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,r=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*r,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return ki(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;ki(e,"bpmn:BoundaryEvent")&&-1!==(c=_n(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var p=n?{x:r.right+s+t.width/2,y:i.y+bc(c,l,o)}:{x:i.x+bc(c,l,o),y:r.bottom+s+t.height/2},u={margin:a,minDistance:l},d=n?{y:u}:{x:u};return lc(e,t,p,cc(d))}(e,t,r):void 0}function bc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function wc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return vc(e.source,n,t)}))}wc.$inject=["eventBus","elementRegistry"];var xc={__depends__:[mc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",wc]};function _c(e,t,n,i){Uo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=i;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},r=t.shape,i=t.parent||t.newParent;!1!==n.autoResize&&o._expand([r],i)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=r(O(t.closure.topLevel)),i=t.hints,s=!i||i.autoResize;!1!==s&&v(P(n,(function(e){return e.parent.id})),(function(e,t){c(s)&&(e=e.filter((function(e){return m(s,M({id:e.id}))}))),o._expand(e,t)}))})),this.postExecuted(["shape.toggleCollapse"],(function(e){var t=e.context,n=t.hints,r=t.shape;n&&!1===n.autoResize||r.collapsed||o._expand(r.children||[],r)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,r=t.shape,i=r.parent;n&&!1===n.autoResize||i&&o._expand([r],i)}))}function Ec(e){e.invoke(_c,this)}function kc(e){nc.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function Oc(e,t){kc.call(this,e),this._modeling=t}_c.$inject=["eventBus","elementRegistry","modeling","rules"],e(_c,Uo),_c.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),r=this.getPadding(t),i=vn(vt(e)),o=vn(t),s={};return i.top-o.top<r.top&&(s.top=i.top-n.top),i.left-o.left<r.left&&(s.left=i.left-n.left),o.right-i.right<r.right&&(s.right=i.right+n.right),o.bottom-i.bottom<r.bottom&&(s.bottom=i.bottom+n.bottom),bn(L({},o,s))},_c.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var r=function(e,t){var n="";e=vn(e),t=vn(t),e.top>t.top&&(n=n.concat("n"));e.right<t.right&&(n=n.concat("w"));e.bottom<t.bottom&&(n=n.concat("s"));e.left>t.left&&(n=n.concat("e"));return n}(B(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:r});var i=t.parent;i&&this._expand([t],i)}}},_c.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},_c.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},_c.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},Ec.$inject=["injector"],e(Ec,_c),Ec.prototype.resize=function(e,t,n){ki(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},kc.$inject=["eventBus"],e(kc,nc),kc.prototype.canResize=function(e,t){return!1},e(Oc,kc),Oc.$inject=["eventBus","modeling"],Oc.prototype.canResize=function(e,t){if(ki(t.di,"bpmndi:BPMNPlane"))return!1;if(!ki(t,"bpmn:Participant")&&!ki(t,"bpmn:Lane")&&!ki(t,"bpmn:SubProcess"))return!1;var n=!0;return v(e,(function(e){(ki(e,"bpmn:Lane")||mn(e))&&(n=!1)})),n};var Pc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",Ec],bpmnAutoResizeProvider:["type",Oc]};function Sc(e,t,n){var r,i,o=this,s=n.get("dragging",!1);s&&t.on("drag.start",(function(n){t.once("drag.move",1500,(function(t){!function(t){if(!t.hover){var n=t.originalEvent,r=o._findTargetGfx(n),i=r&&e.get(r);r&&i&&(t.stopPropagation(),s.hover({element:i,gfx:r}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){r=e.gfx,i=e.element})),t.on("element.hover",1500,(function(e){i&&t.fire("element.out",{element:i,gfx:r})})),t.on("element.out",(function(){r=null,i=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ys(e),function(e){return te(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}Sc.$inject=["elementRegistry","eventBus","injector"];var Cc={__init__:["hoverFix"],hoverFix:["type",Sc]},Tc=Math.round,Mc="djs-drag-active";function Ac(e){e.preventDefault()}function Dc(e,t,n,r){var i,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),r=t._container.getBoundingClientRect();return{x:n.x+(e.x-r.left)/n.scale,y:n.y+(e.y-r.top)/n.scale}}function a(t,n){n=n||i;var r=e.createEvent(L({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,r)&&e.fire(n.prefix+"."+t,r)}function l(e,r){var o,l=i.payload,c=i.displacement,p=i.globalStart,u=ys(e),d=oa(u,p),h=i.localStart,f=s(u),g=oa(f,h);if(!i.active&&(r||(o=d,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>i.threshold))){if(L(l,{x:Tc(h.x+c.x),y:Tc(h.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();i.active=!0,i.keepSelection||(l.previousSelection=n.get(),n.select(null)),i.cursor&&ea(i.cursor),t.addMarker(t.getRootElement(),Mc)}gs(e),i.active&&(L(l,{x:Tc(f.x+c.x),y:Tc(f.y+c.y),dx:Tc(g.x),dy:Tc(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;i.active&&(e&&(i.payload.originalEvent=e,gs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function p(e){Bs("Escape",e)&&(Ac(e),m())}function u(t){var n;i.active&&(n=ra(e),setTimeout(n,400),Ac(t)),c(t)}function d(e){l(e)}function h(e){var t=i.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=i.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(i){var n=i.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),ta(),g=i.trapClick?u:c,ce.unbind(document,"mousemove",l),ce.unbind(document,"dragstart",Ac),ce.unbind(document,"selectstart",Ac),ce.unbind(document,"mousedown",g,!0),ce.unbind(document,"mouseup",g,!0),ce.unbind(document,"keyup",p),ce.unbind(document,"touchstart",d,!0),ce.unbind(document,"touchcancel",m,!0),ce.unbind(document,"touchmove",l,!0),ce.unbind(document,"touchend",c,!0),e.off("element.hover",h),e.off("element.out",f),t.removeMarker(t.getRootElement(),Mc);var y=i.payload.previousSelection;return!1!==o&&y&&!n.get().length&&function(e){var t=e.filter((function(e){return r.get(e.id)}));t.length&&n.select(t)}(y),s=i,i=null,s}e.on("diagram.destroy",m),this.init=function(t,n,r,g){i&&m(!1),"string"==typeof n&&(g=r,r=n,n=null);var y,v,b,w,x,_=(g=L({},o,g||{})).data||{};w=g.trapClick?u:c,t?(y=ms(t)||t,v=ys(t),gs(t),"dragstart"===y.type&&Ac(y)):(y=null,v={x:0,y:0}),b=s(v),n||(n=b),x=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(y),i=L({prefix:r,data:_,payload:{},globalStart:v,displacement:oa(n,b),localStart:b,isTouch:x},g),g.manual||(x?(ce.bind(document,"touchstart",d,!0),ce.bind(document,"touchcancel",m,!0),ce.bind(document,"touchmove",l,!0),ce.bind(document,"touchend",c,!0)):(ce.bind(document,"mousemove",l),ce.bind(document,"dragstart",Ac),ce.bind(document,"selectstart",Ac),ce.bind(document,"mousedown",w,!0),ce.bind(document,"mouseup",w,!0)),ce.bind(document,"keyup",p),e.on("element.hover",h),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=h,this.out=f,this.end=c,this.cancel=m,this.context=function(){return i},this.setOptions=function(e){L(o,e)}}Dc.$inject=["eventBus","canvas","selection","elementRegistry"];var Nc={__depends__:[Cc,Ns],dragging:["type",Dc]};function Rc(e,t,n){this._canvas=n,this._opts=L({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 jc(e,t,n){return t<e&&e<n}Rc.$inject=["config.autoScroll","eventBus","canvas"],Rc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,r=this,i=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,i.width-e.x,i.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)jc(o[l],n.scrollThresholdOut[l],n.scrollThresholdIn[l])&&(0===l?s=n.scrollStep:1==l?a=n.scrollStep:2==l?s=-n.scrollStep:3==l&&(a=-n.scrollStep));0===s&&0===a||(t.scroll({dx:s,dy:a}),this._scrolling=setTimeout((function(){r.startScroll(e)}),n.scrollRepeatTimeout))},Rc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Rc.prototype.setOptions=function(e){this._opts=L({},this._opts,e)},Rc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ys(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Ic={__depends__:[Nc],__init__:["autoScroll"],autoScroll:["type",Rc]};function Lc(e){this._commandStack=e.get("commandStack",!1)}Lc.$inject=["injector"],Lc.prototype.allowed=function(e,t){var n=!0,r=this._commandStack;return r&&(n=r.canExecute(e,t)),void 0===n||n};var $c={__init__:["rules"],rules:["type",Lc]},zc=Math.round,Bc=Math.max;var qc=10;function Fc(e,t){return function(e,t){var n,r;for(n=0;r=e[n];n++)if(Ct(r,t)<=qc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,r,i=an(function(e,t){return[["M",e.x,e.y],["m",0,-t],["a",t,t,0,1,1,0,2*t],["a",t,t,0,1,1,0,-2*t],["z"]]}(t,qc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=i[0],s=i[i.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[r=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:r}:{point:{x:zc(o.x+s.x)/2,y:zc(o.y+s.y)/2},index:o.segment2}:{point:{x:zc(o.x),y:zc(o.y)},index:o.segment2}:null}(e,t)}function Vc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function Hc(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Uc(e,t){var n=t[0],r=t[1],i={x:r.x-n.x,y:r.y-n.y},o=function(e,t,n){var r=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(r[0].n*t[0]+r[1].n*t[1])/(r[0].lambda*t[0]+r[1].lambda*t[1])}([n.x,n.y],[i.x,i.y],[e.x,e.y]);return{x:n.x+o*i.x,y:n.y+o*i.y}}function Wc(e,t){var n=Uc(e,t);return Vc({x:n.x-e.x,y:n.y-e.y})}function Gc(e,t){return Vc({x:e.x-t.x,y:e.y-t.y})}var Qc="djs-bendpoint",Yc="djs-segment-dragger";function Xc(e,t,n){var r=function(e,t){var n,r=ys(t),i=e._container.getBoundingClientRect();n={x:i.left,y:i.top};var o=e.viewbox();return{x:o.x+(r.x-n.x)/o.scale,y:o.y+(r.y-n.y)/o.scale}}(e,n);return Fc(t,r)}function Zc(e,t){var n=Re("g");Se(n).add(Qc),xe(e,n);var r=Re("circle");Oe(r,{cx:0,cy:0,r:4}),Se(r).add("djs-visual"),xe(n,r);var i=Re("circle");return Oe(i,{cx:0,cy:0,r:10}),Se(i).add("djs-hit"),xe(n,i),t&&Se(n).add(t),n}function Kc(e,t,n,r){var i=Re("g");xe(e,i);var o=function(e,t,n){var r=t.x-e.x,i=t.y-e.y;return ep("h"===n?r:i)}(t,n,r),s=Re("rect");Oe(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(i,s);var a=Re("rect");return Oe(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(i,a),Jn(i,"v"===r?90:0),i}function Jc(e,t,n){var r=Re("g"),i=Rt(t,n),o=At(t,n);return xe(e,r),Kc(r,t,n,o),Se(r).add(Yc),Se(r).add("h"===o?"horizontal":"vertical"),Kn(r,i.x,i.y),r}function ep(e){return Math.abs(Math.round(2*e/3))}function tp(e,t){var n=function(e,t){for(var n,r=t.waypoints,i=1/0,o=0;o<r.length-1;o++){var s=Wc(e,[r[o],r[o+1]]);s<i&&(i=s,n=o)}return[r[n],r[n+1]]}(e,t);return Uc(e,n)}function np(e,t,n,r,i){function o(e,n){var o,s=n.waypoints,a=Xc(t,s,e);if(a)return o=function(e,t){var n,r,i=e.waypoints;return t.index<=0||t.bendpoint?null:(r=At((n={start:i[t.index-1],end:i[t.index]}).start,n.end))?ep("h"===r?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var r,i,o,s,a,l,c=e.index,p=e.point;return!(c<=0||e.bendpoint)&&(o=Rt(r=t[c-1],i=t[c]),s=At(r,i),a=Math.abs(p.x-o.x),l=Math.abs(p.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?r.start(e,n,a.index,!a.bendpoint):i.start(e,n,a.index),!0}function s(e,t,r){ce.bind(e,t,(function(e){n.triggerMouseEvent(t,e,r),e.stopPropagation()}))}function a(e,n){var r=t.getLayer("overlays"),i=ve('.djs-bendpoints[data-element-id="'+Yo(e.id)+'"]',r);return!i&&n&&(Oe(i=Re("g"),{"data-element-id":e.id}),Se(i).add("djs-bendpoints"),xe(r,i),s(i,"mousedown",e),s(i,"click",e),s(i,"dblclick",e)),i}function l(e,t){return ve('.djs-segment-dragger[data-segment-idx="'+e+'"]',t)}function c(e,t){t.waypoints.forEach((function(t,n){var r=Zc(e);xe(e,r),Kn(r,t.x,t.y)})),Zc(e,"floating")}function p(e,t){for(var n,r,i,o=t.waypoints,a=1;a<o.length;a++)At(n=o[a-1],r=o[a])&&(Oe(i=Jc(e,n,r),{"data-segment-idx":a}),s(i,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),p(t,e)),t}function d(e){var t=a(e);t&&(!function(e){v(be("."+Yc,e),(function(e){Ue(e)}))}(t),function(e){v(be("."+Qc,e),(function(e){Ue(e)}))}(t),p(t,e),c(t,e))}function h(e,t,n){var r,i,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,p=Rt(s,a),u=At(s,a);o&&(r=function(e){return ve(".djs-visual",e)}(o),i={x:c.x-p.x,y:c.y-p.y},"v"===u&&(i={x:i.y,y:i.x}),Kn(r,i.x,i.y))}e.on("connection.changed",(function(e){d(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&Ue(t)})),e.on("element.marker.update",(function(e){var t,n=e.element;n.waypoints&&(t=u(n),e.add?Se(t).add(e.marker):Se(t).remove(e.marker))})),e.on("element.mousemove",(function(e){var n,r,i=e.element,o=i.waypoints;if(o){if(n=a(i,!0),!(r=Xc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),r=t.point;n&&Kn(n,r.x,r.y)}(n,r),r.bendpoint||h(n,r,o)}})),e.on("element.mousedown",(function(e){if(ws(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var r=a(t);r&&Oe(r,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=d,this.getBendpointsContainer=a,this.getSegmentDragger=l}np.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var rp=Math.round,ip="reconnectStart",op="reconnectEnd",sp="updateWaypoints";function ap(e,t,n,r,i,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,p=t.target,u=t.waypoints,d=(a=s||0!==o?s||o!==u.length-1?sp:op:ip)===sp?"connection.updateWaypoints":"connection.reconnect",h=i.allowed(d,{connection:t,source:c,target:p});!1===h&&(h=i.allowed(d,{connection:t,source:p,target:c})),!1!==h&&r.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:h,bendpointIndex:o,connection:t,source:c,target:p,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,r=n.connection,o=r.source,s=r.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===sp?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=i.allowed(c,{connection:r,source:l===ip?a:o,target:l===op?a:s}))return n.source=l===ip?a:o,void(n.target=l===op?a:s);!1===t&&(t=n.allowed=i.allowed(c,{connection:r,source:l===op?a:s,target:l===ip?a:o})),t&&(n.source=l===op?a:s,n.target=l===ip?a:o)}})),t.on(["bendpoint.move.out","bendpoint.move.cleanup"],(function(e){var t=e.context,n=t.type;t.hover=null,t.source=null,t.target=null,n!==sp&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,r=t.bendpointIndex,i=t.connection,s=t.insert,a=i.waypoints.slice(),l=t.source,c=t.target,p=t.type,u=t.hints||{},d={x:rp(e.x),y:rp(e.y)};if(!n)return!1;p===sp?(s?a.splice(r,0,d):a[r]=d,u.bendpointMove={insert:s,bendpointIndex:r},a=this.cropWaypoints(i,a),o.updateWaypoints(i,function(e){e=e.slice();for(var t,n,r,i=0;e[i];)t=e[i],n=e[i-1],0===Ct(t,r=e[i+1])||Tt(n,r,t)?e.splice(i,1):i++;return e}(a),u)):(p===ip?(u.docking="source",lp(t)&&(u.docking="target",u.newWaypoints=a.reverse())):p===op&&(u.docking="target",lp(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(i,l,c,d,u))}),this)}function lp(e){var t=e.hover,n=e.source,r=e.target,i=e.type;return i===ip?t&&r&&t===r&&n!==r:i===op?t&&n&&t===n&&n!==r:void 0}ap.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],ap.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var r=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=r,t};var cp="updateWaypoints",pp="connect-ok",up="connect-not-ok",dp="connect-hover",hp="djs-updating",fp="djs-dragging";function mp(e,t,n,r){this._injector=t;var i=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,i=t.connection,o=t.insert,s=i.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),i.waypoints=a,Se(t.draggerGfx=Zc(r.getLayer("overlays"))).add("djs-dragging"),r.addMarker(i,fp),r.addMarker(i,hp)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,i=t.hover,o=t.type;if(i){if(r.addMarker(i,dp),o===cp)return;n?(r.removeMarker(i,up),r.addMarker(i,pp)):!1===n&&(r.removeMarker(i,pp),r.addMarker(i,up))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,i=t.target;n&&(r.removeMarker(n,dp),r.removeMarker(n,i?pp:up))})),n.on("bendpoint.move.move",(function(t){var n=t.context,r=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,p=c.source,u=c.target,d=c.waypoints.slice(),h={x:t.x,y:t.y},f=n.hints||{},m={};i&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?lp(n)?(m.connectionEnd=m.connectionEnd||h,m.source=u,m.target=a||p,d=d.reverse()):(m.connectionStart=m.connectionStart||h,m.source=a||p,m.target=u):"reconnectEnd"===l?lp(n)?(m.connectionStart=m.connectionStart||h,m.source=a||u,m.target=p,d=d.reverse()):(m.connectionEnd=m.connectionEnd||h,m.source=p,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,d[o]=h),l===cp&&(d=e.cropWaypoints(c,d)),m.waypoints=d,i.drawPreview(n,r,m)),Kn(s,t.x,t.y)}),this),n.on(["bendpoint.move.end","bendpoint.move.cancel"],1100,(function(e){var t=e.context,n=t.connection,o=t.draggerGfx,s=t.hover,a=t.target,l=t.waypoints;n.waypoints=l,Ue(o),r.removeMarker(n,hp),r.removeMarker(n,fp),s&&(r.removeMarker(s,pp),r.removeMarker(s,a?pp:up)),i&&i.cleanUp(t)}))}mp.$inject=["bendpointMove","injector","eventBus","canvas"];var gp="connect-hover",yp="djs-updating";function vp(e,t,n){return bp(e,t,e[t]+n)}function bp(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function wp(e){return"x"===e?"y":"x"}function xp(e,t,n){var r,i;return e.original?e.original:(r=xn(t),bp(e,i=wp(n),r[i]))}function _p(e,t,n,r,i,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,r=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=r,n}function l(e){i.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var r=e.newWaypoints,i=function(e,t,n,r){var i=Math.max(t[r],n[r]),o=Math.min(t[r],n[r]);return bp(t,r,Math.min(Math.max(o+20,e[r]),i-20))}(n,r[e.segmentStartIndex+t],r[e.segmentEndIndex+t],wp(e.axis));Kn(e.draggerGfx,i.x,i.y)}this.start=function(e,t,i){var o,s,a,l,c=n.getGraphics(t),p=i-1,u=i,d=t.waypoints,h=d[p],f=d[u],m=Xc(n,d,e);(s=At(h,f))&&(a="v"===s?"x":"y",0===p&&(h=xp(h,t.source,a)),u===d.length-1&&(f=xp(f,t.target,a)),o={connection:t,segmentStartIndex:p,segmentEndIndex:u,segmentStart:h,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(h.x+f.x)/2,y:(h.y+f.y)/2}},r.init(e,l,"connectionSegment.move",{cursor:"x"===a?"resize-ew":"resize-ns",data:{connection:t,connectionGfx:c,context:o}}))},t.on("connectionSegment.move.start",(function(e){var t=e.context,r=e.connection,i=n.getLayer("overlays");t.originalWaypoints=r.waypoints.slice(),t.draggerGfx=Jc(i,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(r,yp)})),t.on("connectionSegment.move.move",(function(e){var t,n,r=e.context,i=r.connection,o=r.segmentStartIndex,s=r.segmentEndIndex,p=r.segmentStart,u=r.segmentEnd,d=r.axis,h=r.originalWaypoints.slice(),f=vp(p,d,e["d"+d]),m=vp(u,d,e["d"+d]),g=h.length,y=0;h[o]=f,h[s]=m,o<2&&(t=_n(i.source,f),1===o?"intersect"===t&&(h.shift(),h[0]=f,y--):"intersect"!==t&&(h.unshift(p),y++)),s>g-3&&(n=_n(i.target,m),s===g-2?"intersect"===n&&(h.pop(),h[h.length-1]=m):"intersect"!==n&&h.push(u)),r.newWaypoints=i.waypoints=a(i,h),c(r,y,e),r.newSegmentStartIndex=o+y,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,gp)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,gp)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,r=t.connection;t.draggerGfx&&Ue(t.draggerGfx),n.removeMarker(r,yp)})),t.on(["connectionSegment.move.cancel","connectionSegment.move.end"],(function(e){var t=e.context;t.connection.waypoints=t.originalWaypoints,l(e)})),t.on("connectionSegment.move.end",(function(e){var t=e.context,n=t.connection,r=t.newWaypoints,i=t.newSegmentStartIndex;r=r.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,r=e.filter((function(r,i){return!Tt(e[i-1],e[i+1],r)||(n=i<=t?n-1:n,!1)}));return{waypoints:r,segmentOffset:n}}(r,i),l=a(n,s.waypoints),c=s.segmentOffset,p={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:i+c}};o.updateWaypoints(n,l,p)}))}_p.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var Ep=Math.abs,kp=Math.round;function Op(e){return{x:e.x,y:e.y}}function Pp(e){return{x:e.x+e.width,y:e.y+e.height}}function Sp(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:kp(e.x+e.width/2),y:kp(e.y+e.height/2)}}function Cp(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Tp(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var r,i=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,r=n-i,e[t]+=r,e["d"+t]+=r),i}function Mp(e){return e.children||[]}var Ap=Math.abs,Dp=Math.round;function Np(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Ap(e[n]-t)<=10)return e[n]}else{var r=t%(e=+e);if(r<10)return t-r;if(r>e-10)return t-r+e}return t}function n(e,t){return e.waypoints?tp(t,e):e.width?{x:Dp(e.width/2+e.x),y:Dp(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var r,i,o=function(e){var t=e.context,r=t.snapPoints,i=t.connection,o=i.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,p=t.axis;if(r)return r;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(i.source,e)),c>o.length-3&&u.unshift(n(i.target,e)),t.snapPoints=r={horizontal:[],vertical:[]},v(u,(function(e){e&&(e=e.original||e,"y"===p&&r.horizontal.push(e.y),"x"===p&&r.vertical.push(e.x))})),r}(e),s=e.x,a=e.y;if(o){var l=s-(r=t(o.vertical,s)),c=a-(i=t(o.horizontal,a));L(e,{dx:e.dx-l,dy:e.dy-c,x:r,y:i}),(l||-1!==o.vertical.indexOf(s))&&Tp(e,"x",r),(c||-1!==o.horizontal.indexOf(a))&&Tp(e,"y",i)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,r=t&&n(t,e);fn(t)&&r&&r.x&&r.y&&(Tp(e,"x",r.x),Tp(e,"y",r.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var r,i,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,r=e.bendpointIndex;if(t)return t;var i=[n[r-1],n[r+1]];return e.snapPoints=t={horizontal:[],vertical:[]},v(i,(function(e){e&&(e=e.original||e,t.horizontal.push(e.y),t.vertical.push(e.x))})),t}(o),a=o.hover,l=a&&n(a,e),c=e.x,p=e.y;if(s){var u=c-(r=t(l?s.vertical.concat([l.x]):s.vertical,c)),d=p-(i=t(l?s.horizontal.concat([l.y]):s.horizontal,p));L(e,{dx:e.dx-u,dy:e.dy-d,x:e.x-u,y:e.y-d}),(u||-1!==s.vertical.indexOf(c))&&Tp(e,"x",r),(d||-1!==s.horizontal.indexOf(p))&&Tp(e,"y",i)}}))}Np.$inject=["eventBus"];var Rp={__depends__:[Nc,$c],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",np],bendpointMove:["type",ap],bendpointMovePreview:["type",mp],connectionSegmentMove:["type",_p],bendpointSnapping:["type",Np]};function jp(e,t,n,r){function i(e,t){return r.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,r=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=i(r,o))){if(!1!==t)return n.source=r,void(n.target=o);l(t=n.canExecute=i(o,r))||!1!==t&&(n.source=o,n.target=r)}})),e.on(["connect.out","connect.cleanup"],(function(e){var t=e.context;t.hover=null,t.source=null,t.target=null,t.canExecute=!1})),e.on("connect.end",(function(e){var t=e.context,r=t.canExecute,i=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!r)return!1;var l=null,c={connectionStart:Ip(t)?o:i,connectionEnd:Ip(t)?i:o};p(r)&&(l=r),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,r,i){p(r)||(i=r,r=xn(n)),t.init(e,"connect",{autoActivate:i,data:{shape:n,context:{start:n,connectionStart:r}}})}}function Ip(e){var t=e.hover,n=e.source,r=e.target;return t&&n&&t===n&&n!==r}jp.$inject=["eventBus","dragging","modeling","rules"];var Lp="connect-ok",$p="connect-not-ok";function zp(e,t,n){var r=e.get("connectionPreview",!1);r&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,i=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,p=t.connectionEnd||{x:e.x,y:e.y},u=c,d=p;Ip(t)&&(u=p,d=c),r.drawPreview(t,n,{source:o||s,target:l||i,connectionStart:u,connectionEnd:d})})),t.on("connect.hover",900,(function(e){var t=e.context,r=e.hover,i=t.canExecute;null!==i&&n.addMarker(r,i?Lp:$p)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Lp),n.removeMarker(t,$p))})),r&&t.on("connect.cleanup",(function(e){r.cleanUp(e.context)}))}zp.$inject=["injector","eventBus","canvas"];var Bp={__depends__:[Ns,$c,Nc],__init__:["connectPreview"],connect:["type",jp],connectPreview:["type",zp]};function qp(e,t,n,r){this._canvas=t,this._graphicsFactory=n,this._elementFactory=r,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}qp.$inject=["injector","canvas","graphicsFactory","elementFactory"],qp.prototype.drawPreview=function(e,t,n){n=n||{};var r,i=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,p=n.connectionEnd,u=n.noLayout,d=n.noCropping,h=n.noNoop,f=this;i||(i=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Te(i),o||(o=e.getConnection=function(e){var t={};return function(n){var r=JSON.stringify(n),i=t[r];return i||(i=t[r]=e.apply(null,arguments)),i}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(r=o(t,s,a)),r?(r.waypoints=l||[],this._layouter&&!u&&(r.waypoints=this._layouter.layoutConnection(r,{source:s,target:a,connectionStart:c,connectionEnd:p,waypoints:n.waypoints||r.waypoints})),r.waypoints&&r.waypoints.length||(r.waypoints=[s?xn(s):c,a?xn(a):p]),this._connectionDocking&&(s||a)&&!d&&(r.waypoints=this._connectionDocking.getCroppedWaypoints(r,s,a)),this._graphicsFactory.drawConnection(i,r,{stroke:"var(--element-dragger-color)"})):!h&&this.drawNoopPreview(i,n)},qp.prototype.drawNoopPreview=function(e,t){var n=t.source,r=t.target,i=t.connectionStart||xn(n),o=t.connectionEnd||xn(r),s=this.cropWaypoints(i,o,n,r);xe(e,this.createNoopConnection(s[0],s[1]))},qp.prototype.cropWaypoints=function(e,t,n,r){var i=this._graphicsFactory,o=n&&i.getShapePath(n),s=r&&i.getShapePath(r),a=i.getConnectionPath({waypoints:[e,t]});return[e=n&&En(o,a,!0)||e,t=r&&En(s,a,!1)||t]},qp.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&Ue(e.connectionPreviewGfx)},qp.prototype.getConnection=function(e){var t=function(e){return p(e)?e:{}}(e);return this._elementFactory.createConnection(t)},qp.prototype.createConnectionPreviewGfx=function(){var e=Re("g");return Oe(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},qp.prototype.createNoopConnection=function(e,t){return ut([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Fp={__init__:["connectionPreview"],connectionPreview:["type",qp]};const Vp=new Io("ps");var Hp=["marker-start","marker-mid","marker-end"],Up=["circle","ellipse","line","path","polygon","polyline","path","rect"];function Wp(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._styles=r}Wp.$inject=["elementRegistry","eventBus","canvas","styles"],Wp.prototype.cleanUp=function(){console.warn("PreviewSupport#cleanUp is deprecated and will be removed in future versions. You do not need to manually clean up previews anymore. cf. https://github.com/bpmn-io/diagram-js/pull/906")},Wp.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},Wp.prototype.addDragger=function(e,t,n,r="djs-dragger"){var i=Me(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Xn(i),r),Oe(i,this._styles.cls(r,[],{x:o.top,y:o.left})),xe(t,i),Oe(i,"data-preview-support-element-id",e.id),i},Wp.prototype.addFrame=function(e,t){var n=Re("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),Oe(n,"data-preview-support-element-id",e.id),n},Wp.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var r=this;e.childNodes&&e.childNodes.forEach((e=>{r._cloneMarkers(e,t,n)})),function(e){return-1!==Up.indexOf(e.nodeName)}(e)&&Hp.forEach((function(i){if(Oe(e,i)){var o=function(e,t,n){var r=(i=Oe(e,t),i.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var i;return ve("marker#"+r,n||document)}(e,i,r._canvas.getContainer());o&&r._cloneMarker(n,e,o,i,t)}}))},Wp.prototype._cloneMarker=function(e,t,n,r,i="djs-dragger"){var o=[n.id,i,Vp.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Me(n);a.id=o,Se(a).add(i);var l=ve(":scope > defs",e);l||xe(e,l=Re("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);Oe(t,r,c)};var Gp={__init__:["previewSupport"],previewSupport:["type",Wp]};const Qp="complex-preview";class Yp{constructor(e,t,n){this._canvas=e,this._graphicsFactory=t,this._previewSupport=n,this._markers=[]}create(e){this.cleanUp();const{created:t=[],moved:n=[],removed:r=[],resized:i=[]}=e,o=this._canvas.getLayer(Qp);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;fn(e)?(t=this._graphicsFactory._createContainer("connection",Re("g")),this._graphicsFactory.drawConnection(Xn(t),e)):(t=this._graphicsFactory._createContainer("shape",Re("g")),this._graphicsFactory.drawShape(Xn(t),e),Kn(t,e.x,e.y)),this._previewSupport.addDragger(e,o,t)})),n.forEach((({element:e,delta:t})=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"]);const n=this._previewSupport.addDragger(e,o);fn(e)?Kn(n,t.x,t.y):Kn(n,e.x+t.x,e.y+t.y)})),r.forEach((e=>{this._previewSupport.addDragger(e,o,void 0,"djs-dragging"),this._canvas.addMarker(e,"djs-element-hidden"),this._markers.push([e,"djs-element-hidden"])})),i.forEach((({shape:e,bounds:t})=>{this._canvas.addMarker(e,"djs-hidden"),this._markers.push([e,"djs-hidden"]),this._previewSupport.addDragger(e,o,void 0,"djs-dragging");const n=this._graphicsFactory._createContainer("shape",Re("g"));this._graphicsFactory.drawShape(Xn(n),e,{width:t.width,height:t.height}),Kn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Te(this._canvas.getLayer(Qp)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Qp)}hide(){this._canvas.hideLayer(Qp)}}Yp.$inject=["canvas","graphicsFactory","previewSupport"];var Xp={__depends__:[Gp],__init__:["complexPreview"],complexPreview:["type",Yp]},Zp=["top","bottom","left","right"],Kp=10;function Jp(e,t){function n(e){if(Ki(e)&&!fn(e)){var n=function(e){var t=xn(e.label),n=xn(e),r=eu(n,t);if(i=r,-1===Zp.indexOf(i))return;var i;var o=function(e){var t=xn(e),n=[].concat(e.incoming.map((function(e){return e.waypoints[e.waypoints.length-2]})),e.outgoing.map((function(e){return e.waypoints[1]}))).map((function(e){return eu(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,r=xn(e),i=_n(r,n);t=i.indexOf("-")>=0?i.split("-"):[i];var o=Zp.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Zp.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(r))return;return a[0]}(e);n&&function(e,n){var r=xn(e),i=e.label,o=xn(i);if(!i.parent)return;var s,a=vn(e);switch(n){case"top":s={x:r.x,y:a.top-Kp-i.height/2};break;case"left":s={x:a.left-Kp-i.width/2,y:r.y};break;case"bottom":s={x:r.x,y:a.bottom+Kp+i.height/2};break;case"right":s={x:a.right+Kp+i.width/2,y:r.y}}var l=oa(s,o);t.moveShape(i,l)}(e,n)}}Uo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,r=t.connection,i=r.source,o=r.target;!1!==(t.hints||{}).createElementsBehavior&&(n(i),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,r=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(r.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,r=t.elements;!1!==(t.hints||{}).createElementsBehavior&&r.forEach((function(e){n(e)}))}))}function eu(e,t){return _n(t,e,5)}function tu(e){Uo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(ki(n,"bpmn:TextAnnotation")?e.position={x:t.x+t.width/2+75,y:t.y-50-n.height/2}:e.position={x:t.x+t.width+80+n.width/2,y:t.y+t.height/2})}),!0)}function nu(e,t){e.invoke(Uo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,r=e.shape;v(y(r.incoming.concat(r.outgoing),(function(e){return ki(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Jp,Uo),Jp.$inject=["eventBus","modeling"],e(tu,Uo),tu.$inject=["eventBus"],e(nu,Uo),nu.$inject=["injector","modeling"];function ru(e,t){t.invoke(Uo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;1===(t=t.filter((function(e){return iu(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(r){var i=t[r];e.elements[r]=n._replaceShape(t[r],i)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;if(1===t.length){var i=t[0];iu(i,r)&&(e.shapes=[n._replaceShape(i,r)])}}),!0)}function iu(e,t){return!mn(e)&&Oi(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function ou(e,t){function n(e){return y(e.attachers,(function(e){return ki(e,"bpmn:BoundaryEvent")}))}Uo.call(this,e),this.postExecute("connection.create",(function(e){var r=e.context.source,i=e.context.target,o=n(i);ki(r,"bpmn:EventBasedGateway")&&ki(i,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var r=e.context.oldSource,i=e.context.newSource;ki(r,"bpmn:Gateway")&&ki(i,"bpmn:EventBasedGateway")&&v(i.outgoing,(function(e){var r=e.target,i=n(r);ki(r,"bpmn:ReceiveTask")&&i.length>0&&t.removeElements(i)}))}))}function su(e,t,n){function r(e){t.updateProperties(e,{isForCompensation:!0})}function i(e){t.updateProperties(e,{isForCompensation:void 0})}Uo.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:r}=e;if(lu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=r.outgoing.find((({target:e})=>au(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!lu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=r.outgoing.find((({target:e})=>cu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>ki(e,"bpmn:SequenceFlow")));t.removeElements(n)}(r)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:r}=e;n&&t.connect(r,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,i=e.source,o=e.target;lu(i)&&cu(o)&&(r(o),function(e,n){const r=e.outgoing.filter((e=>ki(e,"bpmn:Association"))),i=r.filter((e=>au(e.target)&&!n.includes(e)));i.forEach((e=>t.removeConnection(e)))}(i,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;lu(t)&&au(n)&&i(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;au(o)&&i(o),lu(e)&&cu(t)&&r(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:r}=e;au(r)?(function(e){for(const r of e.incoming)n.canConnect(r.source,e)||t.removeConnection(r);for(const r of e.outgoing)n.canConnect(e,r.target)||t.removeConnection(r)}(r),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(r)):cu(r)&&function(e){const n=e.incoming.filter((e=>lu(e.source)));t.removeElements(n)}(r)}),!0)}function au(e){const t=Pi(e);return t&&t.get("isForCompensation")}function lu(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Qi(e,"bpmn:CompensateEventDefinition")}function cu(e){return e&&ki(e,"bpmn:Activity")&&!Gi(e)}function pu(e){e.invoke(Uo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,r=t.shape;ki(n,"bpmn:Lane")&&!ki(r,"bpmn:Lane")&&(t.parent=gc(n,"bpmn:Participant"))}))}function uu(e,t){Uo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(ki(n,"bpmn:DataObjectReference")&&"label"!==n.type){var r=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=r}}))}ru.$inject=["bpmnReplace","injector"],e(ru,Uo),ru.prototype._replaceShape=function(e,t){var n,r=(n=Pi(e).eventDefinitions)&&n[0],i={type:"bpmn:BoundaryEvent",host:t};return r&&(i.eventDefinitionType=r.$type),this._bpmnReplace.replaceElement(e,i,{layoutConnection:!1})},ou.$inject=["eventBus","modeling"],e(ou,Uo),e(su,Uo),su.$inject=["eventBus","modeling","bpmnRules"],pu.$inject=["injector"],e(pu,Uo),uu.$inject=["eventBus","bpmnFactory"],e(uu,Uo);var du=20,hu=20,fu=30,mu=2e3;function gu(e,t,n){function r(){var t=e.getRootElement();return ki(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Uo.call(this,t),t.on(["create.start","shape.move.start"],mu,(function(t){var n=t.context,r=n.shape,i=e.getRootElement();if(ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&i.children.length){var o=i.children.filter((function(e){return!ki(e,"bpmn:Group")&&!mn(e)&&!fn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*du+fu,height:t.height+2*hu};var n=Math.max(e.width,t.width),r=Math.max(e.height,t.height);return{x:-n/2,y:-r/2,width:n,height:r}}(r,s);L(r,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-hu,left:t.right-e.width/2+du,top:t.bottom-e.height/2+hu,right:t.left+e.width/2-du-fu}}(r,s)}}})),t.on("create.start",mu,(function(n){var r=n.context.shape,i=e.getRootElement(),o=e.getGraphics(i);function s(e){e.element=i,e.gfx=o}ki(r,"bpmn:Participant")&&ki(i,"bpmn:Process")&&(t.on("element.hover",mu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",mu,(function(e){var t,n=e.elements,i=e.parent,o=function(e){return m(e,(function(e){return ki(e,"bpmn:Participant")}))}(n);o&&ki(i,"bpmn:Process")&&(e.parent=r(),(t=e.hints=e.hints||{}).participant=o,t.process=i,t.processRef=Pi(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;ki(n,"bpmn:Participant")&&ki(t,"bpmn:Process")&&(e.parent=r(),e.process=t,e.processRef=Pi(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.shape,i=t.participant;!n||i&&r!==i||Pi(r).set("processRef",Pi(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,r=e.processRef||t.processRef,i=e.shape,o=t.participant;!n||o&&i!==o||Pi(i).set("processRef",r)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},r=e.process||e.hints.process,i=e.shape,o=t.participant;if(r){var s=r.children.slice();o?i===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},i)}}),!0)}gu.$inject=["canvas","eventBus","modeling"],e(gu,Uo);var yu="__targetRef_placeholder";function vu(e,t){function n(e,n){var r=e.get("properties"),i=m(r,(function(e){return e.name===yu}));return!i&&n&&Pt(r,i=t.create("bpmn:Property",{name:yu})),i}function r(e,t){var r=n(e);r&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,r,t)||Ot(e.get("properties"),r))}function i(e){var t,i=e.context,o=i.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=i.newTarget,p=c&&c.businessObject,u=i.oldTarget||i.target,d=u&&u.businessObject,h=o.businessObject;d&&d!==l&&r(d,s),p&&p!==l&&r(p,s),l?(t=n(l,!0),h.targetRef=t):h.targetRef=null}Uo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],bu(i)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],bu(i))}function bu(e){return function(t){if(ki(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function wu(e){this._bpmnUpdater=e}function xu(e,t,n,r){function i(e){return e.children.filter((function(e){return ki(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,r){var i=e.businessObject||e;if(r=r||n.filter((function(e){return ki(e,"bpmn:Participant")&&Pi(e).processRef}))[0]){var o=r.businessObject||r;t.execute("dataStore.updateContainment",{dataStoreBo:i,dataStoreDi:Si(e),newSemanticParent:o.processRef||o,newDiParent:Si(r)})}}Uo.call(this,r),t.registerHandler("dataStore.updateContainment",wu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&(t.hints||(t.hints={}),t.hints.autoResize=!1)})),this.preExecute("elements.move",(function(e){var t=e.context,n=t.shapes;n.filter((function(e){return ki(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!ki(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;ki(t,"bpmn:DataStoreReference")&&"label"!==t.type&&ki(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,r=t.oldParent,i=n.parent;if(!ki(r,"bpmn:Collaboration")&&ki(n,"bpmn:DataStoreReference")&&"label"!==n.type&&ki(i,"bpmn:Collaboration")){var s=ki(r,"bpmn:Participant")?r:function(e,t){for(;e.parent;){if(ki(e.parent,t))return e.parent;e=e.parent}}(r,"bpmn:Participant");o(n,s)}})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,r=e.getRootElement();Oi(n,["bpmn:Participant","bpmn:SubProcess"])&&ki(r,"bpmn:Collaboration")&&i(r).filter((function(e){return function(e,t){var n=e.businessObject||e,r=t.businessObject||t;for(;n.$parent;){if(n.$parent===r.processRef||r)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,r=t.newRoot;i(n).forEach((function(e){ki(r,"bpmn:Process")&&o(e,r)}))}))}vu.$inject=["eventBus","bpmnFactory"],e(vu,Uo),wu.$inject=["bpmnUpdater"],wu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.newSemanticParent,i=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},wu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,r=e.oldSemanticParent,i=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,r),this._bpmnUpdater.updateDiParent(n,i),[]},xu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(xu,Uo);var _u=Math.max,Eu=Math.min,ku=20;function Ou(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function Pu(e,t,n){var r=t[e],i=n.min&&n.min[e],o=n.max&&n.max[e];return u(i)&&(r=(/top|left/.test(e)?Eu:_u)(r,i)),u(o)&&(r=(/top|left/.test(e)?_u:Eu)(r,o)),r}function Su(e,t){return void 0!==e?e:ku}function Cu(e){return!e.waypoints&&"label"!==e.type}function Tu(e,t){var n;if((n=void 0===e.length?y(e.children,Cu):e).length)return function(e,t){var n,r,i,o;return"object"==typeof t?(n=Su(t.left),r=Su(t.right),i=Su(t.top),o=Su(t.bottom)):n=r=i=o=Su(t),{x:e.x-n,y:e.y-i,width:e.width+n+r,height:e.height+i+o}}(vt(n),t)}var Mu=Math.abs;var Au=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Du=30;function Nu(e,t){return t=t||[],e.children.filter((function(e){ki(e,"bpmn:Lane")&&(Nu(e,t),t.push(e))})),t}function Ru(e){return e.children.filter((function(e){return ki(e,"bpmn:Lane")}))}function ju(e){return gc(e,Au)||e}function Iu(e,t){var n=ju(e),r=Nu(n,ki(n,"bpmn:Process")?[]:[n]),i=vn(e),o=vn(t),s=function(e,t){return Ou(vn(t),vn(e))}(e,t),a=[],l=Ui(e);return r.forEach((function(t){if(t!==e){var n,r,c=l?0:s.top,p=l?s.right:0,u=l?0:s.bottom,d=l?s.left:0,h=vn(t);s.top&&(Mu(h.bottom-i.top)<10&&(u=o.top-h.bottom),Mu(h.top-i.top)<5&&(c=o.top-h.top)),s.left&&(Mu(h.right-i.left)<10&&(p=o.left-h.right),Mu(h.left-i.left)<5&&(d=o.left-h.left)),s.bottom&&(Mu(h.top-i.bottom)<10&&(c=o.bottom-h.top),Mu(h.bottom-i.bottom)<5&&(u=o.bottom-h.bottom)),s.right&&(Mu(h.left-i.right)<10&&(d=o.right-h.left),Mu(h.right-i.right)<5&&(p=o.right-h.right)),(c||p||u||d)&&a.push({shape:t,newBounds:(n=t,r={top:c,right:p,bottom:u,left:d},{x:n.x+(r.left||0),y:n.y+(r.top||0),width:n.width-(r.left||0)+(r.right||0),height:n.height-(r.top||0)+(r.bottom||0)})})}})),a}function Lu(e,t){Uo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,r=n.hints,i=n.shape,o=n.oldParent;ki(i,"bpmn:Lane")&&(r&&r.nested||function(e,n){var r,i,o,s,a,l=Ui(e),c=Ru(n),p=[],u=[],d=[],h=[];gt(c,(function(t){return l?t.y>e.y?u.push(t):p.push(t):t.x>e.x?h.push(t):d.push(t),t.children})),c.length&&(r=l?u.length&&p.length?e.height/2:e.height:h.length&&d.length?e.width/2:e.width,p.length&&(i=t.calculateAdjustments(p,"y",r,e.y-10),t.makeSpace(i.movingShapes,i.resizingShapes,{x:0,y:r},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-r,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-r},"n")),d.length&&(s=t.calculateAdjustments(d,"x",r,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:r,y:0},"e")),h.length&&(a=t.calculateAdjustments(h,"x",-r,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-r,y:0},"w")))}(i,o))}))}Lu.$inject=["eventBus","spaceTool"],e(Lu,Uo);function $u(e,t){t.invoke(Uo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return zu(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(r){e.elements[r]=n._replaceShape(t[r])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,r=e.newHost;t.forEach((function(e,i){var o,s=e.host;zu(e,(o=s,-1!==t.indexOf(o)?s:r))&&(t[i]=n._replaceShape(e))}))}),!0)}function zu(e,t){return!mn(e)&&ki(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function r(e,r,i){var o,s,a,l,c,p,d,h,f=r.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),v=Fc(f,h=u(i.width)?xn(i):i);if(v){if(o=f.slice(0,v.index),s=f.slice(v.index+(v.bendpoint?1:0)),!o.length||!s.length)return;a=v.bendpoint?f[v.index]:h,1!==o.length&&qu(e,o[o.length-1])||o.push(Fu(a)),1!==s.length&&qu(e,s[0])||s.unshift(Fu(a))}l=r.source,c=r.target,t.canConnect(l,e,r)&&(n.reconnectEnd(r,e,o||h),p=r),t.canConnect(e,c,r)&&(p?d=n.connect(e,c,{type:r.type,waypoints:s}):(n.reconnectStart(r,e,s||h),d=r));var b=[].concat(p&&y(g,(function(e){return e.source===p.source}))||[],d&&y(m,(function(e){return e.target===d.target}))||[]);b.length&&n.removeElements(b)}Uo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,r=e.shapes,i=e.delta,o=r[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+i.x,y:s.y+i.y},l=m(n.children,(function(e){return t.canInsert(r,e)&&Fc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!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 n=e.parent,r=e.shape;t.canInsert(r,n)&&(e.targetFlow=n,e.parent=n.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 qu(e,t){var n=t.x,r=t.y;return n>=e.x&&n<=e.x+e.width&&r>=e.y&&r<=e.y+e.height}function Fu(e){return L({},e)}function Vu(e,t){Uo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,r=n.connection,i=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&Hu(r)){(ki(i,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==r&&Hu(e))):o.incoming.filter((e=>e!==r&&Hu(e)&&ki(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;ki(n,"bpmn:EventBasedGateway")&&n.outgoing.filter(Hu).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter(Hu).forEach((function(r){const i=e.incoming.filter(Hu).filter((function(e){return e.source===n}));(r.source!==n||i.length>1)&&t.removeConnection(r)}))}))}))}function Hu(e){return ki(e,"bpmn:SequenceFlow")}$u.$inject=["bpmnReplace","injector"],e($u,Uo),$u.prototype._replaceShape=function(e){var t,n,r=(n=Pi(e).eventDefinitions)&&n[0];return t=r?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:r.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Uo),Bu.$inject=["eventBus","bpmnRules","modeling"],Vu.$inject=["eventBus","modeling"],e(Vu,Uo);var Uu=1500;function Wu(e,t,n){t.on(["create.hover","create.move","create.out","create.end","shape.move.hover","shape.move.move","shape.move.out","shape.move.end"],Uu,(function(t){var r=t.context.shape||t.shape,i=t.hover;ki(i,"bpmn:Lane")&&!Oi(r,["bpmn:Lane","bpmn:Participant"])&&(t.hover=ju(i),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();i!==o&&(r.labelTarget||Oi(r,["bpmn:Group","bpmn:TextAnnotation"]))&&(t.hover=o,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.hover","connect.out","connect.end","connect.cleanup","global-connect.hover","global-connect.out","global-connect.end","global-connect.cleanup"],Uu,(function(t){var n=t.hover;ki(n,"bpmn:Lane")&&(t.hover=ju(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Uu,(function(t){var n=t.context,r=t.hover,i=n.type;ki(r,"bpmn:Lane")&&/reconnect/.test(i)&&(t.hover=ju(r)||r,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Uu,(function(e){var t=e.context,n=t.start;ki(n,"bpmn:Lane")&&(t.start=ju(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;ki(t,"bpmn:Lane")&&(e.shape=ju(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&ki(t,"bpmn:Lane")&&(e.hover=ju(t))}))}Wu.$inject=["elementRegistry","eventBus","canvas"];function Gu(e,t,n,r,i,o){function s(e,t,r){var i=n.filter((function(e){return ki(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==r}));t&&!function(e,t){return e.some((function(e){var n=Pi(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(i,t)&&function(e){var t=e.$parent;t&&(Ot(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Pi(e).categoryValueRef===t}))}(i,e)&&function(e){var t=e.$parent;t&&(Ot(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Pt(t.get("categoryValue"),e),e.$parent=t,Pt(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,r){var i=Pi(n),o=i.categoryValueRef;o||(o=i.categoryValueRef=r.categoryValue=r.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=r.category=r.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,r=t.categoryValue,i=Pi(e);r?(i.categoryValueRef=null,s(r,n,i)):s(null,i.categoryValueRef.$parent,i)}function p(t,n){var r=e.create(t.$type);return o.copyElement(t,r,null,n)}i.invoke(Uo,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;ki(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=Pi(n);if(ki(n,"bpmn:Group")&&!n.labelTarget){var i=t.categoryValue=r.categoryValueRef;i&&(s(i,t.category=i.$parent,r),r.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=t.category,i=t.categoryValue,o=Pi(n);i&&(o.categoryValueRef=i,a(i,r))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Pi(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;ki(n,"bpmn:Group")&&!n.labelTarget&&Pi(n).categoryValueRef&&c(n,t)})),r.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Group")&&!n.labelTarget){var r=Pi(n);if(r.categoryValueRef){var i=r.categoryValueRef;t.categoryValue=p(i,!0),i.$parent&&(t.category=p(i.$parent,!0))}}})),r.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,r=t.categoryValue,i=t.category;r&&(r=n.categoryValueRef=p(r)),i&&(r.$parent=p(i)),delete t.category,delete t.categoryValue}))}function Qu(e,t,n,r){var i,o,s,a;return 0==(i=(r.y-n.y)*(t.x-e.x)-(r.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((r.x-n.x)*o-(r.y-n.y)*s)/i,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Yu(e){function t(e,t,n){var r,i={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Qu(e,t,n,i),a=Qu(e,t,n,o);r=s&&a?Xu(s,n)>Xu(a,n)?a:s:s||a,e.original=r}e.on("bpmnElement.added",(function(e){var n,r,i=e.element;i.waypoints&&(t((r=(n=i).waypoints)[0],r[1],xn(n.source)),t(r[r.length-1],r[r.length-2],xn(n.target)))}))}function Xu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Zu(e){Uo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,r=Pi(n),i=Si(n);if(Oi(r,t)){var o=i.get("isHorizontal");void 0===o&&(o=!0),i.set("isHorizontal",o)}}))}Gu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Gu,Uo),Yu.$inject=["eventBus"],Zu.$inject=["eventBus"],e(Zu,Uo);var Ku=Math.sqrt,Ju=Math.min,ed=Math.max,td=Math.abs;function nd(e){return Math.pow(e,2)}function rd(e,t){return Ku(nd(e.x-t.x)+nd(e.y-t.y))}function id(e,t,n,r){var i=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=i*i+o*o,c=(i*s+o*a)/l,p=c*c-(s*s+a*a-r*r)/l;if(p<0&&p>-1e-6&&(p=0),p<0)return[];var u=Ku(p),d=-c+u,h=-c-u,f={x:e.x-i*d,y:e.y-o*d};return 0===p?[f]:[f,{x:e.x-i*h,y:e.y-o*h}].filter((function(n){return function(e,t,n){return od(e.x,t.x,n.x)&&od(e.y,t.y,n.y)}(n,e,t)}))}function od(e,t,n){return e>=Ju(t,n)-sd&&e<=ed(t,n)+sd}var sd=.1;function ad(e,t){return td(e.x-t.x)<=sd&&td(e.y-t.y)<=sd}function ld(e,t,n,r){var i=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,r,i,o,s,a,l,c,p,u,d,h,f=0;for(f=0;f<t.length-1;f++){if(ad(n=t[f],r=t[f+1])?a=[n]:(i=rd(e,n),o=rd(e,r),a=id(n,r,e,Ju(i,o))),a.length<1)throw new Error("expected between [1, 2] circle -> line intersections");1===a.length&&(l={type:"bendpoint",position:a[0],segmentIndex:f,bendpointIndex:ad(n,a[0])?f:f+1}),2===a.length&&(d=a[0],h=a[1],l={type:"segment",position:s={x:(d.x+h.x)/2,y:(d.y+h.y)/2},segmentIndex:f,relativeLocation:rd(n,s)/rd(n,r)}),c=rd(l.position,e),(!u||p>c)&&(u=l,p=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,r){var i=n.segmentIndex,o=t.length-e.length;if(r.segmentMove){var s=r.segmentMove.segmentStartIndex,a=r.segmentMove.newSegmentStartIndex;return i===s?a:i>=a?i+o<a?a:i+o:i}if(r.bendpointMove){var l,c=r.bendpointMove.insert,p=r.bendpointMove.bendpointIndex;return 0===o?i:(i>=p&&(l=c?i+1:i-1),i<p&&(l=i,c&&"bendpoint"!==n.type&&p-1===i&&cd(t,p)<n.relativeLocation&&l++),l)}return 0===o?i:r.connectionStart&&0===i?0:r.connectionEnd&&i===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,r);if(c<0||c>t.length-2||null===c)return s;var p,u,d=pd(n,l),h=pd(t,c),f=a.position,m=function(e,t){var n=Gc(e[0],e[1]),r=Gc(e[0],t);return 0===n?0:r/n}(d,f),g=(p=h,u=Hc(d),Hc(p)-u);if("bendpoint"===a.type){var y=t.length-n.length,v=a.bendpointIndex,b=n[v];if(-1!==t.indexOf(b))return s;if(0===y){var w=t[v];return{delta:{x:i=w.x-a.position.x,y:o=w.y-a.position.y},point:{x:e.x+i,y:e.y+o}}}y<0&&0!==v&&v<n.length-1&&(m=cd(n,v))}var x,_,E={x:(h[1].x-h[0].x)*m+h[0].x,y:(h[1].y-h[0].y)*m+h[0].y},k=(x={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*x.x-Math.sin(_)*x.y,y:Math.sin(_)*x.x+Math.cos(_)*x.y}:x);return i=E.x+k.x-e.x,o=E.y+k.y-e.y,{point:yn(E),delta:yn({x:i,y:o})}}function cd(e,t){var n=Gc(e[t-1],e[t]);return n/(n+Gc(e[t],e[t+1]))}function pd(e,t){return[e[t],e[t+1]]}function ud(e,t,n){var r=ia(t),i=ia(n),o=oa(e,r),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return yn({x:i.x+s,y:i.y+a})}function dd(e,t,n){var r=ia(e),i=ia(t),o=ia(n),s=oa(e,r),a=oa(r,i),l=function(e,t,n){var r=vn(t),i=vn(n);if(function(e,t){return function(e,t){return e.right!==t.right&&e.left!==t.left}(e,t)||function(e,t){return e.top!==t.top&&e.bottom!==t.bottom}(e,t)}(r,i))return null;var o,s,a,l=_n(t,e);if("top"===l)o={x:0,y:i.bottom-r.bottom};else if("bottom"===l)o={x:0,y:i.top-r.top};else if("right"===l)o={x:i.left-r.left,y:0};else{if("left"!==l)return null;o={x:i.right-r.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=_n(n,s),a!==l)return null;return o}(r,t,n);if(l)return l;var c=a.x*(n.width/t.width),p=a.y*(n.height/t.height),u=o.x+c,d=o.y+p;return yn({x:u+s.x-e.x,y:d+s.y-e.y})}var hd="name",fd="text";function md(e,t,n,r){function i(e){var n=e.context,i=n.element,o=n.properties;if(hd in o&&t.updateLabel(i,o[hd]),fd in o&&ki(i,"bpmn:TextAnnotation")){var s=r.getTextAnnotationBounds({x:i.x,y:i.y,width:i.width,height:i.height},o[fd]||"");t.updateLabel(i,o.text,s)}}function o(e){var t=e.context,n=t.connection,r=n.label,i=L({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ld(xn(e),t,n,r).delta}(r,o,s,i)}Uo.call(this,e),this.postExecute("element.updateProperties",i),this.postExecute("element.updateModdleProperties",(e=>{Pi(e.context.element)===e.context.moddleElement&&i(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var r=n.shape||n.connection;!mn(r)&&Zi(r)&&no(r)&&t.updateLabel(r,no(r))}})),this.postExecute("shape.delete",(function(e){var n=e.context,r=n.labelTarget,i=n.hints||{};r&&!1!==i.unsetLabel&&t.updateLabel(r,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var r,i=n.connection.label;i&&i.parent&&(r=o(e),t.moveShape(i,r))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,r=t.oldShape,i=Pi(n);i&&Zi(i)&&r.label&&n.label&&(n.label.x=r.label.x,n.label.y=r.label.y)})),this.postExecute("shape.resize",(function(e){var n,r=e.context,i=r.shape,o=r.newBounds,s=r.oldBounds;if(Ki(i)){var a=i.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:Wc(e,t)}}));return T(n,"distance")[0].line}(e,t);return Uc(e,n)}(xn(a),[[{x:(n=s).x,y:n.y},{x:n.x+(n.width||0),y:n.y}],[{x:n.x+(n.width||0),y:n.y},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y+(n.height||0)},{x:n.x+(n.width||0),y:n.y+(n.height||0)}],[{x:n.x,y:n.y},{x:n.x,y:n.y+(n.height||0)}]]),c=gd(l,s,o);t.moveShape(a,c)}}))}function gd(e,t,n){return yn(oa(ud(e,t,n),e))}function yd(e,t){function n(e,t){var n=e.context,r=n.connection,i=L({},n.hints),o=n.newWaypoints||r.waypoints,s=n.oldWaypoints;return void 0===i.startChanged&&(i.startChanged=!!i.connectionStart),void 0===i.endChanged&&(i.endChanged=!!i.connectionEnd),function(e,t,n,r){return ld(e,t,n,r).point}(t,o,s,i)}Uo.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var r=e.context.connection,i=r.outgoing;r.incoming.forEach((function(r){var i=r.waypoints[r.waypoints.length-1],o=n(e,i),s=[].concat(r.waypoints.slice(0,-1),[o]);t.updateWaypoints(r,s)})),i.forEach((function(r){var i=r.waypoints[0],o=n(e,i),s=[].concat([o],r.waypoints.slice(1));t.updateWaypoints(r,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,r=n.connection,i=r.outgoing,o=r.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],r={x:n.x+s.x,y:n.y+s.y},i=[].concat(e.waypoints.slice(0,-1),[r]);t.updateWaypoints(e,i)})),i.forEach((function(e){var n=e.waypoints[0],r={x:n.x+s.x,y:n.y+s.y},i=[].concat([r],e.waypoints.slice(1));t.updateWaypoints(e,i)}))}))}function vd(e,t,n){var r=Ed(e),i=kd(r,t),o=r[0];return i.length?i[i.length-1]:ud(o.original||o,n,t)}function bd(e,t,n){var r=Ed(e),i=kd(r,t),o=r[r.length-1];return i.length?i[0]:ud(o.original||o,n,t)}function wd(e,t,n){var r=Ed(e),i=_d(t,n),o=r[0];return ud(o.original||o,i,t)}function xd(e,t,n){var r=Ed(e),i=_d(t,n),o=r[r.length-1];return ud(o.original||o,i,t)}function _d(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function Ed(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function kd(e,t){return y(E(e,Od),(function(e){return function(e,t){return"intersect"===_n(t,e,1)}(e,t)}))}function Od(e){return e.original||e}function Pd(e,t){Uo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,r=e.newShape;if(function(e,t){return ki(e,"bpmn:Participant")&&Hi(e)&&ki(t,"bpmn:Participant")&&!Hi(t)}(n,r)){var i,o,s,a,l=(o=yt([i=n],!1),s=[],a=[],o.forEach((function(e){e!==i&&(e.incoming.forEach((function(e){ki(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){ki(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var i=bd(e,r,n);t.reconnectEnd(e,r,i)})),l.outgoing.forEach((function(e){var i=vd(e,r,n);t.reconnectStart(e,r,i)}))}}),!0)}e(md,Uo),md.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(yd,Uo),yd.$inject=["eventBus","modeling"],Pd.$inject=["eventBus","modeling"],e(Pd,Uo);const Sd=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function Cd(e){const t=Pi(e);if(!(ki(t,"bpmn:BoundaryEvent")||ki(t,"bpmn:StartEvent")&&Gi(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&Sd.some((e=>ki(n[0],e)))}function Td(e){return ki(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function Md(e,t){e.invoke(Uo,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,r=e.context.newShape,i=e.context.hints;if(!Cd(r))return;const o=Td(r);if(i.targetElement&&void 0!==i.targetElement[o])return;const s=Pi(n).get(o);s!==Pi(r).get(o)&&t.updateProperties(r,{[o]:s})}))}function Ad(e,t){Uo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,r=Si(n),i=r&&r.get("label");i&&i.get("bounds")&&t.updateModdleProperties(n,i,{bounds:void 0})}),!0)}function Dd(e,t,n){Uo.call(this,e),this.preExecute("shape.delete",(function(e){var r=e.context.shape;if(1===r.incoming.length&&1===r.outgoing.length){var i=r.incoming[0],o=r.outgoing[0];if(ki(i,"bpmn:SequenceFlow")&&ki(o,"bpmn:SequenceFlow")&&t.canConnect(i.source,o.target,i)){var s=function(e,t){var n=Qu(Nd(e[e.length-2]),Nd(e[e.length-1]),Nd(t[1]),Nd(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Nd(e[0]),Nd(t[t.length-1])]}(i.waypoints,o.waypoints);n.reconnectEnd(i,o.target,s)}}}))}function Nd(e){return e.original||e}function Rd(e,t){Uo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;ki(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var r=t.makeProcess(),i=n.children.slice();t.moveElements(i,{x:0,y:0},r)}}),!0)}function jd(e,t,n,r){Uo.call(this,e);var i=r.get("dragging",!1);function o(e){var r,i,o=e.source,s=e.target;e.parent&&(ki(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(i=!0),n.canConnectMessageFlow(o,s)&&(r="bpmn:MessageFlow")),ki(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(i=!0),n.canConnectSequenceFlow(o,s)&&(r="bpmn:SequenceFlow")),i&&t.removeConnection(e),r&&t.connect(o,s,{type:r,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){v(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var r,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(r=n.canConnect(l,c))&&r.type!==a.type&&(o=t.connect(l,c,{type:r.type,associationDirection:r.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,i&&function(e,t){var n,r=i.context(),o=r&&r.payload.previousSelection;if(!o||!o.length)return;if(n=o.indexOf(e),-1===n)return;o.splice(n,1,t)}(a,o))})),this.postExecuted("element.updateProperties",(function(e){var n,r=e.context,i=r.properties,o=r.element,s=o.businessObject;i.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),i.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Id(e,t,n,r,i,o){r.invoke(Uo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,r=n.parent,i=n.elements,o=w(i,(function(e,n){var i=t.canReplace([n],n.host||n.parent||r);return i?e.concat(i.replacements):e}),[]);o.length&&this._replaceElements(i,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,r=n.newParent,i=n.newHost,o=[];v(n.closure.topLevel,(function(e){o=Gi(e)?o.concat(e.children):o.concat(e)})),1===o.length&&i&&(r=i);var s=t.canReplace(o,r);s&&this._replaceElements(o,s.replacements,i)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,r=e.context,i=r.oldShape,o=r.newShape,s=i.attachers;s&&s.length&&(n=t.canReplace(s,o),this._replaceElements(s,n.replacements))}),this),this.postExecuted(["shape.replace"],1500,(function(e){var t=e.context,n=t.oldShape,r=t.newShape;i.unclaimId(n.businessObject.id,n.businessObject),i.updateProperties(r,{id:n.id})}))}Md.$inject=["injector","modeling"],e(Md,Uo),e(Ad,Uo),Ad.$inject=["eventBus","modeling"],e(Dd,Uo),Dd.$inject=["eventBus","bpmnRules","modeling"],Rd.$inject=["eventBus","modeling"],e(Rd,Uo),e(jd,Uo),jd.$inject=["eventBus","modeling","bpmnRules","injector"],e(Id,Uo),Id.prototype._replaceElements=function(e,t){var n=this._elementRegistry,r=this._bpmnReplace,i=this._selection;v(t,(function(t){var i={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=r.replaceElement(o,i,{select:!1})})),t&&i.select(e)},Id.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Ld={width:140,height:120},$d={width:300,height:60},zd={width:60,height:300},Bd={width:300,height:150},qd={width:150,height:300},Fd={width:140,height:120},Vd={width:50,height:30};function Hd(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,r=t.direction,i=t.balanced;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var r=ju(e),i=!0,o=!0,s=Nu(r,[r]),a=vn(e),l={},c={},p=Ui(e),u=p?$d:zd;/n/.test(t)?c.top=a.bottom-u.height:/e/.test(t)?c.right=a.left+u.width:/s/.test(t)?c.bottom=a.top+u.height:/w/.test(t)&&(c.left=a.right-u.width);s.forEach((function(e){var r=vn(e);p?(r.top<a.top-10&&(i=!1),r.bottom>a.bottom+10&&(o=!1)):(r.left<a.left-10&&(i=!1),r.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Ud(a.top-r.bottom)<10&&Xd(l,"top",r.top+u.height),Ud(a.top-r.top)<5&&Yd(c,"top",r.bottom-u.height)),/e/.test(t)&&(n&&Ud(a.right-r.left)<10&&Yd(l,"right",r.right-u.width),Ud(a.right-r.right)<5&&Xd(c,"right",r.left+u.width)),/s/.test(t)&&(n&&Ud(a.bottom-r.top)<10&&Yd(l,"bottom",r.bottom-u.height),Ud(a.bottom-r.bottom)<5&&Xd(c,"bottom",r.top+u.height)),/w/.test(t)&&(n&&Ud(a.left-r.right)<10&&Xd(l,"left",r.left+u.width),Ud(a.left-r.left)<5&&Yd(c,"left",r.right-u.width))}));var d=r.children.filter((function(e){return!e.hidden&&!e.waypoints&&(ki(e,"bpmn:FlowElement")||ki(e,"bpmn:Artifact"))})),h=p?Zd:Kd;return d.forEach((function(e){var n=vn(e);!/n/.test(t)||p&&!i||Yd(c,"top",n.top-h.top),/e/.test(t)&&(p||o)&&Xd(c,"right",n.right+h.right),!/s/.test(t)||p&&!o||Xd(c,"bottom",n.bottom+h.bottom),/w/.test(t)&&(p||i)&&Yd(c,"left",n.left-h.left)})),{min:c,max:l}}(n,r,i)),ki(n,"bpmn:SubProcess")&&Hi(n)&&(t.minDimensions=Fd),ki(n,"bpmn:TextAnnotation")&&(t.minDimensions=Vd)}))}Hd.$inject=["eventBus"];var Ud=Math.abs,Wd=Math.min,Gd=Math.max;function Qd(e,t,n,r){var i=e[t];e[t]=void 0===i?n:r(n,i)}function Yd(e,t,n){return Qd(e,t,n,Wd)}function Xd(e,t,n){return Qd(e,t,n,Gd)}var Zd={top:20,left:50,right:20,bottom:20},Kd={top:50,left:20,right:20,bottom:20};function Jd(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(ki(n,"bpmn:Lane")||ki(n,"bpmn:Participant"))&&(t.balanced=!xs(e))})),e.on("resize.end",1001,(function(e){var n=e.context,r=n.shape,i=n.canExecute,o=n.newBounds;if(ki(r,"bpmn:Lane")||ki(r,"bpmn:Participant"))return i&&(o=gn(o),t.resizeLane(r,o,n.balanced)),!1}))}Jd.$inject=["eventBus","modeling"];function eh(e,t,n,r,i){function o(e){return Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Qi(e,t)}))}(e,["bpmn:ErrorEventDefinition","bpmn:EscalationEventDefinition","bpmn:MessageEventDefinition","bpmn:SignalEventDefinition"])}function s(t){return!!m(e.getDefinitions().get("rootElements"),M({id:t.id}))}function a(e){return ki(e,"bpmn:ErrorEventDefinition")?"errorRef":ki(e,"bpmn:EscalationEventDefinition")?"escalationRef":ki(e,"bpmn:MessageEventDefinition")?"messageRef":ki(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Uo,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var r=l(Pi(n));r&&!s(r)&&(Pt(e.getDefinitions().get("rootElements"),r),t.addedRootElement=r)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&Ot(e.getDefinitions().get("rootElements"),n)}),!0),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element;if(!n.labelTarget&&o(n)){var r=l(Pi(n));r&&(t.referencedRootElement=r)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=r.copyElement(o,i.create(o.$type))),function(e,t){if(Oi(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.set("messageRef",t);var n=e.get("eventDefinitions")[0];n.set(a(n),t)}(n,o),delete t.referencedRootElement)}))}eh.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(eh,Uo);var th=Math.max;function nh(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,r=e.start,i={};return v(t,(function(e){var t=e.id;ki(e,"bpmn:Participant")&&(i[t]=function(e,t,n){var r=Ui(e);if(i=e,!Ru(i).length)return r?Bd:qd;var i;var o=function(e){return"x"===e}(t),s={};s=o?r?Bd:{width:ih(e,n,o),height:qd.height}:r?{width:Bd.width,height:rh(e,n,o)}:qd;return s}(e,n,r)),ki(e,"bpmn:Lane")&&(i[t]=Ui(e)?$d:zd),ki(e,"bpmn:SubProcess")&&Hi(e)&&(i[t]=Fd),ki(e,"bpmn:TextAnnotation")&&(i[t]=Vd),ki(e,"bpmn:Group")&&(i[t]=Ld)})),i}))}function rh(e,t,n){var r;return r=function(e,t,n){var r,i=Ru(e);return r=oh(i,t,n),e.height-r.height+$d.height}(e,t,n),th(Bd.height,r)}function ih(e,t,n){var r;return r=function(e,t,n){var r,i=Ru(e);return r=oh(i,t,n),e.width-r.width+zd.width}(e,t,n),th(qd.width,r)}function oh(e,t,n){var r,i,o;for(r=0;r<e.length;r++)if(i=e[r],!n&&t>=i.y&&t<=i.y+i.height||n&&t>=i.x&&t<=i.x+i.width)return(o=Ru(i)).length?oh(o,t,n):i}nh.$inject=["eventBus"];var sh=180,ah=160;function lh(e,t,n,r,i,o,s){Uo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=r,this._bpmnFactory=i,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return ki(e,"bpmn:SubProcess")&&!Hi(e)}function c(t){var n=t.shape,r=t.newRootElement,i=Pi(n);r=a._addDiagram(r||i),t.newRootElement=e.addRootElement(r)}function p(t){var n=Pi(t.shape);a._removeDiagram(n);var r=t.newRootElement=s.get(es(n));e.removeRootElement(r)}this.executed("shape.create",(function(e){l(e.shape)&&c(e)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.newRootElement;n&&t.children&&(a._showRecursively(t.children),a._moveChildrenToShape(t,n))}),!0),this.reverted("shape.create",(function(e){l(e.shape)&&p(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var r=s.get(es(t));r&&n.removeElements(r.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&p(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,r=t.newShape;l(n)&&l(r)&&(t.oldRoot=e.removeRootElement(es(n)))}),!0),this.postExecuted("shape.replace",(function(t){var r=t.newShape,i=t.oldRoot,o=e.findRoot(es(r));if(i&&o){var s=i.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ns(t))return s.updateId(t,ts(i)),void s.updateId(r,i);s.get(ts(r))&&s.updateId(ts(r),ts(i))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(ki(t,"bpmn:SubProcess")){var n=e.properties,r=e.oldProperties.id,i=n.id;if(r!==i){if(ns(t))return s.updateId(t,ts(r)),void s.updateId(i,r);var o=s.get(ts(i));o&&s.updateId(o,ts(r))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(ns(n)){var r=n,i=s.get(Jo(r));i&&i!==r&&t.fire("element.changed",{element:i})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Hi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;ki(t,"bpmn:SubProcess")&&(Hi(t)?p(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(ki(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Hi(t)?a._moveChildrenToShape(n,t):a._moveChildrenToShape(t,n))}}),!0),t.on("copyPaste.createTree",(function(e){var t=e.element,n=e.children;if(l(t)){var r=es(t),i=s.get(r);i&&n.push.apply(n,i.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements,i=n.parent;if(ki(Si(i),"bpmndi:BPMNPlane")){var o=Jo(i),s=m(r,(function(e){return e.id===o}));s&&(t.parent=s.id)}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor;t.parent&&(l(t.parent)||t.parent.hidden)&&(t.hidden=!0)}))}function ch(e,t){e.invoke(Uo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,r=e.context.newShape;if(ki(r,"bpmn:SubProcess")&&!ki(r,"bpmn:AdHocSubProcess")&&(ki(n,"bpmn:Task")||ki(n,"bpmn:CallActivity"))&&Hi(r)){var i,o={x:(i=r).x+i.width/6,y:i.y+i.height/2};t.createShape({type:"bpmn:StartEvent"},o,r)}}))}function ph(e){Uo.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;ki(t,"bpmn:TextAnnotation")&&(e.parent=t.parent)}),!0),this.preExecute(["shape.create","shape.resize","elements.move"],(function(e){const t=e.shapes||[e.shape];1===t.length&&ki(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function uh(e,t){Uo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Hi(n)){var r=yt(n);r.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();v(t,(function(e){i(e,!0)})),v(n,(function(e){i(e,!1)}))}))}function i(e,i){-1!==r.indexOf(e.source)&&-1!==r.indexOf(e.target)||(i?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(lh,Uo),lh.prototype._moveChildrenToShape=function(e,t){var n,r=this._modeling,i=e.children;if(i){var o=(i=i.concat(i.reduce((function(t,n){return n.label&&n.label.parent!==e?t.concat(n.label):t}),[]))).filter((function(e){return!e.hidden}));if(o.length){var s=vt(o);if(t.x){var a=xn(t),l=xn(s);n={x:a.x-l.x,y:a.y-l.y}}else n={x:sh-s.x,y:ah-s.y};r.moveElements(i,n,t,{autoResize:!1})}else r.moveElements(i,{x:0,y:0},t,{autoResize:!1})}},lh.prototype._showRecursively=function(e,t){var n=this,r=[];return e.forEach((function(e){e.hidden=!!t,r=r.concat(e),e.children&&(r=r.concat(n._showRecursively(e.children,e.collapsed||t)))})),r},lh.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},lh.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,r=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),i=t.create("bpmndi:BPMNDiagram",{plane:r});return r.$parent=i,n.createRoot({id:es(e),type:e.$type,di:r,businessObject:e,collapsed:!0})},lh.prototype._removeDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams,n=m(t,(function(t){return t.plane.bpmnElement.id===e.id}));return t.splice(t.indexOf(n),1),n},lh.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],ch.$inject=["injector","modeling"],e(ch,Uo),e(ph,Uo),ph.$inject=["eventBus"],e(uh,Uo),uh.$inject=["eventBus","modeling"];function dh(e,t,n){Uo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;ki(n,"bpmn:SubProcess")&&(n.collapsed?Si(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Si(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Si(t).isExpanded=!1:Si(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var r,i=e.context.shape,o=t.getDefaultSize(i);r=i.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(i,o):function(e,t){var n,r,i,o=e.children,s=t;return n=(i=o,i.filter((function(e){return!e.hidden}))).concat([e]),(r=Tu(n))?(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,s.y=r.y+(r.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(i,o),n.resizeShape(i,r,null,{autoResize:!i.collapsed&&"nwse"})}))}function hh(e,t,n,r){t.invoke(Uo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,i=t.businessObject;mn(t)||(ki(t,"bpmn:Participant")&&Hi(t)&&n.ids.unclaim(i.processRef.id),r.unclaimId(i.id,i))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;r.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),r=t.businessObject;ki(t,"bpmn:Collaboration")&&n.ids.unclaim(r.id)}))}function fh(e,t){Uo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,r=n.source;(function(e,t){if(!ki(e,"bpmn:SequenceFlow"))return!1;var n=Pi(t),r=Pi(e);return n.get("default")===r})(n,r)&&t.updateProperties(r,{default:null})}))}e(dh,Uo),dh.$inject=["eventBus","elementFactory","modeling"],e(hh,Uo),hh.$inject=["canvas","injector","moddle","modeling"],e(fh,Uo),fh.$inject=["eventBus","modeling"];function mh(e,t){var n;function r(){if(!n)throw new Error("out of bounds release");return n}Uo.call(this,e);var i=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(i,5e3,(function(e){(n=n||new gh).enter()})),this.postExecuted(i,500,(function(e){!function(){if(!n)throw new Error("out of bounds release");var e=n.leave();e&&(t.updateLaneRefs(n.flowNodes,n.lanes),n=null)}()})),this.preExecute(["shape.create","shape.move","shape.delete","shape.resize"],(function(e){var t=e.context.shape,n=r();t.labelTarget||(ki(t,"bpmn:Lane")&&n.addLane(t),ki(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function gh(){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 yh(e,t){Uo.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)vh(e)&&!bh(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function vh(e){const t=Pi(e);return t&&t.isForCompensation}function bh(e){return e.incoming.filter((e=>function(e){return e&&ki(e,"bpmn:BoundaryEvent")&&Qi(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}mh.$inject=["eventBus","modeling"],e(mh,Uo),e(yh,Uo),yh.$inject=["eventBus","modeling"];var wh={__init__:["adaptiveLabelPositioningBehavior","appendBehavior","associationBehavior","attachEventBehavior","boundaryEventBehavior","compensateBoundaryEventBehaviour","createBehavior","createDataObjectBehavior","createParticipantBehavior","dataInputAssociationBehavior","dataStoreBehavior","deleteLaneBehavior","detachEventBehavior","dropOnFlowBehavior","eventBasedGatewayBehavior","fixHoverBehavior","groupBehavior","importDockingFix","isHorizontalFix","labelBehavior","layoutConnectionBehavior","messageFlowBehavior","nonInterruptingBehavior","removeElementBehavior","removeEmbeddedLabelBoundsBehavior","removeParticipantBehavior","replaceConnectionBehavior","replaceElementBehaviour","resizeBehavior","resizeLaneBehavior","rootElementReferenceBehavior","spaceToolBehavior","subProcessPlaneBehavior","subProcessStartEventBehavior","textAnnotationBehavior","toggleCollapseConnectionBehaviour","toggleElementCollapseBehaviour","unclaimIdBehavior","updateFlowNodeRefsBehavior","unsetDefaultFlowBehavior","setCompensationActivityAfterPasteBehavior"],adaptiveLabelPositioningBehavior:["type",Jp],appendBehavior:["type",tu],associationBehavior:["type",nu],attachEventBehavior:["type",ru],boundaryEventBehavior:["type",ou],compensateBoundaryEventBehaviour:["type",su],createBehavior:["type",pu],createDataObjectBehavior:["type",uu],createParticipantBehavior:["type",gu],dataInputAssociationBehavior:["type",vu],dataStoreBehavior:["type",xu],deleteLaneBehavior:["type",Lu],detachEventBehavior:["type",$u],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",Vu],fixHoverBehavior:["type",Wu],groupBehavior:["type",Gu],importDockingFix:["type",Yu],isHorizontalFix:["type",Zu],labelBehavior:["type",md],layoutConnectionBehavior:["type",yd],messageFlowBehavior:["type",Pd],nonInterruptingBehavior:["type",Md],removeElementBehavior:["type",Dd],removeEmbeddedLabelBoundsBehavior:["type",Ad],removeParticipantBehavior:["type",Rd],replaceConnectionBehavior:["type",jd],replaceElementBehaviour:["type",Id],resizeBehavior:["type",Hd],resizeLaneBehavior:["type",Jd],rootElementReferenceBehavior:["type",eh],spaceToolBehavior:["type",nh],subProcessPlaneBehavior:["type",lh],subProcessStartEventBehavior:["type",ch],textAnnotationBehavior:["type",ph],toggleCollapseConnectionBehaviour:["type",uh],toggleElementCollapseBehaviour:["type",dh],unclaimIdBehavior:["type",hh],unsetDefaultFlowBehavior:["type",fh],updateFlowNodeRefsBehavior:["type",mh],setCompensationActivityAfterPasteBehavior:["type",yh]};function xh(e,t){var n=_n(e,t,-15);return"intersect"!==n?n:null}function _h(e){nc.call(this,e)}function Eh(e){return!e||mn(e)}function kh(e){do{if(ki(e,"bpmn:Process"))return Pi(e);if(ki(e,"bpmn:Participant"))return Pi(e).processRef||Pi(e)}while(e=e.parent)}function Oh(e){return ki(e,"bpmn:TextAnnotation")}function Ph(e){return ki(e,"bpmn:Group")&&!e.labelTarget}function Sh(e){return ki(e,"bpmn:BoundaryEvent")&&Ah(e,"bpmn:CompensateEventDefinition")}function Ch(e){return Pi(e).isForCompensation}function Th(e){for(var t=e;t=t.parent;){if(ki(t,"bpmn:FlowElementsContainer"))return Pi(t);if(ki(t,"bpmn:Participant"))return Pi(t).processRef}return null}function Mh(e,t){return Th(e)===Th(t)}function Ah(e,t){return!!m(Pi(e).eventDefinitions||[],(function(e){return ki(e,t)}))}function Dh(e,t){return(Pi(e).eventDefinitions||[]).every((function(e){return ki(e,t)}))}function Nh(e,t){var n=function(e){for(var t=[];e;)(e=e.parent)&&t.push(e);return t}(t);return-1!==n.indexOf(e)}function Rh(e,t,n){if(Eh(e)||Eh(t))return null;if(!ki(n,"bpmn:DataAssociation")){if(Qh(e,t))return{type:"bpmn:MessageFlow"};if(Yh(e,t))return{type:"bpmn:SequenceFlow"}}var r=Xh(e,t);return r||(Gh(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!Wh(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function jh(e,t){return!(!mn(e)&&!Ph(e))||!(ki(t,"bpmn:Participant")&&!Hi(t))&&(ki(e,"bpmn:Participant")?ki(t,"bpmn:Process")||ki(t,"bpmn:Collaboration"):Oi(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:ki(e,"bpmn:Lane")?ki(t,"bpmn:Participant")||ki(t,"bpmn:Lane"):!(ki(e,"bpmn:BoundaryEvent")&&!function(e){return Pi(e).cancelActivity&&($h(e)||zh(e))}(e))&&(ki(e,"bpmn:FlowElement")&&!ki(e,"bpmn:DataStoreReference")?ki(t,"bpmn:FlowElementsContainer")?Hi(t):Oi(t,["bpmn:Participant","bpmn:Lane"]):ki(e,"bpmn:DataStoreReference")&&ki(t,"bpmn:Collaboration")?_(Pi(t).get("participants"),(function(e){return!!e.get("processRef")})):Oi(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?Oi(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!ki(e,"bpmn:MessageFlow")&&(ki(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Ih(e){return ki(e,"bpmn:Lane")}function Lh(e){return!!function(e){return!mn(e)&&ki(e,"bpmn:BoundaryEvent")}(e)||(!(!ki(e,"bpmn:IntermediateThrowEvent")||!$h(e))||ki(e,"bpmn:IntermediateCatchEvent")&&zh(e))}function $h(e){var t=Pi(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function zh(e){return Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bh(e,t){return t.some((function(t){return Ah(e,t)}))}function qh(e,t,n,r){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var i=e[0];return!mn(i)&&(!!Lh(i)&&(!Gi(t)&&(!(!ki(t,"bpmn:Activity")||Ch(t))&&(!(r&&!xh(r,t))&&(!function(e){return ki(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return ki(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Fh(e,t,n){if(!t)return!1;var r={replacements:[]};return v(e,(function(e){Gi(t)||ki(e,"bpmn:StartEvent")&&"label"!==e.type&&jh(e,t)&&(Wi(e)||r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Qi(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Qi(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Qi(e,"bpmn:CompensateEventDefinition")}(e))&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bh(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&ki(t,"bpmn:SubProcess")&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),ki(t,"bpmn:Transaction")||Ah(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(ki(e,"bpmn:EndEvent")&&jh(e,t)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),ki(e,"bpmn:BoundaryEvent")&&qh(e,t,0,n)&&r.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!r.replacements.length&&r}function Vh(e,t){return!_(e,Ih)&&(!t||e.every((function(e){return jh(e,t)})))}function Hh(e,t,n,r){return!!t&&(!(!mn(e)&&!Ph(e))||!function(e,t){return e===t}(n,t)&&((!n||!Nh(n,t))&&(jh(e,t)||Zh(e,t))))}function Uh(e,t){return ki(e,"bpmn:SubProcess")?Hi(e)&&(!t||t.width>=100&&t.height>=80):!!ki(e,"bpmn:Lane")||(!!ki(e,"bpmn:Participant")||(!!Oh(e)||!!Ph(e)))}function Wh(e,t){return!Nh(t,e)&&!Nh(e,t)&&(!!function(e,t){var n=Oh(e),r=Oh(t);return(n||r)&&n!==r}(e,t)||!!Xh(e,t))}function Gh(e,t){return Mh(e,t)&&Sh(e)&&ki(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Gi(t);var n}function Qh(e,t){return!(Jh(e)&&!Jh(t))&&(ki(n=e,"bpmn:InteractionNode")&&!ki(n,"bpmn:BoundaryEvent")&&(!ki(n,"bpmn:Event")||ki(n,"bpmn:ThrowEvent")&&Dh(n,"bpmn:MessageEventDefinition"))&&function(e){return ki(e,"bpmn:InteractionNode")&&!Ch(e)&&(!ki(e,"bpmn:Event")||ki(e,"bpmn:CatchEvent")&&Dh(e,"bpmn:MessageEventDefinition"))&&!(ki(e,"bpmn:BoundaryEvent")&&!Ah(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return kh(e)===kh(t)}(e,t));var n}function Yh(e,t){return ki(n=e,"bpmn:FlowNode")&&!ki(n,"bpmn:EndEvent")&&!Gi(n)&&!(ki(n,"bpmn:IntermediateThrowEvent")&&Ah(n,"bpmn:LinkEventDefinition"))&&!Sh(n)&&!Ch(n)&&function(e){return ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:StartEvent")&&!ki(e,"bpmn:BoundaryEvent")&&!Gi(e)&&!(ki(e,"bpmn:IntermediateCatchEvent")&&Ah(e,"bpmn:LinkEventDefinition"))&&!Ch(e)}(t)&&Mh(e,t)&&!(ki(e,"bpmn:EventBasedGateway")&&!function(e){return ki(e,"bpmn:ReceiveTask")||ki(e,"bpmn:IntermediateCatchEvent")&&(Ah(e,"bpmn:MessageEventDefinition")||Ah(e,"bpmn:TimerEventDefinition")||Ah(e,"bpmn:ConditionalEventDefinition")||Ah(e,"bpmn:SignalEventDefinition"))}(t));var n}function Xh(e,t){return Oi(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&Oi(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!Oi(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!Oi(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Zh(e,t,n){if(!t)return!1;if(Array.isArray(e)){if(1!==e.length)return!1;e=e[0]}return t.source!==e&&t.target!==e&&(Oi(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!mn(t)&&ki(e,"bpmn:FlowNode")&&!ki(e,"bpmn:BoundaryEvent")&&jh(e,t.parent))}function Kh(e,t){return!!mn(t)||!(ki(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Jh(e){return gc(e,"bpmn:Process")||gc(e,"bpmn:Collaboration")}e(_h,nc),_h.$inject=["eventBus"],_h.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(Eh(e))return null;return Oi(e,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference","bpmn:Group","bpmn:TextAnnotation"])}(e.source)})),this.addRule("connection.create",(function(e){var t=e.source,n=e.target,r=e.hints||{},i=r.targetParent;if(r.targetAttach)return!1;i&&(n.parent=i);try{return Rh(t,n)}finally{i&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Rh(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Uh(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,r=e.target;return!(fn(r)&&!Zh(t,r))&&x(t,(function(e){return fn(e)?Rh(e.source,e.target,e):e.host?qh(e,e.host,null,n):Hh(e,r,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,r=e.position;return qh(n,t,null,r)||Fh(n,t,r)||Vh(n,t)||Zh(n,t)})),this.addRule("shape.create",(function(e){return Hh(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return qh(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Kh(e.elements,t)}))},_h.prototype.canConnectMessageFlow=Qh,_h.prototype.canConnectSequenceFlow=Yh,_h.prototype.canConnectDataAssociation=Xh,_h.prototype.canConnectAssociation=Wh,_h.prototype.canConnectCompensationAssociation=Gh,_h.prototype.canMove=Vh,_h.prototype.canAttach=qh,_h.prototype.canReplace=Fh,_h.prototype.canDrop=jh,_h.prototype.canInsert=Zh,_h.prototype.canCreate=Hh,_h.prototype.canConnect=Rh,_h.prototype.canResize=Uh,_h.prototype.canCopy=Kh;var ef={__depends__:[$c],__init__:["bpmnRules"],bpmnRules:["type",_h]};function tf(e,t){e.on("saveXML.start",2e3,(function(){v(t.getRootElements(),(function(e){var t,n=Si(e);t=E(y(yt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Si),n.set("planeElement",t)}))}))}tf.$inject=["eventBus","canvas"];var nf={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",tf]};function rf(e){Uo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,r=n.shape||n.connection,i=n.newParent||r.parent,o=t.getOrdering(r,i);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function of(e,t){rf.call(this,e);var n=[{type:"bpmn:SubProcess",order:{level:6}},{type:"bpmn:SequenceFlow",order:{level:9,containers:["bpmn:Participant","bpmn:FlowElementsContainer"]}},{type:"bpmn:DataAssociation",order:{level:9,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:TextAnnotation",order:{level:9}},{type:"bpmn:MessageFlow",order:{level:9,containers:["bpmn:Collaboration"]}},{type:"bpmn:Association",order:{level:6,containers:["bpmn:Participant","bpmn:FlowElementsContainer","bpmn:Collaboration"]}},{type:"bpmn:BoundaryEvent",order:{level:8}},{type:"bpmn:Group",order:{level:10,containers:["bpmn:Collaboration","bpmn:FlowElementsContainer"]}},{type:"bpmn:FlowElement",order:{level:5}},{type:"bpmn:Participant",order:{level:-2}},{type:"bpmn:Lane",order:{level:-1}}];function r(e){var t=e.order;if(t||(e.order=t=function(e){if(e.labelTarget)return{level:10};var t=m(n,(function(t){return Oi(e,[t.type])}));return t&&t.order||{level:1}}(e)),!t)throw new Error(`no order for <${e.id}>`);return t}this.getOrdering=function(e,n){if(e.labelTarget||ki(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var i=r(e);i.containers&&(n=function(e,t,n){for(var r=t;r&&!Oi(r,n);)r=r.parent;if(!r)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return r}(e,n,i.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&i.level<r(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}rf.prototype.getOrdering=function(e,t){return null},e(rf,Uo),of.$inject=["eventBus","canvas"],e(of,rf);var sf={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",of]};function af(){}af.prototype.get=function(){return this._data},af.prototype.set=function(e){this._data=e},af.prototype.clear=function(){var e=this._data;return delete this._data,e},af.prototype.isEmpty=function(){return!this._data};var lf={clipboard:["type",af]},cf="drop-ok",pf="drop-not-ok",uf="attach-ok",df="new-parent",hf="create";function ff(e,t,n,r,i){function o(t,n){[uf,cf,pf,df].forEach((function(r){r===n?e.addMarker(t,r):e.removeMarker(t,r)}))}function s(){var e=t.context();e&&e.prefix===hf&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,r=e.hover,s=t.source,a=t.hints||{};if(!r)return t.canExecute=!1,void(t.target=null);mf(e);var l={x:e.x,y:e.y},c=t.canExecute=r&&function(e,t,n,r,o){if(!t)return!1;var s=m(e=y(e,(function(t){var n=t.labelTarget;return!(t.parent||mn(t)&&-1!==e.indexOf(n))})),(function(e){return!fn(e)})),a=!1,l=!1,c=!1;gf(e)&&(a=i.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=gf(e)?i.allowed("shape.create",{position:n,shape:s,source:r,target:t}):i.allowed("elements.create",{elements:e,position:n,target:t}));var p=o.connectionTarget;return c||a?(s&&r&&(l=i.allowed("connection.create",{source:p===r?s:r,target:p===r?r:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,r,l,s,a);r&&null!==c&&(t.target=r,c&&c.attach?o(r,uf):o(r,c?df:pf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,i=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,p=t.hints||{};if(!1===a||!s)return!1;mf(e);var u={x:e.x,y:e.y};i=c?r.appendShape(n,i,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:p.connectionTarget}):m(o=r.createElements(o,u,s,L({},p,{attach:l})),(function(e){return!fn(e)})),L(t,{elements:o,shape:i}),L(e,{elements:o,shape:i})})),n.on("create.init",(function(){n.on("elements.changed",s),n.once(["create.cancel","create.end"],2e3,(function(){n.off("elements.changed",s)}))})),this.start=function(e,n,r){c(n)||(n=[n]);var i=m(n,(function(e){return!fn(e)}));if(i){r=L({elements:n,hints:{},shape:i},r||{}),v(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(y(n,(function(e){return!e.hidden})));v(n,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2}}))),L(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,hf,{cursor:"grabbing",autoActivate:!0,data:{shape:i,elements:n,context:r}})}}}function mf(e){var t=e.context.createConstraints;t&&(t.left&&(e.x=Math.max(e.x,t.left)),t.right&&(e.x=Math.min(e.x,t.right)),t.top&&(e.y=Math.max(e.y,t.top)),t.bottom&&(e.y=Math.min(e.y,t.bottom)))}function gf(e){return e&&1===e.length&&!fn(e[0])}ff.$inject=["canvas","dragging","eventBus","modeling","rules"];function yf(e,t,n,r,i){t.on("create.move",750,(function(t){var o=t.hover,s=t.context,a=s.elements,l=s.dragGroup;l||(l=s.dragGroup=function(e){var t=Re("g");Oe(t,i.cls("djs-drag-group",["no-events"]));var o=Re("g");return e.forEach((function(e){var i;e.hidden||(e.waypoints?(i=n._createContainer("connection",o),n.drawConnection(Xn(i),e)):(i=n._createContainer("shape",o),n.drawShape(Xn(i),e),Kn(i,e.x,e.y)),r.addDragger(e,t,i))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Kn(l,t.x,t.y)):Ue(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&Ue(t)}))}yf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var vf={__depends__:[Nc,Gp,$c,Ns],__init__:["create","createPreview"],create:["type",ff],createPreview:["type",yf]};function bf(e){var t=this;function n(e){t._lastMoveEvent=e}this._lastMoveEvent=null,e.on("canvas.init",(function(e){(t._svg=e.svg).addEventListener("mousemove",n)})),e.on("canvas.destroy",(function(){t._lastMouseEvent=null,t._svg.removeEventListener("mousemove",n)}))}bf.$inject=["eventBus"],bf.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),r=e,i=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,r,i,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var wf={__init__:["mouse"],mouse:["type",bf]};function xf(e,t,n,r,i,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=r,this._eventBus=i,this._modeling=o,this._mouse=s,this._rules=a,i.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,r=e.elements;t.priority=1,t.id=n.id;var i=m(r,(function(e){return e===n.parent}));i&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),fn(n)&&(t.priority=3,t.source=n.source.id,t.target=n.target.id,t.waypoints=function(e){return E(e.waypoints,(function(e){return(e=_f(e)).original&&(e.original=_f(e.original)),e}))}(n)),mn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),v(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),i.on("copyPaste.pasteElements",(function(e){L(e.hints,{createElementsBehavior:!1})}))}function _f(e){return L({},e)}function Ef(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}xf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],xf.prototype.copy=function(e){var t,n;return c(e)||(e=e?[e]:[]),n=!1===(t=this._eventBus.fire("copyPaste.canCopyElements",{elements:e}))?{}:this.createTree(c(t)?t:e),this._clipboard.set(n),this._eventBus.fire("copyPaste.elementsCopied",{elements:e,tree:n}),n},xf.prototype.paste=function(e){var t=this._clipboard.get();if(!this._clipboard.isEmpty()){var n=e&&e.hints||{};this._eventBus.fire("copyPaste.pasteElements",{hints:n});var r=this._createElements(t);if(e&&e.element&&e.point)return this._paste(r,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),r,{hints:n||{}})}},xf.prototype._paste=function(e,t,n,r){v(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var i=vt(e);return v(e,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2}}))),L(e,{x:e.x-i.x-i.width/2,y:e.y-i.y-i.height/2})})),this._modeling.createElements(e,n,t,L({},r))},xf.prototype._createElements=function(e){var t=this,n=this._eventBus,r={},i=[];return v(e,(function(e,o){v(e=T(e,"priority"),(function(e){var o,s=L({},q(e,["priority"]));return r[e.parent]?s.parent=r[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:r,descriptor:s}),fn(s)?(s.source=r[e.source],s.target=r[e.target],o=r[e.id]=t.createConnection(s),void i.push(o)):mn(s)?(s.labelTarget=r[s.labelTarget],o=r[e.id]=t.createLabel(s),void i.push(o)):(s.host&&(s.host=r[s.host]),o=r[e.id]=t.createShape(s),void i.push(o))}))})),i},xf.prototype.createConnection=function(e){return this._elementFactory.createConnection(q(e,["id"]))},xf.prototype.createLabel=function(e){return this._elementFactory.createLabel(q(e,["id"]))},xf.prototype.createShape=function(e){return this._elementFactory.createShape(q(e,["id"]))},xf.prototype.hasRelations=function(e,t){var n,r;return!(fn(e)&&(n=m(t,M({id:e.source.id})),r=m(t,M({id:e.target.id})),!n||!r))&&!(mn(e)&&!m(t,M({id:e.labelTarget.id})))},xf.prototype.createTree=function(e){var t=this._rules,n=this,r={},i=[];function o(e,t){var n=m(i,(function(t){return e===t.element}));n?n.depth<t&&(i=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,i),i.push({element:n.element,depth:t})):i.push({element:e,depth:t})}return gt(ht(e),(function(e,t,r){if(!mn(e)){v(e.labels,(function(e){o(e,r)})),v([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&v(e,(function(e){v(e.labels,(function(e){o(e,r)})),o(e,r)}))})),o(e,r);var i=[];return e.children&&(i=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:i}),i}})),e=E(i,(function(e){return e.element})),i=E(i,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),i=T(i,(function(e){return e.descriptor.priority})),e=E(i,(function(e){return e.element})),v(i,(function(i){var o=i.depth;n.hasRelations(i.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(i.element,e)?Ef(i.element,e):(r[o]||(r[o]=[]),r[o].push(i.descriptor)):Ef(i.element,e)})),r};var kf={__depends__:[lf,vf,wf,$c],__init__:["copyPaste"],copyPaste:["type",xf]};function Of(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}function Pf(e,t,n){function r(t,r){var i=e.create(t.$type);return n.copyElement(t,i,null,r)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,i=Pi(n);if(mn(n))return t;var o=t.businessObject=r(i,!0),s=t.di=r(Si(n),!0);s.bpmnElement=o,Of(o,t,"name"),Of(s,t,"isExpanded"),i.default&&(t.default=i.default.id)}));var i="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,i=n.businessObject,o=n.di;if(mn(n))return n.businessObject=Pi(t[n.labelTarget]),void(n.di=Si(t[n.labelTarget]));i=n.businessObject=r(i),(o=n.di=r(o)).bpmnElement=i,Of(n,i,["isExpanded","name"]),n.type=i.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(ki(n,"bpmn:Participant")){var i=Pi(n);i.processRef&&(t.processRef=r(i.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=r(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[i]=t}(t,function(e,t,n){var r=Pi(e);return e.default&&(n[e.default]={element:r,property:"default"}),e.host&&(Pi(e).attachedToRef=Pi(t[e.host])),q(n,w(n,(function(t,n,i){var o=n.element,s=n.property;return i===e.id&&(o.set(s,r),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[i]=e[i]||{}}(t)))}))}Pf.$inject=["bpmnFactory","eventBus","moddleCopy"];var Sf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function Cf(e,t,n){this._bpmnFactory=t,this._eventBus=e,this._moddle=n,e.on("moddleCopy.canCopyProperties",(function(e){var t=e.propertyNames;if(t&&t.length)return T(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=p(t)&&t.$descriptor,r=e.propertyName;return(!r||-1===Sf.indexOf(r))&&(!(r&&n&&!m(n.properties,M({name:r})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t=e.property;if(function(e,t){return e&&d(e.$instanceOf)&&e.$instanceOf(t)}(t,"bpmn:ExtensionElements")&&(!t.values||!t.values.length))return!1}))}function Tf(e,t){return w(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}Cf.$inject=["eventBus","bpmnFactory","moddle"],Cf.prototype.copyElement=function(e,t,n,r=!1){var i=this;n&&!c(n)&&(n=[n]),n=n||Tf(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:r});return!1===o||(c(o)&&(n=o),v(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=i.copyProperty(o,t,n,r);a(s)&&(!1!==i._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},Cf.prototype.copyProperty=function(e,t,n,r=!1){var i=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:r});if(!1!==o){if(o)return p(o)&&o.$type&&!o.$parent&&(o.$parent=t),o;var s=this._moddle.getPropertyDescriptor(t,n);if(!s.isReference){if(s.isId)return e&&this._copyId(e,t,r);if(c(e))return w(e,(function(e,s){return(o=i.copyProperty(s,t,n,r))?e.concat(o):e}),[]);if(p(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=i._bpmnFactory.create(e.$type)).$parent=t,o=i.copyElement(e,o,null,r)}return e}}},Cf.prototype._copyId=function(e,t,n=!1){return n?e:this._moddle.ids.assigned(e)?void 0:(this._moddle.ids.claim(e,t),e)};var Mf={__depends__:[kf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",Pf],moddleCopy:["type",Cf]},Af=Math.round;function Df(e,t){this._modeling=e,this._eventBus=t}function Nf(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:r={}}=t;!1!==r.select&&e.select(n)}))}Df.$inject=["modeling","eventBus"],Df.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var r=this._modeling,i=this._eventBus;i.fire("replace.start",{element:e,attrs:t,hints:n});var o=t.width||e.width,s=t.height||e.height,a=t.x||e.x,l=t.y||e.y,c=Af(a+o/2),p=Af(l+s/2),u=r.replaceShape(e,L({},t,{x:c,y:p,width:o,height:s}),n);return i.fire("replace.end",{element:e,newElement:u,hints:n}),u},Nf.$inject=["selection","eventBus"];var Rf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Nf],replace:["type",Df]};var jf=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function If(e,t,n,r,i,o){this.replaceElement=function(a,l,p){p=p||{};var u=l.type,d=a.businessObject;if(Lf(d)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Hi(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return r.toggleCollapse(a),a;var h=e.create(u),m={type:u,businessObject:h,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),v(n,(function(n){s(e[n])||(t[n]=e[n])}))}(a.di,m.di,["fill","stroke","background-color","border-color","color"]);var g=function(e,t){return e.filter((function(e){return t.includes(e)}))}(Tf(d.$descriptor),Tf(h.$descriptor,!0));L(h,B(l,jf));var b=y(g,(function(e){return"eventDefinitions"===e?$f(a,l.eventDefinitionType):"loopCharacteristics"===e?!Gi(h):!f(h,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Gi(h))))}));if(h=n.copyElement(d,h,b),l.eventDefinitionType&&($f(h,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),ki(d,"bpmn:Activity")){if(Lf(d))m.isExpanded=Hi(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var w=t.getDefaultSize(h,{isExpanded:m.isExpanded});m.width=w.width,m.height=w.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Hi(a)&&!ki(d,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Lf(d)&&!Lf(h)&&(p.moveChildren=!1),ki(d,"bpmn:Participant")){!0===l.isExpanded?h.processRef=e.create("bpmn:Process"):p.moveChildren=!1;var x=Ui(a);Si(a).isHorizontal||(Si(m).isHorizontal=x),m.width=x?a.width:t.getDefaultSize(m).width,m.height=x?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:h})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),h.name=d.name,Oi(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&Oi(h,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(h.default=d.default),l.host&&!ki(d,"bpmn:BoundaryEvent")&&ki(h,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),i.replaceElement(a,m,{...p,targetElement:l})}}function Lf(e){return ki(e,"bpmn:SubProcess")}function $f(e,t){var n=Pi(e);return t&&n.get("eventDefinitions").some((function(e){return ki(e,t)}))}If.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var zf={__depends__:[Mf,Rf,Ns],bpmnReplace:["type",If]};function Bf(e){this._eventBus=e,this._tools=[],this._active=null}Bf.$inject=["eventBus"],Bf.prototype.registerTool=function(e,t){var n=this._tools;if(!t)throw new Error('A tool has to be registered with it\'s "events"');n.push(e),this.bindEvents(e,t)},Bf.prototype.isActive=function(e){return e&&this._active===e},Bf.prototype.length=function(e){return this._tools.length},Bf.prototype.setActive=function(e){var t=this._eventBus;this._active!==e&&(this._active=e,t.fire("tool-manager.update",{tool:e}))},Bf.prototype.bindEvents=function(e,t){var n=this._eventBus,r=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),v(t,(function(e){r.push(e+".ended"),r.push(e+".canceled")})),n.on(r,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&te(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var qf={__depends__:[Nc],__init__:["toolManager"],toolManager:["type",Bf]};function Ff(e,t){return-1!==e.indexOf(t)}var Vf=Math.abs,Hf=Math.round,Uf={x:"width",y:"height"},Wf="crosshair",Gf={n:"top",w:"left",s:"bottom",e:"right"},Qf=1500,Yf={n:"s",w:"e",s:"n",e:"w"},Xf=20;function Zf(e,t,n,r,i,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=r,this._rules=i,this._toolManager=o,this._mouse=s;var a=this;o.registerTool("space",{tool:"spaceTool.selection",dragging:"spaceTool"}),n.on("spaceTool.selection.end",(function(e){n.once("spaceTool.selection.ended",(function(){a.activateMakeSpace(e.originalEvent)}))})),n.on("spaceTool.move",Qf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Jf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,r=t.axis,i=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Jf(e);var c={x:0,y:0};c[r]=Hf(e["d"+r]),a.makeSpace(o,s,c,i,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Kf(e){return{top:e.top-Xf,right:e.right+Xf,bottom:e.bottom+Xf,left:e.left-Xf}}function Jf(e){var t,n,r=e.context.spaceToolConstraints;r&&(u(r.left)&&(t=Math.max(e.x,r.left),e.dx=e.dx+t-e.x,e.x=t),u(r.right)&&(t=Math.min(e.x,r.right),e.dx=e.dx+t-e.x,e.x=t),u(r.top)&&(n=Math.max(e.y,r.top),e.dy=e.dy+n-e.y,e.y=n),u(r.bottom)&&(n=Math.min(e.y,r.bottom),e.dy=e.dy+n-e.y,e.y=n))}function em(e,t){return-1!==e.indexOf(t)}Zf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Zf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:Wf,data:{context:{reactivate:n}},trapClick:!1})},Zf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:Wf,data:{context:{}}})},Zf.prototype.makeSpace=function(e,t,n,r,i){return this._modeling.createSpace(e,t,n,r,i)},Zf.prototype.init=function(e,t){var n=Vf(e.dx)>Vf(e.dy)?"x":"y",r=e["d"+n],i=e[n]-r;if(Vf(r)<5)return!1;r<0&&(r*=-1),xs(e)&&(r*=-1);var o=function(e,t){if("x"===e){if(t>0)return"e";if(t<0)return"w"}if("y"===e){if(t>0)return"s";if(t<0)return"n"}return null}(n,r),s=this._canvas.getRootElement();!_s(e)&&e.hover&&(s=e.hover);var a=[...yt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,r,i),c=function(e,t,n,r,i){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return v(s,(function(e){var p,d,h,f,m,g,v=e.attachers,b=e.children,w=vn(e),x=y(b,(function(e){return!(fn(e)||mn(e)||em(o,e)||em(s,e))})),_=y(b,(function(e){return!fn(e)&&!mn(e)&&em(o,e)})),E=[],k=[];x.length&&(d=Kf(vn(vt(x))),p=r-w[Gf[n]]+d[Gf[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),_.length&&(h=Kf(vn(vt(_))),p=r-h[Gf[Yf[n]]]+w[Gf[Yf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,p):p:"w"===n?c.right=l=u(l)?Math.min(l,p):p:"s"===n?c.top=a=u(a)?Math.max(a,p):p:"e"===n&&(c.left=a=u(a)?Math.max(a,p):p)),v&&v.length&&(v.forEach((function(e){em(o,e)?E.push(e):k.push(e)})),E.length&&(f=vn(vt(E.map(xn))),m=w[Gf[Yf[n]]]-(f[Gf[Yf[n]]]-r)),k.length&&(g=vn(vt(k.map(xn)))[Gf[n]]-(w[Gf[n]]-r)),"n"===n?(p=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,p):p));var O=i&&i[e.id];O&&("n"===n?(p=r+e[Uf[t]]-O[Uf[t]],c.bottom=l=u(l)?Math.min(l,p):p):"w"===n?(p=r+e[Uf[t]]-O[Uf[t]],c.right=l=u(l)?Math.min(l,p):p):"s"===n?(p=r-e[Uf[t]]+O[Uf[t]],c.top=a=u(a)?Math.max(a,p):p):"e"===n&&(p=r-e[Uf[t]]+O[Uf[t]],c.left=a=u(a)?Math.max(a,p):p))})),c}(l,n,o,i,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:i}));return L(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:i}),ea("resize-"+("x"===n?"ew":"ns")),!0},Zf.prototype.calculateAdjustments=function(e,t,n,r){var i=this._rules,o=[],s=[],a=[],l=[];function c(e){o.includes(e)||o.push(e);var t=e.label;t&&!o.includes(t)&&o.push(t)}v(e,(function(e){if(e.parent&&!mn(e))if(fn(e))l.push(e);else{var o=e[t],p=o+e[Uf[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>r||n<0&&xn(e)[t]<r))a.push(e);else{var u;if(!(n>0&&o>r||n<0&&p<r))return o<r&&p>r&&i.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),v(o,(function(e){var t=e.attachers;t&&v(t,(function(e){c(e)}))}));var p=o.concat(s);return v(a,(function(e){var t=e.host;em(p,t)&&c(e)})),p=o.concat(s),v(l,(function(e){var t=e.source,n=e.target,r=e.label;em(p,t)&&em(p,n)&&r&&c(r)})),{movingShapes:o,resizingShapes:s}},Zf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Zf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var tm="djs-dragging",nm="djs-resizing",rm=Math.max;function im(e,t,n,r,i){function o(e,t){v(e,(function(e){i.addDragger(e,t),n.addMarker(e,tm)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),i=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=Re("g");Oe(a,r.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=Re("path");Oe(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=Re("path");Oe(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),i.crosshairGroup=a})),e.on("spaceTool.selection.move",(function(e){Kn(e.context.crosshairGroup,e.x,e.y)})),e.on("spaceTool.selection.cleanup",(function(e){var t=e.context.crosshairGroup;t&&Ue(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,p=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");Oe(a=Re("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var d=Re("g");Oe(d,r.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),d),o(c,d),o(s.movingConnections=t.filter((function(e){var t=!1;v(c,(function(n){v(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;v(c,(function(t){v(t.incoming,(function(t){e===t&&(n=!0)}))}));var r=!1;v(p,(function(t){v(t.outgoing,(function(t){e===t&&(r=!0)}))}));var i=!1;return v(p,(function(t){v(t.incoming,(function(t){e===t&&(i=!0)}))})),fn(e)&&(t||r)&&(n||i)})),d),s.dragGroup=d}if(!s.frameGroup){var h=Re("g");Oe(h,r.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),h);var f=[];v(p,(function(e){var t=i.addFrame(e,h),r=t.getBBox();f.push({element:t,initialBounds:r}),n.addMarker(e,nm)})),s.frameGroup=h,s.frames=f}Oe(a,{d:{x:"M"+e.x+", -10000 L"+e.x+", 10000",y:"M -10000, "+e.y+" L 10000, "+e.y}[l]});var m={x:e.dx,y:e.dy};m[{x:"y",y:"x"}[s.axis]]=0,Kn(s.dragGroup,m.x,m.y),v(s.frames,(function(e){var t,n,r=e.element,i=e.initialBounds;"e"===s.direction?Oe(r,{width:rm(i.width+m.x,5)}):Oe(r,{width:t=rm(i.width-m.x,5),x:i.x+i.width-t}),"s"===s.direction?Oe(r,{height:rm(i.height+m.y,5)}):Oe(r,{height:n=rm(i.height-m.y,5),y:i.y+i.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,r=t.movingShapes,i=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;v(r,(function(e){n.removeMarker(e,tm)})),v(i,(function(e){n.removeMarker(e,tm)})),a&&(Ue(s),Ue(a)),v(o,(function(e){n.removeMarker(e,nm)})),l&&Ue(l)}))}im.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var om={__init__:["spaceToolPreview"],__depends__:[Nc,$c,qf,Gp,wf],spaceTool:["type",Zf],spaceToolPreview:["type",im]};function sm(e,t){e.invoke(Zf,this),this._canvas=t}sm.$inject=["injector","canvas"],e(sm,Zf),sm.prototype.calculateAdjustments=function(e,t,n,r){var i=this._canvas.getRootElement(),o=e[0]===i?null:e[0],s=[];o&&(s=O(bt(i.children.filter((e=>ki(e,"bpmn:Artifact"))),vt(o))));const a=[...e,...s];var l=Zf.prototype.calculateAdjustments.call(this,a,t,n,r);return l.resizingShapes=l.resizingShapes.filter((function(e){return!ki(e,"bpmn:TextAnnotation")&&(!function(e){return ki(e,"bpmn:Participant")&&!Pi(e).processRef}(e)||!("y"===t&&Ui(e)||"x"===t&&!Ui(e)))})),l};var am={__depends__:[om],spaceTool:["type",sm]};function lm(e,t){this._handlerMap={},this._stack=[],this._stackIdx=-1,this._currentExecution={actions:[],dirty:[],trigger:null},this._injector=t,this._eventBus=e,this._uid=1,e.on(["diagram.destroy","diagram.clear"],(function(){this.clear(!1)}),this)}lm.$inject=["eventBus","injector"],lm.prototype.execute=function(e,t){if(!e)throw new Error("command required");this._currentExecution.trigger="execute";const n={command:e,context:t};this._pushAction(n),this._internalExecute(n),this._popAction()},lm.prototype.canExecute=function(e,t){const n={command:e,context:t},r=this._getHandler(e);let i=this._fire(e,"canExecute",n);if(void 0===i){if(!r)return!1;r.canExecute&&(i=r.canExecute(t))}return i},lm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},lm.prototype.undo=function(){let e,t=this._getUndoAction();if(t){for(this._currentExecution.trigger="undo",this._pushAction(t);t&&(this._internalUndo(t),e=this._getUndoAction(),e&&e.id===t.id);)t=e;this._popAction()}},lm.prototype.redo=function(){let e,t=this._getRedoAction();if(t){for(this._currentExecution.trigger="redo",this._pushAction(t);t&&(this._internalExecute(t,!0),e=this._getRedoAction(),e&&e.id===t.id);)t=e;this._popAction()}},lm.prototype.register=function(e,t){this._setHandler(e,t)},lm.prototype.registerHandler=function(e,t){if(!e||!t)throw new Error("command and handlerCls must be defined");const n=this._injector.instantiate(t);this.register(e,n)},lm.prototype.canUndo=function(){return!!this._getUndoAction()},lm.prototype.canRedo=function(){return!!this._getRedoAction()},lm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},lm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},lm.prototype._internalUndo=function(e){const t=e.command,n=e.context,r=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),r.revert&&this._markDirty(r.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},lm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const r=t?[e+"."+t,t]:[e];let i;n=this._eventBus.createEvent(n);for(const e of r)if(i=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return i},lm.prototype._createId=function(){return this._uid++},lm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},lm.prototype._internalExecute=function(e,t){const n=e.command,r=e.context,i=this._getHandler(n);if(!i)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),i.preExecute&&i.preExecute(r),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),i.execute&&this._markDirty(i.execute(r)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),i.postExecute&&i.postExecute(r),this._fire(n,"postExecuted",e)),this._popAction()},lm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,r=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=r&&r.id||this._createId()),n.push(e)},lm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,r=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:S("id",r.reverse())}),r.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},lm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},lm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},lm.prototype._revertedAction=function(e){this._stackIdx--},lm.prototype._getHandler=function(e){return this._handlerMap[e]},lm.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 cm={commandStack:["type",lm]};function pm(e,t){if("function"!=typeof t)throw new Error("removeFn iterator must be a function");if(e){for(var n;n=e[0];)t(n);return e}}function um(e,t,n){Uo.call(this,t);var r=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,r=t.validatedShapes;t.shapes=dm(n),t.validatedShapes=dm(r)})),r&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,i=[];v(n,(function(e){v(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||i.push(n),e.labelTarget&&i.push(e)}))})),v(i,(function(e){r.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,r=[];v(n,(function(e){v(e.labels,(function(e){n[e.id]||r.push(e)}))})),t.addAll(r)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;pm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,r=n.labelTarget;r&&(t.labelTargetIndex=St(r.labels,n),t.labelTarget=r,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,r=t.labelTarget,i=t.labelTargetIndex;r&&(Pt(r.labels,n,i),n.labelTarget=r)}))}function dm(e){return y(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(um,Uo),um.$inject=["injector","eventBus","modeling"];var hm={__init__:["labelSupport"],labelSupport:["type",um]},fm="attach-ok";function mm(e,t,n,r,i){Uo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,r=e.context,i=r.shapes,o=r.validatedShapes;r.shapes=(n=gm(t=i),C("id",t,n)),r.validatedShapes=function(e){var t=P(e,"id");return y(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;v(gm(t.shapes),(function(e){o.makeDraggable(t,e,!0),v(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var r=e.context.shapes;if(1===r.length){var i=r[0].host;i&&(n.addMarker(i,fm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(i,fm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;v(gm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,r=t.newHost;r&&1!==n.length||v(r?n:y(n,(function(e){var t,r=e.host;return function(e){return!!e.host}(e)&&(t=r,!(-1!==n.indexOf(t)))})),(function(e){i.updateAttachment(e,r)}))})),this.postExecuted("elements.move",(function(e){v(e.context.shapes,(function(e){v(e.attachers,(function(e){v(e.outgoing.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)})),v(e.incoming.slice(),(function(e){r.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||i.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,r=t.host;r&&i.updateAttachment(n,r)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;pm(n.attachers,(function(e){"attach"===r.allowed("elements.move",{target:o,shapes:[e]})?i.updateAttachment(e,o):i.removeShape(e)})),o.attachers.length&&v(o.attachers,(function(e){var t=dd(e,n,o);i.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,r=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&v(s,(function(e){var t=dd(e,r,o);i.moveShape(e,t,e.parent),v(e.labels,(function(e){i.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;pm(t.attachers,(function(e){i.removeShape(e)})),t.host&&i.updateAttachment(t,null)}))}function gm(e){return r(E(e,(function(e){return e.attachers||[]})))}e(mm,Uo),mm.$inject=["injector","eventBus","canvas","rules","modeling"];var ym={__depends__:[$c],__init__:["attachSupport"],attachSupport:["type",mm]};function vm(e){this._model=e}function bm(e,t,n){Uo.call(this,e),this._bpmnFactory=t;var r=this;function i(e){v(e.context.oldRoot.children,(function(e){ki(e,"bpmn:BaseElement")&&r.updateParent(e)}))}function o(e){var t=e.context.shape;ki(t,"bpmn:BaseElement")&&r.updateBounds(t)}function s(e){r.updateConnection(e.context)}function a(e){r.updateConnectionWaypoints(e.context.connection)}function l(e){r.updateAttachment(e.context)}function c(e){const{element:n}=e.context,r=no(n),i=Si(n),o=i&&i.get("label");Zi(n)||ns(n)||(r&&!o?i.set("label",t.create("bpmndi:BPMNLabel")):!r&&o&&i.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,r=e.context,i=r.hints||{};r.cropped||!1===i.createElementsBehavior||((t=r.connection).waypoints=n.getCroppedWaypoints(t),r.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wm((function(e){var t=e.context;r.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],wm((function(e){var t=e.context,n=t.shape||t.connection,i=t.parent||t.newParent;r.updateParent(n,i)}))),this.executed(["canvas.updateRoot"],i),this.reverted(["canvas.updateRoot"],i),this.executed(["shape.move","shape.create","shape.resize"],wm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],wm((function(e){"label"!==e.context.shape.type&&o(e)}))),e.on("shape.changed",(function(e){"label"===e.element.type&&o({context:{shape:e.element}})})),this.executed(["connection.create","connection.move","connection.delete","connection.reconnect"],wm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],wm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],wm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],wm(a)),this.executed("connection.reconnect",wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Pi(n),s=Pi(r),a=Pi(i);o.conditionExpression&&!Oi(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),r!==i&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",wm((function(e){var t=e.context,n=t.connection,r=t.oldSource,i=t.newSource,o=Pi(n),s=Pi(r),a=Pi(i);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],wm(l)),this.reverted(["element.updateAttachment"],wm(l)),this.executed("element.updateLabel",wm(c)),this.reverted("element.updateLabel",wm(c))}function wm(e){return function(t){var n=t.context;ki(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function xm(e,t){Un.call(this),this._bpmnFactory=e,this._moddle=t}function _m(e,t,n){return void 0===t[n]?t:(e[n]=t[n],q(t,[n]))}function Em(e,t){this._modeling=e,this._canvas=t}function km(e){this._modeling=e}function Om(e,t){this._canvas=e,this._layouter=t}vm.$inject=["moddle"],vm.prototype._needsId=function(e){return Oi(e,["bpmn:RootElement","bpmn:FlowElement","bpmn:MessageFlow","bpmn:DataAssociation","bpmn:Artifact","bpmn:Participant","bpmn:Lane","bpmn:LaneSet","bpmn:Process","bpmn:Collaboration","bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane","bpmn:Property","bpmn:CategoryValue"])},vm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=ki(e,"bpmn:Activity")?"Activity":ki(e,"bpmn:Event")?"Event":ki(e,"bpmn:Gateway")?"Gateway":Oi(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},vm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},vm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},vm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",L({bpmnElement:e,bounds:this.createDiBounds()},t))},vm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},vm.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},vm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",B(e,["x","y"]))},vm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",L({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},vm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",L({bpmnElement:e},t))},e(bm,Uo),bm.$inject=["eventBus","bpmnFactory","connectionDocking"],bm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,r=t.host;n.attachedToRef=r&&r.businessObject},bm.prototype.updateParent=function(e,t){if(!(mn(e)||ki(e,"bpmn:DataStoreReference")&&e.parent&&ki(e.parent,"bpmn:Collaboration"))){var n=e.parent,r=e.businessObject,i=Si(e),o=n&&n.businessObject,s=Si(n);ki(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(r,o,t&&t.businessObject),ki(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),ki(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(r,o),ki(e,"bpmn:DataObjectReference")&&r.dataObjectRef&&this.updateSemanticParent(r.dataObjectRef,o),this.updateDiParent(i,s)}},bm.prototype.updateBounds=function(e){var t=Si(e),n=function(e){if(!ki(e,"bpmn:Activity"))return;var t=Si(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var r=oa(n,t.get("bounds"));L(n,{x:e.x+r.x,y:e.y+r.y})}var i=mn(e)?this._getLabel(t):t,o=i.bounds;o||(o=this._bpmnFactory.createDiBounds(),i.set("bounds",o)),L(o,{x:e.x,y:e.y,width:e.width,height:e.height})},bm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(ki(n,"bpmn:Lane")&&Ot(n.get("flowNodeRef"),e),ki(t,"bpmn:Lane")&&Pt(t.get("flowNodeRef"),e))},bm.prototype.updateDiConnection=function(e,t,n){var r=Si(e),i=Si(t),o=Si(n);r.sourceElement&&r.sourceElement.bpmnElement!==Pi(t)&&(r.sourceElement=t&&i),r.targetElement&&r.targetElement.bpmnElement!==Pi(n)&&(r.targetElement=n&&o)},bm.prototype.updateDiParent=function(e,t){if(t&&!ki(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(Ot(n,e),e.$parent=null)}},bm.prototype.getLaneSet=function(e){var t,n;return ki(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(ki(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},bm.prototype.updateSemanticParent=function(e,t,n){var r;if(e.$parent!==t&&(!ki(e,"bpmn:DataInput")&&!ki(e,"bpmn:DataOutput")||(ki(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(ki(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),r="lanes";else if(ki(e,"bpmn:FlowElement")){if(t)if(ki(t,"bpmn:Participant"))t=t.processRef;else if(ki(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(ki(t,"bpmn:Lane"));r="flowElements"}else if(ki(e,"bpmn:Artifact")){for(;t&&!ki(t,"bpmn:Process")&&!ki(t,"bpmn:SubProcess")&&!ki(t,"bpmn:Collaboration");){if(ki(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}r="artifacts"}else if(ki(e,"bpmn:MessageFlow"))r="messageFlows";else if(ki(e,"bpmn:Participant")){r="participants";var i,o=e.processRef;o&&(i=function(e){for(;e&&!ki(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(Ot(i.get("rootElements"),o),o.$parent=null),t&&(Pt(i.get("rootElements"),o),o.$parent=i))}else ki(e,"bpmn:DataOutputAssociation")?r="dataOutputAssociations":ki(e,"bpmn:DataInputAssociation")&&(r="dataInputAssociations");if(!r)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&Ot(s=e.$parent.get(r),e),t?((s=t.get(r)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(r);Ot(s,e),t&&(a||(a=[],t.set(r,a)),a.push(e))}}},bm.prototype.updateConnectionWaypoints=function(e){Si(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},bm.prototype.updateConnection=function(e){var t,n=e.connection,r=Pi(n),i=n.source,o=Pi(i),s=n.target,a=Pi(n.target);if(ki(r,"bpmn:DataAssociation"))ki(r,"bpmn:DataInputAssociation")?(r.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(r,a,t)):ki(r,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(r,o,t),r.targetRef=a);else{var l=ki(r,"bpmn:SequenceFlow");r.sourceRef!==o&&(l&&(Ot(r.sourceRef&&r.sourceRef.get("outgoing"),r),o&&o.get("outgoing")&&o.get("outgoing").push(r)),r.sourceRef=o),r.targetRef!==a&&(l&&(Ot(r.targetRef&&r.targetRef.get("incoming"),r),a&&a.get("incoming")&&a.get("incoming").push(r)),r.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,i,s)},bm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(xm,Un),xm.$inject=["bpmnFactory","moddle"],xm.prototype._baseCreate=Un.prototype.create,xm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,L({type:"label",di:n},Yi,t))}return this.createElement(e,t)},xm.prototype.createElement=function(e,t){var n,r,i,o=(t=L({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");xi(o=this._bpmnFactory.create(t.type))}if(!Oi(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=L({},s||{},{id:o.id+"_di"});s="root"===e?this._bpmnFactory.createDiPlane(o,l):"connection"===e?this._bpmnFactory.createDiEdge(o,l):this._bpmnFactory.createDiShape(o,l)}return ki(o,"bpmn:Group")&&(t=L({isFrame:!0},t)),t=function(e,t,n){return v(n,(function(n){t=_m(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=_m(s,t,"isExpanded")),Oi(o,["bpmn:Lane","bpmn:Participant"])&&(t=_m(s,t,"isHorizontal")),ki(o,"bpmn:SubProcess")&&(t.collapsed=!Hi(o,s)),ki(o,"bpmn:ExclusiveGateway")&&(f(s,"isMarkerVisible")?void 0===s.isMarkerVisible&&(s.isMarkerVisible=!1):s.isMarkerVisible=!0),a(t.triggeredByEvent)&&(o.triggeredByEvent=t.triggeredByEvent,delete t.triggeredByEvent),a(t.cancelActivity)&&(o.cancelActivity=t.cancelActivity,delete t.cancelActivity),t.eventDefinitionType&&(r=o.get("eventDefinitions")||[],i=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(i.condition=this._bpmnFactory.create("bpmn:FormalExpression")),r.push(i),i.$parent=o,o.eventDefinitions=r,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=L({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},xm.prototype.getDefaultSize=function(e,t){var n=Pi(e);if(t=t||Si(e),ki(n,"bpmn:SubProcess"))return Hi(n,t)?{width:350,height:200}:{width:100,height:80};if(ki(n,"bpmn:Task"))return{width:100,height:80};if(ki(n,"bpmn:Gateway"))return{width:50,height:50};if(ki(n,"bpmn:Event"))return{width:36,height:36};if(ki(n,"bpmn:Participant")){var r=void 0===t.isHorizontal||!0===t.isHorizontal;return Hi(n,t)?r?{width:600,height:250}:{width:250,height:600}:r?{width:400,height:60}:{width:60,height:400}}return ki(n,"bpmn:Lane")?{width:400,height:100}:ki(n,"bpmn:DataObjectReference")?{width:36,height:50}:ki(n,"bpmn:DataStoreReference")?{width:50,height:50}:ki(n,"bpmn:TextAnnotation")?{width:100,height:30}:ki(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},xm.prototype.createParticipantShape=function(e){return p(e)||(e={isExpanded:e}),!1!==(e=L({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},Em.$inject=["modeling","canvas"],Em.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,r=e.alignment;v(n,(function(e){var n={x:0,y:0};a(r.left)?n.x=r.left-e.x:a(r.right)?n.x=r.right-e.width-e.x:a(r.center)?n.x=r.center-Math.round(e.width/2)-e.x:a(r.top)?n.y=r.top-e.y:a(r.bottom)?n.y=r.bottom-e.height-e.y:a(r.middle)&&(n.y=r.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},Em.prototype.postExecute=function(e){},km.$inject=["modeling"],km.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,r=e.shape,i=e.hints||{};r=e.shape=this._modeling.createShape(r,e.position,n,{attach:i.attach}),e.shape=r},km.prototype.postExecute=function(e){var t,n,r=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(r.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},Om.$inject=["canvas","layouter"],Om.prototype.execute=function(e){var t=e.connection,n=e.source,r=e.target,i=e.parent,o=e.parentIndex,s=e.hints;if(!n||!r)throw new Error("source and target required");if(!i)throw new Error("parent required");return t.source=n,t.target=r,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,i,o),t},Om.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var Pm=Math.round;function Sm(e){this._modeling=e}Sm.$inject=["modeling"],Sm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,r=e.parentIndex,i=e.position,o=e.hints,s=this._modeling;v(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(y(t,(function(e){return!e.hidden})));v(t,(function(e){fn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:Pm(e.x-a.x-a.width/2+i.x),y:Pm(e.y-a.y-a.height/2+i.y)}}))),L(e,{x:Pm(e.x-a.x-a.width/2+i.x),y:Pm(e.y-a.y-a.height/2+i.y)})}));var l=ht(t),c={};v(t,(function(e){if(fn(e))c[e.id]=u(r)?s.createConnection(c[e.source.id],c[e.target.id],r,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=L({},o);-1===l.indexOf(e)&&(t.autoResize=!1),mn(e)&&(t=q(t,["attach"])),c[e.id]=u(r)?s.createShape(e,B(e,["x","y","width","height"]),e.parent||n,r,t):s.createShape(e,B(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var Cm=Math.round;function Tm(e){this._canvas=e}function Mm(e){Tm.call(this,e)}Tm.$inject=["canvas"],Tm.prototype.execute=function(e){var t=e.shape,n=e.position,r=e.parent,i=e.parentIndex;if(!r)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?L(t,n):L(t,{x:n.x-Cm(t.width/2),y:n.y-Cm(t.height/2)}),this._canvas.addShape(t,r,i),t},Tm.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(Mm,Tm),Mm.$inject=["canvas"];var Am=Tm.prototype.execute;Mm.prototype.execute=function(e){var t=e.shape;return function(e){["width","height"].forEach((function(t){void 0===e[t]&&(e[t]=0)}))}(t),t.labelTarget=e.labelTarget,Am.call(this,e)};var Dm=Tm.prototype.revert;function Nm(e,t){this._canvas=e,this._modeling=t}function Rm(e,t){this._modeling=e,this._elementRegistry=t}function jm(e,t){this._canvas=e,this._modeling=t}function Im(e){this._modeling=e}Mm.prototype.revert=function(e){return e.shape.labelTarget=null,Dm.call(this,e)},Nm.$inject=["canvas","modeling"],Nm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;pm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Nm.prototype.execute=function(e){var t=e.connection,n=t.parent;return e.parent=n,e.parentIndex=St(n.children,t),e.source=t.source,e.target=t.target,this._canvas.removeConnection(t),t.source=null,t.target=null,t},Nm.prototype.revert=function(e){var t=e.connection,n=e.parent,r=e.parentIndex;return t.source=e.source,t.target=e.target,Pt(n.children,t,r),this._canvas.addConnection(t,n),t},Rm.$inject=["modeling","elementRegistry"],Rm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;v(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},jm.$inject=["canvas","modeling"],jm.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;pm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),pm(n.children,(function(e){fn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},jm.prototype.execute=function(e){var t=this._canvas,n=e.shape,r=n.parent;return e.oldParent=r,e.oldParentIndex=St(r.children,n),t.removeShape(n),n},jm.prototype.revert=function(e){var t=this._canvas,n=e.shape,r=e.oldParent,i=e.oldParentIndex;return Pt(r.children,n,i),t.addShape(n,r),n},Im.$inject=["modeling"];var Lm={x:"y",y:"x"};function $m(e,t){this._layouter=e,this._canvas=t}function zm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function qm(e){this._modeling=e}function Fm(e){this._helper=new qm(e)}function Vm(e){this._modeling=e,this._helper=new qm(e)}function Hm(e){this._modeling=e}function Um(e){return e.original||e}function Wm(e,t){this._modeling=e,this._rules=t}function Gm(e){this._modeling=e}function Qm(e){this._modeling=e}function Ym(e){return L({},e)}function Xm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Zm(e,t,n){var r=Xm(n);return/e|s/.test(n)?e[r]>t:/n|w/.test(n)?e[r]<t:void 0}function Km(e,t){return-1!==e.indexOf(t)}function Jm(e){this._modeling=e}function eg(e){var t={};return v(e,(function(e){t[e.id]=e.hidden,e.children&&(t=L({},t,eg(e.children)))})),t}function tg(e,t){var n=[];return v(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(tg(e.children,e.collapsed||t)))})),n}function ng(e,t){var n=[];return v(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(ng(e.children,t)))})),n}function rg(e){this._modeling=e}function ig(e,t){return Ot(e&&e.attachers,t)}function og(e,t,n){if(e){var r=e.attachers;r||(e.attachers=r=[]),Pt(r,t,n)}}function sg(){}function ag(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var r=this;e.on("diagram.init",(function(){r.registerHandlers(n)}))}function lg(e){this._elementRegistry=e}function cg(e,t){v(t,(function(t,n){e.set(n,t)}))}Im.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,r=e.axis,i=e.dimension;function o(e,t){e.range.min=Math.min(t[r],e.range.min),e.range.max=Math.max(t[r]+t[i],e.range.max)}function s(e){return e[r]+e[i]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,p,u=n[0],d=a(n),h=n[d],f=0;v(n,(function(e,c){var p,u,h;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(p=T(e.elements,r))[0],c===d&&(u=p[a(p)]),h=s(u),e.range=null,v(p,(function(n){!function(e,n){var i={y:0};i[r]=e-s(n),i[r]&&(i[Lm[r]]=0,t.moveElements([n],i,n.parent))}(h,n),null!==e.range?o(e,n):e.range={min:n[r],max:n[r]+n[i]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),p=Math.abs(h.range.min-u.range.max),(c=Math.round((p-f)/(n.length-1)))<n.length-1||v(n,(function(e,o){var s,a={};e!==u&&e!==h&&(s=n[o-1],e.range.max=0,v(e.elements,(function(n,o){a[Lm[r]]=0,a[r]=s.range.max-n[r]+c,e.range.min!==n[r]&&(a[r]+=n[r]-e.range.min),a[r]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[r]+n[i],o?e.range.max:0)})))}))},Im.prototype.postExecute=function(e){},$m.$inject=["layouter","canvas"],$m.prototype.execute=function(e){var t=e.connection;return L(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},$m.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},zm.prototype.execute=function(e){var t=e.connection,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x+=n.x,e.y+=n.y,e.original&&(e.original.x+=n.x,e.original.y+=n.y)})),t},zm.prototype.revert=function(e){var t=e.connection,n=t.parent,r=e.oldParent,i=e.oldParentIndex,o=e.delta;return Ot(n.children,t),Pt(r.children,t,i),t.parent=r,v(t.waypoints,(function(e){e.x-=o.x,e.y-=o.y,e.original&&(e.original.x-=o.x,e.original.y-=o.y)})),t},Bm.prototype.add=function(e,t){return this.addAll([e],t)},Bm.prototype.addAll=function(e,t){var n=function(e,t,n){s(t)&&(t=!0),p(t)&&(n=t,t=!0);var r=_t((n=n||{}).allShapes),i=_t(n.allConnections),o=_t(n.enclosedElements),a=_t(n.enclosedConnections),l=_t(n.topLevel,t&&P(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),r[e.source.id]&&r[e.target.id]&&(a[e.id]=o[e.id]=e),i[e.id]=e}return gt(e,(function(e){if(o[e.id]=e,!e.waypoints)return r[e.id]=e,v(e.incoming,c),v(e.outgoing,c),e.children;a[e.id]=i[e.id]=e})),{allShapes:r,allConnections:i,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return L(this,n),this},qm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},qm.prototype.moveClosure=function(e,t,n,r,i){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,p=!1;i&&i.parent===n&&(p=!0),v(s,(function(e){o.moveShape(e,t,c[e.id]&&!p&&n,{recurse:!1,layout:!1})})),v(a,(function(e){var r=!!s[e.source.id],i=!!s[e.target.id];l[e.id]&&r&&i?o.moveConnection(e,t,c[e.id]&&!p&&n):o.layoutConnection(e,{connectionStart:r&&wd(e,e.source,t),connectionEnd:i&&xd(e,e.target,t)})}))},qm.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},Fm.$inject=["modeling"],Fm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Fm.prototype.postExecute=function(e){var t,n=e.hints;n&&n.primaryShape&&(t=n.primaryShape,n.oldParent=t.parent),this._helper.moveClosure(e.closure,e.delta,e.newParent,e.newHost,t)},Vm.$inject=["modeling"],Vm.prototype.execute=function(e){var t=e.shape,n=e.delta,r=e.newParent||t.parent,i=e.newParentIndex,o=t.parent;return e.oldBounds=B(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=Ot(o.children,t),Pt(r.children,t,i),L(t,{parent:r,x:t.x+n.x,y:t.y+n.y}),t},Vm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,r=e.hints,i=this._modeling;!1!==r.layout&&(v(t.incoming,(function(e){i.layoutConnection(e,{connectionEnd:xd(e,t,n)})})),v(t.outgoing,(function(e){i.layoutConnection(e,{connectionStart:wd(e,t,n)})}))),!1!==r.recurse&&this.moveChildren(e)},Vm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,r=e.oldParentIndex,i=e.delta;return Pt(n.children,t,r),L(t,{parent:n,x:t.x-i.x,y:t.y-i.y}),t},Vm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},Vm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},Hm.$inject=["modeling"],Hm.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,r=e.connection,i=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(i)&&(e.oldWaypoints=r.waypoints,r.waypoints=i),t&&(e.oldSource=r.source,r.source=t),n&&(e.oldTarget=r.target,r.target=n),r},Hm.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,r=e.newTarget,i=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||r&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Um(c(i)?i[0]:i)),!r||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Um(c(i)?i[i.length-1]:i)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},Hm.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,r=e.oldWaypoints,i=e.connection;return t&&(i.source=t),n&&(i.target=n),r&&(i.waypoints=r),i},Wm.$inject=["modeling","rules"],Wm.prototype.preExecute=function(e){var t,n=this,r=this._modeling,i=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return i.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,p={x:s.x,y:s.y},u={x:o.x,y:o.y,width:o.width,height:o.height};t=e.newShape=e.newShape||n.createShape(s,p,o.parent,a),o.host&&r.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),r.moveElements(c,{x:0,y:0},t,a));var d=o.incoming.slice(),h=o.outgoing.slice();v(d,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,bd(e,t,u),a)})),v(h,(function(e){var r=e.target;l(t,r,e)&&n.reconnectStart(e,t,vd(e,t,u),a)}))},Wm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},Wm.prototype.execute=function(e){},Wm.prototype.revert=function(e){},Wm.prototype.createShape=function(e,t,n,r){return this._modeling.createShape(e,t,n,r)},Wm.prototype.reconnectStart=function(e,t,n,r){this._modeling.reconnectStart(e,t,n,r)},Wm.prototype.reconnectEnd=function(e,t,n,r){this._modeling.reconnectEnd(e,t,n,r)},Gm.$inject=["modeling"],Gm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,r=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(r&&(n.width<r.width||n.height<r.height))throw new Error("width and height cannot be less than minimum height and width");if(!r&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Gm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,r=e.oldBounds;!1!==(e.hints||{}).layout&&(v(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:bd(e,n,r)})})),v(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:vd(e,n,r)})})))},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return L(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Qm.$inject=["modeling"],Qm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,r=e.movingShapes,i=e.resizingShapes,o=e.start,s={};this.moveShapes(r,t),v(i,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(i,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return v(e.concat(t),(function(r){var i=r.incoming,o=r.outgoing;v(i.concat(o),(function(r){var i=r.source,o=r.target;(Ff(e,i)||Ff(e,o)||Ff(t,i)||Ff(t,o))&&(Ff(n,r)||n.push(r))}))})),n}(r,i),t,n,o,r,i,s)},Qm.prototype.execute=function(){},Qm.prototype.revert=function(){},Qm.prototype.moveShapes=function(e,t){var n=this;v(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Qm.prototype.resizeShapes=function(e,t,n){var r=this;v(e,(function(e){var i=function(e,t,n){var r=e.x,i=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:r,y:i+l,width:o,height:s-l};case"s":return{x:r,y:i,width:o,height:s+l};case"w":return{x:r+a,y:i,width:o-a,height:s};case"e":return{x:r,y:i,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);r._modeling.resizeShape(e,i,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Qm.prototype.updateConnectionWaypoints=function(e,t,n,r,i,o,s){var a=this,l=i.concat(o);v(e,(function(e){var c=e.source,p=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=Ym(e)).original&&(e.original=Ym(e.original)),e}))}(e),d=Xm(n),h={};Km(l,c)&&Km(l,p)?(u=E(u,(function(e){return Zm(e,r,n)&&(e[d]=e[d]+t[d]),e.original&&Zm(e.original,r,n)&&(e.original[d]=e.original[d]+t[d]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Km(l,c)||Km(l,p))&&(Km(i,c)?h.connectionStart=wd(e,c,t):Km(i,p)?h.connectionEnd=xd(e,p,t):Km(o,c)?h.connectionStart=vd(e,c,s[c.id]):Km(o,p)&&(h.connectionEnd=bd(e,p,s[p.id])),a._modeling.layoutConnection(e,h))}))},Jm.$inject=["modeling"],Jm.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=eg(n),t.collapsed=!t.collapsed;var r=tg(n,t.collapsed);return[t].concat(r)},Jm.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,r=ng(t.children,n);return t.collapsed=!t.collapsed,[t].concat(r)},rg.$inject=["modeling"],rg.prototype.execute=function(e){var t=e.shape,n=e.newHost,r=t.host;return e.oldHost=r,e.attacherIdx=ig(r,t),og(n,t),t.host=n,t},rg.prototype.revert=function(e){var t=e.shape,n=e.newHost,r=e.oldHost,i=e.attacherIdx;return t.host=r,ig(n,t),og(r,t,i),t},sg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},sg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},ag.$inject=["eventBus","elementFactory","commandStack"],ag.prototype.getHandlers=function(){return{"shape.append":km,"shape.create":Tm,"shape.delete":jm,"shape.move":Vm,"shape.resize":Gm,"shape.replace":Wm,"shape.toggleCollapse":Jm,spaceTool:Qm,"label.create":Mm,"connection.create":Om,"connection.delete":Nm,"connection.move":zm,"connection.layout":$m,"connection.updateWaypoints":sg,"connection.reconnect":Hm,"elements.create":Sm,"elements.move":Fm,"elements.delete":Rm,"elements.distribute":Im,"elements.align":Em,"element.updateAttachment":rg}},ag.prototype.registerHandlers=function(e){v(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},ag.prototype.moveShape=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=null);var o={shape:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("shape.move",o)},ag.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},ag.prototype.moveElements=function(e,t,n,r){var i,o=(r=r||{}).attach,s=n;!0===o?(i=n,s=n.parent):!1===o&&(i=null);var a={shapes:e,delta:t,newParent:s,newHost:i,hints:r};this._commandStack.execute("elements.move",a)},ag.prototype.moveConnection=function(e,t,n,r,i){"object"==typeof r&&(i=r,r=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:r,hints:i||{}};this._commandStack.execute("connection.move",o)},ag.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},ag.prototype.createConnection=function(e,t,n,r,i,o){"object"==typeof n&&(o=i,i=r,r=n,n=void 0);var s={source:e,target:t,parent:i,parentIndex:n,connection:r=this._create("connection",r),hints:o};return this._commandStack.execute("connection.create",s),s.connection},ag.prototype.createShape=function(e,t,n,r,i){"number"!=typeof r&&(i=r,r=void 0);var o,s,a=(i=i||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:r,host:s,hints:i};return this._commandStack.execute("shape.create",l),l.shape},ag.prototype.createElements=function(e,t,n,r,i){c(e)||(e=[e]),"number"!=typeof r&&(i=r,r=void 0);var o={position:t,elements:e,parent:n,parentIndex:r,hints:i=i||{}};return this._commandStack.execute("elements.create",o),o.elements},ag.prototype.createLabel=function(e,t,n,r){n=this._create("label",n);var i={labelTarget:e,position:t,parent:r||e.parent,shape:n};return this._commandStack.execute("label.create",i),i.shape},ag.prototype.appendShape=function(e,t,n,r,i){i=i||{};var o={source:e,position:n,target:r,shape:t=this._create("shape",t),connection:i.connection,connectionParent:i.connectionParent,hints:i};return this._commandStack.execute("shape.append",o),o.shape},ag.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},ag.prototype.distributeElements=function(e,t,n){var r={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",r)},ag.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},ag.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},ag.prototype.replaceShape=function(e,t,n){var r={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",r),r.newShape},ag.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},ag.prototype.resizeShape=function(e,t,n,r){var i={shape:e,newBounds:t,minBounds:n,hints:r};this._commandStack.execute("shape.resize",i)},ag.prototype.createSpace=function(e,t,n,r,i){var o={delta:n,direction:r,movingShapes:e,resizingShapes:t,start:i};this._commandStack.execute("spaceTool",o)},ag.prototype.updateWaypoints=function(e,t,n){var r={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",r)},ag.prototype.reconnect=function(e,t,n,r,i){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:r,hints:i||{}};this._commandStack.execute("connection.reconnect",o)},ag.prototype.reconnectStart=function(e,t,n,r){r||(r={}),this.reconnect(e,t,e.target,n,L(r,{docking:"source"}))},ag.prototype.reconnectEnd=function(e,t,n,r){r||(r={}),this.reconnect(e,e.source,t,n,L(r,{docking:"target"}))},ag.prototype.connect=function(e,t,n,r){return this.createConnection(e,t,n||{},e.parent,r)},ag.prototype._create=function(e,t){return t instanceof zn?t:this._elementFactory.create(e,t)},ag.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},lg.$inject=["elementRegistry"],lg.prototype.execute=function(e){var t=e.element,n=e.moddleElement,r=e.properties;if(!n)throw new Error("<moddleElement> required");var i=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return w(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,k(r));return cg(n,r),e.oldProperties=o,e.changed=i,i},lg.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,r=e.changed;return cg(n,t),r},lg.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return ki(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return ki(t,"bpmn:DataObjectReference")&&Pi(t).dataObjectRef===e}))}(e,t):[]};var pg="default",ug="id",dg="di",hg={width:0,height:0};function fg(e,t,n,r){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=r}function mg(e,t){return ug in e&&e[ug]!==t[ug]}function gg(e,t){var n=e.businessObject,r=Si(e);v(t,(function(e,t){t!==dg?n.set(t,e):r&&function(e,t){v(t,(function(t,n){e.set(n,t)}))}(r,e)}))}fg.$inject=["elementRegistry","moddle","modeling","textRenderer"],fg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var r=this._elementRegistry,i=this._moddle.ids,o=t.businessObject,s=function(e){var t=L({},e);return yg.forEach((function(n){n in e&&(t[n]=Pi(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=k(t),r=e.businessObject,i=Si(e);return w(n,(function(e,n){return e[n]=n!==dg?r.get(n):function(e,t){return w(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(i,k(t.di)),e}),{})}(t,s);return mg(s,o)&&(i.unclaim(o[ug]),r.updateId(t,s[ug]),i.claim(s[ug],o)),pg in s&&(s[pg]&&n.push(r.get(s[pg].id)),o[pg]&&n.push(r.get(o[pg].id))),gg(t,s),e.oldProperties=a,e.changed=n,n},fg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Pi(t).name;if(n){var r=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,r,hg)}},fg.prototype.revert=function(e){var t=e.element,n=e.properties,r=e.oldProperties,i=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return gg(t,r),mg(n,i)&&(s.unclaim(n[ug]),o.updateId(t,r[ug]),s.claim(r[ug],i)),e.changed};var yg=["default"];function vg(e,t){this._canvas=e,this._modeling=t}function bg(e,t){this._modeling=e,this._spaceTool=t}function wg(e){this._modeling=e}function xg(e,t){this._modeling=e,this._spaceTool=t}vg.$inject=["canvas","modeling"],vg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=t.getRootElement(),o=i.businessObject,s=o.$parent,a=Si(i);return t.setRootElement(n),t.removeRootElement(i),Pt(s.rootElements,r),r.$parent=s,Ot(s.rootElements,o),o.$parent=null,i.di=null,a.bpmnElement=r,n.di=a,e.oldRoot=i,[]},vg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,r=n.businessObject,i=e.oldRoot,o=i.businessObject,s=r.$parent,a=Si(n);return t.setRootElement(i),t.removeRootElement(n),Ot(s.rootElements,r),r.$parent=null,Pt(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,i.di=a,[]},bg.$inject=["modeling","spaceTool"],bg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,r=e.shape,i=e.location,o=ju(r),s=o===r,a=s?r:r.parent,l=Ru(a),c=Ui(r);if(c?"left"===i?i="top":"right"===i&&(i="bottom"):"top"===i?i="left":"bottom"===i&&(i="right"),!l.length){var p=c?{x:r.x+Du,y:r.y,width:r.width-Du,height:r.height}:{x:r.x,y:r.y+Du,width:r.width,height:r.height-Du};n.createShape({type:"bpmn:Lane",isHorizontal:c},p,a)}var u,d,h,f,m,g=[];gt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===r?[]:y(e.children,(function(e){return e!==r}))})),"top"===i?(u=-120,h=(d=r.y)+10,f="n",m="y"):"left"===i?(u=-120,h=(d=r.x)+10,f="w",m="x"):"bottom"===i?(u=120,h=(d=r.y+r.height)-10,f="s",m="y"):"right"===i&&(u=120,h=(d=r.x+r.width)-10,f="e",m="x");var v=t.calculateAdjustments(g,m,u,h),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(v.movingShapes,v.resizingShapes,b,f,h);var w=c?{x:r.x+(s?Du:0),y:d-("top"===i?120:0),width:r.width-(s?Du:0),height:120}:{x:d-("left"===i?120:0),y:r.y+(s?Du:0),width:120,height:r.height-(s?Du:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},w,a)},wg.$inject=["modeling"],wg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,r=e.count,i=Ru(n),o=i.length;if(o>r)throw new Error(`more than <${r}> child lanes`);var s,a,l,c,p=Ui(n),u=p?n.height:n.width,d=Math.round(u/r);for(c=0;c<r;c++)s=c===r-1?u-d*c:d,a=p?{x:n.x+Du,y:n.y+c*d,width:n.width-Du,height:s}:{x:n.x+c*d,y:n.y+Du,width:s,height:n.height-Du},c<o?t.resizeShape(i[c],a):(l={type:"bpmn:Lane",isHorizontal:p},t.createShape(l,a,n))},xg.$inject=["modeling","spaceTool"],xg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},xg.prototype.resizeBalanced=function(e,t){var n=this._modeling,r=Iu(e,t);n.resizeShape(e,t),r.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},xg.prototype.resizeSpace=function(e,t){var n,r,i,o,s,a=this._spaceTool,l=vn(e),c=Ou(vn(t),l),p=ju(e),u=[],d=[];gt(p,(function(e){return u.push(e),(ki(e,"bpmn:Lane")||ki(e,"bpmn:Participant"))&&d.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,r=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),i=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},i)),(c.left||c.right)&&(n=c.right||c.left,r=e.x+(c.right?e.width:0)+(c.right?-10:100),i=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(d,"x",o,r),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},i))};var _g="flowNodeRef",Eg="lanes";function kg(e){this._elementRegistry=e}function Og(e){this._moddle=e}kg.$inject=["elementRegistry"],kg.prototype._computeUpdates=function(e,t){var n=[],r=[],i={},o=[];function s(e){-1===n.indexOf(e)&&(o.push(e),n.push(e))}function a(e){if(!e.parent)return[];var t=function(e){var t=ju(e);return i[t.id]||(i[t.id]=Nu(t)),i[t.id]}(e);return t.filter((function(t){return n=e,r=vn(t),i=n.x+n.width/2,o=n.y+n.height/2,i>r.left&&i<r.right&&o>r.top&&o<r.bottom;var n,r,i,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=ju(e);if(t&&-1===n.indexOf(t)){var r=t.children.filter((function(e){return ki(e,"bpmn:FlowNode")}));r.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(Eg).slice(),i=a(e);r.push({flowNode:t,remove:n,add:i})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(_g).forEach((function(e){r.push({flowNode:e,remove:[t],add:[]})}))})),r},kg.prototype.execute=function(e){var t=e.updates;return t||(t=e.updates=this._computeUpdates(e.flowNodeShapes,e.laneShapes)),t.forEach((function(e){var t=e.flowNode,n=t.get(Eg);e.remove.forEach((function(e){Ot(n,e),Ot(e.get(_g),t)})),e.add.forEach((function(e){Pt(n,e),Pt(e.get(_g),t)}))})),[]},kg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(Eg);e.add.forEach((function(e){Ot(n,e),Ot(e.get(_g),t)})),e.remove.forEach((function(e){Pt(n,e),Pt(e.get(_g),t)}))})),[]},Og.$inject=["moddle"],Og.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.claim(n,r):t.unclaim(n),[]},Og.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,r=e.element;return e.claiming?t.unclaim(n):t.claim(n,r),[]};var Pg={fill:void 0,stroke:void 0};function Sg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(h(e)){var t=function(e){var t=document.createElement("canvas").getContext("2d");return t.fillStyle="transparent",t.fillStyle=e,/^#[0-9a-fA-F]{6}$/.test(t.fillStyle)?t.fillStyle:null}(e);if(t)return t}throw new Error(`invalid color value: ${e}`)}}}Sg.$inject=["commandStack"],Sg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||Pg,r=this,i={};"fill"in n&&L(i,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&L(i,{"border-color":this._normalizeColor(n.stroke)}),v(t,(function(e){var t=fn(e)?B(i,["border-color"]):i,n=Si(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),mn(e))r._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:i["border-color"]}});else{if(!Oi(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;r._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var Cg={width:0,height:0};function Tg(e,t,n){function r(e,t){var n=e.label||e,r=e.labelTarget||e;return ro(n,t),[n,r]}this.preExecute=function(t){var n=t.element,r=n.businessObject,i=t.newLabel;if(!mn(n)&&Zi(n)&&!Ki(n)&&!Mg(i)){var o=eo(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:r.id+"_label",businessObject:r,di:n.di})}},this.execute=function(e){return e.oldLabel=no(e.element),r(e.element,e.newLabel)},this.revert=function(e){return r(e.element,e.oldLabel)},this.postExecute=function(n){var r=n.element,i=r.label||r,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(mn(i)||ki(i,"bpmn:TextAnnotation"))if(mn(i)&&Mg(o))!1!==a.removeShape&&e.removeShape(i,{unsetLabel:!1});else{var l=no(r);void 0===s&&(s=t.getExternalLabelBounds(i,l)),s&&e.resizeShape(i,s,Cg)}}}function Mg(e){return!e||!e.trim()}function Ag(e,t,n,r){ag.call(this,e,t,n),this._bpmnRules=r}function Dg(){}Tg.$inject=["modeling","textRenderer","bpmnFactory"],e(Ag,ag),Ag.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Ag.prototype.getHandlers=function(){var e=ag.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=lg,e["element.updateProperties"]=fg,e["canvas.updateRoot"]=vg,e["lane.add"]=bg,e["lane.resize"]=xg,e["lane.split"]=wg,e["lane.updateRefs"]=kg,e["id.updateClaim"]=Og,e["element.setColor"]=Sg,e["element.updateLabel"]=Tg,e},Ag.prototype.updateLabel=function(e,t,n,r){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:r||{}})},Ag.prototype.connect=function(e,t,n,r){var i=this._bpmnRules;if(n||(n=i.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,r)},Ag.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Ag.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Ag.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Ag.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Ag.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Ag.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ag.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Ag.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Ag.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Ag.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Ag.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Dg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var Ng=20,Rg=5,jg=Math.round,Ig=20,Lg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function $g(e,t,n){var r,i,o,s=_n(t,e,Rg),a=n.split(":")[0],l=jg((t.x-e.x)/2+e.x),c=jg((t.y-e.y)/2+e.y),p=(o=s,{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/left|right/,v:/top|bottom/}[a].test(o)),u=/h|r|l/.test(a),d=!1,h=!1;return p?(r=u?{x:l,y:e.y}:{x:e.x,y:c},i=u?"h:h":"v:v"):(d=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),i=u?"h:v":"v:h",d?u?(h=c===e.y,r={x:e.x+Ng*(/l/.test(a)?-1:1),y:h?c+Ng:c}):r={x:(h=l===e.x)?l+Ng:l,y:e.y+Ng*(/t/.test(a)?-1:1)}:r={x:l,y:c}),{waypoints:Bg(e,r,i).concat(r),directions:i,turnNextDirections:h}}function zg(e){return e.split(":").reverse().join(":")}function Bg(e,t,n){if(!function(e){return e&&/^h|v|t|r|b|l:h|v|t|r|b|l$/.test(e)}(n=n||"h:h"))throw new Error("unknown directions: <"+n+">: must be specified as <start>:<end> with start/end in { h,v,t,r,b,l }");if(Ug(n)){var r=function(e,t,n){return $g(e,t,n)}(e,t,n),i=function(e,t,n){var r=$g(t,e,zg(n));return{waypoints:r.waypoints.slice().reverse(),directions:zg(r.directions),turnNextDirections:r.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],r=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(r="h"==r?"v":"h");var i=n+":"+r;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],i),directions:i}}(r,i);return[].concat(r.waypoints,o.waypoints,i.waypoints)}return function(e,t,n){var r=jg((t.x-e.x)/2+e.x),i=jg((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:r,y:e.y},{x:r,y:t.y}];if("v:v"===n)return[{x:e.x,y:i},{x:t.x,y:i}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function qg(e,t,n,r,i){var o=b(i&&i.preferredLayouts||[],"straight")[0]||"h:h",s=_n(e,t,Lg[o]||0),a=function(e,t){if(Ug(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}}(s,o);n=n||xn(e),r=r||xn(t);var l=a.split(":"),c=Wg(n,e,l[0],function(e){return{top:"bottom",bottom:"top",left:"right",right:"left","top-left":"bottom-right","bottom-right":"top-left","top-right":"bottom-left","bottom-left":"top-right"}[e]}(s));return function(e,t,n){var r=Bg(e,t,n);return r.unshift(e),r.push(t),Gg(r)}(c,Wg(r,t,l[1],s),a)}function Fg(e,t,n,r,i,o){var s;return c(n)&&(i=n,o=r,n=xn(e),r=xn(t)),i=i||[],s=-1!==(o=L({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,r,i){var o,s,a={};if(s=_n(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===i.preserveDocking?Vg(o,r,e)?(a[o]=r[o],[{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y,original:{x:void 0!==a.x?a.x:n.x,y:void 0!==a.y?a.y:n.y}},{x:r.x,y:r.y}]):null:Vg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y,original:{x:void 0!==a.x?a.x:r.x,y:void 0!==a.y?a.y:r.y}}]):null}(e,t,n,r,o),s||(s=o.connectionEnd&&function(e,t,n,r){var i=r.slice().reverse();return i=Hg(e,t,n,i),i?i.reverse():null}(t,e,r,i),s||((s=o.connectionStart&&Hg(e,t,n,i))||(!o.connectionStart&&!o.connectionEnd&&i&&i.length?i:qg(e,t,n,r,o))))}function Vg(e,t,n){return function(e,t,n){return e>=t&&e<=n}(t[e],n[e],n[e]+n[{x:"width",y:"height"}[e]])}function Hg(e,t,n,r){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var r=e[n-1];return r&&Ct(t,r)<3}))}(r))return null;var i,o=r[0],s=r.slice();return s[0]=n,s[1]=function(e,t,n){switch(At(t,e)){case"v":return{x:n.x,y:e.y};case"h":return{x:e.x,y:n.y}}return{x:e.x,y:e.y}}(s[1],o,n),i=function(e,t,n){var r;for(r=e.length-2;0!==r;r--)if(Nt(e[r],t,Ig)||Nt(e[r],n,Ig))return e.slice(r);return e}(s,e,t),i!==s&&(s=Hg(e,t,n,i)),s&&At(s)?null:s}function Ug(e){return e&&/t|r|b|l/.test(e)}function Wg(e,t,n,r){if("h"===n&&(n=/left/.test(r)?"l":"r"),"v"===n&&(n=/top/.test(r)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Gg(e){return e.reduce((function(t,n,r){return Tt(t[t.length-1],e[r+1],n,0)||t.push(n),t}),[])}var Qg=-10,Yg=40,Xg={default:["h:h"],fromGateway:["v:h"],toGateway:["h:v"],loop:{fromTop:["t:r"],fromRight:["r:b"],fromLeft:["l:t"],fromBottom:["b:l"]},boundaryLoop:{alternateHorizontalSide:"b",alternateVerticalSide:"l",default:"v"},messageFlow:["straight","v:v"],subProcess:["straight","h:h"],isHorizontal:!0},Zg={default:["v:v"],fromGateway:["h:v"],toGateway:["v:h"],loop:{fromTop:["t:l"],fromRight:["r:t"],fromLeft:["l:b"],fromBottom:["b:r"]},boundaryLoop:{alternateHorizontalSide:"t",alternateVerticalSide:"r",default:"h"},messageFlow:["straight","h:h"],subProcess:["straight","v:v"],isHorizontal:!1},Kg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Jg={top:"t",right:"r",bottom:"b",left:"l"};function ey(e){this._elementRegistry=e}function ty(e,t){return ki(t,"bpmn:Participant")?"source":ki(e,"bpmn:Participant")?"target":oy(t)?"source":oy(e)||ki(t,"bpmn:Event")?"target":ki(e,"bpmn:Event")?"source":null}function ny(e){return oy(e)?"target":"source"}function ry(e,t){return e?e.original||e:xn(t)}function iy(e,t){return ki(t,"bpmn:Activity")&&ki(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function oy(e){return ki(e,"bpmn:SubProcess")&&Hi(e)}function sy(e,t){return e===t}function ay(e){var t=/right|left/.exec(e);return t&&t[0]}function ly(e){var t=/top|bottom/.exec(e);return t&&t[0]}function cy(e,t){return Kg[e]===t}function py(e){return"right"===e||"left"===e}function uy(e,t,n){var r=t.waypoints,i=r&&r.length&&_n(r[0],e);return"top"===i?n.loop.fromTop:"right"===i?n.loop.fromRight:"left"===i?n.loop.fromLeft:n.loop.fromBottom}function dy(e,t,n,r){var i,o,s,a,l=xn(e),c=xn(t),p=(a=(s=e).host,_n(xn(s),a,Qg)),u=sy(e.host,t),d=-1!==["top","right","bottom","left"].indexOf(p),h=_n(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,r,i,o){var s,a=t?e:o.isHorizontal?ly(e):ay(e),l=Jg[a];s=t?py(e)?hy("y",n,r,i)?"h":o.boundaryLoop.alternateHorizontalSide:hy("x",n,r,i)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(p,d,e,t,n,r):(i=function(e,t,n,r){if(n)return Jg[e];var i=ly(e),o=ay(e),s=ly(t),a=ay(t);if(r){if(sy(i,s)||cy(o,a))return Jg[i]}else if(sy(o,a)||cy(i,s))return Jg[o];return Jg[r?o:i]}(p,h,d,r.isHorizontal),o=function(e,t,n,r){if(n)return py(e)?function(e,t){var n=ay(e),r=Kg[n];return-1!==t.indexOf(r)}(e,t)||sy(e,t)?"h":"v":function(e,t){var n=ly(e),r=Kg[n];return-1!==t.indexOf(r)}(e,t)||sy(e,t)?"v":"h";return r?sy(ly(e),ly(t))?"h":"v":sy(ay(e),ay(t))?"v":"h"}(p,h,d,r.isHorizontal),[i+":"+o])}function hy(e,t,n,r){var i=Yg;return!(fy(e,r,n,i)||fy(e,r,{x:n.x+n.width,y:n.y+n.height},i)||fy(e,r,xn(t),i))}function fy(e,t,n,r){return Math.abs(t[e]-n[e])<r}function my(e){return L({original:e.point.original||e.point},e.actual)}function gy(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(ey,Dg),ey.prototype.layoutConnection=function(e,t){t||(t={});var n,r,i=t.source||e.source,o=t.target||e.target,s=t.waypoints||e.waypoints,a=t.connectionStart,l=t.connectionEnd,c=this._elementRegistry;if(a||(a=ry(s&&s[0],i)),l||(l=ry(s&&s[s.length-1],o)),(ki(e,"bpmn:Association")||ki(e,"bpmn:DataAssociation"))&&s&&!iy(i,o))return[].concat([a],s.slice(1,-1),[l]);var p=yc(i,c)?Xg:Zg;return ki(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:ty(e,t)}}(i,o,p):(ki(e,"bpmn:SequenceFlow")||iy(i,o))&&(n=i===o?{preferredLayouts:uy(i,e,p)}:ki(i,"bpmn:BoundaryEvent")?{preferredLayouts:dy(i,o,l,p)}:oy(i)||oy(o)?{preferredLayouts:p.subProcess,preserveDocking:ny(i)}:ki(i,"bpmn:Gateway")?{preferredLayouts:p.fromGateway}:ki(o,"bpmn:Gateway")?{preferredLayouts:p.toGateway}:{preferredLayouts:p.default}),n&&(r=Gg(Fg(i,o,a,l,s,n=L(n,t)))),r||[a,l]},ey.$inject=["elementRegistry"],gy.$inject=["elementRegistry","graphicsFactory"],gy.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var r=this.getDockingPoint(e,t,!0),i=this.getDockingPoint(e,n),o=e.waypoints.slice(r.idx+1,i.idx);return o.unshift(my(r)),o.push(my(i)),o},gy.prototype.getDockingPoint=function(e,t,n){var r,i,o=e.waypoints;return{point:i=o[r=n?0:o.length-1],actual:this._getIntersection(t,e,n)||i,idx:r}},gy.prototype._getIntersection=function(e,t,n){return En(this._getShapePath(e),this._getConnectionPath(t),n)},gy.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},gy.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},gy.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var yy={__init__:["modeling","bpmnUpdater"],__depends__:[wh,ef,nf,sf,zf,cm,hm,ym,Ns,Ho,am],bpmnFactory:["type",vm],bpmnUpdater:["type",bm],elementFactory:["type",xm],modeling:["type",Ag],layouter:["type",ey],connectionDocking:["type",gy]};const vy=Math.round;function by(e,t,n,r,i,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=r,this._layouter=i,this._rules=o}by.prototype.create=function(e,t,n){const r=this._complexPreview,i=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,p=o.createShape(L({type:t},n)),u=s.fire("autoPlace",{source:e,shape:p});if(!u)return;L(p,{x:u.x-vy(p.width/2),y:u.y-vy(p.height/2)});const d=c.allowed("connection.create",{source:e,target:p,hints:{targetParent:e.parent}});let h=null;d&&(h=o.createConnection(d),h.waypoints=a.layoutConnection(h,{source:e,target:p}),h.waypoints=i.getCroppedWaypoints(h,e,p)),r.create({created:[p,h].filter((e=>!l(e)))})},by.prototype.cleanUp=function(){this._complexPreview.cleanUp()},by.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var wy={__depends__:[xc,Xp,yy],__init__:["appendPreview"],appendPreview:["type",by]},xy=Math.min,_y=Math.max;function Ey(e){e.preventDefault()}function ky(e){e.stopPropagation()}function Oy(e){this.container=e.container,this.parent=ge('<div class="djs-direct-editing-parent"><div class="djs-direct-editing-content" contenteditable="true"></div></div>'),this.content=ve("[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 Py(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new Oy({container:t.getContainer(),keyHandler:I(this._handleKey,this),resizeHandler:I(this._handleResize,this)})}Oy.prototype.create=function(e,t,n,r){var i=this.parent,o=this.content,s=this.container;r=this.options=r||{};var a=B(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);L(i.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"},a);var l=B(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return L(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),r.centerVertically&&L(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,ce.bind(o,"keydown",this.keyHandler),ce.bind(o,"mousedown",ky),ce.bind(o,"paste",this.handlePaste),r.autoResize&&ce.bind(o,"input",this.autoResize),r.resizable&&this.resizable(t),s.appendChild(i),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),i},Oy.prototype.handlePaste=function(e){var t,n=this.options,r=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var i=this.autoResize(r);i&&this.resizeHandler(i)}},Oy.prototype.insertText=function(e){e=function(e){return e.replace(/\r\n|\r|\n/g,"\n")}(e),document.execCommand("insertText",!1,e)||this._insertTextIE(e)},Oy.prototype._insertTextIE=function(e){var t,n,r,i=this.getSelection(),o=i.startContainer,s=i.endContainer,a=i.startOffset,l=i.endOffset,c=i.commonAncestorContainer,p=(t=c.childNodes,[].slice.call(t));if(function(e){return e.nodeType===Node.TEXT_NODE}(c)){var u=o.textContent;o.textContent=u.substring(0,a)+e+u.substring(l),n=o,r=a+e.length}else if(o===this.content&&s===this.content){var d=document.createTextNode(e);this.content.insertBefore(d,p[a]),n=d,r=d.textContent.length}else{var h=p.indexOf(o),f=p.indexOf(s);p.forEach((function(t,n){n===h?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>h&&n<=f&&we(t)})),n=o,r=a+e.length}n&&void 0!==r&&setTimeout((function(){self.setSelection(n,r)}))},Oy.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var r=e.getBoundingClientRect(),i=t.scrollHeight;e.style.height=i+"px",this.resizeHandler({width:r.width,height:r.height,dx:0,dy:i-r.height})}},Oy.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,r=parseInt(this.style.minWidth)||0,i=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,p;n=this.resizeHandle=ge('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){Ey(n),ky(n);var u=xy(_y(c+n.clientX-a,r),o),d=xy(_y(p+n.clientY-l,i),s);t.style.width=u+"px",t.style.height=d+"px",e.resizeHandler({width:c,height:p,dx:n.clientX-a,dy:n.clientY-l})},d=function(e){Ey(e),ky(e),ce.unbind(document,"mousemove",u,!1),ce.unbind(document,"mouseup",d,!1)};ce.bind(n,"mousedown",(function(e){Ey(e),ky(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,p=n.height,ce.bind(document,"mousemove",u),ce.bind(document,"mouseup",d)}))}L(n.style,{position:"absolute",bottom:"0px",right:"0px",cursor:"nwse-resize",width:"0",height:"0",borderTop:(parseInt(this.style.fontSize)/4||3)+"px solid transparent",borderRight:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderBottom:(parseInt(this.style.fontSize)/4||3)+"px solid #ccc",borderLeft:(parseInt(this.style.fontSize)/4||3)+"px solid transparent"}),t.appendChild(n)},Oy.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),ce.unbind(t,"keydown",this.keyHandler),ce.unbind(t,"mousedown",ky),ce.unbind(t,"input",this.autoResize),ce.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),we(n)),we(e)},Oy.prototype.getValue=function(){return this.content.innerText.trim()},Oy.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},Oy.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var r=window.getSelection();r.removeAllRanges(),r.addRange(n)},Py.$inject=["eventBus","canvas"],Py.prototype.registerProvider=function(e){this._providers.push(e)},Py.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},Py.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},Py.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},Py.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},Py.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,r=this.$textbox.getBoundingClientRect(),i=this.getValue();i===e.context.text&&r.height===n.height&&r.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,i,e.context.text,{x:r.left-t.left,y:r.top-t.top,width:r.width,height:r.height})),this._fire("complete"),this.close()}},Py.prototype.getValue=function(){return this._textbox.getValue()},Py.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())},Py.prototype._handleResize=function(e){this._fire("resize",e)},Py.prototype.activate=function(e){var t;this.isActive()&&this.cancel();var n=m(this._providers,(function(n){return(t=n.activate(e))?n:null}));return t&&(this.$textbox=this._textbox.create(t.bounds,t.style,t.text,t.options),this._active={element:e,context:t,provider:n},t.options&&t.options.resizable&&(this.resizable=!0),this._fire("activate")),!!t};var Sy={__depends__:[Ps],__init__:["directEditing"],directEditing:["type",Py]};var Cy=[{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"}}],Ty=[{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"}}],My=[{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",eventDefinitionAttrs:{name:""}}},{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",eventDefinitionAttrs:{name:""}}},{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"}}],Ay=[{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"}}],Dy=[{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"}}],Ny=[{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:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}},{label:"Sub-process (collapsed)",actionName:"replace-with-collapsed-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:SubProcess",isExpanded:!1}}],Ry=[{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}},{label:"Event sub-process",actionName:"replace-with-event-subprocess",className:"bpmn-icon-event-subprocess-expanded",target:{type:"bpmn:SubProcess",triggeredByEvent:!0,isExpanded:!0}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}}],jy=[{label:"Transaction",actionName:"replace-with-transaction",className:"bpmn-icon-transaction",target:{type:"bpmn:Transaction",isExpanded:!0}},{label:"Sub-process",actionName:"replace-with-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:SubProcess",isExpanded:!0}},{label:"Ad-hoc sub-process",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",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}}],Iy=jy,Ly=[{label:"Task",actionName:"replace-with-task",className:"bpmn-icon-task",target:{type:"bpmn:Task"}},{label:"User task",actionName:"replace-with-user-task",className:"bpmn-icon-user",target:{type:"bpmn:UserTask"}},{label:"Service task",actionName:"replace-with-service-task",className:"bpmn-icon-service",target:{type:"bpmn:ServiceTask"}},{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:"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:"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}},{label:"Ad-hoc sub-process (collapsed)",actionName:"replace-with-collapsed-ad-hoc-subprocess",className:"bpmn-icon-subprocess-collapsed",target:{type:"bpmn:AdHocSubProcess",isExpanded:!1}},{label:"Ad-hoc sub-process (expanded)",actionName:"replace-with-ad-hoc-subprocess",className:"bpmn-icon-subprocess-expanded",target:{type:"bpmn:AdHocSubProcess",isExpanded:!0}}],$y=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],zy=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],By=[{label:"Message boundary event",actionName:"replace-with-message-boundary",className:"bpmn-icon-intermediate-event-catch-message",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:MessageEventDefinition",cancelActivity:!0}},{label:"Timer boundary event",actionName:"replace-with-timer-boundary",className:"bpmn-icon-intermediate-event-catch-timer",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:TimerEventDefinition",cancelActivity:!0}},{label:"Escalation boundary event",actionName:"replace-with-escalation-boundary",className:"bpmn-icon-intermediate-event-catch-escalation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",cancelActivity:!0}},{label:"Conditional boundary event",actionName:"replace-with-conditional-boundary",className:"bpmn-icon-intermediate-event-catch-condition",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",cancelActivity:!0}},{label:"Error boundary event",actionName:"replace-with-error-boundary",className:"bpmn-icon-intermediate-event-catch-error",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",cancelActivity:!0}},{label:"Cancel boundary event",actionName:"replace-with-cancel-boundary",className:"bpmn-icon-intermediate-event-catch-cancel",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CancelEventDefinition",cancelActivity:!0}},{label:"Signal boundary event",actionName:"replace-with-signal-boundary",className:"bpmn-icon-intermediate-event-catch-signal",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:SignalEventDefinition",cancelActivity:!0}},{label:"Compensation boundary event",actionName:"replace-with-compensation-boundary",className:"bpmn-icon-intermediate-event-catch-compensation",target:{type:"bpmn:BoundaryEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",cancelActivity:!0}},{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}}],qy=[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition",isInterrupting:!0}},{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition",isInterrupting:!0}},{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition",isInterrupting:!0}},{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition",isInterrupting:!0}},{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition",isInterrupting:!0}},{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition",isInterrupting:!0}},{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition",isInterrupting:!0}},{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}}],Fy=[{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"}],Vy=[{label:"Expanded pool/participant",actionName:"replace-with-expanded-pool",className:"bpmn-icon-participant",target:{type:"bpmn:Participant",isExpanded:!0}},{label:function(e){var t="Empty pool/participant";return e.children&&e.children.length&&(t+=" (removes content)"),t},actionName:"replace-with-collapsed-pool",className:"bpmn-icon-lane",target:{type:"bpmn:Participant",isExpanded:!1}}],Hy={"bpmn:MessageEventDefinition":[{label:"Message start event",actionName:"replace-with-message-start",className:"bpmn-icon-start-event-message",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}},{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:"Message end event",actionName:"replace-with-message-end",className:"bpmn-icon-end-event-message",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:MessageEventDefinition"}}],"bpmn:TimerEventDefinition":[{label:"Timer start event",actionName:"replace-with-timer-start",className:"bpmn-icon-start-event-timer",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:TimerEventDefinition"}},{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"}}],"bpmn:ConditionalEventDefinition":[{label:"Conditional start event",actionName:"replace-with-conditional-start",className:"bpmn-icon-start-event-condition",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ConditionalEventDefinition"}},{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"}}],"bpmn:SignalEventDefinition":[{label:"Signal start event",actionName:"replace-with-signal-start",className:"bpmn-icon-start-event-signal",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}},{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"}},{label:"Signal end event",actionName:"replace-with-signal-end",className:"bpmn-icon-end-event-signal",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:SignalEventDefinition"}}],"bpmn:ErrorEventDefinition":[{label:"Error start event",actionName:"replace-with-error-start",className:"bpmn-icon-start-event-error",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}},{label:"Error end event",actionName:"replace-with-error-end",className:"bpmn-icon-end-event-error",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:ErrorEventDefinition"}}],"bpmn:EscalationEventDefinition":[{label:"Escalation start event",actionName:"replace-with-escalation-start",className:"bpmn-icon-start-event-escalation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}},{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:"Escalation end event",actionName:"replace-with-escalation-end",className:"bpmn-icon-end-event-escalation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:EscalationEventDefinition"}}],"bpmn:CompensateEventDefinition":[{label:"Compensation start event",actionName:"replace-with-compensation-start",className:"bpmn-icon-start-event-compensation",target:{type:"bpmn:StartEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}},{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:"Compensation end event",actionName:"replace-with-compensation-end",className:"bpmn-icon-end-event-compensation",target:{type:"bpmn:EndEvent",eventDefinitionType:"bpmn:CompensateEventDefinition"}}]},Uy={"start-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)">\n <path d="m1899 28.357c21.545 567.43-598.38 1023.5-1133.6 835.92-548.09-147.21-801.57-873.95-463.59-1330 302.62-480.3 1071.7-507.54 1407.6-49.847 122.14 153.12 190.07 348.07 189.59 543.91z" fill="none" stroke="currentColor" stroke-dasharray="418.310422, 361.2328165" stroke-linecap="round" stroke-width="100"/>\n </g>\n </svg>',"intermediate-event-non-interrupting":'\n <svg viewBox="0 0 2048 2048" xmlns="http://www.w3.org/2000/svg">\n <g transform="translate(0 995.64)" fill="none" stroke="currentColor" stroke-linecap="round">\n <circle cx="1024" cy="28.357" r="875" stroke-dasharray="418.310422, 361.2328165" stroke-width="100"/>\n <circle cx="1024" cy="28.357" r="685" stroke-dasharray="348.31044857,261.23283643" stroke-dashoffset="500" stroke-width="100"/>\n </g>\n </svg>'};function Wy(e,t,n,r,i,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=r,this._bpmnReplace=i,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}Wy.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],Wy.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},Wy.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,r=this._rules,i=[],o=[];if(c(e)||!r.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Pi(s),r=n.eventDefinitions&&n.eventDefinitions[0],i=n.$type===t.type,o=(r&&r.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Hi(s);return!(i&&o&&a&&l)});return ki(n,"bpmn:DataObjectReference")?this._createEntries(e,$y):ki(n,"bpmn:DataStoreReference")&&!ki(e.parent,"bpmn:Collaboration")?this._createEntries(e,zy):(ki(n,"bpmn:Event")&&!ki(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,i=Hy[t]||[],!Gi(n.$parent)&&ki(n.$parent,"bpmn:SubProcess")&&(i=y(i,(function(e){return"bpmn:StartEvent"!==e.target.type})))),ki(n,"bpmn:StartEvent")&&!ki(n.$parent,"bpmn:SubProcess")?(o=y(Cy.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:Participant")?(o=y(Vy,(function(t){return Hi(e)!==t.target.isExpanded})),this._createEntries(e,o)):ki(n,"bpmn:StartEvent")&&Gi(n.$parent)?(o=y(qy.concat(i),(function(e){var t=!1!==e.target.isInterrupting,r=n.isInterrupting===t;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):ki(n,"bpmn:StartEvent")&&!Gi(n.$parent)&&ki(n.$parent,"bpmn:SubProcess")?(o=y(Ty.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:EndEvent")?(o=y(Ay.concat(i),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!ki(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):ki(n,"bpmn:BoundaryEvent")?(o=y(By,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!ki(n.attachedToRef,"bpmn:Transaction"))return!1;var r=!1!==t.cancelActivity,i=n.cancelActivity==r;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):ki(n,"bpmn:IntermediateCatchEvent")||ki(n,"bpmn:IntermediateThrowEvent")?(o=y(My.concat(i),a),this._createEntries(e,o)):ki(n,"bpmn:Gateway")?(o=y(Dy,a),this._createEntries(e,o)):ki(n,"bpmn:Transaction")?(o=y(jy,a),this._createEntries(e,o)):Gi(n)&&Hi(e)?(o=y(Iy,a),this._createEntries(e,o)):ki(n,"bpmn:AdHocSubProcess")&&Hi(e)?(o=y(Ry,a),this._createEntries(e,o)):ki(n,"bpmn:SubProcess")&&Hi(e)?(o=y(Ny,a),this._createEntries(e,o)):ki(n,"bpmn:SubProcess")&&!Hi(e)?(o=y(Ly,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):ki(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Fy):ki(n,"bpmn:FlowNode")?(o=y(Ly,a),this._createEntries(e,o)):{})},Wy.prototype.getPopupMenuHeaderEntries=function(e){var t={};return ki(e,"bpmn:Activity")&&!Gi(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),ki(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),ki(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),Cd(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},Wy.prototype._createEntries=function(e,t){var n={},r=this;return v(t,(function(t){n[t.actionName]=r._createEntry(t,e)})),n},Wy.prototype._createSequenceFlowEntries=function(e,t){var n=Pi(e),r={},i=this._modeling,o=this._moddle,s=this;return v(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&ki(n.sourceRef,"bpmn:Activity")&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});i.updateProperties(e,{conditionExpression:t})}))});break;default:ki(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e,{conditionExpression:void 0})}))}),(ki(n.sourceRef,"bpmn:ExclusiveGateway")||ki(n.sourceRef,"bpmn:InclusiveGateway")||ki(n.sourceRef,"bpmn:ComplexGateway")||ki(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(r={...r,[t.actionName]:s._createEntry(t,e,(function(){i.updateProperties(e.source,{default:void 0})}))})}})),r},Wy.prototype._createEntry=function(e,t,n){var r=this._translate,i=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return i(t,e.target)},{label:r(o),className:e.className,action:n}},Wy.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function r(n,r){if(r.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var i=e.businessObject.get("loopCharacteristics");i&&ki(i,r.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,i,{isSequential:r.options.isSequential}):(i=t._moddle.create(r.options.loopCharacteristics,{isSequential:r.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:i}))}}var i,o,s,a=Pi(e).loopCharacteristics;return a&&(i=a.isSequential,o=void 0===a.isSequential,s=void 0!==a.isSequential&&!a.isSequential),{"toggle-parallel-mi":{className:"bpmn-icon-parallel-mi-marker",title:n("Parallel multi-instance"),active:s,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:i,action:r,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:r,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},Wy.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,r=e.businessObject.dataObjectRef;if(!r)return{};var i=r.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:i,action:function(n,i){t._modeling.updateModdleProperties(e,r,{isCollection:!i.active})}}}},Wy.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,r=this._translate;var i=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:r("Participant multiplicity"),active:!!i,action:function(r,i){var o;i.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},Wy.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Pi(e),r=this,i=Td(e),o=ki(e,"bpmn:BoundaryEvent")?Uy["intermediate-event-non-interrupting"]:Uy["start-event-non-interrupting"],s=!n[i];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){r._modeling.updateProperties(e,{[i]:!!s})}}}};var Gy={__depends__:[Zl,zf,xc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",Wy]};function Qy(e,t,n,r,i,o,s,a,l,c,p,u,d){e=e||{},r.registerProvider(this),this._contextPad=r,this._modeling=i,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=p,this._translate=u,this._eventBus=n,this._appendPreview=d,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(xs(e)&&r.isOpen(t)){var n=r.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){d.cleanUp()}))}function Yy(e,t,n){var r=e.$instanceOf(t),i=!1;return v(e.eventDefinitions||[],(function(e){e.$type===n&&(i=!0)})),r&&i}Qy.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Qy.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&L(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Qy.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?x(e,(e=>t.includes(e))):t},Qy.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,r=this._elementFactory,i=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,p={};if("label"===e.type)return this._isDeleteAllowed([e])&&L(p,f()),p;var u=e.businessObject;function d(e,t){i.start(e,t)}function h(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:h}}}}function m(e,t,n,i){function s(t,n){var s=r.createShape(L({type:e},i));o.start(t,s,{source:n})}var l=a?function(t,n){var o=r.createShape(L({type:e},i));a.append(n,o)}:s,p=a?function(t,n){return c.create(n,e,i),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:p}}}function g(e){return function(r,i){n.splitLane(i,e),t.open(i,!0)}}if(Oi(u,["bpmn:Lane","bpmn:Participant"])&&Hi(e)){var y=Ru(e);L(p,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),y.length<2&&((Ui(e)?e.height>=120:e.width>=120)&&L(p,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(Ui(e)?e.height>=180:e.width>=180)&&L(p,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),L(p,{"lane-insert-below":{group:"lane-insert-below",className:"bpmn-icon-lane-insert-below",title:l("Add lane below"),action:{click:function(e,t){n.addLane(t,"bottom")}}}})}return ki(u,"bpmn:FlowNode")&&(ki(u,"bpmn:EventBasedGateway")?L(p,{"append.receive-task":m("bpmn:ReceiveTask","bpmn-icon-receive-task",l("Append receive task")),"append.message-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-message",l("Append message intermediate catch event"),{eventDefinitionType:"bpmn:MessageEventDefinition"}),"append.timer-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-timer",l("Append timer intermediate catch event"),{eventDefinitionType:"bpmn:TimerEventDefinition"}),"append.condition-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-condition",l("Append conditional intermediate catch event"),{eventDefinitionType:"bpmn:ConditionalEventDefinition"}),"append.signal-intermediate-event":m("bpmn:IntermediateCatchEvent","bpmn-icon-intermediate-event-catch-signal",l("Append signal intermediate catch event"),{eventDefinitionType:"bpmn:SignalEventDefinition"})}):Yy(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?L(p,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):ki(u,"bpmn:EndEvent")||u.isForCompensation||Yy(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Gi(u)||L(p,{"append.end-event":m("bpmn:EndEvent","bpmn-icon-end-event-none",l("Append end event")),"append.gateway":m("bpmn:ExclusiveGateway","bpmn-icon-gateway-none",l("Append gateway")),"append.append-task":m("bpmn:Task","bpmn-icon-task",l("Append task")),"append.intermediate-event":m("bpmn:IntermediateThrowEvent","bpmn-icon-intermediate-event-none",l("Append intermediate/boundary event"))})),s.isEmpty(e,"bpmn-replace")||L(p,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var r=L(function(e){var n=t.getPad(e).html.getBoundingClientRect();return{x:n.left,y:n.bottom+5}}(n),{cursor:{x:e.x,y:e.y}});s.open(n,"bpmn-replace",r,{title:l("Change element"),width:300,search:!0})}}}}),ki(u,"bpmn:SequenceFlow")&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),Oi(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation")),connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect to other element"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:TextAnnotation")&&L(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:d,dragstart:d}}}),Oi(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&L(p,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:d,dragstart:d}}}),ki(u,"bpmn:Group")&&L(p,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&L(p,f()),p};var Xy={__depends__:[wy,Sy,Da,Ns,Bp,vf,Gy],__init__:["contextPadProvider"],contextPadProvider:["type",Qy]},Zy={horizontal:["x","width"],vertical:["y","height"]};function Ky(e,t){this._modeling=e,this._filters=[],this.registerFilter((function(e){var n=t.allowed("elements.distribute",{elements:e});return c(n)?n:n?e:[]}))}Ky.$inject=["modeling","rules"],Ky.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Ky.prototype.trigger=function(e,t){var n,r,i=this._modeling;if(!(e.length<3||(this._setOrientation(t),r=this._filterElements(e),(n=this._createGroups(r)).length<=2)))return i.distributeElements(n,this._axis,this._dimension),n},Ky.prototype._filterElements=function(e){var t=this._filters,n=this._axis,r=this._dimension,i=[].concat(e);return t.length?(v(t,(function(e){i=e(i,n,r)})),i):e},Ky.prototype._createGroups=function(e){var t=[],n=this,r=this._axis,i=this._dimension;if(!r)throw new Error('must have a defined "axis" and "dimension"');return v(T(e,r),(function(e,o){var s,a=n._findRange(e,r,i),l=t[t.length-1];l&&n._hasIntersection(l.range,a)?t[t.length-1].elements.push(e):(s={range:a,elements:[e]},t.push(s))})),t},Ky.prototype._setOrientation=function(e){var t=Zy[e];this._axis=t[0],this._dimension=t[1]},Ky.prototype._hasIntersection=function(e,t){return Math.max(e.min,e.max)>=Math.min(t.min,t.max)&&Math.min(e.min,e.max)<=Math.max(t.min,t.max)},Ky.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Jy={__init__:["distributeElements"],distributeElements:["type",Ky]};function ev(e){nc.call(this,e)}ev.$inject=["eventBus"],e(ev,nc),ev.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=ht(t=y(t,(function(e){var t=Oi(e,["bpmn:Association","bpmn:BoundaryEvent","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:Lane","bpmn:MessageFlow","bpmn:SequenceFlow","bpmn:TextAnnotation"]);return!(e.labelTarget||t)})))).length<3)&&t}))};var tv={horizontal:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="450 400 450 150 1350 150 1350 400" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="150" y="450" width="600" height="1200" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="1050" y="450" width="600" height="800" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>',vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1800 1800">\n <polyline points="400 1350 150 1350 150 450 400 450" style="fill:none;stroke:currentColor;stroke-width:100;stroke-linejoin:round;"/>\n <rect x="450" y="150" width="1200" height="600" rx="1" style="fill:none;stroke:currentColor;stroke-width:100;"></rect>\n <rect x="450" y="1050" width="800" height="600" rx="1" style="fill:currentColor;stroke:currentColor;stroke-width:100;opacity:.5;"></rect>\n </svg>'};function nv(e,t,n,r){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=r,e.registerProvider("align-elements",900,this)}nv.$inject=["popupMenu","distributeElements","translate","rules"],nv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&L(t,this._getEntries(e)),t},nv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},nv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,r=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:tv.horizontal,action:function(n,i){t.trigger(e,"horizontal"),r.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:tv.vertical,action:function(n,i){t.trigger(e,"vertical"),r.close()}}}};var rv={__depends__:[Zl,Jy],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",ev],distributeElementsMenuProvider:["type",nv]},iv="is not a registered action";function ov(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function sv(e,t){return new Error(e+" "+t)}ov.$inject=["eventBus","injector"],ov.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),r=e.get("selection",!1),i=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),p=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();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),i&&this.register("stepZoom",(function(e){i.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&r&&a&&this.register("removeSelection",(function(){var e=r.get();if(e.length){var t,i=a.allowed("elements.delete",{elements:e});!1!==i&&(t=c(i)?i:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),p&&this.register("moveSelection",(function(e){p.moveSelection(e.direction,e.accelerated)}))},ov.prototype.trigger=function(e,t){if(!this._actions[e])throw sv(e,iv);return this._actions[e](t)},ov.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);v(e,(function(e,t){n._registerAction(t,e)}))},ov.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw sv(e,"is already registered");this._actions[e]=t},ov.prototype.unregister=function(e){if(!this.isRegistered(e))throw sv(e,iv);this._actions[e]=void 0},ov.prototype.getActions=function(){return Object.keys(this._actions)},ov.prototype.isRegistered=function(e){return!!this._actions[e]};var av={__init__:["editorActions"],editorActions:["type",ov]};function lv(e){e.invoke(ov,this)}e(lv,ov),lv.$inject=["injector"],lv.prototype._registerDefaultActions=function(e){ov.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),r=e.get("selection",!1),i=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),p=e.get("directEditing",!1),u=e.get("searchPad",!1),d=e.get("modeling",!1),h=e.get("contextPad",!1);t&&n&&r&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),i=n.filter((function(t){return t!==e}));return r.select(i),i})),i&&this._registerAction("spaceTool",(function(){i.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),r&&l&&this._registerAction("distributeElements",(function(e){var t=r.get(),n=e.type;t.length&&l.trigger(t,n)})),r&&c&&this._registerAction("alignElements",(function(e){var t=r.get(),n=[],i=e.type;t.length&&(n=y(t,(function(e){return!ki(e,"bpmn:Lane")})),c.trigger(n,i))})),r&&d&&this._registerAction("setColor",(function(e){var t=r.get();t.length&&d.setColor(t,e)})),r&&p&&this._registerAction("directEditing",(function(){var e=r.get();e.length&&p.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&d&&this._registerAction("moveToOrigin",(function(){var e,r,i=t.getRootElement();e=vt(r=ki(i,"bpmn:Collaboration")?n.filter((function(e){return ki(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==i&&!ki(e.parent,"bpmn:SubProcess")}))),d.moveElements(r,{x:-e.x,y:-e.y},i)})),r&&h&&this._registerAction("replaceElement",(function(e){h.triggerEntry("replace","click",e)}))};var cv={__depends__:[av],editorActions:["type",lv]};function pv(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;Oi(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}pv.$inject=["eventBus"];var uv=10;function dv(e,t,n){return n||(n="round"),Math[n](e/t)*t}function hv(e,t,n){var r=!n||!1!==n.active;this._eventBus=t;var i=this;t.on("diagram.init",800,(function(){i.setActive(r)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!i.active||n&&zs(n))){var r=t.context,o=r.gridSnappingContext;o||(o=r.gridSnappingContext={}),["x","y"].forEach((function(n){var r={},o=function(e,t,n){var r=e.context,i=e.shape,o=r.gridSnappingContext,s=o.snapLocation,a=o.snapOffset;if(a&&u(a[t]))return a[t];a||(a=o.snapOffset={});u(a[t])||(a[t]=0);if(!i)return a[t];n.get(i.id)||(fv(t)?a[t]+=i[t]+i.width/2:a[t]+=i[t]+i.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=i.width/2:/right/.test(s)&&(a[t]+=i.width/2):/top/.test(s)?a[t]-=i.height/2:/bottom/.test(s)&&(a[t]+=i.height/2);return a[t]}(t,n,e);o&&(r.offset=o);var s=function(e,t){var n=e.context,r=n.createConstraints,i=n.resizeConstraints||{},o=n.gridSnappingContext,s=o.snapConstraints;if(s&&s[t])return s[t];s||(s=o.snapConstraints={});s[t]||(s[t]={});var a=n.direction;r&&(fv(t)?(s.x.min=r.left,s.x.max=r.right):(s.y.min=r.top,s.y.max=r.bottom));var l=i.min,c=i.max;l&&(fv(t)?gv(a)?s.x.max=l.left:s.x.min=l.right:mv(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(fv(t)?gv(a)?s.x.min=c.left:s.x.max=c.right:mv(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&L(r,s),Cp(t,n)||i.snapEvent(t,n,r)}))}}))}function fv(e){return"x"===e}function mv(e){return-1!==e.indexOf("n")}function gv(e){return-1!==e.indexOf("w")}function yv(e,t){Uo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,r=(t.hints||{}).autoResize;if(r){var i=t.shape,o=t.newBounds;h(r)?t.newBounds=n.snapComplex(o,r):t.newBounds=n.snapSimple(i,o)}}))}hv.prototype.snapEvent=function(e,t,n){Tp(e,t,this.snapValue(e[t],n))},hv.prototype.getGridSpacing=function(){return uv},hv.prototype.snapValue=function(e,t){var n,r,i=0;return t&&t.offset&&(i=t.offset),e=dv(e+=i,uv),t&&t.min&&u(n=t.min)&&(n=dv(n+i,uv,"ceil"),e=Math.max(e,n)),t&&t.max&&u(r=t.max)&&(r=dv(r+i,uv,"floor"),e=Math.min(e,r)),e-=i},hv.prototype.isActive=function(){return this.active},hv.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},hv.prototype.toggleActive=function(){this.setActive(!this.active)},hv.$inject=["elementRegistry","eventBus","config.gridSnapping"],yv.$inject=["eventBus","gridSnapping","modeling"],e(yv,Uo),yv.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},yv.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},yv.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,r=/w/.test(t),i=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),i&&(r?(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),L(e,o),e},yv.prototype.snapVertically=function(e,t){var n=this._gridSnapping,r=/n/.test(t),i=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),r&&(i?(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),L(e,o),e};function vv(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,r=e.context;r.initialized&&("x"===r.axis?(n=t.snapValue(e.dx),e.x=e.x+n-e.dx,e.dx=n):(n=t.snapValue(e.dy),e.y=e.y+n-e.dy,e.dy=n))}))}vv.$inject=["eventBus","gridSnapping"];var bv={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",yv],gridSnappingSpaceToolBehavior:["type",vv]}],__init__:["gridSnapping"],gridSnapping:["type",hv]};function wv(e,t,n){e.on("autoPlace",2e3,(function(e){var r=e.source,i=xn(r),o=e.shape,s=vc(r,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==i[e]&&(s[e]>i[e]?n.min=s[e]:n.max=s[e],ki(o,"bpmn:TextAnnotation")&&(!function(e){return"x"===e}(e)?n.offset=-o.height/2:n.offset=-o.width/2),s[e]=t.snapValue(s[e],n))})),s}))}wv.$inject=["eventBus","gridSnapping","elementRegistry"];function xv(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var r=t.context,i=r.shape,o=e.getRootElement();ki(i,"bpmn:Participant")&&ki(o,"bpmn:Process")&&o.children.length&&(r.createConstraints&&(i.width=n.snapValue(i.width,{min:i.width}),i.height=n.snapValue(i.height,{min:i.height})))}))}xv.$inject=["canvas","eventBus","gridSnapping"];function _v(e,t,n){Uo.call(this,e),this._gridSnapping=t;var r=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,i=t.connection,o=t.hints||{},s=i.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(i,r.snapMiddleSegments(s))}))}function Ev(e,t,n){var r=At(t,n),i={};return function(e){return"h"===e}(r)&&(i.y=e.snapValue(t.y)),function(e){return"v"===e}(r)&&(i.x=e.snapValue(t.x)),("x"in i||"y"in i)&&(t=L({},t,i),n=L({},n,i)),[t,n]}_v.$inject=["eventBus","gridSnapping","modeling"],e(_v,Uo),_v.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var r=1;r<e.length-2;r++)t=Ev(n,e[r],e[r+1]),e[r]=t[0],e[r+1]=t[1];return e};var kv={__depends__:[bv,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",wv],gridSnappingParticipantBehavior:["type",xv],gridSnappingLayoutConnectionBehavior:["type",_v]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",pv]};function Ov(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,r=e.gfx;return ki(t,"bpmn:Lane")?n._createParticipantHit(t,r):ki(t,"bpmn:Participant")?Hi(t)?n._createParticipantHit(t,r):n._createDefaultHit(t,r):ki(t,"bpmn:SubProcess")?Hi(t)?n._createSubProcessHit(t,r):n._createDefaultHit(t,r):void 0}))}Ov.$inject=["eventBus","interactionEvents"],Ov.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},Ov.prototype._createParticipantHit=function(e,t){this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height});var n=Ui(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},Ov.prototype._createSubProcessHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createBoxHit(t,"no-move",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"click-stroke",{width:e.width,height:e.height}),this._interactionEvents.createBoxHit(t,"all",{width:e.width,height:30}),!0};var Pv={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",Ov]};function Sv(e){e.invoke(Qs,this)}e(Sv,Qs),Sv.$inject=["injector"],Sv.prototype.registerBindings=function(e,t){function n(n,r){t.isRegistered(n)&&e.addListener(r)}Qs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var r=n.keyEvent;if(e.isKey(["a","A"],r)&&e.isCmd(r))return t.trigger("selectElements"),!0})),n("find",(function(n){var r=n.keyEvent;if(e.isKey(["f","F"],r)&&e.isCmd(r))return t.trigger("find"),!0})),n("spaceTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["s","S"],r)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["l","L"],r)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["h","H"],r)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["c","C"],r)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["e","E"],r)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var r=n.keyEvent;if(!e.hasModifier(r))return e.isKey(["r","R"],r)?(t.trigger("replaceElement",r),!0):void 0}))};var Cv={__depends__:[Ys],__init__:["keyboardBindings"],keyboardBindings:["type",Sv]},Tv={moveSpeed:1,moveSpeedAccelerated:10},Mv="left",Av="right",Dv="down",Nv={ArrowLeft:Mv,Left:Mv,ArrowUp:"up",Up:"up",ArrowRight:Av,Right:Av,ArrowDown:Dv,Down:Dv},Rv={left:function(e){return{x:-e,y:0}},up:function(e){return{x:0,y:-e}},right:function(e){return{x:e,y:0}},down:function(e){return{x:0,y:e}}};function jv(e,t,n,r,i){var o=this;this._config=L({},Tv,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,r=Nv[n.key];if(r&&!t.isCmd(n)){var i=t.isShift(n);return o.moveSelection(r,i),!0}})),this.moveSelection=function(e,t){var o=i.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Rv[e](s);r.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}jv.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var Iv={__depends__:[Ys,Ns],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",jv]};function Lv(e,t,n,r){this._dragging=r,this._rules=t;var i=this;function o(e,t){var n,r=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var r=n.x,i=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+i,o.height=e.height-i):-1!==t.indexOf("s")&&(o.height=e.height+i),-1!==t.indexOf("e")?o.width=e.width+r:-1!==t.indexOf("w")&&(o.x=e.x+r,o.width=e.width-r),o}(r,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return bn({top:Pu("top",n,t),right:Pu("right",n,t),bottom:Pu("bottom",n,t),left:Pu("left",n,t)})}(n,s),e.canExecute=i.canResize(e)}e.on("resize.start",(function(e){var t,n,r;t=e.context,n=t.resizeConstraints,r=t.minBounds,void 0===n&&(void 0===r&&(r=i.computeMinResizeBox(t)),t.resizeConstraints={min:vn(r)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,r=e.canExecute,i=e.newBounds;if(r){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,i=gn(i)))return;n.resizeShape(t,i)}}(e.context)}))}function $v(e,t){var n=xn(e),r=vn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}function zv(e){var t="resize-";return"n"===e||"s"===e?t+"ns":"e"===e||"w"===e?t+"ew":"nw"===e||"se"===e?t+"nwse":t+"nesw"}Lv.prototype.canResize=function(e){var t=this._rules,n=B(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Lv.prototype.activate=function(e,t,n){var r,i,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(i=(r=L({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,$v(t,i),"resize",{autoActivate:!0,cursor:zv(i),data:{shape:t,context:r}})},Lv.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,r){var i=vn(t),o={top:/n/.test(e)?i.bottom-n.height:i.top,left:/w/.test(e)?i.right-n.width:i.left,bottom:/s/.test(e)?i.top+n.height:i.bottom,right:/e/.test(e)?i.left+n.width:i.right},s=r?vn(r):o;return bn({top:Eu(o.top,s.top),left:Eu(o.left,s.left),bottom:_u(o.bottom,s.bottom),right:_u(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Tu(t,e.childrenBoxPadding))},Lv.$inject=["eventBus","rules","modeling","dragging"];var Bv="djs-resizing",qv="resize-not-ok";function Fv(e,t,n){e.on("resize.move",500,(function(e){var r,i,o,s;r=e.context,i=r.shape,o=r.newBounds,(s=r.frame)||(s=r.frame=n.addFrame(i,t.getActiveLayer()),t.addMarker(i,Bv)),o.width>5&&Oe(s,{x:o.x,width:o.width}),o.height>5&&Oe(s,{y:o.y,height:o.height}),r.canExecute?Se(s).remove(qv):Se(s).add(qv)})),e.on("resize.cleanup",(function(e){var n,r;n=e.context,r=n.shape,n.frame&&Ue(n.frame),t.removeMarker(r,Bv)}))}Fv.$inject=["eventBus","canvas","previewSupport"];var Vv=-6,Hv="djs-resizer",Uv=["n","w","s","e","nw","ne","se","sw"];function Wv(e,t,n,r){this._resize=r,this._canvas=t;var i=this;e.on("selection.changed",(function(e){var t=e.newSelection;i.removeResizers(),1===t.length&&v(t,I(i.addResizer,i))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(i.removeResizers(),i.addResizer(t))}))}Wv.prototype.makeDraggable=function(e,t,n){var r=this._resize;function i(t){ws(t)&&r.activate(t,e,n)}ce.bind(t,"mousedown",i),ce.bind(t,"touchstart",i)},Wv.prototype._createResizer=function(e,t,n,r){var i=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=Vv);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=Vv);return t}(r),s=Re("g");Se(s).add(Hv),Se(s).add(Hv+"-"+e.id),Se(s).add(Hv+"-"+r),xe(i,s);var a=Re("rect");Oe(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add(Hv+"-visual"),xe(s,a);var l=Re("rect");return Oe(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add(Hv+"-hit"),xe(s,l),Zn(s,t,n),s},Wv.prototype.createResizer=function(e,t){var n=$v(e,t),r=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,r,t)},Wv.prototype.addResizer=function(e){var t=this;!fn(e)&&this._resize.canResize({shape:e})&&v(Uv,(function(n){t.createResizer(e,n)}))},Wv.prototype.removeResizers=function(){Te(this._getResizersParent())},Wv.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},Wv.$inject=["eventBus","canvas","selection","resize"];var Gv={__depends__:[$c,Nc,Gp],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Lv],resizePreview:["type",Fv],resizeHandles:["type",Wv]};function Qv(e,t,n,r,i,o,s){function a(e,t){(t||Oi(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Yv(e))&&r.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=i,this._textRenderer=s,r.registerProvider(this),e.on("element.dblclick",(function(e){a(e.element,!0)})),e.on(["autoPlace.start","canvas.viewbox.changing","drag.init","element.mousedown","popupMenu.open","root.set","selection.changed"],(function(){r.isActive()&&r.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){r.isActive(e.element)&&r.cancel()})),e.on(["commandStack.changed"],(function(e){r.isActive()&&r.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,r=e.context.canExecute;e.isTouch||r&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Yv(e){return ki(e,"bpmn:SubProcess")&&!Hi(e)}Qv.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Qv.prototype.activate=function(e){var t=no(e);if(void 0!==t){var n={text:t};L(n,this.getEditingBBox(e));var r={},i=n.style||{};return L(i,{backgroundColor:null,border:null}),(Oi(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Yv(e))&&L(r,{centerVertically:!0}),Zi(e)&&(L(r,{autoResize:!0}),L(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),ki(e,"bpmn:TextAnnotation")&&(L(r,{resizable:!0,autoResize:!0}),L(i,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),L(n,{options:r,style:i}),n}},Qv.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,r=t.getAbsoluteBBox(n),i=r.x+r.width/2,o=r.y+r.height/2,s={x:r.x,y:r.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),p=c.fontSize*a,u=c.lineHeight,d=l.fontSize*a,h=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(ki(e,"bpmn:Lane")||function(e){return ki(e,"bpmn:Participant")&&Hi(e)}(e)){var m=Ui(e);L(s,m?{width:r.height,height:30*a,x:r.x-r.height/2+15*a,y:o-30*a/2}:{width:r.width,height:30*a}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:m?"rotate(-90deg)":null})}if(function(e){return ki(e,"bpmn:Participant")&&!Hi(e)}(e)){var g=Ui(e);L(s,g?{width:r.width,height:r.height}:{width:r.height,height:r.width,x:i-r.height/2,y:o-r.width/2}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(Oi(e,["bpmn:Task","bpmn:CallActivity"])||Yv(e))&&(L(s,{width:r.width,height:r.height}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return ki(e,"bpmn:SubProcess")&&Hi(e)}(e)&&(L(s,{width:r.width,x:r.x}),L(f,{fontSize:d+"px",lineHeight:h,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var y=90*a,v=7*a,b=4*a;if(n.labelTarget&&(L(s,{width:y,height:r.height+v+b,x:i-y/2,y:r.y-v}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})),Zi(n)&&!Ki(n)&&!mn(n)){var w=eo(e),x=t.getAbsoluteBBox({x:w.x,y:w.y,width:0,height:0}),_=p+v+b;L(s,{width:y,height:_,x:x.x-y/2,y:x.y-_/2}),L(f,{fontSize:p+"px",lineHeight:u,paddingTop:v+"px",paddingBottom:b+"px"})}return ki(e,"bpmn:TextAnnotation")&&(L(s,{width:r.width,height:r.height,minWidth:30*a,minHeight:10*a}),L(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:d+"px",lineHeight:h})),{bounds:s,style:f}},Qv.prototype.update=function(e,t,n,r){var i,o,s;ki(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),i={x:e.x,y:e.y,width:e.width/o.width*r.width,height:e.height/o.height*r.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,i)};var Xv="djs-element-hidden",Zv="djs-label-hidden";function Kv(e,t,n){var r,i,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(ki(r=l.element.label||l.element,"bpmn:TextAnnotation")){i=t.getAbsoluteBBox(r),o=Re("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:r.height,position:{mx:0,my:0}}),p=s.path=Re("path");Oe(p,{d:c,strokeWidth:2,stroke:Jv(r)}),xe(o,p),xe(a,o),Kn(o,r.x,r.y)}ki(r,"bpmn:TextAnnotation")||r.labelTarget?t.addMarker(r,Xv):(ki(r,"bpmn:Task")||ki(r,"bpmn:CallActivity")||ki(r,"bpmn:SubProcess")||ki(r,"bpmn:Participant")||ki(r,"bpmn:Lane"))&&t.addMarker(r,Zv)})),e.on("directEditing.resize",(function(e){if(ki(r,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(r.height/i.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:r.width,containerHeight:a,position:{mx:0,my:0}});Oe(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,Xv),t.removeMarker(r,Zv)),r=void 0,i=void 0,o&&(Ue(o),o=void 0)}))}function Jv(e,t){return Si(e).get("stroke")||t||"black"}Kv.$inject=["eventBus","canvas","pathMap"];var eb={__depends__:[Ho,Gv,Sy],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Qv],labelEditingPreview:["type",Kv]},tb=new Io("tt");function nb(e,t){e.style.display=!1===t?"none":""}var rb="djs-tooltip",ib="."+rb;function ob(e,t){var n,r;this._eventBus=e,this._canvas=t,this._ids=tb,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),Y(r=ge('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(r,n.firstChild),r);var i=this;de.bind(this._tooltipRoot,ib,"mousedown",(function(e){e.stopPropagation()})),de.bind(this._tooltipRoot,ib,"mouseover",(function(e){i.trigger("mouseover",e)})),de.bind(this._tooltipRoot,ib,"mouseout",(function(e){i.trigger("mouseout",e)})),this._init()}ob.$inject=["eventBus","canvas"],ob.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=L({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},ob.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,r=this.get(X(n,"data-tooltip-id"));r&&("mouseover"===e&&r.timeout&&this.clearTimeout(r),"mouseout"===e&&r.timeout&&(r.timeout=1e3,this.setTimeout(r)))},ob.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},ob.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},ob.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},ob.prototype.remove=function(e){var t=this.get(e);t&&(we(t.html),we(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},ob.prototype.show=function(){nb(this._tooltipRoot)},ob.prototype.hide=function(){nb(this._tooltipRoot,!1)},ob.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,r="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=r,this._tooltipRoot.style["-ms-transform"]=r},ob.prototype._addTooltip=function(e){var t,n=e.id,r=e.html,i=this._tooltipRoot;r.get&&r.constructor.prototype.jquery&&(r=r.get(0)),h(r)&&(r=ge(r)),Y(t=ge('<div data-tooltip-id="'+n+'" class="'+rb+'">'),{position:"absolute"}),t.appendChild(r),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,i.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},ob.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){Y(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},ob.prototype._updateTooltipVisibilty=function(e){v(this._tooltips,(function(t){var n=t.show,r=t.htmlContainer,i=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(i=!1),nb(r,i))}))},ob.prototype._init=function(){var e=this;this._eventBus.on("canvas.viewbox.changing",(function(t){e.hide()})),this._eventBus.on("canvas.viewbox.changed",(function(t){var n;n=t.viewbox,e._updateRoot(n),e._updateTooltipVisibilty(n),e.show()}))};var sb={__init__:["tooltips"],tooltips:["type",ob]};function ab(e,t,n){function r(e,n,r){t.add({position:{x:e.x+5,y:e.y+5},type:"error",timeout:2e3,html:"<div>"+n+"</div>"})}e.on(["shape.move.rejected","create.rejected"],(function(e){var t=e.context,i=t.shape;ki(t.target,"bpmn:Collaboration")&&(ki(i,"bpmn:FlowNode")?r(e,n("flow elements must be children of pools/participants")):ki(i,"bpmn:DataObjectReference")&&r(e,n("Data object must be placed within a pool/participant.")))}))}ab.$inject=["eventBus","tooltips","translate"];var lb={__depends__:[sb],__init__:["modelingFeedback"],modelingFeedback:["type",ab]};function cb(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),r=this;function i(e){var t=Re("rect");return Oe(t,L({x:0,y:0,rx:4,width:100,height:100},n)),t}e.on(["shape.added","shape.changed"],500,(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=r.getOutline(t)||i()),r.updateShapeOutline(o,t)})),e.on(["connection.added","connection.changed"],(function(e){var t=e.element,n=e.gfx,o=ve(".djs-outline",n);o||xe(n,o=i()),r.updateConnectionOutline(o,t)}))}cb.prototype.updateShapeOutline=function(e,t){var n=!1,r=this._getProviders();r.length&&v(r,(function(r){n=n||r.updateOutline(t,e)})),n||Oe(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},cb.prototype.updateConnectionOutline=function(e,t){var n=vt(t);Oe(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},cb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},cb.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},cb.prototype.getOutline=function(e){var t;return v(this._getProviders(),(function(n){d(n.getOutline)&&(t=t||n.getOutline(e))})),t},cb.$inject=["eventBus","styles","elementRegistry"];function pb(e,t,n){this._canvas=t;var r=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&r._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;r._updateMultiSelectionOutline(t)}))}pb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Te(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var r=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),i=Re("rect");Oe(i,L({rx:3},r)),Se(i).add("djs-selection-outline"),xe(t,i)}},pb.$inject=["eventBus","canvas","selection"];var ub={__depends__:[Ns],__init__:["outline","multiSelectionOutline"],outline:["type",cb],multiSelectionOutline:["type",pb]},db=Math.round;function hb(e,t,n,r,i){function o(e,t,n,r){return i.allowed("elements.move",{shapes:e,delta:t,position:n,target:r})}function s(e,n,r,i){if(p(r)&&(i=r,r=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+db(e.width/2),y:e.y+db(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:r,data:{shape:n,context:i||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,i=r.get().slice();-1===i.indexOf(n)&&(i=[n]),i=function(e){var t=P(e,"id");return y(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(i),L(t,{shapes:i,validatedShapes:i,shape:n})})),e.on("shape.move.start",1250,(function(e){var t=e.context,n=t.validatedShapes;if(!(t.canExecute=o(n)))return!1})),e.on("shape.move.move",500,(function(e){var t,n=e.context,r=n.validatedShapes,i=e.hover,s={x:e.dx,y:e.dy};t=o(r,s,{x:e.x,y:e.y},i),n.delta=s,n.canExecute=t,n.target=null!==t?i:null})),e.on("shape.move.end",(function(e){var t=e.context,r=t.delta,i=t.canExecute,o="attach"===i,s=t.shapes;if(!1===i)return!1;r.x=db(r.x),r.y=db(r.y),0===r.x&&0===r.y||n.moveElements(s,r,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(ws(e)){var t=ms(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}hb.$inject=["eventBus","dragging","modeling","selection","rules"];var fb="djs-dragging",mb="drop-ok",gb="drop-not-ok",yb="new-parent",vb="attach-ok";function bb(e,t,n,i){function o(e){var t=function(e){var t=y(e,(function(t){return!fn(t)||m(e,M({id:t.source.id}))&&m(e,M({id:t.target.id}))}));return t}(s(e));return t}function s(e){var t=yt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),r=t.concat(n);return[...new Set(r)]}function a(e,n){[vb,mb,gb,yb].forEach((function(r){r===n?t.addMarker(e,r):t.removeMarker(e,r)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,p=l.allDraggedElements,u=o(c);if(!l.dragGroup){var d=Re("g");Oe(d,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),d),l.dragGroup=d}u.forEach((function(e){i.addDragger(e,l.dragGroup)})),v(p=p?r([p,s(c)]):s(c),(function(e){t.addMarker(e,fb)})),l.allDraggedElements=p,l.differentParents=1!==(a=P(c,(function(e){return e.parent&&e.parent.id})),k(a).length)})),e.on("shape.move.move",499,(function(e){var t=e.context,n=t.dragGroup,r=t.target,i=t.shape.parent,o=t.canExecute;r&&("attach"===o?a(r,vb):t.canExecute&&i&&r.id!==i.id?a(r,yb):a(r,t.canExecute?mb:gb)),Kn(n,e.dx,e.dy)})),e.on(["shape.move.out","shape.move.cleanup"],(function(e){var t=e.context.target;t&&a(t,null)})),e.on("shape.move.cleanup",(function(e){var n=e.context,r=n.allDraggedElements,i=n.dragGroup;v(r,(function(e){t.removeMarker(e,fb)})),i&&Ue(i)})),this.makeDraggable=function(e,n,r){i.addDragger(n,e.dragGroup),r&&t.addMarker(n,fb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}bb.$inject=["eventBus","canvas","styles","previewSupport"];var wb={__depends__:[Ps,Ns,ub,$c,Nc,Gp],__init__:["move","movePreview"],move:["type",hb],movePreview:["type",bb]},xb=".djs-palette-toggle",_b=".entry",Eb=xb+", "+_b,kb="djs-palette-",Ob="open",Pb="two-column";function Sb(e,t){this._eventBus=e,this._canvas=t;var n=this;e.on("tool-manager.update",(function(e){var t=e.tool;n.updateToolHighlight(t)})),e.on("i18n.changed",(function(){n._update()})),e.on("diagram.init",(function(){n._diagramInitialized=!0,n._rebuild()}))}function Cb(e,t){var n=t.getPaletteEntries();return d(n)?n(e):(v(n,(function(t,n){e[n]=t})),e)}Sb.$inject=["eventBus","canvas"],Sb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},Sb.prototype.getEntries=function(){return this._getProviders().reduce(Cb,{})},Sb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},Sb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),r=this._container=ge(Sb.HTML_MARKUP);n.appendChild(r),K(n).add(kb+"shown"),de.bind(r,Eb,"click",(function(t){if(ye(t.delegateTarget,xb))return e.toggle();e.trigger("click",t)})),ce.bind(r,"mousedown",(function(e){e.stopPropagation()})),de.bind(r,_b,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:r})},Sb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},Sb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),r=this._container,i=this._eventBus,o=K(r),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(Pb,t),s.toggle(kb+Pb,t),"open"in e&&(o.toggle(Ob,e.open),s.toggle(kb+Ob,e.open)),i.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},Sb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();ee(e),v(t,(function(t,n){var r=t.group||"default",i=ve("[data-group="+Yo(r)+"]",e);i||(X(i=ge('<div class="group"></div>'),"data-group",r),e.appendChild(i));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=ge(o);if(i.appendChild(s),!t.separator&&(X(s,"data-action",n),t.title&&X(s,"title",t.title),t.className&&function(e,t){var n=K(e),r=c(t)?t:t.split(/\s+/g);r.forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=ge("<img>");X(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},Sb.prototype.trigger=function(e,t,n){var r,i,o=t.delegateTarget||t.target;return o?(r=X(o,"data-action"),i=t.originalEvent||t,this.triggerEntry(r,e,i,n)):t.preventDefault()},Sb.prototype.triggerEntry=function(e,t,n,r){var i,o;if((i=this._entries[e])&&(o=i.action,!1!==this._eventBus.fire("palette.trigger",{entry:i,event:n}))){if(d(o)){if("click"===t)return o(n,r)}else if(o[t])return o[t](n,r);n.preventDefault()}},Sb.prototype._layoutChanged=function(){this._toggleState({})},Sb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},Sb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},Sb.prototype.open=function(){this._toggleState({open:!0})},Sb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},Sb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},Sb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),v(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var r=K(t);n=n.replace("-tool",""),r.contains("entry")&&n===e?r.add("highlighted-entry"):r.remove("highlighted-entry")}}))},Sb.prototype.isOpen=function(){return K(this._container).has(Ob)},Sb.prototype._getParentContainer=function(){return this._canvas.getContainer()},Sb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Tb={__init__:["palette"],palette:["type",Sb]},Mb="crosshair";function Ab(e,t,n,r,i,o,s){this._selection=i,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,r=t.getActiveLayer();Oe(n=e.frame=Re("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(r,n)},c=function(e){var t=e.frame,n=e.bbox;Oe(t,{x:n.x,y:n.y,width:n.width,height:n.height})},p=function(e){e.frame&&Ue(e.frame)};o.registerTool("lasso",{tool:"lasso.selection",dragging:"lasso"}),e.on("lasso.selection.end",(function(t){var n=t.originalEvent.target;(t.hover||n instanceof SVGElement)&&e.once("lasso.selection.ended",(function(){a.activateLasso(t.originalEvent,!0)}))})),e.on("lasso.end",0,(function(e){var t=e.context,n=Db(e),i=r.filter((function(e){return e})),o=_s(e);a.select(i,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Db(e),l(t),t.selection=i.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Db(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;p(t)})),e.on("element.mousedown",1500,(function(e){if(_s(e))return a.activateLasso(e.originalEvent),!0}))}function Db(e){var t={x:e.x-e.dx,y:e.y-e.dy},n={x:e.x,y:e.y};return t.x<=n.x&&t.y<n.y||t.x<n.x&&t.y<=n.y?{x:t.x,y:t.y,width:n.x-t.x,height:n.y-t.y}:t.x>=n.x&&t.y<n.y||t.x>n.x&&t.y<=n.y?{x:n.x,y:t.y,width:t.x-n.x,height:n.y-t.y}:t.x<=n.x&&t.y>n.y||t.x<n.x&&t.y>=n.y?{x:t.x,y:n.y,width:n.x-t.x,height:t.y-n.y}:t.x>=n.x&&t.y>n.y||t.x>n.x&&t.y>=n.y?{x:n.x,y:n.y,width:t.x-n.x,height:t.y-n.y}:{x:n.x,y:n.y,width:0,height:0}}Ab.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Ab.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:Mb,data:{context:{}}})},Ab.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:Mb,data:{context:{}},keepSelection:!0})},Ab.prototype.select=function(e,t,n=[]){var r=bt(e,t);this._selection.select([...n,...O(r)])},Ab.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ab.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Nb={__depends__:[qf,wf],__init__:["lassoTool"],lassoTool:["type",Ab]},Rb=1500,jb="grab";function Ib(e,t,n,r,i,o){this._dragging=n,this._mouse=o;var s=this,a=r.get("keyboard",!1);i.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Rb,(function(e){if(xs(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Rb,(function(e){if(Lb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Rb,(function(e){Lb(e.keyEvent)&&s.isActive()&&s.toggle()}),"keyboard.keyup"),e.on("hand.end",(function(t){var n=t.originalEvent.target;if(!(t.hover||n instanceof SVGElement))return!1;e.once("hand.ended",(function(){s.activateMove(t.originalEvent,{reactivate:!0})}))})),e.on("hand.move.move",(function(e){var n=t.viewbox().scale;t.scroll({dx:e.dx*n,dy:e.dy*n})})),e.on("hand.move.end",(function(t){var n=t.context.reactivate;return!xs(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Lb(e){return Bs("Space",e)}Ib.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Ib.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:jb,data:{context:n||{}}})},Ib.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:jb,data:{context:{reactivate:n}}})},Ib.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Ib.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var $b={__depends__:[qf,wf],__init__:["handTool"],handTool:["type",Ib]},zb="connect-ok",Bb="connect-not-ok";function qb(e,t,n,r,i,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,i.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,i=t.canStartConnect=a.canStartConnect(n);null!==i&&(t.startTarget=n,r.addMarker(n,i?zb:Bb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&r.removeMarker(t,n?zb:Bb)})),e.on(["global-connect.ended"],(function(t){var r=t.context.startTarget,i={x:t.x,y:t.y};if(a.canStartConnect(r))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,r,i)})),!1}))}qb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],qb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},qb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},qb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},qb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Fb={__depends__:[Bp,$c,Nc,qf,wf],globalConnect:["type",qb]};function Vb(e,t,n,r,i,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=r,this._lassoTool=i,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}Vb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],Vb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,r=this._spaceTool,i=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,r,i,o,s){function a(r){var i=n.createShape(L({type:e},s));t.start(r,i)}return{group:r,className:i,title:o,action:{dragstart:a,click:a}}}function c(e){var r=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),i=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:r});t.start(e,[r,i],{hints:{autoSelect:[r]}})}function p(e){t.start(e,n.createParticipantShape())}return L(e,{"hand-tool":{group:"tools",className:"bpmn-icon-hand-tool",title:a("Activate hand tool"),action:{click:function(e){o.activateHand(e)}}},"lasso-tool":{group:"tools",className:"bpmn-icon-lasso-tool",title:a("Activate lasso tool"),action:{click:function(e){i.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){r.activateSelection(e)}}},"global-connect-tool":{group:"tools",className:"bpmn-icon-connection-multi",title:a("Activate global connect tool"),action:{click:function(e){s.start(e)}}},"tool-separator":{group:"tools",separator:!0},"create.start-event":l("bpmn:StartEvent","event","bpmn-icon-start-event-none",a("Create start event")),"create.intermediate-event":l("bpmn:IntermediateThrowEvent","event","bpmn-icon-intermediate-event-none",a("Create intermediate/boundary event")),"create.end-event":l("bpmn:EndEvent","event","bpmn-icon-end-event-none",a("Create end event")),"create.exclusive-gateway":l("bpmn:ExclusiveGateway","gateway","bpmn-icon-gateway-none",a("Create gateway")),"create.task":l("bpmn:Task","activity","bpmn-icon-task",a("Create task")),"create.data-object":l("bpmn:DataObjectReference","data-object","bpmn-icon-data-object",a("Create data object reference")),"create.data-store":l("bpmn:DataStoreReference","data-store","bpmn-icon-data-store",a("Create data store reference")),"create.subprocess-expanded":{group:"activity",className:"bpmn-icon-subprocess-expanded",title:a("Create expanded sub-process"),action:{dragstart:c,click:c}},"create.participant-expanded":{group:"collaboration",className:"bpmn-icon-participant",title:a("Create pool/participant"),action:{dragstart:p,click:p}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var Hb={__depends__:[Tb,vf,am,Nb,$b,Fb,Mo],__init__:["paletteProvider"],paletteProvider:["type",Vb]};function Ub(e,t,n,r,i){Uo.call(this,e),e.on("shape.move.move",250,(function(e){var o=e.context,s=o.canExecute;o.visualReplacements||(o.visualReplacements={}),s&&s.replacements?function(e){v(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);L(a,{x:l.x,y:l.y});var c=n.createShape(a);r.addShape(c,l.parent);var p=ve('[data-element-id="'+Yo(l.id)+'"]',e.dragGroup);p&&Oe(p,{display:"none"});var u=i.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,r.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;v(t,(function(n,r){var i=ve('[data-element-id="'+Yo(r)+'"]',e.dragGroup);i&&Oe(i,{display:"inline"}),n.remove(),t[r]&&delete t[r]}))}(o)}))}Ub.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ub,Uo);var Wb={__depends__:[Gp],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ub]},Gb=40,Qb=20,Yb=10,Xb=20,Zb=["x","y"],Kb=Math.abs;function Jb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,r=t.start,i=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&i&&function(e,t,n){Zb.forEach((function(r){var i=nw(r,t);e[r]<t[r]+n?Tp(e,r,t[r]+n):e[r]>t[r]+i-n&&Tp(e,r,t[r]+i-n)}))}(e,i,function(e){return ki(e,"bpmn:Task")?Yb:Qb}(i)),i&&function(e,t){return _(t,(function(t){return tw(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=Sp(r),Oi(i,["bpmn:Event","bpmn:Gateway"])&&ew(e,Sp(i)),Oi(i,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=Sp(t);Zb.forEach((function(r){(function(e,t,n){return e[n]>t[n]+Xb&&e[n]<t[n]+nw(n,t)-Xb})(e,t,r)&&Tp(e,r,n[r])}))}(e,i),ki(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,r=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var i=Sp(n),o=_n(i,r,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,r=e[t];Kb(r-i[t])<Gb&&(n=r>i[t]?i[t]+Gb:i[t]-Gb,Tp(e,t,n))}))}(e)):tw(n,"bpmn:MessageFlow")?(ki(r,"bpmn:Event")&&(t.connectionStart=Sp(r)),ki(i,"bpmn:Event")&&ew(e,Sp(i))):t.connectionStart=t.initialConnectionStart)}))}function ew(e,t){Tp(e,"x",t.x),Tp(e,"y",t.y)}function tw(e,t){return e&&e.type===t}function nw(e,t){return"x"===e?t.width:t.height}function rw(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function iw(){this._snapValues={}}Jb.$inject=["eventBus"],rw.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},rw.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},rw.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},rw.prototype.getSnapLocations=function(){return this._snapLocations},rw.prototype.setSnapLocations=function(e){this._snapLocations=e},rw.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new iw).initDefaults(this._defaultSnaps),n},iw.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)},iw.prototype.snap=function(e,t,n,r){var i=this._snapValues[t];return i&&function(e,t,n){var r,i;for(n=void 0===n?10:n,r=0;r<t.length;r++)if(i=t[r],Ep(i-e)<=n)return i}(e[n],i[n],r)},iw.prototype.initDefaults=function(e){var t=this;v(e||{},(function(e,n){v(e,(function(e){t.add(n,e)}))}))};var ow=1250;function sw(e,t,n){var r=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){r.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],ow,(function(e){var t=e.context,i=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!Cp(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=r.addSnapTargetPoints(a,i,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}sw.$inject=["elementRegistry","eventBus","snapping"],sw.prototype.initSnap=function(e){var t,n=this._elementRegistry,r=e.context,i=r.shape,o=r.snapContext;o||(o=r.snapContext=new rw);var s=(t=n.get(i.id)?Sp(i,e):{x:e.x+Sp(i).x,y:e.y+Sp(i).y}).x-i.width/2,a=t.y-i.height/2,l=t.x+i.width/2,c=t.y+i.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),mn(i)||(o.setSnapOrigin("top-left",{x:s-e.x,y:a-e.y}),o.setSnapOrigin("bottom-right",{x:l-e.x,y:c-e.y})),o},sw.prototype.addSnapTargetPoints=function(e,t,n){return v(this.getSnapTargets(t,n),(function(n){if(mn(n))mn(t)&&e.add("mid",Sp(n));else if(fn(n)){if(n.waypoints.length<3)return;v(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",Sp(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",Sp(t)),e):e},sw.prototype.getSnapTargets=function(e,t){return Mp(t).filter((function(e){return!e.hidden}))};function aw(e,t){t.invoke(sw,this),e.on(["create.move","create.end"],1500,lw),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,r=t.target;n&&("attach"===n||n.attach)&&!Cp(e)&&function(e,t){var n,r=vn(t),i=xh(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(i)?Tp(e,"y",r.top-n.y):/bottom/.test(i)&&Tp(e,"y",r.bottom-n.y);/left/.test(i)?Tp(e,"x",r.left-n.x):/right/.test(i)&&Tp(e,"x",r.right-n.x)}(e,r)}))}function lw(e){var t=e.context.createConstraints;if(t){var n=t.top,r=t.right,i=t.bottom,o=t.left;(o&&o>=e.x||r&&r<=e.x)&&Tp(e,"x",e.x),(n&&n>=e.y||i&&i<=e.y)&&Tp(e,"y",e.y)}}function cw(e,t){return-1!==e.indexOf(t)}function pw(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(aw,sw),aw.$inject=["eventBus","injector"],aw.prototype.initSnap=function(e){var t=sw.prototype.initSnap.call(this,e),n=e.shape,r=!!this._elementRegistry.get(n.id);return v(n.outgoing,(function(n){var i=n.waypoints[0];i=i.original||i,t.setSnapOrigin(n.id+"-docking",pw(i,r,e))})),v(n.incoming,(function(n){var i=n.waypoints[n.waypoints.length-1];i=i.original||i,t.setSnapOrigin(n.id+"-docking",pw(i,r,e))})),ki(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},aw.prototype.addSnapTargetPoints=function(e,t,n){sw.prototype.addSnapTargetPoints.call(this,e,t,n);var r=this.getSnapTargets(t,n);v(r,(function(n){(function(e){if(ki(e,"bpmn:SubProcess")&&Hi(e))return!0;return ki(e,"bpmn:Participant")}(n)||function(e,t){return e.every((function(e){return ki(e,t)}))}([t,n],"bpmn:TextAnnotation"))&&(e.add("top-left",Op(n)),e.add("bottom-right",Pp(n)))}));var i=this._elementRegistry;return v(t.incoming,(function(n){if(i.get(t.id)){cw(r,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),v(t.outgoing,(function(n){if(i.get(t.id)){cw(r,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),ki(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},aw.prototype.getSnapTargets=function(e,t){return sw.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!ki(e,"bpmn:Lane")}))};function uw(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var r=e.context,i=r.shape,o=i.parent,s=r.direction,a=r.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||Cp(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,i,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Tp(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Tp(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function dw(e,t){var n=xn(e),r=vn(e),i={x:n.x,y:n.y};return-1!==t.indexOf("n")?i.y=r.top:-1!==t.indexOf("s")&&(i.y=r.bottom),-1!==t.indexOf("e")?i.x=r.right:-1!==t.indexOf("w")&&(i.x=r.left),i}uw.prototype.initSnap=function(e){var t=e.context,n=t.shape,r=t.direction,i=t.snapContext;i||(i=t.snapContext=new rw);var o=dw(n,r);return i.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),i},uw.prototype.addSnapTargetPoints=function(e,t,n,r){return v(this.getSnapTargets(t,n),(function(t){e.add("corner",Pp(t)),e.add("corner",Op(t))})),e.add("corner",dw(t,r)),e},uw.$inject=["eventBus","snapping"],uw.prototype.getSnapTargets=function(e,t){return Mp(t).filter((function(t){return!(n=t,r=e,n.host===r||fn(t)||function(e){return!!e.hidden}(t)||mn(t));var n,r}))};function hw(e){this._canvas=e,this._asyncHide=j(I(this.hide,this),1e3)}hw.$inject=["canvas"],hw.prototype.snap=function(e,t){var n=e.context.snapContext,r=n.getSnapLocations(),i={x:Cp(e,"x"),y:Cp(e,"y")};v(r,(function(r){var o=n.getSnapOrigin(r),s={x:e.x+o.x,y:e.y+o.y};if(v(["x","y"],(function(e){var n;i[e]||void 0!==(n=t.snap(s,r,e,7))&&(i[e]={value:n,originValue:n-o[e]})})),i.x&&i.y)return!1})),this.showSnapLine("vertical",i.x&&i.x.value),this.showSnapLine("horizontal",i.y&&i.y.value),v(["x","y"],(function(t){var n=i[t];p(n)&&Tp(e,t,n.originValue)}))},hw.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=Re("path");return Oe(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?Oe(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):Oe(n,{display:"none"})}}},hw.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},hw.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},hw.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},hw.prototype.hide=function(){v(this._snapLines,(function(e){e.update()}))};var fw={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",sw],resizeSnapping:["type",uw],snapping:["type",hw]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Jb],createMoveSnapping:["type",aw]};function mw(e,t,n,r){this._open=!1,this._results={},this._eventMaps=[],this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._canvas=e,this._eventBus=t,this._selection=n,this._translate=r,this._container=this._getBoxHtml(),this._searchInput=ve(mw.INPUT_SELECTOR,this._container),this._resultsContainer=ve(mw.RESULTS_CONTAINER_SELECTOR,this._container),this._canvas.getContainer().appendChild(this._container),t.on(["canvas.destroy","diagram.destroy","drag.init","elements.changed"],this.close,this)}function gw(e,t,n){var r=function(e){var t="";return e.forEach((function(e){var n=Zo(e.value||e.matched||e.normal),r=e.match||e.matched;t+=r?'<b class="'+mw.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),i=ge(n);i.innerHTML=r,e.appendChild(i)}mw.$inject=["canvas","eventBus","selection","translate"],mw.prototype._bindEvents=function(){var e=this;function t(t,n,r,i){e._eventMaps.push({el:t,type:r,listener:de.bind(t,n,r,i)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,mw.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,mw.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,mw.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,mw.INPUT_SELECTOR,"keydown",(function(e){Bs("ArrowUp",e)&&e.preventDefault(),Bs("ArrowDown",e)&&e.preventDefault()})),t(this._container,mw.INPUT_SELECTOR,"keyup",(function(t){if(Bs("Escape",t))return e.close();if(Bs("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return Bs("ArrowUp",t)?e._scrollToDirection(!0):Bs("ArrowDown",t)?e._scrollToDirection():void(Bs(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},mw.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){de.unbind(e.el,e.type,e.listener)}))},mw.prototype._search=function(e){var t=this;if(this._clearResults(),e.trim()){var n=this._searchProvider.find(e);if((n=n.filter((function(e){return!t._canvas.getRootElements().includes(e.element)}))).length){n.forEach((function(e){var n=e.element.id,r=t._createResultNode(e,n);t._results[n]={element:e.element,node:r}}));var r=ve(mw.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(r),this._preselect(r)}else this._selection.select(null)}},mw.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},mw.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,r=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<r&&(this._resultsContainer.scrollTop=r)}},mw.prototype._clearResults=function(){ee(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},mw.prototype._getCurrentResult=function(){return ve(mw.RESULT_SELECTED_SELECTOR,this._resultsContainer)},mw.prototype._createResultNode=function(e,t){var n=ge(mw.RESULT_HTML);return e.primaryTokens.length>0&&gw(n,e.primaryTokens,mw.RESULT_PRIMARY_HTML),gw(n,e.secondaryTokens,mw.RESULT_SECONDARY_HTML),X(n,mw.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},mw.prototype.registerProvider=function(e){this._searchProvider=e},mw.prototype.open=function(){if(!this._searchProvider)throw new Error("no search provider registered");this.isOpen()||(this._cachedRootElement=this._canvas.getRootElement(),this._cachedSelection=this._selection.get(),this._cachedViewbox=this._canvas.viewbox(),this._selection.select(null),this._bindEvents(),this._open=!0,K(this._canvas.getContainer()).add("djs-search-open"),K(this._container).add("open"),this._searchInput.focus(),this._eventBus.fire("searchPad.opened"))},mw.prototype.close=function(e=!0){this.isOpen()&&(e&&(this._cachedRootElement&&this._canvas.setRootElement(this._cachedRootElement),this._cachedSelection&&this._selection.select(this._cachedSelection),this._cachedViewbox&&this._canvas.viewbox(this._cachedViewbox),this._eventBus.fire("searchPad.restored")),this._cachedRootElement=null,this._cachedSelection=null,this._cachedViewbox=null,this._unbindEvents(),this._open=!1,K(this._canvas.getContainer()).remove("djs-search-open"),K(this._container).remove("open"),this._clearResults(),this._searchInput.value="",this._searchInput.blur(),this._eventBus.fire("searchPad.closed"),this._canvas.restoreFocus())},mw.prototype.toggle=function(){this.isOpen()?this.close():this.open()},mw.prototype.isOpen=function(){return this._open},mw.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(mw.RESULT_SELECTED_CLASS);var n=X(e,mw.RESULT_ID_ATTRIBUTE),r=this._results[n].element;K(e).add(mw.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(r,{top:300}),this._selection.select(r),this._eventBus.fire("searchPad.preselected",r)}},mw.prototype._select=function(e){var t=X(e,mw.RESULT_ID_ATTRIBUTE),n=this._results[t].element;this._cachedSelection=null,this._cachedViewbox=null,this.close(!1),this._canvas.scrollToElement(n,{top:300}),this._selection.select(n),this._eventBus.fire("searchPad.selected",n)},mw.prototype._getBoxHtml=function(){const e=ge(mw.BOX_HTML),t=ve(mw.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},mw.CONTAINER_SELECTOR=".djs-search-container",mw.INPUT_SELECTOR=".djs-search-input input",mw.RESULTS_CONTAINER_SELECTOR=".djs-search-results",mw.RESULT_SELECTOR=".djs-search-result",mw.RESULT_SELECTED_CLASS="djs-search-result-selected",mw.RESULT_SELECTED_SELECTOR="."+mw.RESULT_SELECTED_CLASS,mw.RESULT_ID_ATTRIBUTE="data-result-id",mw.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",mw.BOX_HTML='<div class="djs-search-container djs-scrollable">\n <div class="djs-search-input">\n <svg class="djs-search-icon" width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">\n <path fill-rule="evenodd" clip-rule="evenodd" d="M9.0325 8.5H9.625L13.3675 12.25L12.25 13.3675L8.5 9.625V9.0325L8.2975 8.8225C7.4425 9.5575 6.3325 10 5.125 10C2.4325 10 0.25 7.8175 0.25 5.125C0.25 2.4325 2.4325 0.25 5.125 0.25C7.8175 0.25 10 2.4325 10 5.125C10 6.3325 9.5575 7.4425 8.8225 8.2975L9.0325 8.5ZM1.75 5.125C1.75 6.9925 3.2575 8.5 5.125 8.5C6.9925 8.5 8.5 6.9925 8.5 5.125C8.5 3.2575 6.9925 1.75 5.125 1.75C3.2575 1.75 1.75 3.2575 1.75 5.125Z" fill="#22242A"/>\n </svg>\n <input type="text" spellcheck="false" />\n </div>\n <div class="djs-search-results" />\n</div>',mw.RESULT_HTML='<div class="djs-search-result"></div>',mw.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',mw.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var yw={__depends__:[Mo,Fo,Ns],searchPad:["type",mw]};function vw(e,t,n,r){this._elementRegistry=e,this._canvas=n,this._search=r,t.registerProvider(this)}function bw(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}vw.$inject=["elementRegistry","searchPad","canvas","search"],vw.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!mn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:no(e),id:e.id}))),e,{keys:["label","id"]}).map(bw)};var ww={__depends__:[yw,Xl],__init__:["bpmnSearch"],bpmnSearch:["type",vw]};const xw={width:36,height:50},_w={width:50,height:50};function Ew(e,t,n){return Re("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function kw(e,t){this._styles=t,e.registerProvider(this)}function Ow(e,t){var n;return"bpmn:DataObjectReference"===t?n=xw:"bpmn:DataStoreReference"===t&&(n=_w),e.width===n.width&&e.height===n.height}kw.$inject=["outline","styles"],kw.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!mn(e))return ki(e,"bpmn:Gateway")?(L((n=Re("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),Oe(n,L({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):Oi(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?Oe(n=Re("rect"),L({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):ki(e,"bpmn:EndEvent")?Oe(n=Re("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):ki(e,"bpmn:Event")?Oe(n=Re("circle"),L({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):ki(e,"bpmn:DataObjectReference")&&Ow(e,"bpmn:DataObjectReference")?n=Ew("M44.7648 11.3263L36.9892 2.64074C36.0451 1.58628 34.5651 0.988708 33.1904 0.988708H5.98667C3.22688 0.988708 0.989624 3.34892 0.989624 6.26039V55.0235C0.989624 57.9349 3.22688 60.2952 5.98667 60.2952H40.966C43.7257 60.2952 45.963 57.9349 45.963 55.0235V14.9459C45.963 13.5998 45.6407 12.3048 44.7648 11.3263Z",{x:-6,y:-6},t):ki(e,"bpmn:DataStoreReference")&&Ow(e,"bpmn:DataStoreReference")&&(n=Ew("M1.03845 48.1347C1.03845 49.3511 1.07295 50.758 1.38342 52.064C1.69949 53.3938 2.32428 54.7154 3.56383 55.6428C6.02533 57.4841 10.1161 58.7685 14.8212 59.6067C19.5772 60.4538 25.1388 60.8738 30.6831 60.8738C36.2276 60.8738 41.7891 60.4538 46.545 59.6067C51.2504 58.7687 55.3412 57.4842 57.8028 55.6429C59.0424 54.7156 59.6673 53.3938 59.9834 52.064C60.2938 50.7579 60.3285 49.351 60.3285 48.1344V13.8415C60.3285 12.6249 60.2938 11.218 59.9834 9.91171C59.6673 8.58194 59.0423 7.2602 57.8027 6.33294C55.341 4.49168 51.2503 3.20723 46.545 2.36914C41.7891 1.522 36.2276 1.10204 30.6831 1.10205C25.1388 1.10206 19.5772 1.52206 14.8213 2.36923C10.1162 3.20734 6.02543 4.49183 3.5639 6.33314C2.32433 7.26038 1.69951 8.58206 1.38343 9.91181C1.07295 11.2179 1.03845 12.6247 1.03845 13.8411V48.1347Z",{x:-6,y:-6},t)),n},kw.prototype.updateOutline=function(e,t){if(!mn(e))return Oi(e,["bpmn:SubProcess","bpmn:Group"])?(Oe(t,{width:e.width+10,height:e.height+10}),!0):!!Oi(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var Pw={__depends__:[ub],__init__:["outlineProvider"],outlineProvider:["type",kw]};function Sw(e){Vi.call(this,e)}e(Sw,Vi),Sw.Viewer=Rs,Sw.NavigatedViewer=fa,Sw.prototype.createDiagram=function(){return this.importXML('<?xml version="1.0" encoding="UTF-8"?><bpmn:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" targetNamespace="http://bpmn.io/schema/bpmn" id="Definitions_1"><bpmn:process id="Process_1" isExecutable="false"><bpmn:startEvent id="StartEvent_1"/></bpmn:process><bpmndi:BPMNDiagram id="BPMNDiagram_1"><bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1"><bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"><dc:Bounds height="36.0" width="36.0" x="173.0" y="102.0"/></bpmndi:BPMNShape></bpmndi:BPMNPlane></bpmndi:BPMNDiagram></bpmn:definitions>')},Sw.prototype._interactionModules=[Ks,aa,ha],Sw.prototype._modelingModules=[ic,xc,Ic,Pc,Rp,Bp,Fp,Xy,Mf,vf,rv,cv,kv,Pv,Cv,Iv,eb,yy,lb,wb,Hb,Wb,Gv,fw,ww,Pw],Sw.prototype._modules=[].concat(Rs.prototype._modules,Sw.prototype._interactionModules,Sw.prototype._modelingModules);var Cw=new Io,Tw={min:.2,max:4};function Mw(e,t,n,r,i){var o=this;function s(e){o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Dw(Aw({x:e.x-o._state._svgClientRect.left,y:e.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),o._canvas),o._update()}function a(e){return function(t){var n=Bw(t);o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var i=Aw({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=r.viewbox(),p=function(e,t){var n={x:t.x+t.width/2,y:t.y+t.height/2};return{x:e.x-n.x,y:e.y-n.y}}(i,a),u=o._viewportDom.getBoundingClientRect(),d={x:n.x-u.left+1,y:n.y-u.top+1};L(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:p,offsetViewportDom:d,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),ce.bind(document,"mousemove",l),ce.bind(document,"mouseup",c)}}function l(e){var t=Bw(e);if(o._state.isDragging){o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,r=o._state.viewportClientRect,i=o._state.parentClientRect;L(o._viewportDom.style,{top:t.y-n.y-i.top+"px",left:t.x-n.x-i.left+"px"});var s=Lw(i,{top:t.y-n.y-i.top,left:t.x-n.x-i.left,width:r.width,height:r.height});L(o._overlay.style,{clipPath:s});var a=Aw({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Dw({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=Bw(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),L(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),ce.unbind(document,"mousemove",l),ce.unbind(document,"mouseup",c))}this._canvas=r,this._elementRegistry=i,this._eventBus=n,this._injector=t,this._state={isOpen:void 0,isDragging:!1,initialDragPosition:null,offsetViewport:null,cachedViewbox:null,dragger:null,svgClientRect:null,parentClientRect:null,zoomDelta:0},this._minimapId=Cw.next(),this._init(),this.toggle(e&&e.open||!1),ce.bind(this._viewportDom,"mousedown",a(!1)),ce.bind(this._svg,"mousedown",a(!0)),ce.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!jw(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),t=e,n=o._state._svgClientRect,t.x>n.left&&t.x<n.left+n.width&&t.y>n.top&&t.y<n.top+n.height)){var t,n,i=0===e.deltaMode?.02:.32,s=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Iw(e.deltaY)*-i;if(o._state.zoomDelta+=s,Math.abs(o._state.zoomDelta)>.1){var a=s>0?1:-1,l=Math.log(r.zoom())/Math.log(10),c=function(e,t){var n=Math.log(e.min)/Math.log(10),r=Math.log(e.max)/Math.log(10);return(Math.abs(n)+Math.abs(r))/t}(Tw,20),p=Math.round(l/c)*c;p+=c*a;var u=Math.pow(10,p);r.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Tw,u),d),o._state.zoomDelta=0;var d=Aw({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Dw(d,o._canvas),o._update()}}})),ce.bind(this._toggle,"click",(function(e){e.preventDefault(),e.stopPropagation(),o.toggle()})),n.on(["shape.added","connection.added"],(function(e){var t=e.element;o._addElement(t),o._update()})),n.on(["shape.removed","connection.removed"],(function(e){var t=e.element;o._removeElement(t),o._update()})),n.on("elements.changed",250,(function(e){e.elements.forEach((function(e){o._updateElement(e)})),o._update()})),n.on("element.updateId",(function(e){var t=e.element,n=e.newId;o._updateElementId(t,n)})),n.on("canvas.viewbox.changed",(function(){o._state.isDragging||o._update()})),n.on("canvas.resized",(function(){document.body.contains(o._parent)&&(o._state.isDragging||o._update(),o._state._svgClientRect=o._svg.getBoundingClientRect())})),n.on(["root.set","plane.set"],(function(e){o._clear(),(e.element||e.plane.rootElement).children.forEach((function(e){o._addElement(e)})),o._update()}))}function Aw(e,t,n){var r=t.getBoundingClientRect(),i=function(e,t){var n=e.width/e.height,r=L({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var i=r.width*(1/t);L(r,{y:r.y-(i-r.height)/2,height:i})}else if(n<t){var o=r.height*t;L(r,{x:r.x-(o-r.width)/2,width:o})}return r}(n,r.width/r.height);return{x:Nw(e.x,0,r.width,i.x,i.x+i.width),y:Nw(e.y,0,r.height,i.y,i.y+i.height)}}function Dw(e,t){var n=t.viewbox(),r=n.width,i=n.height;t.viewbox({x:e.x-r/2,y:e.y-i/2,width:r,height:i})}function Nw(e,t,n,r,i){return(e-t)*(i-r)/(n-t)+r}function Rw(e,t,n){var r=function(e){var t=ve(".children",e);t||xe(e,t=Re("g",{class:"children"}));return t}(t),i=[].slice.call(r.childNodes)[n];i?t.insertBefore(e,i.nextSibling):t.appendChild(e)}function jw(e){return 0===e.width&&0===e.height}Mw.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],Mw.prototype._init=function(){var e=this._canvas.getContainer(),t=this._parent=document.createElement("div");K(t).add("djs-minimap"),e.appendChild(t);var n=this._toggle=document.createElement("div");K(n).add("toggle"),t.appendChild(n);var r=this._map=document.createElement("div");K(r).add("map"),t.appendChild(r);var i=this._svg=Re("svg");Oe(i,{width:"100%",height:"100%"}),xe(r,i),xe(i,this._elementsGroup=Re("g"));var o=this._viewportGroup=Re("g");xe(i,o);var s=this._viewport=Re("rect");Se(s).add("viewport"),xe(o,s),ce.bind(t,"mousedown",(function(e){e.stopPropagation()}));var a=this._viewportDom=document.createElement("div");K(a).add("viewport-dom"),this._parent.appendChild(a);var l=this._overlay=document.createElement("div");K(l).add("overlay"),this._parent.appendChild(l)},Mw.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(zw(e)){var r,i,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(r=t.x-a/2,o=n.width,t.x+t.width<n.width&&(r=Math.min(0,t.x))):(r=t.x,o=t.width),t.height<n.height?(i=t.y-l/2,s=n.height,t.y+t.height<n.height&&(i=Math.min(0,t.y))):(i=t.y,s=t.height),r-=50,i-=50,o+=100,s+=100,this._lastViewbox={x:r,y:i,width:o,height:s},Oe(this._svg,{viewBox:r+", "+i+", "+o+", "+s}),Oe(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),p=this._viewport.getBoundingClientRect(),u={top:p.top-c.top,left:p.left-c.left,width:p.width,height:p.height};L(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var d=Lw(c,u);L(this._overlay.style,{clipPath:d})}},Mw.prototype.open=function(){L(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},Mw.prototype.close=function(){L(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};X(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},Mw.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},Mw.prototype.isOpen=function(){return this._state.isOpen},Mw.prototype._updateElement=function(e){try{void 0!==e.parent&&null!==e.parent&&(this._removeElement(e),this._addElement(e))}catch(e){console.warn("Minimap#_updateElement errored",e)}},Mw.prototype._updateElementId=function(e,t){try{var n=ve("#"+Yo(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},Mw.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},Mw.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,r,i,o=this._createElement(e),s=ve("#"+Yo(this._prefixId(e.parent.id)),this._elementsGroup);if(o){var a=function(e,t){var n=ve(".djs-children",t.parentNode);if(!n)return;var r=[].slice.call(n.childNodes),i=-1;return r.forEach((function(t,n){ve(".djs-element",t)===e&&(i=n)})),i}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Rw(o,s,a):Rw(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(r=e.x,i=e.y,s&&(r-=(n=e.parent).x,i-=n.y),Oe(o,{transform:"translate("+r+" "+i+")"})):(r=0,i=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(r=-n.x,i=-n.y),Oe(o,{transform:"translate("+r+" "+i+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},Mw.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&Ue(t)},Mw.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Xn(n))){var r=function(e){return be("[id]",e).forEach((function(e){e.remove()})),e}(Me(t));return Oe(r,{id:this._prefixId(e.id)}),r}},Mw.prototype._clear=function(){Te(this._elementsGroup)},Mw.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Iw=Math.sign||function(e){return e>=0?1:-1};function Lw(e,t){return"polygon("+[$w(t.left,t.top),$w(t.left+t.width,t.top),$w(t.left+t.width,t.top+t.height),$w(t.left,t.top+t.height),$w(t.left,e.height),$w(e.width,e.height),$w(e.width,0),$w(0,0),$w(0,e.height),$w(t.left,e.height)].join(", ")+")"}function $w(e,t){return e+"px "+t+"px"}function zw(e){return x(e,(function(e){return p(e)?zw(e):u(e)&&isFinite(e)}))}function Bw(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var qw={__init__:["minimap"],minimap:["type",Mw]},Fw=1e5,Vw=1e5;function Hw(e,t){this._canvas=e;var n=this;t.on("diagram.init",(function(){n._init(),n.toggle(!0)})),t.on("gridSnapping.toggle",(function(e){var t=e.active;n.toggle(t),n._centerGridAroundViewbox()})),t.on("canvas.viewbox.changed",(function(e){var t=e.viewbox;n._centerGridAroundViewbox(t)}))}Hw.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=Re("defs"),xe(this._canvas._svg,e));var t=this._pattern=Re("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());Oe(t,{id:n,width:uv,height:uv,patternUnits:"userSpaceOnUse"});var r=this._circle=Re("circle");Oe(r,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,r),xe(e,t),Oe(this._gfx=Re("rect"),{x:-Fw/2,y:-Vw/2,width:Fw,height:Vw,fill:`url(#${n})`})},Hw.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=xn(e);Oe(this._gfx,{x:-Fw/2+dv(t.x,uv),y:-Vw/2+dv(t.y,uv)})},Hw.prototype.isVisible=function(){return this._visible},Hw.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Te(t),this._visible=e}},Hw.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},Hw.$inject=["canvas","eventBus"];var Uw={__init__:["grid"],grid:["type",Hw]};function Ww(e,t){var n,r,i=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Yw("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Yw("path",{class:Qw("border"),d:Gw(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:i,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Yw("path",{d:Gw(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Qw("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(r=Yw("text",{x:-40,y:-10,fill:o,class:Qw("label")})).textContent="(0, 0)",xe(n,r)}function Gw(e){return e.join(" ")}function Qw(e){return"djs-origin-"+e}function Yw(e,t){var n=Re(e);return Oe(n,t),n}Ww.$inject=["config.origin","canvas"];var Xw={__init__:[Ww]},Zw={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Kw(e,t,n,r,i,o){function s(e,n){var r=n.offset,i=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+r[n],a=t.get("gridSnapping",!1);a&&(s=function(e,t,n){n||(n="round");return Math[n](e/t)*t}(s,a.getGridSpacing())),o[n]=Math.abs(s)<i?0:s})),o}function a(){var t=i.viewbox().inner,n=i.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||r.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,r=i.viewbox().scale;i.scroll({dx:e*n.x*r,dy:e*n.y*r})}))}}var c,p,d;e=function(e){var t=L({},Zw,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),r.register("elements.alignToOrigin",{preExecute:function(e){var t=e.delta,n=e.elements;o.moveElements(n,t)},execute:l(-1),revert:l(1)}),e.alignOnSave&&(c=t.get("_parent",!1),p=n,((d=c&&c._eventBus)||p).on("saveXML.start",1250,a),d&&p.on("diagram.destroy",(function(){d.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Kw.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Jw={__init__:["alignToOrigin"],alignToOrigin:["type",Kw]};function ex(e){function t(e){if(!e.labelTarget){var t=Pi(e);ki(t,"bpmn:Participant")&&(t=t.processRef),ki(t,"bpmn:Process")&&(t.isExecutable=!!t.isExecutable)}}e.on(["shape.added","root.added"],(function(e){t(e.element)})),e.on("elements.changed",(function(e){e.elements.forEach((function(e){t(e)}))}))}ex.$inject=["eventBus"];var tx,nx,rx,ix,ox,sx,ax,lx,cx={__init__:[ex]},px={},ux=[],dx=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,hx=Array.isArray;function fx(e,t){for(var n in t)e[n]=t[n];return e}function mx(e){var t=e.parentNode;t&&t.removeChild(e)}function gx(e,t,n){var r,i,o,s={};for(o in t)"key"==o?r=t[o]:"ref"==o?i=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?tx.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(o in e.defaultProps)void 0===s[o]&&(s[o]=e.defaultProps[o]);return yx(e,s,r,i,null)}function yx(e,t,n,r,i){var o={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==i?++rx:i,__i:-1,__u:0};return null==i&&null!=nx.vnode&&nx.vnode(o),o}function vx(e){return e.children}function bx(e,t){this.props=e,this.context=t}function wx(e,t){if(null==t)return e.__?wx(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?wx(e):null}function xx(e){var t,n;if(null!=(e=e.__)&&null!=e.__c){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e){e.__e=e.__c.base=n.__e;break}return xx(e)}}function _x(e){(!e.__d&&(e.__d=!0)&&ix.push(e)&&!Ex.__r++||ox!==nx.debounceRendering)&&((ox=nx.debounceRendering)||sx)(Ex)}function Ex(){var e,t,n,r,i,o,s,a,l;for(ix.sort(ax);e=ix.shift();)e.__d&&(t=ix.length,r=void 0,o=(i=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((r=fx({},i)).__v=i.__v+1,nx.vnode&&nx.vnode(r),Dx(s,r,i,n.__n,void 0!==s.ownerSVGElement,32&i.__u?[o]:null,a,null==o?wx(i):o,!!(32&i.__u),l),r.__.__k[r.__i]=r,Nx(a,r,l),r.__e!=o&&xx(r)),ix.length>t&&ix.sort(ax));Ex.__r=0}function kx(e,t,n,r,i,o,s,a,l,c,p){var u,d,h,f,m,g=r&&r.__k||ux,y=t.length;for(n.__d=l,function(e,t,n){var r,i,o,s,a,l=t.length,c=n.length,p=c,u=0;for(e.__k=[],r=0;r<l;r++)null!=(i=e.__k[r]=null==(i=t[r])||"boolean"==typeof i||"function"==typeof i?null:"string"==typeof i||"number"==typeof i||"bigint"==typeof i||i.constructor==String?yx(null,i,null,null,i):hx(i)?yx(vx,{children:i},null,null,null):void 0===i.constructor&&i.__b>0?yx(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)?(i.__=e,i.__b=e.__b+1,a=Sx(i,n,s=r+u,p),i.__i=a,o=null,-1!==a&&(p--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof i.type&&(i.__u|=65536)):a!==s&&(a===s+1?u++:a>s?p>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==r+u&&(i.__u|=65536))):(o=n[r])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=wx(o)),jx(o,o,!1),n[r]=null,p--);if(p)for(r=0;r<c;r++)null!=(o=n[r])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=wx(o)),jx(o,o))}(n,t,g),l=n.__d,u=0;u<y;u++)null!=(h=n.__k[u])&&"boolean"!=typeof h&&"function"!=typeof h&&(d=-1===h.__i?px:g[h.__i]||px,h.__i=u,Dx(e,h,d,i,o,s,a,l,c,p),f=h.__e,h.ref&&d.ref!=h.ref&&(d.ref&&Rx(d.ref,null,h),p.push(h.ref,h.__c||f,h)),null==m&&null!=f&&(m=f),65536&h.__u||d.__k===h.__k?l=Ox(h,l,e):"function"==typeof h.type&&void 0!==h.__d?l=h.__d:f&&(l=f.nextSibling),h.__d=void 0,h.__u&=-196609);n.__d=l,n.__e=m}function Ox(e,t,n){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=Ox(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function Px(e,t){return t=t||[],null==e||"boolean"==typeof e||(hx(e)?e.some((function(e){Px(e,t)})):t.push(e)),t}function Sx(e,t,n,r){var i=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&i==l.key&&o===l.type)return n;if(r>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&i==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&i==l.key&&o===l.type)return a;a++}}return-1}function Cx(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||dx.test(t)?n:n+"px"}function Tx(e,t,n,r,i){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof r&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Cx(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||Cx(e.style,t,n[t])}else if("o"===t[0]&&"n"===t[1])o=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+o]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,o?Ax:Mx,o)):e.removeEventListener(t,o?Ax:Mx,o);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!==t&&"height"!==t&&"href"!==t&&"list"!==t&&"form"!==t&&"tabIndex"!==t&&"download"!==t&&"rowSpan"!==t&&"colSpan"!==t&&"role"!==t&&t in e)try{e[t]=null==n?"":n;break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!==t[4]?e.removeAttribute(t):e.setAttribute(t,n))}}function Mx(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(nx.event?nx.event(e):e)}function Ax(e){return this.l[e.type+!0](nx.event?nx.event(e):e)}function Dx(e,t,n,r,i,o,s,a,l,c){var p,u,d,h,f,m,g,y,v,b,w,x,_,E,k,O=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(l=!!(32&n.__u),o=[a=t.__e=n.__e]),(p=nx.__b)&&p(t);e:if("function"==typeof O)try{if(y=t.props,v=(p=O.contextType)&&r[p.__c],b=p?v?v.props.value:p.__:r,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(y,b):(t.__c=u=new bx(y,b),u.constructor=O,u.render=Ix),v&&v.sub(u),u.props=y,u.state||(u.state={}),u.context=b,u.__n=r,d=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=fx({},u.__s)),fx(u.__s,O.getDerivedStateFromProps(y,u.__s))),h=u.props,f=u.state,u.__v=t,d)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&y!==h&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(y,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(y,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=y,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),w=0;w<u._sb.length;w++)u.__h.push(u._sb[w]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(y,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(h,f,m)}))}if(u.context=b,u.props=y,u.__P=e,u.__e=!1,x=nx.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),E=0;E<u._sb.length;E++)u.__h.push(u._sb[E]);u._sb=[]}else do{u.__d=!1,x&&x(t),p=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(r=fx(fx({},r),u.getChildContext())),d||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(h,f)),kx(e,hx(k=null!=p&&p.type===vx&&null==p.key?p.props.children:p)?k:[k],t,n,r,i,o,s,a,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),g&&(u.__E=u.__=null)}catch(e){t.__v=null,l||null!=o?(t.__e=a,t.__u|=l?160:32,o[o.indexOf(a)]=null):(t.__e=n.__e,t.__k=n.__k),nx.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=function(e,t,n,r,i,o,s,a,l){var c,p,u,d,h,f,m,g=n.props,y=t.props,v=t.type;if("svg"===v&&(i=!0),null!=o)for(c=0;c<o.length;c++)if((h=o[c])&&"setAttribute"in h==!!v&&(v?h.localName===v:3===h.nodeType)){e=h,o[c]=null;break}if(null==e){if(null===v)return document.createTextNode(y);e=i?document.createElementNS("http://www.w3.org/2000/svg",v):document.createElement(v,y.is&&y),o=null,a=!1}if(null===v)g===y||a&&e.data===y||(e.data=y);else{if(o=o&&tx.call(e.childNodes),g=n.props||px,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(h=e.attributes[c]).name]=h.value;for(c in g)h=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=h:"key"===c||c in y||Tx(e,c,null,h,i));for(c in y)h=y[c],"children"==c?d=h:"dangerouslySetInnerHTML"==c?p=h:"value"==c?f=h:"checked"==c?m=h:"key"===c||a&&"function"!=typeof h||g[c]===h||Tx(e,c,h,g[c],i);if(p)a||u&&(p.__html===u.__html||p.__html===e.innerHTML)||(e.innerHTML=p.__html),t.__k=[];else if(u&&(e.innerHTML=""),kx(e,hx(d)?d:[d],t,n,r,i&&"foreignObject"!==v,o,s,o?o[0]:n.__k&&wx(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&mx(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===v&&!f||"option"===v&&f!==g[c])&&Tx(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Tx(e,c,m,g[c],!1))}return e}(n.__e,t,n,r,i,o,s,l,c);(p=nx.diffed)&&p(t)}function Nx(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)Rx(n[r],n[++r],n[++r]);nx.__c&&nx.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){nx.__e(e,t.__v)}}))}function Rx(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){nx.__e(e,n)}}function jx(e,t,n){var r,i;if(nx.unmount&&nx.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||Rx(r,null,t)),null!=(r=e.__c)){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){nx.__e(e,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&jx(r[i],t,n||"function"!=typeof e.type);n||null==e.__e||mx(e.__e),e.__=e.__e=e.__d=void 0}function Ix(e,t,n){return this.constructor(e,n)}function Lx(e,t,n){var r,i,o,s;nx.__&&nx.__(e,t),i=(r="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Dx(t,e=(!r&&n||t).__k=gx(vx,null,[e]),i||px,px,void 0!==t.ownerSVGElement,!r&&n?[n]:i?null:t.firstChild?tx.call(t.childNodes):null,o,!r&&n?n:i?i.__e:t.firstChild,r,s),Nx(o,e,s)}function $x(e,t){var n={__c:t="__cC"+lx++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,r;return this.getChildContext||(n=[],(r={})[t]=this,this.getChildContext=function(){return r},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,_x(e)}))},this.sub=function(e){n.push(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n.splice(n.indexOf(e),1),t&&t.call(e)}}),e.children}};return n.Provider.__=n.Consumer.contextType=n}tx=ux.slice,nx={__e:function(e,t,n,r){for(var i,o,s;t=t.__;)if((i=t.__c)&&!i.__)try{if((o=i.constructor)&&null!=o.getDerivedStateFromError&&(i.setState(o.getDerivedStateFromError(e)),s=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(e,r||{}),s=i.__d),s)return i.__E=i}catch(t){e=t}throw e}},rx=0,bx.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=fx({},this.state),"function"==typeof e&&(e=e(fx({},n),this.props)),e&&fx(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),_x(this))},bx.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_x(this))},bx.prototype.render=vx,ix=[],sx="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ax=function(e,t){return e.__v.__b-t.__v.__b},Ex.__r=0,lx=0;var zx,Bx,qx,Fx,Vx=0,Hx=[],Ux=[],Wx=nx.__b,Gx=nx.__r,Qx=nx.diffed,Yx=nx.__c,Xx=nx.unmount;function Zx(e,t){nx.__h&&nx.__h(Bx,e,Vx||t),Vx=0;var n=Bx.__H||(Bx.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:Ux}),n.__[e]}function Kx(e){return Vx=1,Jx(d_,e)}function Jx(e,t,n){var r=Zx(zx++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):d_(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Bx,!Bx.u)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=r.__c.__H.__.filter((function(e){return e.__c}));if(i.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return i.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&r.__c.props===e)&&(!o||o.call(this,e,t,n))};Bx.u=!0;var o=Bx.shouldComponentUpdate,s=Bx.componentWillUpdate;Bx.componentWillUpdate=function(e,t,n){if(this.__e){var r=o;o=void 0,i(e,t,n),o=r}s&&s.call(this,e,t,n)},Bx.shouldComponentUpdate=i}return r.__N||r.__}function e_(e,t){var n=Zx(zx++,3);!nx.__s&&u_(n.__H,t)&&(n.__=e,n.i=t,Bx.__H.__h.push(n))}function t_(e,t){var n=Zx(zx++,4);!nx.__s&&u_(n.__H,t)&&(n.__=e,n.i=t,Bx.__h.push(n))}function n_(e){return Vx=5,r_((function(){return{current:e}}),[])}function r_(e,t){var n=Zx(zx++,7);return u_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function i_(e,t){return Vx=8,r_((function(){return e}),t)}function o_(e){var t=Bx.context[e.__c],n=Zx(zx++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Bx)),t.props.value):e.__}function s_(){for(var e;e=Hx.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(c_),e.__H.__h.forEach(p_),e.__H.__h=[]}catch(t){e.__H.__h=[],nx.__e(t,e.__v)}}nx.__b=function(e){Bx=null,Wx&&Wx(e)},nx.__r=function(e){Gx&&Gx(e),zx=0;var t=(Bx=e.__c).__H;t&&(qx===Bx?(t.__h=[],Bx.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=Ux,e.__N=e.i=void 0}))):(t.__h.forEach(c_),t.__h.forEach(p_),t.__h=[],zx=0)),qx=Bx},nx.diffed=function(e){Qx&&Qx(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Hx.push(t)&&Fx===nx.requestAnimationFrame||((Fx=nx.requestAnimationFrame)||l_)(s_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==Ux&&(e.__=e.__V),e.i=void 0,e.__V=Ux}))),qx=Bx=null},nx.__c=function(e,t){t.some((function(e){try{e.__h.forEach(c_),e.__h=e.__h.filter((function(e){return!e.__||p_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],nx.__e(n,e.__v)}})),Yx&&Yx(e,t)},nx.unmount=function(e){Xx&&Xx(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{c_(e)}catch(e){t=e}})),n.__H=void 0,t&&nx.__e(t,n.__v))};var a_="function"==typeof requestAnimationFrame;function l_(e){var t,n=function(){clearTimeout(r),a_&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);a_&&(t=requestAnimationFrame(n))}function c_(e){var t=Bx,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Bx=t}function p_(e){var t=Bx;e.__c=e.__(),Bx=t}function u_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function d_(e,t){return"function"==typeof t?t(e):t}function h_(e,t){for(var n in t)e[n]=t[n];return e}function f_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var r in t)if("__source"!==r&&e[r]!==t[r])return!0;return!1}function m_(e){this.props=e}(m_.prototype=new bx).isPureReactComponent=!0,m_.prototype.shouldComponentUpdate=function(e,t){return f_(this.props,e)||f_(this.state,t)};var g_=nx.__b;nx.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),g_&&g_(e)};var y_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function v_(e){function t(t){var n=h_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=y_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var b_=nx.__e;nx.__e=function(e,t,n,r){if(e.then)for(var i,o=t;o=o.__;)if((i=o.__c)&&i.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),i.__c(e,t);b_(e,t,n,r)};var w_=nx.unmount;function x_(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach((function(e){"function"==typeof e.__c&&e.__c()})),e.__c.__H=null),null!=(e=h_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return x_(e,t,n)}))),e}function __(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return __(e,t,n)})),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function E_(){this.__u=0,this.t=null,this.__b=null}function k_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function O_(){this.u=null,this.o=null}nx.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),w_&&w_(e)},(E_.prototype=new bx).__c=function(e,t){var n=t.__c,r=this;null==r.t&&(r.t=[]),r.t.push(n);var i=k_(r.__v),o=!1,s=function(){o||(o=!0,n.__R=null,i?i(a):a())};n.__R=s;var a=function(){if(! --r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=__(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.t.pop();)t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(s,s)},E_.prototype.componentWillUnmount=function(){this.t=[]},E_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=x_(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&gx(vx,null,e.fallback);return i&&(i.__u&=-33),[gx(vx,null,t.__a?null:e.children),i]};var P_=function(e,t,n){if(++n[1]===n[0]&&e.o.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.o.size))for(n=e.u;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.u=n=n[2]}};function S_(e){return this.getChildContext=function(){return e.context},e.children}function C_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Lx(null,t.l),t.l=null,t.i=null},t.i&&t.i!==n&&t.componentWillUnmount(),t.l||(t.i=n,t.l={nodeType:1,parentNode:n,childNodes:[],appendChild:function(e){this.childNodes.push(e),t.i.appendChild(e)},insertBefore:function(e,n){this.childNodes.push(e),t.i.appendChild(e)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.i.removeChild(e)}}),Lx(gx(S_,{context:t.context},e.__v),t.l)}function T_(e,t){var n=gx(C_,{__v:e,i:t});return n.containerInfo=t,n}(O_.prototype=new bx).__a=function(e){var t=this,n=k_(t.__v),r=t.o.get(e);return r[0]++,function(i){var o=function(){t.props.revealOrder?(r.push(i),P_(t,e,r)):i()};n?n(o):o()}},O_.prototype.render=function(e){this.u=null,this.o=new Map;var t=Px(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.o.set(t[n],this.u=[1,0,this.u]);return e.children},O_.prototype.componentDidUpdate=O_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){P_(e,n,t)}))};var M_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,A_=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,D_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,N_=/[A-Z0-9]/g,R_="undefined"!=typeof document,j_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};bx.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(bx.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var I_=nx.event;function L_(){}function $_(){return this.cancelBubble}function z_(){return this.defaultPrevented}nx.event=function(e){return I_&&(e=I_(e)),e.persist=L_,e.isPropagationStopped=$_,e.isDefaultPrevented=z_,e.nativeEvent=e};var B_={enumerable:!1,configurable:!0,get:function(){return this.class}},q_=nx.vnode;nx.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,r={};for(var i in t){var o=t[i];if(!("value"===i&&"defaultValue"in t&&null==o||R_&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var s=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===o?o="":"ondoubleclick"===s?i="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||j_(t.type)?"onfocus"===s?i="onfocusin":"onblur"===s?i="onfocusout":D_.test(i)?i=s:-1===n.indexOf("-")&&A_.test(i)?i=i.replace(N_,"-$&").toLowerCase():null===o&&(o=void 0):s=i="oninput","oninput"===s&&r[i=s]&&(i="oninputCapture"),r[i]=o}}"select"==n&&r.multiple&&Array.isArray(r.value)&&(r.value=Px(t.children).forEach((function(e){e.props.selected=-1!=r.value.indexOf(e.props.value)}))),"select"==n&&null!=r.defaultValue&&(r.value=Px(t.children).forEach((function(e){e.props.selected=r.multiple?-1!=r.defaultValue.indexOf(e.props.value):r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",B_)):(t.className&&!t.class||t.class&&t.className)&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=M_,q_&&q_(e)};var F_=nx.__r;nx.__r=function(e){F_&&F_(e),e.__c};var V_=nx.diffed;nx.diffed=function(e){V_&&V_(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),null};var H_=gx,U_=0;function W_(e,t,n,r,i,o){var s,a,l={};for(a in t)"ref"==a?s=t[a]:l[a]=t[a];var c={type:e,props:l,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:--U_,__i:-1,__u:0,__source:i,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return nx.vnode&&nx.vnode(c),c}var G_="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Q_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y_,X_={exports:{}};
|
|
172
172
|
/*!
|
|
173
173
|
Copyright (c) 2018 Jed Watson.
|
|
174
174
|
Licensed under the MIT License (MIT), see
|