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)},Il.prototype.open=function(e,t,n,i){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:r,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Il.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Il.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(r).length)}},Il.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Il.prototype.reset=function(){const e=this._current.container;tl(null,e),be(e)},Il.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Il.prototype._onOpened=function(){this._emit("opened")},Il.prototype._onClosed=function(){this._emit("closed")},Il.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=me(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Il.prototype._bindAutoClose=function(){this._eventBus.once($l,this.close,this)},Il.prototype._unbindAutoClose=function(){this._eventBus.off($l,this.close,this)},Il.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),a(e)&&n<e&&(r=e),a(t)&&n>t&&(r=t)),r},Il.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,s=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,s=t.y-i.height):r.x?(o=t.x-i.width,s=t.y):r.y&&t.y<i.height?(o=t.x,s=10):r.y&&(o=t.x,s=t.y-i.height),t.y<n.top&&(s=t.y+i.height),{x:o,y:s}},Il.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},Il.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Il.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Il.prototype._getEntries=function(e,t){var n={};return y(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);p(i)?n=i(n):y(i,(function(e,t){n[t]=e}))}else y(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=j(e,["id"])}))})),n},Il.prototype._getHeaderEntries=function(e,t){var n={};return y(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);p(i)?n=i(n):y(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;y(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=j(e,["id"])}))}})),n},Il.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>p(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Il.prototype.isOpen=function(){return!!this._current},Il.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=U(ee(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(p(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Il.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 ql={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:r}=n.reduce(((n,i)=>{const r=e[i],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(Vl),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[r]=a,o=a.index,s=a.index+r.length,c=0===o,h=s===e.length,u=!!a.groups.all,p=c||/\s/.test(e.charAt(o-1)),d=h||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:r,index:a.index,match:!0,wordStart:p,wordEnd:d,start:c,end:h,all:u});const f=u?t:[r];for(const e of f)i[e.toLowerCase()]=!0;l=a.index+r.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:i}}(r,t);return{tokens:{...n.tokens,[i]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return r}(e,r,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=jl(t.tokens[i],n.tokens[i]);if(0!==e)return e;const r=Hl(t.item[i],n.item[i]);if(0!==r)return r}return 0}}(i))}]},Wl={__depends__:[ql],__init__:["popupMenu"],popupMenu:["type",Il]},Ql={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 Gl(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Gl.$inject=["contextPad","popupMenu","translate","canvas"],Gl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Gl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Gl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ql.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Gl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Xl=["left","center","right","top","middle","bottom"];function Ul(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Yl(e){Vo.call(this,e),this.init()}function Kl(e){Yl.call(this,e)}Ul.$inject=["popupMenu","alignElements","translate","rules"],Ul.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Ul.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ul.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return y(Xl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ql[o],action:function(){t.trigger(e,o),i.close()}}})),r},Yl.$inject=["eventBus"],e(Yl,Vo),Yl.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},Yl.prototype.init=function(){},Kl.$inject=["eventBus"],e(Kl,Yl),Kl.prototype.init=function(){this.addRule("elements.align",(function(e){var t=v(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=pt(t)).length<2)&&t}))};var Zl={__depends__:[ya,Aa,Wl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Gl],alignElementsMenuProvider:["type",Ul],bpmnAlignElements:["type",Kl]},Jl=10,ec=50,tc=250;function nc(e,t,n,i){for(var r;r=rc(e,n,t);)n=i(t,n,r);return n}function ic(e){return function(t,n,i){var r={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;r[o]=l<0?Math.min(i[o]+l-t[a]/2,n[o]-c+l):Math.max(i[o]+i[a]+l+t[a]/2,n[o]+c+l)}})),r}}function rc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=oc(e);e.host&&(t=t.concat(oc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(oc(t))}),[])));return t}(e);return m(r,(function(e){return e!==n&&"intersect"===wn(e,i,Jl)}))}function oc(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 sc(){return!0}function ac(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||ec,r=xn(e),o=vn(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function lc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ac.$inject=["eventBus","modeling","canvas"],lc.$inject=["eventBus","selection"];var cc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ac],autoPlaceSelectionBehavior:["type",lc]};function hc(e,t){for(d(t)&&(t=[t]);e=e.parent;)if(kr(e,t))return e;return null}function uc(e,t){var n=hc(e,"bpmn:Process");if(n)return!0;var i,r=["bpmn:Participant","bpmn:Lane"];if(n=hc(e,r))return qr(n);if(kr(e,r))return qr(e);for(i=Or(e);i&&!Er(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find((function(e){var t=Or(e);return t&&t.get("processRef")===i}));return!o||qr(o)}function pc(e,t,n){var i=uc(e,n);return Er(t,"bpmn:TextAnnotation")?function(e,t,n){var i=vn(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};dn(e)&&(r=xn(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return nc(e,t,r,ic(s))}(e,t,i):kr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var i=vn(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return nc(e,t,r,ic(s))}(e,t,i):Er(t,"bpmn:FlowNode")?function(e,t,n){var i=vn(e),r=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||ec,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||tc,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===i?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===i?"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}r||(r=sc);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),h=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,weight:n}})),u=x(c.concat(h).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return Er(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;Er(e,"bpmn:BoundaryEvent")&&-1!==(c=wn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var h=n?{x:i.right+s+t.width/2,y:r.y+dc(c,l,o)}:{x:r.x+dc(c,l,o),y:i.bottom+s+t.height/2},u={margin:a,minDistance:l},p=n?{y:u}:{x:u};return nc(e,t,h,ic(p))}(e,t,i):void 0}function dc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function fc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return pc(e.source,n,t)}))}fc.$inject=["eventBus","elementRegistry"];var mc={__depends__:[cc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fc]};function gc(e,t,n,r){Vo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,r=t.parent||t.newParent;!1!==n.autoResize&&o._expand([i],r)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=i(O(t.closure.topLevel)),r=t.hints,s=!r||r.autoResize;!1!==s&&y(S(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,i=t.shape;n&&!1===n.autoResize||i.collapsed||o._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&!1===n.autoResize||r&&o._expand([i],r)}))}function vc(e){e.invoke(gc,this)}function yc(e){Yl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function bc(e,t){yc.call(this,e),this._modeling=t}gc.$inject=["eventBus","elementRegistry","modeling","rules"],e(gc,Vo),gc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=vn(vt(e)),o=vn(t),s={};return r.top-o.top<i.top&&(s.top=r.top-n.top),r.left-o.left<i.left&&(s.left=r.left-n.left),o.right-r.right<i.right&&(s.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(s.bottom=r.bottom+n.bottom),yn(z({},o,s))},gc.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var i=function(e,t){var n="";e=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}(I(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},gc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},gc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},gc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},vc.$inject=["injector"],e(vc,gc),vc.prototype.resize=function(e,t,n){Er(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},yc.$inject=["eventBus"],e(yc,Yl),yc.prototype.canResize=function(e,t){return!1},e(bc,yc),bc.$inject=["eventBus","modeling"],bc.prototype.canResize=function(e,t){if(Er(t.di,"bpmndi:BPMNPlane"))return!1;if(!Er(t,"bpmn:Participant")&&!Er(t,"bpmn:Lane")&&!Er(t,"bpmn:SubProcess"))return!1;var n=!0;return y(e,(function(e){(Er(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var xc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",vc],bpmnAutoResizeProvider:["type",bc]};function wc(e,t,n){var i,r,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,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),s.hover({element:r,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ms(e),function(e){return ee(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}wc.$inject=["elementRegistry","eventBus","injector"];var _c={__init__:["hoverFix"],hoverFix:["type",wc]},Ec=Math.round,kc="djs-drag-active";function Oc(e){e.preventDefault()}function Sc(e,t,n,i){var r,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||r;var i=e.createEvent(z({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var o,l=r.payload,c=r.displacement,h=r.globalStart,u=ms(e),p=ia(u,h),d=r.localStart,f=s(u),g=ia(f,d);if(!r.active&&(i||(o=p,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(z(l,{x:Ec(d.x+c.x),y:Ec(d.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&Zs(r.cursor),t.addMarker(t.getRootElement(),kc)}fs(e),r.active&&(z(l,{x:Ec(f.x+c.x),y:Ec(f.y+c.y),dx:Ec(g.x),dy:Ec(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,fs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function h(e){$s("Escape",e)&&(Oc(e),m())}function u(t){var n;r.active&&(n=ta(e),setTimeout(n,400),Oc(t)),c(t)}function p(e){l(e)}function d(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(r){var n=r.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),Js(),g=r.trapClick?u:c,le.unbind(document,"mousemove",l),le.unbind(document,"dragstart",Oc),le.unbind(document,"selectstart",Oc),le.unbind(document,"mousedown",g,!0),le.unbind(document,"mouseup",g,!0),le.unbind(document,"keyup",h),le.unbind(document,"touchstart",p,!0),le.unbind(document,"touchcancel",m,!0),le.unbind(document,"touchmove",l,!0),le.unbind(document,"touchend",c,!0),e.off("element.hover",d),e.off("element.out",f),t.removeMarker(t.getRootElement(),kc);var v=r.payload.previousSelection;return!1!==o&&v&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(v),s=r,r=null,s}e.on("diagram.destroy",m),this.init=function(t,n,i,g){r&&m(!1),"string"==typeof n&&(g=i,i=n,n=null);var v,y,b,x,w,_=(g=z({},o,g||{})).data||{};x=g.trapClick?u:c,t?(v=ds(t)||t,y=ms(t),fs(t),"dragstart"===v.type&&Oc(v)):(v=null,y={x:0,y:0}),b=s(y),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),r=z({prefix:i,data:_,payload:{},globalStart:y,displacement:ia(n,b),localStart:b,isTouch:w},g),g.manual||(w?(le.bind(document,"touchstart",p,!0),le.bind(document,"touchcancel",m,!0),le.bind(document,"touchmove",l,!0),le.bind(document,"touchend",c,!0)):(le.bind(document,"mousemove",l),le.bind(document,"dragstart",Oc),le.bind(document,"selectstart",Oc),le.bind(document,"mousedown",x,!0),le.bind(document,"mouseup",x,!0)),le.bind(document,"keyup",h),e.on("element.hover",d),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=d,this.out=f,this.end=c,this.cancel=m,this.context=function(){return r},this.setOptions=function(e){z(o,e)}}Sc.$inject=["eventBus","canvas","selection","elementRegistry"];var Cc={__depends__:[_c,Rs],dragging:["type",Sc]};function Pc(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function Ac(e,t,n){return t<e&&e<n}Pc.$inject=["config.autoScroll","eventBus","canvas"],Pc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)Ac(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(){i.startScroll(e)}),n.scrollRepeatTimeout))},Pc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Pc.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},Pc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ms(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Mc={__depends__:[Cc],__init__:["autoScroll"],autoScroll:["type",Pc]};function Rc(e){this._commandStack=e.get("commandStack",!1)}Rc.$inject=["injector"],Rc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Tc={__init__:["rules"],rules:["type",Rc]},Dc=Math.round,Bc=Math.max;var Lc=10;function Nc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Ct(i,t)<=Lc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=sn(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,Lc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],s=r[r.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[i=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Dc(o.x+s.x)/2,y:Dc(o.y+s.y)/2},index:o.segment2}:{point:{x:Dc(o.x),y:Dc(o.y)},index:o.segment2}:null}(e,t)}function zc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $c(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Ic(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jc(e,t){var n=Ic(e,t);return zc({x:n.x-e.x,y:n.y-e.y})}function Fc(e,t){return zc({x:e.x-t.x,y:e.y-t.y})}var Hc="djs-bendpoint",Vc="djs-segment-dragger";function qc(e,t,n){var i=function(e,t){var n,i=ms(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return Nc(t,i)}function Wc(e,t){var n=De("g");Se(n).add(Hc),xe(e,n);var i=De("circle");ke(i,{cx:0,cy:0,r:4}),Se(i).add("djs-visual"),xe(n,i);var r=De("circle");return ke(r,{cx:0,cy:0,r:10}),Se(r).add("djs-hit"),xe(n,r),t&&Se(n).add(t),n}function Qc(e,t,n,i){var r=De("g");xe(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Xc("h"===n?i:r)}(t,n,i),s=De("rect");ke(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(r,s);var a=De("rect");return ke(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(r,a),Zn(r,"v"===i?90:0),r}function Gc(e,t,n){var i=De("g"),r=Dt(t,n),o=Mt(t,n);return xe(e,i),Qc(i,t,n,o),Se(i).add(Vc),Se(i).add("h"===o?"horizontal":"vertical"),Kn(i,r.x,r.y),i}function Xc(e){return Math.abs(Math.round(2*e/3))}function Uc(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var s=jc(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return Ic(e,n)}function Yc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=qc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Mt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Xc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,r,o,s,a,l,c=e.index,h=e.point;return!(c<=0||e.bendpoint)&&(o=Dt(i=t[c-1],r=t[c]),s=Mt(i,r),a=Math.abs(h.x-o.x),l=Math.abs(h.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?i.start(e,n,a.index,!a.bendpoint):r.start(e,n,a.index),!0}function s(e,t,i){le.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),r=ve('.djs-bendpoints[data-element-id="'+Go(e.id)+'"]',i);return!r&&n&&(ke(r=De("g"),{"data-element-id":e.id}),Se(r).add("djs-bendpoints"),xe(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}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 i=Wc(e);xe(e,i),Kn(i,t.x,t.y)})),Wc(e,"floating")}function h(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],i=o[a])&&(ke(r=Gc(e,n,i),{"data-segment-idx":a}),s(r,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),h(t,e)),t}function p(e){var t=a(e);t&&(!function(e){y(ye("."+Vc,e),(function(e){qe(e)}))}(t),function(e){y(ye("."+Hc,e),(function(e){qe(e)}))}(t),h(t,e),c(t,e))}function d(e,t,n){var i,r,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,h=Dt(s,a),u=Mt(s,a);o&&(i=function(e){return ve(".djs-visual",e)}(o),r={x:c.x-h.x,y:c.y-h.y},"v"===u&&(r={x:r.y,y:r.x}),Kn(i,r.x,r.y))}e.on("connection.changed",(function(e){p(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&qe(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,i,r=e.element,o=r.waypoints;if(o){if(n=a(r,!0),!(i=qc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),i=t.point;n&&Kn(n,i.x,i.y)}(n,i),i.bendpoint||d(n,i,o)}})),e.on("element.mousedown",(function(e){if(ys(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=a(t);i&&ke(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=p,this.getBendpointsContainer=a,this.getSegmentDragger=l}Yc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Kc=Math.round,Zc="reconnectStart",Jc="reconnectEnd",eh="updateWaypoints";function th(e,t,n,i,r,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,h=t.target,u=t.waypoints,p=(a=s||0!==o?s||o!==u.length-1?eh:Jc:Zc)===eh?"connection.updateWaypoints":"connection.reconnect",d=r.allowed(p,{connection:t,source:c,target:h});!1===d&&(d=r.allowed(p,{connection:t,source:h,target:c})),!1!==d&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:d,bendpointIndex:o,connection:t,source:c,target:h,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===eh?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Zc?a:o,target:l===Jc?a:s}))return n.source=l===Zc?a:o,void(n.target=l===Jc?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===Jc?a:s,target:l===Zc?a:o})),t&&(n.source=l===Jc?a:s,n.target=l===Zc?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!==eh&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,s=t.insert,a=r.waypoints.slice(),l=t.source,c=t.target,h=t.type,u=t.hints||{},p={x:Kc(e.x),y:Kc(e.y)};if(!n)return!1;h===eh?(s?a.splice(i,0,p):a[i]=p,u.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(r,a),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===Ct(t,i=e[r+1])||Pt(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(h===Zc?(u.docking="source",nh(t)&&(u.docking="target",u.newWaypoints=a.reverse())):h===Jc&&(u.docking="target",nh(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,p,u))}),this)}function nh(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Zc?t&&i&&t===i&&n!==i:r===Jc?t&&n&&t===n&&n!==i:void 0}th.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],th.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var ih="updateWaypoints",rh="connect-ok",oh="connect-not-ok",sh="connect-hover",ah="djs-updating",lh="djs-dragging";function ch(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,s=r.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),r.waypoints=a,Se(t.draggerGfx=Wc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,lh),i.addMarker(r,ah)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,sh),o===ih)return;n?(i.removeMarker(r,oh),i.addMarker(r,rh)):!1===n&&(i.removeMarker(r,rh),i.addMarker(r,oh))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,sh),i.removeMarker(n,r?rh:oh))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,h=c.source,u=c.target,p=c.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};r&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?nh(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=a||h,p=p.reverse()):(m.connectionStart=m.connectionStart||d,m.source=a||h,m.target=u):"reconnectEnd"===l?nh(n)?(m.connectionStart=m.connectionStart||d,m.source=a||u,m.target=h,p=p.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=h,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,p[o]=d),l===ih&&(p=e.cropWaypoints(c,p)),m.waypoints=p,r.drawPreview(n,i,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,qe(o),i.removeMarker(n,ah),i.removeMarker(n,lh),s&&(i.removeMarker(s,rh),i.removeMarker(s,a?rh:oh)),r&&r.cleanUp(t)}))}ch.$inject=["bendpointMove","injector","eventBus","canvas"];var hh="connect-hover",uh="djs-updating";function ph(e,t,n){return dh(e,t,e[t]+n)}function dh(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function fh(e){return"x"===e?"y":"x"}function mh(e,t,n){var i,r;return e.original?e.original:(i=xn(t),dh(e,r=fh(n),i[r]))}function gh(e,t,n,i,r,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){r.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return dh(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],fh(e.axis));Kn(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,s,a,l,c=n.getGraphics(t),h=r-1,u=r,p=t.waypoints,d=p[h],f=p[u],m=qc(n,p,e);(s=Mt(d,f))&&(a="v"===s?"x":"y",0===h&&(d=mh(d,t.source,a)),u===p.length-1&&(f=mh(f,t.target,a)),o={connection:t,segmentStartIndex:h,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},i.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,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Gc(r,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(i,uh)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,s=i.segmentEndIndex,h=i.segmentStart,u=i.segmentEnd,p=i.axis,d=i.originalWaypoints.slice(),f=ph(h,p,e["d"+p]),m=ph(u,p,e["d"+p]),g=d.length,v=0;d[o]=f,d[s]=m,o<2&&(t=wn(r.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,v--):"intersect"!==t&&(d.unshift(h),v++)),s>g-3&&(n=wn(r.target,m),s===g-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=a(r,d),c(i,v,e),i.newSegmentStartIndex=o+v,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,hh)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,hh)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&qe(t.draggerGfx),n.removeMarker(i,uh)})),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,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,r){return!Pt(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),l=a(n,s.waypoints),c=s.segmentOffset,h={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,l,h)}))}gh.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var vh=Math.abs,yh=Math.round;function bh(e){return{x:e.x,y:e.y}}function xh(e){return{x:e.x+e.width,y:e.y+e.height}}function wh(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:yh(e.x+e.width/2),y:yh(e.y+e.height/2)}}function _h(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Eh(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function kh(e){return e.children||[]}var Oh=Math.abs,Sh=Math.round;function Ch(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Oh(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Uc(t,e):e.width?{x:Sh(e.width/2+e.x),y:Sh(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,h=t.axis;if(i)return i;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(r.source,e)),c>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},y(u,(function(e){e&&(e=e.original||e,"y"===h&&i.horizontal.push(e.y),"x"===h&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(o){var l=s-(i=t(o.vertical,s)),c=a-(r=t(o.horizontal,a));z(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:r}),(l||-1!==o.vertical.indexOf(s))&&Eh(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&Eh(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);dn(t)&&i&&i.x&&i.y&&(Eh(e,"x",i.x),Eh(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},y(r,(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,h=e.y;if(s){var u=c-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),p=h-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,h));z(e,{dx:e.dx-u,dy:e.dy-p,x:e.x-u,y:e.y-p}),(u||-1!==s.vertical.indexOf(c))&&Eh(e,"x",i),(p||-1!==s.horizontal.indexOf(h))&&Eh(e,"y",r)}}))}Ch.$inject=["eventBus"];var Ph={__depends__:[Cc,Tc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Yc],bendpointMove:["type",th],bendpointMovePreview:["type",ch],connectionSegmentMove:["type",gh],bendpointSnapping:["type",Ch]};function Ah(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);l(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),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,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:Mh(t)?o:r,connectionEnd:Mh(t)?r:o};h(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,r){h(i)||(r=i,i=xn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Mh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}Ah.$inject=["eventBus","dragging","modeling","rules"];var Rh="connect-ok",Th="connect-not-ok";function Dh(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,h=t.connectionEnd||{x:e.x,y:e.y},u=c,p=h;Mh(t)&&(u=h,p=c),i.drawPreview(t,n,{source:o||s,target:l||r,connectionStart:u,connectionEnd:p})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?Rh:Th)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Rh),n.removeMarker(t,Th))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Dh.$inject=["injector","eventBus","canvas"];var Bh={__depends__:[Rs,Tc,Cc],__init__:["connectPreview"],connect:["type",Ah],connectPreview:["type",Dh]};function Lh(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Lh.$inject=["injector","canvas","graphicsFactory","elementFactory"],Lh.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,h=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Pe(r),o||(o=e.getConnection=function(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(i=o(t,s,a)),i?(i.waypoints=l||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:s,target:a,connectionStart:c,connectionEnd:h,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[s?xn(s):c,a?xn(a):h]),this._connectionDocking&&(s||a)&&!p&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,s,a)),this._graphicsFactory.drawConnection(r,i,{stroke:"var(--element-dragger-color)"})):!d&&this.drawNoopPreview(r,n)},Lh.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||xn(n),o=t.connectionEnd||xn(i),s=this.cropWaypoints(r,o,n,i);xe(e,this.createNoopConnection(s[0],s[1]))},Lh.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&_n(o,a,!0)||e,t=i&&_n(s,a,!1)||t]},Lh.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&qe(e.connectionPreviewGfx)},Lh.prototype.getConnection=function(e){var t=function(e){return h(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Lh.prototype.createConnectionPreviewGfx=function(){var e=De("g");return ke(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},Lh.prototype.createNoopConnection=function(e,t){return ht([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Nh={__init__:["connectionPreview"],connectionPreview:["type",Lh]};const zh=new Bo("ps");var $h=["marker-start","marker-mid","marker-end"],Ih=["circle","ellipse","line","path","polygon","polyline","path","rect"];function jh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}jh.$inject=["elementRegistry","eventBus","canvas","styles"],jh.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")},jh.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},jh.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ae(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Un(r),i),ke(r,this._styles.cls(i,[],{x:o.top,y:o.left})),xe(t,r),ke(r,"data-preview-support-element-id",e.id),r},jh.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),ke(n,"data-preview-support-element-id",e.id),n},jh.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==Ih.indexOf(e.nodeName)}(e)&&$h.forEach((function(r){if(ke(e,r)){var o=function(e,t,n){var i=(r=ke(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ve("marker#"+i,n||document)}(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}}))},jh.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zh.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Ae(n);a.id=o,Se(a).add(r);var l=ve(":scope > defs",e);l||xe(e,l=De("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);ke(t,i,c)};var Fh={__init__:["previewSupport"],previewSupport:["type",jh]};const Hh="complex-preview";class Vh{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:i=[],resized:r=[]}=e,o=this._canvas.getLayer(Hh);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;dn(e)?(t=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(Un(t),e)):(t=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(Un(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);dn(e)?Kn(n,t.x,t.y):Kn(n,e.x+t.x,e.y+t.y)})),i.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"])})),r.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",De("g"));this._graphicsFactory.drawShape(Un(n),e,{width:t.width,height:t.height}),Kn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Pe(this._canvas.getLayer(Hh)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Hh)}hide(){this._canvas.hideLayer(Hh)}}Vh.$inject=["canvas","graphicsFactory","previewSupport"];var qh={__depends__:[Fh],__init__:["complexPreview"],complexPreview:["type",Vh]},Wh=["top","bottom","left","right"],Qh=10;function Gh(e,t){function n(e){if(Kr(e)&&!dn(e)){var n=function(e){var t=xn(e.label),n=xn(e),i=Xh(n,t);if(r=i,-1===Wh.indexOf(r))return;var r;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 Xh(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=xn(e),r=wn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Wh.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wh.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=xn(e),r=e.label,o=xn(r);if(!r.parent)return;var s,a=vn(e);switch(n){case"top":s={x:i.x,y:a.top-Qh-r.height/2};break;case"left":s={x:a.left-Qh-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Qh+r.height/2};break;case"right":s={x:a.right+Qh+r.width/2,y:i.y}}var l=ia(s,o);t.moveShape(r,l)}(e,n)}}Vo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Xh(e,t){return wn(t,e,5)}function Uh(e){Vo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Er(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 Yh(e,t){e.invoke(Vo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;y(v(i.incoming.concat(i.outgoing),(function(e){return Er(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Gh,Vo),Gh.$inject=["eventBus","modeling"],e(Uh,Vo),Uh.$inject=["eventBus"],e(Yh,Vo),Yh.$inject=["injector","modeling"];function Kh(e,t){t.invoke(Vo,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 Zh(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Zh(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Zh(e,t){return!fn(e)&&kr(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Jh(e,t){function n(e){return v(e.attachers,(function(e){return Er(e,"bpmn:BoundaryEvent")}))}Vo.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);Er(i,"bpmn:EventBasedGateway")&&Er(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;Er(i,"bpmn:Gateway")&&Er(r,"bpmn:EventBasedGateway")&&y(r.outgoing,(function(e){var i=e.target,r=n(i);Er(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function eu(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}Vo.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(nu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>tu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!nu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>iu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Er(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;nu(r)&&iu(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>Er(e,"bpmn:Association"))),r=i.filter((e=>tu(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;nu(t)&&tu(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;tu(o)&&r(o),nu(e)&&iu(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;tu(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):iu(i)&&function(e){const n=e.incoming.filter((e=>nu(e.source)));t.removeElements(n)}(i)}),!0)}function tu(e){const t=Or(e);return t&&t.get("isForCompensation")}function nu(e){return e&&Er(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}function iu(e){return e&&Er(e,"bpmn:Activity")&&!Qr(e)}function ru(e){e.invoke(Vo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;Er(n,"bpmn:Lane")&&!Er(i,"bpmn:Lane")&&(t.parent=hc(n,"bpmn:Participant"))}))}function ou(e,t){Vo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Er(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Kh.$inject=["bpmnReplace","injector"],e(Kh,Vo),Kh.prototype._replaceShape=function(e,t){var n,i=(n=Or(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},Jh.$inject=["eventBus","modeling"],e(Jh,Vo),e(eu,Vo),eu.$inject=["eventBus","modeling","bpmnRules"],ru.$inject=["injector"],e(ru,Vo),ou.$inject=["eventBus","bpmnFactory"],e(ou,Vo);var su=20,au=20,lu=30,cu=2e3;function hu(e,t,n){function i(){var t=e.getRootElement();return Er(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Vo.call(this,t),t.on(["create.start","shape.move.start"],cu,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(Er(i,"bpmn:Participant")&&Er(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!Er(e,"bpmn:Group")&&!fn(e)&&!dn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*su+lu,height:t.height+2*au};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,s);z(i,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-au,left:t.right-e.width/2+su,top:t.bottom-e.height/2+au,right:t.left+e.width/2-su-lu}}(i,s)}}})),t.on("create.start",cu,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}Er(i,"bpmn:Participant")&&Er(r,"bpmn:Process")&&(t.on("element.hover",cu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",cu,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return m(e,(function(e){return Er(e,"bpmn:Participant")}))}(n);o&&Er(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Or(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Er(n,"bpmn:Participant")&&Er(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Or(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Or(i).set("processRef",Or(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Or(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var s=i.children.slice();o?r===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},r)}}),!0)}hu.$inject=["canvas","eventBus","modeling"],e(hu,Vo);var uu="__targetRef_placeholder";function pu(e,t){function n(e,n){var i=e.get("properties"),r=m(i,(function(e){return e.name===uu}));return!r&&n&&Ot(i,r=t.create("bpmn:Property",{name:uu})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||kt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=r.newTarget,h=c&&c.businessObject,u=r.oldTarget||r.target,p=u&&u.businessObject,d=o.businessObject;p&&p!==l&&i(p,s),h&&h!==l&&i(h,s),l?(t=n(l,!0),d.targetRef=t):d.targetRef=null}Vo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],du(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],du(r))}function du(e){return function(t){if(Er(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function fu(e){this._bpmnUpdater=e}function mu(e,t,n,i){function r(e){return e.children.filter((function(e){return Er(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return Er(e,"bpmn:Participant")&&Or(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:Sr(e),newSemanticParent:o.processRef||o,newDiParent:Sr(i)})}}Vo.call(this,i),t.registerHandler("dataStore.updateContainment",fu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Er(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 Er(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Er(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Er(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Er(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Er(i,"bpmn:Collaboration")||Er(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Er(r,"bpmn:Collaboration")&&o(n,Er(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Er(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();kr(n,["bpmn:Participant","bpmn:SubProcess"])&&Er(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){Er(i,"bpmn:Process")&&o(e,i)}))}))}pu.$inject=["eventBus","bpmnFactory"],e(pu,Vo),fu.$inject=["bpmnUpdater"],fu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},fu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},mu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(mu,Vo);var gu=Math.max,vu=Math.min,yu=20;function bu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?vu:gu)(i,r)),u(o)&&(i=(/top|left/.test(e)?gu:vu)(i,o)),i}function wu(e,t){return void 0!==e?e:yu}function _u(e){return!e.waypoints&&"label"!==e.type}function Eu(e,t){var n;if((n=void 0===e.length?v(e.children,_u):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=wu(t.left),i=wu(t.right),r=wu(t.top),o=wu(t.bottom)):n=i=r=o=wu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(vt(n),t)}var ku=Math.abs;var Ou=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){Er(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Pu(e){return e.children.filter((function(e){return Er(e,"bpmn:Lane")}))}function Au(e){return hc(e,Ou)||e}function Mu(e,t){var n=Au(e),i=Cu(n,Er(n,"bpmn:Process")?[]:[n]),r=vn(e),o=vn(t),s=function(e,t){return bu(vn(t),vn(e))}(e,t),a=[],l=qr(e);return i.forEach((function(t){if(t!==e){var n,i,c=l?0:s.top,h=l?s.right:0,u=l?0:s.bottom,p=l?s.left:0,d=vn(t);s.top&&(ku(d.bottom-r.top)<10&&(u=o.top-d.bottom),ku(d.top-r.top)<5&&(c=o.top-d.top)),s.left&&(ku(d.right-r.left)<10&&(h=o.left-d.right),ku(d.left-r.left)<5&&(p=o.left-d.left)),s.bottom&&(ku(d.top-r.bottom)<10&&(c=o.bottom-d.top),ku(d.bottom-r.bottom)<5&&(u=o.bottom-d.bottom)),s.right&&(ku(d.left-r.right)<10&&(p=o.right-d.left),ku(d.right-r.right)<5&&(h=o.right-d.right)),(c||h||u||p)&&a.push({shape:t,newBounds:(n=t,i={top:c,right:h,bottom:u,left:p},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}})),a}function Ru(e,t){Vo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;Er(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=qr(e),c=Pu(n),h=[],u=[],p=[],d=[];mt(c,(function(t){return l?t.y>e.y?u.push(t):h.push(t):t.x>e.x?d.push(t):p.push(t),t.children})),c.length&&(i=l?u.length&&h.length?e.height/2:e.height:d.length&&p.length?e.width/2:e.width,h.length&&(r=t.calculateAdjustments(h,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),p.length&&(s=t.calculateAdjustments(p,"x",i,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:i,y:0},"e")),d.length&&(a=t.calculateAdjustments(d,"x",-i,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}Ru.$inject=["eventBus","spaceTool"],e(Ru,Vo);function Tu(e,t){t.invoke(Vo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Du(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,s=e.host;Du(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Du(e,t){return!fn(e)&&Er(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function i(e,i,r){var o,s,a,l,c,h,p,d,f=i.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),y=Nc(f,d=u(r.width)?xn(r):r);if(y){if(o=f.slice(0,y.index),s=f.slice(y.index+(y.bendpoint?1:0)),!o.length||!s.length)return;a=y.bendpoint?f[y.index]:d,1!==o.length&&Lu(e,o[o.length-1])||o.push(Nu(a)),1!==s.length&&Lu(e,s[0])||s.unshift(Nu(a))}l=i.source,c=i.target,t.canConnect(l,e,i)&&(n.reconnectEnd(i,e,o||d),h=i),t.canConnect(e,c,i)&&(h?p=n.connect(e,c,{type:i.type,waypoints:s}):(n.reconnectStart(i,e,s||d),p=i));var b=[].concat(h&&v(g,(function(e){return e.source===h.source}))||[],p&&v(m,(function(e){return e.target===p.target}))||[]);b.length&&n.removeElements(b)}Vo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+r.x,y:s.y+r.y},l=m(n.children,(function(e){return t.canInsert(i,e)&&Nc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Lu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Nu(e){return z({},e)}function zu(e,t){Vo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&$u(i)){(Er(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&$u(e))):o.incoming.filter((e=>e!==i&&$u(e)&&Er(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Er(n,"bpmn:EventBasedGateway")&&n.outgoing.filter($u).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter($u).forEach((function(i){const r=e.incoming.filter($u).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function $u(e){return Er(e,"bpmn:SequenceFlow")}Tu.$inject=["bpmnReplace","injector"],e(Tu,Vo),Tu.prototype._replaceShape=function(e){var t,n,i=(n=Or(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Vo),Bu.$inject=["eventBus","bpmnRules","modeling"],zu.$inject=["eventBus","modeling"],e(zu,Vo);var Iu=1500;function ju(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"],Iu,(function(t){var i=t.context.shape||t.shape,r=t.hover;Er(r,"bpmn:Lane")&&!kr(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Au(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||kr(i,["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"],Iu,(function(t){var n=t.hover;Er(n,"bpmn:Lane")&&(t.hover=Au(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Iu,(function(t){var n=t.context,i=t.hover,r=n.type;Er(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Au(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Iu,(function(e){var t=e.context,n=t.start;Er(n,"bpmn:Lane")&&(t.start=Au(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Er(t,"bpmn:Lane")&&(e.shape=Au(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Er(t,"bpmn:Lane")&&(e.hover=Au(t))}))}ju.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return Er(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Or(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(kt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Or(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(kt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Ot(t.get("categoryValue"),e),e.$parent=t,Ot(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Or(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,i=t.categoryValue,r=Or(e);i?(r.categoryValueRef=null,s(i,n,r)):s(null,r.categoryValueRef.$parent,r)}function h(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(Vo,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Er(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Er(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Or(n);if(Er(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(s(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Er(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Or(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Er(n,"bpmn:Group")&&!n.labelTarget&&Or(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Er(n,"bpmn:Group")&&!n.labelTarget&&Or(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Er(n,"bpmn:Group")&&!n.labelTarget){var i=Or(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=h(r,!0),r.$parent&&(t.category=h(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=h(i)),r&&(i.$parent=h(r)),delete t.category,delete t.categoryValue}))}function Hu(e,t,n,i){var r,o,s,a;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((i.x-n.x)*o-(i.y-n.y)*s)/r,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Vu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Hu(e,t,n,r),a=Hu(e,t,n,o);i=s&&a?qu(s,n)>qu(a,n)?a:s:s||a,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],xn(n.source)),t(i[i.length-1],i[i.length-2],xn(n.target)))}))}function qu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){Vo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Or(n),r=Sr(n);if(kr(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,Vo),Vu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,Vo);var Qu=Math.sqrt,Gu=Math.min,Xu=Math.max,Uu=Math.abs;function Yu(e){return Math.pow(e,2)}function Ku(e,t){return Qu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Zu(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=r*r+o*o,c=(r*s+o*a)/l,h=c*c-(s*s+a*a-i*i)/l;if(h<0&&h>-1e-6&&(h=0),h<0)return[];var u=Qu(h),p=-c+u,d=-c-u,f={x:e.x-r*p,y:e.y-o*p};return 0===h?[f]:[f,{x:e.x-r*d,y:e.y-o*d}].filter((function(n){return function(e,t,n){return Ju(e.x,t.x,n.x)&&Ju(e.y,t.y,n.y)}(n,e,t)}))}function Ju(e,t,n){return e>=Gu(t,n)-ep&&e<=Xu(t,n)+ep}var ep=.1;function tp(e,t){return Uu(e.x-t.x)<=ep&&Uu(e.y-t.y)<=ep}function np(e,t,n,i){var r=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,i,r,o,s,a,l,c,h,u,p,d,f=0;for(f=0;f<t.length-1;f++){if(tp(n=t[f],i=t[f+1])?a=[n]:(r=Ku(e,n),o=Ku(e,i),a=Zu(n,i,e,Gu(r,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:tp(n,a[0])?f:f+1}),2===a.length&&(p=a[0],d=a[1],l={type:"segment",position:s={x:(p.x+d.x)/2,y:(p.y+d.y)/2},segmentIndex:f,relativeLocation:Ku(n,s)/Ku(n,i)}),c=Ku(l.position,e),(!u||h>c)&&(u=l,h=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var s=i.segmentMove.segmentStartIndex,a=i.segmentMove.newSegmentStartIndex;return r===s?a:r>=a?r+o<a?a:r+o:r}if(i.bendpointMove){var l,c=i.bendpointMove.insert,h=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=h&&(l=c?r+1:r-1),r<h&&(l=r,c&&"bendpoint"!==n.type&&h-1===r&&ip(t,h)<n.relativeLocation&&l++),l)}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,i);if(c<0||c>t.length-2||null===c)return s;var h,u,p=rp(n,l),d=rp(t,c),f=a.position,m=function(e,t){var n=Fc(e[0],e[1]),i=Fc(e[0],t);return 0===n?0:i/n}(p,f),g=(h=d,u=$c(p),$c(h)-u);if("bendpoint"===a.type){var v=t.length-n.length,y=a.bendpointIndex,b=n[y];if(-1!==t.indexOf(b))return s;if(0===v){var x=t[y];return{delta:{x:r=x.x-a.position.x,y:o=x.y-a.position.y},point:{x:e.x+r,y:e.y+o}}}v<0&&0!==y&&y<n.length-1&&(m=ip(n,y))}var w,_,E={x:(d[1].x-d[0].x)*m+d[0].x,y:(d[1].y-d[0].y)*m+d[0].y},k=(w={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*w.x-Math.sin(_)*w.y,y:Math.sin(_)*w.x+Math.cos(_)*w.y}:w);return r=E.x+k.x-e.x,o=E.y+k.y-e.y,{point:gn(E),delta:gn({x:r,y:o})}}function ip(e,t){var n=Fc(e[t-1],e[t]);return n/(n+Fc(e[t],e[t+1]))}function rp(e,t){return[e[t],e[t+1]]}function op(e,t,n){var i=na(t),r=na(n),o=ia(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:r.x+s,y:r.y+a})}function sp(e,t,n){var i=na(e),r=na(t),o=na(n),s=ia(e,i),a=ia(i,r),l=function(e,t,n){var i=vn(t),r=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)}(i,r))return null;var o,s,a,l=wn(t,e);if("top"===l)o={x:0,y:r.bottom-i.bottom};else if("bottom"===l)o={x:0,y:r.top-i.top};else if("right"===l)o={x:r.left-i.left,y:0};else{if("left"!==l)return null;o={x:r.right-i.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=wn(n,s),a!==l)return null;return o}(i,t,n);if(l)return l;var c=a.x*(n.width/t.width),h=a.y*(n.height/t.height),u=o.x+c,p=o.y+h;return gn({x:u+s.x-e.x,y:p+s.y-e.y})}var ap="name",lp="text";function cp(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(ap in o&&t.updateLabel(r,o[ap]),lp in o&&Er(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[lp]||"");t.updateLabel(r,o.text,s)}}function o(e){var t=e.context,n=t.connection,i=n.label,r=z({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return np(xn(e),t,n,i).delta}(i,o,s,r)}Vo.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Or(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!fn(i)&&Yr(i)&&to(i)&&t.updateLabel(i,to(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Or(n);r&&Yr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,s=i.oldBounds;if(Kr(r)){var a=r.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:jc(e,t)}}));return A(n,"distance")[0].line}(e,t);return Ic(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=hp(l,s,o);t.moveShape(a,c)}}))}function hp(e,t,n){return gn(ia(op(e,t,n),e))}function up(e,t){function n(e,t){var n=e.context,i=n.connection,r=z({},n.hints),o=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return np(e,t,n,i).point}(t,o,s,r)}Vo.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),s=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,s)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),s=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+s.x,y:n.y+s.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+s.x,y:n.y+s.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function pp(e,t,n){var i=vp(e),r=yp(i,t),o=i[0];return r.length?r[r.length-1]:op(o.original||o,n,t)}function dp(e,t,n){var i=vp(e),r=yp(i,t),o=i[i.length-1];return r.length?r[0]:op(o.original||o,n,t)}function fp(e,t,n){var i=vp(e),r=gp(t,n),o=i[0];return op(o.original||o,r,t)}function mp(e,t,n){var i=vp(e),r=gp(t,n),o=i[i.length-1];return op(o.original||o,r,t)}function gp(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vp(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function yp(e,t){return v(E(e,bp),(function(e){return function(e,t){return"intersect"===wn(t,e,1)}(e,t)}))}function bp(e){return e.original||e}function xp(e,t){Vo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return Er(e,"bpmn:Participant")&&Vr(e)&&Er(t,"bpmn:Participant")&&!Vr(t)}(n,i)){var r,o,s,a,l=(o=gt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){Er(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Er(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=dp(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=pp(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(cp,Vo),cp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(up,Vo),up.$inject=["eventBus","modeling"],xp.$inject=["eventBus","modeling"],e(xp,Vo);const wp=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function _p(e){const t=Or(e);if(!(Er(t,"bpmn:BoundaryEvent")||Er(t,"bpmn:StartEvent")&&Qr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&wp.some((e=>Er(n[0],e)))}function Ep(e){return Er(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function kp(e,t){e.invoke(Vo,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!_p(i))return;const o=Ep(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Or(n).get(o);s!==Or(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function Op(e,t){Vo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Sr(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function Sp(e,t,n){Vo.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(Er(r,"bpmn:SequenceFlow")&&Er(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=Hu(Cp(e[e.length-2]),Cp(e[e.length-1]),Cp(t[1]),Cp(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Cp(e[0]),Cp(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Cp(e){return e.original||e}function Pp(e,t){Vo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Er(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var i=t.makeProcess(),r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}}),!0)}function Ap(e,t,n,i){Vo.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(Er(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),Er(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(r=!0),n.canConnectSequenceFlow(o,s)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,s,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){y(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(i=n.canConnect(l,c))&&i.type!==a.type&&(o=t.connect(l,c,{type:i.type,associationDirection:i.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.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,i=e.context,r=i.properties,o=i.element,s=o.businessObject;r.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Mp(e,t,n,i,r,o){i.invoke(Vo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=x(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];y(n.closure.topLevel,(function(e){o=Qr(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var s=t.canReplace(o,i);s&&this._replaceElements(o,s.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,s=r.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,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}kp.$inject=["injector","modeling"],e(kp,Vo),e(Op,Vo),Op.$inject=["eventBus","modeling"],e(Sp,Vo),Sp.$inject=["eventBus","bpmnRules","modeling"],Pp.$inject=["eventBus","modeling"],e(Pp,Vo),e(Ap,Vo),Ap.$inject=["eventBus","modeling","bpmnRules","injector"],e(Mp,Vo),Mp.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;y(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},Mp.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Rp={width:140,height:120},Tp={width:300,height:60},Dp={width:60,height:300},Bp={width:300,height:150},Lp={width:150,height:300},Np={width:140,height:120},zp={width:50,height:30};function $p(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(Er(n,"bpmn:Lane")||Er(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Au(e),r=!0,o=!0,s=Cu(i,[i]),a=vn(e),l={},c={},h=qr(e),u=h?Tp:Dp;/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 i=vn(e);h?(i.top<a.top-10&&(r=!1),i.bottom>a.bottom+10&&(o=!1)):(i.left<a.left-10&&(r=!1),i.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Ip(a.top-i.bottom)<10&&qp(l,"top",i.top+u.height),Ip(a.top-i.top)<5&&Vp(c,"top",i.bottom-u.height)),/e/.test(t)&&(n&&Ip(a.right-i.left)<10&&Vp(l,"right",i.right-u.width),Ip(a.right-i.right)<5&&qp(c,"right",i.left+u.width)),/s/.test(t)&&(n&&Ip(a.bottom-i.top)<10&&Vp(l,"bottom",i.bottom-u.height),Ip(a.bottom-i.bottom)<5&&qp(c,"bottom",i.top+u.height)),/w/.test(t)&&(n&&Ip(a.left-i.right)<10&&qp(l,"left",i.left+u.width),Ip(a.left-i.left)<5&&Vp(c,"left",i.right-u.width))}));var p=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Er(e,"bpmn:FlowElement")||Er(e,"bpmn:Artifact"))})),d=h?Wp:Qp;return p.forEach((function(e){var n=vn(e);!/n/.test(t)||h&&!r||Vp(c,"top",n.top-d.top),/e/.test(t)&&(h||o)&&qp(c,"right",n.right+d.right),!/s/.test(t)||h&&!o||qp(c,"bottom",n.bottom+d.bottom),/w/.test(t)&&(h||r)&&Vp(c,"left",n.left-d.left)})),{min:c,max:l}}(n,i,r)),Er(n,"bpmn:SubProcess")&&Vr(n)&&(t.minDimensions=Np),Er(n,"bpmn:TextAnnotation")&&(t.minDimensions=zp)}))}$p.$inject=["eventBus"];var Ip=Math.abs,jp=Math.min,Fp=Math.max;function Hp(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Vp(e,t,n){return Hp(e,t,n,jp)}function qp(e,t,n){return Hp(e,t,n,Fp)}var Wp={top:20,left:50,right:20,bottom:20},Qp={top:50,left:20,right:20,bottom:20};function Gp(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Er(n,"bpmn:Lane")||Er(n,"bpmn:Participant"))&&(t.balanced=!bs(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(Er(i,"bpmn:Lane")||Er(i,"bpmn:Participant"))return r&&(o=mn(o),t.resizeLane(i,o,n.balanced)),!1}))}Gp.$inject=["eventBus","modeling"];function Xp(e,t,n,i,r){function o(e){return kr(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Gr(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 Er(e,"bpmn:ErrorEventDefinition")?"errorRef":Er(e,"bpmn:EscalationEventDefinition")?"escalationRef":Er(e,"bpmn:MessageEventDefinition")?"messageRef":Er(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(kr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Vo,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Or(n));i&&!s(i)&&(Ot(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&kt(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 i=l(Or(n));i&&(t.referencedRootElement=i)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=i.copyElement(o,r.create(o.$type))),function(e,t){if(kr(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)}))}Xp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xp,Vo);var Up=Math.max;function Yp(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return y(t,(function(e){var t=e.id;Er(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=qr(e);if(r=e,!Pu(r).length)return i?Bp:Lp;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?Bp:{width:Zp(e,n,o),height:Lp.height}:i?{width:Bp.width,height:Kp(e,n,o)}:Lp;return s}(e,n,i)),Er(e,"bpmn:Lane")&&(r[t]=qr(e)?Tp:Dp),Er(e,"bpmn:SubProcess")&&Vr(e)&&(r[t]=Np),Er(e,"bpmn:TextAnnotation")&&(r[t]=zp),Er(e,"bpmn:Group")&&(r[t]=Rp)})),r}))}function Kp(e,t,n){var i;return i=function(e,t,n){var i,r=Pu(e);return i=Jp(r,t,n),e.height-i.height+Tp.height}(e,t,n),Up(Bp.height,i)}function Zp(e,t,n){var i;return i=function(e,t,n){var i,r=Pu(e);return i=Jp(r,t,n),e.width-i.width+Dp.width}(e,t,n),Up(Lp.width,i)}function Jp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=Pu(r)).length?Jp(o,t,n):r}Yp.$inject=["eventBus"];var ed=180,td=160;function nd(e,t,n,i,r,o,s){Vo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return Er(e,"bpmn:SubProcess")&&!Vr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Or(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function h(t){var n=Or(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Zo(n));e.removeRootElement(i)}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)&&h(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var i=s.get(Zo(t));i&&n.removeElements(i.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&h(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,i=t.newShape;l(n)&&l(i)&&(t.oldRoot=e.removeRootElement(Zo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Zo(i));if(r&&o){var s=r.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Er(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(es(t))return s.updateId(t,Jo(r)),void s.updateId(i,r);s.get(Jo(i))&&s.updateId(Jo(i),Jo(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Er(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(es(t))return s.updateId(t,Jo(i)),void s.updateId(r,i);var o=s.get(Jo(r));o&&s.updateId(o,Jo(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(es(n)){var i=n,r=s.get(Ko(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Er(t,"bpmn:SubProcess")&&(Vr(t)?h(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Er(t,"bpmn:SubProcess")&&(Vr(t)?h(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Er(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vr(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 i=Zo(t),r=s.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(Er(Sr(r),"bpmndi:BPMNPlane")){var o=Ko(r),s=m(i,(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 id(e,t){e.invoke(Vo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(Er(i,"bpmn:SubProcess")&&(Er(n,"bpmn:Task")||Er(n,"bpmn:CallActivity"))&&Vr(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function rd(e){Vo.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;Er(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&&Er(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function od(e,t){Vo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vr(n)){var i=gt(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();y(t,(function(e){r(e,!0)})),y(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(nd,Vo),nd.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.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:ed-s.x,y:td-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},nd.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},nd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},nd.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:Zo(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},nd.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},nd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],id.$inject=["injector","modeling"],e(id,Vo),e(rd,Vo),rd.$inject=["eventBus"],e(od,Vo),od.$inject=["eventBus","modeling"];function sd(e,t,n){Vo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Er(n,"bpmn:SubProcess")&&(n.collapsed?Sr(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Sr(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Sr(t).isExpanded=!1:Sr(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,s=t;return n=(r=o,r.filter((function(e){return!e.hidden}))).concat([e]),(i=Eu(n))?(s.width=Math.max(i.width,s.width),s.height=Math.max(i.height,s.height),s.x=i.x+(i.width-s.width)/2,s.y=i.y+(i.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function ad(e,t,n,i){t.invoke(Vo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;fn(t)||(Er(t,"bpmn:Participant")&&Vr(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;Er(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function ld(e,t){Vo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!Er(e,"bpmn:SequenceFlow"))return!1;var n=Or(t),i=Or(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(sd,Vo),sd.$inject=["eventBus","elementFactory","modeling"],e(ad,Vo),ad.$inject=["canvas","injector","moddle","modeling"],e(ld,Vo),ld.$inject=["eventBus","modeling"];function cd(e,t){var n;function i(){if(!n)throw new Error("out of bounds release");return n}Vo.call(this,e);var r=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(r,5e3,(function(e){(n=n||new hd).enter()})),this.postExecuted(r,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=i();t.labelTarget||(Er(t,"bpmn:Lane")&&n.addLane(t),Er(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function hd(){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 ud(e,t){Vo.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)pd(e)&&!dd(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function pd(e){const t=Or(e);return t&&t.isForCompensation}function dd(e){return e.incoming.filter((e=>function(e){return e&&Er(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}cd.$inject=["eventBus","modeling"],e(cd,Vo),e(ud,Vo),ud.$inject=["eventBus","modeling"];var fd={__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",Gh],appendBehavior:["type",Uh],associationBehavior:["type",Yh],attachEventBehavior:["type",Kh],boundaryEventBehavior:["type",Jh],compensateBoundaryEventBehaviour:["type",eu],createBehavior:["type",ru],createDataObjectBehavior:["type",ou],createParticipantBehavior:["type",hu],dataInputAssociationBehavior:["type",pu],dataStoreBehavior:["type",mu],deleteLaneBehavior:["type",Ru],detachEventBehavior:["type",Tu],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",zu],fixHoverBehavior:["type",ju],groupBehavior:["type",Fu],importDockingFix:["type",Vu],isHorizontalFix:["type",Wu],labelBehavior:["type",cp],layoutConnectionBehavior:["type",up],messageFlowBehavior:["type",xp],nonInterruptingBehavior:["type",kp],removeElementBehavior:["type",Sp],removeEmbeddedLabelBoundsBehavior:["type",Op],removeParticipantBehavior:["type",Pp],replaceConnectionBehavior:["type",Ap],replaceElementBehaviour:["type",Mp],resizeBehavior:["type",$p],resizeLaneBehavior:["type",Gp],rootElementReferenceBehavior:["type",Xp],spaceToolBehavior:["type",Yp],subProcessPlaneBehavior:["type",nd],subProcessStartEventBehavior:["type",id],textAnnotationBehavior:["type",rd],toggleCollapseConnectionBehaviour:["type",od],toggleElementCollapseBehaviour:["type",sd],unclaimIdBehavior:["type",ad],unsetDefaultFlowBehavior:["type",ld],updateFlowNodeRefsBehavior:["type",cd],setCompensationActivityAfterPasteBehavior:["type",ud]};function md(e,t){var n=wn(e,t,-15);return"intersect"!==n?n:null}function gd(e){Yl.call(this,e)}function vd(e){return!e||fn(e)}function yd(e){do{if(Er(e,"bpmn:Process"))return Or(e);if(Er(e,"bpmn:Participant"))return Or(e).processRef||Or(e)}while(e=e.parent)}function bd(e){return Er(e,"bpmn:TextAnnotation")}function xd(e){return Er(e,"bpmn:Group")&&!e.labelTarget}function wd(e){return Er(e,"bpmn:BoundaryEvent")&&Od(e,"bpmn:CompensateEventDefinition")}function _d(e){return Or(e).isForCompensation}function Ed(e){for(var t=e;t=t.parent;){if(Er(t,"bpmn:FlowElementsContainer"))return Or(t);if(Er(t,"bpmn:Participant"))return Or(t).processRef}return null}function kd(e,t){return Ed(e)===Ed(t)}function Od(e,t){return!!m(Or(e).eventDefinitions||[],(function(e){return Er(e,t)}))}function Sd(e,t){return(Or(e).eventDefinitions||[]).every((function(e){return Er(e,t)}))}function Cd(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 Pd(e,t,n){if(vd(e)||vd(t))return null;if(!Er(n,"bpmn:DataAssociation")){if(Hd(e,t))return{type:"bpmn:MessageFlow"};if(Vd(e,t))return{type:"bpmn:SequenceFlow"}}var i=qd(e,t);return i||(Fd(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!jd(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Ad(e,t){return!(!fn(e)&&!xd(e))||!(Er(t,"bpmn:Participant")&&!Vr(t))&&(Er(e,"bpmn:Participant")?Er(t,"bpmn:Process")||Er(t,"bpmn:Collaboration"):kr(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Er(e,"bpmn:Lane")?Er(t,"bpmn:Participant")||Er(t,"bpmn:Lane"):!(Er(e,"bpmn:BoundaryEvent")&&!function(e){return Or(e).cancelActivity&&(Td(e)||Dd(e))}(e))&&(Er(e,"bpmn:FlowElement")&&!Er(e,"bpmn:DataStoreReference")?Er(t,"bpmn:FlowElementsContainer")?Vr(t):kr(t,["bpmn:Participant","bpmn:Lane"]):Er(e,"bpmn:DataStoreReference")&&Er(t,"bpmn:Collaboration")?_(Or(t).get("participants"),(function(e){return!!e.get("processRef")})):kr(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?kr(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Er(e,"bpmn:MessageFlow")&&(Er(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Md(e){return Er(e,"bpmn:Lane")}function Rd(e){return!!function(e){return!fn(e)&&Er(e,"bpmn:BoundaryEvent")}(e)||(!(!Er(e,"bpmn:IntermediateThrowEvent")||!Td(e))||Er(e,"bpmn:IntermediateCatchEvent")&&Dd(e))}function Td(e){var t=Or(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dd(e){return Bd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bd(e,t){return t.some((function(t){return Od(e,t)}))}function Ld(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!fn(r)&&(!!Rd(r)&&(!Qr(t)&&(!(!Er(t,"bpmn:Activity")||_d(t))&&(!(i&&!md(i,t))&&(!function(e){return Er(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return Er(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Nd(e,t,n){if(!t)return!1;var i={replacements:[]};return y(e,(function(e){Qr(t)||Er(e,"bpmn:StartEvent")&&"label"!==e.type&&Ad(e,t)&&(Wr(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Er(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Er(t,"bpmn:Transaction")||Od(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Er(e,"bpmn:EndEvent")&&Ad(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Er(e,"bpmn:BoundaryEvent")&&Ld(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function zd(e,t){return!_(e,Md)&&(!t||e.every((function(e){return Ad(e,t)})))}function $d(e,t,n,i){return!!t&&(!(!fn(e)&&!xd(e))||!function(e,t){return e===t}(n,t)&&((!n||!Cd(n,t))&&(Ad(e,t)||Wd(e,t))))}function Id(e,t){return Er(e,"bpmn:SubProcess")?Vr(e)&&(!t||t.width>=100&&t.height>=80):!!Er(e,"bpmn:Lane")||(!!Er(e,"bpmn:Participant")||(!!bd(e)||!!xd(e)))}function jd(e,t){return!Cd(t,e)&&!Cd(e,t)&&(!!function(e,t){var n=bd(e),i=bd(t);return(n||i)&&n!==i}(e,t)||!!qd(e,t))}function Fd(e,t){return kd(e,t)&&wd(e)&&Er(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Qr(t);var n}function Hd(e,t){return!(Gd(e)&&!Gd(t))&&(Er(n=e,"bpmn:InteractionNode")&&!Er(n,"bpmn:BoundaryEvent")&&(!Er(n,"bpmn:Event")||Er(n,"bpmn:ThrowEvent")&&Sd(n,"bpmn:MessageEventDefinition"))&&function(e){return Er(e,"bpmn:InteractionNode")&&!_d(e)&&(!Er(e,"bpmn:Event")||Er(e,"bpmn:CatchEvent")&&Sd(e,"bpmn:MessageEventDefinition"))&&!(Er(e,"bpmn:BoundaryEvent")&&!Od(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return yd(e)===yd(t)}(e,t));var n}function Vd(e,t){return Er(n=e,"bpmn:FlowNode")&&!Er(n,"bpmn:EndEvent")&&!Qr(n)&&!(Er(n,"bpmn:IntermediateThrowEvent")&&Od(n,"bpmn:LinkEventDefinition"))&&!wd(n)&&!_d(n)&&function(e){return Er(e,"bpmn:FlowNode")&&!Er(e,"bpmn:StartEvent")&&!Er(e,"bpmn:BoundaryEvent")&&!Qr(e)&&!(Er(e,"bpmn:IntermediateCatchEvent")&&Od(e,"bpmn:LinkEventDefinition"))&&!_d(e)}(t)&&kd(e,t)&&!(Er(e,"bpmn:EventBasedGateway")&&!function(e){return Er(e,"bpmn:ReceiveTask")||Er(e,"bpmn:IntermediateCatchEvent")&&(Od(e,"bpmn:MessageEventDefinition")||Od(e,"bpmn:TimerEventDefinition")||Od(e,"bpmn:ConditionalEventDefinition")||Od(e,"bpmn:SignalEventDefinition"))}(t));var n}function qd(e,t){return kr(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&kr(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!kr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!kr(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Wd(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&&(kr(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&Er(e,"bpmn:FlowNode")&&!Er(e,"bpmn:BoundaryEvent")&&Ad(e,t.parent))}function Qd(e,t){return!!fn(t)||!(Er(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Gd(e){return hc(e,"bpmn:Process")||hc(e,"bpmn:Collaboration")}e(gd,Yl),gd.$inject=["eventBus"],gd.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(vd(e))return null;return kr(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,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return Pd(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Pd(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Id(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(dn(i)&&!Wd(t,i))&&w(t,(function(e){return dn(e)?Pd(e.source,e.target,e):e.host?Ld(e,e.host,null,n):$d(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Ld(n,t,null,i)||Nd(n,t,i)||zd(n,t)||Wd(n,t)})),this.addRule("shape.create",(function(e){return $d(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Ld(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Qd(e.elements,t)}))},gd.prototype.canConnectMessageFlow=Hd,gd.prototype.canConnectSequenceFlow=Vd,gd.prototype.canConnectDataAssociation=qd,gd.prototype.canConnectAssociation=jd,gd.prototype.canConnectCompensationAssociation=Fd,gd.prototype.canMove=zd,gd.prototype.canAttach=Ld,gd.prototype.canReplace=Nd,gd.prototype.canDrop=Ad,gd.prototype.canInsert=Wd,gd.prototype.canCreate=$d,gd.prototype.canConnect=Pd,gd.prototype.canResize=Id,gd.prototype.canCopy=Qd;var Xd={__depends__:[Tc],__init__:["bpmnRules"],bpmnRules:["type",gd]};function Ud(e,t){e.on("saveXML.start",2e3,(function(){y(t.getRootElements(),(function(e){var t,n=Sr(e);t=E(v(gt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Sr),n.set("planeElement",t)}))}))}Ud.$inject=["eventBus","canvas"];var Yd={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ud]};function Kd(e){Vo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function Zd(e,t){Kd.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 i(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 kr(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||Er(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var i=t;i&&!kr(i,n);)i=i.parent;if(!i)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return i}(e,n,r.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Kd.prototype.getOrdering=function(e,t){return null},e(Kd,Vo),Zd.$inject=["eventBus","canvas"],e(Zd,Kd);var Jd={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Zd]};function ef(){}ef.prototype.get=function(){return this._data},ef.prototype.set=function(e){this._data=e},ef.prototype.clear=function(){var e=this._data;return delete this._data,e},ef.prototype.isEmpty=function(){return!this._data};var tf={clipboard:["type",ef]},nf="drop-ok",rf="drop-not-ok",of="attach-ok",sf="new-parent",af="create";function lf(e,t,n,i,r){function o(t,n){[of,nf,rf,sf].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===af&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,s=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);cf(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var s=m(e=v(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!dn(e)})),a=!1,l=!1,c=!1;hf(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=hf(e)?r.allowed("shape.create",{position:n,shape:s,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var h=o.connectionTarget;return c||a?(s&&i&&(l=r.allowed("connection.create",{source:h===i?s:i,target:h===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,s,a);i&&null!==c&&(t.target=i,c&&c.attach?o(i,of):o(i,c?sf:rf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,h=t.hints||{};if(!1===a||!s)return!1;cf(e);var u={x:e.x,y:e.y};r=c?i.appendShape(n,r,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:h.connectionTarget}):m(o=i.createElements(o,u,s,z({},h,{attach:l})),(function(e){return!dn(e)})),z(t,{elements:o,shape:r}),z(e,{elements:o,shape:r})})),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,i){c(n)||(n=[n]);var r=m(n,(function(e){return!dn(e)}));if(r){i=z({elements:n,hints:{},shape:r},i||{}),y(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(v(n,(function(e){return!e.hidden})));y(n,(function(e){dn(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}}))),z(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,af,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function cf(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 hf(e){return e&&1===e.length&&!dn(e[0])}lf.$inject=["canvas","dragging","eventBus","modeling","rules"];function uf(e,t,n,i,r){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=De("g");ke(t,r.cls("djs-drag-group",["no-events"]));var o=De("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Un(r),e)):(r=n._createContainer("shape",o),n.drawShape(Un(r),e),Kn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Kn(l,t.x,t.y)):qe(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&qe(t)}))}uf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var pf={__depends__:[Cc,Fh,Tc,Rs],__init__:["create","createPreview"],create:["type",lf],createPreview:["type",uf]};function df(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)}))}df.$inject=["eventBus"],df.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var ff={__init__:["mouse"],mouse:["type",df]};function mf(e,t,n,i,r,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=s,this._rules=a,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=m(i,(function(e){return e===n.parent}));r&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),dn(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=gf(e)).original&&(e.original=gf(e.original)),e}))}(n)),fn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),y(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),r.on("copyPaste.pasteElements",(function(e){z(e.hints,{createElementsBehavior:!1})}))}function gf(e){return z({},e)}function vf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}mf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],mf.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},mf.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 i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},mf.prototype._paste=function(e,t,n,i){y(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var r=vt(e);return y(e,(function(e){dn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),z(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,z({},i))},mf.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return y(e,(function(e,o){y(e=A(e,"priority"),(function(e){var o,s=z({},j(e,["priority"]));return i[e.parent]?s.parent=i[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s}),dn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):fn(s)?(s.labelTarget=i[s.labelTarget],o=i[e.id]=t.createLabel(s),void r.push(o)):(s.host&&(s.host=i[s.host]),o=i[e.id]=t.createShape(s),void r.push(o))}))})),r},mf.prototype.createConnection=function(e){return this._elementFactory.createConnection(j(e,["id"]))},mf.prototype.createLabel=function(e){return this._elementFactory.createLabel(j(e,["id"]))},mf.prototype.createShape=function(e){return this._elementFactory.createShape(j(e,["id"]))},mf.prototype.hasRelations=function(e,t){var n,i;return!(dn(e)&&(n=m(t,M({id:e.source.id})),i=m(t,M({id:e.target.id})),!n||!i))&&!(fn(e)&&!m(t,M({id:e.labelTarget.id})))},mf.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=m(r,(function(t){return e===t.element}));n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}return mt(pt(e),(function(e,t,i){if(!fn(e)){y(e.labels,(function(e){o(e,i)})),y([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&y(e,(function(e){y(e.labels,(function(e){o(e,i)})),o(e,i)}))})),o(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}})),e=E(r,(function(e){return e.element})),r=E(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=A(r,(function(e){return e.descriptor.priority})),e=E(r,(function(e){return e.element})),y(r,(function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?vf(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):vf(r.element,e)})),i};var yf={__depends__:[tf,pf,ff,Tc],__init__:["copyPaste"],copyPaste:["type",mf]};function bf(e,t,n){c(n)||(n=[n]),y(n,(function(n){s(e[n])||(t[n]=e[n])}))}function xf(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=Or(n);if(fn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(Sr(n),!0);s.bpmnElement=o,bf(o,t,"name"),bf(s,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Or(t[n.labelTarget]),void(n.di=Sr(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,bf(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Er(n,"bpmn:Participant")){var r=Or(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[r]=t}(t,function(e,t,n){var i=Or(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Or(e).attachedToRef=Or(t[e.host])),j(n,x(n,(function(t,n,r){var o=n.element,s=n.property;return r===e.id&&(o.set(s,i),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[r]=e[r]||{}}(t)))}))}xf.$inject=["bpmnFactory","eventBus","moddleCopy"];var wf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function _f(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 A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=h(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===wf.indexOf(i))&&(!(i&&n&&!m(n.properties,M({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&p(t.$instanceOf)&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1}))}function Ef(e,t){return x(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}_f.$inject=["eventBus","bpmnFactory","moddle"],_f.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||Ef(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(c(o)&&(n=o),y(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=r.copyProperty(o,t,n,i);a(s)&&(!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},_f.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(!1!==o){if(o)return h(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,i);if(c(e))return x(e,(function(e,s){return(o=r.copyProperty(s,t,n,i))?e.concat(o):e}),[]);if(h(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=r._bpmnFactory.create(e.$type)).$parent=t,o=r.copyElement(e,o,null,i)}return e}}},_f.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 kf={__depends__:[yf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",xf],moddleCopy:["type",_f]},Of=Math.round;function Sf(e,t){this._modeling=e,this._eventBus=t}function Cf(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}Sf.$inject=["modeling","eventBus"],Sf.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.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=Of(a+o/2),h=Of(l+s/2),u=i.replaceShape(e,z({},t,{x:c,y:h,width:o,height:s}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},Cf.$inject=["selection","eventBus"];var Pf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Cf],replace:["type",Sf]};var Af=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Mf(e,t,n,i,r,o){this.replaceElement=function(a,l,h){h=h||{};var u=l.type,p=a.businessObject;if(Rf(p)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Vr(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return i.toggleCollapse(a),a;var d=e.create(u),m={type:u,businessObject:d,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),y(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)}))}(Ef(p.$descriptor),Ef(d.$descriptor,!0));z(d,I(l,Af));var b=v(g,(function(e){return"eventDefinitions"===e?Tf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Qr(d):!f(d,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Qr(d))))}));if(d=n.copyElement(p,d,b),l.eventDefinitionType&&(Tf(d,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),Er(p,"bpmn:Activity")){if(Rf(p))m.isExpanded=Vr(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var x=t.getDefaultSize(d,{isExpanded:m.isExpanded});m.width=x.width,m.height=x.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Vr(a)&&!Er(p,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Rf(p)&&!Rf(d)&&(h.moveChildren=!1),Er(p,"bpmn:Participant")){!0===l.isExpanded?d.processRef=e.create("bpmn:Process"):h.moveChildren=!1;var w=qr(a);Sr(a).isHorizontal||(Sr(m).isHorizontal=w),m.width=w?a.width:t.getDefaultSize(m).width,m.height=w?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:d})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),d.name=p.name,kr(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&kr(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),l.host&&!Er(p,"bpmn:BoundaryEvent")&&Er(d,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),r.replaceElement(a,m,{...h,targetElement:l})}}function Rf(e){return Er(e,"bpmn:SubProcess")}function Tf(e,t){var n=Or(e);return t&&n.get("eventDefinitions").some((function(e){return Er(e,t)}))}Mf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Df={__depends__:[kf,Pf,Rs],bpmnReplace:["type",Mf]};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,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),y(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ee(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Lf={__depends__:[Cc],__init__:["toolManager"],toolManager:["type",Bf]};function Nf(e,t){return-1!==e.indexOf(t)}var zf=Math.abs,$f=Math.round,If={x:"width",y:"height"},jf="crosshair",Ff={n:"top",w:"left",s:"bottom",e:"right"},Hf=1500,Vf={n:"s",w:"e",s:"n",e:"w"},qf=20;function Wf(e,t,n,i,r,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",Hf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Gf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Gf(e);var c={x:0,y:0};c[i]=$f(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Qf(e){return{top:e.top-qf,right:e.right+qf,bottom:e.bottom+qf,left:e.left-qf}}function Gf(e){var t,n,i=e.context.spaceToolConstraints;i&&(u(i.left)&&(t=Math.max(e.x,i.left),e.dx=e.dx+t-e.x,e.x=t),u(i.right)&&(t=Math.min(e.x,i.right),e.dx=e.dx+t-e.x,e.x=t),u(i.top)&&(n=Math.max(e.y,i.top),e.dy=e.dy+n-e.y,e.y=n),u(i.bottom)&&(n=Math.min(e.y,i.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Xf(e,t){return-1!==e.indexOf(t)}Wf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:jf,data:{context:{reactivate:n}},trapClick:!1})},Wf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:jf,data:{context:{}}})},Wf.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wf.prototype.init=function(e,t){var n=zf(e.dx)>zf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(zf(i)<5)return!1;i<0&&(i*=-1),bs(e)&&(i*=-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,i),s=this._canvas.getRootElement();!xs(e)&&e.hover&&(s=e.hover);var a=[...gt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,i,r),c=function(e,t,n,i,r){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return y(s,(function(e){var h,p,d,f,m,g,y=e.attachers,b=e.children,x=vn(e),w=v(b,(function(e){return!(dn(e)||fn(e)||Xf(o,e)||Xf(s,e))})),_=v(b,(function(e){return!dn(e)&&!fn(e)&&Xf(o,e)})),E=[],k=[];w.length&&(p=Qf(vn(vt(w))),h=i-x[Ff[n]]+p[Ff[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,h):h:"w"===n?c.right=l=u(l)?Math.min(l,h):h:"s"===n?c.top=a=u(a)?Math.max(a,h):h:"e"===n&&(c.left=a=u(a)?Math.max(a,h):h)),_.length&&(d=Qf(vn(vt(_))),h=i-d[Ff[Vf[n]]]+x[Ff[Vf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,h):h:"w"===n?c.right=l=u(l)?Math.min(l,h):h:"s"===n?c.top=a=u(a)?Math.max(a,h):h:"e"===n&&(c.left=a=u(a)?Math.max(a,h):h)),y&&y.length&&(y.forEach((function(e){Xf(o,e)?E.push(e):k.push(e)})),E.length&&(f=vn(vt(E.map(xn))),m=x[Ff[Vf[n]]]-(f[Ff[Vf[n]]]-i)),k.length&&(g=vn(vt(k.map(xn)))[Ff[n]]-(x[Ff[n]]-i)),"n"===n?(h=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,h):h):"w"===n?(h=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,h):h):"s"===n?(h=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,h):h):"e"===n&&(h=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,h):h));var O=r&&r[e.id];O&&("n"===n?(h=i+e[If[t]]-O[If[t]],c.bottom=l=u(l)?Math.min(l,h):h):"w"===n?(h=i+e[If[t]]-O[If[t]],c.right=l=u(l)?Math.min(l,h):h):"s"===n?(h=i-e[If[t]]+O[If[t]],c.top=a=u(a)?Math.max(a,h):h):"e"===n&&(h=i-e[If[t]]+O[If[t]],c.left=a=u(a)?Math.max(a,h):h))})),c}(l,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:r}));return z(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:r}),Zs("resize-"+("x"===n?"ew":"ns")),!0},Wf.prototype.calculateAdjustments=function(e,t,n,i){var r=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)}y(e,(function(e){if(e.parent&&!fn(e))if(dn(e))l.push(e);else{var o=e[t],h=o+e[If[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>i||n<0&&xn(e)[t]<i))a.push(e);else{var u;if(!(n>0&&o>i||n<0&&h<i))return o<i&&h>i&&r.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),y(o,(function(e){var t=e.attachers;t&&y(t,(function(e){c(e)}))}));var h=o.concat(s);return y(a,(function(e){var t=e.host;Xf(h,t)&&c(e)})),h=o.concat(s),y(l,(function(e){var t=e.source,n=e.target,i=e.label;Xf(h,t)&&Xf(h,n)&&i&&c(i)})),{movingShapes:o,resizingShapes:s}},Wf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Uf="djs-dragging",Yf="djs-resizing",Kf=Math.max;function Zf(e,t,n,i,r){function o(e,t){y(e,(function(e){r.addDragger(e,t),n.addMarker(e,Uf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=De("g");ke(a,i.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=De("path");ke(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=De("path");ke(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),r.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&&qe(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,h=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");ke(a=De("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var p=De("g");ke(p,i.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),p),o(c,p),o(s.movingConnections=t.filter((function(e){var t=!1;y(c,(function(n){y(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;y(c,(function(t){y(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;y(h,(function(t){y(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return y(h,(function(t){y(t.incoming,(function(t){e===t&&(r=!0)}))})),dn(e)&&(t||i)&&(n||r)})),p),s.dragGroup=p}if(!s.frameGroup){var d=De("g");ke(d,i.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),d);var f=[];y(h,(function(e){var t=r.addFrame(e,d),i=t.getBBox();f.push({element:t,initialBounds:i}),n.addMarker(e,Yf)})),s.frameGroup=d,s.frames=f}ke(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),y(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?ke(i,{width:Kf(r.width+m.x,5)}):ke(i,{width:t=Kf(r.width-m.x,5),x:r.x+r.width-t}),"s"===s.direction?ke(i,{height:Kf(r.height+m.y,5)}):ke(i,{height:n=Kf(r.height-m.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;y(i,(function(e){n.removeMarker(e,Uf)})),y(r,(function(e){n.removeMarker(e,Uf)})),a&&(qe(s),qe(a)),y(o,(function(e){n.removeMarker(e,Yf)})),l&&qe(l)}))}Zf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Jf={__init__:["spaceToolPreview"],__depends__:[Cc,Tc,Lf,Fh,ff],spaceTool:["type",Wf],spaceToolPreview:["type",Zf]};function em(e,t){e.invoke(Wf,this),this._canvas=t}em.$inject=["injector","canvas"],e(em,Wf),em.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],s=[];o&&(s=O(yt(r.children.filter((e=>Er(e,"bpmn:Artifact"))),vt(o))));const a=[...e,...s];var l=Wf.prototype.calculateAdjustments.call(this,a,t,n,i);return l.resizingShapes=l.resizingShapes.filter((function(e){return!Er(e,"bpmn:TextAnnotation")&&(!function(e){return Er(e,"bpmn:Participant")&&!Or(e).processRef}(e)||!("y"===t&&qr(e)||"x"===t&&!qr(e)))})),l};var tm={__depends__:[Jf],spaceTool:["type",em]};function nm(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)}nm.$inject=["eventBus","injector"],nm.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()},nm.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},nm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},nm.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()}},nm.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()}},nm.prototype.register=function(e,t){this._setHandler(e,t)},nm.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)},nm.prototype.canUndo=function(){return!!this._getUndoAction()},nm.prototype.canRedo=function(){return!!this._getRedoAction()},nm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nm.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},nm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},nm.prototype._createId=function(){return this._uid++},nm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nm.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},nm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},nm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:C("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},nm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},nm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nm.prototype._revertedAction=function(e){this._stackIdx--},nm.prototype._getHandler=function(e){return this._handlerMap[e]},nm.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 im={commandStack:["type",nm]};function rm(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 om(e,t,n){Vo.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=sm(n),t.validatedShapes=sm(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];y(n,(function(e){y(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),y(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];y(n,(function(e){y(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;rm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=St(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(Ot(i.labels,n,r),n.labelTarget=i)}))}function sm(e){return v(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(om,Vo),om.$inject=["injector","eventBus","modeling"];var am={__init__:["labelSupport"],labelSupport:["type",om]},lm="attach-ok";function cm(e,t,n,i,r){Vo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=hm(t=r),P("id",t,n)),i.validatedShapes=function(e){var t=S(e,"id");return v(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;y(hm(t.shapes),(function(e){o.makeDraggable(t,e,!0),y(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,lm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,lm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;y(hm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||y(i?n:v(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){y(e.context.shapes,(function(e){y(e.attachers,(function(e){y(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),y(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;rm(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&y(o.attachers,(function(e){var t=sp(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&y(s,(function(e){var t=sp(e,i,o);r.moveShape(e,t,e.parent),y(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;rm(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function hm(e){return i(E(e,(function(e){return e.attachers||[]})))}e(cm,Vo),cm.$inject=["injector","eventBus","canvas","rules","modeling"];var um={__depends__:[Tc],__init__:["attachSupport"],attachSupport:["type",cm]};function pm(e){this._model=e}function dm(e,t,n){Vo.call(this,e),this._bpmnFactory=t;var i=this;function r(e){y(e.context.oldRoot.children,(function(e){Er(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function o(e){var t=e.context.shape;Er(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function a(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}function c(e){const{element:n}=e.context,i=to(n),r=Sr(n),o=r&&r.get("label");Yr(n)||es(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fm((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fm((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],r),this.reverted(["canvas.updateRoot"],r),this.executed(["shape.move","shape.create","shape.resize"],fm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],fm((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"],fm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],fm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],fm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],fm(a)),this.executed("connection.reconnect",fm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Or(n),s=Or(i),a=Or(r);o.conditionExpression&&!kr(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",fm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Or(n),s=Or(i),a=Or(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],fm(l)),this.reverted(["element.updateAttachment"],fm(l)),this.executed("element.updateLabel",fm(c)),this.reverted("element.updateLabel",fm(c))}function fm(e){return function(t){var n=t.context;Er(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function mm(e,t){qn.call(this),this._bpmnFactory=e,this._moddle=t}function gm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],j(t,[n]))}function vm(e,t){this._modeling=e,this._canvas=t}function ym(e){this._modeling=e}function bm(e,t){this._canvas=e,this._layouter=t}pm.$inject=["moddle"],pm.prototype._needsId=function(e){return kr(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"])},pm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Er(e,"bpmn:Activity")?"Activity":Er(e,"bpmn:Event")?"Event":Er(e,"bpmn:Gateway")?"Gateway":kr(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},pm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},pm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},pm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},pm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},pm.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},pm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",I(e,["x","y"]))},pm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},pm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))},e(dm,Vo),dm.$inject=["eventBus","bpmnFactory","connectionDocking"],dm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},dm.prototype.updateParent=function(e,t){if(!(fn(e)||Er(e,"bpmn:DataStoreReference")&&e.parent&&Er(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Sr(e),o=n&&n.businessObject,s=Sr(n);Er(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),Er(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Er(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),Er(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},dm.prototype.updateBounds=function(e){var t=Sr(e),n=function(e){if(!Er(e,"bpmn:Activity"))return;var t=Sr(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ia(n,t.get("bounds"));z(n,{x:e.x+i.x,y:e.y+i.y})}var r=fn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},dm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Er(n,"bpmn:Lane")&&kt(n.get("flowNodeRef"),e),Er(t,"bpmn:Lane")&&Ot(t.get("flowNodeRef"),e))},dm.prototype.updateDiConnection=function(e,t,n){var i=Sr(e),r=Sr(t),o=Sr(n);i.sourceElement&&i.sourceElement.bpmnElement!==Or(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Or(n)&&(i.targetElement=n&&o)},dm.prototype.updateDiParent=function(e,t){if(t&&!Er(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(kt(n,e),e.$parent=null)}},dm.prototype.getLaneSet=function(e){var t,n;return Er(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Er(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},dm.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&(!Er(e,"bpmn:DataInput")&&!Er(e,"bpmn:DataOutput")||(Er(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Er(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Er(e,"bpmn:FlowElement")){if(t)if(Er(t,"bpmn:Participant"))t=t.processRef;else if(Er(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Er(t,"bpmn:Lane"));i="flowElements"}else if(Er(e,"bpmn:Artifact")){for(;t&&!Er(t,"bpmn:Process")&&!Er(t,"bpmn:SubProcess")&&!Er(t,"bpmn:Collaboration");){if(Er(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Er(e,"bpmn:MessageFlow"))i="messageFlows";else if(Er(e,"bpmn:Participant")){i="participants";var r,o=e.processRef;o&&(r=function(e){for(;e&&!Er(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(kt(r.get("rootElements"),o),o.$parent=null),t&&(Ot(r.get("rootElements"),o),o.$parent=r))}else Er(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Er(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&kt(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(i);kt(s,e),t&&(a||(a=[],t.set(i,a)),a.push(e))}}},dm.prototype.updateConnectionWaypoints=function(e){Sr(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},dm.prototype.updateConnection=function(e){var t,n=e.connection,i=Or(n),r=n.source,o=Or(r),s=n.target,a=Or(n.target);if(Er(i,"bpmn:DataAssociation"))Er(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):Er(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=Er(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(kt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(kt(i.targetRef&&i.targetRef.get("incoming"),i),a&&a.get("incoming")&&a.get("incoming").push(i)),i.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,s)},dm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(mm,qn),mm.$inject=["bpmnFactory","moddle"],mm.prototype._baseCreate=qn.prototype.create,mm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},Xr,t))}return this.createElement(e,t)},mm.prototype.createElement=function(e,t){var n,i,r,o=(t=z({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");xr(o=this._bpmnFactory.create(t.type))}if(!kr(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=z({},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 Er(o,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=function(e,t,n){return y(n,(function(n){t=gm(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=gm(s,t,"isExpanded")),kr(o,["bpmn:Lane","bpmn:Participant"])&&(t=gm(s,t,"isHorizontal")),Er(o,"bpmn:SubProcess")&&(t.collapsed=!Vr(o,s)),Er(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&&(i=o.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=o,o.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=z({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},mm.prototype.getDefaultSize=function(e,t){var n=Or(e);if(t=t||Sr(e),Er(n,"bpmn:SubProcess"))return Vr(n,t)?{width:350,height:200}:{width:100,height:80};if(Er(n,"bpmn:Task"))return{width:100,height:80};if(Er(n,"bpmn:Gateway"))return{width:50,height:50};if(Er(n,"bpmn:Event"))return{width:36,height:36};if(Er(n,"bpmn:Participant")){var i=void 0===t.isHorizontal||!0===t.isHorizontal;return Vr(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return Er(n,"bpmn:Lane")?{width:400,height:100}:Er(n,"bpmn:DataObjectReference")?{width:36,height:50}:Er(n,"bpmn:DataStoreReference")?{width:50,height:50}:Er(n,"bpmn:TextAnnotation")?{width:100,height:30}:Er(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mm.prototype.createParticipantShape=function(e){return h(e)||(e={isExpanded:e}),!1!==(e=z({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},vm.$inject=["modeling","canvas"],vm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;y(n,(function(e){var n={x:0,y:0};a(i.left)?n.x=i.left-e.x:a(i.right)?n.x=i.right-e.width-e.x:a(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:a(i.top)?n.y=i.top-e.y:a(i.bottom)?n.y=i.bottom-e.height-e.y:a(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},vm.prototype.postExecute=function(e){},ym.$inject=["modeling"],ym.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},ym.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},bm.$inject=["canvas","layouter"],bm.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,o),t},bm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xm=Math.round;function wm(e){this._modeling=e}wm.$inject=["modeling"],wm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,s=this._modeling;y(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(v(t,(function(e){return!e.hidden})));y(t,(function(e){dn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:xm(e.x-a.x-a.width/2+r.x),y:xm(e.y-a.y-a.height/2+r.y)}}))),z(e,{x:xm(e.x-a.x-a.width/2+r.x),y:xm(e.y-a.y-a.height/2+r.y)})}));var l=pt(t),c={};y(t,(function(e){if(dn(e))c[e.id]=u(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=z({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=j(t,["attach"])),c[e.id]=u(i)?s.createShape(e,I(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,I(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var _m=Math.round;function Em(e){this._canvas=e}function km(e){Em.call(this,e)}Em.$inject=["canvas"],Em.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?z(t,n):z(t,{x:n.x-_m(t.width/2),y:n.y-_m(t.height/2)}),this._canvas.addShape(t,i,r),t},Em.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(km,Em),km.$inject=["canvas"];var Om=Em.prototype.execute;km.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,Om.call(this,e)};var Sm=Em.prototype.revert;function Cm(e,t){this._canvas=e,this._modeling=t}function Pm(e,t){this._modeling=e,this._elementRegistry=t}function Am(e,t){this._canvas=e,this._modeling=t}function Mm(e){this._modeling=e}km.prototype.revert=function(e){return e.shape.labelTarget=null,Sm.call(this,e)},Cm.$inject=["canvas","modeling"],Cm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Cm.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},Cm.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,i),this._canvas.addConnection(t,n),t},Pm.$inject=["modeling","elementRegistry"],Pm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;y(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Am.$inject=["canvas","modeling"],Am.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.children,(function(e){dn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Am.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=St(i.children,n),t.removeShape(n),n},Am.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ot(i.children,n,r),t.addShape(n,i),n},Mm.$inject=["modeling"];var Rm={x:"y",y:"x"};function Tm(e,t){this._layouter=e,this._canvas=t}function Dm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Lm(e){this._modeling=e}function Nm(e){this._helper=new Lm(e)}function zm(e){this._modeling=e,this._helper=new Lm(e)}function $m(e){this._modeling=e}function Im(e){return e.original||e}function jm(e,t){this._modeling=e,this._rules=t}function Fm(e){this._modeling=e}function Hm(e){this._modeling=e}function Vm(e){return z({},e)}function qm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Wm(e,t,n){var i=qm(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Qm(e,t){return-1!==e.indexOf(t)}function Gm(e){this._modeling=e}function Xm(e){var t={};return y(e,(function(e){t[e.id]=e.hidden,e.children&&(t=z({},t,Xm(e.children)))})),t}function Um(e,t){var n=[];return y(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Um(e.children,e.collapsed||t)))})),n}function Ym(e,t){var n=[];return y(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Ym(e.children,t)))})),n}function Km(e){this._modeling=e}function Zm(e,t){return kt(e&&e.attachers,t)}function Jm(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ot(i,t,n)}}function eg(){}function tg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function ng(e){this._elementRegistry=e}function ig(e,t){y(t,(function(t,n){e.set(n,t)}))}Mm.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function s(e){return e[i]+e[r]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,h,u=n[0],p=a(n),d=n[p],f=0;y(n,(function(e,c){var h,u,d;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(h=A(e.elements,i))[0],c===p&&(u=h[a(h)]),d=s(u),e.range=null,y(h,(function(n){!function(e,n){var r={y:0};r[i]=e-s(n),r[i]&&(r[Rm[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),h=Math.abs(d.range.min-u.range.max),(c=Math.round((h-f)/(n.length-1)))<n.length-1||y(n,(function(e,o){var s,a={};e!==u&&e!==d&&(s=n[o-1],e.range.max=0,y(e.elements,(function(n,o){a[Rm[i]]=0,a[i]=s.range.max-n[i]+c,e.range.min!==n[i]&&(a[i]+=n[i]-e.range.min),a[i]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},Mm.prototype.postExecute=function(e){},Tm.$inject=["layouter","canvas"],Tm.prototype.execute=function(e){var t=e.connection;return z(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Tm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Dm.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=kt(o.children,t),Ot(i.children,t,r),t.parent=i,y(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},Dm.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return kt(n.children,t),Ot(i.children,t,r),t.parent=i,y(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),h(t)&&(n=t,t=!0);var i=wt((n=n||{}).allShapes),r=wt(n.allConnections),o=wt(n.enclosedElements),a=wt(n.enclosedConnections),l=wt(n.topLevel,t&&S(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return mt(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,y(e.incoming,c),y(e.outgoing,c),e.children;a[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return z(this,n),this},Lm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Lm.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,h=!1;r&&r.parent===n&&(h=!0),y(s,(function(e){o.moveShape(e,t,c[e.id]&&!h&&n,{recurse:!1,layout:!1})})),y(a,(function(e){var i=!!s[e.source.id],r=!!s[e.target.id];l[e.id]&&i&&r?o.moveConnection(e,t,c[e.id]&&!h&&n):o.layoutConnection(e,{connectionStart:i&&fp(e,e.source,t),connectionEnd:r&&mp(e,e.target,t)})}))},Lm.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},Nm.$inject=["modeling"],Nm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Nm.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)},zm.$inject=["modeling"],zm.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=I(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=kt(o.children,t),Ot(i.children,t,r),z(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(y(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:mp(e,t,n)})})),y(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:fp(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},zm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ot(n.children,t,i),z(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},$m.$inject=["modeling"],$m.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},$m.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Im(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Im(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},$m.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},jm.$inject=["modeling","rules"],jm.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return r.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,h={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,h,o.parent,a),o.host&&i.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),i.moveElements(c,{x:0,y:0},t,a));var p=o.incoming.slice(),d=o.outgoing.slice();y(p,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,dp(e,t,u),a)})),y(d,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,pp(e,t,u),a)}))},jm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},jm.prototype.execute=function(e){},jm.prototype.revert=function(e){},jm.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},jm.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},jm.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Fm.$inject=["modeling"],Fm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Fm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(y(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:dp(e,n,i)})})),y(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:pp(e,n,i)})})))},Fm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Hm.$inject=["modeling"],Hm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,s={};this.moveShapes(i,t),y(r,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return y(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;y(r.concat(o),(function(i){var r=i.source,o=i.target;(Nf(e,r)||Nf(e,o)||Nf(t,r)||Nf(t,o))&&(Nf(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Hm.prototype.execute=function(){},Hm.prototype.revert=function(){},Hm.prototype.moveShapes=function(e,t){var n=this;y(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Hm.prototype.resizeShapes=function(e,t,n){var i=this;y(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:i,y:r+l,width:o,height:s-l};case"s":return{x:i,y:r,width:o,height:s+l};case"w":return{x:i+a,y:r,width:o-a,height:s};case"e":return{x:i,y:r,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Hm.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,s){var a=this,l=r.concat(o);y(e,(function(e){var c=e.source,h=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=Vm(e)).original&&(e.original=Vm(e.original)),e}))}(e),p=qm(n),d={};Qm(l,c)&&Qm(l,h)?(u=E(u,(function(e){return Wm(e,i,n)&&(e[p]=e[p]+t[p]),e.original&&Wm(e.original,i,n)&&(e.original[p]=e.original[p]+t[p]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Qm(l,c)||Qm(l,h))&&(Qm(r,c)?d.connectionStart=fp(e,c,t):Qm(r,h)?d.connectionEnd=mp(e,h,t):Qm(o,c)?d.connectionStart=pp(e,c,s[c.id]):Qm(o,h)&&(d.connectionEnd=dp(e,h,s[h.id])),a._modeling.layoutConnection(e,d))}))},Gm.$inject=["modeling"],Gm.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Xm(n),t.collapsed=!t.collapsed;var i=Um(n,t.collapsed);return[t].concat(i)},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Ym(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Km.$inject=["modeling"],Km.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Zm(i,t),Jm(n,t),t.host=n,t},Km.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Zm(n,t),Jm(i,t,r),t},eg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},eg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},tg.$inject=["eventBus","elementFactory","commandStack"],tg.prototype.getHandlers=function(){return{"shape.append":ym,"shape.create":Em,"shape.delete":Am,"shape.move":zm,"shape.resize":Fm,"shape.replace":jm,"shape.toggleCollapse":Gm,spaceTool:Hm,"label.create":km,"connection.create":bm,"connection.delete":Cm,"connection.move":Dm,"connection.layout":Tm,"connection.updateWaypoints":eg,"connection.reconnect":$m,"elements.create":wm,"elements.move":Nm,"elements.delete":Pm,"elements.distribute":Mm,"elements.align":vm,"element.updateAttachment":Km}},tg.prototype.registerHandlers=function(e){y(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},tg.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},tg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},tg.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,s=n;!0===o?(r=n,s=n.parent):!1===o&&(r=null);var a={shapes:e,delta:t,newParent:s,newHost:r,hints:i};this._commandStack.execute("elements.move",a)},tg.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},tg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},tg.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var s={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",s),s.connection},tg.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,s,a=(r=r||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",l),l.shape},tg.prototype.createElements=function(e,t,n,i,r){c(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},tg.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},tg.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},tg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},tg.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},tg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},tg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},tg.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},tg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},tg.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},tg.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},tg.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},tg.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},tg.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,z(i,{docking:"source"}))},tg.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,z(i,{docking:"target"}))},tg.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},tg.prototype._create=function(e,t){return t instanceof $n?t:this._elementFactory.create(e,t)},tg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ng.$inject=["elementRegistry"],ng.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return x(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,k(i));return ig(n,i),e.oldProperties=o,e.changed=r,r},ng.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ig(n,t),i},ng.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Er(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Er(t,"bpmn:DataObjectReference")&&Or(t).dataObjectRef===e}))}(e,t):[]};var rg="default",og="id",sg="di",ag={width:0,height:0};function lg(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}function cg(e,t){return og in e&&e[og]!==t[og]}function hg(e,t){var n=e.businessObject,i=Sr(e);y(t,(function(e,t){t!==sg?n.set(t,e):i&&function(e,t){y(t,(function(t,n){e.set(n,t)}))}(i,e)}))}lg.$inject=["elementRegistry","moddle","modeling","textRenderer"],lg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,s=function(e){var t=z({},e);return ug.forEach((function(n){n in e&&(t[n]=Or(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=k(t),i=e.businessObject,r=Sr(e);return x(n,(function(e,n){return e[n]=n!==sg?i.get(n):function(e,t){return x(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,k(t.di)),e}),{})}(t,s);return cg(s,o)&&(r.unclaim(o[og]),i.updateId(t,s[og]),r.claim(s[og],o)),rg in s&&(s[rg]&&n.push(i.get(s[rg].id)),o[rg]&&n.push(i.get(o[rg].id))),hg(t,s),e.oldProperties=a,e.changed=n,n},lg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Or(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,ag)}},lg.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return hg(t,i),cg(n,r)&&(s.unclaim(n[og]),o.updateId(t,i[og]),s.claim(i[og],r)),e.changed};var ug=["default"];function pg(e,t){this._canvas=e,this._modeling=t}function dg(e,t){this._modeling=e,this._spaceTool=t}function fg(e){this._modeling=e}function mg(e,t){this._modeling=e,this._spaceTool=t}pg.$inject=["canvas","modeling"],pg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=Sr(r);return t.setRootElement(n),t.removeRootElement(r),Ot(s.rootElements,i),i.$parent=s,kt(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},pg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=Sr(n);return t.setRootElement(r),t.removeRootElement(n),kt(s.rootElements,i),i.$parent=null,Ot(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},dg.$inject=["modeling","spaceTool"],dg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Au(i),s=o===i,a=s?i:i.parent,l=Pu(a),c=qr(i);if(c?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!l.length){var h=c?{x:i.x+Su,y:i.y,width:i.width-Su,height:i.height}:{x:i.x,y:i.y+Su,width:i.width,height:i.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},h,a)}var u,p,d,f,m,g=[];mt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===i?[]:v(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,d=(p=i.y)+10,f="n",m="y"):"left"===r?(u=-120,d=(p=i.x)+10,f="w",m="x"):"bottom"===r?(u=120,d=(p=i.y+i.height)-10,f="s",m="y"):"right"===r&&(u=120,d=(p=i.x+i.width)-10,f="e",m="x");var y=t.calculateAdjustments(g,m,u,d),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,b,f,d);var x=c?{x:i.x+(s?Su:0),y:p-("top"===r?120:0),width:i.width-(s?Su:0),height:120}:{x:p-("left"===r?120:0),y:i.y+(s?Su:0),width:120,height:i.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},x,a)},fg.$inject=["modeling"],fg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Pu(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var s,a,l,c,h=qr(n),u=h?n.height:n.width,p=Math.round(u/i);for(c=0;c<i;c++)s=c===i-1?u-p*c:p,a=h?{x:n.x+Su,y:n.y+c*p,width:n.width-Su,height:s}:{x:n.x+c*p,y:n.y+Su,width:s,height:n.height-Su},c<o?t.resizeShape(r[c],a):(l={type:"bpmn:Lane",isHorizontal:h},t.createShape(l,a,n))},mg.$inject=["modeling","spaceTool"],mg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},mg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Mu(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},mg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=vn(e),c=bu(vn(t),l),h=Au(e),u=[],p=[];mt(h,(function(e){return u.push(e),(Er(e,"bpmn:Lane")||Er(e,"bpmn:Participant"))&&p.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,i=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),r=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},r)),(c.left||c.right)&&(n=c.right||c.left,i=e.x+(c.right?e.width:0)+(c.right?-10:100),r=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(p,"x",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},r))};var gg="flowNodeRef",vg="lanes";function yg(e){this._elementRegistry=e}function bg(e){this._moddle=e}yg.$inject=["elementRegistry"],yg.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},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=Au(e);return r[t.id]||(r[t.id]=Cu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=vn(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Au(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return Er(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(vg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(gg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},yg.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(vg);e.remove.forEach((function(e){kt(n,e),kt(e.get(gg),t)})),e.add.forEach((function(e){Ot(n,e),Ot(e.get(gg),t)}))})),[]},yg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(vg);e.add.forEach((function(e){kt(n,e),kt(e.get(gg),t)})),e.remove.forEach((function(e){Ot(n,e),Ot(e.get(gg),t)}))})),[]},bg.$inject=["moddle"],bg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.claim(n,i):t.unclaim(n),[]},bg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.unclaim(n):t.claim(n,i),[]};var xg={fill:void 0,stroke:void 0};function wg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(d(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}`)}}}wg.$inject=["commandStack"],wg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xg,i=this,r={};"fill"in n&&z(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(r,{"border-color":this._normalizeColor(n.stroke)}),y(t,(function(e){var t=dn(e)?I(r,["border-color"]):r,n=Sr(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),fn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!kr(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var _g={width:0,height:0};function Eg(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t){var n=e.businessObject,i=eo(n);if(i)if("categoryValueRef"===i){if(!n[i])return e;n[i].value=t}else n[i]=t}(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!fn(n)&&Yr(n)&&!Kr(n)&&!kg(r)){var o=Jr(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i,di:n.di})}},this.execute=function(e){return e.oldLabel=to(e.element),i(e.element,e.newLabel)},this.revert=function(e){return i(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(r)||Er(r,"bpmn:TextAnnotation"))if(fn(r)&&kg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=to(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,_g)}}}function kg(e){return!e||!e.trim()}function Og(e,t,n,i){tg.call(this,e,t,n),this._bpmnRules=i}function Sg(){}Eg.$inject=["modeling","textRenderer","bpmnFactory"],e(Og,tg),Og.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Og.prototype.getHandlers=function(){var e=tg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ng,e["element.updateProperties"]=lg,e["canvas.updateRoot"]=pg,e["lane.add"]=dg,e["lane.resize"]=mg,e["lane.split"]=fg,e["lane.updateRefs"]=yg,e["id.updateClaim"]=bg,e["element.setColor"]=wg,e["element.updateLabel"]=Eg,e},Og.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Og.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},Og.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Og.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Og.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Og.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Og.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Og.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Og.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Og.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Og.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Og.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Og.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Sg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var Cg=20,Pg=5,Ag=Math.round,Mg=20,Rg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Tg(e,t,n){var i,r,o,s=wn(t,e,Pg),a=n.split(":")[0],l=Ag((t.x-e.x)/2+e.x),c=Ag((t.y-e.y)/2+e.y),h=(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),p=!1,d=!1;return h?(i=u?{x:l,y:e.y}:{x:e.x,y:c},r=u?"h:h":"v:v"):(p=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),r=u?"h:v":"v:h",p?u?(d=c===e.y,i={x:e.x+Cg*(/l/.test(a)?-1:1),y:d?c+Cg:c}):i={x:(d=l===e.x)?l+Cg:l,y:e.y+Cg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:Bg(e,i,r).concat(i),directions:r,turnNextDirections:d}}function Dg(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(Ig(n)){var i=function(e,t,n){return Tg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Tg(t,e,Dg(n));return{waypoints:i.waypoints.slice().reverse(),directions:Dg(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=Ag((t.x-e.x)/2+e.x),r=Ag((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Lg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=wn(e,t,Rg[o]||0),a=function(e,t){if(Ig(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),i=i||xn(t);var l=a.split(":"),c=jg(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 i=Bg(e,t,n);return i.unshift(e),i.push(t),Fg(i)}(c,jg(i,t,l[1],s),a)}function Ng(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=xn(e),i=xn(t)),r=r||[],s=-1!==(o=z({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=wn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===r.preserveDocking?zg(o,i,e)?(a[o]=i[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:i.x,y:i.y}]):null:zg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y,original:{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y}}]):null}(e,t,n,i,o),s||(s=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=$g(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&$g(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Lg(e,t,n,i,o))))}function zg(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 $g(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var i=e[n-1];return i&&Ct(t,i)<3}))}(i))return null;var r,o=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(Mt(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),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(Tt(e[i],t,Mg)||Tt(e[i],n,Mg))return e.slice(i);return e}(s,e,t),r!==s&&(s=$g(e,t,n,r)),s&&Mt(s)?null:s}function Ig(e){return e&&/t|r|b|l/.test(e)}function jg(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Fg(e){return e.reduce((function(t,n,i){return Pt(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Hg=-10,Vg=40,qg={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},Wg={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},Qg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Gg={top:"t",right:"r",bottom:"b",left:"l"};function Xg(e){this._elementRegistry=e}function Ug(e,t){return Er(t,"bpmn:Participant")?"source":Er(e,"bpmn:Participant")?"target":Jg(t)?"source":Jg(e)||Er(t,"bpmn:Event")?"target":Er(e,"bpmn:Event")?"source":null}function Yg(e){return Jg(e)?"target":"source"}function Kg(e,t){return e?e.original||e:xn(t)}function Zg(e,t){return Er(t,"bpmn:Activity")&&Er(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Jg(e){return Er(e,"bpmn:SubProcess")&&Vr(e)}function ev(e,t){return e===t}function tv(e){var t=/right|left/.exec(e);return t&&t[0]}function nv(e){var t=/top|bottom/.exec(e);return t&&t[0]}function iv(e,t){return Qg[e]===t}function rv(e){return"right"===e||"left"===e}function ov(e,t,n){var i=t.waypoints,r=i&&i.length&&wn(i[0],e);return"top"===r?n.loop.fromTop:"right"===r?n.loop.fromRight:"left"===r?n.loop.fromLeft:n.loop.fromBottom}function sv(e,t,n,i){var r,o,s,a,l=xn(e),c=xn(t),h=(a=(s=e).host,wn(xn(s),a,Hg)),u=ev(e.host,t),p=-1!==["top","right","bottom","left"].indexOf(h),d=wn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,i,r,o){var s,a=t?e:o.isHorizontal?nv(e):tv(e),l=Gg[a];s=t?rv(e)?av("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:av("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(h,p,e,t,n,i):(r=function(e,t,n,i){if(n)return Gg[e];var r=nv(e),o=tv(e),s=nv(t),a=tv(t);if(i){if(ev(r,s)||iv(o,a))return Gg[r]}else if(ev(o,a)||iv(r,s))return Gg[o];return Gg[i?o:r]}(h,d,p,i.isHorizontal),o=function(e,t,n,i){if(n)return rv(e)?function(e,t){var n=tv(e),i=Qg[n];return-1!==t.indexOf(i)}(e,t)||ev(e,t)?"h":"v":function(e,t){var n=nv(e),i=Qg[n];return-1!==t.indexOf(i)}(e,t)||ev(e,t)?"v":"h";return i?ev(nv(e),nv(t))?"h":"v":ev(tv(e),tv(t))?"v":"h"}(h,d,p,i.isHorizontal),[r+":"+o])}function av(e,t,n,i){var r=Vg;return!(lv(e,i,n,r)||lv(e,i,{x:n.x+n.width,y:n.y+n.height},r)||lv(e,i,xn(t),r))}function lv(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cv(e){return z({original:e.point.original||e.point},e.actual)}function hv(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Xg,Sg),Xg.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=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=Kg(s&&s[0],r)),l||(l=Kg(s&&s[s.length-1],o)),(Er(e,"bpmn:Association")||Er(e,"bpmn:DataAssociation"))&&s&&!Zg(r,o))return[].concat([a],s.slice(1,-1),[l]);var h=uc(r,c)?qg:Wg;return Er(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Ug(e,t)}}(r,o,h):(Er(e,"bpmn:SequenceFlow")||Zg(r,o))&&(n=r===o?{preferredLayouts:ov(r,e,h)}:Er(r,"bpmn:BoundaryEvent")?{preferredLayouts:sv(r,o,l,h)}:Jg(r)||Jg(o)?{preferredLayouts:h.subProcess,preserveDocking:Yg(r)}:Er(r,"bpmn:Gateway")?{preferredLayouts:h.fromGateway}:Er(o,"bpmn:Gateway")?{preferredLayouts:h.toGateway}:{preferredLayouts:h.default}),n&&(i=Fg(Ng(r,o,a,l,s,n=z(n,t)))),i||[a,l]},Xg.$inject=["elementRegistry"],hv.$inject=["elementRegistry","graphicsFactory"],hv.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(cv(i)),o.push(cv(r)),o},hv.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},hv.prototype._getIntersection=function(e,t,n){return _n(this._getShapePath(e),this._getConnectionPath(t),n)},hv.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hv.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hv.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var uv={__init__:["modeling","bpmnUpdater"],__depends__:[fd,Xd,Yd,Jd,Df,im,am,um,Rs,Ho,tm],bpmnFactory:["type",pm],bpmnUpdater:["type",dm],elementFactory:["type",mm],modeling:["type",Og],layouter:["type",Xg],connectionDocking:["type",hv]};const pv=Math.round;function dv(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}dv.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,h=o.createShape(z({type:t},n)),u=s.fire("autoPlace",{source:e,shape:h});if(!u)return;z(h,{x:u.x-pv(h.width/2),y:u.y-pv(h.height/2)});const p=c.allowed("connection.create",{source:e,target:h,hints:{targetParent:e.parent}});let d=null;p&&(d=o.createConnection(p),d.waypoints=a.layoutConnection(d,{source:e,target:h}),d.waypoints=r.getCroppedWaypoints(d,e,h)),i.create({created:[h,d].filter((e=>!l(e)))})},dv.prototype.cleanUp=function(){this._complexPreview.cleanUp()},dv.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var fv={__depends__:[mc,qh,uv],__init__:["appendPreview"],appendPreview:["type",dv]},mv=Math.min,gv=Math.max;function vv(e){e.preventDefault()}function yv(e){e.stopPropagation()}function bv(e){this.container=e.container,this.parent=me('<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=N(this.autoResize,this),this.handlePaste=N(this.handlePaste,this)}function xv(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new bv({container:t.getContainer(),keyHandler:N(this._handleKey,this),resizeHandler:N(this._handleResize,this)})}bv.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=I(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=I(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&z(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,le.bind(o,"keydown",this.keyHandler),le.bind(o,"mousedown",yv),le.bind(o,"paste",this.handlePaste),i.autoResize&&le.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},bv.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},bv.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)},bv.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,s=r.endContainer,a=r.startOffset,l=r.endOffset,c=r.commonAncestorContainer,h=(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,i=a+e.length}else if(o===this.content&&s===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,h[a]),n=p,i=p.textContent.length}else{var d=h.indexOf(o),f=h.indexOf(s);h.forEach((function(t,n){n===d?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>d&&n<=f&&be(t)})),n=o,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},bv.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},bv.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,h;n=this.resizeHandle=me('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){vv(n),yv(n);var u=mv(gv(c+n.clientX-a,i),o),p=mv(gv(h+n.clientY-l,r),s);t.style.width=u+"px",t.style.height=p+"px",e.resizeHandler({width:c,height:h,dx:n.clientX-a,dy:n.clientY-l})},p=function(e){vv(e),yv(e),le.unbind(document,"mousemove",u,!1),le.unbind(document,"mouseup",p,!1)};le.bind(n,"mousedown",(function(e){vv(e),yv(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,h=n.height,le.bind(document,"mousemove",u),le.bind(document,"mouseup",p)}))}z(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)},bv.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",yv),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},bv.prototype.getValue=function(){return this.content.innerText.trim()},bv.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},bv.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},xv.$inject=["eventBus","canvas"],xv.prototype.registerProvider=function(e){this._providers.push(e)},xv.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},xv.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},xv.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},xv.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},xv.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},xv.prototype.getValue=function(){return this._textbox.getValue()},xv.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())},xv.prototype._handleResize=function(e){this._fire("resize",e)},xv.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 wv={__depends__:[ks],__init__:["directEditing"],directEditing:["type",xv]};var _v=[{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"}}],Ev=[{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"}}],kv=[{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"}}],Ov=[{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"}}],Sv=[{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"}}],Cv=[{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}}],Pv=[{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}}],Av=[{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}}],Mv=Av,Rv=[{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}}],Tv=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Dv=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Bv=[{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}}],Lv=[{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}}],Nv=[{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"}],zv=[{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}}],$v={"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"}}]},Iv={"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 jv(e,t,n,i,r,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}jv.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],jv.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},jv.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,i=this._rules,r=[],o=[];if(c(e)||!i.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Or(s),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Vr(s);return!(r&&o&&a&&l)});return Er(n,"bpmn:DataObjectReference")?this._createEntries(e,Tv):Er(n,"bpmn:DataStoreReference")&&!Er(e.parent,"bpmn:Collaboration")?this._createEntries(e,Dv):(Er(n,"bpmn:Event")&&!Er(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,r=$v[t]||[],!Qr(n.$parent)&&Er(n.$parent,"bpmn:SubProcess")&&(r=v(r,(function(e){return"bpmn:StartEvent"!==e.target.type})))),Er(n,"bpmn:StartEvent")&&!Er(n.$parent,"bpmn:SubProcess")?(o=v(_v.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:Participant")?(o=v(zv,(function(t){return Vr(e)!==t.target.isExpanded})),this._createEntries(e,o)):Er(n,"bpmn:StartEvent")&&Qr(n.$parent)?(o=v(Lv.concat(r),(function(e){var t=!1!==e.target.isInterrupting,i=n.isInterrupting===t;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):Er(n,"bpmn:StartEvent")&&!Qr(n.$parent)&&Er(n.$parent,"bpmn:SubProcess")?(o=v(Ev.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:EndEvent")?(o=v(Ov.concat(r),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Er(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):Er(n,"bpmn:BoundaryEvent")?(o=v(Bv,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!Er(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,r=n.cancelActivity==i;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):Er(n,"bpmn:IntermediateCatchEvent")||Er(n,"bpmn:IntermediateThrowEvent")?(o=v(kv.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:Gateway")?(o=v(Sv,a),this._createEntries(e,o)):Er(n,"bpmn:Transaction")?(o=v(Av,a),this._createEntries(e,o)):Qr(n)&&Vr(e)?(o=v(Mv,a),this._createEntries(e,o)):Er(n,"bpmn:AdHocSubProcess")&&Vr(e)?(o=v(Pv,a),this._createEntries(e,o)):Er(n,"bpmn:SubProcess")&&Vr(e)?(o=v(Cv,a),this._createEntries(e,o)):Er(n,"bpmn:SubProcess")&&!Vr(e)?(o=v(Rv,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):Er(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Nv):Er(n,"bpmn:FlowNode")?(o=v(Rv,a),this._createEntries(e,o)):{})},jv.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Er(e,"bpmn:Activity")&&!Qr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Er(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Er(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),_p(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},jv.prototype._createEntries=function(e,t){var n={},i=this;return y(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},jv.prototype._createSequenceFlowEntries=function(e,t){var n=Or(e),i={},r=this._modeling,o=this._moddle,s=this;return y(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Er(n.sourceRef,"bpmn:ExclusiveGateway")||Er(n.sourceRef,"bpmn:InclusiveGateway")||Er(n.sourceRef,"bpmn:ComplexGateway")||Er(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&Er(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:Er(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(Er(n.sourceRef,"bpmn:ExclusiveGateway")||Er(n.sourceRef,"bpmn:InclusiveGateway")||Er(n.sourceRef,"bpmn:ComplexGateway")||Er(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},jv.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},jv.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var r=e.businessObject.get("loopCharacteristics");r&&Er(r,i.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,r,{isSequential:i.options.isSequential}):(r=t._moddle.create(i.options.loopCharacteristics,{isSequential:i.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:r}))}}var r,o,s,a=Or(e).loopCharacteristics;return a&&(r=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:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},jv.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},jv.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},jv.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Or(e),i=this,r=Ep(e),o=Er(e,"bpmn:BoundaryEvent")?Iv["intermediate-event-non-interrupting"]:Iv["start-event-non-interrupting"],s=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){i._modeling.updateProperties(e,{[r]:!!s})}}}};var Fv={__depends__:[Wl,Df,mc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",jv]};function Hv(e,t,n,i,r,o,s,a,l,c,h,u,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=h,this._translate=u,this._eventBus=n,this._appendPreview=p,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(bs(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){p.cleanUp()}))}function Vv(e,t,n){var i=e.$instanceOf(t),r=!1;return y(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}Hv.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Hv.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Hv.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?w(e,(e=>t.includes(e))):t},Hv.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,h={};if("label"===e.type)return this._isDeleteAllowed([e])&&z(h,f()),h;var u=e.businessObject;function p(e,t){r.start(e,t)}function d(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:d}}}}function m(e,t,n,r){function s(t,n){var s=i.createShape(z({type:e},r));o.start(t,s,{source:n})}var l=a?function(t,n){var o=i.createShape(z({type:e},r));a.append(n,o)}:s,h=a?function(t,n){return c.create(n,e,r),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:h}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(kr(u,["bpmn:Lane","bpmn:Participant"])&&Vr(e)){var v=Pu(e);z(h,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&((qr(e)?e.height>=120:e.width>=120)&&z(h,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(qr(e)?e.height>=180:e.width>=180)&&z(h,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),z(h,{"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 Er(u,"bpmn:FlowNode")&&(Er(u,"bpmn:EventBasedGateway")?z(h,{"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"})}):Vv(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(h,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):Er(u,"bpmn:EndEvent")||u.isForCompensation||Vv(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Qr(u)||z(h,{"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")||z(h,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var i=z(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",i,{title:l("Change element"),width:300,search:!0})}}}}),Er(u,"bpmn:SequenceFlow")&&z(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),kr(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(h,{"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:p,dragstart:p}}}),Er(u,"bpmn:TextAnnotation")&&z(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:p,dragstart:p}}}),kr(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:p,dragstart:p}}}),Er(u,"bpmn:Group")&&z(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&z(h,f()),h};var qv={__depends__:[fv,wv,Aa,Rs,Bh,pf,Fv],__init__:["contextPadProvider"],contextPadProvider:["type",Hv]},Wv={horizontal:["x","width"],vertical:["y","height"]};function Qv(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:[]}))}Qv.$inject=["modeling","rules"],Qv.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Qv.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Qv.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(y(t,(function(e){r=e(r,n,i)})),r):e},Qv.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return y(A(e,i),(function(e,o){var s,a=n._findRange(e,i,r),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},Qv.prototype._setOrientation=function(e){var t=Wv[e];this._axis=t[0],this._dimension=t[1]},Qv.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)},Qv.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Gv={__init__:["distributeElements"],distributeElements:["type",Qv]};function Xv(e){Yl.call(this,e)}Xv.$inject=["eventBus"],e(Xv,Yl),Xv.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=pt(t=v(t,(function(e){var t=kr(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 Uv={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 Yv(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Yv.$inject=["popupMenu","distributeElements","translate","rules"],Yv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Yv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Yv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Uv.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Uv.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var Kv={__depends__:[Wl,Gv],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xv],distributeElementsMenuProvider:["type",Yv]},Zv="is not a registered action";function Jv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function ey(e,t){return new Error(e+" "+t)}Jv.$inject=["eventBus","injector"],Jv.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),h=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=a.allowed("elements.delete",{elements:e});!1!==r&&(t=c(r)?r:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),h&&this.register("moveSelection",(function(e){h.moveSelection(e.direction,e.accelerated)}))},Jv.prototype.trigger=function(e,t){if(!this._actions[e])throw ey(e,Zv);return this._actions[e](t)},Jv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);y(e,(function(e,t){n._registerAction(t,e)}))},Jv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ey(e,"is already registered");this._actions[e]=t},Jv.prototype.unregister=function(e){if(!this.isRegistered(e))throw ey(e,Zv);this._actions[e]=void 0},Jv.prototype.getActions=function(){return Object.keys(this._actions)},Jv.prototype.isRegistered=function(e){return!!this._actions[e]};var ty={__init__:["editorActions"],editorActions:["type",Jv]};function ny(e){e.invoke(Jv,this)}e(ny,Jv),ny.$inject=["injector"],ny.prototype._registerDefaultActions=function(e){Jv.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),h=e.get("directEditing",!1),u=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),i&&l&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&l.trigger(t,n)})),i&&c&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=v(t,(function(e){return!Er(e,"bpmn:Lane")})),c.trigger(n,r))})),i&&p&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&p.setColor(t,e)})),i&&h&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&h.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&p&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();e=vt(i=Er(r,"bpmn:Collaboration")?n.filter((function(e){return Er(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!Er(e.parent,"bpmn:SubProcess")}))),p.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&d&&this._registerAction("replaceElement",(function(e){d.triggerEntry("replace","click",e)}))};var iy={__depends__:[ty],editorActions:["type",ny]};function ry(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;kr(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}ry.$inject=["eventBus"];var oy=10;function sy(e,t,n){return n||(n="round"),Math[n](e/t)*t}function ay(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!r.active||n&&zs(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,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(!r)return a[t];n.get(r.id)||(ly(t)?a[t]+=r[t]+r.width/2:a[t]+=r[t]+r.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=r.width/2:/right/.test(s)&&(a[t]+=r.width/2):/top/.test(s)?a[t]-=r.height/2:/bottom/.test(s)&&(a[t]+=r.height/2);return a[t]}(t,n,e);o&&(i.offset=o);var s=function(e,t){var n=e.context,i=n.createConstraints,r=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;i&&(ly(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;l&&(ly(t)?hy(a)?s.x.max=l.left:s.x.min=l.right:cy(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(ly(t)?hy(a)?s.x.min=c.left:s.x.max=c.right:cy(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&z(i,s),_h(t,n)||r.snapEvent(t,n,i)}))}}))}function ly(e){return"x"===e}function cy(e){return-1!==e.indexOf("n")}function hy(e){return-1!==e.indexOf("w")}function uy(e,t){Vo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;d(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}ay.prototype.snapEvent=function(e,t,n){Eh(e,t,this.snapValue(e[t],n))},ay.prototype.getGridSpacing=function(){return oy},ay.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=sy(e+=r,oy),t&&t.min&&u(n=t.min)&&(n=sy(n+r,oy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=sy(i+r,oy,"floor"),e=Math.min(e,i)),e-=r},ay.prototype.isActive=function(){return this.active},ay.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},ay.prototype.toggleActive=function(){this.setActive(!this.active)},ay.$inject=["elementRegistry","eventBus","config.gridSnapping"],uy.$inject=["eventBus","gridSnapping","modeling"],e(uy,Vo),uy.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},uy.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},uy.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),z(e,o),e},uy.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),z(e,o),e};function py(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.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))}))}py.$inject=["eventBus","gridSnapping"];var dy={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",uy],gridSnappingSpaceToolBehavior:["type",py]}],__init__:["gridSnapping"],gridSnapping:["type",ay]};function fy(e,t,n){e.on("autoPlace",2e3,(function(e){var i=e.source,r=xn(i),o=e.shape,s=pc(i,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==r[e]&&(s[e]>r[e]?n.min=s[e]:n.max=s[e],Er(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}))}fy.$inject=["eventBus","gridSnapping","elementRegistry"];function my(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();Er(r,"bpmn:Participant")&&Er(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))}))}my.$inject=["canvas","eventBus","gridSnapping"];function gy(e,t,n){Vo.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,r=t.connection,o=t.hints||{},s=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(r,i.snapMiddleSegments(s))}))}function vy(e,t,n){var i=Mt(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=z({},t,r),n=z({},n,r)),[t,n]}gy.$inject=["eventBus","gridSnapping","modeling"],e(gy,Vo),gy.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=vy(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var yy={__depends__:[dy,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fy],gridSnappingParticipantBehavior:["type",my],gridSnappingLayoutConnectionBehavior:["type",gy]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ry]};function by(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return Er(t,"bpmn:Lane")?n._createParticipantHit(t,i):Er(t,"bpmn:Participant")?Vr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):Er(t,"bpmn:SubProcess")?Vr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}by.$inject=["eventBus","interactionEvents"],by.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},by.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=qr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},by.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 xy={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",by]};function wy(e){e.invoke(Qs,this)}e(wy,Qs),wy.$inject=["injector"],wy.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Qs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0})),n("spaceTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["r","R"],i)?(t.trigger("replaceElement",i),!0):void 0}))};var _y={__depends__:[Gs],__init__:["keyboardBindings"],keyboardBindings:["type",wy]},Ey={moveSpeed:1,moveSpeedAccelerated:10},ky="left",Oy="right",Sy="down",Cy={ArrowLeft:ky,Left:ky,ArrowUp:"up",Up:"up",ArrowRight:Oy,Right:Oy,ArrowDown:Sy,Down:Sy},Py={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 Ay(e,t,n,i,r){var o=this;this._config=z({},Ey,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=Cy[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Py[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Ay.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var My={__depends__:[Gs,Rs],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Ay]};function Ry(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return yn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("left",n,t)})}(n,s),e.canExecute=r.canResize(e)}e.on("resize.start",(function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:vn(i)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,i=e.canExecute,r=e.newBounds;if(i){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,r=mn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function Ty(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function Dy(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"}Ry.prototype.canResize=function(e){var t=this._rules,n=I(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ry.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=z({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Ty(t,r),"resize",{autoActivate:!0,cursor:Dy(r),data:{shape:t,context:i}})},Ry.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=vn(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},s=i?vn(i):o;return yn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:gu(o.bottom,s.bottom),right:gu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Eu(t,e.childrenBoxPadding))},Ry.$inject=["eventBus","rules","modeling","dragging"];var By="djs-resizing",Ly="resize-not-ok";function Ny(e,t,n){e.on("resize.move",500,(function(e){var i,r,o,s;i=e.context,r=i.shape,o=i.newBounds,(s=i.frame)||(s=i.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,By)),o.width>5&&ke(s,{x:o.x,width:o.width}),o.height>5&&ke(s,{y:o.y,height:o.height}),i.canExecute?Se(s).remove(Ly):Se(s).add(Ly)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&qe(n.frame),t.removeMarker(i,By)}))}Ny.$inject=["eventBus","canvas","previewSupport"];var zy=-6,$y="djs-resizer",Iy=["n","w","s","e","nw","ne","se","sw"];function jy(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&y(t,N(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}jy.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){ys(t)&&i.activate(t,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},jy.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=zy);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=zy);return t}(i),s=De("g");Se(s).add($y),Se(s).add($y+"-"+e.id),Se(s).add($y+"-"+i),xe(r,s);var a=De("rect");ke(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add($y+"-visual"),xe(s,a);var l=De("rect");return ke(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add($y+"-hit"),xe(s,l),Yn(s,t,n),s},jy.prototype.createResizer=function(e,t){var n=Ty(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},jy.prototype.addResizer=function(e){var t=this;!dn(e)&&this._resize.canResize({shape:e})&&y(Iy,(function(n){t.createResizer(e,n)}))},jy.prototype.removeResizers=function(){Pe(this._getResizersParent())},jy.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},jy.$inject=["eventBus","canvas","selection","resize"];var Fy={__depends__:[Tc,Cc,Fh],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ry],resizePreview:["type",Ny],resizeHandles:["type",jy]};function Hy(e,t,n,i,r,o,s){function a(e,t){(t||kr(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Vy(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=s,i.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(){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Vy(e){return Er(e,"bpmn:SubProcess")&&!Vr(e)}Hy.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Hy.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};z(n,this.getEditingBBox(e));var i={},r=n.style||{};return z(r,{backgroundColor:null,border:null}),(kr(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Vy(e))&&z(i,{centerVertically:!0}),Yr(e)&&(z(i,{autoResize:!0}),z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Er(e,"bpmn:TextAnnotation")&&(z(i,{resizable:!0,autoResize:!0}),z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),z(n,{options:i,style:r}),n}},Hy.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,s={x:i.x,y:i.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),h=c.fontSize*a,u=c.lineHeight,p=l.fontSize*a,d=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Er(e,"bpmn:Lane")||function(e){return Er(e,"bpmn:Participant")&&Vr(e)}(e)){var m=qr(e);z(s,m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o-30*a/2}:{width:i.width,height:30*a}),z(f,{fontSize:p+"px",lineHeight:d,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 Er(e,"bpmn:Participant")&&!Vr(e)}(e)){var g=qr(e);z(s,g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r-i.height/2,y:o-i.width/2}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(kr(e,["bpmn:Task","bpmn:CallActivity"])||Vy(e))&&(z(s,{width:i.width,height:i.height}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return Er(e,"bpmn:SubProcess")&&Vr(e)}(e)&&(z(s,{width:i.width,x:i.x}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var v=90*a,y=7*a,b=4*a;if(n.labelTarget&&(z(s,{width:v,height:i.height+y+b,x:r-v/2,y:i.y-y}),z(f,{fontSize:h+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:b+"px"})),Yr(n)&&!Kr(n)&&!fn(n)){var x=Jr(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),_=h+y+b;z(s,{width:v,height:_,x:w.x-v/2,y:w.y-_/2}),z(f,{fontSize:h+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:b+"px"})}return Er(e,"bpmn:TextAnnotation")&&(z(s,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),z(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:s,style:f}},Hy.prototype.update=function(e,t,n,i){var r,o,s;Er(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var qy="djs-element-hidden",Wy="djs-label-hidden";function Qy(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Er(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=De("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),h=s.path=De("path");ke(h,{d:c,strokeWidth:2,stroke:Gy(i)}),xe(o,h),xe(a,o),Kn(o,i.x,i.y)}Er(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,qy):(Er(i,"bpmn:Task")||Er(i,"bpmn:CallActivity")||Er(i,"bpmn:SubProcess")||Er(i,"bpmn:Participant")||Er(i,"bpmn:Lane"))&&t.addMarker(i,Wy)})),e.on("directEditing.resize",(function(e){if(Er(i,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(i.height/r.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:a,position:{mx:0,my:0}});ke(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,qy),t.removeMarker(i,Wy)),i=void 0,r=void 0,o&&(qe(o),o=void 0)}))}function Gy(e,t){return Sr(e).get("stroke")||t||"black"}Qy.$inject=["eventBus","canvas","pathMap"];var Xy={__depends__:[Ho,Fy,wv],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Hy],labelEditingPreview:["type",Qy]},Uy=new Bo("tt");function Yy(e,t){e.style.display=!1===t?"none":""}var Ky="djs-tooltip",Zy="."+Ky;function Jy(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Uy,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),X(i=me('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;ue.bind(this._tooltipRoot,Zy,"mousedown",(function(e){e.stopPropagation()})),ue.bind(this._tooltipRoot,Zy,"mouseover",(function(e){r.trigger("mouseover",e)})),ue.bind(this._tooltipRoot,Zy,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}Jy.$inject=["eventBus","canvas"],Jy.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=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Jy.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(U(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Jy.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Jy.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Jy.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Jy.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Jy.prototype.show=function(){Yy(this._tooltipRoot)},Jy.prototype.hide=function(){Yy(this._tooltipRoot,!1)},Jy.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Jy.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=me(i)),X(t=me('<div data-tooltip-id="'+n+'" class="'+Ky+'">'),{position:"absolute"}),t.appendChild(i),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Jy.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){X(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Jy.prototype._updateTooltipVisibilty=function(e){y(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Yy(i,r))}))},Jy.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 eb={__init__:["tooltips"],tooltips:["type",Jy]};function tb(e,t,n){e.on(["shape.move.rejected","create.rejected"],(function(e){var i,r,o=e.context,s=o.shape;Er(o.target,"bpmn:Collaboration")&&Er(s,"bpmn:FlowNode")&&(i=e,r=n("flow elements must be children of pools/participants"),t.add({position:{x:i.x+5,y:i.y+5},type:"error",timeout:2e3,html:"<div>"+r+"</div>"}))}))}tb.$inject=["eventBus","tooltips","translate"];var nb={__depends__:[eb],__init__:["modelingFeedback"],modelingFeedback:["type",tb]};function ib(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=De("rect");return ke(t,z({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=i.getOutline(t)||r()),i.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=r()),i.updateConnectionOutline(o,t)}))}ib.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&y(i,(function(i){n=n||i.updateOutline(t,e)})),n||ke(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ib.prototype.updateConnectionOutline=function(e,t){var n=vt(t);ke(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ib.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},ib.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ib.prototype.getOutline=function(e){var t;return y(this._getProviders(),(function(n){p(n.getOutline)&&(t=t||n.getOutline(e))})),t},ib.$inject=["eventBus","styles","elementRegistry"];function rb(e,t,n){this._canvas=t;var i=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;i._updateMultiSelectionOutline(t)}))}rb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Pe(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),r=De("rect");ke(r,z({rx:3},i)),Se(r).add("djs-selection-outline"),xe(t,r)}},rb.$inject=["eventBus","canvas","selection"];var ob={__depends__:[Rs],__init__:["outline","multiSelectionOutline"],outline:["type",ib],multiSelectionOutline:["type",rb]},sb=Math.round;function ab(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,r){if(h(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+sb(e.width/2),y:e.y+sb(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=S(e,"id");return v(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),z(t,{shapes:r,validatedShapes:r,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,i=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=o(i,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,s=t.shapes;if(!1===r)return!1;i.x=sb(i.x),i.y=sb(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(ys(e)){var t=ds(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}ab.$inject=["eventBus","dragging","modeling","selection","rules"];var lb="djs-dragging",cb="drop-ok",hb="drop-not-ok",ub="new-parent",pb="attach-ok";function db(e,t,n,r){function o(e){var t=function(e){var t=v(e,(function(t){return!dn(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=gt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),i=t.concat(n);return[...new Set(i)]}function a(e,n){[pb,cb,hb,ub].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,h=l.allDraggedElements,u=o(c);if(!l.dragGroup){var p=De("g");ke(p,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),p),l.dragGroup=p}u.forEach((function(e){r.addDragger(e,l.dragGroup)})),y(h=h?i([h,s(c)]):s(c),(function(e){t.addMarker(e,lb)})),l.allDraggedElements=h,l.differentParents=1!==(a=S(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,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,pb):t.canExecute&&r&&i.id!==r.id?a(i,ub):a(i,t.canExecute?cb:hb)),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,i=n.allDraggedElements,r=n.dragGroup;y(i,(function(e){t.removeMarker(e,lb)})),r&&qe(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,lb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}db.$inject=["eventBus","canvas","styles","previewSupport"];var fb={__depends__:[ks,Rs,ob,Tc,Cc,Fh],__init__:["move","movePreview"],move:["type",ab],movePreview:["type",db]},mb=".djs-palette-toggle",gb=".entry",vb=mb+", "+gb,yb="djs-palette-",bb="open",xb="two-column";function wb(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 _b(e,t){var n=t.getPaletteEntries();return p(n)?n(e):(y(n,(function(t,n){e[n]=t})),e)}wb.$inject=["eventBus","canvas"],wb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},wb.prototype.getEntries=function(){return this._getProviders().reduce(_b,{})},wb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},wb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=me(wb.HTML_MARKUP);n.appendChild(i),K(n).add(yb+"shown"),ue.bind(i,vb,"click",(function(t){if(ge(t.delegateTarget,mb))return e.toggle();e.trigger("click",t)})),le.bind(i,"mousedown",(function(e){e.stopPropagation()})),ue.bind(i,gb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},wb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},wb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=K(i),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(xb,t),s.toggle(yb+xb,t),"open"in e&&(o.toggle(bb,e.open),s.toggle(yb+bb,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},wb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();J(e),y(t,(function(t,n){var i=t.group||"default",r=ve("[data-group="+Go(i)+"]",e);r||(U(r=me('<div class="group"></div>'),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=me(o);if(r.appendChild(s),!t.separator&&(U(s,"data-action",n),t.title&&U(s,"title",t.title),t.className&&function(e,t){var n=K(e);(c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=me("<img>");U(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},wb.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=U(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},wb.prototype.triggerEntry=function(e,t,n,i){var r,o;if((r=this._entries[e])&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(p(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},wb.prototype._layoutChanged=function(){this._toggleState({})},wb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},wb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},wb.prototype.open=function(){this._toggleState({open:!0})},wb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},wb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},wb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),y(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=K(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},wb.prototype.isOpen=function(){return K(this._container).has(bb)},wb.prototype._getParentContainer=function(){return this._canvas.getContainer()},wb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Eb={__init__:["palette"],palette:["type",wb]},kb="crosshair";function Ob(e,t,n,i,r,o,s){this._selection=r,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();ke(n=e.frame=De("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(i,n)},c=function(e){var t=e.frame,n=e.bbox;ke(t,{x:n.x,y:n.y,width:n.width,height:n.height})},h=function(e){e.frame&&qe(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=Sb(e),r=i.filter((function(e){return e})),o=xs(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Sb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Sb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;h(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Sb(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}}Ob.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Ob.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:kb,data:{context:{}}})},Ob.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:kb,data:{context:{}},keepSelection:!0})},Ob.prototype.select=function(e,t,n=[]){var i=yt(e,t);this._selection.select([...n,...O(i)])},Ob.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ob.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Cb={__depends__:[Lf,ff],__init__:["lassoTool"],lassoTool:["type",Ob]},Pb=1500,Ab="grab";function Mb(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var s=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Pb,(function(e){if(bs(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Pb,(function(e){if(Rb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Pb,(function(e){Rb(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!bs(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Rb(e){return $s("Space",e)}Mb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ab,data:{context:n||{}}})},Mb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ab,data:{context:{reactivate:n}}})},Mb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Tb={__depends__:[Lf,ff],__init__:["handTool"],handTool:["type",Mb]},Db="connect-ok",Bb="connect-not-ok";function Lb(e,t,n,i,r,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,r=t.canStartConnect=a.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Db:Bb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Db:Bb)})),e.on(["global-connect.ended"],(function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(a.canStartConnect(i))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,i,r)})),!1}))}Lb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Lb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Lb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Lb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Lb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Bh,Tc,Cc,Lf,ff],globalConnect:["type",Lb]};function zb(e,t,n,i,r,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}zb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,i,r,o,s){function a(i){var r=n.createShape(z({type:e},s));t.start(i,r)}return{group:i,className:r,title:o,action:{dragstart:a,click:a}}}function c(e){var i=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:i});t.start(e,[i,r],{hints:{autoSelect:[i]}})}function h(e){t.start(e,n.createParticipantShape())}return z(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){r.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){i.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:h,click:h}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var $b={__depends__:[Eb,pf,tm,Cb,Tb,Nb,Po],__init__:["paletteProvider"],paletteProvider:["type",zb]};function Ib(e,t,n,i,r){Vo.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){y(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);z(a,{x:l.x,y:l.y});var c=n.createShape(a);i.addShape(c,l.parent);var h=ve('[data-element-id="'+Go(l.id)+'"]',e.dragGroup);h&&ke(h,{display:"none"});var u=r.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,i.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;y(t,(function(n,i){var r=ve('[data-element-id="'+Go(i)+'"]',e.dragGroup);r&&ke(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}Ib.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ib,Vo);var jb={__depends__:[Fh],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ib]},Fb=40,Hb=20,Vb=10,qb=20,Wb=["x","y"],Qb=Math.abs;function Gb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,i=t.start,r=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Wb.forEach((function(i){var r=Yb(i,t);e[i]<t[i]+n?Eh(e,i,t[i]+n):e[i]>t[i]+r-n&&Eh(e,i,t[i]+r-n)}))}(e,r,function(e){return Er(e,"bpmn:Task")?Vb:Hb}(r)),r&&function(e,t){return _(t,(function(t){return Ub(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=wh(i),kr(r,["bpmn:Event","bpmn:Gateway"])&&Xb(e,wh(r)),kr(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=wh(t);Wb.forEach((function(i){(function(e,t,n){return e[n]>t[n]+qb&&e[n]<t[n]+Yb(n,t)-qb})(e,t,i)&&Eh(e,i,n[i])}))}(e,r),Er(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,i=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var r=wh(n),o=wn(r,i,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,i=e[t];Qb(i-r[t])<Fb&&(n=i>r[t]?r[t]+Fb:r[t]-Fb,Eh(e,t,n))}))}(e)):Ub(n,"bpmn:MessageFlow")?(Er(i,"bpmn:Event")&&(t.connectionStart=wh(i)),Er(r,"bpmn:Event")&&Xb(e,wh(r))):t.connectionStart=t.initialConnectionStart)}))}function Xb(e,t){Eh(e,"x",t.x),Eh(e,"y",t.y)}function Ub(e,t){return e&&e.type===t}function Yb(e,t){return"x"===e?t.width:t.height}function Kb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Zb(){this._snapValues={}}Gb.$inject=["eventBus"],Kb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Kb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Kb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Kb.prototype.getSnapLocations=function(){return this._snapLocations},Kb.prototype.setSnapLocations=function(e){this._snapLocations=e},Kb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Zb).initDefaults(this._defaultSnaps),n},Zb.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)},Zb.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],vh(r-e)<=n)return r}(e[n],r[n],i)},Zb.prototype.initDefaults=function(e){var t=this;y(e||{},(function(e,n){y(e,(function(e){t.add(n,e)}))}))};var Jb=1250;function ex(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Jb,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!_h(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=i.addSnapTargetPoints(a,r,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}ex.$inject=["elementRegistry","eventBus","snapping"],ex.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Kb);var s=(t=n.get(r.id)?wh(r,e):{x:e.x+wh(r).x,y:e.y+wh(r).y}).x-r.width/2,a=t.y-r.height/2,l=t.x+r.width/2,c=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(r)||(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},ex.prototype.addSnapTargetPoints=function(e,t,n){return y(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",wh(n));else if(dn(n)){if(n.waypoints.length<3)return;y(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",wh(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",wh(t)),e):e},ex.prototype.getSnapTargets=function(e,t){return kh(t).filter((function(e){return!e.hidden}))};function tx(e,t){t.invoke(ex,this),e.on(["create.move","create.end"],1500,nx),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,i=t.target;n&&("attach"===n||n.attach)&&!_h(e)&&function(e,t){var n,i=vn(t),r=md(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(r)?Eh(e,"y",i.top-n.y):/bottom/.test(r)&&Eh(e,"y",i.bottom-n.y);/left/.test(r)?Eh(e,"x",i.left-n.x):/right/.test(r)&&Eh(e,"x",i.right-n.x)}(e,i)}))}function nx(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&Eh(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Eh(e,"y",e.y)}}function ix(e,t){return-1!==e.indexOf(t)}function rx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(tx,ex),tx.$inject=["eventBus","injector"],tx.prototype.initSnap=function(e){var t=ex.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return y(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",rx(r,i,e))})),y(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",rx(r,i,e))})),Er(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},tx.prototype.addSnapTargetPoints=function(e,t,n){ex.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);y(i,(function(n){var i;(function(e){if(Er(e,"bpmn:SubProcess")&&Vr(e))return!0;return Er(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return Er(e,i)}))))&&(e.add("top-left",bh(n)),e.add("bottom-right",xh(n)))}));var r=this._elementRegistry;return y(t.incoming,(function(n){if(r.get(t.id)){ix(i,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),y(t.outgoing,(function(n){if(r.get(t.id)){ix(i,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Er(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},tx.prototype.getSnapTargets=function(e,t){return ex.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Er(e,"bpmn:Lane")}))};function ox(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||_h(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,r,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Eh(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Eh(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function sx(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}ox.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Kb);var o=sx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ox.prototype.addSnapTargetPoints=function(e,t,n,i){return y(this.getSnapTargets(t,n),(function(t){e.add("corner",xh(t)),e.add("corner",bh(t))})),e.add("corner",sx(t,i)),e},ox.$inject=["eventBus","snapping"],ox.prototype.getSnapTargets=function(e,t){return kh(t).filter((function(t){return!(n=t,i=e,n.host===i||dn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,i}))};function ax(e){this._canvas=e,this._asyncHide=L(N(this.hide,this),1e3)}ax.$inject=["canvas"],ax.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:_h(e,"x"),y:_h(e,"y")};y(i,(function(i){var o=n.getSnapOrigin(i),s={x:e.x+o.x,y:e.y+o.y};if(y(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(s,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),y(["x","y"],(function(t){var n=r[t];h(n)&&Eh(e,t,n.originValue)}))},ax.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return ke(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?ke(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):ke(n,{display:"none"})}}},ax.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},ax.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},ax.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},ax.prototype.hide=function(){y(this._snapLines,(function(e){e.update()}))};var lx={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ex],resizeSnapping:["type",ox],snapping:["type",ax]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Gb],createMoveSnapping:["type",tx]};function cx(e,t,n,i){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=i,this._container=this._getBoxHtml(),this._searchInput=ve(cx.INPUT_SELECTOR,this._container),this._resultsContainer=ve(cx.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 hx(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n=Uo(e.value||e.matched||e.normal),i=e.match||e.matched;t+=i?'<b class="'+cx.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),r=me(n);r.innerHTML=i,e.appendChild(r)}cx.$inject=["canvas","eventBus","selection","translate"],cx.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:ue.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,cx.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,cx.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,cx.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,cx.INPUT_SELECTOR,"keydown",(function(e){$s("ArrowUp",e)&&e.preventDefault(),$s("ArrowDown",e)&&e.preventDefault()})),t(this._container,cx.INPUT_SELECTOR,"keyup",(function(t){if($s("Escape",t))return e.close();if($s("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return $s("ArrowUp",t)?e._scrollToDirection(!0):$s("ArrowDown",t)?e._scrollToDirection():void($s(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},cx.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ue.unbind(e.el,e.type,e.listener)}))},cx.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,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=ve(cx.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},cx.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},cx.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},cx.prototype._clearResults=function(){J(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},cx.prototype._getCurrentResult=function(){return ve(cx.RESULT_SELECTED_SELECTOR,this._resultsContainer)},cx.prototype._createResultNode=function(e,t){var n=me(cx.RESULT_HTML);return e.primaryTokens.length>0&&hx(n,e.primaryTokens,cx.RESULT_PRIMARY_HTML),hx(n,e.secondaryTokens,cx.RESULT_SECONDARY_HTML),U(n,cx.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},cx.prototype.registerProvider=function(e){this._searchProvider=e},cx.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"))},cx.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())},cx.prototype.toggle=function(){this.isOpen()?this.close():this.open()},cx.prototype.isOpen=function(){return this._open},cx.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(cx.RESULT_SELECTED_CLASS);var n=U(e,cx.RESULT_ID_ATTRIBUTE),i=this._results[n].element;K(e).add(cx.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},cx.prototype._select=function(e){var t=U(e,cx.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)},cx.prototype._getBoxHtml=function(){const e=me(cx.BOX_HTML),t=ve(cx.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},cx.CONTAINER_SELECTOR=".djs-search-container",cx.INPUT_SELECTOR=".djs-search-input input",cx.RESULTS_CONTAINER_SELECTOR=".djs-search-results",cx.RESULT_SELECTOR=".djs-search-result",cx.RESULT_SELECTED_CLASS="djs-search-result-selected",cx.RESULT_SELECTED_SELECTOR="."+cx.RESULT_SELECTED_CLASS,cx.RESULT_ID_ATTRIBUTE="data-result-id",cx.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",cx.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>',cx.RESULT_HTML='<div class="djs-search-result"></div>',cx.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',cx.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var ux={__depends__:[Po,jo,Rs],searchPad:["type",cx]};function px(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}function dx(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}px.$inject=["elementRegistry","searchPad","canvas","search"],px.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!fn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:to(e),id:e.id}))),e,{keys:["label","id"]}).map(dx)};var fx={__depends__:[ux,ql],__init__:["bpmnSearch"],bpmnSearch:["type",px]};const mx={width:36,height:50},gx={width:50,height:50};function vx(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function yx(e,t){this._styles=t,e.registerProvider(this)}function bx(e,t){var n;return"bpmn:DataObjectReference"===t?n=mx:"bpmn:DataStoreReference"===t&&(n=gx),e.width===n.width&&e.height===n.height}yx.$inject=["outline","styles"],yx.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return Er(e,"bpmn:Gateway")?(z((n=De("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ke(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):kr(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?ke(n=De("rect"),z({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Er(e,"bpmn:EndEvent")?ke(n=De("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Er(e,"bpmn:Event")?ke(n=De("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Er(e,"bpmn:DataObjectReference")&&bx(e,"bpmn:DataObjectReference")?n=vx("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):Er(e,"bpmn:DataStoreReference")&&bx(e,"bpmn:DataStoreReference")&&(n=vx("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},yx.prototype.updateOutline=function(e,t){if(!fn(e))return kr(e,["bpmn:SubProcess","bpmn:Group"])?(ke(t,{width:e.width+10,height:e.height+10}),!0):!!kr(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var xx={__depends__:[ob],__init__:["outlineProvider"],outlineProvider:["type",yx]};function wx(e){Hr.call(this,e)}e(wx,Hr),wx.Viewer=Ts,wx.NavigatedViewer=pa,wx.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>')},wx.prototype._interactionModules=[Ys,oa,ua],wx.prototype._modelingModules=[Zl,mc,Mc,xc,Ph,Bh,Nh,qv,kf,pf,Kv,iy,yy,xy,_y,My,Xy,uv,nb,fb,$b,jb,Fy,lx,fx,xx],wx.prototype._modules=[].concat(Ts.prototype._modules,wx.prototype._interactionModules,wx.prototype._modelingModules);var _x=new Bo,Ex={min:.2,max:4};function kx(e,t,n,i,r){var o=this;function s(e){o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Sx(Ox({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=Bx(t);o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var r=Ox({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=i.viewbox(),h=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}}(r,a),u=o._viewportDom.getBoundingClientRect(),p={x:n.x-u.left+1,y:n.y-u.top+1};z(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:h,offsetViewportDom:p,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),le.bind(document,"mousemove",l),le.bind(document,"mouseup",c)}}function l(e){var t=Bx(e);if(o._state.isDragging){o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;z(o._viewportDom.style,{top:t.y-n.y-r.top+"px",left:t.x-n.x-r.left+"px"});var s=Rx(r,{top:t.y-n.y-r.top,left:t.x-n.x-r.left,width:i.width,height:i.height});z(o._overlay.style,{clipPath:s});var a=Ox({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sx({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=Bx(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),z(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),le.unbind(document,"mousemove",l),le.unbind(document,"mouseup",c))}this._canvas=i,this._elementRegistry=r,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=_x.next(),this._init(),this.toggle(e&&e.open||!1),le.bind(this._viewportDom,"mousedown",a(!1)),le.bind(this._svg,"mousedown",a(!0)),le.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Ax(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,r,s,a,l,c=0===e.deltaMode?.02:.32,h=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Mx(e.deltaY)*-c;if(o._state.zoomDelta+=h,Math.abs(o._state.zoomDelta)>.1){var u=h>0?1:-1,p=Math.log(i.zoom())/Math.log(10),d=(r=Ex,s=20,a=Math.log(r.min)/Math.log(10),l=Math.log(r.max)/Math.log(10),(Math.abs(a)+Math.abs(l))/s),f=Math.round(p/d)*d;f+=d*u;var m=Math.pow(10,f);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ex,m),g),o._state.zoomDelta=0;var g=Ox({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sx(g,o._canvas),o._update()}}})),le.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 Ox(e,t,n){var i=t.getBoundingClientRect(),r=function(e,t){var n=e.width/e.height,i=z({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t);z(i,{y:i.y-(r-i.height)/2,height:r})}else if(n<t){var o=i.height*t;z(i,{x:i.x-(o-i.width)/2,width:o})}return i}(n,i.width/i.height);return{x:Cx(e.x,0,i.width,r.x,r.x+r.width),y:Cx(e.y,0,i.height,r.y,r.y+r.height)}}function Sx(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function Cx(e,t,n,i,r){return(e-t)*(r-i)/(n-t)+i}function Px(e,t,n){var i=function(e){var t=ve(".children",e);t||xe(e,t=De("g",{class:"children"}));return t}(t),r=[].slice.call(i.childNodes)[n];r?t.insertBefore(e,r.nextSibling):t.appendChild(e)}function Ax(e){return 0===e.width&&0===e.height}kx.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],kx.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 i=this._map=document.createElement("div");K(i).add("map"),t.appendChild(i);var r=this._svg=De("svg");ke(r,{width:"100%",height:"100%"}),xe(i,r),xe(r,this._elementsGroup=De("g"));var o=this._viewportGroup=De("g");xe(r,o);var s=this._viewport=De("rect");Se(s).add("viewport"),xe(o,s),le.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)},kx.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Dx(e)){var i,r,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(i=t.x-a/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-l/2,s=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,s=t.height),i-=50,r-=50,o+=100,s+=100,this._lastViewbox={x:i,y:r,width:o,height:s},ke(this._svg,{viewBox:i+", "+r+", "+o+", "+s}),ke(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),h=this._viewport.getBoundingClientRect(),u={top:h.top-c.top,left:h.left-c.left,width:h.width,height:h.height};z(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var p=Rx(c,u);z(this._overlay.style,{clipPath:p})}},kx.prototype.open=function(){z(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};U(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},kx.prototype.close=function(){z(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};U(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},kx.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},kx.prototype.isOpen=function(){return this._state.isOpen},kx.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)}},kx.prototype._updateElementId=function(e,t){try{var n=ve("#"+Go(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},kx.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},kx.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,i,r,o=this._createElement(e),s=ve("#"+Go(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 i=[].slice.call(n.childNodes),r=-1;return i.forEach((function(t,n){ve(".djs-element",t)===e&&(r=n)})),r}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Px(o,s,a):Px(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(i=e.x,r=e.y,s&&(i-=(n=e.parent).x,r-=n.y),ke(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),ke(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},kx.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&qe(t)},kx.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Un(n))){var i=function(e){return ye("[id]",e).forEach((function(e){e.remove()})),e}(Ae(t));return ke(i,{id:this._prefixId(e.id)}),i}},kx.prototype._clear=function(){Pe(this._elementsGroup)},kx.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Mx=Math.sign||function(e){return e>=0?1:-1};function Rx(e,t){return"polygon("+[Tx(t.left,t.top),Tx(t.left+t.width,t.top),Tx(t.left+t.width,t.top+t.height),Tx(t.left,t.top+t.height),Tx(t.left,e.height),Tx(e.width,e.height),Tx(e.width,0),Tx(0,0),Tx(0,e.height),Tx(t.left,e.height)].join(", ")+")"}function Tx(e,t){return e+"px "+t+"px"}function Dx(e){return w(e,(function(e){return h(e)?Dx(e):u(e)&&isFinite(e)}))}function Bx(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Lx={__init__:["minimap"],minimap:["type",kx]},Nx=1e5,zx=1e5;function $x(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)}))}$x.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=De("defs"),xe(this._canvas._svg,e));var t=this._pattern=De("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());ke(t,{id:n,width:oy,height:oy,patternUnits:"userSpaceOnUse"});var i=this._circle=De("circle");ke(i,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,i),xe(e,t),ke(this._gfx=De("rect"),{x:-Nx/2,y:-zx/2,width:Nx,height:zx,fill:`url(#${n})`})},$x.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=xn(e);ke(this._gfx,{x:-Nx/2+sy(t.x,oy),y:-zx/2+sy(t.y,oy)})},$x.prototype.isVisible=function(){return this._visible},$x.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Pe(t),this._visible=e}},$x.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},$x.$inject=["canvas","eventBus"];var Ix={__init__:["grid"],grid:["type",$x]};function jx(e,t){var n,i,r=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Vx("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Vx("path",{class:Hx("border"),d:Fx(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:r,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Vx("path",{d:Fx(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Hx("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(i=Vx("text",{x:-40,y:-10,fill:o,class:Hx("label")})).textContent="(0, 0)",xe(n,i)}function Fx(e){return e.join(" ")}function Hx(e){return"djs-origin-"+e}function Vx(e,t){var n=De(e);return ke(n,t),n}jx.$inject=["config.origin","canvas"];var qx={__init__:[jx]},Wx={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Qx(e,t,n,i,r,o){function s(e,n){var i=n.offset,r=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+i[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)<r?0:s})),o}function a(){var t=r.viewbox().inner,n=r.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||i.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,i=r.viewbox().scale;r.scroll({dx:e*n.x*i,dy:e*n.y*i})}))}}var c,h,p;e=function(e){var t=z({},Wx,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),i.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),h=n,((p=c&&c._eventBus)||h).on("saveXML.start",1250,a),p&&h.on("diagram.destroy",(function(){p.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Qx.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Gx={__init__:["alignToOrigin"],alignToOrigin:["type",Qx]};function Xx(e){function t(e){if(!e.labelTarget){var t=Or(e);Er(t,"bpmn:Participant")&&(t=t.processRef),Er(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)}))}))}Xx.$inject=["eventBus"];var Ux,Yx,Kx,Zx,Jx,ew,tw,nw,iw={__init__:[Xx]},rw={},ow=[],sw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,aw=Array.isArray;function lw(e,t){for(var n in t)e[n]=t[n];return e}function cw(e){var t=e.parentNode;t&&t.removeChild(e)}function hw(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ux.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 uw(e,s,i,r,null)}function uw(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Kx:r,__i:-1,__u:0};return null==r&&null!=Yx.vnode&&Yx.vnode(o),o}function pw(e){return e.children}function dw(e,t){this.props=e,this.context=t}function fw(e,t){if(null==t)return e.__?fw(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?fw(e):null}function mw(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 mw(e)}}function gw(e){(!e.__d&&(e.__d=!0)&&Zx.push(e)&&!vw.__r++||Jx!==Yx.debounceRendering)&&((Jx=Yx.debounceRendering)||ew)(vw)}function vw(){var e,t,n,i,r,o,s,a,l;for(Zx.sort(tw);e=Zx.shift();)e.__d&&(t=Zx.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=lw({},r)).__v=r.__v+1,Yx.vnode&&Yx.vnode(i),Sw(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?fw(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Cw(a,i,l),i.__e!=o&&mw(i)),Zx.length>t&&Zx.sort(tw));vw.__r=0}function yw(e,t,n,i,r,o,s,a,l,c,h){var u,p,d,f,m,g=i&&i.__k||ow,v=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,h=c,u=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?uw(null,r,null,null,r):aw(r)?uw(pw,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?uw(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=ww(r,n,s=i+u,h),r.__i=a,o=null,-1!==a&&(h--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?u++:a>s?h>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==i+u&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=fw(o)),Mw(o,o,!1),n[i]=null,h--);if(h)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=fw(o)),Mw(o,o))}(n,t,g),l=n.__d,u=0;u<v;u++)null!=(d=n.__k[u])&&"boolean"!=typeof d&&"function"!=typeof d&&(p=-1===d.__i?rw:g[d.__i]||rw,d.__i=u,Sw(e,d,p,r,o,s,a,l,c,h),f=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Aw(p.ref,null,d),h.push(d.ref,d.__c||f,d)),null==m&&null!=f&&(m=f),65536&d.__u||p.__k===d.__k?l=bw(d,l,e):"function"==typeof d.type&&void 0!==d.__d?l=d.__d:f&&(l=f.nextSibling),d.__d=void 0,d.__u&=-196609);n.__d=l,n.__e=m}function bw(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=bw(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function xw(e,t){return t=t||[],null==e||"boolean"==typeof e||(aw(e)?e.some((function(e){xw(e,t)})):t.push(e)),t}function ww(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function _w(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||sw.test(t)?n:n+"px"}function Ew(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||_w(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||_w(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?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?Ow:kw,o)):e.removeEventListener(t,o?Ow:kw,o);else{if(r)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 kw(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Yx.event?Yx.event(e):e)}function Ow(e){return this.l[e.type+!0](Yx.event?Yx.event(e):e)}function Sw(e,t,n,i,r,o,s,a,l,c){var h,u,p,d,f,m,g,v,y,b,x,w,_,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]),(h=Yx.__b)&&h(t);e:if("function"==typeof O)try{if(v=t.props,y=(h=O.contextType)&&i[h.__c],b=h?y?y.props.value:h.__:i,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(v,b):(t.__c=u=new dw(v,b),u.constructor=O,u.render=Rw),y&&y.sub(u),u.props=v,u.state||(u.state={}),u.context=b,u.__n=i,p=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=lw({},u.__s)),lw(u.__s,O.getDerivedStateFromProps(v,u.__s))),d=u.props,f=u.state,u.__v=t,p)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&v!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(v,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(v,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=v,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(v,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,m)}))}if(u.context=b,u.props=v,u.__P=e,u.__e=!1,w=Yx.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,w&&w(t),h=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,w&&w(t),h=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(i=lw(lw({},i),u.getChildContext())),p||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(d,f)),yw(e,aw(k=null!=h&&h.type===pw&&null==h.key?h.props.children:h)?k:[k],t,n,i,r,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),Yx.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Pw(n.__e,t,n,i,r,o,s,l,c);(h=Yx.diffed)&&h(t)}function Cw(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Aw(n[i],n[++i],n[++i]);Yx.__c&&Yx.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Yx.__e(e,t.__v)}}))}function Pw(e,t,n,i,r,o,s,a,l){var c,h,u,p,d,f,m,g=n.props,v=t.props,y=t.type;if("svg"===y&&(r=!0),null!=o)for(c=0;c<o.length;c++)if((d=o[c])&&"setAttribute"in d==!!y&&(y?d.localName===y:3===d.nodeType)){e=d,o[c]=null;break}if(null==e){if(null===y)return document.createTextNode(v);e=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,v.is&&v),o=null,a=!1}if(null===y)g===v||a&&e.data===v||(e.data=v);else{if(o=o&&Ux.call(e.childNodes),g=n.props||rw,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(d=e.attributes[c]).name]=d.value;for(c in g)d=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=d:"key"===c||c in v||Ew(e,c,null,d,r));for(c in v)d=v[c],"children"==c?p=d:"dangerouslySetInnerHTML"==c?h=d:"value"==c?f=d:"checked"==c?m=d:"key"===c||a&&"function"!=typeof d||g[c]===d||Ew(e,c,d,g[c],r);if(h)a||u&&(h.__html===u.__html||h.__html===e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(u&&(e.innerHTML=""),yw(e,aw(p)?p:[p],t,n,i,r&&"foreignObject"!==y,o,s,o?o[0]:n.__k&&fw(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&cw(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===y&&!f||"option"===y&&f!==g[c])&&Ew(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Ew(e,c,m,g[c],!1))}return e}function Aw(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Yx.__e(e,n)}}function Mw(e,t,n){var i,r;if(Yx.unmount&&Yx.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Aw(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Yx.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Mw(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||cw(e.__e),e.__=e.__e=e.__d=void 0}function Rw(e,t,n){return this.constructor(e,n)}function Tw(e,t,n){var i,r,o,s;Yx.__&&Yx.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Sw(t,e=(!i&&n||t).__k=hw(pw,null,[e]),r||rw,rw,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Ux.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Cw(o,e,s)}function Dw(e,t){var n={__c:t="__cC"+nw++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,gw(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}Ux=ow.slice,Yx={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Kx=0,dw.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=lw({},this.state),"function"==typeof e&&(e=e(lw({},n),this.props)),e&&lw(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),gw(this))},dw.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gw(this))},dw.prototype.render=pw,Zx=[],ew="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,tw=function(e,t){return e.__v.__b-t.__v.__b},vw.__r=0,nw=0;var Bw,Lw,Nw,zw,$w=0,Iw=[],jw=[],Fw=Yx.__b,Hw=Yx.__r,Vw=Yx.diffed,qw=Yx.__c,Ww=Yx.unmount;function Qw(e,t){Yx.__h&&Yx.__h(Lw,e,$w||t),$w=0;var n=Lw.__H||(Lw.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:jw}),n.__[e]}function Gw(e){return $w=1,Xw(a_,e)}function Xw(e,t,n){var i=Qw(Bw++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):a_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Lw,!Lw.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};Lw.u=!0;var o=Lw.shouldComponentUpdate,s=Lw.componentWillUpdate;Lw.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},Lw.shouldComponentUpdate=r}return i.__N||i.__}function Uw(e,t){var n=Qw(Bw++,3);!Yx.__s&&s_(n.__H,t)&&(n.__=e,n.i=t,Lw.__H.__h.push(n))}function Yw(e,t){var n=Qw(Bw++,4);!Yx.__s&&s_(n.__H,t)&&(n.__=e,n.i=t,Lw.__h.push(n))}function Kw(e){return $w=5,Zw((function(){return{current:e}}),[])}function Zw(e,t){var n=Qw(Bw++,7);return s_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jw(e,t){return $w=8,Zw((function(){return e}),t)}function e_(e){var t=Lw.context[e.__c],n=Qw(Bw++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Lw)),t.props.value):e.__}function t_(){for(var e;e=Iw.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(r_),e.__H.__h.forEach(o_),e.__H.__h=[]}catch(t){e.__H.__h=[],Yx.__e(t,e.__v)}}Yx.__b=function(e){Lw=null,Fw&&Fw(e)},Yx.__r=function(e){Hw&&Hw(e),Bw=0;var t=(Lw=e.__c).__H;t&&(Nw===Lw?(t.__h=[],Lw.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=jw,e.__N=e.i=void 0}))):(t.__h.forEach(r_),t.__h.forEach(o_),t.__h=[],Bw=0)),Nw=Lw},Yx.diffed=function(e){Vw&&Vw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Iw.push(t)&&zw===Yx.requestAnimationFrame||((zw=Yx.requestAnimationFrame)||i_)(t_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==jw&&(e.__=e.__V),e.i=void 0,e.__V=jw}))),Nw=Lw=null},Yx.__c=function(e,t){t.some((function(e){try{e.__h.forEach(r_),e.__h=e.__h.filter((function(e){return!e.__||o_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Yx.__e(n,e.__v)}})),qw&&qw(e,t)},Yx.unmount=function(e){Ww&&Ww(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{r_(e)}catch(e){t=e}})),n.__H=void 0,t&&Yx.__e(t,n.__v))};var n_="function"==typeof requestAnimationFrame;function i_(e){var t,n=function(){clearTimeout(i),n_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);n_&&(t=requestAnimationFrame(n))}function r_(e){var t=Lw,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Lw=t}function o_(e){var t=Lw;e.__c=e.__(),Lw=t}function s_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function a_(e,t){return"function"==typeof t?t(e):t}function l_(e,t){for(var n in t)e[n]=t[n];return e}function c_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function h_(e){this.props=e}(h_.prototype=new dw).isPureReactComponent=!0,h_.prototype.shouldComponentUpdate=function(e,t){return c_(this.props,e)||c_(this.state,t)};var u_=Yx.__b;Yx.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u_&&u_(e)};var p_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function d_(e){function t(t){var n=l_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=p_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var f_=Yx.__e;Yx.__e=function(e,t,n,i){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);f_(e,t,n,i)};var m_=Yx.unmount;function g_(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=l_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return g_(e,t,n)}))),e}function v_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return v_(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 y_(){this.__u=0,this.t=null,this.__b=null}function b_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function x_(){this.u=null,this.o=null}Yx.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),m_&&m_(e)},(y_.prototype=new dw).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var r=b_(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=v_(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},y_.prototype.componentWillUnmount=function(){this.t=[]},y_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=g_(this.__b,n,i.__O=i.__P)}this.__b=null}var r=t.__a&&hw(pw,null,e.fallback);return r&&(r.__u&=-33),[hw(pw,null,t.__a?null:e.children),r]};var w_=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 __(e){return this.getChildContext=function(){return e.context},e.children}function E_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Tw(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)}}),Tw(hw(__,{context:t.context},e.__v),t.l)}function k_(e,t){var n=hw(E_,{__v:e,i:t});return n.containerInfo=t,n}(x_.prototype=new dw).__a=function(e){var t=this,n=b_(t.__v),i=t.o.get(e);return i[0]++,function(r){var o=function(){t.props.revealOrder?(i.push(r),w_(t,e,i)):r()};n?n(o):o()}},x_.prototype.render=function(e){this.u=null,this.o=new Map;var t=xw(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},x_.prototype.componentDidUpdate=x_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){w_(e,n,t)}))};var O_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,S_=/^(?: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]/,C_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,P_=/[A-Z0-9]/g,A_="undefined"!=typeof document,M_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};dw.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(dw.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var R_=Yx.event;function T_(){}function D_(){return this.cancelBubble}function B_(){return this.defaultPrevented}Yx.event=function(e){return R_&&(e=R_(e)),e.persist=T_,e.isPropagationStopped=D_,e.isDefaultPrevented=B_,e.nativeEvent=e};var L_={enumerable:!1,configurable:!0,get:function(){return this.class}},N_=Yx.vnode;Yx.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var r in t){var o=t[r];if(!("value"===r&&"defaultValue"in t&&null==o||A_&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===o?o="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||M_(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":C_.test(r)?r=s:-1===n.indexOf("-")&&S_.test(r)?r=r.replace(P_,"-$&").toLowerCase():null===o&&(o=void 0):s=r="oninput","oninput"===s&&i[r=s]&&(r="oninputCapture"),i[r]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=xw(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=xw(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",L_)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=O_,N_&&N_(e)};var z_=Yx.__r;Yx.__r=function(e){z_&&z_(e),e.__c};var $_=Yx.diffed;Yx.diffed=function(e){$_&&$_(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 I_=hw,j_=0;function F_(e,t,n,i,r,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:--j_,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Yx.vnode&&Yx.vnode(c),c}function H_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V_,q_={exports:{}};
|
|
171
|
+
`,this._current.container)},Il.prototype.open=function(e,t,n,i){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:r,headerEntries:o,emptyPlaceholder:s}=this._getContext(e,t);this._current={position:n,providerId:t,target:e,entries:r,headerEntries:o,emptyPlaceholder:s,container:this._createContainer({provider:t}),options:i},this._emit("open"),this._bindAutoClose(),this._render()},Il.prototype.refresh=function(){if(!this.isOpen())return;const{target:e,providerId:t}=this._current,{entries:n,headerEntries:i,emptyPlaceholder:r}=this._getContext(e,t);this._current={...this._current,entries:n,headerEntries:i,emptyPlaceholder:r},this._emit("refresh"),this._render()},Il.prototype._getContext=function(e,t){const n=this._getProviders(t);if(!n||!n.length)throw new Error("provider for <"+t+"> not found");const i=this._getEntries(e,n),r=this._getHeaderEntries(e,n);return{entries:i,headerEntries:r,emptyPlaceholder:this._getEmptyPlaceholder(n),empty:!(Object.keys(i).length||Object.keys(r).length)}},Il.prototype.close=function(){this.isOpen()&&(this._emit("close"),this.reset(),this._canvas.restoreFocus(),this._current=null)},Il.prototype.reset=function(){const e=this._current.container;tl(null,e),be(e)},Il.prototype._emit=function(e,t){this._eventBus.fire(`popupMenu.${e}`,t)},Il.prototype._onOpened=function(){this._emit("opened")},Il.prototype._onClosed=function(){this._emit("closed")},Il.prototype._createContainer=function(e){var t=this._canvas.getContainer();const n=me(`<div class="djs-popup-parent djs-scrollable" data-popup=${e.provider}></div>`);return t.appendChild(n),n},Il.prototype._bindAutoClose=function(){this._eventBus.once($l,this.close,this)},Il.prototype._unbindAutoClose=function(){this._eventBus.off($l,this.close,this)},Il.prototype._updateScale=function(){var e,t,n=this._canvas.zoom(),i=this._config.scale,r=n;return!0!==i&&(!1===i?(e=1,t=1):(e=i.min,t=i.max),a(e)&&n<e&&(r=e),a(t)&&n>t&&(r=t)),r},Il.prototype._ensureVisible=function(e,t){var n=document.documentElement.getBoundingClientRect(),i=e.getBoundingClientRect(),r={},o=t.x,s=t.y;return t.x+i.width>n.width&&(r.x=!0),t.y+i.height>n.height&&(r.y=!0),r.x&&r.y?(o=t.x-i.width,s=t.y-i.height):r.x?(o=t.x-i.width,s=t.y):r.y&&t.y<i.height?(o=t.x,s=10):r.y&&(o=t.x,s=t.y-i.height),t.y<n.top&&(s=t.y+i.height),{x:o,y:s}},Il.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},Il.prototype.registerProvider=function(e,t,n){n||(n=t,t=1e3),this._eventBus.on("popupMenu.getProviders."+e,t,(function(e){e.providers.push(n)}))},Il.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"popupMenu.getProviders."+e,providers:[]});return this._eventBus.fire(t),t.providers},Il.prototype._getEntries=function(e,t){var n={};return y(t,(function(t){if(t.getPopupMenuEntries){var i=t.getPopupMenuEntries(e);p(i)?n=i(n):y(i,(function(e,t){n[t]=e}))}else y(t.getEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=j(e,["id"])}))})),n},Il.prototype._getHeaderEntries=function(e,t){var n={};return y(t,(function(t){if(t.getPopupMenuHeaderEntries){var i=t.getPopupMenuHeaderEntries(e);p(i)?n=i(n):y(i,(function(e,t){n[t]=e}))}else{if(!t.getHeaderEntries)return;y(t.getHeaderEntries(e),(function(e){var t=e.id;if(!t)throw new Error("entry ID is missing");n[t]=j(e,["id"])}))}})),n},Il.prototype._getEmptyPlaceholder=function(e){const t=e.find((e=>p(e.getEmptyPlaceholder)));return t&&t.getEmptyPlaceholder()},Il.prototype.isOpen=function(){return!!this._current},Il.prototype.trigger=function(e,t,n="click"){if(e.preventDefault(),!t){let n=U(ee(e.delegateTarget||e.target,".entry",!0),"data-id");t={id:n,...this._getEntry(n)}}const i=t.action;if(!1!==this._emit("trigger",{entry:t,event:e}))if(p(i)){if("click"===n)return i(e,t)}else if(i[n])return i[n](e,t)},Il.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 ql={search:["value",function(e,t,n){const{keys:i}=n;if(!(t=t.trim().toLowerCase()))throw new Error("<pattern> must not be empty");const r=t.trim().toLowerCase().split(/\s+/);return e.flatMap((e=>{const t=function(e,t,n){const{matchedWords:i,tokens:r}=n.reduce(((n,i)=>{const r=e[i],{tokens:o,matchedWords:s}=function(e,t){if(!e)return{tokens:[],matchedWords:{}};const n=[],i={},r=t.map(Vl),o=[`(?<all>${r.join("\\s+")})`,...r].join("|"),s=new RegExp(o,"ig");let a,l=0;for(;a=s.exec(e);){const[r]=a,o=a.index,s=a.index+r.length,c=0===o,h=s===e.length,u=!!a.groups.all,p=c||/\s/.test(e.charAt(o-1)),d=h||/\s/.test(e.charAt(s+1));a.index>l&&n.push({value:e.slice(l,a.index),index:l}),n.push({value:r,index:a.index,match:!0,wordStart:p,wordEnd:d,start:c,end:h,all:u});const f=u?t:[r];for(const e of f)i[e.toLowerCase()]=!0;l=a.index+r.length}l<e.length&&n.push({value:e.slice(l),index:l});return{tokens:n,matchedWords:i}}(r,t);return{tokens:{...n.tokens,[i]:o},matchedWords:{...n.matchedWords,...s}}}),{matchedWords:{},tokens:{}});if(Object.keys(i).length!==t.length)return null;return r}(e,r,i);return t?{item:e,tokens:t}:[]})).sort(function(e){return(t,n)=>{for(const i of e){const e=jl(t.tokens[i],n.tokens[i]);if(0!==e)return e;const r=Hl(t.item[i],n.item[i]);if(0!==r)return r}return 0}}(i))}]},Wl={__depends__:[ql],__init__:["popupMenu"],popupMenu:["type",Il]},Ql={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 Gl(e,t,n,i){e.registerProvider(900,this),this._contextPad=e,this._popupMenu=t,this._translate=n,this._canvas=i}Gl.$inject=["contextPad","popupMenu","translate","canvas"],Gl.prototype.getMultiElementContextPadEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Gl.prototype._isAllowed=function(e){return!this._popupMenu.isEmpty(e,"align-elements")},Gl.prototype._getEntries=function(){var e=this;return{"align-elements":{group:"align-elements",title:e._translate("Align elements"),html:`<div class="entry">${Ql.align}</div>`,action:{click:function(t,n){var i=e._getMenuPosition(n);z(i,{cursor:{x:t.x,y:t.y}}),e._popupMenu.open(n,"align-elements",i)}}}}},Gl.prototype._getMenuPosition=function(e){var t=this._contextPad.getPad(e).html.getBoundingClientRect();return{x:t.left,y:t.bottom+5}};var Xl=["left","center","right","top","middle","bottom"];function Ul(e,t,n,i){this._alignElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",this)}function Yl(e){Vo.call(this,e),this.init()}function Kl(e){Yl.call(this,e)}Ul.$inject=["popupMenu","alignElements","translate","rules"],Ul.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Ul.prototype._isAllowed=function(e){return this._rules.allowed("elements.align",{elements:e})},Ul.prototype._getEntries=function(e){var t=this._alignElements,n=this._translate,i=this._popupMenu,r={};return y(Xl,(function(o){r["align-elements-"+o]={group:"align",title:n("Align elements "+o),className:"bjs-align-elements-menu-entry",imageHtml:Ql[o],action:function(){t.trigger(e,o),i.close()}}})),r},Yl.$inject=["eventBus"],e(Yl,Vo),Yl.prototype.addRule=function(e,t,n){var i=this;"string"==typeof e&&(e=[e]),e.forEach((function(e){i.canExecute(e,t,(function(e,t,i){return n(e)}),!0)}))},Yl.prototype.init=function(){},Kl.$inject=["eventBus"],e(Kl,Yl),Kl.prototype.init=function(){this.addRule("elements.align",(function(e){var t=v(e.elements,(function(e){return!(e.waypoints||e.host||e.labelTarget)}));return!((t=pt(t)).length<2)&&t}))};var Zl={__depends__:[ya,Aa,Wl],__init__:["alignElementsContextPadProvider","alignElementsMenuProvider","bpmnAlignElements"],alignElementsContextPadProvider:["type",Gl],alignElementsMenuProvider:["type",Ul],bpmnAlignElements:["type",Kl]},Jl=10,ec=50,tc=250;function nc(e,t,n,i){for(var r;r=rc(e,n,t);)n=i(t,n,r);return n}function ic(e){return function(t,n,i){var r={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;r[o]=l<0?Math.min(i[o]+l-t[a]/2,n[o]-c+l):Math.max(i[o]+i[a]+l+t[a]/2,n[o]+c+l)}})),r}}function rc(e,t,n){var i={x:t.x-n.width/2,y:t.y-n.height/2,width:n.width,height:n.height},r=function(e){var t=oc(e);e.host&&(t=t.concat(oc(e.host)));e.attachers&&(t=t.concat(e.attachers.reduce((function(e,t){return e.concat(oc(t))}),[])));return t}(e);return m(r,(function(e){return e!==n&&"intersect"===wn(e,i,Jl)}))}function oc(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 sc(){return!0}function ac(e,t,n){e.on("autoPlace",100,(function(e){var t=e.shape;return function(e,t,n){n||(n={});var i=n.defaultDistance||ec,r=xn(e),o=vn(e);return{x:o.right+i+t.width/2,y:r.y}}(e.source,t)})),e.on("autoPlace.end",(function(e){n.scrollToElement(e.shape)})),this.append=function(n,i,r){e.fire("autoPlace.start",{source:n,shape:i});var o=e.fire("autoPlace",{source:n,shape:i}),s=t.appendShape(n,i,o,n.parent,r);return e.fire("autoPlace.end",{source:n,shape:s}),s}}function lc(e,t){e.on("autoPlace.end",500,(function(e){t.select(e.shape)}))}ac.$inject=["eventBus","modeling","canvas"],lc.$inject=["eventBus","selection"];var cc={__init__:["autoPlaceSelectionBehavior"],autoPlace:["type",ac],autoPlaceSelectionBehavior:["type",lc]};function hc(e,t){for(d(t)&&(t=[t]);e=e.parent;)if(kr(e,t))return e;return null}function uc(e,t){var n=hc(e,"bpmn:Process");if(n)return!0;var i,r=["bpmn:Participant","bpmn:Lane"];if(n=hc(e,r))return qr(n);if(kr(e,r))return qr(e);for(i=Or(e);i&&!Er(i,"bpmn:Process");i=i.$parent);if(!t)return!0;var o=t.find((function(e){var t=Or(e);return t&&t.get("processRef")===i}));return!o||qr(o)}function pc(e,t,n){var i=uc(e,n);return Er(t,"bpmn:TextAnnotation")?function(e,t,n){var i=vn(e),r=n?{x:i.right+t.width/2,y:i.top-50-t.height/2}:{x:i.right+50+t.width/2,y:i.bottom+t.height/2};dn(e)&&(r=xn(e),n?(r.x+=100,r.y-=50):(r.x+=100,r.y+=50));var o={margin:n?-30:30,minDistance:20},s=n?{y:o}:{x:o};return nc(e,t,r,ic(s))}(e,t,i):kr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])?function(e,t,n){var i=vn(e),r=n?{x:i.right-10+t.width/2,y:i.bottom+40+t.width/2}:{x:i.left-40-t.width/2,y:i.bottom-10+t.height/2},o={margin:30,minDistance:30},s=n?{x:o}:{y:o};return nc(e,t,r,ic(s))}(e,t,i):Er(t,"bpmn:FlowNode")?function(e,t,n){var i=vn(e),r=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||ec,i=t.direction||"e",r=t.filter,o=t.getWeight||function(t){return t.source===e?1:-1},s=t.maxDistance||tc,a=t.reference||"start";function l(e,t){return"n"===i?"start"===a?vn(e).top-vn(t).bottom:"center"===a?vn(e).top-xn(t).y:vn(e).top-vn(t).top:"w"===i?"start"===a?vn(e).left-vn(t).right:"center"===a?vn(e).left-xn(t).x:vn(e).left-vn(t).left:"s"===i?"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}r||(r=sc);var c=e.incoming.filter(r).map((function(t){var n=o(t),i=n<0?l(t.source,e):l(e,t.source);return{id:t.source.id,distance:i,weight:n}})),h=e.outgoing.filter(r).map((function(t){var n=o(t),i=n>0?l(e,t.target):l(t.target,e);return{id:t.target.id,distance:i,weight:n}})),u=x(c.concat(h).reduce((function(e,t){return e[t.id+"__weight_"+t.weight]=t,e}),{}),(function(e,t){var n=t.distance,i=t.weight;return n<0||n>s||(e[String(n)]||(e[String(n)]=0),e[String(n)]+=1*i,(!e.distance||e[e.distance]<e[String(n)])&&(e.distance=n)),e}),{});return u.distance||n}(e,{filter:function(e){return Er(e,"bpmn:SequenceFlow")},direction:o.directionHint}),a=30,l=o.minDistance,c=o.baseOrientation;Er(e,"bpmn:BoundaryEvent")&&-1!==(c=wn(e,e.host,-25)).indexOf(o.boundaryOrientation)&&(a*=-1);var h=n?{x:i.right+s+t.width/2,y:r.y+dc(c,l,o)}:{x:r.x+dc(c,l,o),y:i.bottom+s+t.height/2},u={margin:a,minDistance:l},p=n?{y:u}:{x:u};return nc(e,t,h,ic(p))}(e,t,i):void 0}function dc(e,t,n){return e.includes(n.start)?-1*t:e.includes(n.end)?t:0}function fc(e,t){e.on("autoPlace",(function(e){var n=e.shape;return pc(e.source,n,t)}))}fc.$inject=["eventBus","elementRegistry"];var mc={__depends__:[cc],__init__:["bpmnAutoPlace"],bpmnAutoPlace:["type",fc]};function gc(e,t,n,r){Vo.call(this,e),this._elementRegistry=t,this._modeling=n,this._rules=r;var o=this;this.postExecuted(["shape.create"],(function(e){var t=e.context,n=t.hints||{},i=t.shape,r=t.parent||t.newParent;!1!==n.autoResize&&o._expand([i],r)})),this.postExecuted(["elements.move"],(function(e){var t=e.context,n=i(O(t.closure.topLevel)),r=t.hints,s=!r||r.autoResize;!1!==s&&y(S(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,i=t.shape;n&&!1===n.autoResize||i.collapsed||o._expand(i.children||[],i)})),this.postExecuted(["shape.resize"],(function(e){var t=e.context,n=t.hints,i=t.shape,r=i.parent;n&&!1===n.autoResize||r&&o._expand([i],r)}))}function vc(e){e.invoke(gc,this)}function yc(e){Yl.call(this,e);var t=this;this.addRule("element.autoResize",(function(e){return t.canResize(e.elements,e.target)}))}function bc(e,t){yc.call(this,e),this._modeling=t}gc.$inject=["eventBus","elementRegistry","modeling","rules"],e(gc,Vo),gc.prototype._getOptimalBounds=function(e,t){var n=this.getOffset(t),i=this.getPadding(t),r=vn(vt(e)),o=vn(t),s={};return r.top-o.top<i.top&&(s.top=r.top-n.top),r.left-o.left<i.left&&(s.left=r.left-n.left),o.right-r.right<i.right&&(s.right=r.right+n.right),o.bottom-r.bottom<i.bottom&&(s.bottom=r.bottom+n.bottom),yn(z({},o,s))},gc.prototype._expand=function(e,t){if("string"==typeof t&&(t=this._elementRegistry.get(t)),this._rules.allowed("element.autoResize",{elements:e,target:t})){var n=this._getOptimalBounds(e,t);if(function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(n,t)){var i=function(e,t){var n="";e=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}(I(t,["x","y","width","height"]),n);this.resize(t,n,{autoResize:i});var r=t.parent;r&&this._expand([t],r)}}},gc.prototype.getOffset=function(e){return{top:60,bottom:60,left:100,right:100}},gc.prototype.getPadding=function(e){return{top:2,bottom:2,left:15,right:15}},gc.prototype.resize=function(e,t,n){this._modeling.resizeShape(e,t,null,n)},vc.$inject=["injector"],e(vc,gc),vc.prototype.resize=function(e,t,n){Er(e,"bpmn:Participant")?this._modeling.resizeLane(e,t,null,n):this._modeling.resizeShape(e,t,null,n)},yc.$inject=["eventBus"],e(yc,Yl),yc.prototype.canResize=function(e,t){return!1},e(bc,yc),bc.$inject=["eventBus","modeling"],bc.prototype.canResize=function(e,t){if(Er(t.di,"bpmndi:BPMNPlane"))return!1;if(!Er(t,"bpmn:Participant")&&!Er(t,"bpmn:Lane")&&!Er(t,"bpmn:SubProcess"))return!1;var n=!0;return y(e,(function(e){(Er(e,"bpmn:Lane")||fn(e))&&(n=!1)})),n};var xc={__init__:["bpmnAutoResize","bpmnAutoResizeProvider"],bpmnAutoResize:["type",vc],bpmnAutoResizeProvider:["type",bc]};function wc(e,t,n){var i,r,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,i=o._findTargetGfx(n),r=i&&e.get(i);i&&r&&(t.stopPropagation(),s.hover({element:r,gfx:i}),s.move(n))}}(t)}))})),t.on("element.hover",(function(e){i=e.gfx,r=e.element})),t.on("element.hover",1500,(function(e){r&&t.fire("element.out",{element:r,gfx:i})})),t.on("element.out",(function(){i=null,r=null})),this._findTargetGfx=function(e){var t;if(e instanceof MouseEvent)return t=ms(e),function(e){return ee(e,"svg, .djs-element",!0)}(document.elementFromPoint(t.x,t.y))}}wc.$inject=["elementRegistry","eventBus","injector"];var _c={__init__:["hoverFix"],hoverFix:["type",wc]},Ec=Math.round,kc="djs-drag-active";function Oc(e){e.preventDefault()}function Sc(e,t,n,i){var r,o={threshold:5,trapClick:!0};function s(e){var n=t.viewbox(),i=t._container.getBoundingClientRect();return{x:n.x+(e.x-i.left)/n.scale,y:n.y+(e.y-i.top)/n.scale}}function a(t,n){n=n||r;var i=e.createEvent(z({},n.payload,n.data,{isTouch:n.isTouch}));return!1!==e.fire("drag."+t,i)&&e.fire(n.prefix+"."+t,i)}function l(e,i){var o,l=r.payload,c=r.displacement,h=r.globalStart,u=ms(e),p=ia(u,h),d=r.localStart,f=s(u),g=ia(f,d);if(!r.active&&(i||(o=p,Math.sqrt(Math.pow(o.x,2)+Math.pow(o.y,2))>r.threshold))){if(z(l,{x:Ec(d.x+c.x),y:Ec(d.y+c.y),dx:0,dy:0},{originalEvent:e}),!1===a("start"))return m();r.active=!0,r.keepSelection||(l.previousSelection=n.get(),n.select(null)),r.cursor&&Zs(r.cursor),t.addMarker(t.getRootElement(),kc)}fs(e),r.active&&(z(l,{x:Ec(f.x+c.x),y:Ec(f.y+c.y),dx:Ec(g.x),dy:Ec(g.y)},{originalEvent:e}),a("move"))}function c(e){var t=!0;r.active&&(e&&(r.payload.originalEvent=e,fs(e)),t=a("end")),!1===t&&a("rejected"),a("ended",g(!0!==t))}function h(e){$s("Escape",e)&&(Oc(e),m())}function u(t){var n;r.active&&(n=ta(e),setTimeout(n,400),Oc(t)),c(t)}function p(e){l(e)}function d(e){var t=r.payload;t.hoverGfx=e.gfx,t.hover=e.element,a("hover")}function f(e){a("out");var t=r.payload;t.hoverGfx=null,t.hover=null}function m(e){var t;if(r){var n=r.active;n&&a("cancel"),t=g(e),n&&a("canceled",t)}}function g(o){var s,g;a("cleanup"),Js(),g=r.trapClick?u:c,le.unbind(document,"mousemove",l),le.unbind(document,"dragstart",Oc),le.unbind(document,"selectstart",Oc),le.unbind(document,"mousedown",g,!0),le.unbind(document,"mouseup",g,!0),le.unbind(document,"keyup",h),le.unbind(document,"touchstart",p,!0),le.unbind(document,"touchcancel",m,!0),le.unbind(document,"touchmove",l,!0),le.unbind(document,"touchend",c,!0),e.off("element.hover",d),e.off("element.out",f),t.removeMarker(t.getRootElement(),kc);var v=r.payload.previousSelection;return!1!==o&&v&&!n.get().length&&function(e){var t=e.filter((function(e){return i.get(e.id)}));t.length&&n.select(t)}(v),s=r,r=null,s}e.on("diagram.destroy",m),this.init=function(t,n,i,g){r&&m(!1),"string"==typeof n&&(g=i,i=n,n=null);var v,y,b,x,w,_=(g=z({},o,g||{})).data||{};x=g.trapClick?u:c,t?(v=ds(t)||t,y=ms(t),fs(t),"dragstart"===v.type&&Oc(v)):(v=null,y={x:0,y:0}),b=s(y),n||(n=b),w=function(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent}(v),r=z({prefix:i,data:_,payload:{},globalStart:y,displacement:ia(n,b),localStart:b,isTouch:w},g),g.manual||(w?(le.bind(document,"touchstart",p,!0),le.bind(document,"touchcancel",m,!0),le.bind(document,"touchmove",l,!0),le.bind(document,"touchend",c,!0)):(le.bind(document,"mousemove",l),le.bind(document,"dragstart",Oc),le.bind(document,"selectstart",Oc),le.bind(document,"mousedown",x,!0),le.bind(document,"mouseup",x,!0)),le.bind(document,"keyup",h),e.on("element.hover",d),e.on("element.out",f)),a("init"),g.autoActivate&&l(t,!0)},this.move=l,this.hover=d,this.out=f,this.end=c,this.cancel=m,this.context=function(){return r},this.setOptions=function(e){z(o,e)}}Sc.$inject=["eventBus","canvas","selection","elementRegistry"];var Cc={__depends__:[_c,Rs],dragging:["type",Sc]};function Pc(e,t,n){this._canvas=n,this._opts=z({scrollThresholdIn:[20,20,20,20],scrollThresholdOut:[0,0,0,0],scrollRepeatTimeout:15,scrollStep:10},e);var i=this;t.on("drag.move",(function(e){var t=i._toBorderPoint(e);i.startScroll(t)})),t.on(["drag.cleanup"],(function(){i.stopScroll()}))}function Ac(e,t,n){return t<e&&e<n}Pc.$inject=["config.autoScroll","eventBus","canvas"],Pc.prototype.startScroll=function(e){var t=this._canvas,n=this._opts,i=this,r=t.getContainer().getBoundingClientRect(),o=[e.x,e.y,r.width-e.x,r.height-e.y];this.stopScroll();for(var s=0,a=0,l=0;l<4;l++)Ac(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(){i.startScroll(e)}),n.scrollRepeatTimeout))},Pc.prototype.stopScroll=function(){clearTimeout(this._scrolling)},Pc.prototype.setOptions=function(e){this._opts=z({},this._opts,e)},Pc.prototype._toBorderPoint=function(e){var t=this._canvas._container.getBoundingClientRect(),n=ms(e.originalEvent);return{x:n.x-t.left,y:n.y-t.top}};var Mc={__depends__:[Cc],__init__:["autoScroll"],autoScroll:["type",Pc]};function Rc(e){this._commandStack=e.get("commandStack",!1)}Rc.$inject=["injector"],Rc.prototype.allowed=function(e,t){var n=!0,i=this._commandStack;return i&&(n=i.canExecute(e,t)),void 0===n||n};var Tc={__init__:["rules"],rules:["type",Rc]},Dc=Math.round,Bc=Math.max;var Lc=10;function Nc(e,t){return function(e,t){var n,i;for(n=0;i=e[n];n++)if(Ct(i,t)<=Lc)return{point:e[n],bendpoint:!0,index:n};return null}(e,t)||function(e,t){var n,i,r=sn(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,Lc),(n=[],e.forEach((function(e,t){n.push([0===t?"M":"L",e.x,e.y])})),n)),o=r[0],s=r[r.length-1];return o?o!==s?o.segment2!==s.segment2?{point:e[i=Bc(o.segment2,s.segment2)-1],bendpoint:!0,index:i}:{point:{x:Dc(o.x+s.x)/2,y:Dc(o.y+s.y)/2},index:o.segment2}:{point:{x:Dc(o.x),y:Dc(o.y)},index:o.segment2}:null}(e,t)}function zc(e){return Math.sqrt(Math.pow(e.x,2)+Math.pow(e.y,2))}function $c(e){return Math.atan((e[1].y-e[0].y)/(e[1].x-e[0].x))}function Ic(e,t){var n=t[0],i=t[1],r={x:i.x-n.x,y:i.y-n.y},o=function(e,t,n){var i=[{n:e[0]-n[0],lambda:t[0]},{n:e[1]-n[1],lambda:t[1]}];return-(i[0].n*t[0]+i[1].n*t[1])/(i[0].lambda*t[0]+i[1].lambda*t[1])}([n.x,n.y],[r.x,r.y],[e.x,e.y]);return{x:n.x+o*r.x,y:n.y+o*r.y}}function jc(e,t){var n=Ic(e,t);return zc({x:n.x-e.x,y:n.y-e.y})}function Fc(e,t){return zc({x:e.x-t.x,y:e.y-t.y})}var Hc="djs-bendpoint",Vc="djs-segment-dragger";function qc(e,t,n){var i=function(e,t){var n,i=ms(t),r=e._container.getBoundingClientRect();n={x:r.left,y:r.top};var o=e.viewbox();return{x:o.x+(i.x-n.x)/o.scale,y:o.y+(i.y-n.y)/o.scale}}(e,n);return Nc(t,i)}function Wc(e,t){var n=De("g");Se(n).add(Hc),xe(e,n);var i=De("circle");ke(i,{cx:0,cy:0,r:4}),Se(i).add("djs-visual"),xe(n,i);var r=De("circle");return ke(r,{cx:0,cy:0,r:10}),Se(r).add("djs-hit"),xe(n,r),t&&Se(n).add(t),n}function Qc(e,t,n,i){var r=De("g");xe(e,r);var o=function(e,t,n){var i=t.x-e.x,r=t.y-e.y;return Xc("h"===n?i:r)}(t,n,i),s=De("rect");ke(s,{x:-9,y:-3,width:18,height:6}),Se(s).add("djs-visual"),xe(r,s);var a=De("rect");return ke(a,{x:-o/2,y:-8.5,width:o,height:17}),Se(a).add("djs-hit"),xe(r,a),Zn(r,"v"===i?90:0),r}function Gc(e,t,n){var i=De("g"),r=Dt(t,n),o=Mt(t,n);return xe(e,i),Qc(i,t,n,o),Se(i).add(Vc),Se(i).add("h"===o?"horizontal":"vertical"),Kn(i,r.x,r.y),i}function Xc(e){return Math.abs(Math.round(2*e/3))}function Uc(e,t){var n=function(e,t){for(var n,i=t.waypoints,r=1/0,o=0;o<i.length-1;o++){var s=jc(e,[i[o],i[o+1]]);s<r&&(r=s,n=o)}return[i[n],i[n+1]]}(e,t);return Ic(e,n)}function Yc(e,t,n,i,r){function o(e,n){var o,s=n.waypoints,a=qc(t,s,e);if(a)return o=function(e,t){var n,i,r=e.waypoints;return t.index<=0||t.bendpoint?null:(i=Mt((n={start:r[t.index-1],end:r[t.index]}).start,n.end))?Xc("h"===i?n.end.x-n.start.x:n.end.y-n.start.y)/2:null}(n,a),!function(e,t,n){var i,r,o,s,a,l,c=e.index,h=e.point;return!(c<=0||e.bendpoint)&&(o=Dt(i=t[c-1],r=t[c]),s=Mt(i,r),a=Math.abs(h.x-o.x),l=Math.abs(h.y-o.y),s&&a<=n&&l<=n)}(a,s,o)?i.start(e,n,a.index,!a.bendpoint):r.start(e,n,a.index),!0}function s(e,t,i){le.bind(e,t,(function(e){n.triggerMouseEvent(t,e,i),e.stopPropagation()}))}function a(e,n){var i=t.getLayer("overlays"),r=ve('.djs-bendpoints[data-element-id="'+Go(e.id)+'"]',i);return!r&&n&&(ke(r=De("g"),{"data-element-id":e.id}),Se(r).add("djs-bendpoints"),xe(i,r),s(r,"mousedown",e),s(r,"click",e),s(r,"dblclick",e)),r}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 i=Wc(e);xe(e,i),Kn(i,t.x,t.y)})),Wc(e,"floating")}function h(e,t){for(var n,i,r,o=t.waypoints,a=1;a<o.length;a++)Mt(n=o[a-1],i=o[a])&&(ke(r=Gc(e,n,i),{"data-segment-idx":a}),s(r,"mousemove",t))}function u(e){var t=a(e);return t||(c(t=a(e,!0),e),h(t,e)),t}function p(e){var t=a(e);t&&(!function(e){y(ye("."+Vc,e),(function(e){qe(e)}))}(t),function(e){y(ye("."+Hc,e),(function(e){qe(e)}))}(t),h(t,e),c(t,e))}function d(e,t,n){var i,r,o=l(t.index,e),s=n[t.index-1],a=n[t.index],c=t.point,h=Dt(s,a),u=Mt(s,a);o&&(i=function(e){return ve(".djs-visual",e)}(o),r={x:c.x-h.x,y:c.y-h.y},"v"===u&&(r={x:r.y,y:r.x}),Kn(i,r.x,r.y))}e.on("connection.changed",(function(e){p(e.element)})),e.on("connection.remove",(function(e){var t=a(e.element);t&&qe(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,i,r=e.element,o=r.waypoints;if(o){if(n=a(r,!0),!(i=qc(t,o,e.originalEvent)))return;!function(e,t){var n=ve(".floating",e),i=t.point;n&&Kn(n,i.x,i.y)}(n,i),i.bendpoint||d(n,i,o)}})),e.on("element.mousedown",(function(e){if(ys(e)){var t=e.originalEvent,n=e.element;if(n.waypoints)return o(t,n)}})),e.on("selection.changed",(function(e){var t=e.newSelection[0];t&&t.waypoints&&u(t)})),e.on("element.hover",(function(e){var t=e.element;t.waypoints&&(u(t),n.registerEvent(e.gfx,"mousemove","element.mousemove"))})),e.on("element.out",(function(e){n.unregisterEvent(e.gfx,"mousemove","element.mousemove")})),e.on("element.updateId",(function(e){var t=e.element,n=e.newId;if(t.waypoints){var i=a(t);i&&ke(i,{"data-element-id":n})}})),this.addHandles=u,this.updateHandles=p,this.getBendpointsContainer=a,this.getSegmentDragger=l}Yc.$inject=["eventBus","canvas","interactionEvents","bendpointMove","connectionSegmentMove"];var Kc=Math.round,Zc="reconnectStart",Jc="reconnectEnd",eh="updateWaypoints";function th(e,t,n,i,r,o){this._injector=e,this.start=function(e,t,o,s){var a,l=n.getGraphics(t),c=t.source,h=t.target,u=t.waypoints,p=(a=s||0!==o?s||o!==u.length-1?eh:Jc:Zc)===eh?"connection.updateWaypoints":"connection.reconnect",d=r.allowed(p,{connection:t,source:c,target:h});!1===d&&(d=r.allowed(p,{connection:t,source:h,target:c})),!1!==d&&i.init(e,"bendpoint.move",{data:{connection:t,connectionGfx:l,context:{allowed:d,bendpointIndex:o,connection:t,source:c,target:h,insert:s,type:a}}})},t.on("bendpoint.move.hover",(function(e){var t,n=e.context,i=n.connection,o=i.source,s=i.target,a=e.hover,l=n.type;if(n.hover=a,a){var c=l===eh?"connection.updateWaypoints":"connection.reconnect";if(t=n.allowed=r.allowed(c,{connection:i,source:l===Zc?a:o,target:l===Jc?a:s}))return n.source=l===Zc?a:o,void(n.target=l===Jc?a:s);!1===t&&(t=n.allowed=r.allowed(c,{connection:i,source:l===Jc?a:s,target:l===Zc?a:o})),t&&(n.source=l===Jc?a:s,n.target=l===Zc?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!==eh&&(t.allowed=!1)})),t.on("bendpoint.move.end",(function(e){var t=e.context,n=t.allowed,i=t.bendpointIndex,r=t.connection,s=t.insert,a=r.waypoints.slice(),l=t.source,c=t.target,h=t.type,u=t.hints||{},p={x:Kc(e.x),y:Kc(e.y)};if(!n)return!1;h===eh?(s?a.splice(i,0,p):a[i]=p,u.bendpointMove={insert:s,bendpointIndex:i},a=this.cropWaypoints(r,a),o.updateWaypoints(r,function(e){e=e.slice();for(var t,n,i,r=0;e[r];)t=e[r],n=e[r-1],0===Ct(t,i=e[r+1])||Pt(n,i,t)?e.splice(r,1):r++;return e}(a),u)):(h===Zc?(u.docking="source",nh(t)&&(u.docking="target",u.newWaypoints=a.reverse())):h===Jc&&(u.docking="target",nh(t)&&(u.docking="source",u.newWaypoints=a.reverse())),o.reconnect(r,l,c,p,u))}),this)}function nh(e){var t=e.hover,n=e.source,i=e.target,r=e.type;return r===Zc?t&&i&&t===i&&n!==i:r===Jc?t&&n&&t===n&&n!==i:void 0}th.$inject=["injector","eventBus","canvas","dragging","rules","modeling"],th.prototype.cropWaypoints=function(e,t){var n=this._injector.get("connectionDocking",!1);if(!n)return t;var i=e.waypoints;return e.waypoints=t,e.waypoints=n.getCroppedWaypoints(e),t=e.waypoints,e.waypoints=i,t};var ih="updateWaypoints",rh="connect-ok",oh="connect-not-ok",sh="connect-hover",ah="djs-updating",lh="djs-dragging";function ch(e,t,n,i){this._injector=t;var r=t.get("connectionPreview",!1);n.on("bendpoint.move.start",(function(e){var t=e.context,n=t.bendpointIndex,r=t.connection,o=t.insert,s=r.waypoints,a=s.slice();t.waypoints=s,o&&a.splice(n,0,{x:e.x,y:e.y}),r.waypoints=a,Se(t.draggerGfx=Wc(i.getLayer("overlays"))).add("djs-dragging"),i.addMarker(r,lh),i.addMarker(r,ah)})),n.on("bendpoint.move.hover",(function(e){var t=e.context,n=t.allowed,r=t.hover,o=t.type;if(r){if(i.addMarker(r,sh),o===ih)return;n?(i.removeMarker(r,oh),i.addMarker(r,rh)):!1===n&&(i.removeMarker(r,rh),i.addMarker(r,oh))}})),n.on(["bendpoint.move.out","bendpoint.move.cleanup"],1100,(function(e){var t=e.context,n=t.hover,r=t.target;n&&(i.removeMarker(n,sh),i.removeMarker(n,r?rh:oh))})),n.on("bendpoint.move.move",(function(t){var n=t.context,i=n.allowed,o=n.bendpointIndex,s=n.draggerGfx,a=n.hover,l=n.type,c=n.connection,h=c.source,u=c.target,p=c.waypoints.slice(),d={x:t.x,y:t.y},f=n.hints||{},m={};r&&(f.connectionStart&&(m.connectionStart=f.connectionStart),f.connectionEnd&&(m.connectionEnd=f.connectionEnd),"reconnectStart"===l?nh(n)?(m.connectionEnd=m.connectionEnd||d,m.source=u,m.target=a||h,p=p.reverse()):(m.connectionStart=m.connectionStart||d,m.source=a||h,m.target=u):"reconnectEnd"===l?nh(n)?(m.connectionStart=m.connectionStart||d,m.source=a||u,m.target=h,p=p.reverse()):(m.connectionEnd=m.connectionEnd||d,m.source=h,m.target=a||u):(m.noCropping=!0,m.noLayout=!0,p[o]=d),l===ih&&(p=e.cropWaypoints(c,p)),m.waypoints=p,r.drawPreview(n,i,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,qe(o),i.removeMarker(n,ah),i.removeMarker(n,lh),s&&(i.removeMarker(s,rh),i.removeMarker(s,a?rh:oh)),r&&r.cleanUp(t)}))}ch.$inject=["bendpointMove","injector","eventBus","canvas"];var hh="connect-hover",uh="djs-updating";function ph(e,t,n){return dh(e,t,e[t]+n)}function dh(e,t,n){return{x:"x"===t?n:e.x,y:"y"===t?n:e.y}}function fh(e){return"x"===e?"y":"x"}function mh(e,t,n){var i,r;return e.original?e.original:(i=xn(t),dh(e,r=fh(n),i[r]))}function gh(e,t,n,i,r,o){var s=e.get("connectionDocking",!1);function a(e,t){if(!s)return t;var n,i=e.waypoints;return e.waypoints=t,n=s.getCroppedWaypoints(e),e.waypoints=i,n}function l(e){r.update("connection",e.connection,e.connectionGfx)}function c(e,t,n){var i=e.newWaypoints,r=function(e,t,n,i){var r=Math.max(t[i],n[i]),o=Math.min(t[i],n[i]);return dh(t,i,Math.min(Math.max(o+20,e[i]),r-20))}(n,i[e.segmentStartIndex+t],i[e.segmentEndIndex+t],fh(e.axis));Kn(e.draggerGfx,r.x,r.y)}this.start=function(e,t,r){var o,s,a,l,c=n.getGraphics(t),h=r-1,u=r,p=t.waypoints,d=p[h],f=p[u],m=qc(n,p,e);(s=Mt(d,f))&&(a="v"===s?"x":"y",0===h&&(d=mh(d,t.source,a)),u===p.length-1&&(f=mh(f,t.target,a)),o={connection:t,segmentStartIndex:h,segmentEndIndex:u,segmentStart:d,segmentEnd:f,axis:a,dragPosition:l=m?m.point:{x:(d.x+f.x)/2,y:(d.y+f.y)/2}},i.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,i=e.connection,r=n.getLayer("overlays");t.originalWaypoints=i.waypoints.slice(),t.draggerGfx=Gc(r,t.segmentStart,t.segmentEnd),Se(t.draggerGfx).add("djs-dragging"),n.addMarker(i,uh)})),t.on("connectionSegment.move.move",(function(e){var t,n,i=e.context,r=i.connection,o=i.segmentStartIndex,s=i.segmentEndIndex,h=i.segmentStart,u=i.segmentEnd,p=i.axis,d=i.originalWaypoints.slice(),f=ph(h,p,e["d"+p]),m=ph(u,p,e["d"+p]),g=d.length,v=0;d[o]=f,d[s]=m,o<2&&(t=wn(r.source,f),1===o?"intersect"===t&&(d.shift(),d[0]=f,v--):"intersect"!==t&&(d.unshift(h),v++)),s>g-3&&(n=wn(r.target,m),s===g-2?"intersect"===n&&(d.pop(),d[d.length-1]=m):"intersect"!==n&&d.push(u)),i.newWaypoints=r.waypoints=a(r,d),c(i,v,e),i.newSegmentStartIndex=o+v,l(e)})),t.on("connectionSegment.move.hover",(function(e){e.context.hover=e.hover,n.addMarker(e.hover,hh)})),t.on(["connectionSegment.move.out","connectionSegment.move.cleanup"],(function(e){var t=e.context.hover;t&&n.removeMarker(t,hh)})),t.on("connectionSegment.move.cleanup",(function(e){var t=e.context,i=t.connection;t.draggerGfx&&qe(t.draggerGfx),n.removeMarker(i,uh)})),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,i=t.newWaypoints,r=t.newSegmentStartIndex;i=i.map((function(e){return{original:e.original,x:Math.round(e.x),y:Math.round(e.y)}}));var s=function(e,t){var n=0,i=e.filter((function(i,r){return!Pt(e[r-1],e[r+1],i)||(n=r<=t?n-1:n,!1)}));return{waypoints:i,segmentOffset:n}}(i,r),l=a(n,s.waypoints),c=s.segmentOffset,h={segmentMove:{segmentStartIndex:t.segmentStartIndex,newSegmentStartIndex:r+c}};o.updateWaypoints(n,l,h)}))}gh.$inject=["injector","eventBus","canvas","dragging","graphicsFactory","modeling"];var vh=Math.abs,yh=Math.round;function bh(e){return{x:e.x,y:e.y}}function xh(e){return{x:e.x+e.width,y:e.y+e.height}}function wh(e,t){return!e||isNaN(e.x)||isNaN(e.y)?t:{x:yh(e.x+e.width/2),y:yh(e.y+e.height/2)}}function _h(e,t){var n=e.snapped;return!!n&&("string"==typeof t?n[t]:n.x&&n.y)}function Eh(e,t,n){if("string"!=typeof t)throw new Error("axis must be in [x, y]");if("number"!=typeof n&&!1!==n)throw new Error("value must be Number or false");var i,r=e[t],o=e.snapped=e.snapped||{};return!1===n?o[t]=!1:(o[t]=!0,i=n-r,e[t]+=i,e["d"+t]+=i),r}function kh(e){return e.children||[]}var Oh=Math.abs,Sh=Math.round;function Ch(e){function t(e,t){if(c(e)){for(var n=e.length;n--;)if(Oh(e[n]-t)<=10)return e[n]}else{var i=t%(e=+e);if(i<10)return t-i;if(i>e-10)return t-i+e}return t}function n(e,t){return e.waypoints?Uc(t,e):e.width?{x:Sh(e.width/2+e.x),y:Sh(e.height/2+e.y)}:void 0}e.on("connectionSegment.move.move",1500,(function(e){var i,r,o=function(e){var t=e.context,i=t.snapPoints,r=t.connection,o=r.waypoints,s=t.segmentStart,a=t.segmentStartIndex,l=t.segmentEnd,c=t.segmentEndIndex,h=t.axis;if(i)return i;var u=[o[a-1],s,l,o[c+1]];return a<2&&u.unshift(n(r.source,e)),c>o.length-3&&u.unshift(n(r.target,e)),t.snapPoints=i={horizontal:[],vertical:[]},y(u,(function(e){e&&(e=e.original||e,"y"===h&&i.horizontal.push(e.y),"x"===h&&i.vertical.push(e.x))})),i}(e),s=e.x,a=e.y;if(o){var l=s-(i=t(o.vertical,s)),c=a-(r=t(o.horizontal,a));z(e,{dx:e.dx-l,dy:e.dy-c,x:i,y:r}),(l||-1!==o.vertical.indexOf(s))&&Eh(e,"x",i),(c||-1!==o.horizontal.indexOf(a))&&Eh(e,"y",r)}})),e.on(["connect.hover","connect.move","connect.end"],1500,(function(e){var t=e.context.hover,i=t&&n(t,e);dn(t)&&i&&i.x&&i.y&&(Eh(e,"x",i.x),Eh(e,"y",i.y))})),e.on(["bendpoint.move.move","bendpoint.move.end"],1500,(function(e){var i,r,o=e.context,s=function(e){var t=e.snapPoints,n=e.connection.waypoints,i=e.bendpointIndex;if(t)return t;var r=[n[i-1],n[i+1]];return e.snapPoints=t={horizontal:[],vertical:[]},y(r,(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,h=e.y;if(s){var u=c-(i=t(l?s.vertical.concat([l.x]):s.vertical,c)),p=h-(r=t(l?s.horizontal.concat([l.y]):s.horizontal,h));z(e,{dx:e.dx-u,dy:e.dy-p,x:e.x-u,y:e.y-p}),(u||-1!==s.vertical.indexOf(c))&&Eh(e,"x",i),(p||-1!==s.horizontal.indexOf(h))&&Eh(e,"y",r)}}))}Ch.$inject=["eventBus"];var Ph={__depends__:[Cc,Tc],__init__:["bendpoints","bendpointSnapping","bendpointMovePreview"],bendpoints:["type",Yc],bendpointMove:["type",th],bendpointMovePreview:["type",ch],connectionSegmentMove:["type",gh],bendpointSnapping:["type",Ch]};function Ah(e,t,n,i){function r(e,t){return i.allowed("connection.create",{source:e,target:t})}e.on("connect.hover",(function(e){var t,n=e.context,i=n.start,o=e.hover;if(n.hover=o,!l(t=n.canExecute=r(i,o))){if(!1!==t)return n.source=i,void(n.target=o);l(t=n.canExecute=r(o,i))||!1!==t&&(n.source=o,n.target=i)}})),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,i=t.canExecute,r=t.connectionStart,o={x:e.x,y:e.y},s=t.source,a=t.target;if(!i)return!1;var l=null,c={connectionStart:Mh(t)?o:r,connectionEnd:Mh(t)?r:o};h(i)&&(l=i),t.connection=n.connect(s,a,l,c)})),this.start=function(e,n,i,r){h(i)||(r=i,i=xn(n)),t.init(e,"connect",{autoActivate:r,data:{shape:n,context:{start:n,connectionStart:i}}})}}function Mh(e){var t=e.hover,n=e.source,i=e.target;return t&&n&&t===n&&n!==i}Ah.$inject=["eventBus","dragging","modeling","rules"];var Rh="connect-ok",Th="connect-not-ok";function Dh(e,t,n){var i=e.get("connectionPreview",!1);i&&t.on("connect.move",(function(e){var t=e.context,n=t.canExecute,r=t.hover,o=t.source,s=t.start,a=t.startPosition,l=t.target,c=t.connectionStart||a,h=t.connectionEnd||{x:e.x,y:e.y},u=c,p=h;Mh(t)&&(u=h,p=c),i.drawPreview(t,n,{source:o||s,target:l||r,connectionStart:u,connectionEnd:p})})),t.on("connect.hover",900,(function(e){var t=e.context,i=e.hover,r=t.canExecute;null!==r&&n.addMarker(i,r?Rh:Th)})),t.on(["connect.out","connect.cleanup"],1100,(function(e){var t=e.hover;t&&(n.removeMarker(t,Rh),n.removeMarker(t,Th))})),i&&t.on("connect.cleanup",(function(e){i.cleanUp(e.context)}))}Dh.$inject=["injector","eventBus","canvas"];var Bh={__depends__:[Rs,Tc,Cc],__init__:["connectPreview"],connect:["type",Ah],connectPreview:["type",Dh]};function Lh(e,t,n,i){this._canvas=t,this._graphicsFactory=n,this._elementFactory=i,this._connectionDocking=e.get("connectionDocking",!1),this._layouter=e.get("layouter",!1)}Lh.$inject=["injector","canvas","graphicsFactory","elementFactory"],Lh.prototype.drawPreview=function(e,t,n){n=n||{};var i,r=e.connectionPreviewGfx,o=e.getConnection,s=n.source,a=n.target,l=n.waypoints,c=n.connectionStart,h=n.connectionEnd,u=n.noLayout,p=n.noCropping,d=n.noNoop,f=this;r||(r=e.connectionPreviewGfx=this.createConnectionPreviewGfx()),Pe(r),o||(o=e.getConnection=function(e){var t={};return function(n){var i=JSON.stringify(n),r=t[i];return r||(r=t[i]=e.apply(null,arguments)),r}}((function(e,t,n){return f.getConnection(e,t,n)}))),t&&(i=o(t,s,a)),i?(i.waypoints=l||[],this._layouter&&!u&&(i.waypoints=this._layouter.layoutConnection(i,{source:s,target:a,connectionStart:c,connectionEnd:h,waypoints:n.waypoints||i.waypoints})),i.waypoints&&i.waypoints.length||(i.waypoints=[s?xn(s):c,a?xn(a):h]),this._connectionDocking&&(s||a)&&!p&&(i.waypoints=this._connectionDocking.getCroppedWaypoints(i,s,a)),this._graphicsFactory.drawConnection(r,i,{stroke:"var(--element-dragger-color)"})):!d&&this.drawNoopPreview(r,n)},Lh.prototype.drawNoopPreview=function(e,t){var n=t.source,i=t.target,r=t.connectionStart||xn(n),o=t.connectionEnd||xn(i),s=this.cropWaypoints(r,o,n,i);xe(e,this.createNoopConnection(s[0],s[1]))},Lh.prototype.cropWaypoints=function(e,t,n,i){var r=this._graphicsFactory,o=n&&r.getShapePath(n),s=i&&r.getShapePath(i),a=r.getConnectionPath({waypoints:[e,t]});return[e=n&&_n(o,a,!0)||e,t=i&&_n(s,a,!1)||t]},Lh.prototype.cleanUp=function(e){e&&e.connectionPreviewGfx&&qe(e.connectionPreviewGfx)},Lh.prototype.getConnection=function(e){var t=function(e){return h(e)?e:{}}(e);return this._elementFactory.createConnection(t)},Lh.prototype.createConnectionPreviewGfx=function(){var e=De("g");return ke(e,{pointerEvents:"none"}),Se(e).add("djs-dragger"),xe(this._canvas.getActiveLayer(),e),e},Lh.prototype.createNoopConnection=function(e,t){return ht([e,t],{stroke:"#333",strokeDasharray:[1],strokeWidth:2,"pointer-events":"none"})};var Nh={__init__:["connectionPreview"],connectionPreview:["type",Lh]};const zh=new Bo("ps");var $h=["marker-start","marker-mid","marker-end"],Ih=["circle","ellipse","line","path","polygon","polyline","path","rect"];function jh(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._styles=i}jh.$inject=["elementRegistry","eventBus","canvas","styles"],jh.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")},jh.prototype.getGfx=function(e){return this._elementRegistry.getGraphics(e)},jh.prototype.addDragger=function(e,t,n,i="djs-dragger"){var r=Ae(n=n||this.getGfx(e)),o=n.getBoundingClientRect();return this._cloneMarkers(Un(r),i),ke(r,this._styles.cls(i,[],{x:o.top,y:o.left})),xe(t,r),ke(r,"data-preview-support-element-id",e.id),r},jh.prototype.addFrame=function(e,t){var n=De("rect",{class:"djs-resize-overlay",width:e.width,height:e.height,x:e.x,y:e.y});return xe(t,n),ke(n,"data-preview-support-element-id",e.id),n},jh.prototype._cloneMarkers=function(e,t="djs-dragger",n=e){var i=this;e.childNodes&&e.childNodes.forEach((e=>{i._cloneMarkers(e,t,n)})),function(e){return-1!==Ih.indexOf(e.nodeName)}(e)&&$h.forEach((function(r){if(ke(e,r)){var o=function(e,t,n){var i=(r=ke(e,t),r.match(/url\(['"]?#([^'"]*)['"]?\)/)[1]);var r;return ve("marker#"+i,n||document)}(e,r,i._canvas.getContainer());o&&i._cloneMarker(n,e,o,r,t)}}))},jh.prototype._cloneMarker=function(e,t,n,i,r="djs-dragger"){var o=[n.id,r,zh.next()].join("-"),s=ve("marker#"+n.id,e);e=e||this._canvas._svg;var a=s||Ae(n);a.id=o,Se(a).add(r);var l=ve(":scope > defs",e);l||xe(e,l=De("defs")),xe(l,a);var c=function(e){return"url(#"+e+")"}(a.id);ke(t,i,c)};var Fh={__init__:["previewSupport"],previewSupport:["type",jh]};const Hh="complex-preview";class Vh{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:i=[],resized:r=[]}=e,o=this._canvas.getLayer(Hh);t.filter((e=>!function(e){return e.hidden}(e))).forEach((e=>{let t;dn(e)?(t=this._graphicsFactory._createContainer("connection",De("g")),this._graphicsFactory.drawConnection(Un(t),e)):(t=this._graphicsFactory._createContainer("shape",De("g")),this._graphicsFactory.drawShape(Un(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);dn(e)?Kn(n,t.x,t.y):Kn(n,e.x+t.x,e.y+t.y)})),i.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"])})),r.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",De("g"));this._graphicsFactory.drawShape(Un(n),e,{width:t.width,height:t.height}),Kn(n,t.x,t.y),this._previewSupport.addDragger(e,o,n)}))}cleanUp(){Pe(this._canvas.getLayer(Hh)),this._markers.forEach((([e,t])=>this._canvas.removeMarker(e,t))),this._markers=[]}show(){this._canvas.showLayer(Hh)}hide(){this._canvas.hideLayer(Hh)}}Vh.$inject=["canvas","graphicsFactory","previewSupport"];var qh={__depends__:[Fh],__init__:["complexPreview"],complexPreview:["type",Vh]},Wh=["top","bottom","left","right"],Qh=10;function Gh(e,t){function n(e){if(Kr(e)&&!dn(e)){var n=function(e){var t=xn(e.label),n=xn(e),i=Xh(n,t);if(r=i,-1===Wh.indexOf(r))return;var r;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 Xh(t,e)}));return n}(e);if(e.host){var s=function(e){var t,n=e.host,i=xn(e),r=wn(i,n);t=r.indexOf("-")>=0?r.split("-"):[r];var o=Wh.filter((function(e){return-1===t.indexOf(e)}));return o}(e);o=o.concat(s)}var a=Wh.filter((function(e){return-1===o.indexOf(e)}));if(-1!==a.indexOf(i))return;return a[0]}(e);n&&function(e,n){var i=xn(e),r=e.label,o=xn(r);if(!r.parent)return;var s,a=vn(e);switch(n){case"top":s={x:i.x,y:a.top-Qh-r.height/2};break;case"left":s={x:a.left-Qh-r.width/2,y:i.y};break;case"bottom":s={x:i.x,y:a.bottom+Qh+r.height/2};break;case"right":s={x:a.right+Qh+r.width/2,y:i.y}}var l=ia(s,o);t.moveShape(r,l)}(e,n)}}Vo.call(this,e),this.postExecuted(["connection.create","connection.layout","connection.updateWaypoints"],(function(e){var t=e.context,i=t.connection,r=i.source,o=i.target;!1!==(t.hints||{}).createElementsBehavior&&(n(r),n(o))})),this.postExecuted(["label.create"],(function(e){var t=e.context,i=t.shape;!1!==(t.hints||{}).createElementsBehavior&&n(i.labelTarget)})),this.postExecuted(["elements.create"],(function(e){var t=e.context,i=t.elements;!1!==(t.hints||{}).createElementsBehavior&&i.forEach((function(e){n(e)}))}))}function Xh(e,t){return wn(t,e,5)}function Uh(e){Vo.call(this,e),this.preExecute("shape.append",(function(e){var t=e.source,n=e.shape;e.position||(Er(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 Yh(e,t){e.invoke(Vo,this),this.postExecute("shape.move",(function(e){var n=e.newParent,i=e.shape;y(v(i.incoming.concat(i.outgoing),(function(e){return Er(e,"bpmn:Association")})),(function(e){t.moveConnection(e,{x:0,y:0},n)}))}),!0)}e(Gh,Vo),Gh.$inject=["eventBus","modeling"],e(Uh,Vo),Uh.$inject=["eventBus"],e(Yh,Vo),Yh.$inject=["injector","modeling"];function Kh(e,t){t.invoke(Vo,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 Zh(e,e.host)}))).length&&t.map((function(e){return t.indexOf(e)})).forEach((function(i){var r=t[i];e.elements[i]=n._replaceShape(t[i],r)}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;if(1===t.length){var r=t[0];Zh(r,i)&&(e.shapes=[n._replaceShape(r,i)])}}),!0)}function Zh(e,t){return!fn(e)&&kr(e,["bpmn:IntermediateThrowEvent","bpmn:IntermediateCatchEvent"])&&!!t}function Jh(e,t){function n(e){return v(e.attachers,(function(e){return Er(e,"bpmn:BoundaryEvent")}))}Vo.call(this,e),this.postExecute("connection.create",(function(e){var i=e.context.source,r=e.context.target,o=n(r);Er(i,"bpmn:EventBasedGateway")&&Er(r,"bpmn:ReceiveTask")&&o.length>0&&t.removeElements(o)})),this.postExecute("connection.reconnect",(function(e){var i=e.context.oldSource,r=e.context.newSource;Er(i,"bpmn:Gateway")&&Er(r,"bpmn:EventBasedGateway")&&y(r.outgoing,(function(e){var i=e.target,r=n(i);Er(i,"bpmn:ReceiveTask")&&r.length>0&&t.removeElements(r)}))}))}function eu(e,t,n){function i(e){t.updateProperties(e,{isForCompensation:!0})}function r(e){t.updateProperties(e,{isForCompensation:void 0})}Vo.call(this,e),this.preExecute("shape.replace",(function(e){const{newData:n,oldShape:i}=e;if(nu(e.oldShape)&&"bpmn:CompensateEventDefinition"!==n.eventDefinitionType||"bpmn:BoundaryEvent"!==n.type){const t=i.outgoing.find((({target:e})=>tu(e)));t&&t.target&&(e._connectionTarget=t.target)}else if(!nu(e.oldShape)&&"bpmn:CompensateEventDefinition"===n.eventDefinitionType&&"bpmn:BoundaryEvent"===n.type){const n=i.outgoing.find((({target:e})=>iu(e)));n&&n.target&&(e._connectionTarget=n.target),function(e){const n=e.outgoing.filter((e=>Er(e,"bpmn:SequenceFlow")));t.removeElements(n)}(i)}}),!0),this.postExecuted("shape.replace",(function(e){const{_connectionTarget:n,newShape:i}=e;n&&t.connect(i,n)}),!0),this.preExecute("connection.create",(function(e){const n=e.connection,r=e.source,o=e.target;nu(r)&&iu(o)&&(i(o),function(e,n){const i=e.outgoing.filter((e=>Er(e,"bpmn:Association"))),r=i.filter((e=>tu(e.target)&&!n.includes(e)));r.forEach((e=>t.removeConnection(e)))}(r,[n]))}),!0),this.postExecuted("connection.delete",(function(e){const t=e.source,n=e.target;nu(t)&&tu(n)&&r(n)}),!0),this.postExecuted("connection.reconnect",(function(e){const t=e.newTarget,n=e.oldSource,o=e.oldTarget;if(o!==t){const e=n;tu(o)&&r(o),nu(e)&&iu(t)&&i(t)}}),!0),this.postExecuted("element.updateProperties",(function(e){const{element:i}=e;tu(i)?(function(e){for(const i of e.incoming)n.canConnect(i.source,e)||t.removeConnection(i);for(const i of e.outgoing)n.canConnect(e,i.target)||t.removeConnection(i)}(i),function(e){const n=e.attachers.slice();if(!n.length)return;t.removeElements(n)}(i)):iu(i)&&function(e){const n=e.incoming.filter((e=>nu(e.source)));t.removeElements(n)}(i)}),!0)}function tu(e){const t=Or(e);return t&&t.get("isForCompensation")}function nu(e){return e&&Er(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}function iu(e){return e&&Er(e,"bpmn:Activity")&&!Qr(e)}function ru(e){e.invoke(Vo,this),this.preExecute("shape.create",1500,(function(e){var t=e.context,n=t.parent,i=t.shape;Er(n,"bpmn:Lane")&&!Er(i,"bpmn:Lane")&&(t.parent=hc(n,"bpmn:Participant"))}))}function ou(e,t){Vo.call(this,e),this.preExecute("shape.create",(function(e){var n=e.context.shape;if(Er(n,"bpmn:DataObjectReference")&&"label"!==n.type){var i=t.create("bpmn:DataObject");n.businessObject.dataObjectRef=i}}))}Kh.$inject=["bpmnReplace","injector"],e(Kh,Vo),Kh.prototype._replaceShape=function(e,t){var n,i=(n=Or(e).eventDefinitions)&&n[0],r={type:"bpmn:BoundaryEvent",host:t};return i&&(r.eventDefinitionType=i.$type),this._bpmnReplace.replaceElement(e,r,{layoutConnection:!1})},Jh.$inject=["eventBus","modeling"],e(Jh,Vo),e(eu,Vo),eu.$inject=["eventBus","modeling","bpmnRules"],ru.$inject=["injector"],e(ru,Vo),ou.$inject=["eventBus","bpmnFactory"],e(ou,Vo);var su=20,au=20,lu=30,cu=2e3;function hu(e,t,n){function i(){var t=e.getRootElement();return Er(t,"bpmn:Collaboration")?t:n.makeCollaboration()}Vo.call(this,t),t.on(["create.start","shape.move.start"],cu,(function(t){var n=t.context,i=n.shape,r=e.getRootElement();if(Er(i,"bpmn:Participant")&&Er(r,"bpmn:Process")&&r.children.length){var o=r.children.filter((function(e){return!Er(e,"bpmn:Group")&&!fn(e)&&!dn(e)}));if(o.length){var s=vt(o),a=function(e,t){t={width:t.width+2*su+lu,height:t.height+2*au};var n=Math.max(e.width,t.width),i=Math.max(e.height,t.height);return{x:-n/2,y:-i/2,width:n,height:i}}(i,s);z(i,a),n.createConstraints=function(e,t){return t=vn(t),{bottom:t.top+e.height/2-au,left:t.right-e.width/2+su,top:t.bottom-e.height/2+au,right:t.left+e.width/2-su-lu}}(i,s)}}})),t.on("create.start",cu,(function(n){var i=n.context.shape,r=e.getRootElement(),o=e.getGraphics(r);function s(e){e.element=r,e.gfx=o}Er(i,"bpmn:Participant")&&Er(r,"bpmn:Process")&&(t.on("element.hover",cu,s),t.once("create.cleanup",(function(){t.off("element.hover",s)})))})),this.preExecute("elements.create",cu,(function(e){var t,n=e.elements,r=e.parent,o=function(e){return m(e,(function(e){return Er(e,"bpmn:Participant")}))}(n);o&&Er(r,"bpmn:Process")&&(e.parent=i(),(t=e.hints=e.hints||{}).participant=o,t.process=r,t.processRef=Or(o).get("processRef"))}),!0),this.preExecute("shape.create",(function(e){var t=e.parent,n=e.shape;Er(n,"bpmn:Participant")&&Er(t,"bpmn:Process")&&(e.parent=i(),e.process=t,e.processRef=Or(n).get("processRef"))}),!0),this.execute("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.shape,r=t.participant;!n||r&&i!==r||Or(i).set("processRef",Or(n))}),!0),this.revert("shape.create",(function(e){var t=e.hints||{},n=e.process||t.process,i=e.processRef||t.processRef,r=e.shape,o=t.participant;!n||o&&r!==o||Or(r).set("processRef",i)}),!0),this.postExecute("shape.create",(function(e){var t=e.hints||{},i=e.process||e.hints.process,r=e.shape,o=t.participant;if(i){var s=i.children.slice();o?r===o&&n.moveElements(s,{x:0,y:0},o):n.moveElements(s,{x:0,y:0},r)}}),!0)}hu.$inject=["canvas","eventBus","modeling"],e(hu,Vo);var uu="__targetRef_placeholder";function pu(e,t){function n(e,n){var i=e.get("properties"),r=m(i,(function(e){return e.name===uu}));return!r&&n&&Ot(i,r=t.create("bpmn:Property",{name:uu})),r}function i(e,t){var i=n(e);i&&(function(e,t,n){return m(e.get("dataInputAssociations"),(function(e){return e!==n&&e.targetRef===t}))}(e,i,t)||kt(e.get("properties"),i))}function r(e){var t,r=e.context,o=r.connection,s=o.businessObject,a=o.target,l=a&&a.businessObject,c=r.newTarget,h=c&&c.businessObject,u=r.oldTarget||r.target,p=u&&u.businessObject,d=o.businessObject;p&&p!==l&&i(p,s),h&&h!==l&&i(h,s),l?(t=n(l,!0),d.targetRef=t):d.targetRef=null}Vo.call(this,e),this.executed(["connection.create","connection.delete","connection.move","connection.reconnect"],du(r)),this.reverted(["connection.create","connection.delete","connection.move","connection.reconnect"],du(r))}function du(e){return function(t){if(Er(t.context.connection,"bpmn:DataInputAssociation"))return e(t)}}function fu(e){this._bpmnUpdater=e}function mu(e,t,n,i){function r(e){return e.children.filter((function(e){return Er(e,"bpmn:DataStoreReference")&&!e.labelTarget}))}function o(e,i){var r=e.businessObject||e;if(i=i||n.filter((function(e){return Er(e,"bpmn:Participant")&&Or(e).processRef}))[0]){var o=i.businessObject||i;t.execute("dataStore.updateContainment",{dataStoreBo:r,dataStoreDi:Sr(e),newSemanticParent:o.processRef||o,newDiParent:Sr(i)})}}Vo.call(this,i),t.registerHandler("dataStore.updateContainment",fu),this.preExecute("shape.create",(function(e){var t=e.context,n=t.shape;Er(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 Er(e,"bpmn:DataStoreReference")})).length&&(t.hints||(t.hints={}),t.hints.autoResize=n.filter((function(e){return!Er(e,"bpmn:DataStoreReference")})))})),this.postExecute("shape.create",(function(e){var t=e.context.shape,n=t.parent;Er(t,"bpmn:DataStoreReference")&&"label"!==t.type&&Er(n,"bpmn:Collaboration")&&o(t)})),this.postExecute("shape.move",(function(e){var t=e.context,n=t.shape,i=t.oldParent,r=n.parent;Er(i,"bpmn:Collaboration")||Er(n,"bpmn:DataStoreReference")&&"label"!==n.type&&Er(r,"bpmn:Collaboration")&&o(n,Er(i,"bpmn:Participant")?i:function(e,t){for(;e.parent;){if(Er(e.parent,t))return e.parent;e=e.parent}}(i,"bpmn:Participant"))})),this.postExecute("shape.delete",(function(t){var n=t.context.shape,i=e.getRootElement();kr(n,["bpmn:Participant","bpmn:SubProcess"])&&Er(i,"bpmn:Collaboration")&&r(i).filter((function(e){return function(e,t){var n=e.businessObject||e,i=t.businessObject||t;for(;n.$parent;){if(n.$parent===i.processRef||i)return!0;n=n.$parent}return!1}(e,n)})).forEach((function(e){o(e)}))})),this.postExecute("canvas.updateRoot",(function(e){var t=e.context,n=t.oldRoot,i=t.newRoot;r(n).forEach((function(e){Er(i,"bpmn:Process")&&o(e,i)}))}))}pu.$inject=["eventBus","bpmnFactory"],e(pu,Vo),fu.$inject=["bpmnUpdater"],fu.prototype.execute=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.newSemanticParent,r=e.newDiParent;return e.oldSemanticParent=t.$parent,e.oldDiParent=n.$parent,this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},fu.prototype.revert=function(e){var t=e.dataStoreBo,n=e.dataStoreDi,i=e.oldSemanticParent,r=e.oldDiParent;return this._bpmnUpdater.updateSemanticParent(t,i),this._bpmnUpdater.updateDiParent(n,r),[]},mu.$inject=["canvas","commandStack","elementRegistry","eventBus"],e(mu,Vo);var gu=Math.max,vu=Math.min,yu=20;function bu(e,t){return{top:e.top-t.top,right:e.right-t.right,bottom:e.bottom-t.bottom,left:e.left-t.left}}function xu(e,t,n){var i=t[e],r=n.min&&n.min[e],o=n.max&&n.max[e];return u(r)&&(i=(/top|left/.test(e)?vu:gu)(i,r)),u(o)&&(i=(/top|left/.test(e)?gu:vu)(i,o)),i}function wu(e,t){return void 0!==e?e:yu}function _u(e){return!e.waypoints&&"label"!==e.type}function Eu(e,t){var n;if((n=void 0===e.length?v(e.children,_u):e).length)return function(e,t){var n,i,r,o;return"object"==typeof t?(n=wu(t.left),i=wu(t.right),r=wu(t.top),o=wu(t.bottom)):n=i=r=o=wu(t),{x:e.x-n,y:e.y-r,width:e.width+n+i,height:e.height+r+o}}(vt(n),t)}var ku=Math.abs;var Ou=["bpmn:Participant","bpmn:Process","bpmn:SubProcess"],Su=30;function Cu(e,t){return t=t||[],e.children.filter((function(e){Er(e,"bpmn:Lane")&&(Cu(e,t),t.push(e))})),t}function Pu(e){return e.children.filter((function(e){return Er(e,"bpmn:Lane")}))}function Au(e){return hc(e,Ou)||e}function Mu(e,t){var n=Au(e),i=Cu(n,Er(n,"bpmn:Process")?[]:[n]),r=vn(e),o=vn(t),s=function(e,t){return bu(vn(t),vn(e))}(e,t),a=[],l=qr(e);return i.forEach((function(t){if(t!==e){var n,i,c=l?0:s.top,h=l?s.right:0,u=l?0:s.bottom,p=l?s.left:0,d=vn(t);s.top&&(ku(d.bottom-r.top)<10&&(u=o.top-d.bottom),ku(d.top-r.top)<5&&(c=o.top-d.top)),s.left&&(ku(d.right-r.left)<10&&(h=o.left-d.right),ku(d.left-r.left)<5&&(p=o.left-d.left)),s.bottom&&(ku(d.top-r.bottom)<10&&(c=o.bottom-d.top),ku(d.bottom-r.bottom)<5&&(u=o.bottom-d.bottom)),s.right&&(ku(d.left-r.right)<10&&(p=o.right-d.left),ku(d.right-r.right)<5&&(h=o.right-d.right)),(c||h||u||p)&&a.push({shape:t,newBounds:(n=t,i={top:c,right:h,bottom:u,left:p},{x:n.x+(i.left||0),y:n.y+(i.top||0),width:n.width-(i.left||0)+(i.right||0),height:n.height-(i.top||0)+(i.bottom||0)})})}})),a}function Ru(e,t){Vo.call(this,e),this.postExecuted("shape.delete",500,(function(e){var n=e.context,i=n.hints,r=n.shape,o=n.oldParent;Er(r,"bpmn:Lane")&&(i&&i.nested||function(e,n){var i,r,o,s,a,l=qr(e),c=Pu(n),h=[],u=[],p=[],d=[];mt(c,(function(t){return l?t.y>e.y?u.push(t):h.push(t):t.x>e.x?d.push(t):p.push(t),t.children})),c.length&&(i=l?u.length&&h.length?e.height/2:e.height:d.length&&p.length?e.width/2:e.width,h.length&&(r=t.calculateAdjustments(h,"y",i,e.y-10),t.makeSpace(r.movingShapes,r.resizingShapes,{x:0,y:i},"s")),u.length&&(o=t.calculateAdjustments(u,"y",-i,e.y+e.height+10),t.makeSpace(o.movingShapes,o.resizingShapes,{x:0,y:-i},"n")),p.length&&(s=t.calculateAdjustments(p,"x",i,e.x-10),t.makeSpace(s.movingShapes,s.resizingShapes,{x:i,y:0},"e")),d.length&&(a=t.calculateAdjustments(d,"x",-i,e.x+e.width+10),t.makeSpace(a.movingShapes,a.resizingShapes,{x:-i,y:0},"w")))}(r,o))}))}Ru.$inject=["eventBus","spaceTool"],e(Ru,Vo);function Tu(e,t){t.invoke(Vo,this),this._bpmnReplace=e;var n=this;this.postExecuted("elements.create",500,(function(e){var t=e.elements;t.filter((function(e){return Du(e,e.host)})).map((function(e){return t.indexOf(e)})).forEach((function(i){e.elements[i]=n._replaceShape(t[i])}))}),!0),this.preExecute("elements.move",500,(function(e){var t=e.shapes,i=e.newHost;t.forEach((function(e,r){var o,s=e.host;Du(e,(o=s,-1!==t.indexOf(o)?s:i))&&(t[r]=n._replaceShape(e))}))}),!0)}function Du(e,t){return!fn(e)&&Er(e,"bpmn:BoundaryEvent")&&!t}function Bu(e,t,n){function i(e,i,r){var o,s,a,l,c,h,p,d,f=i.waypoints,m=e.outgoing.slice(),g=e.incoming.slice(),y=Nc(f,d=u(r.width)?xn(r):r);if(y){if(o=f.slice(0,y.index),s=f.slice(y.index+(y.bendpoint?1:0)),!o.length||!s.length)return;a=y.bendpoint?f[y.index]:d,1!==o.length&&Lu(e,o[o.length-1])||o.push(Nu(a)),1!==s.length&&Lu(e,s[0])||s.unshift(Nu(a))}l=i.source,c=i.target,t.canConnect(l,e,i)&&(n.reconnectEnd(i,e,o||d),h=i),t.canConnect(e,c,i)&&(h?p=n.connect(e,c,{type:i.type,waypoints:s}):(n.reconnectStart(i,e,s||d),p=i));var b=[].concat(h&&v(g,(function(e){return e.source===h.source}))||[],p&&v(m,(function(e){return e.target===p.target}))||[]);b.length&&n.removeElements(b)}Vo.call(this,e),this.preExecute("elements.move",(function(e){var n=e.newParent,i=e.shapes,r=e.delta,o=i[0];if(o&&n){n&&n.waypoints&&(e.newParent=n=n.parent);var s=xn(o),a={x:s.x+r.x,y:s.y+r.y},l=m(n.children,(function(e){return t.canInsert(i,e)&&Nc(e.waypoints,a)}));l&&(e.targetFlow=l,e.position=a)}}),!0),this.postExecuted("elements.move",(function(e){var t=e.shapes,n=e.targetFlow,r=e.position;n&&i(t[0],n,r)}),!0),this.preExecute("shape.create",(function(e){var n=e.parent,i=e.shape;t.canInsert(i,n)&&(e.targetFlow=n,e.parent=n.parent)}),!0),this.postExecuted("shape.create",(function(e){var t=e.shape,n=e.targetFlow,r=e.position;n&&i(t,n,r)}),!0)}function Lu(e,t){var n=t.x,i=t.y;return n>=e.x&&n<=e.x+e.width&&i>=e.y&&i<=e.y+e.height}function Nu(e){return z({},e)}function zu(e,t){Vo.call(this,e),this.preExecuted("connection.create",(function(e){var n=e.context,i=n.connection,r=n.source,o=n.target,s=n.hints;if((!s||!1!==s.createElementsBehavior)&&$u(i)){(Er(r,"bpmn:EventBasedGateway")?o.incoming.filter((e=>e!==i&&$u(e))):o.incoming.filter((e=>e!==i&&$u(e)&&Er(e.source,"bpmn:EventBasedGateway")))).forEach((function(e){t.removeConnection(e)}))}})),this.preExecuted("shape.replace",(function(e){var n=e.context.newShape;Er(n,"bpmn:EventBasedGateway")&&n.outgoing.filter($u).reduce((function(e,t){return e.includes(t.target)?e:e.concat(t.target)}),[]).forEach((function(e){e.incoming.filter($u).forEach((function(i){const r=e.incoming.filter($u).filter((function(e){return e.source===n}));(i.source!==n||r.length>1)&&t.removeConnection(i)}))}))}))}function $u(e){return Er(e,"bpmn:SequenceFlow")}Tu.$inject=["bpmnReplace","injector"],e(Tu,Vo),Tu.prototype._replaceShape=function(e){var t,n,i=(n=Or(e).eventDefinitions)&&n[0];return t=i?{type:"bpmn:IntermediateCatchEvent",eventDefinitionType:i.$type}:{type:"bpmn:IntermediateThrowEvent"},this._bpmnReplace.replaceElement(e,t,{layoutConnection:!1})},e(Bu,Vo),Bu.$inject=["eventBus","bpmnRules","modeling"],zu.$inject=["eventBus","modeling"],e(zu,Vo);var Iu=1500;function ju(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"],Iu,(function(t){var i=t.context.shape||t.shape,r=t.hover;Er(r,"bpmn:Lane")&&!kr(i,["bpmn:Lane","bpmn:Participant"])&&(t.hover=Au(r),t.hoverGfx=e.getGraphics(t.hover));var o=n.getRootElement();r!==o&&(i.labelTarget||kr(i,["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"],Iu,(function(t){var n=t.hover;Er(n,"bpmn:Lane")&&(t.hover=Au(n)||n,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["bendpoint.move.hover"],Iu,(function(t){var n=t.context,i=t.hover,r=n.type;Er(i,"bpmn:Lane")&&/reconnect/.test(r)&&(t.hover=Au(i)||i,t.hoverGfx=e.getGraphics(t.hover))})),t.on(["connect.start"],Iu,(function(e){var t=e.context,n=t.start;Er(n,"bpmn:Lane")&&(t.start=Au(n)||n)})),t.on("shape.move.start",2e3,(function(e){var t=e.shape;Er(t,"bpmn:Lane")&&(e.shape=Au(t)||t)})),t.on("spaceTool.move",2e3,(function(e){var t=e.hover;t&&Er(t,"bpmn:Lane")&&(e.hover=Au(t))}))}ju.$inject=["elementRegistry","eventBus","canvas"];function Fu(e,t,n,i,r,o){function s(e,t,i){var r=n.filter((function(e){return Er(e,"bpmn:Group")})).filter((function(e){return e.businessObject!==i}));t&&!function(e,t){return e.some((function(e){var n=Or(e);return(n.categoryValueRef&&n.categoryValueRef.$parent)===t}))}(r,t)&&function(e){var t=e.$parent;t&&(kt(t.get("rootElements"),e),e.$parent=null)}(t),e&&!function(e,t){return e.some((function(e){return Or(e).categoryValueRef===t}))}(r,e)&&function(e){var t=e.$parent;t&&(kt(t.get("categoryValue"),e),e.$parent=null)}(e)}function a(e,n){return function(e,t,n){return Ot(t.get("categoryValue"),e),e.$parent=t,Ot(n.get("rootElements"),t),t.$parent=n,e}(e,n,t.getDefinitions())}function l(n,i){var r=Or(n),o=r.categoryValueRef;o||(o=r.categoryValueRef=i.categoryValue=i.categoryValue||function(e){return e.create("bpmn:CategoryValue")}(e));var s=o.$parent;s||(s=o.$parent=i.category=i.category||function(e){return e.create("bpmn:Category")}(e)),a(o,s,t.getDefinitions())}function c(e,t){var n=t.category,i=t.categoryValue,r=Or(e);i?(r.categoryValueRef=null,s(i,n,r)):s(null,r.categoryValueRef.$parent,r)}function h(t,n){var i=e.create(t.$type);return o.copyElement(t,i,null,n)}r.invoke(Vo,this),this.execute("label.create",(function(e){var t=e.context,n=t.labelTarget;Er(n,"bpmn:Group")&&l(n,t)})),this.revert("label.create",(function(e){var t=e.context,n=t.labelTarget;Er(n,"bpmn:Group")&&c(n,t)})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=Or(n);if(Er(n,"bpmn:Group")&&!n.labelTarget){var r=t.categoryValue=i.categoryValueRef;r&&(s(r,t.category=r.$parent,i),i.categoryValueRef=null)}})),this.reverted("shape.delete",(function(e){var t=e.context,n=t.shape;if(Er(n,"bpmn:Group")&&!n.labelTarget){var i=t.category,r=t.categoryValue,o=Or(n);r&&(o.categoryValueRef=r,a(r,i))}})),this.execute("shape.create",(function(e){var t=e.context,n=t.shape;Er(n,"bpmn:Group")&&!n.labelTarget&&Or(n).categoryValueRef&&l(n,t)})),this.reverted("shape.create",(function(e){var t=e.context,n=t.shape;Er(n,"bpmn:Group")&&!n.labelTarget&&Or(n).categoryValueRef&&c(n,t)})),i.on("copyPaste.copyElement",770,(function(e){var t=e.descriptor,n=e.element;if(Er(n,"bpmn:Group")&&!n.labelTarget){var i=Or(n);if(i.categoryValueRef){var r=i.categoryValueRef;t.categoryValue=h(r,!0),r.$parent&&(t.category=h(r.$parent,!0))}}})),i.on("copyPaste.pasteElement",770,(function(e){var t=e.descriptor,n=t.businessObject,i=t.categoryValue,r=t.category;i&&(i=n.categoryValueRef=h(i)),r&&(i.$parent=h(r)),delete t.category,delete t.categoryValue}))}function Hu(e,t,n,i){var r,o,s,a;return 0==(r=(i.y-n.y)*(t.x-e.x)-(i.x-n.x)*(t.y-e.y))?null:(o=e.y-n.y,s=e.x-n.x,a=((i.x-n.x)*o-(i.y-n.y)*s)/r,{x:Math.round(e.x+a*(t.x-e.x)),y:Math.round(e.y+a*(t.y-e.y))})}function Vu(e){function t(e,t,n){var i,r={x:n.x,y:n.y-50},o={x:n.x-50,y:n.y},s=Hu(e,t,n,r),a=Hu(e,t,n,o);i=s&&a?qu(s,n)>qu(a,n)?a:s:s||a,e.original=i}e.on("bpmnElement.added",(function(e){var n,i,r=e.element;r.waypoints&&(t((i=(n=r).waypoints)[0],i[1],xn(n.source)),t(i[i.length-1],i[i.length-2],xn(n.target)))}))}function qu(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Wu(e){Vo.call(this,e);var t=["bpmn:Participant","bpmn:Lane"];this.executed(["shape.move","shape.create","shape.resize"],(function(e){var n=e.context.shape,i=Or(n),r=Sr(n);if(kr(i,t)){var o=r.get("isHorizontal");void 0===o&&(o=!0),r.set("isHorizontal",o)}}))}Fu.$inject=["bpmnFactory","bpmnjs","elementRegistry","eventBus","injector","moddleCopy"],e(Fu,Vo),Vu.$inject=["eventBus"],Wu.$inject=["eventBus"],e(Wu,Vo);var Qu=Math.sqrt,Gu=Math.min,Xu=Math.max,Uu=Math.abs;function Yu(e){return Math.pow(e,2)}function Ku(e,t){return Qu(Yu(e.x-t.x)+Yu(e.y-t.y))}function Zu(e,t,n,i){var r=t.x-e.x,o=t.y-e.y,s=n.x-e.x,a=n.y-e.y,l=r*r+o*o,c=(r*s+o*a)/l,h=c*c-(s*s+a*a-i*i)/l;if(h<0&&h>-1e-6&&(h=0),h<0)return[];var u=Qu(h),p=-c+u,d=-c-u,f={x:e.x-r*p,y:e.y-o*p};return 0===h?[f]:[f,{x:e.x-r*d,y:e.y-o*d}].filter((function(n){return function(e,t,n){return Ju(e.x,t.x,n.x)&&Ju(e.y,t.y,n.y)}(n,e,t)}))}function Ju(e,t,n){return e>=Gu(t,n)-ep&&e<=Xu(t,n)+ep}var ep=.1;function tp(e,t){return Uu(e.x-t.x)<=ep&&Uu(e.y-t.y)<=ep}function np(e,t,n,i){var r=0,o=0,s={point:e,delta:{x:0,y:0}},a=function(e,t){var n,i,r,o,s,a,l,c,h,u,p,d,f=0;for(f=0;f<t.length-1;f++){if(tp(n=t[f],i=t[f+1])?a=[n]:(r=Ku(e,n),o=Ku(e,i),a=Zu(n,i,e,Gu(r,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:tp(n,a[0])?f:f+1}),2===a.length&&(p=a[0],d=a[1],l={type:"segment",position:s={x:(p.x+d.x)/2,y:(p.y+d.y)/2},segmentIndex:f,relativeLocation:Ku(n,s)/Ku(n,i)}),c=Ku(l.position,e),(!u||h>c)&&(u=l,h=c)}return u}(e,n),l=a.segmentIndex,c=function(e,t,n,i){var r=n.segmentIndex,o=t.length-e.length;if(i.segmentMove){var s=i.segmentMove.segmentStartIndex,a=i.segmentMove.newSegmentStartIndex;return r===s?a:r>=a?r+o<a?a:r+o:r}if(i.bendpointMove){var l,c=i.bendpointMove.insert,h=i.bendpointMove.bendpointIndex;return 0===o?r:(r>=h&&(l=c?r+1:r-1),r<h&&(l=r,c&&"bendpoint"!==n.type&&h-1===r&&ip(t,h)<n.relativeLocation&&l++),l)}return 0===o?r:i.connectionStart&&0===r?0:i.connectionEnd&&r===e.length-2?t.length-2:Math.floor((t.length-2)/2)}(n,t,a,i);if(c<0||c>t.length-2||null===c)return s;var h,u,p=rp(n,l),d=rp(t,c),f=a.position,m=function(e,t){var n=Fc(e[0],e[1]),i=Fc(e[0],t);return 0===n?0:i/n}(p,f),g=(h=d,u=$c(p),$c(h)-u);if("bendpoint"===a.type){var v=t.length-n.length,y=a.bendpointIndex,b=n[y];if(-1!==t.indexOf(b))return s;if(0===v){var x=t[y];return{delta:{x:r=x.x-a.position.x,y:o=x.y-a.position.y},point:{x:e.x+r,y:e.y+o}}}v<0&&0!==y&&y<n.length-1&&(m=ip(n,y))}var w,_,E={x:(d[1].x-d[0].x)*m+d[0].x,y:(d[1].y-d[0].y)*m+d[0].y},k=(w={x:e.x-f.x,y:e.y-f.y},(_=g)?{x:Math.cos(_)*w.x-Math.sin(_)*w.y,y:Math.sin(_)*w.x+Math.cos(_)*w.y}:w);return r=E.x+k.x-e.x,o=E.y+k.y-e.y,{point:gn(E),delta:gn({x:r,y:o})}}function ip(e,t){var n=Fc(e[t-1],e[t]);return n/(n+Fc(e[t],e[t+1]))}function rp(e,t){return[e[t],e[t+1]]}function op(e,t,n){var i=na(t),r=na(n),o=ia(e,i),s=o.x*(n.width/t.width),a=o.y*(n.height/t.height);return gn({x:r.x+s,y:r.y+a})}function sp(e,t,n){var i=na(e),r=na(t),o=na(n),s=ia(e,i),a=ia(i,r),l=function(e,t,n){var i=vn(t),r=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)}(i,r))return null;var o,s,a,l=wn(t,e);if("top"===l)o={x:0,y:r.bottom-i.bottom};else if("bottom"===l)o={x:0,y:r.top-i.top};else if("right"===l)o={x:r.left-i.left,y:0};else{if("left"!==l)return null;o={x:r.right-i.right,y:0}}if(s={x:e.x+o.x,y:e.y+o.y},a=wn(n,s),a!==l)return null;return o}(i,t,n);if(l)return l;var c=a.x*(n.width/t.width),h=a.y*(n.height/t.height),u=o.x+c,p=o.y+h;return gn({x:u+s.x-e.x,y:p+s.y-e.y})}var ap="name",lp="text";function cp(e,t,n,i){function r(e){var n=e.context,r=n.element,o=n.properties;if(ap in o&&t.updateLabel(r,o[ap]),lp in o&&Er(r,"bpmn:TextAnnotation")){var s=i.getTextAnnotationBounds({x:r.x,y:r.y,width:r.width,height:r.height},o[lp]||"");t.updateLabel(r,o.text,s)}}function o(e){var t=e.context,n=t.connection,i=n.label,r=z({},t.hints),o=t.newWaypoints||n.waypoints,s=t.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return np(xn(e),t,n,i).delta}(i,o,s,r)}Vo.call(this,e),this.postExecute("element.updateProperties",r),this.postExecute("element.updateModdleProperties",(e=>{Or(e.context.element)===e.context.moddleElement&&r(e)})),this.postExecute(["shape.create","connection.create"],(function(e){var n=e.context;if(!1!==(n.hints||{}).createElementsBehavior){var i=n.shape||n.connection;!fn(i)&&Yr(i)&&to(i)&&t.updateLabel(i,to(i))}})),this.postExecute("shape.delete",(function(e){var n=e.context,i=n.labelTarget,r=n.hints||{};i&&!1!==r.unsetLabel&&t.updateLabel(i,null,null,{removeShape:!1})})),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var n=e.context;if(!1!==(n.hints||{}).labelBehavior){var i,r=n.connection.label;r&&r.parent&&(i=o(e),t.moveShape(r,i))}})),this.postExecute(["shape.replace"],(function(e){var t=e.context,n=t.newShape,i=t.oldShape,r=Or(n);r&&Yr(r)&&i.label&&n.label&&(n.label.x=i.label.x,n.label.y=i.label.y)})),this.postExecute("shape.resize",(function(e){var n,i=e.context,r=i.shape,o=i.newBounds,s=i.oldBounds;if(Kr(r)){var a=r.label,l=function(e,t){if(!t.length)return;var n=function(e,t){var n=t.map((function(t){return{line:t,distance:jc(e,t)}}));return A(n,"distance")[0].line}(e,t);return Ic(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=hp(l,s,o);t.moveShape(a,c)}}))}function hp(e,t,n){return gn(ia(op(e,t,n),e))}function up(e,t){function n(e,t){var n=e.context,i=n.connection,r=z({},n.hints),o=n.newWaypoints||i.waypoints,s=n.oldWaypoints;return void 0===r.startChanged&&(r.startChanged=!!r.connectionStart),void 0===r.endChanged&&(r.endChanged=!!r.connectionEnd),function(e,t,n,i){return np(e,t,n,i).point}(t,o,s,r)}Vo.call(this,e),this.postExecute(["connection.layout","connection.updateWaypoints"],(function(e){var i=e.context.connection,r=i.outgoing;i.incoming.forEach((function(i){var r=i.waypoints[i.waypoints.length-1],o=n(e,r),s=[].concat(i.waypoints.slice(0,-1),[o]);t.updateWaypoints(i,s)})),r.forEach((function(i){var r=i.waypoints[0],o=n(e,r),s=[].concat([o],i.waypoints.slice(1));t.updateWaypoints(i,s)}))})),this.postExecute(["connection.move"],(function(e){var n=e.context,i=n.connection,r=i.outgoing,o=i.incoming,s=n.delta;o.forEach((function(e){var n=e.waypoints[e.waypoints.length-1],i={x:n.x+s.x,y:n.y+s.y},r=[].concat(e.waypoints.slice(0,-1),[i]);t.updateWaypoints(e,r)})),r.forEach((function(e){var n=e.waypoints[0],i={x:n.x+s.x,y:n.y+s.y},r=[].concat([i],e.waypoints.slice(1));t.updateWaypoints(e,r)}))}))}function pp(e,t,n){var i=vp(e),r=yp(i,t),o=i[0];return r.length?r[r.length-1]:op(o.original||o,n,t)}function dp(e,t,n){var i=vp(e),r=yp(i,t),o=i[i.length-1];return r.length?r[0]:op(o.original||o,n,t)}function fp(e,t,n){var i=vp(e),r=gp(t,n),o=i[0];return op(o.original||o,r,t)}function mp(e,t,n){var i=vp(e),r=gp(t,n),o=i[i.length-1];return op(o.original||o,r,t)}function gp(e,t){return{x:e.x-t.x,y:e.y-t.y,width:e.width,height:e.height}}function vp(e){var t=e.waypoints;if(!t.length)throw new Error("connection#"+e.id+": no waypoints");return t}function yp(e,t){return v(E(e,bp),(function(e){return function(e,t){return"intersect"===wn(t,e,1)}(e,t)}))}function bp(e){return e.original||e}function xp(e,t){Vo.call(this,e),this.postExecute("shape.replace",(function(e){var n=e.oldShape,i=e.newShape;if(function(e,t){return Er(e,"bpmn:Participant")&&Vr(e)&&Er(t,"bpmn:Participant")&&!Vr(t)}(n,i)){var r,o,s,a,l=(o=gt([r=n],!1),s=[],a=[],o.forEach((function(e){e!==r&&(e.incoming.forEach((function(e){Er(e,"bpmn:MessageFlow")&&s.push(e)})),e.outgoing.forEach((function(e){Er(e,"bpmn:MessageFlow")&&a.push(e)})))}),[]),{incoming:s,outgoing:a});l.incoming.forEach((function(e){var r=dp(e,i,n);t.reconnectEnd(e,i,r)})),l.outgoing.forEach((function(e){var r=pp(e,i,n);t.reconnectStart(e,i,r)}))}}),!0)}e(cp,Vo),cp.$inject=["eventBus","modeling","bpmnFactory","textRenderer"],e(up,Vo),up.$inject=["eventBus","modeling"],xp.$inject=["eventBus","modeling"],e(xp,Vo);const wp=["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:EscalationEventDefinition","bpmn:ConditionalEventDefinition","bpmn:SignalEventDefinition"];function _p(e){const t=Or(e);if(!(Er(t,"bpmn:BoundaryEvent")||Er(t,"bpmn:StartEvent")&&Qr(t.$parent)))return!1;const n=t.get("eventDefinitions");return!(!n||!n.length)&&wp.some((e=>Er(n[0],e)))}function Ep(e){return Er(e,"bpmn:BoundaryEvent")?"cancelActivity":"isInterrupting"}function kp(e,t){e.invoke(Vo,this),this.postExecuted("shape.replace",(function(e){const n=e.context.oldShape,i=e.context.newShape,r=e.context.hints;if(!_p(i))return;const o=Ep(i);if(r.targetElement&&void 0!==r.targetElement[o])return;const s=Or(n).get(o);s!==Or(i).get(o)&&t.updateProperties(i,{[o]:s})}))}function Op(e,t){Vo.call(this,e),this.preExecute("shape.resize",(function(e){var n=e.shape,i=Sr(n),r=i&&i.get("label");r&&r.get("bounds")&&t.updateModdleProperties(n,r,{bounds:void 0})}),!0)}function Sp(e,t,n){Vo.call(this,e),this.preExecute("shape.delete",(function(e){var i=e.context.shape;if(1===i.incoming.length&&1===i.outgoing.length){var r=i.incoming[0],o=i.outgoing[0];if(Er(r,"bpmn:SequenceFlow")&&Er(o,"bpmn:SequenceFlow")&&t.canConnect(r.source,o.target,r)){var s=function(e,t){var n=Hu(Cp(e[e.length-2]),Cp(e[e.length-1]),Cp(t[1]),Cp(t[0]));return n?[].concat(e.slice(0,e.length-1),[n],t.slice(1)):[Cp(e[0]),Cp(t[t.length-1])]}(r.waypoints,o.waypoints);n.reconnectEnd(r,o.target,s)}}}))}function Cp(e){return e.original||e}function Pp(e,t){Vo.call(this,e),this.preExecute("shape.delete",(function(e){var t=e.shape,n=t.parent;Er(t,"bpmn:Participant")&&(e.collaborationRoot=n)}),!0),this.postExecute("shape.delete",(function(e){var n=e.collaborationRoot;if(n&&!n.businessObject.participants.length){var i=t.makeProcess(),r=n.children.slice();t.moveElements(r,{x:0,y:0},i)}}),!0)}function Ap(e,t,n,i){Vo.call(this,e);var r=i.get("dragging",!1);function o(e){var i,r,o=e.source,s=e.target;e.parent&&(Er(e,"bpmn:SequenceFlow")&&(n.canConnectSequenceFlow(o,s)||(r=!0),n.canConnectMessageFlow(o,s)&&(i="bpmn:MessageFlow")),Er(e,"bpmn:MessageFlow")&&(n.canConnectMessageFlow(o,s)||(r=!0),n.canConnectSequenceFlow(o,s)&&(i="bpmn:SequenceFlow")),r&&t.removeConnection(e),i&&t.connect(o,s,{type:i,waypoints:e.waypoints.slice()}))}this.postExecuted("elements.move",(function(e){y(e.closure.allConnections,o)}),!0),this.preExecute("connection.reconnect",(function(e){var i,o,s=e.context,a=s.connection,l=s.newSource||a.source,c=s.newTarget||a.target;(i=n.canConnect(l,c))&&i.type!==a.type&&(o=t.connect(l,c,{type:i.type,associationDirection:i.associationDirection,waypoints:a.waypoints.slice()}),a.parent&&t.removeConnection(a),s.connection=o,r&&function(e,t){var n,i=r.context(),o=i&&i.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,i=e.context,r=i.properties,o=i.element,s=o.businessObject;r.default&&(n=m(o.outgoing,M({id:o.businessObject.default.id})))&&t.updateProperties(n,{conditionExpression:void 0}),r.conditionExpression&&s.sourceRef.default===s&&t.updateProperties(o.source,{default:void 0})}))}function Mp(e,t,n,i,r,o){i.invoke(Vo,this),this._bpmnReplace=e,this._elementRegistry=n,this._selection=o,this.postExecuted(["elements.create"],500,(function(e){var n=e.context,i=n.parent,r=n.elements,o=x(r,(function(e,n){var r=t.canReplace([n],n.host||n.parent||i);return r?e.concat(r.replacements):e}),[]);o.length&&this._replaceElements(r,o)}),this),this.postExecuted(["elements.move"],500,(function(e){var n=e.context,i=n.newParent,r=n.newHost,o=[];y(n.closure.topLevel,(function(e){o=Qr(e)?o.concat(e.children):o.concat(e)})),1===o.length&&r&&(i=r);var s=t.canReplace(o,i);s&&this._replaceElements(o,s.replacements,r)}),this),this.postExecute(["shape.replace"],1500,(function(e){var n,i=e.context,r=i.oldShape,o=i.newShape,s=r.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,i=t.newShape;r.unclaimId(n.businessObject.id,n.businessObject),r.updateProperties(i,{id:n.id})}))}kp.$inject=["injector","modeling"],e(kp,Vo),e(Op,Vo),Op.$inject=["eventBus","modeling"],e(Sp,Vo),Sp.$inject=["eventBus","bpmnRules","modeling"],Pp.$inject=["eventBus","modeling"],e(Pp,Vo),e(Ap,Vo),Ap.$inject=["eventBus","modeling","bpmnRules","injector"],e(Mp,Vo),Mp.prototype._replaceElements=function(e,t){var n=this._elementRegistry,i=this._bpmnReplace,r=this._selection;y(t,(function(t){var r={type:t.newElementType},o=n.get(t.oldElementId),s=e.indexOf(o);e[s]=i.replaceElement(o,r,{select:!1})})),t&&r.select(e)},Mp.$inject=["bpmnReplace","bpmnRules","elementRegistry","injector","modeling","selection"];var Rp={width:140,height:120},Tp={width:300,height:60},Dp={width:60,height:300},Bp={width:300,height:150},Lp={width:150,height:300},Np={width:140,height:120},zp={width:50,height:30};function $p(e){e.on("resize.start",1500,(function(e){var t=e.context,n=t.shape,i=t.direction,r=t.balanced;(Er(n,"bpmn:Lane")||Er(n,"bpmn:Participant"))&&(t.resizeConstraints=function(e,t,n){var i=Au(e),r=!0,o=!0,s=Cu(i,[i]),a=vn(e),l={},c={},h=qr(e),u=h?Tp:Dp;/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 i=vn(e);h?(i.top<a.top-10&&(r=!1),i.bottom>a.bottom+10&&(o=!1)):(i.left<a.left-10&&(r=!1),i.right>a.right+10&&(o=!1)),/n/.test(t)&&(n&&Ip(a.top-i.bottom)<10&&qp(l,"top",i.top+u.height),Ip(a.top-i.top)<5&&Vp(c,"top",i.bottom-u.height)),/e/.test(t)&&(n&&Ip(a.right-i.left)<10&&Vp(l,"right",i.right-u.width),Ip(a.right-i.right)<5&&qp(c,"right",i.left+u.width)),/s/.test(t)&&(n&&Ip(a.bottom-i.top)<10&&Vp(l,"bottom",i.bottom-u.height),Ip(a.bottom-i.bottom)<5&&qp(c,"bottom",i.top+u.height)),/w/.test(t)&&(n&&Ip(a.left-i.right)<10&&qp(l,"left",i.left+u.width),Ip(a.left-i.left)<5&&Vp(c,"left",i.right-u.width))}));var p=i.children.filter((function(e){return!e.hidden&&!e.waypoints&&(Er(e,"bpmn:FlowElement")||Er(e,"bpmn:Artifact"))})),d=h?Wp:Qp;return p.forEach((function(e){var n=vn(e);!/n/.test(t)||h&&!r||Vp(c,"top",n.top-d.top),/e/.test(t)&&(h||o)&&qp(c,"right",n.right+d.right),!/s/.test(t)||h&&!o||qp(c,"bottom",n.bottom+d.bottom),/w/.test(t)&&(h||r)&&Vp(c,"left",n.left-d.left)})),{min:c,max:l}}(n,i,r)),Er(n,"bpmn:SubProcess")&&Vr(n)&&(t.minDimensions=Np),Er(n,"bpmn:TextAnnotation")&&(t.minDimensions=zp)}))}$p.$inject=["eventBus"];var Ip=Math.abs,jp=Math.min,Fp=Math.max;function Hp(e,t,n,i){var r=e[t];e[t]=void 0===r?n:i(n,r)}function Vp(e,t,n){return Hp(e,t,n,jp)}function qp(e,t,n){return Hp(e,t,n,Fp)}var Wp={top:20,left:50,right:20,bottom:20},Qp={top:50,left:20,right:20,bottom:20};function Gp(e,t){e.on("resize.start",1501,(function(e){var t=e.context,n=t.shape;(Er(n,"bpmn:Lane")||Er(n,"bpmn:Participant"))&&(t.balanced=!bs(e))})),e.on("resize.end",1001,(function(e){var n=e.context,i=n.shape,r=n.canExecute,o=n.newBounds;if(Er(i,"bpmn:Lane")||Er(i,"bpmn:Participant"))return r&&(o=mn(o),t.resizeLane(i,o,n.balanced)),!1}))}Gp.$inject=["eventBus","modeling"];function Xp(e,t,n,i,r){function o(e){return kr(e,["bpmn:ReceiveTask","bpmn:SendTask"])||function(e,t){c(t)||(t=[t]);return _(t,(function(t){return Gr(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 Er(e,"bpmn:ErrorEventDefinition")?"errorRef":Er(e,"bpmn:EscalationEventDefinition")?"escalationRef":Er(e,"bpmn:MessageEventDefinition")?"messageRef":Er(e,"bpmn:SignalEventDefinition")?"signalRef":void 0}function l(e){if(kr(e,["bpmn:ReceiveTask","bpmn:SendTask"]))return e.get("messageRef");var t=e.get("eventDefinitions")[0];return t.get(a(t))}n.invoke(Vo,this),this.executed(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.shape||t.element;if(o(n)){var i=l(Or(n));i&&!s(i)&&(Ot(e.getDefinitions().get("rootElements"),i),t.addedRootElement=i)}}),!0),this.reverted(["shape.create","element.updateProperties","element.updateModdleProperties"],(function(t){var n=t.addedRootElement;n&&kt(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 i=l(Or(n));i&&(t.referencedRootElement=i)}})),t.on("copyPaste.pasteElement",500,(function(e){var t=e.descriptor,n=t.businessObject,o=t.referencedRootElement;o&&(s(o)||(o=i.copyElement(o,r.create(o.$type))),function(e,t){if(kr(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)}))}Xp.$inject=["bpmnjs","eventBus","injector","moddleCopy","bpmnFactory"],e(Xp,Vo);var Up=Math.max;function Yp(e){e.on("spaceTool.getMinDimensions",(function(e){var t=e.shapes,n=e.axis,i=e.start,r={};return y(t,(function(e){var t=e.id;Er(e,"bpmn:Participant")&&(r[t]=function(e,t,n){var i=qr(e);if(r=e,!Pu(r).length)return i?Bp:Lp;var r;var o=function(e){return"x"===e}(t),s={};s=o?i?Bp:{width:Zp(e,n,o),height:Lp.height}:i?{width:Bp.width,height:Kp(e,n,o)}:Lp;return s}(e,n,i)),Er(e,"bpmn:Lane")&&(r[t]=qr(e)?Tp:Dp),Er(e,"bpmn:SubProcess")&&Vr(e)&&(r[t]=Np),Er(e,"bpmn:TextAnnotation")&&(r[t]=zp),Er(e,"bpmn:Group")&&(r[t]=Rp)})),r}))}function Kp(e,t,n){var i;return i=function(e,t,n){var i,r=Pu(e);return i=Jp(r,t,n),e.height-i.height+Tp.height}(e,t,n),Up(Bp.height,i)}function Zp(e,t,n){var i;return i=function(e,t,n){var i,r=Pu(e);return i=Jp(r,t,n),e.width-i.width+Dp.width}(e,t,n),Up(Lp.width,i)}function Jp(e,t,n){var i,r,o;for(i=0;i<e.length;i++)if(r=e[i],!n&&t>=r.y&&t<=r.y+r.height||n&&t>=r.x&&t<=r.x+r.width)return(o=Pu(r)).length?Jp(o,t,n):r}Yp.$inject=["eventBus"];var ed=180,td=160;function nd(e,t,n,i,r,o,s){Vo.call(this,t),this._canvas=e,this._eventBus=t,this._modeling=n,this._elementFactory=i,this._bpmnFactory=r,this._bpmnjs=o,this._elementRegistry=s;var a=this;function l(e){return Er(e,"bpmn:SubProcess")&&!Vr(e)}function c(t){var n=t.shape,i=t.newRootElement,r=Or(n);i=a._addDiagram(i||r),t.newRootElement=e.addRootElement(i)}function h(t){var n=Or(t.shape);a._removeDiagram(n);var i=t.newRootElement=s.get(Zo(n));e.removeRootElement(i)}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)&&h(e)}),!0),this.preExecuted("shape.delete",(function(e){var t=e.shape;if(l(t)){var i=s.get(Zo(t));i&&n.removeElements(i.children.slice())}}),!0),this.executed("shape.delete",(function(e){l(e.shape)&&h(e)}),!0),this.reverted("shape.delete",(function(e){l(e.shape)&&c(e)}),!0),this.preExecuted("shape.replace",(function(t){var n=t.oldShape,i=t.newShape;l(n)&&l(i)&&(t.oldRoot=e.removeRootElement(Zo(n)))}),!0),this.postExecuted("shape.replace",(function(t){var i=t.newShape,r=t.oldRoot,o=e.findRoot(Zo(i));if(r&&o){var s=r.children;n.moveElements(s,{x:0,y:0},o)}}),!0),this.executed("element.updateProperties",(function(e){var t=e.element;if(Er(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(es(t))return s.updateId(t,Jo(r)),void s.updateId(i,r);s.get(Jo(i))&&s.updateId(Jo(i),Jo(r))}}}),!0),this.reverted("element.updateProperties",(function(e){var t=e.element;if(Er(t,"bpmn:SubProcess")){var n=e.properties,i=e.oldProperties.id,r=n.id;if(i!==r){if(es(t))return s.updateId(t,Jo(i)),void s.updateId(r,i);var o=s.get(Jo(r));o&&s.updateId(o,Jo(i))}}}),!0),t.on("element.changed",(function(e){var n=e.element;if(es(n)){var i=n,r=s.get(Ko(i));r&&r!==i&&t.fire("element.changed",{element:r})}})),this.executed("shape.toggleCollapse",400,(function(e){var t=e.shape;Er(t,"bpmn:SubProcess")&&(Vr(t)?h(e):(c(e),a._showRecursively(t.children)))}),!0),this.reverted("shape.toggleCollapse",400,(function(e){var t=e.shape;Er(t,"bpmn:SubProcess")&&(Vr(t)?h(e):(c(e),a._showRecursively(t.children)))}),!0),this.postExecuted("shape.toggleCollapse",600,(function(e){var t=e.shape;if(Er(t,"bpmn:SubProcess")){var n=e.newRootElement;n&&(Vr(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 i=Zo(t),r=s.get(i);r&&n.push.apply(n,r.children)}})),t.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements,r=n.parent;if(Er(Sr(r),"bpmndi:BPMNPlane")){var o=Ko(r),s=m(i,(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 id(e,t){e.invoke(Vo,this),this.postExecuted("shape.replace",(function(e){var n=e.context.oldShape,i=e.context.newShape;if(Er(i,"bpmn:SubProcess")&&!Er(i,"bpmn:AdHocSubProcess")&&(Er(n,"bpmn:Task")||Er(n,"bpmn:CallActivity"))&&Vr(i)){var r,o={x:(r=i).x+r.width/6,y:r.y+r.height/2};t.createShape({type:"bpmn:StartEvent"},o,i)}}))}function rd(e){Vo.call(this,e),this.preExecute("connection.create",(function(e){const{target:t}=e;Er(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&&Er(t[0],"bpmn:TextAnnotation")&&(e.hints=e.hints||{},e.hints.autoResize=!1)}),!0)}function od(e,t){Vo.call(this,e),this.postExecuted("shape.toggleCollapse",1500,(function(e){var n=e.shape;if(!Vr(n)){var i=gt(n);i.forEach((function(e){var t=e.incoming.slice(),n=e.outgoing.slice();y(t,(function(e){r(e,!0)})),y(n,(function(e){r(e,!1)}))}))}function r(e,r){-1!==i.indexOf(e.source)&&-1!==i.indexOf(e.target)||(r?t.reconnectEnd(e,n,xn(n)):t.reconnectStart(e,n,xn(n)))}}),!0)}e(nd,Vo),nd.prototype._moveChildrenToShape=function(e,t){var n,i=this._modeling,r=e.children;if(r){var o=(r=r.concat(r.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:ed-s.x,y:td-s.y};i.moveElements(r,n,t,{autoResize:!1})}else i.moveElements(r,{x:0,y:0},t,{autoResize:!1})}},nd.prototype._showRecursively=function(e,t){var n=this,i=[];return e.forEach((function(e){e.hidden=!!t,i=i.concat(e),e.children&&(i=i.concat(n._showRecursively(e.children,e.collapsed||t)))})),i},nd.prototype._addDiagram=function(e){var t=this._bpmnjs.getDefinitions().diagrams;return e.businessObject||(e=this._createNewDiagram(e)),t.push(e.di.$parent),e},nd.prototype._createNewDiagram=function(e){var t=this._bpmnFactory,n=this._elementFactory,i=t.create("bpmndi:BPMNPlane",{bpmnElement:e}),r=t.create("bpmndi:BPMNDiagram",{plane:i});return i.$parent=r,n.createRoot({id:Zo(e),type:e.$type,di:i,businessObject:e,collapsed:!0})},nd.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},nd.$inject=["canvas","eventBus","modeling","elementFactory","bpmnFactory","bpmnjs","elementRegistry"],id.$inject=["injector","modeling"],e(id,Vo),e(rd,Vo),rd.$inject=["eventBus"],e(od,Vo),od.$inject=["eventBus","modeling"];function sd(e,t,n){Vo.call(this,e),this.executed(["shape.toggleCollapse"],500,(function(e){var t,n=e.context.shape;Er(n,"bpmn:SubProcess")&&(n.collapsed?Sr(n).isExpanded=!1:((t=n.children).length&&t.forEach((function(e){"label"!==e.type||e.businessObject.name||(e.hidden=!0)})),Sr(n).isExpanded=!0))})),this.reverted(["shape.toggleCollapse"],500,(function(e){var t=e.context.shape;t.collapsed?Sr(t).isExpanded=!1:Sr(t).isExpanded=!0})),this.postExecuted(["shape.toggleCollapse"],500,(function(e){var i,r=e.context.shape,o=t.getDefaultSize(r);i=r.collapsed?function(e,t){return{x:e.x+(e.width-t.width)/2,y:e.y+(e.height-t.height)/2,width:t.width,height:t.height}}(r,o):function(e,t){var n,i,r,o=e.children,s=t;return n=(r=o,r.filter((function(e){return!e.hidden}))).concat([e]),(i=Eu(n))?(s.width=Math.max(i.width,s.width),s.height=Math.max(i.height,s.height),s.x=i.x+(i.width-s.width)/2,s.y=i.y+(i.height-s.height)/2):(s.x=e.x+(e.width-s.width)/2,s.y=e.y+(e.height-s.height)/2),s}(r,o),n.resizeShape(r,i,null,{autoResize:!r.collapsed&&"nwse"})}))}function ad(e,t,n,i){t.invoke(Vo,this),this.preExecute("shape.delete",(function(e){var t=e.context.shape,r=t.businessObject;fn(t)||(Er(t,"bpmn:Participant")&&Vr(t)&&n.ids.unclaim(r.processRef.id),i.unclaimId(r.id,r))})),this.preExecute("connection.delete",(function(e){var t=e.context.connection.businessObject;i.unclaimId(t.id,t)})),this.preExecute("canvas.updateRoot",(function(){var t=e.getRootElement(),i=t.businessObject;Er(t,"bpmn:Collaboration")&&n.ids.unclaim(i.id)}))}function ld(e,t){Vo.call(this,e),this.preExecute("connection.delete",(function(e){var n=e.context.connection,i=n.source;(function(e,t){if(!Er(e,"bpmn:SequenceFlow"))return!1;var n=Or(t),i=Or(e);return n.get("default")===i})(n,i)&&t.updateProperties(i,{default:null})}))}e(sd,Vo),sd.$inject=["eventBus","elementFactory","modeling"],e(ad,Vo),ad.$inject=["canvas","injector","moddle","modeling"],e(ld,Vo),ld.$inject=["eventBus","modeling"];function cd(e,t){var n;function i(){if(!n)throw new Error("out of bounds release");return n}Vo.call(this,e);var r=["spaceTool","lane.add","lane.resize","lane.split","elements.create","elements.delete","elements.move","shape.create","shape.delete","shape.move","shape.resize"];this.preExecute(r,5e3,(function(e){(n=n||new hd).enter()})),this.postExecuted(r,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=i();t.labelTarget||(Er(t,"bpmn:Lane")&&n.addLane(t),Er(t,"bpmn:FlowNode")&&n.addFlowNode(t))}))}function hd(){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 ud(e,t){Vo.call(this,e),this.postExecuted("elements.create",(function(e){const n=e.context.elements;for(const e of n)pd(e)&&!dd(e)&&t.updateProperties(e,{isForCompensation:void 0})}))}function pd(e){const t=Or(e);return t&&t.isForCompensation}function dd(e){return e.incoming.filter((e=>function(e){return e&&Er(e,"bpmn:BoundaryEvent")&&Gr(e,"bpmn:CompensateEventDefinition")}(e.source))).length>0}cd.$inject=["eventBus","modeling"],e(cd,Vo),e(ud,Vo),ud.$inject=["eventBus","modeling"];var fd={__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",Gh],appendBehavior:["type",Uh],associationBehavior:["type",Yh],attachEventBehavior:["type",Kh],boundaryEventBehavior:["type",Jh],compensateBoundaryEventBehaviour:["type",eu],createBehavior:["type",ru],createDataObjectBehavior:["type",ou],createParticipantBehavior:["type",hu],dataInputAssociationBehavior:["type",pu],dataStoreBehavior:["type",mu],deleteLaneBehavior:["type",Ru],detachEventBehavior:["type",Tu],dropOnFlowBehavior:["type",Bu],eventBasedGatewayBehavior:["type",zu],fixHoverBehavior:["type",ju],groupBehavior:["type",Fu],importDockingFix:["type",Vu],isHorizontalFix:["type",Wu],labelBehavior:["type",cp],layoutConnectionBehavior:["type",up],messageFlowBehavior:["type",xp],nonInterruptingBehavior:["type",kp],removeElementBehavior:["type",Sp],removeEmbeddedLabelBoundsBehavior:["type",Op],removeParticipantBehavior:["type",Pp],replaceConnectionBehavior:["type",Ap],replaceElementBehaviour:["type",Mp],resizeBehavior:["type",$p],resizeLaneBehavior:["type",Gp],rootElementReferenceBehavior:["type",Xp],spaceToolBehavior:["type",Yp],subProcessPlaneBehavior:["type",nd],subProcessStartEventBehavior:["type",id],textAnnotationBehavior:["type",rd],toggleCollapseConnectionBehaviour:["type",od],toggleElementCollapseBehaviour:["type",sd],unclaimIdBehavior:["type",ad],unsetDefaultFlowBehavior:["type",ld],updateFlowNodeRefsBehavior:["type",cd],setCompensationActivityAfterPasteBehavior:["type",ud]};function md(e,t){var n=wn(e,t,-15);return"intersect"!==n?n:null}function gd(e){Yl.call(this,e)}function vd(e){return!e||fn(e)}function yd(e){do{if(Er(e,"bpmn:Process"))return Or(e);if(Er(e,"bpmn:Participant"))return Or(e).processRef||Or(e)}while(e=e.parent)}function bd(e){return Er(e,"bpmn:TextAnnotation")}function xd(e){return Er(e,"bpmn:Group")&&!e.labelTarget}function wd(e){return Er(e,"bpmn:BoundaryEvent")&&Od(e,"bpmn:CompensateEventDefinition")}function _d(e){return Or(e).isForCompensation}function Ed(e){for(var t=e;t=t.parent;){if(Er(t,"bpmn:FlowElementsContainer"))return Or(t);if(Er(t,"bpmn:Participant"))return Or(t).processRef}return null}function kd(e,t){return Ed(e)===Ed(t)}function Od(e,t){return!!m(Or(e).eventDefinitions||[],(function(e){return Er(e,t)}))}function Sd(e,t){return(Or(e).eventDefinitions||[]).every((function(e){return Er(e,t)}))}function Cd(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 Pd(e,t,n){if(vd(e)||vd(t))return null;if(!Er(n,"bpmn:DataAssociation")){if(Hd(e,t))return{type:"bpmn:MessageFlow"};if(Vd(e,t))return{type:"bpmn:SequenceFlow"}}var i=qd(e,t);return i||(Fd(e,t)?{type:"bpmn:Association",associationDirection:"One"}:!!jd(e,t)&&{type:"bpmn:Association",associationDirection:"None"})}function Ad(e,t){return!(!fn(e)&&!xd(e))||!(Er(t,"bpmn:Participant")&&!Vr(t))&&(Er(e,"bpmn:Participant")?Er(t,"bpmn:Process")||Er(t,"bpmn:Collaboration"):kr(e,["bpmn:DataInput","bpmn:DataOutput"])&&e.parent?t===e.parent:Er(e,"bpmn:Lane")?Er(t,"bpmn:Participant")||Er(t,"bpmn:Lane"):!(Er(e,"bpmn:BoundaryEvent")&&!function(e){return Or(e).cancelActivity&&(Td(e)||Dd(e))}(e))&&(Er(e,"bpmn:FlowElement")&&!Er(e,"bpmn:DataStoreReference")?Er(t,"bpmn:FlowElementsContainer")?Vr(t):kr(t,["bpmn:Participant","bpmn:Lane"]):Er(e,"bpmn:DataStoreReference")&&Er(t,"bpmn:Collaboration")?_(Or(t).get("participants"),(function(e){return!!e.get("processRef")})):kr(e,["bpmn:Artifact","bpmn:DataAssociation","bpmn:DataStoreReference"])?kr(t,["bpmn:Collaboration","bpmn:Lane","bpmn:Participant","bpmn:Process","bpmn:SubProcess"]):!!Er(e,"bpmn:MessageFlow")&&(Er(t,"bpmn:Collaboration")||e.source.parent==t||e.target.parent==t)))}function Md(e){return Er(e,"bpmn:Lane")}function Rd(e){return!!function(e){return!fn(e)&&Er(e,"bpmn:BoundaryEvent")}(e)||(!(!Er(e,"bpmn:IntermediateThrowEvent")||!Td(e))||Er(e,"bpmn:IntermediateCatchEvent")&&Dd(e))}function Td(e){var t=Or(e);return t&&!(t.eventDefinitions&&t.eventDefinitions.length)}function Dd(e){return Bd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])}function Bd(e,t){return t.some((function(t){return Od(e,t)}))}function Ld(e,t,n,i){if(Array.isArray(e)||(e=[e]),1!==e.length)return!1;var r=e[0];return!fn(r)&&(!!Rd(r)&&(!Qr(t)&&(!(!Er(t,"bpmn:Activity")||_d(t))&&(!(i&&!md(i,t))&&(!function(e){return Er(e,"bpmn:ReceiveTask")&&m(e.incoming,(function(e){return Er(e.source,"bpmn:EventBasedGateway")}))}(t)&&"attach")))))}function Nd(e,t,n){if(!t)return!1;var i={replacements:[]};return y(e,(function(e){Qr(t)||Er(e,"bpmn:StartEvent")&&"label"!==e.type&&Ad(e,t)&&(Wr(e)||i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),(function(e){return Gr(e,"bpmn:ErrorEventDefinition")}(e)||function(e){return Gr(e,"bpmn:EscalationEventDefinition")}(e)||function(e){return Gr(e,"bpmn:CompensateEventDefinition")}(e))&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"}),Bd(e,["bpmn:MessageEventDefinition","bpmn:TimerEventDefinition","bpmn:SignalEventDefinition","bpmn:ConditionalEventDefinition"])&&Er(t,"bpmn:SubProcess")&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:StartEvent"})),Er(t,"bpmn:Transaction")||Od(e,"bpmn:CancelEventDefinition")&&"label"!==e.type&&(Er(e,"bpmn:EndEvent")&&Ad(e,t)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:EndEvent"}),Er(e,"bpmn:BoundaryEvent")&&Ld(e,t,0,n)&&i.replacements.push({oldElementId:e.id,newElementType:"bpmn:BoundaryEvent"}))})),!!i.replacements.length&&i}function zd(e,t){return!_(e,Md)&&(!t||e.every((function(e){return Ad(e,t)})))}function $d(e,t,n,i){return!!t&&(!(!fn(e)&&!xd(e))||!function(e,t){return e===t}(n,t)&&((!n||!Cd(n,t))&&(Ad(e,t)||Wd(e,t))))}function Id(e,t){return Er(e,"bpmn:SubProcess")?Vr(e)&&(!t||t.width>=100&&t.height>=80):!!Er(e,"bpmn:Lane")||(!!Er(e,"bpmn:Participant")||(!!bd(e)||!!xd(e)))}function jd(e,t){return!Cd(t,e)&&!Cd(e,t)&&(!!function(e,t){var n=bd(e),i=bd(t);return(n||i)&&n!==i}(e,t)||!!qd(e,t))}function Fd(e,t){return kd(e,t)&&wd(e)&&Er(t,"bpmn:Activity")&&(n=e,!t.attachers.includes(n))&&!Qr(t);var n}function Hd(e,t){return!(Gd(e)&&!Gd(t))&&(Er(n=e,"bpmn:InteractionNode")&&!Er(n,"bpmn:BoundaryEvent")&&(!Er(n,"bpmn:Event")||Er(n,"bpmn:ThrowEvent")&&Sd(n,"bpmn:MessageEventDefinition"))&&function(e){return Er(e,"bpmn:InteractionNode")&&!_d(e)&&(!Er(e,"bpmn:Event")||Er(e,"bpmn:CatchEvent")&&Sd(e,"bpmn:MessageEventDefinition"))&&!(Er(e,"bpmn:BoundaryEvent")&&!Od(e,"bpmn:MessageEventDefinition"))}(t)&&!function(e,t){return yd(e)===yd(t)}(e,t));var n}function Vd(e,t){return Er(n=e,"bpmn:FlowNode")&&!Er(n,"bpmn:EndEvent")&&!Qr(n)&&!(Er(n,"bpmn:IntermediateThrowEvent")&&Od(n,"bpmn:LinkEventDefinition"))&&!wd(n)&&!_d(n)&&function(e){return Er(e,"bpmn:FlowNode")&&!Er(e,"bpmn:StartEvent")&&!Er(e,"bpmn:BoundaryEvent")&&!Qr(e)&&!(Er(e,"bpmn:IntermediateCatchEvent")&&Od(e,"bpmn:LinkEventDefinition"))&&!_d(e)}(t)&&kd(e,t)&&!(Er(e,"bpmn:EventBasedGateway")&&!function(e){return Er(e,"bpmn:ReceiveTask")||Er(e,"bpmn:IntermediateCatchEvent")&&(Od(e,"bpmn:MessageEventDefinition")||Od(e,"bpmn:TimerEventDefinition")||Od(e,"bpmn:ConditionalEventDefinition")||Od(e,"bpmn:SignalEventDefinition"))}(t));var n}function qd(e,t){return kr(e,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&kr(t,["bpmn:Activity","bpmn:ThrowEvent"])?{type:"bpmn:DataInputAssociation"}:!(!kr(t,["bpmn:DataObjectReference","bpmn:DataStoreReference"])||!kr(e,["bpmn:Activity","bpmn:CatchEvent"]))&&{type:"bpmn:DataOutputAssociation"}}function Wd(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&&(kr(t,["bpmn:SequenceFlow","bpmn:MessageFlow"])&&!fn(t)&&Er(e,"bpmn:FlowNode")&&!Er(e,"bpmn:BoundaryEvent")&&Ad(e,t.parent))}function Qd(e,t){return!!fn(t)||!(Er(t,"bpmn:Lane")&&!function(e,t){return e&&t&&-1!==e.indexOf(t)}(e,t.parent))}function Gd(e){return hc(e,"bpmn:Process")||hc(e,"bpmn:Collaboration")}e(gd,Yl),gd.$inject=["eventBus"],gd.prototype.init=function(){this.addRule("connection.start",(function(e){return function(e){if(vd(e))return null;return kr(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,i=e.hints||{},r=i.targetParent;if(i.targetAttach)return!1;r&&(n.parent=r);try{return Pd(t,n)}finally{r&&(n.parent=null)}})),this.addRule("connection.reconnect",(function(e){var t=e.connection;return Pd(e.source,e.target,t)})),this.addRule("connection.updateWaypoints",(function(e){return{type:e.connection.type}})),this.addRule("shape.resize",(function(e){return Id(e.shape,e.newBounds)})),this.addRule("elements.create",(function(e){var t=e.elements,n=e.position,i=e.target;return!(dn(i)&&!Wd(t,i))&&w(t,(function(e){return dn(e)?Pd(e.source,e.target,e):e.host?Ld(e,e.host,null,n):$d(e,i,null)}))})),this.addRule("elements.move",(function(e){var t=e.target,n=e.shapes,i=e.position;return Ld(n,t,null,i)||Nd(n,t,i)||zd(n,t)||Wd(n,t)})),this.addRule("shape.create",(function(e){return $d(e.shape,e.target,e.source,e.position)})),this.addRule("shape.attach",(function(e){return Ld(e.shape,e.target,null,e.position)})),this.addRule("element.copy",(function(e){var t=e.element;return Qd(e.elements,t)}))},gd.prototype.canConnectMessageFlow=Hd,gd.prototype.canConnectSequenceFlow=Vd,gd.prototype.canConnectDataAssociation=qd,gd.prototype.canConnectAssociation=jd,gd.prototype.canConnectCompensationAssociation=Fd,gd.prototype.canMove=zd,gd.prototype.canAttach=Ld,gd.prototype.canReplace=Nd,gd.prototype.canDrop=Ad,gd.prototype.canInsert=Wd,gd.prototype.canCreate=$d,gd.prototype.canConnect=Pd,gd.prototype.canResize=Id,gd.prototype.canCopy=Qd;var Xd={__depends__:[Tc],__init__:["bpmnRules"],bpmnRules:["type",gd]};function Ud(e,t){e.on("saveXML.start",2e3,(function(){y(t.getRootElements(),(function(e){var t,n=Sr(e);t=E(v(gt([e],!1),(function(t){return t!==e&&!t.labelTarget})),Sr),n.set("planeElement",t)}))}))}Ud.$inject=["eventBus","canvas"];var Yd={__init__:["bpmnDiOrdering"],bpmnDiOrdering:["type",Ud]};function Kd(e){Vo.call(this,e);var t=this;this.preExecute(["shape.create","connection.create"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.parent=o.parent),n.parentIndex=o.index)})),this.preExecute(["shape.move","connection.move"],(function(e){var n=e.context,i=n.shape||n.connection,r=n.newParent||i.parent,o=t.getOrdering(i,r);o&&(void 0!==o.parent&&(n.newParent=o.parent),n.newParentIndex=o.index)}))}function Zd(e,t){Kd.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 i(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 kr(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||Er(e,"bpmn:TextAnnotation"))return{parent:t.findRoot(n)||t.getRootElement(),index:-1};var r=i(e);r.containers&&(n=function(e,t,n){for(var i=t;i&&!kr(i,n);)i=i.parent;if(!i)throw new Error(`no parent for <${e.id}> in <${t&&t.id}>`);return i}(e,n,r.containers));var o=n.children.indexOf(e),s=g(n.children,(function(t){return!(!e.labelTarget&&t.labelTarget)&&r.level<i(t).level}));return-1!==s&&-1!==o&&o<s&&(s-=1),{index:s,parent:n}}}Kd.prototype.getOrdering=function(e,t){return null},e(Kd,Vo),Zd.$inject=["eventBus","canvas"],e(Zd,Kd);var Jd={__init__:["bpmnOrderingProvider"],bpmnOrderingProvider:["type",Zd]};function ef(){}ef.prototype.get=function(){return this._data},ef.prototype.set=function(e){this._data=e},ef.prototype.clear=function(){var e=this._data;return delete this._data,e},ef.prototype.isEmpty=function(){return!this._data};var tf={clipboard:["type",ef]},nf="drop-ok",rf="drop-not-ok",of="attach-ok",sf="new-parent",af="create";function lf(e,t,n,i,r){function o(t,n){[of,nf,rf,sf].forEach((function(i){i===n?e.addMarker(t,i):e.removeMarker(t,i)}))}function s(){var e=t.context();e&&e.prefix===af&&t.cancel()}n.on(["create.move","create.hover"],(function(e){var t=e.context,n=t.elements,i=e.hover,s=t.source,a=t.hints||{};if(!i)return t.canExecute=!1,void(t.target=null);cf(e);var l={x:e.x,y:e.y},c=t.canExecute=i&&function(e,t,n,i,o){if(!t)return!1;var s=m(e=v(e,(function(t){var n=t.labelTarget;return!(t.parent||fn(t)&&-1!==e.indexOf(n))})),(function(e){return!dn(e)})),a=!1,l=!1,c=!1;hf(e)&&(a=r.allowed("shape.attach",{position:n,shape:s,target:t})),a||(c=hf(e)?r.allowed("shape.create",{position:n,shape:s,source:i,target:t}):r.allowed("elements.create",{elements:e,position:n,target:t}));var h=o.connectionTarget;return c||a?(s&&i&&(l=r.allowed("connection.create",{source:h===i?s:i,target:h===i?i:s,hints:{targetParent:t,targetAttach:a}})),{attach:a,connect:l}):(null===c||null===a)&&null}(n,i,l,s,a);i&&null!==c&&(t.target=i,c&&c.attach?o(i,of):o(i,c?sf:rf))})),n.on(["create.end","create.out","create.cleanup"],(function(e){var t=e.hover;t&&o(t,null)})),n.on("create.end",(function(e){var t=e.context,n=t.source,r=t.shape,o=t.elements,s=t.target,a=t.canExecute,l=a&&a.attach,c=a&&a.connect,h=t.hints||{};if(!1===a||!s)return!1;cf(e);var u={x:e.x,y:e.y};r=c?i.appendShape(n,r,u,s,{attach:l,connection:!0===c?{}:c,connectionTarget:h.connectionTarget}):m(o=i.createElements(o,u,s,z({},h,{attach:l})),(function(e){return!dn(e)})),z(t,{elements:o,shape:r}),z(e,{elements:o,shape:r})})),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,i){c(n)||(n=[n]);var r=m(n,(function(e){return!dn(e)}));if(r){i=z({elements:n,hints:{},shape:r},i||{}),y(n,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var o=vt(v(n,(function(e){return!e.hidden})));y(n,(function(e){dn(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}}))),z(e,{x:e.x-o.x-o.width/2,y:e.y-o.y-o.height/2})})),t.init(e,af,{cursor:"grabbing",autoActivate:!0,data:{shape:r,elements:n,context:i}})}}}function cf(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 hf(e){return e&&1===e.length&&!dn(e[0])}lf.$inject=["canvas","dragging","eventBus","modeling","rules"];function uf(e,t,n,i,r){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=De("g");ke(t,r.cls("djs-drag-group",["no-events"]));var o=De("g");return e.forEach((function(e){var r;e.hidden||(e.waypoints?(r=n._createContainer("connection",o),n.drawConnection(Un(r),e)):(r=n._createContainer("shape",o),n.drawShape(Un(r),e),Kn(r,e.x,e.y)),i.addDragger(e,t,r))})),t}(a)),o?(l.parentNode||xe(e.getActiveLayer(),l),Kn(l,t.x,t.y)):qe(l)})),t.on("create.cleanup",(function(e){var t=e.context.dragGroup;t&&qe(t)}))}uf.$inject=["canvas","eventBus","graphicsFactory","previewSupport","styles"];var pf={__depends__:[Cc,Fh,Tc,Rs],__init__:["create","createPreview"],create:["type",lf],createPreview:["type",uf]};function df(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)}))}df.$inject=["eventBus"],df.prototype.getLastMoveEvent=function(){return this._lastMoveEvent||function(e,t){var n=document.createEvent("MouseEvent"),i=e,r=t,o=e,s=t;n.initMouseEvent&&n.initMouseEvent("mousemove",!0,!0,window,0,i,r,o,s,!1,!1,!1,!1,0,null);return n}(0,0)};var ff={__init__:["mouse"],mouse:["type",df]};function mf(e,t,n,i,r,o,s,a){this._canvas=e,this._create=t,this._clipboard=n,this._elementFactory=i,this._eventBus=r,this._modeling=o,this._mouse=s,this._rules=a,r.on("copyPaste.copyElement",(function(e){var t=e.descriptor,n=e.element,i=e.elements;t.priority=1,t.id=n.id;var r=m(i,(function(e){return e===n.parent}));r&&(t.parent=n.parent.id),function(e){return!!e.host}(n)&&(t.priority=2,t.host=n.host.id),dn(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=gf(e)).original&&(e.original=gf(e.original)),e}))}(n)),fn(n)&&(t.priority=4,t.labelTarget=n.labelTarget.id),y(["x","y","width","height"],(function(e){u(n[e])&&(t[e]=n[e])})),t.hidden=n.hidden,t.collapsed=n.collapsed})),r.on("copyPaste.pasteElements",(function(e){z(e.hints,{createElementsBehavior:!1})}))}function gf(e){return z({},e)}function vf(e,t){var n=t.indexOf(e);return-1===n?t:t.splice(n,1)}mf.$inject=["canvas","create","clipboard","elementFactory","eventBus","modeling","mouse","rules"],mf.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},mf.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 i=this._createElements(t);if(e&&e.element&&e.point)return this._paste(i,e.element,e.point,n);this._create.start(this._mouse.getLastMoveEvent(),i,{hints:n||{}})}},mf.prototype._paste=function(e,t,n,i){y(e,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var r=vt(e);return y(e,(function(e){dn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2}}))),z(e,{x:e.x-r.x-r.width/2,y:e.y-r.y-r.height/2})})),this._modeling.createElements(e,n,t,z({},i))},mf.prototype._createElements=function(e){var t=this,n=this._eventBus,i={},r=[];return y(e,(function(e,o){y(e=A(e,"priority"),(function(e){var o,s=z({},j(e,["priority"]));return i[e.parent]?s.parent=i[e.parent]:delete s.parent,n.fire("copyPaste.pasteElement",{cache:i,descriptor:s}),dn(s)?(s.source=i[e.source],s.target=i[e.target],o=i[e.id]=t.createConnection(s),void r.push(o)):fn(s)?(s.labelTarget=i[s.labelTarget],o=i[e.id]=t.createLabel(s),void r.push(o)):(s.host&&(s.host=i[s.host]),o=i[e.id]=t.createShape(s),void r.push(o))}))})),r},mf.prototype.createConnection=function(e){return this._elementFactory.createConnection(j(e,["id"]))},mf.prototype.createLabel=function(e){return this._elementFactory.createLabel(j(e,["id"]))},mf.prototype.createShape=function(e){return this._elementFactory.createShape(j(e,["id"]))},mf.prototype.hasRelations=function(e,t){var n,i;return!(dn(e)&&(n=m(t,M({id:e.source.id})),i=m(t,M({id:e.target.id})),!n||!i))&&!(fn(e)&&!m(t,M({id:e.labelTarget.id})))},mf.prototype.createTree=function(e){var t=this._rules,n=this,i={},r=[];function o(e,t){var n=m(r,(function(t){return e===t.element}));n?n.depth<t&&(r=function(e,t){var n=t.indexOf(e);-1!==n&&t.splice(n,1);return t}(n,r),r.push({element:n.element,depth:t})):r.push({element:e,depth:t})}return mt(pt(e),(function(e,t,i){if(!fn(e)){y(e.labels,(function(e){o(e,i)})),y([e.attachers,e.incoming,e.outgoing],(function(e){e&&e.length&&y(e,(function(e){y(e.labels,(function(e){o(e,i)})),o(e,i)}))})),o(e,i);var r=[];return e.children&&(r=e.children.slice()),n._eventBus.fire("copyPaste.createTree",{element:e,children:r}),r}})),e=E(r,(function(e){return e.element})),r=E(r,(function(t){return t.descriptor={},n._eventBus.fire("copyPaste.copyElement",{descriptor:t.descriptor,element:t.element,elements:e}),t})),r=A(r,(function(e){return e.descriptor.priority})),e=E(r,(function(e){return e.element})),y(r,(function(r){var o=r.depth;n.hasRelations(r.element,e)?!function(e,n){return t.allowed("element.copy",{element:e,elements:n})}(r.element,e)?vf(r.element,e):(i[o]||(i[o]=[]),i[o].push(r.descriptor)):vf(r.element,e)})),i};var yf={__depends__:[tf,pf,ff,Tc],__init__:["copyPaste"],copyPaste:["type",mf]};function bf(e,t,n){c(n)||(n=[n]),y(n,(function(n){s(e[n])||(t[n]=e[n])}))}function xf(e,t,n){function i(t,i){var r=e.create(t.$type);return n.copyElement(t,r,null,i)}t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element,r=Or(n);if(fn(n))return t;var o=t.businessObject=i(r,!0),s=t.di=i(Sr(n),!0);s.bpmnElement=o,bf(o,t,"name"),bf(s,t,"isExpanded"),r.default&&(t.default=r.default.id)}));var r="-bpmn-js-refs";t.on("copyPaste.pasteElement",(function(e){var t=e.cache,n=e.descriptor,r=n.businessObject,o=n.di;if(fn(n))return n.businessObject=Or(t[n.labelTarget]),void(n.di=Sr(t[n.labelTarget]));r=n.businessObject=i(r),(o=n.di=i(o)).bpmnElement=r,bf(n,r,["isExpanded","name"]),n.type=r.$type})),t.on("copyPaste.copyElement",750,(function(e){var t=e.descriptor,n=e.element;if(Er(n,"bpmn:Participant")){var r=Or(n);r.processRef&&(t.processRef=i(r.processRef,!0))}})),t.on("copyPaste.pasteElement",(function(e){var t=e.descriptor,n=t.processRef;n&&(t.processRef=i(n))})),t.on("copyPaste.pasteElement",750,(function(e){var t=e.cache;!function(e,t){e[r]=t}(t,function(e,t,n){var i=Or(e);return e.default&&(n[e.default]={element:i,property:"default"}),e.host&&(Or(e).attachedToRef=Or(t[e.host])),j(n,x(n,(function(t,n,r){var o=n.element,s=n.property;return r===e.id&&(o.set(s,i),t.push(e.id)),t}),[]))}(e.descriptor,t,function(e){return e[r]=e[r]||{}}(t)))}))}xf.$inject=["bpmnFactory","eventBus","moddleCopy"];var wf=["artifacts","dataInputAssociations","dataOutputAssociations","default","flowElements","lanes","incoming","outgoing","categoryValue"];function _f(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 A(t,(function(e){return"extensionElements"===e}))})),e.on("moddleCopy.canCopyProperty",(function(e){var t=e.parent,n=h(t)&&t.$descriptor,i=e.propertyName;return(!i||-1===wf.indexOf(i))&&(!(i&&n&&!m(n.properties,M({name:i})))&&void 0)})),e.on("moddleCopy.canSetCopiedProperty",(function(e){var t,n,i=e.property;if(n="bpmn:ExtensionElements",(t=i)&&p(t.$instanceOf)&&t.$instanceOf(n)&&(!i.values||!i.values.length))return!1}))}function Ef(e,t){return x(e.properties,(function(e,n){return t&&n.default?e:e.concat(n.name)}),[])}_f.$inject=["eventBus","bpmnFactory","moddle"],_f.prototype.copyElement=function(e,t,n,i=!1){var r=this;n&&!c(n)&&(n=[n]),n=n||Ef(e.$descriptor);var o=this._eventBus.fire("moddleCopy.canCopyProperties",{propertyNames:n,sourceElement:e,targetElement:t,clone:i});return!1===o||(c(o)&&(n=o),y(n,(function(n){var o;f(e,n)&&(o=e.get(n));var s=r.copyProperty(o,t,n,i);a(s)&&(!1!==r._eventBus.fire("moddleCopy.canSetCopiedProperty",{parent:t,property:s,propertyName:n})&&t.set(n,s))}))),t},_f.prototype.copyProperty=function(e,t,n,i=!1){var r=this,o=this._eventBus.fire("moddleCopy.canCopyProperty",{parent:t,property:e,propertyName:n,clone:i});if(!1!==o){if(o)return h(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,i);if(c(e))return x(e,(function(e,s){return(o=r.copyProperty(s,t,n,i))?e.concat(o):e}),[]);if(h(e)&&e.$type){if(this._moddle.getElementDescriptor(e).isGeneric)return;return(o=r._bpmnFactory.create(e.$type)).$parent=t,o=r.copyElement(e,o,null,i)}return e}}},_f.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 kf={__depends__:[yf],__init__:["bpmnCopyPaste","moddleCopy"],bpmnCopyPaste:["type",xf],moddleCopy:["type",_f]},Of=Math.round;function Sf(e,t){this._modeling=e,this._eventBus=t}function Cf(e,t){t.on("replace.end",500,(function(t){const{newElement:n,hints:i={}}=t;!1!==i.select&&e.select(n)}))}Sf.$inject=["modeling","eventBus"],Sf.prototype.replaceElement=function(e,t,n){if(e.waypoints)return null;var i=this._modeling,r=this._eventBus;r.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=Of(a+o/2),h=Of(l+s/2),u=i.replaceShape(e,z({},t,{x:c,y:h,width:o,height:s}),n);return r.fire("replace.end",{element:e,newElement:u,hints:n}),u},Cf.$inject=["selection","eventBus"];var Pf={__init__:["replace","replaceSelectionBehavior"],replaceSelectionBehavior:["type",Cf],replace:["type",Sf]};var Af=["cancelActivity","instantiate","eventGatewayType","triggeredByEvent","isInterrupting"];function Mf(e,t,n,i,r,o){this.replaceElement=function(a,l,h){h=h||{};var u=l.type,p=a.businessObject;if(Rf(p)&&("bpmn:SubProcess"===u||"bpmn:AdHocSubProcess"===u)&&function(e,t){var n=e&&f(e,"collapsed")?e.collapsed:!Vr(e);return n!==(t&&(f(t,"collapsed")||f(t,"isExpanded"))?f(t,"collapsed")?t.collapsed:!t.isExpanded:n)}(a,l))return i.toggleCollapse(a),a;var d=e.create(u),m={type:u,businessObject:d,di:{}};"bpmn:ExclusiveGateway"===u&&(m.di.isMarkerVisible=!0),function(e,t,n){c(n)||(n=[n]),y(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)}))}(Ef(p.$descriptor),Ef(d.$descriptor,!0));z(d,I(l,Af));var b=v(g,(function(e){return"eventDefinitions"===e?Tf(a,l.eventDefinitionType):"loopCharacteristics"===e?!Qr(d):!f(d,e)&&(("processRef"!==e||!1!==l.isExpanded)&&("triggeredByEvent"!==e&&("isForCompensation"!==e||!Qr(d))))}));if(d=n.copyElement(p,d,b),l.eventDefinitionType&&(Tf(d,l.eventDefinitionType)||(m.eventDefinitionType=l.eventDefinitionType,m.eventDefinitionAttrs=l.eventDefinitionAttrs)),Er(p,"bpmn:Activity")){if(Rf(p))m.isExpanded=Vr(a);else if(l&&f(l,"isExpanded")){m.isExpanded=l.isExpanded;var x=t.getDefaultSize(d,{isExpanded:m.isExpanded});m.width=x.width,m.height=x.height,m.x=a.x-(m.width-a.width)/2,m.y=a.y-(m.height-a.height)/2}Vr(a)&&!Er(p,"bpmn:Task")&&m.isExpanded&&(m.width=a.width,m.height=a.height)}if(Rf(p)&&!Rf(d)&&(h.moveChildren=!1),Er(p,"bpmn:Participant")){!0===l.isExpanded?d.processRef=e.create("bpmn:Process"):h.moveChildren=!1;var w=qr(a);Sr(a).isHorizontal||(Sr(m).isHorizontal=w),m.width=w?a.width:t.getDefaultSize(m).width,m.height=w?t.getDefaultSize(m).height:a.height}return o.allowed("shape.resize",{shape:d})||(m.height=t.getDefaultSize(m).height,m.width=t.getDefaultSize(m).width),d.name=p.name,kr(p,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&kr(d,["bpmn:ExclusiveGateway","bpmn:InclusiveGateway","bpmn:Activity"])&&(d.default=p.default),l.host&&!Er(p,"bpmn:BoundaryEvent")&&Er(d,"bpmn:BoundaryEvent")&&(m.host=l.host),"bpmn:DataStoreReference"!==m.type&&"bpmn:DataObjectReference"!==m.type||(m.x=a.x+(a.width-m.width)/2),r.replaceElement(a,m,{...h,targetElement:l})}}function Rf(e){return Er(e,"bpmn:SubProcess")}function Tf(e,t){var n=Or(e);return t&&n.get("eventDefinitions").some((function(e){return Er(e,t)}))}Mf.$inject=["bpmnFactory","elementFactory","moddleCopy","modeling","replace","rules"];var Df={__depends__:[kf,Pf,Rs],bpmnReplace:["type",Mf]};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,i=[];n.on(t.tool+".init",(function(t){t.context.reactivate||!this.isActive(e)?this.setActive(e):this.setActive(null)}),this),y(t,(function(e){i.push(e+".ended"),i.push(e+".canceled")})),n.on(i,250,(function(e){this._active&&(function(e){var t=e.originalEvent&&e.originalEvent.target;return t&&ee(t,'.group[data-group="tools"]')}(e)||this.setActive(null))}),this)};var Lf={__depends__:[Cc],__init__:["toolManager"],toolManager:["type",Bf]};function Nf(e,t){return-1!==e.indexOf(t)}var zf=Math.abs,$f=Math.round,If={x:"width",y:"height"},jf="crosshair",Ff={n:"top",w:"left",s:"bottom",e:"right"},Hf=1500,Vf={n:"s",w:"e",s:"n",e:"w"},qf=20;function Wf(e,t,n,i,r,o,s){this._canvas=e,this._dragging=t,this._eventBus=n,this._modeling=i,this._rules=r,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",Hf,(function(e){var t=e.context,n=t.initialized;n||(n=t.initialized=a.init(e,t)),n&&Gf(e)})),n.on("spaceTool.end",(function(e){var t=e.context,i=t.axis,r=t.direction,o=t.movingShapes,s=t.resizingShapes,l=t.start;if(t.initialized){Gf(e);var c={x:0,y:0};c[i]=$f(e["d"+i]),a.makeSpace(o,s,c,r,l),n.once("spaceTool.ended",(function(e){a.activateSelection(e.originalEvent,!0,!0)}))}}))}function Qf(e){return{top:e.top-qf,right:e.right+qf,bottom:e.bottom+qf,left:e.left-qf}}function Gf(e){var t,n,i=e.context.spaceToolConstraints;i&&(u(i.left)&&(t=Math.max(e.x,i.left),e.dx=e.dx+t-e.x,e.x=t),u(i.right)&&(t=Math.min(e.x,i.right),e.dx=e.dx+t-e.x,e.x=t),u(i.top)&&(n=Math.max(e.y,i.top),e.dy=e.dy+n-e.y,e.y=n),u(i.bottom)&&(n=Math.min(e.y,i.bottom),e.dy=e.dy+n-e.y,e.y=n))}function Xf(e,t){return-1!==e.indexOf(t)}Wf.$inject=["canvas","dragging","eventBus","modeling","rules","toolManager","mouse"],Wf.prototype.activateSelection=function(e,t,n){this._dragging.init(e,"spaceTool.selection",{autoActivate:t,cursor:jf,data:{context:{reactivate:n}},trapClick:!1})},Wf.prototype.activateMakeSpace=function(e){this._dragging.init(e,"spaceTool",{autoActivate:!0,cursor:jf,data:{context:{}}})},Wf.prototype.makeSpace=function(e,t,n,i,r){return this._modeling.createSpace(e,t,n,i,r)},Wf.prototype.init=function(e,t){var n=zf(e.dx)>zf(e.dy)?"x":"y",i=e["d"+n],r=e[n]-i;if(zf(i)<5)return!1;i<0&&(i*=-1),bs(e)&&(i*=-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,i),s=this._canvas.getRootElement();!xs(e)&&e.hover&&(s=e.hover);var a=[...gt(s,!0),...s.attachers||[]],l=this.calculateAdjustments(a,n,i,r),c=function(e,t,n,i,r){var o=e.movingShapes,s=e.resizingShapes;if(!s.length)return;var a,l,c={};return y(s,(function(e){var h,p,d,f,m,g,y=e.attachers,b=e.children,x=vn(e),w=v(b,(function(e){return!(dn(e)||fn(e)||Xf(o,e)||Xf(s,e))})),_=v(b,(function(e){return!dn(e)&&!fn(e)&&Xf(o,e)})),E=[],k=[];w.length&&(p=Qf(vn(vt(w))),h=i-x[Ff[n]]+p[Ff[n]],"n"===n?c.bottom=l=u(l)?Math.min(l,h):h:"w"===n?c.right=l=u(l)?Math.min(l,h):h:"s"===n?c.top=a=u(a)?Math.max(a,h):h:"e"===n&&(c.left=a=u(a)?Math.max(a,h):h)),_.length&&(d=Qf(vn(vt(_))),h=i-d[Ff[Vf[n]]]+x[Ff[Vf[n]]],"n"===n?c.bottom=l=u(l)?Math.min(l,h):h:"w"===n?c.right=l=u(l)?Math.min(l,h):h:"s"===n?c.top=a=u(a)?Math.max(a,h):h:"e"===n&&(c.left=a=u(a)?Math.max(a,h):h)),y&&y.length&&(y.forEach((function(e){Xf(o,e)?E.push(e):k.push(e)})),E.length&&(f=vn(vt(E.map(xn))),m=x[Ff[Vf[n]]]-(f[Ff[Vf[n]]]-i)),k.length&&(g=vn(vt(k.map(xn)))[Ff[n]]-(x[Ff[n]]-i)),"n"===n?(h=Math.min(m||1/0,g||1/0),c.bottom=l=u(l)?Math.min(l,h):h):"w"===n?(h=Math.min(m||1/0,g||1/0),c.right=l=u(l)?Math.min(l,h):h):"s"===n?(h=Math.max(m||-1/0,g||-1/0),c.top=a=u(a)?Math.max(a,h):h):"e"===n&&(h=Math.max(m||-1/0,g||-1/0),c.left=a=u(a)?Math.max(a,h):h));var O=r&&r[e.id];O&&("n"===n?(h=i+e[If[t]]-O[If[t]],c.bottom=l=u(l)?Math.min(l,h):h):"w"===n?(h=i+e[If[t]]-O[If[t]],c.right=l=u(l)?Math.min(l,h):h):"s"===n?(h=i-e[If[t]]+O[If[t]],c.top=a=u(a)?Math.max(a,h):h):"e"===n&&(h=i-e[If[t]]+O[If[t]],c.left=a=u(a)?Math.max(a,h):h))})),c}(l,n,o,r,this._eventBus.fire("spaceTool.getMinDimensions",{axis:n,direction:o,shapes:l.resizingShapes,start:r}));return z(t,l,{axis:n,direction:o,spaceToolConstraints:c,start:r}),Zs("resize-"+("x"===n?"ew":"ns")),!0},Wf.prototype.calculateAdjustments=function(e,t,n,i){var r=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)}y(e,(function(e){if(e.parent&&!fn(e))if(dn(e))l.push(e);else{var o=e[t],h=o+e[If[t]];if(function(e){return!!e.host}(e)&&(n>0&&xn(e)[t]>i||n<0&&xn(e)[t]<i))a.push(e);else{var u;if(!(n>0&&o>i||n<0&&h<i))return o<i&&h>i&&r.allowed("shape.resize",{shape:e})?(u=e,void(s.includes(u)||s.push(u))):void 0;c(e)}}})),y(o,(function(e){var t=e.attachers;t&&y(t,(function(e){c(e)}))}));var h=o.concat(s);return y(a,(function(e){var t=e.host;Xf(h,t)&&c(e)})),h=o.concat(s),y(l,(function(e){var t=e.source,n=e.target,i=e.label;Xf(h,t)&&Xf(h,n)&&i&&c(i)})),{movingShapes:o,resizingShapes:s}},Wf.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Wf.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^spaceTool/.test(e.prefix)};var Uf="djs-dragging",Yf="djs-resizing",Kf=Math.max;function Zf(e,t,n,i,r){function o(e,t){y(e,(function(e){r.addDragger(e,t),n.addMarker(e,Uf)}))}e.on("spaceTool.selection.start",(function(e){var t=n.getLayer("space"),r=e.context,o="M 0,-10000 L 0,10000",s="M -10000,0 L 10000,0",a=De("g");ke(a,i.cls("djs-crosshair-group",["no-events"])),xe(t,a);var l=De("path");ke(l,"d",o),Se(l).add("djs-crosshair"),xe(a,l);var c=De("path");ke(c,"d",s),Se(c).add("djs-crosshair"),xe(a,c),r.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&&qe(t)})),e.on("spaceTool.move",250,(function(e){var s=e.context,a=s.line,l=s.axis,c=s.movingShapes,h=s.resizingShapes;if(s.initialized){if(!s.dragGroup){var u=n.getLayer("space");ke(a=De("path"),"d","M0,0 L0,0"),Se(a).add("djs-crosshair"),xe(u,a),s.line=a;var p=De("g");ke(p,i.cls("djs-drag-group",["no-events"])),xe(n.getActiveLayer(),p),o(c,p),o(s.movingConnections=t.filter((function(e){var t=!1;y(c,(function(n){y(n.outgoing,(function(n){e===n&&(t=!0)}))}));var n=!1;y(c,(function(t){y(t.incoming,(function(t){e===t&&(n=!0)}))}));var i=!1;y(h,(function(t){y(t.outgoing,(function(t){e===t&&(i=!0)}))}));var r=!1;return y(h,(function(t){y(t.incoming,(function(t){e===t&&(r=!0)}))})),dn(e)&&(t||i)&&(n||r)})),p),s.dragGroup=p}if(!s.frameGroup){var d=De("g");ke(d,i.cls("djs-frame-group",["no-events"])),xe(n.getActiveLayer(),d);var f=[];y(h,(function(e){var t=r.addFrame(e,d),i=t.getBBox();f.push({element:t,initialBounds:i}),n.addMarker(e,Yf)})),s.frameGroup=d,s.frames=f}ke(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),y(s.frames,(function(e){var t,n,i=e.element,r=e.initialBounds;"e"===s.direction?ke(i,{width:Kf(r.width+m.x,5)}):ke(i,{width:t=Kf(r.width-m.x,5),x:r.x+r.width-t}),"s"===s.direction?ke(i,{height:Kf(r.height+m.y,5)}):ke(i,{height:n=Kf(r.height-m.y,5),y:r.y+r.height-n})}))}})),e.on("spaceTool.cleanup",(function(e){var t=e.context,i=t.movingShapes,r=t.movingConnections,o=t.resizingShapes,s=t.line,a=t.dragGroup,l=t.frameGroup;y(i,(function(e){n.removeMarker(e,Uf)})),y(r,(function(e){n.removeMarker(e,Uf)})),a&&(qe(s),qe(a)),y(o,(function(e){n.removeMarker(e,Yf)})),l&&qe(l)}))}Zf.$inject=["eventBus","elementRegistry","canvas","styles","previewSupport"];var Jf={__init__:["spaceToolPreview"],__depends__:[Cc,Tc,Lf,Fh,ff],spaceTool:["type",Wf],spaceToolPreview:["type",Zf]};function em(e,t){e.invoke(Wf,this),this._canvas=t}em.$inject=["injector","canvas"],e(em,Wf),em.prototype.calculateAdjustments=function(e,t,n,i){var r=this._canvas.getRootElement(),o=e[0]===r?null:e[0],s=[];o&&(s=O(yt(r.children.filter((e=>Er(e,"bpmn:Artifact"))),vt(o))));const a=[...e,...s];var l=Wf.prototype.calculateAdjustments.call(this,a,t,n,i);return l.resizingShapes=l.resizingShapes.filter((function(e){return!Er(e,"bpmn:TextAnnotation")&&(!function(e){return Er(e,"bpmn:Participant")&&!Or(e).processRef}(e)||!("y"===t&&qr(e)||"x"===t&&!qr(e)))})),l};var tm={__depends__:[Jf],spaceTool:["type",em]};function nm(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)}nm.$inject=["eventBus","injector"],nm.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()},nm.prototype.canExecute=function(e,t){const n={command:e,context:t},i=this._getHandler(e);let r=this._fire(e,"canExecute",n);if(void 0===r){if(!i)return!1;i.canExecute&&(r=i.canExecute(t))}return r},nm.prototype.clear=function(e){this._stack.length=0,this._stackIdx=-1,!1!==e&&this._fire("changed",{trigger:"clear"})},nm.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()}},nm.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()}},nm.prototype.register=function(e,t){this._setHandler(e,t)},nm.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)},nm.prototype.canUndo=function(){return!!this._getUndoAction()},nm.prototype.canRedo=function(){return!!this._getRedoAction()},nm.prototype._getRedoAction=function(){return this._stack[this._stackIdx+1]},nm.prototype._getUndoAction=function(){return this._stack[this._stackIdx]},nm.prototype._internalUndo=function(e){const t=e.command,n=e.context,i=this._getHandler(t);this._atomicDo((()=>{this._fire(t,"revert",e),i.revert&&this._markDirty(i.revert(n)),this._revertedAction(e),this._fire(t,"reverted",e)}))},nm.prototype._fire=function(e,t,n){arguments.length<3&&(n=t,t=null);const i=t?[e+"."+t,t]:[e];let r;n=this._eventBus.createEvent(n);for(const e of i)if(r=this._eventBus.fire("commandStack."+e,n),n.cancelBubble)break;return r},nm.prototype._createId=function(){return this._uid++},nm.prototype._atomicDo=function(e){const t=this._currentExecution;t.atomic=!0;try{e()}finally{t.atomic=!1}},nm.prototype._internalExecute=function(e,t){const n=e.command,i=e.context,r=this._getHandler(n);if(!r)throw new Error("no command handler registered for <"+n+">");this._pushAction(e),t||(this._fire(n,"preExecute",e),r.preExecute&&r.preExecute(i),this._fire(n,"preExecuted",e)),this._atomicDo((()=>{this._fire(n,"execute",e),r.execute&&this._markDirty(r.execute(i)),this._executedAction(e,t),this._fire(n,"executed",e)})),t||(this._fire(n,"postExecute",e),r.postExecute&&r.postExecute(i),this._fire(n,"postExecuted",e)),this._popAction()},nm.prototype._pushAction=function(e){const t=this._currentExecution,n=t.actions,i=n[0];if(t.atomic)throw new Error("illegal invocation in <execute> or <revert> phase (action: "+e.command+")");e.id||(e.id=i&&i.id||this._createId()),n.push(e)},nm.prototype._popAction=function(){const e=this._currentExecution,t=e.trigger,n=e.actions,i=e.dirty;n.pop(),n.length||(this._eventBus.fire("elements.changed",{elements:C("id",i.reverse())}),i.length=0,this._fire("changed",{trigger:t}),e.trigger=null)},nm.prototype._markDirty=function(e){const t=this._currentExecution;e&&(e=c(e)?e:[e],t.dirty=t.dirty.concat(e))},nm.prototype._executedAction=function(e,t){const n=++this._stackIdx;t||this._stack.splice(n,this._stack.length,e)},nm.prototype._revertedAction=function(e){this._stackIdx--},nm.prototype._getHandler=function(e){return this._handlerMap[e]},nm.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 im={commandStack:["type",nm]};function rm(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 om(e,t,n){Vo.call(this,t);var i=e.get("movePreview",!1);t.on("shape.move.start",1400,(function(e){var t=e.context,n=t.shapes,i=t.validatedShapes;t.shapes=sm(n),t.validatedShapes=sm(i)})),i&&t.on("shape.move.start",250,(function(e){var t=e.context,n=t.shapes,r=[];y(n,(function(e){y(e.labels,(function(n){n.hidden||-1!==t.shapes.indexOf(n)||r.push(n),e.labelTarget&&r.push(e)}))})),y(r,(function(e){i.makeDraggable(t,e,!0)}))})),this.preExecuted("elements.move",1400,(function(e){var t=e.context.closure,n=t.enclosedElements,i=[];y(n,(function(e){y(e.labels,(function(e){n[e.id]||i.push(e)}))})),t.addAll(i)})),this.preExecute(["connection.delete","shape.delete"],(function(e){var t=e.context;rm((t.connection||t.shape).labels,(function(e){n.removeShape(e,{nested:!0})}))})),this.execute("shape.delete",(function(e){var t=e.context,n=t.shape,i=n.labelTarget;i&&(t.labelTargetIndex=St(i.labels,n),t.labelTarget=i,n.labelTarget=null)})),this.revert("shape.delete",(function(e){var t=e.context,n=t.shape,i=t.labelTarget,r=t.labelTargetIndex;i&&(Ot(i.labels,n,r),n.labelTarget=i)}))}function sm(e){return v(e,(function(t){return-1===e.indexOf(t.labelTarget)}))}e(om,Vo),om.$inject=["injector","eventBus","modeling"];var am={__init__:["labelSupport"],labelSupport:["type",om]},lm="attach-ok";function cm(e,t,n,i,r){Vo.call(this,t);var o=e.get("movePreview",!1);t.on("shape.move.start",1401,(function(e){var t,n,i=e.context,r=i.shapes,o=i.validatedShapes;i.shapes=(n=hm(t=r),P("id",t,n)),i.validatedShapes=function(e){var t=S(e,"id");return v(e,(function(e){for(;e;){if(e.host&&t[e.host.id])return!1;e=e.parent}return!0}))}(o)})),o&&t.on("shape.move.start",251,(function(e){var t=e.context;y(hm(t.shapes),(function(e){o.makeDraggable(t,e,!0),y(e.labels,(function(e){o.makeDraggable(t,e,!0)}))}))})),o&&t.on("shape.move.start",(function(e){var i=e.context.shapes;if(1===i.length){var r=i[0].host;r&&(n.addMarker(r,lm),t.once(["shape.move.out","shape.move.cleanup"],(function(){n.removeMarker(r,lm)})))}})),this.preExecuted("elements.move",1401,(function(e){var t=e.context,n=t.closure;y(hm(t.shapes),(function(e){n.add(e,n.topLevel[e.host.id])}))})),this.postExecuted("elements.move",(function(e){var t=e.context,n=t.shapes,i=t.newHost;i&&1!==n.length||y(i?n:v(n,(function(e){var t,i=e.host;return function(e){return!!e.host}(e)&&(t=i,!(-1!==n.indexOf(t)))})),(function(e){r.updateAttachment(e,i)}))})),this.postExecuted("elements.move",(function(e){y(e.context.shapes,(function(e){y(e.attachers,(function(e){y(e.outgoing.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)})),y(e.incoming.slice(),(function(e){i.allowed("connection.reconnect",{connection:e,source:e.source,target:e.target})||r.removeConnection(e)}))}))}))})),this.postExecute("shape.create",(function(e){var t=e.context,n=t.shape,i=t.host;i&&r.updateAttachment(n,i)})),this.postExecute("shape.replace",(function(e){var t=e.context,n=t.oldShape,o=t.newShape;rm(n.attachers,(function(e){"attach"===i.allowed("elements.move",{target:o,shapes:[e]})?r.updateAttachment(e,o):r.removeShape(e)})),o.attachers.length&&y(o.attachers,(function(e){var t=sp(e,n,o);r.moveShape(e,t,e.parent)}))})),this.postExecute("shape.resize",(function(e){var t=e.context,n=t.shape,i=t.oldBounds,o=t.newBounds,s=n.attachers;!1!==(t.hints||{}).attachSupport&&y(s,(function(e){var t=sp(e,i,o);r.moveShape(e,t,e.parent),y(e.labels,(function(e){r.moveShape(e,t,e.parent)}))}))})),this.preExecute("shape.delete",(function(e){var t=e.context.shape;rm(t.attachers,(function(e){r.removeShape(e)})),t.host&&r.updateAttachment(t,null)}))}function hm(e){return i(E(e,(function(e){return e.attachers||[]})))}e(cm,Vo),cm.$inject=["injector","eventBus","canvas","rules","modeling"];var um={__depends__:[Tc],__init__:["attachSupport"],attachSupport:["type",cm]};function pm(e){this._model=e}function dm(e,t,n){Vo.call(this,e),this._bpmnFactory=t;var i=this;function r(e){y(e.context.oldRoot.children,(function(e){Er(e,"bpmn:BaseElement")&&i.updateParent(e)}))}function o(e){var t=e.context.shape;Er(t,"bpmn:BaseElement")&&i.updateBounds(t)}function s(e){i.updateConnection(e.context)}function a(e){i.updateConnectionWaypoints(e.context.connection)}function l(e){i.updateAttachment(e.context)}function c(e){const{element:n}=e.context,i=to(n),r=Sr(n),o=r&&r.get("label");Yr(n)||es(n)||(i&&!o?r.set("label",t.create("bpmndi:BPMNLabel")):!i&&o&&r.set("label",void 0))}this.executed(["connection.layout","connection.create"],(function(e){var t,i=e.context,r=i.hints||{};i.cropped||!1===r.createElementsBehavior||((t=i.connection).waypoints=n.getCroppedWaypoints(t),i.cropped=!0)})),this.reverted(["connection.layout"],(function(e){delete e.context.cropped})),this.executed(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fm((function(e){var t=e.context;i.updateParent(t.shape||t.connection,t.oldParent)}))),this.reverted(["shape.move","shape.create","shape.delete","connection.create","connection.move","connection.delete"],fm((function(e){var t=e.context,n=t.shape||t.connection,r=t.parent||t.newParent;i.updateParent(n,r)}))),this.executed(["canvas.updateRoot"],r),this.reverted(["canvas.updateRoot"],r),this.executed(["shape.move","shape.create","shape.resize"],fm((function(e){"label"!==e.context.shape.type&&o(e)}))),this.reverted(["shape.move","shape.create","shape.resize"],fm((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"],fm(s)),this.reverted(["connection.create","connection.move","connection.delete","connection.reconnect"],fm(s)),this.executed(["connection.layout","connection.move","connection.updateWaypoints"],fm(a)),this.reverted(["connection.layout","connection.move","connection.updateWaypoints"],fm(a)),this.executed("connection.reconnect",fm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Or(n),s=Or(i),a=Or(r);o.conditionExpression&&!kr(a,["bpmn:Activity","bpmn:ExclusiveGateway","bpmn:InclusiveGateway"])&&(t.oldConditionExpression=o.conditionExpression,delete o.conditionExpression),i!==r&&s.default===o&&(t.oldDefault=s.default,delete s.default)}))),this.reverted("connection.reconnect",fm((function(e){var t=e.context,n=t.connection,i=t.oldSource,r=t.newSource,o=Or(n),s=Or(i),a=Or(r);t.oldConditionExpression&&(o.conditionExpression=t.oldConditionExpression),t.oldDefault&&(s.default=t.oldDefault,delete a.default)}))),this.executed(["element.updateAttachment"],fm(l)),this.reverted(["element.updateAttachment"],fm(l)),this.executed("element.updateLabel",fm(c)),this.reverted("element.updateLabel",fm(c))}function fm(e){return function(t){var n=t.context;Er(n.shape||n.connection||n.element,"bpmn:BaseElement")&&e(t)}}function mm(e,t){qn.call(this),this._bpmnFactory=e,this._moddle=t}function gm(e,t,n){return void 0===t[n]?t:(e[n]=t[n],j(t,[n]))}function vm(e,t){this._modeling=e,this._canvas=t}function ym(e){this._modeling=e}function bm(e,t){this._canvas=e,this._layouter=t}pm.$inject=["moddle"],pm.prototype._needsId=function(e){return kr(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"])},pm.prototype._ensureId=function(e){var t;e.id?this._model.ids.claim(e.id,e):(t=Er(e,"bpmn:Activity")?"Activity":Er(e,"bpmn:Event")?"Event":Er(e,"bpmn:Gateway")?"Gateway":kr(e,["bpmn:SequenceFlow","bpmn:MessageFlow"])?"Flow":(e.$type||"").replace(/^[^:]*:/g,""),t+="_",!e.id&&this._needsId(e)&&(e.id=this._model.ids.nextPrefixed(t,e)))},pm.prototype.create=function(e,t){var n=this._model.create(e,t||{});return this._ensureId(n),n},pm.prototype.createDiLabel=function(){return this.create("bpmndi:BPMNLabel",{bounds:this.createDiBounds()})},pm.prototype.createDiShape=function(e,t){return this.create("bpmndi:BPMNShape",z({bpmnElement:e,bounds:this.createDiBounds()},t))},pm.prototype.createDiBounds=function(e){return this.create("dc:Bounds",e)},pm.prototype.createDiWaypoints=function(e){var t=this;return E(e,(function(e){return t.createDiWaypoint(e)}))},pm.prototype.createDiWaypoint=function(e){return this.create("dc:Point",I(e,["x","y"]))},pm.prototype.createDiEdge=function(e,t){return this.create("bpmndi:BPMNEdge",z({bpmnElement:e,waypoint:this.createDiWaypoints([])},t))},pm.prototype.createDiPlane=function(e,t){return this.create("bpmndi:BPMNPlane",z({bpmnElement:e},t))},e(dm,Vo),dm.$inject=["eventBus","bpmnFactory","connectionDocking"],dm.prototype.updateAttachment=function(e){var t=e.shape,n=t.businessObject,i=t.host;n.attachedToRef=i&&i.businessObject},dm.prototype.updateParent=function(e,t){if(!(fn(e)||Er(e,"bpmn:DataStoreReference")&&e.parent&&Er(e.parent,"bpmn:Collaboration"))){var n=e.parent,i=e.businessObject,r=Sr(e),o=n&&n.businessObject,s=Sr(n);Er(e,"bpmn:FlowNode")&&this.updateFlowNodeRefs(i,o,t&&t.businessObject),Er(e,"bpmn:DataOutputAssociation")&&(o=e.source?e.source.businessObject:null),Er(e,"bpmn:DataInputAssociation")&&(o=e.target?e.target.businessObject:null),this.updateSemanticParent(i,o),Er(e,"bpmn:DataObjectReference")&&i.dataObjectRef&&this.updateSemanticParent(i.dataObjectRef,o),this.updateDiParent(r,s)}},dm.prototype.updateBounds=function(e){var t=Sr(e),n=function(e){if(!Er(e,"bpmn:Activity"))return;var t=Sr(e);if(!t)return;var n=t.get("label");if(!n)return;return n.get("bounds")}(e);if(n){var i=ia(n,t.get("bounds"));z(n,{x:e.x+i.x,y:e.y+i.y})}var r=fn(e)?this._getLabel(t):t,o=r.bounds;o||(o=this._bpmnFactory.createDiBounds(),r.set("bounds",o)),z(o,{x:e.x,y:e.y,width:e.width,height:e.height})},dm.prototype.updateFlowNodeRefs=function(e,t,n){n!==t&&(Er(n,"bpmn:Lane")&&kt(n.get("flowNodeRef"),e),Er(t,"bpmn:Lane")&&Ot(t.get("flowNodeRef"),e))},dm.prototype.updateDiConnection=function(e,t,n){var i=Sr(e),r=Sr(t),o=Sr(n);i.sourceElement&&i.sourceElement.bpmnElement!==Or(t)&&(i.sourceElement=t&&r),i.targetElement&&i.targetElement.bpmnElement!==Or(n)&&(i.targetElement=n&&o)},dm.prototype.updateDiParent=function(e,t){if(t&&!Er(t,"bpmndi:BPMNPlane")&&(t=t.$parent),e.$parent!==t){var n=(t||e.$parent).get("planeElement");t?(n.push(e),e.$parent=t):(kt(n,e),e.$parent=null)}},dm.prototype.getLaneSet=function(e){var t,n;return Er(e,"bpmn:Lane")?((t=e.childLaneSet)||(t=this._bpmnFactory.create("bpmn:LaneSet"),e.childLaneSet=t,t.$parent=e),t):(Er(e,"bpmn:Participant")&&(e=e.processRef),(t=(n=e.get("laneSets"))[0])||((t=this._bpmnFactory.create("bpmn:LaneSet")).$parent=e,n.push(t)),t)},dm.prototype.updateSemanticParent=function(e,t,n){var i;if(e.$parent!==t&&(!Er(e,"bpmn:DataInput")&&!Er(e,"bpmn:DataOutput")||(Er(t,"bpmn:Participant")&&"processRef"in t&&(t=t.processRef),!("ioSpecification"in t)||t.ioSpecification!==e.$parent))){if(Er(e,"bpmn:Lane"))t&&(t=this.getLaneSet(t)),i="lanes";else if(Er(e,"bpmn:FlowElement")){if(t)if(Er(t,"bpmn:Participant"))t=t.processRef;else if(Er(t,"bpmn:Lane"))do{t=t.$parent.$parent}while(Er(t,"bpmn:Lane"));i="flowElements"}else if(Er(e,"bpmn:Artifact")){for(;t&&!Er(t,"bpmn:Process")&&!Er(t,"bpmn:SubProcess")&&!Er(t,"bpmn:Collaboration");){if(Er(t,"bpmn:Participant")){t=t.processRef;break}t=t.$parent}i="artifacts"}else if(Er(e,"bpmn:MessageFlow"))i="messageFlows";else if(Er(e,"bpmn:Participant")){i="participants";var r,o=e.processRef;o&&(r=function(e){for(;e&&!Er(e,"bpmn:Definitions");)e=e.$parent;return e}(e.$parent||t),e.$parent&&(kt(r.get("rootElements"),o),o.$parent=null),t&&(Ot(r.get("rootElements"),o),o.$parent=r))}else Er(e,"bpmn:DataOutputAssociation")?i="dataOutputAssociations":Er(e,"bpmn:DataInputAssociation")&&(i="dataInputAssociations");if(!i)throw new Error(`no parent for <${e.id}> in <${t.id}>`);var s;if(e.$parent&&kt(s=e.$parent.get(i),e),t?((s=t.get(i)).push(e),e.$parent=t):e.$parent=null,n){var a=n.get(i);kt(s,e),t&&(a||(a=[],t.set(i,a)),a.push(e))}}},dm.prototype.updateConnectionWaypoints=function(e){Sr(e).set("waypoint",this._bpmnFactory.createDiWaypoints(e.waypoints))},dm.prototype.updateConnection=function(e){var t,n=e.connection,i=Or(n),r=n.source,o=Or(r),s=n.target,a=Or(n.target);if(Er(i,"bpmn:DataAssociation"))Er(i,"bpmn:DataInputAssociation")?(i.get("sourceRef")[0]=o,t=e.parent||e.newParent||a,this.updateSemanticParent(i,a,t)):Er(i,"bpmn:DataOutputAssociation")&&(t=e.parent||e.newParent||o,this.updateSemanticParent(i,o,t),i.targetRef=a);else{var l=Er(i,"bpmn:SequenceFlow");i.sourceRef!==o&&(l&&(kt(i.sourceRef&&i.sourceRef.get("outgoing"),i),o&&o.get("outgoing")&&o.get("outgoing").push(i)),i.sourceRef=o),i.targetRef!==a&&(l&&(kt(i.targetRef&&i.targetRef.get("incoming"),i),a&&a.get("incoming")&&a.get("incoming").push(i)),i.targetRef=a)}this.updateConnectionWaypoints(n),this.updateDiConnection(n,r,s)},dm.prototype._getLabel=function(e){return e.label||(e.label=this._bpmnFactory.createDiLabel()),e.label},e(mm,qn),mm.$inject=["bpmnFactory","moddle"],mm.prototype._baseCreate=qn.prototype.create,mm.prototype.create=function(e,t){if("label"===e){var n=t.di||this._bpmnFactory.createDiLabel();return this._baseCreate(e,z({type:"label",di:n},Xr,t))}return this.createElement(e,t)},mm.prototype.createElement=function(e,t){var n,i,r,o=(t=z({},t||{})).businessObject,s=t.di;if(!o){if(!t.type)throw new Error("no shape type specified");xr(o=this._bpmnFactory.create(t.type))}if(!kr(s,["bpmndi:BPMNShape","bpmndi:BPMNEdge","bpmndi:BPMNDiagram","bpmndi:BPMNPlane"])){var l=z({},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 Er(o,"bpmn:Group")&&(t=z({isFrame:!0},t)),t=function(e,t,n){return y(n,(function(n){t=gm(e,t,n)})),t}(o,t,["processRef","isInterrupting","associationDirection","isForCompensation"]),t.isExpanded&&(t=gm(s,t,"isExpanded")),kr(o,["bpmn:Lane","bpmn:Participant"])&&(t=gm(s,t,"isHorizontal")),Er(o,"bpmn:SubProcess")&&(t.collapsed=!Vr(o,s)),Er(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&&(i=o.get("eventDefinitions")||[],r=this._bpmnFactory.create(t.eventDefinitionType,t.eventDefinitionAttrs),"bpmn:ConditionalEventDefinition"===t.eventDefinitionType&&(r.condition=this._bpmnFactory.create("bpmn:FormalExpression")),i.push(r),r.$parent=o,o.eventDefinitions=i,delete t.eventDefinitionType),n=this.getDefaultSize(o,s),t=z({id:o.id},n,t,{businessObject:o,di:s}),this._baseCreate(e,t)},mm.prototype.getDefaultSize=function(e,t){var n=Or(e);if(t=t||Sr(e),Er(n,"bpmn:SubProcess"))return Vr(n,t)?{width:350,height:200}:{width:100,height:80};if(Er(n,"bpmn:Task"))return{width:100,height:80};if(Er(n,"bpmn:Gateway"))return{width:50,height:50};if(Er(n,"bpmn:Event"))return{width:36,height:36};if(Er(n,"bpmn:Participant")){var i=void 0===t.isHorizontal||!0===t.isHorizontal;return Vr(n,t)?i?{width:600,height:250}:{width:250,height:600}:i?{width:400,height:60}:{width:60,height:400}}return Er(n,"bpmn:Lane")?{width:400,height:100}:Er(n,"bpmn:DataObjectReference")?{width:36,height:50}:Er(n,"bpmn:DataStoreReference")?{width:50,height:50}:Er(n,"bpmn:TextAnnotation")?{width:100,height:30}:Er(n,"bpmn:Group")?{width:300,height:300}:{width:100,height:80}},mm.prototype.createParticipantShape=function(e){return h(e)||(e={isExpanded:e}),!1!==(e=z({type:"bpmn:Participant"},e||{})).isExpanded&&(e.processRef=this._bpmnFactory.create("bpmn:Process")),this.createShape(e)},vm.$inject=["modeling","canvas"],vm.prototype.preExecute=function(e){var t=this._modeling,n=e.elements,i=e.alignment;y(n,(function(e){var n={x:0,y:0};a(i.left)?n.x=i.left-e.x:a(i.right)?n.x=i.right-e.width-e.x:a(i.center)?n.x=i.center-Math.round(e.width/2)-e.x:a(i.top)?n.y=i.top-e.y:a(i.bottom)?n.y=i.bottom-e.height-e.y:a(i.middle)&&(n.y=i.middle-Math.round(e.height/2)-e.y),t.moveElements([e],n,e.parent)}))},vm.prototype.postExecute=function(e){},ym.$inject=["modeling"],ym.prototype.preExecute=function(e){var t=e.source;if(!t)throw new Error("source required");var n=e.target||t.parent,i=e.shape,r=e.hints||{};i=e.shape=this._modeling.createShape(i,e.position,n,{attach:r.attach}),e.shape=i},ym.prototype.postExecute=function(e){var t,n,i=e.hints||{};t=e.source,n=e.shape,_(t.outgoing,(function(e){return e.target===n}))||(i.connectionTarget===e.source?this._modeling.connect(e.shape,e.source,e.connection):this._modeling.connect(e.source,e.shape,e.connection))},bm.$inject=["canvas","layouter"],bm.prototype.execute=function(e){var t=e.connection,n=e.source,i=e.target,r=e.parent,o=e.parentIndex,s=e.hints;if(!n||!i)throw new Error("source and target required");if(!r)throw new Error("parent required");return t.source=n,t.target=i,t.waypoints||(t.waypoints=this._layouter.layoutConnection(t,s)),this._canvas.addConnection(t,r,o),t},bm.prototype.revert=function(e){var t=e.connection;return this._canvas.removeConnection(t),t.source=null,t.target=null,t};var xm=Math.round;function wm(e){this._modeling=e}wm.$inject=["modeling"],wm.prototype.preExecute=function(e){var t=e.elements,n=e.parent,i=e.parentIndex,r=e.position,o=e.hints,s=this._modeling;y(t,(function(e){u(e.x)||(e.x=0),u(e.y)||(e.y=0)}));var a=vt(v(t,(function(e){return!e.hidden})));y(t,(function(e){dn(e)&&(e.waypoints=E(e.waypoints,(function(e){return{x:xm(e.x-a.x-a.width/2+r.x),y:xm(e.y-a.y-a.height/2+r.y)}}))),z(e,{x:xm(e.x-a.x-a.width/2+r.x),y:xm(e.y-a.y-a.height/2+r.y)})}));var l=pt(t),c={};y(t,(function(e){if(dn(e))c[e.id]=u(i)?s.createConnection(c[e.source.id],c[e.target.id],i,e,e.parent||n,o):s.createConnection(c[e.source.id],c[e.target.id],e,e.parent||n,o);else{var t=z({},o);-1===l.indexOf(e)&&(t.autoResize=!1),fn(e)&&(t=j(t,["attach"])),c[e.id]=u(i)?s.createShape(e,I(e,["x","y","width","height"]),e.parent||n,i,t):s.createShape(e,I(e,["x","y","width","height"]),e.parent||n,t)}})),e.elements=O(c)};var _m=Math.round;function Em(e){this._canvas=e}function km(e){Em.call(this,e)}Em.$inject=["canvas"],Em.prototype.execute=function(e){var t=e.shape,n=e.position,i=e.parent,r=e.parentIndex;if(!i)throw new Error("parent required");if(!n)throw new Error("position required");return void 0!==n.width?z(t,n):z(t,{x:n.x-_m(t.width/2),y:n.y-_m(t.height/2)}),this._canvas.addShape(t,i,r),t},Em.prototype.revert=function(e){var t=e.shape;return this._canvas.removeShape(t),t},e(km,Em),km.$inject=["canvas"];var Om=Em.prototype.execute;km.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,Om.call(this,e)};var Sm=Em.prototype.revert;function Cm(e,t){this._canvas=e,this._modeling=t}function Pm(e,t){this._modeling=e,this._elementRegistry=t}function Am(e,t){this._canvas=e,this._modeling=t}function Mm(e){this._modeling=e}km.prototype.revert=function(e){return e.shape.labelTarget=null,Sm.call(this,e)},Cm.$inject=["canvas","modeling"],Cm.prototype.preExecute=function(e){var t=this._modeling,n=e.connection;rm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})}))},Cm.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},Cm.prototype.revert=function(e){var t=e.connection,n=e.parent,i=e.parentIndex;return t.source=e.source,t.target=e.target,Ot(n.children,t,i),this._canvas.addConnection(t,n),t},Pm.$inject=["modeling","elementRegistry"],Pm.prototype.postExecute=function(e){var t=this._modeling,n=this._elementRegistry;y(e.elements,(function(e){n.get(e.id)&&(e.waypoints?t.removeConnection(e):t.removeShape(e))}))},Am.$inject=["canvas","modeling"],Am.prototype.preExecute=function(e){var t=this._modeling,n=e.shape;rm(n.incoming,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.outgoing,(function(e){t.removeConnection(e,{nested:!0})})),rm(n.children,(function(e){dn(e)?t.removeConnection(e,{nested:!0}):t.removeShape(e,{nested:!0})}))},Am.prototype.execute=function(e){var t=this._canvas,n=e.shape,i=n.parent;return e.oldParent=i,e.oldParentIndex=St(i.children,n),t.removeShape(n),n},Am.prototype.revert=function(e){var t=this._canvas,n=e.shape,i=e.oldParent,r=e.oldParentIndex;return Ot(i.children,n,r),t.addShape(n,i),n},Mm.$inject=["modeling"];var Rm={x:"y",y:"x"};function Tm(e,t){this._layouter=e,this._canvas=t}function Dm(){}function Bm(){this.allShapes={},this.allConnections={},this.enclosedElements={},this.enclosedConnections={},this.topLevel={}}function Lm(e){this._modeling=e}function Nm(e){this._helper=new Lm(e)}function zm(e){this._modeling=e,this._helper=new Lm(e)}function $m(e){this._modeling=e}function Im(e){return e.original||e}function jm(e,t){this._modeling=e,this._rules=t}function Fm(e){this._modeling=e}function Hm(e){this._modeling=e}function Vm(e){return z({},e)}function qm(e){switch(e){case"n":case"s":return"y";case"w":case"e":return"x"}}function Wm(e,t,n){var i=qm(n);return/e|s/.test(n)?e[i]>t:/n|w/.test(n)?e[i]<t:void 0}function Qm(e,t){return-1!==e.indexOf(t)}function Gm(e){this._modeling=e}function Xm(e){var t={};return y(e,(function(e){t[e.id]=e.hidden,e.children&&(t=z({},t,Xm(e.children)))})),t}function Um(e,t){var n=[];return y(e,(function(e){e.hidden=t,n=n.concat(e),e.children&&(n=n.concat(Um(e.children,e.collapsed||t)))})),n}function Ym(e,t){var n=[];return y(e,(function(e){e.hidden=t[e.id],n=n.concat(e),e.children&&(n=n.concat(Ym(e.children,t)))})),n}function Km(e){this._modeling=e}function Zm(e,t){return kt(e&&e.attachers,t)}function Jm(e,t,n){if(e){var i=e.attachers;i||(e.attachers=i=[]),Ot(i,t,n)}}function eg(){}function tg(e,t,n){this._eventBus=e,this._elementFactory=t,this._commandStack=n;var i=this;e.on("diagram.init",(function(){i.registerHandlers(n)}))}function ng(e){this._elementRegistry=e}function ig(e,t){y(t,(function(t,n){e.set(n,t)}))}Mm.prototype.preExecute=function(e){var t=this._modeling,n=e.groups,i=e.axis,r=e.dimension;function o(e,t){e.range.min=Math.min(t[i],e.range.min),e.range.max=Math.max(t[i]+t[r],e.range.max)}function s(e){return e[i]+e[r]/2}function a(e){return e.length-1}function l(e){return e.max-e.min}var c,h,u=n[0],p=a(n),d=n[p],f=0;y(n,(function(e,c){var h,u,d;e.elements.length<2?c&&c!==n.length-1&&(o(e,e.elements[0]),f+=l(e.range)):(u=(h=A(e.elements,i))[0],c===p&&(u=h[a(h)]),d=s(u),e.range=null,y(h,(function(n){!function(e,n){var r={y:0};r[i]=e-s(n),r[i]&&(r[Rm[i]]=0,t.moveElements([n],r,n.parent))}(d,n),null!==e.range?o(e,n):e.range={min:n[i],max:n[i]+n[r]}})),c&&c!==n.length-1&&(f+=l(e.range)))})),h=Math.abs(d.range.min-u.range.max),(c=Math.round((h-f)/(n.length-1)))<n.length-1||y(n,(function(e,o){var s,a={};e!==u&&e!==d&&(s=n[o-1],e.range.max=0,y(e.elements,(function(n,o){a[Rm[i]]=0,a[i]=s.range.max-n[i]+c,e.range.min!==n[i]&&(a[i]+=n[i]-e.range.min),a[i]&&t.moveElements([n],a,n.parent),e.range.max=Math.max(n[i]+n[r],o?e.range.max:0)})))}))},Mm.prototype.postExecute=function(e){},Tm.$inject=["layouter","canvas"],Tm.prototype.execute=function(e){var t=e.connection;return z(e,{oldWaypoints:t.waypoints}),t.waypoints=this._layouter.layoutConnection(t,e.hints),t},Tm.prototype.revert=function(e){var t=e.connection;return t.waypoints=e.oldWaypoints,t},Dm.prototype.execute=function(e){var t=e.connection,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldParent=o,e.oldParentIndex=kt(o.children,t),Ot(i.children,t,r),t.parent=i,y(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},Dm.prototype.revert=function(e){var t=e.connection,n=t.parent,i=e.oldParent,r=e.oldParentIndex,o=e.delta;return kt(n.children,t),Ot(i.children,t,r),t.parent=i,y(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),h(t)&&(n=t,t=!0);var i=wt((n=n||{}).allShapes),r=wt(n.allConnections),o=wt(n.enclosedElements),a=wt(n.enclosedConnections),l=wt(n.topLevel,t&&S(e,(function(e){return e.id})));function c(e){l[e.source.id]&&l[e.target.id]&&(l[e.id]=[e]),i[e.source.id]&&i[e.target.id]&&(a[e.id]=o[e.id]=e),r[e.id]=e}return mt(e,(function(e){if(o[e.id]=e,!e.waypoints)return i[e.id]=e,y(e.incoming,c),y(e.outgoing,c),e.children;a[e.id]=r[e.id]=e})),{allShapes:i,allConnections:r,topLevel:l,enclosedConnections:a,enclosedElements:o}}(e,!!t,this);return z(this,n),this},Lm.prototype.moveRecursive=function(e,t,n){return e?this.moveClosure(this.getClosure(e),t,n):[]},Lm.prototype.moveClosure=function(e,t,n,i,r){var o=this._modeling,s=e.allShapes,a=e.allConnections,l=e.enclosedConnections,c=e.topLevel,h=!1;r&&r.parent===n&&(h=!0),y(s,(function(e){o.moveShape(e,t,c[e.id]&&!h&&n,{recurse:!1,layout:!1})})),y(a,(function(e){var i=!!s[e.source.id],r=!!s[e.target.id];l[e.id]&&i&&r?o.moveConnection(e,t,c[e.id]&&!h&&n):o.layoutConnection(e,{connectionStart:i&&fp(e,e.source,t),connectionEnd:r&&mp(e,e.target,t)})}))},Lm.prototype.getClosure=function(e){return(new Bm).addAll(e,!0)},Nm.$inject=["modeling"],Nm.prototype.preExecute=function(e){e.closure=this._helper.getClosure(e.shapes)},Nm.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)},zm.$inject=["modeling"],zm.prototype.execute=function(e){var t=e.shape,n=e.delta,i=e.newParent||t.parent,r=e.newParentIndex,o=t.parent;return e.oldBounds=I(t,["x","y","width","height"]),e.oldParent=o,e.oldParentIndex=kt(o.children,t),Ot(i.children,t,r),z(t,{parent:i,x:t.x+n.x,y:t.y+n.y}),t},zm.prototype.postExecute=function(e){var t=e.shape,n=e.delta,i=e.hints,r=this._modeling;!1!==i.layout&&(y(t.incoming,(function(e){r.layoutConnection(e,{connectionEnd:mp(e,t,n)})})),y(t.outgoing,(function(e){r.layoutConnection(e,{connectionStart:fp(e,t,n)})}))),!1!==i.recurse&&this.moveChildren(e)},zm.prototype.revert=function(e){var t=e.shape,n=e.oldParent,i=e.oldParentIndex,r=e.delta;return Ot(n.children,t,i),z(t,{parent:n,x:t.x-r.x,y:t.y-r.y}),t},zm.prototype.moveChildren=function(e){var t=e.delta,n=e.shape;this._helper.moveRecursive(n.children,t,null)},zm.prototype.getNewParent=function(e){return e.newParent||e.shape.parent},$m.$inject=["modeling"],$m.prototype.execute=function(e){var t=e.newSource,n=e.newTarget,i=e.connection,r=e.dockingOrPoints;if(!t&&!n)throw new Error("newSource or newTarget required");return c(r)&&(e.oldWaypoints=i.waypoints,i.waypoints=r),t&&(e.oldSource=i.source,i.source=t),n&&(e.oldTarget=i.target,i.target=n),i},$m.prototype.postExecute=function(e){var t=e.connection,n=e.newSource,i=e.newTarget,r=e.dockingOrPoints,o=e.hints||{},s={};o.connectionStart&&(s.connectionStart=o.connectionStart),o.connectionEnd&&(s.connectionEnd=o.connectionEnd),!1!==o.layoutConnection&&(!n||i&&"source"!==o.docking||(s.connectionStart=s.connectionStart||Im(c(r)?r[0]:r)),!i||n&&"target"!==o.docking||(s.connectionEnd=s.connectionEnd||Im(c(r)?r[r.length-1]:r)),o.newWaypoints&&(s.waypoints=o.newWaypoints),this._modeling.layoutConnection(t,s))},$m.prototype.revert=function(e){var t=e.oldSource,n=e.oldTarget,i=e.oldWaypoints,r=e.connection;return t&&(r.source=t),n&&(r.target=n),i&&(r.waypoints=i),r},jm.$inject=["modeling","rules"],jm.prototype.preExecute=function(e){var t,n=this,i=this._modeling,r=this._rules,o=e.oldShape,s=e.newData,a=e.hints||{};function l(e,t,n){return r.allowed("connection.reconnect",{connection:n,source:e,target:t})}var c,h={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,h,o.parent,a),o.host&&i.updateAttachment(t,o.host),!1!==a.moveChildren&&(c=o.children.slice(),i.moveElements(c,{x:0,y:0},t,a));var p=o.incoming.slice(),d=o.outgoing.slice();y(p,(function(e){l(e.source,t,e)&&n.reconnectEnd(e,t,dp(e,t,u),a)})),y(d,(function(e){var i=e.target;l(t,i,e)&&n.reconnectStart(e,t,pp(e,t,u),a)}))},jm.prototype.postExecute=function(e){var t=e.oldShape;this._modeling.removeShape(t)},jm.prototype.execute=function(e){},jm.prototype.revert=function(e){},jm.prototype.createShape=function(e,t,n,i){return this._modeling.createShape(e,t,n,i)},jm.prototype.reconnectStart=function(e,t,n,i){this._modeling.reconnectStart(e,t,n,i)},jm.prototype.reconnectEnd=function(e,t,n,i){this._modeling.reconnectEnd(e,t,n,i)},Fm.$inject=["modeling"],Fm.prototype.execute=function(e){var t=e.shape,n=e.newBounds,i=e.minBounds;if(void 0===n.x||void 0===n.y||void 0===n.width||void 0===n.height)throw new Error("newBounds must have {x, y, width, height} properties");if(i&&(n.width<i.width||n.height<i.height))throw new Error("width and height cannot be less than minimum height and width");if(!i&&n.width<10||n.height<10)throw new Error("width and height cannot be less than 10px");return e.oldBounds={width:t.width,height:t.height,x:t.x,y:t.y},z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Fm.prototype.postExecute=function(e){var t=this._modeling,n=e.shape,i=e.oldBounds;!1!==(e.hints||{}).layout&&(y(n.incoming,(function(e){t.layoutConnection(e,{connectionEnd:dp(e,n,i)})})),y(n.outgoing,(function(e){t.layoutConnection(e,{connectionStart:pp(e,n,i)})})))},Fm.prototype.revert=function(e){var t=e.shape,n=e.oldBounds;return z(t,{width:n.width,height:n.height,x:n.x,y:n.y}),t},Hm.$inject=["modeling"],Hm.prototype.preExecute=function(e){var t=e.delta,n=e.direction,i=e.movingShapes,r=e.resizingShapes,o=e.start,s={};this.moveShapes(i,t),y(r,(function(e){s[e.id]=function(e){return{x:e.x,y:e.y,height:e.height,width:e.width}}(e)})),this.resizeShapes(r,t,n),this.updateConnectionWaypoints(function(e,t){var n=[];return y(e.concat(t),(function(i){var r=i.incoming,o=i.outgoing;y(r.concat(o),(function(i){var r=i.source,o=i.target;(Nf(e,r)||Nf(e,o)||Nf(t,r)||Nf(t,o))&&(Nf(n,i)||n.push(i))}))})),n}(i,r),t,n,o,i,r,s)},Hm.prototype.execute=function(){},Hm.prototype.revert=function(){},Hm.prototype.moveShapes=function(e,t){var n=this;y(e,(function(e){n._modeling.moveShape(e,t,null,{autoResize:!1,layout:!1,recurse:!1})}))},Hm.prototype.resizeShapes=function(e,t,n){var i=this;y(e,(function(e){var r=function(e,t,n){var i=e.x,r=e.y,o=e.width,s=e.height,a=n.x,l=n.y;switch(t){case"n":return{x:i,y:r+l,width:o,height:s-l};case"s":return{x:i,y:r,width:o,height:s+l};case"w":return{x:i+a,y:r,width:o-a,height:s};case"e":return{x:i,y:r,width:o+a,height:s};default:throw new Error("unknown direction: "+t)}}(e,n,t);i._modeling.resizeShape(e,r,null,{attachSupport:!1,autoResize:!1,layout:!1})}))},Hm.prototype.updateConnectionWaypoints=function(e,t,n,i,r,o,s){var a=this,l=r.concat(o);y(e,(function(e){var c=e.source,h=e.target,u=function(e){return E(e.waypoints,(function(e){return(e=Vm(e)).original&&(e.original=Vm(e.original)),e}))}(e),p=qm(n),d={};Qm(l,c)&&Qm(l,h)?(u=E(u,(function(e){return Wm(e,i,n)&&(e[p]=e[p]+t[p]),e.original&&Wm(e.original,i,n)&&(e.original[p]=e.original[p]+t[p]),e})),a._modeling.updateWaypoints(e,u,{labelBehavior:!1})):(Qm(l,c)||Qm(l,h))&&(Qm(r,c)?d.connectionStart=fp(e,c,t):Qm(r,h)?d.connectionEnd=mp(e,h,t):Qm(o,c)?d.connectionStart=pp(e,c,s[c.id]):Qm(o,h)&&(d.connectionEnd=dp(e,h,s[h.id])),a._modeling.layoutConnection(e,d))}))},Gm.$inject=["modeling"],Gm.prototype.execute=function(e){var t=e.shape,n=t.children;e.oldChildrenVisibility=Xm(n),t.collapsed=!t.collapsed;var i=Um(n,t.collapsed);return[t].concat(i)},Gm.prototype.revert=function(e){var t=e.shape,n=e.oldChildrenVisibility,i=Ym(t.children,n);return t.collapsed=!t.collapsed,[t].concat(i)},Km.$inject=["modeling"],Km.prototype.execute=function(e){var t=e.shape,n=e.newHost,i=t.host;return e.oldHost=i,e.attacherIdx=Zm(i,t),Jm(n,t),t.host=n,t},Km.prototype.revert=function(e){var t=e.shape,n=e.newHost,i=e.oldHost,r=e.attacherIdx;return t.host=i,Zm(n,t),Jm(i,t,r),t},eg.prototype.execute=function(e){var t=e.connection,n=e.newWaypoints;return e.oldWaypoints=t.waypoints,t.waypoints=n,t},eg.prototype.revert=function(e){var t=e.connection,n=e.oldWaypoints;return t.waypoints=n,t},tg.$inject=["eventBus","elementFactory","commandStack"],tg.prototype.getHandlers=function(){return{"shape.append":ym,"shape.create":Em,"shape.delete":Am,"shape.move":zm,"shape.resize":Fm,"shape.replace":jm,"shape.toggleCollapse":Gm,spaceTool:Hm,"label.create":km,"connection.create":bm,"connection.delete":Cm,"connection.move":Dm,"connection.layout":Tm,"connection.updateWaypoints":eg,"connection.reconnect":$m,"elements.create":wm,"elements.move":Nm,"elements.delete":Pm,"elements.distribute":Mm,"elements.align":vm,"element.updateAttachment":Km}},tg.prototype.registerHandlers=function(e){y(this.getHandlers(),(function(t,n){e.registerHandler(n,t)}))},tg.prototype.moveShape=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=null);var o={shape:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("shape.move",o)},tg.prototype.updateAttachment=function(e,t){var n={shape:e,newHost:t};this._commandStack.execute("element.updateAttachment",n)},tg.prototype.moveElements=function(e,t,n,i){var r,o=(i=i||{}).attach,s=n;!0===o?(r=n,s=n.parent):!1===o&&(r=null);var a={shapes:e,delta:t,newParent:s,newHost:r,hints:i};this._commandStack.execute("elements.move",a)},tg.prototype.moveConnection=function(e,t,n,i,r){"object"==typeof i&&(r=i,i=void 0);var o={connection:e,delta:t,newParent:n,newParentIndex:i,hints:r||{}};this._commandStack.execute("connection.move",o)},tg.prototype.layoutConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.layout",n)},tg.prototype.createConnection=function(e,t,n,i,r,o){"object"==typeof n&&(o=r,r=i,i=n,n=void 0);var s={source:e,target:t,parent:r,parentIndex:n,connection:i=this._create("connection",i),hints:o};return this._commandStack.execute("connection.create",s),s.connection},tg.prototype.createShape=function(e,t,n,i,r){"number"!=typeof i&&(r=i,i=void 0);var o,s,a=(r=r||{}).attach;e=this._create("shape",e),a?(o=n.parent,s=n):o=n;var l={position:t,shape:e,parent:o,parentIndex:i,host:s,hints:r};return this._commandStack.execute("shape.create",l),l.shape},tg.prototype.createElements=function(e,t,n,i,r){c(e)||(e=[e]),"number"!=typeof i&&(r=i,i=void 0);var o={position:t,elements:e,parent:n,parentIndex:i,hints:r=r||{}};return this._commandStack.execute("elements.create",o),o.elements},tg.prototype.createLabel=function(e,t,n,i){n=this._create("label",n);var r={labelTarget:e,position:t,parent:i||e.parent,shape:n};return this._commandStack.execute("label.create",r),r.shape},tg.prototype.appendShape=function(e,t,n,i,r){r=r||{};var o={source:e,position:n,target:i,shape:t=this._create("shape",t),connection:r.connection,connectionParent:r.connectionParent,hints:r};return this._commandStack.execute("shape.append",o),o.shape},tg.prototype.removeElements=function(e){var t={elements:e};this._commandStack.execute("elements.delete",t)},tg.prototype.distributeElements=function(e,t,n){var i={groups:e,axis:t,dimension:n};this._commandStack.execute("elements.distribute",i)},tg.prototype.removeShape=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.delete",n)},tg.prototype.removeConnection=function(e,t){var n={connection:e,hints:t||{}};this._commandStack.execute("connection.delete",n)},tg.prototype.replaceShape=function(e,t,n){var i={oldShape:e,newData:t,hints:n||{}};return this._commandStack.execute("shape.replace",i),i.newShape},tg.prototype.alignElements=function(e,t){var n={elements:e,alignment:t};this._commandStack.execute("elements.align",n)},tg.prototype.resizeShape=function(e,t,n,i){var r={shape:e,newBounds:t,minBounds:n,hints:i};this._commandStack.execute("shape.resize",r)},tg.prototype.createSpace=function(e,t,n,i,r){var o={delta:n,direction:i,movingShapes:e,resizingShapes:t,start:r};this._commandStack.execute("spaceTool",o)},tg.prototype.updateWaypoints=function(e,t,n){var i={connection:e,newWaypoints:t,hints:n||{}};this._commandStack.execute("connection.updateWaypoints",i)},tg.prototype.reconnect=function(e,t,n,i,r){var o={connection:e,newSource:t,newTarget:n,dockingOrPoints:i,hints:r||{}};this._commandStack.execute("connection.reconnect",o)},tg.prototype.reconnectStart=function(e,t,n,i){i||(i={}),this.reconnect(e,t,e.target,n,z(i,{docking:"source"}))},tg.prototype.reconnectEnd=function(e,t,n,i){i||(i={}),this.reconnect(e,e.source,t,n,z(i,{docking:"target"}))},tg.prototype.connect=function(e,t,n,i){return this.createConnection(e,t,n||{},e.parent,i)},tg.prototype._create=function(e,t){return t instanceof $n?t:this._elementFactory.create(e,t)},tg.prototype.toggleCollapse=function(e,t){var n={shape:e,hints:t||{}};this._commandStack.execute("shape.toggleCollapse",n)},ng.$inject=["elementRegistry"],ng.prototype.execute=function(e){var t=e.element,n=e.moddleElement,i=e.properties;if(!n)throw new Error("<moddleElement> required");var r=e.changed||this._getVisualReferences(n).concat(t),o=e.oldProperties||function(e,t){return x(t,(function(t,n){return t[n]=e.get(n),t}),{})}(n,k(i));return ig(n,i),e.oldProperties=o,e.changed=r,r},ng.prototype.revert=function(e){var t=e.oldProperties,n=e.moddleElement,i=e.changed;return ig(n,t),i},ng.prototype._getVisualReferences=function(e){var t=this._elementRegistry;return Er(e,"bpmn:DataObject")?function(e,t){return t.filter((function(t){return Er(t,"bpmn:DataObjectReference")&&Or(t).dataObjectRef===e}))}(e,t):[]};var rg="default",og="id",sg="di",ag={width:0,height:0};function lg(e,t,n,i){this._elementRegistry=e,this._moddle=t,this._modeling=n,this._textRenderer=i}function cg(e,t){return og in e&&e[og]!==t[og]}function hg(e,t){var n=e.businessObject,i=Sr(e);y(t,(function(e,t){t!==sg?n.set(t,e):i&&function(e,t){y(t,(function(t,n){e.set(n,t)}))}(i,e)}))}lg.$inject=["elementRegistry","moddle","modeling","textRenderer"],lg.prototype.execute=function(e){var t=e.element,n=[t];if(!t)throw new Error("element required");var i=this._elementRegistry,r=this._moddle.ids,o=t.businessObject,s=function(e){var t=z({},e);return ug.forEach((function(n){n in e&&(t[n]=Or(t[n]))})),t}(e.properties),a=e.oldProperties||function(e,t){var n=k(t),i=e.businessObject,r=Sr(e);return x(n,(function(e,n){return e[n]=n!==sg?i.get(n):function(e,t){return x(t,(function(t,n){return t[n]=e&&e.get(n),t}),{})}(r,k(t.di)),e}),{})}(t,s);return cg(s,o)&&(r.unclaim(o[og]),i.updateId(t,s[og]),r.claim(s[og],o)),rg in s&&(s[rg]&&n.push(i.get(s[rg].id)),o[rg]&&n.push(i.get(o[rg].id))),hg(t,s),e.oldProperties=a,e.changed=n,n},lg.prototype.postExecute=function(e){var t=e.element.label,n=t&&Or(t).name;if(n){var i=this._textRenderer.getExternalLabelBounds(t,n);this._modeling.resizeShape(t,i,ag)}},lg.prototype.revert=function(e){var t=e.element,n=e.properties,i=e.oldProperties,r=t.businessObject,o=this._elementRegistry,s=this._moddle.ids;return hg(t,i),cg(n,r)&&(s.unclaim(n[og]),o.updateId(t,i[og]),s.claim(i[og],r)),e.changed};var ug=["default"];function pg(e,t){this._canvas=e,this._modeling=t}function dg(e,t){this._modeling=e,this._spaceTool=t}function fg(e){this._modeling=e}function mg(e,t){this._modeling=e,this._spaceTool=t}pg.$inject=["canvas","modeling"],pg.prototype.execute=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=t.getRootElement(),o=r.businessObject,s=o.$parent,a=Sr(r);return t.setRootElement(n),t.removeRootElement(r),Ot(s.rootElements,i),i.$parent=s,kt(s.rootElements,o),o.$parent=null,r.di=null,a.bpmnElement=i,n.di=a,e.oldRoot=r,[]},pg.prototype.revert=function(e){var t=this._canvas,n=e.newRoot,i=n.businessObject,r=e.oldRoot,o=r.businessObject,s=i.$parent,a=Sr(n);return t.setRootElement(r),t.removeRootElement(n),kt(s.rootElements,i),i.$parent=null,Ot(s.rootElements,o),o.$parent=s,n.di=null,a.bpmnElement=o,r.di=a,[]},dg.$inject=["modeling","spaceTool"],dg.prototype.preExecute=function(e){var t=this._spaceTool,n=this._modeling,i=e.shape,r=e.location,o=Au(i),s=o===i,a=s?i:i.parent,l=Pu(a),c=qr(i);if(c?"left"===r?r="top":"right"===r&&(r="bottom"):"top"===r?r="left":"bottom"===r&&(r="right"),!l.length){var h=c?{x:i.x+Su,y:i.y,width:i.width-Su,height:i.height}:{x:i.x,y:i.y+Su,width:i.width,height:i.height-Su};n.createShape({type:"bpmn:Lane",isHorizontal:c},h,a)}var u,p,d,f,m,g=[];mt(o,(function(e){return g.push(e),e.label&&g.push(e.label),e===i?[]:v(e.children,(function(e){return e!==i}))})),"top"===r?(u=-120,d=(p=i.y)+10,f="n",m="y"):"left"===r?(u=-120,d=(p=i.x)+10,f="w",m="x"):"bottom"===r?(u=120,d=(p=i.y+i.height)-10,f="s",m="y"):"right"===r&&(u=120,d=(p=i.x+i.width)-10,f="e",m="x");var y=t.calculateAdjustments(g,m,u,d),b=c?{x:0,y:u}:{x:u,y:0};t.makeSpace(y.movingShapes,y.resizingShapes,b,f,d);var x=c?{x:i.x+(s?Su:0),y:p-("top"===r?120:0),width:i.width-(s?Su:0),height:120}:{x:p-("left"===r?120:0),y:i.y+(s?Su:0),width:120,height:i.height-(s?Su:0)};e.newLane=n.createShape({type:"bpmn:Lane",isHorizontal:c},x,a)},fg.$inject=["modeling"],fg.prototype.preExecute=function(e){var t=this._modeling,n=e.shape,i=e.count,r=Pu(n),o=r.length;if(o>i)throw new Error(`more than <${i}> child lanes`);var s,a,l,c,h=qr(n),u=h?n.height:n.width,p=Math.round(u/i);for(c=0;c<i;c++)s=c===i-1?u-p*c:p,a=h?{x:n.x+Su,y:n.y+c*p,width:n.width-Su,height:s}:{x:n.x+c*p,y:n.y+Su,width:s,height:n.height-Su},c<o?t.resizeShape(r[c],a):(l={type:"bpmn:Lane",isHorizontal:h},t.createShape(l,a,n))},mg.$inject=["modeling","spaceTool"],mg.prototype.preExecute=function(e){var t=e.shape,n=e.newBounds;!1!==e.balanced?this.resizeBalanced(t,n):this.resizeSpace(t,n)},mg.prototype.resizeBalanced=function(e,t){var n=this._modeling,i=Mu(e,t);n.resizeShape(e,t),i.forEach((function(e){n.resizeShape(e.shape,e.newBounds)}))},mg.prototype.resizeSpace=function(e,t){var n,i,r,o,s,a=this._spaceTool,l=vn(e),c=bu(vn(t),l),h=Au(e),u=[],p=[];mt(h,(function(e){return u.push(e),(Er(e,"bpmn:Lane")||Er(e,"bpmn:Participant"))&&p.push(e),e.children})),(c.bottom||c.top)&&(n=c.bottom||c.top,i=e.y+(c.bottom?e.height:0)+(c.bottom?-10:10),r=c.bottom?"s":"n",o=c.top>0||c.bottom<0?-n:n,s=a.calculateAdjustments(u,"y",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:0,y:n},r)),(c.left||c.right)&&(n=c.right||c.left,i=e.x+(c.right?e.width:0)+(c.right?-10:100),r=c.right?"e":"w",o=c.left>0||c.right<0?-n:n,s=a.calculateAdjustments(p,"x",o,i),a.makeSpace(s.movingShapes,s.resizingShapes,{x:n,y:0},r))};var gg="flowNodeRef",vg="lanes";function yg(e){this._elementRegistry=e}function bg(e){this._moddle=e}yg.$inject=["elementRegistry"],yg.prototype._computeUpdates=function(e,t){var n=[],i=[],r={},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=Au(e);return r[t.id]||(r[t.id]=Cu(t)),r[t.id]}(e);return t.filter((function(t){return n=e,i=vn(t),r=n.x+n.width/2,o=n.y+n.height/2,r>i.left&&r<i.right&&o>i.top&&o<i.bottom;var n,i,r,o})).map((function(e){return e.businessObject}))}return t.forEach((function(e){var t=Au(e);if(t&&-1===n.indexOf(t)){var i=t.children.filter((function(e){return Er(e,"bpmn:FlowNode")}));i.forEach(s),n.push(t)}})),e.forEach(s),o.forEach((function(e){var t=e.businessObject,n=t.get(vg).slice(),r=a(e);i.push({flowNode:t,remove:n,add:r})})),t.forEach((function(e){var t=e.businessObject;e.parent||t.get(gg).forEach((function(e){i.push({flowNode:e,remove:[t],add:[]})}))})),i},yg.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(vg);e.remove.forEach((function(e){kt(n,e),kt(e.get(gg),t)})),e.add.forEach((function(e){Ot(n,e),Ot(e.get(gg),t)}))})),[]},yg.prototype.revert=function(e){return e.updates.forEach((function(e){var t=e.flowNode,n=t.get(vg);e.add.forEach((function(e){kt(n,e),kt(e.get(gg),t)})),e.remove.forEach((function(e){Ot(n,e),Ot(e.get(gg),t)}))})),[]},bg.$inject=["moddle"],bg.prototype.execute=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.claim(n,i):t.unclaim(n),[]},bg.prototype.revert=function(e){var t=this._moddle.ids,n=e.id,i=e.element;return e.claiming?t.unclaim(n):t.claim(n,i),[]};var xg={fill:void 0,stroke:void 0};function wg(e){this._commandStack=e,this._normalizeColor=function(e){if(e){if(d(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}`)}}}wg.$inject=["commandStack"],wg.prototype.postExecute=function(e){var t=e.elements,n=e.colors||xg,i=this,r={};"fill"in n&&z(r,{"background-color":this._normalizeColor(n.fill)}),"stroke"in n&&z(r,{"border-color":this._normalizeColor(n.stroke)}),y(t,(function(e){var t=dn(e)?I(r,["border-color"]):r,n=Sr(e);if(function(e){"border-color"in e&&(e.stroke=e["border-color"]);"background-color"in e&&(e.fill=e["background-color"])}(t),fn(e))i._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:n.label,properties:{color:r["border-color"]}});else{if(!kr(n,["bpmndi:BPMNEdge","bpmndi:BPMNShape"]))return;i._commandStack.execute("element.updateProperties",{element:e,properties:{di:t}})}}))};var _g={width:0,height:0};function Eg(e,t,n){function i(e,t){var n=e.label||e,i=e.labelTarget||e;return function(e,t){var n=e.businessObject,i=eo(n);if(i)if("categoryValueRef"===i){if(!n[i])return e;n[i].value=t}else n[i]=t}(n,t),[n,i]}this.preExecute=function(t){var n=t.element,i=n.businessObject,r=t.newLabel;if(!fn(n)&&Yr(n)&&!Kr(n)&&!kg(r)){var o=Jr(n);o={x:o.x,y:o.y+7},e.createLabel(n,o,{id:i.id+"_label",businessObject:i,di:n.di})}},this.execute=function(e){return e.oldLabel=to(e.element),i(e.element,e.newLabel)},this.revert=function(e){return i(e.element,e.oldLabel)},this.postExecute=function(n){var i=n.element,r=i.label||i,o=n.newLabel,s=n.newBounds,a=n.hints||{};if(fn(r)||Er(r,"bpmn:TextAnnotation"))if(fn(r)&&kg(o))!1!==a.removeShape&&e.removeShape(r,{unsetLabel:!1});else{var l=to(i);void 0===s&&(s=t.getExternalLabelBounds(r,l)),s&&e.resizeShape(r,s,_g)}}}function kg(e){return!e||!e.trim()}function Og(e,t,n,i){tg.call(this,e,t,n),this._bpmnRules=i}function Sg(){}Eg.$inject=["modeling","textRenderer","bpmnFactory"],e(Og,tg),Og.$inject=["eventBus","elementFactory","commandStack","bpmnRules"],Og.prototype.getHandlers=function(){var e=tg.prototype.getHandlers.call(this);return e["element.updateModdleProperties"]=ng,e["element.updateProperties"]=lg,e["canvas.updateRoot"]=pg,e["lane.add"]=dg,e["lane.resize"]=mg,e["lane.split"]=fg,e["lane.updateRefs"]=yg,e["id.updateClaim"]=bg,e["element.setColor"]=wg,e["element.updateLabel"]=Eg,e},Og.prototype.updateLabel=function(e,t,n,i){this._commandStack.execute("element.updateLabel",{element:e,newLabel:t,newBounds:n,hints:i||{}})},Og.prototype.connect=function(e,t,n,i){var r=this._bpmnRules;if(n||(n=r.canConnect(e,t)),n)return this.createConnection(e,t,n,e.parent,i)},Og.prototype.updateModdleProperties=function(e,t,n){this._commandStack.execute("element.updateModdleProperties",{element:e,moddleElement:t,properties:n})},Og.prototype.updateProperties=function(e,t){this._commandStack.execute("element.updateProperties",{element:e,properties:t})},Og.prototype.resizeLane=function(e,t,n){this._commandStack.execute("lane.resize",{shape:e,newBounds:t,balanced:n})},Og.prototype.addLane=function(e,t){var n={shape:e,location:t};return this._commandStack.execute("lane.add",n),n.newLane},Og.prototype.splitLane=function(e,t){this._commandStack.execute("lane.split",{shape:e,count:t})},Og.prototype.makeCollaboration=function(){var e=this._create("root",{type:"bpmn:Collaboration"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Og.prototype.makeProcess=function(){var e=this._create("root",{type:"bpmn:Process"}),t={newRoot:e};return this._commandStack.execute("canvas.updateRoot",t),e},Og.prototype.updateLaneRefs=function(e,t){this._commandStack.execute("lane.updateRefs",{flowNodeShapes:e,laneShapes:t})},Og.prototype.claimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t,claiming:!0})},Og.prototype.unclaimId=function(e,t){this._commandStack.execute("id.updateClaim",{id:e,element:t})},Og.prototype.setColor=function(e,t){e.length||(e=[e]),this._commandStack.execute("element.setColor",{elements:e,colors:t})},Sg.prototype.layoutConnection=function(e,t){return[(t=t||{}).connectionStart||xn(t.source||e.source),t.connectionEnd||xn(t.target||e.target)]};var Cg=20,Pg=5,Ag=Math.round,Mg=20,Rg={"h:h":20,"v:v":20,"h:v":-10,"v:h":-10};function Tg(e,t,n){var i,r,o,s=wn(t,e,Pg),a=n.split(":")[0],l=Ag((t.x-e.x)/2+e.x),c=Ag((t.y-e.y)/2+e.y),h=(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),p=!1,d=!1;return h?(i=u?{x:l,y:e.y}:{x:e.x,y:c},r=u?"h:h":"v:v"):(p=function(e,t){return!{t:/top/,r:/right/,b:/bottom/,l:/left/,h:/./,v:/./}[t].test(e)}(s,a),r=u?"h:v":"v:h",p?u?(d=c===e.y,i={x:e.x+Cg*(/l/.test(a)?-1:1),y:d?c+Cg:c}):i={x:(d=l===e.x)?l+Cg:l,y:e.y+Cg*(/t/.test(a)?-1:1)}:i={x:l,y:c}),{waypoints:Bg(e,i,r).concat(i),directions:r,turnNextDirections:d}}function Dg(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(Ig(n)){var i=function(e,t,n){return Tg(e,t,n)}(e,t,n),r=function(e,t,n){var i=Tg(t,e,Dg(n));return{waypoints:i.waypoints.slice().reverse(),directions:Dg(i.directions),turnNextDirections:i.turnNextDirections}}(e,t,n),o=function(e,t){var n=e.directions.split(":")[1],i=t.directions.split(":")[0];e.turnNextDirections&&(n="h"==n?"v":"h"),t.turnNextDirections&&(i="h"==i?"v":"h");var r=n+":"+i;return{waypoints:Bg(e.waypoints[e.waypoints.length-1],t.waypoints[0],r),directions:r}}(i,r);return[].concat(i.waypoints,o.waypoints,r.waypoints)}return function(e,t,n){var i=Ag((t.x-e.x)/2+e.x),r=Ag((t.y-e.y)/2+e.y);if("h:v"===n)return[{x:t.x,y:e.y}];if("v:h"===n)return[{x:e.x,y:t.y}];if("h:h"===n)return[{x:i,y:e.y},{x:i,y:t.y}];if("v:v"===n)return[{x:e.x,y:r},{x:t.x,y:r}];throw new Error("invalid directions: can only handle varians of [hv]:[hv]")}(e,t,n)}function Lg(e,t,n,i,r){var o=b(r&&r.preferredLayouts||[],"straight")[0]||"h:h",s=wn(e,t,Rg[o]||0),a=function(e,t){if(Ig(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),i=i||xn(t);var l=a.split(":"),c=jg(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 i=Bg(e,t,n);return i.unshift(e),i.push(t),Fg(i)}(c,jg(i,t,l[1],s),a)}function Ng(e,t,n,i,r,o){var s;return c(n)&&(r=n,o=i,n=xn(e),i=xn(t)),r=r||[],s=-1!==(o=z({preferredLayouts:[]},o)).preferredLayouts.indexOf("straight")&&function(e,t,n,i,r){var o,s,a={};if(s=wn(e,t),!/^(top|bottom|left|right)$/.test(s))return null;/top|bottom/.test(s)&&(o="x");/left|right/.test(s)&&(o="y");return"target"===r.preserveDocking?zg(o,i,e)?(a[o]=i[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:i.x,y:i.y}]):null:zg(o,n,t)?(a[o]=n[o],[{x:n.x,y:n.y},{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y,original:{x:void 0!==a.x?a.x:i.x,y:void 0!==a.y?a.y:i.y}}]):null}(e,t,n,i,o),s||(s=o.connectionEnd&&function(e,t,n,i){var r=i.slice().reverse();return r=$g(e,t,n,r),r?r.reverse():null}(t,e,i,r),s||((s=o.connectionStart&&$g(e,t,n,r))||(!o.connectionStart&&!o.connectionEnd&&r&&r.length?r:Lg(e,t,n,i,o))))}function zg(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 $g(e,t,n,i){if(function(e){return e.length<3||!(e.length>4)&&!!m(e,(function(t,n){var i=e[n-1];return i&&Ct(t,i)<3}))}(i))return null;var r,o=i[0],s=i.slice();return s[0]=n,s[1]=function(e,t,n){switch(Mt(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),r=function(e,t,n){var i;for(i=e.length-2;0!==i;i--)if(Tt(e[i],t,Mg)||Tt(e[i],n,Mg))return e.slice(i);return e}(s,e,t),r!==s&&(s=$g(e,t,n,r)),s&&Mt(s)?null:s}function Ig(e){return e&&/t|r|b|l/.test(e)}function jg(e,t,n,i){if("h"===n&&(n=/left/.test(i)?"l":"r"),"v"===n&&(n=/top/.test(i)?"t":"b"),"t"===n)return{original:e,x:e.x,y:t.y};if("r"===n)return{original:e,x:t.x+t.width,y:e.y};if("b"===n)return{original:e,x:e.x,y:t.y+t.height};if("l"===n)return{original:e,x:t.x,y:e.y};throw new Error("unexpected dockingDirection: <"+n+">")}function Fg(e){return e.reduce((function(t,n,i){return Pt(t[t.length-1],e[i+1],n,0)||t.push(n),t}),[])}var Hg=-10,Vg=40,qg={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},Wg={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},Qg={top:"bottom","top-right":"bottom-left","top-left":"bottom-right",right:"left",bottom:"top","bottom-right":"top-left","bottom-left":"top-right",left:"right"},Gg={top:"t",right:"r",bottom:"b",left:"l"};function Xg(e){this._elementRegistry=e}function Ug(e,t){return Er(t,"bpmn:Participant")?"source":Er(e,"bpmn:Participant")?"target":Jg(t)?"source":Jg(e)||Er(t,"bpmn:Event")?"target":Er(e,"bpmn:Event")?"source":null}function Yg(e){return Jg(e)?"target":"source"}function Kg(e,t){return e?e.original||e:xn(t)}function Zg(e,t){return Er(t,"bpmn:Activity")&&Er(e,"bpmn:BoundaryEvent")&&t.businessObject.isForCompensation}function Jg(e){return Er(e,"bpmn:SubProcess")&&Vr(e)}function ev(e,t){return e===t}function tv(e){var t=/right|left/.exec(e);return t&&t[0]}function nv(e){var t=/top|bottom/.exec(e);return t&&t[0]}function iv(e,t){return Qg[e]===t}function rv(e){return"right"===e||"left"===e}function ov(e,t,n){var i=t.waypoints,r=i&&i.length&&wn(i[0],e);return"top"===r?n.loop.fromTop:"right"===r?n.loop.fromRight:"left"===r?n.loop.fromLeft:n.loop.fromBottom}function sv(e,t,n,i){var r,o,s,a,l=xn(e),c=xn(t),h=(a=(s=e).host,wn(xn(s),a,Hg)),u=ev(e.host,t),p=-1!==["top","right","bottom","left"].indexOf(h),d=wn(c,l,{x:e.width/2+t.width/2,y:e.height/2+t.height/2});return u?function(e,t,n,i,r,o){var s,a=t?e:o.isHorizontal?nv(e):tv(e),l=Gg[a];s=t?rv(e)?av("y",n,i,r)?"h":o.boundaryLoop.alternateHorizontalSide:av("x",n,i,r)?"v":o.boundaryLoop.alternateVerticalSide:o.boundaryLoop.default;return[l+":"+s]}(h,p,e,t,n,i):(r=function(e,t,n,i){if(n)return Gg[e];var r=nv(e),o=tv(e),s=nv(t),a=tv(t);if(i){if(ev(r,s)||iv(o,a))return Gg[r]}else if(ev(o,a)||iv(r,s))return Gg[o];return Gg[i?o:r]}(h,d,p,i.isHorizontal),o=function(e,t,n,i){if(n)return rv(e)?function(e,t){var n=tv(e),i=Qg[n];return-1!==t.indexOf(i)}(e,t)||ev(e,t)?"h":"v":function(e,t){var n=nv(e),i=Qg[n];return-1!==t.indexOf(i)}(e,t)||ev(e,t)?"v":"h";return i?ev(nv(e),nv(t))?"h":"v":ev(tv(e),tv(t))?"v":"h"}(h,d,p,i.isHorizontal),[r+":"+o])}function av(e,t,n,i){var r=Vg;return!(lv(e,i,n,r)||lv(e,i,{x:n.x+n.width,y:n.y+n.height},r)||lv(e,i,xn(t),r))}function lv(e,t,n,i){return Math.abs(t[e]-n[e])<i}function cv(e){return z({original:e.point.original||e.point},e.actual)}function hv(e,t){this._elementRegistry=e,this._graphicsFactory=t}e(Xg,Sg),Xg.prototype.layoutConnection=function(e,t){t||(t={});var n,i,r=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=Kg(s&&s[0],r)),l||(l=Kg(s&&s[s.length-1],o)),(Er(e,"bpmn:Association")||Er(e,"bpmn:DataAssociation"))&&s&&!Zg(r,o))return[].concat([a],s.slice(1,-1),[l]);var h=uc(r,c)?qg:Wg;return Er(e,"bpmn:MessageFlow")?n=function(e,t,n){return{preferredLayouts:n.messageFlow,preserveDocking:Ug(e,t)}}(r,o,h):(Er(e,"bpmn:SequenceFlow")||Zg(r,o))&&(n=r===o?{preferredLayouts:ov(r,e,h)}:Er(r,"bpmn:BoundaryEvent")?{preferredLayouts:sv(r,o,l,h)}:Jg(r)||Jg(o)?{preferredLayouts:h.subProcess,preserveDocking:Yg(r)}:Er(r,"bpmn:Gateway")?{preferredLayouts:h.fromGateway}:Er(o,"bpmn:Gateway")?{preferredLayouts:h.toGateway}:{preferredLayouts:h.default}),n&&(i=Fg(Ng(r,o,a,l,s,n=z(n,t)))),i||[a,l]},Xg.$inject=["elementRegistry"],hv.$inject=["elementRegistry","graphicsFactory"],hv.prototype.getCroppedWaypoints=function(e,t,n){t=t||e.source,n=n||e.target;var i=this.getDockingPoint(e,t,!0),r=this.getDockingPoint(e,n),o=e.waypoints.slice(i.idx+1,r.idx);return o.unshift(cv(i)),o.push(cv(r)),o},hv.prototype.getDockingPoint=function(e,t,n){var i,r,o=e.waypoints;return{point:r=o[i=n?0:o.length-1],actual:this._getIntersection(t,e,n)||r,idx:i}},hv.prototype._getIntersection=function(e,t,n){return _n(this._getShapePath(e),this._getConnectionPath(t),n)},hv.prototype._getConnectionPath=function(e){return this._graphicsFactory.getConnectionPath(e)},hv.prototype._getShapePath=function(e){return this._graphicsFactory.getShapePath(e)},hv.prototype._getGfx=function(e){return this._elementRegistry.getGraphics(e)};var uv={__init__:["modeling","bpmnUpdater"],__depends__:[fd,Xd,Yd,Jd,Df,im,am,um,Rs,Ho,tm],bpmnFactory:["type",pm],bpmnUpdater:["type",dm],elementFactory:["type",mm],modeling:["type",Og],layouter:["type",Xg],connectionDocking:["type",hv]};const pv=Math.round;function dv(e,t,n,i,r,o){this._complexPreview=e,this._connectionDocking=t,this._elementFactory=n,this._eventBus=i,this._layouter=r,this._rules=o}dv.prototype.create=function(e,t,n){const i=this._complexPreview,r=this._connectionDocking,o=this._elementFactory,s=this._eventBus,a=this._layouter,c=this._rules,h=o.createShape(z({type:t},n)),u=s.fire("autoPlace",{source:e,shape:h});if(!u)return;z(h,{x:u.x-pv(h.width/2),y:u.y-pv(h.height/2)});const p=c.allowed("connection.create",{source:e,target:h,hints:{targetParent:e.parent}});let d=null;p&&(d=o.createConnection(p),d.waypoints=a.layoutConnection(d,{source:e,target:h}),d.waypoints=r.getCroppedWaypoints(d,e,h)),i.create({created:[h,d].filter((e=>!l(e)))})},dv.prototype.cleanUp=function(){this._complexPreview.cleanUp()},dv.$inject=["complexPreview","connectionDocking","elementFactory","eventBus","layouter","rules"];var fv={__depends__:[mc,qh,uv],__init__:["appendPreview"],appendPreview:["type",dv]},mv=Math.min,gv=Math.max;function vv(e){e.preventDefault()}function yv(e){e.stopPropagation()}function bv(e){this.container=e.container,this.parent=me('<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=N(this.autoResize,this),this.handlePaste=N(this.handlePaste,this)}function xv(e,t){this._eventBus=e,this._canvas=t,this._providers=[],this._textbox=new bv({container:t.getContainer(),keyHandler:N(this._handleKey,this),resizeHandler:N(this._handleResize,this)})}bv.prototype.create=function(e,t,n,i){var r=this.parent,o=this.content,s=this.container;i=this.options=i||{};var a=I(t=this.style=t||{},["width","height","maxWidth","maxHeight","minWidth","minHeight","left","top","backgroundColor","position","overflow","border","wordWrap","textAlign","outline","transform"]);z(r.style,{width:e.width+"px",height:e.height+"px",maxWidth:e.maxWidth+"px",maxHeight:e.maxHeight+"px",minWidth:e.minWidth+"px",minHeight:e.minHeight+"px",left:e.x+"px",top:e.y+"px",backgroundColor:"#ffffff",position:"absolute",overflow:"visible",border:"1px solid #ccc",boxSizing:"border-box",wordWrap:"normal",textAlign:"center",outline:"none"},a);var l=I(t,["fontFamily","fontSize","fontWeight","lineHeight","padding","paddingTop","paddingRight","paddingBottom","paddingLeft"]);return z(o.style,{boxSizing:"border-box",width:"100%",outline:"none",wordWrap:"break-word"},l),i.centerVertically&&z(o.style,{position:"absolute",top:"50%",transform:"translate(0, -50%)"},l),o.innerText=n,le.bind(o,"keydown",this.keyHandler),le.bind(o,"mousedown",yv),le.bind(o,"paste",this.handlePaste),i.autoResize&&le.bind(o,"input",this.autoResize),i.resizable&&this.resizable(t),s.appendChild(r),this.setSelection(o.lastChild,o.lastChild&&o.lastChild.length),r},bv.prototype.handlePaste=function(e){var t,n=this.options,i=this.style;if(e.preventDefault(),t=e.clipboardData?e.clipboardData.getData("text/plain"):window.clipboardData.getData("Text"),this.insertText(t),n.autoResize){var r=this.autoResize(i);r&&this.resizeHandler(r)}},bv.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)},bv.prototype._insertTextIE=function(e){var t,n,i,r=this.getSelection(),o=r.startContainer,s=r.endContainer,a=r.startOffset,l=r.endOffset,c=r.commonAncestorContainer,h=(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,i=a+e.length}else if(o===this.content&&s===this.content){var p=document.createTextNode(e);this.content.insertBefore(p,h[a]),n=p,i=p.textContent.length}else{var d=h.indexOf(o),f=h.indexOf(s);h.forEach((function(t,n){n===d?t.textContent=o.textContent.substring(0,a)+e+s.textContent.substring(l):n>d&&n<=f&&be(t)})),n=o,i=a+e.length}n&&void 0!==i&&setTimeout((function(){self.setSelection(n,i)}))},bv.prototype.autoResize=function(){var e=this.parent,t=this.content,n=parseInt(this.style.fontSize)||12;if(t.scrollHeight>e.offsetHeight||t.scrollHeight<e.offsetHeight-n){var i=e.getBoundingClientRect(),r=t.scrollHeight;e.style.height=r+"px",this.resizeHandler({width:i.width,height:i.height,dx:0,dy:r-i.height})}},bv.prototype.resizable=function(){var e=this,t=this.parent,n=this.resizeHandle,i=parseInt(this.style.minWidth)||0,r=parseInt(this.style.minHeight)||0,o=parseInt(this.style.maxWidth)||1/0,s=parseInt(this.style.maxHeight)||1/0;if(!n){var a,l,c,h;n=this.resizeHandle=me('<div class="djs-direct-editing-resize-handle"></div>');var u=function(n){vv(n),yv(n);var u=mv(gv(c+n.clientX-a,i),o),p=mv(gv(h+n.clientY-l,r),s);t.style.width=u+"px",t.style.height=p+"px",e.resizeHandler({width:c,height:h,dx:n.clientX-a,dy:n.clientY-l})},p=function(e){vv(e),yv(e),le.unbind(document,"mousemove",u,!1),le.unbind(document,"mouseup",p,!1)};le.bind(n,"mousedown",(function(e){vv(e),yv(e),a=e.clientX,l=e.clientY;var n=t.getBoundingClientRect();c=n.width,h=n.height,le.bind(document,"mousemove",u),le.bind(document,"mouseup",p)}))}z(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)},bv.prototype.destroy=function(){var e=this.parent,t=this.content,n=this.resizeHandle;t.innerText="",e.removeAttribute("style"),t.removeAttribute("style"),le.unbind(t,"keydown",this.keyHandler),le.unbind(t,"mousedown",yv),le.unbind(t,"input",this.autoResize),le.unbind(t,"paste",this.handlePaste),n&&(n.removeAttribute("style"),be(n)),be(e)},bv.prototype.getValue=function(){return this.content.innerText.trim()},bv.prototype.getSelection=function(){return window.getSelection().getRangeAt(0)},bv.prototype.setSelection=function(e,t){var n=document.createRange();null===e?n.selectNodeContents(this.content):(n.setStart(e,t),n.setEnd(e,t));var i=window.getSelection();i.removeAllRanges(),i.addRange(n)},xv.$inject=["eventBus","canvas"],xv.prototype.registerProvider=function(e){this._providers.push(e)},xv.prototype.isActive=function(e){return!(!this._active||e&&this._active.element!==e)},xv.prototype.cancel=function(){this._active&&(this._fire("cancel"),this.close())},xv.prototype._fire=function(e,t){this._eventBus.fire("directEditing."+e,t||{active:this._active})},xv.prototype.close=function(){this._textbox.destroy(),this._fire("deactivate"),this._active=null,this.resizable=void 0,this._canvas.restoreFocus&&this._canvas.restoreFocus()},xv.prototype.complete=function(){var e=this._active;if(e){var t,n=e.context.bounds,i=this.$textbox.getBoundingClientRect(),r=this.getValue();r===e.context.text&&i.height===n.height&&i.width===n.width||(t=this._textbox.container.getBoundingClientRect(),e.provider.update(e.element,r,e.context.text,{x:i.left-t.left,y:i.top-t.top,width:i.width,height:i.height})),this._fire("complete"),this.close()}},xv.prototype.getValue=function(){return this._textbox.getValue()},xv.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())},xv.prototype._handleResize=function(e){this._fire("resize",e)},xv.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 wv={__depends__:[ks],__init__:["directEditing"],directEditing:["type",xv]};var _v=[{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"}}],Ev=[{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"}}],kv=[{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"}}],Ov=[{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"}}],Sv=[{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"}}],Cv=[{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}}],Pv=[{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}}],Av=[{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}}],Mv=Av,Rv=[{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}}],Tv=[{label:"Data store reference",actionName:"replace-with-data-store-reference",className:"bpmn-icon-data-store",target:{type:"bpmn:DataStoreReference"}}],Dv=[{label:"Data object reference",actionName:"replace-with-data-object-reference",className:"bpmn-icon-data-object",target:{type:"bpmn:DataObjectReference"}}],Bv=[{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}}],Lv=[{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}}],Nv=[{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"}],zv=[{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}}],$v={"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"}}]},Iv={"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 jv(e,t,n,i,r,o,s,a){this._bpmnFactory=e,this._popupMenu=t,this._modeling=n,this._moddle=i,this._bpmnReplace=r,this._rules=o,this._translate=s,this._moddleCopy=a,this._register()}jv.$inject=["bpmnFactory","popupMenu","modeling","moddle","bpmnReplace","rules","translate","moddleCopy"],jv.prototype._register=function(){this._popupMenu.registerProvider("bpmn-replace",this)},jv.prototype.getPopupMenuEntries=function(e){var t,n=e.businessObject,i=this._rules,r=[],o=[];if(c(e)||!i.allowed("shape.replace",{element:e}))return{};var s,a=(s=e,function(e){var t=e.target,n=Or(s),i=n.eventDefinitions&&n.eventDefinitions[0],r=n.$type===t.type,o=(i&&i.$type)===t.eventDefinitionType,a=!!t.triggeredByEvent==!!n.triggeredByEvent,l=void 0===t.isExpanded||t.isExpanded===Vr(s);return!(r&&o&&a&&l)});return Er(n,"bpmn:DataObjectReference")?this._createEntries(e,Tv):Er(n,"bpmn:DataStoreReference")&&!Er(e.parent,"bpmn:Collaboration")?this._createEntries(e,Dv):(Er(n,"bpmn:Event")&&!Er(n,"bpmn:BoundaryEvent")&&(t=n.get("eventDefinitions")[0]?.$type,r=$v[t]||[],!Qr(n.$parent)&&Er(n.$parent,"bpmn:SubProcess")&&(r=v(r,(function(e){return"bpmn:StartEvent"!==e.target.type})))),Er(n,"bpmn:StartEvent")&&!Er(n.$parent,"bpmn:SubProcess")?(o=v(_v.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:Participant")?(o=v(zv,(function(t){return Vr(e)!==t.target.isExpanded})),this._createEntries(e,o)):Er(n,"bpmn:StartEvent")&&Qr(n.$parent)?(o=v(Lv.concat(r),(function(e){var t=!1!==e.target.isInterrupting,i=n.isInterrupting===t;return a(e)||!a(e)&&!i})),this._createEntries(e,o)):Er(n,"bpmn:StartEvent")&&!Qr(n.$parent)&&Er(n.$parent,"bpmn:SubProcess")?(o=v(Ev.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:EndEvent")?(o=v(Ov.concat(r),(function(e){return!("bpmn:CancelEventDefinition"==e.target.eventDefinitionType&&!Er(n.$parent,"bpmn:Transaction"))&&a(e)})),this._createEntries(e,o)):Er(n,"bpmn:BoundaryEvent")?(o=v(Bv,(function(e){var t=e.target;if("bpmn:CancelEventDefinition"==t.eventDefinitionType&&!Er(n.attachedToRef,"bpmn:Transaction"))return!1;var i=!1!==t.cancelActivity,r=n.cancelActivity==i;return a(e)||!a(e)&&!r})),this._createEntries(e,o)):Er(n,"bpmn:IntermediateCatchEvent")||Er(n,"bpmn:IntermediateThrowEvent")?(o=v(kv.concat(r),a),this._createEntries(e,o)):Er(n,"bpmn:Gateway")?(o=v(Sv,a),this._createEntries(e,o)):Er(n,"bpmn:Transaction")?(o=v(Av,a),this._createEntries(e,o)):Qr(n)&&Vr(e)?(o=v(Mv,a),this._createEntries(e,o)):Er(n,"bpmn:AdHocSubProcess")&&Vr(e)?(o=v(Pv,a),this._createEntries(e,o)):Er(n,"bpmn:SubProcess")&&Vr(e)?(o=v(Cv,a),this._createEntries(e,o)):Er(n,"bpmn:SubProcess")&&!Vr(e)?(o=v(Rv,(function(t){return t.target.type===e.type===(!0===t.target.isExpanded)})),this._createEntries(e,o)):Er(n,"bpmn:SequenceFlow")?this._createSequenceFlowEntries(e,Nv):Er(n,"bpmn:FlowNode")?(o=v(Rv,a),this._createEntries(e,o)):{})},jv.prototype.getPopupMenuHeaderEntries=function(e){var t={};return Er(e,"bpmn:Activity")&&!Qr(e)&&(t={...t,...this._getLoopCharacteristicsHeaderEntries(e)}),Er(e,"bpmn:DataObjectReference")&&(t={...t,...this._getCollectionHeaderEntries(e)}),Er(e,"bpmn:Participant")&&(t={...t,...this._getParticipantMultiplicityHeaderEntries(e)}),_p(e)&&(t={...t,...this._getNonInterruptingHeaderEntries(e)}),t},jv.prototype._createEntries=function(e,t){var n={},i=this;return y(t,(function(t){n[t.actionName]=i._createEntry(t,e)})),n},jv.prototype._createSequenceFlowEntries=function(e,t){var n=Or(e),i={},r=this._modeling,o=this._moddle,s=this;return y(t,(function(t){switch(t.actionName){case"replace-with-default-flow":n.sourceRef.default!==n&&(Er(n.sourceRef,"bpmn:ExclusiveGateway")||Er(n.sourceRef,"bpmn:InclusiveGateway")||Er(n.sourceRef,"bpmn:ComplexGateway")||Er(n.sourceRef,"bpmn:Activity"))&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:n})}))});break;case"replace-with-conditional-flow":!n.conditionExpression&&Er(n.sourceRef,"bpmn:Activity")&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){var t=o.create("bpmn:FormalExpression",{body:""});r.updateProperties(e,{conditionExpression:t})}))});break;default:Er(n.sourceRef,"bpmn:Activity")&&n.conditionExpression&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e,{conditionExpression:void 0})}))}),(Er(n.sourceRef,"bpmn:ExclusiveGateway")||Er(n.sourceRef,"bpmn:InclusiveGateway")||Er(n.sourceRef,"bpmn:ComplexGateway")||Er(n.sourceRef,"bpmn:Activity"))&&n.sourceRef.default===n&&(i={...i,[t.actionName]:s._createEntry(t,e,(function(){r.updateProperties(e.source,{default:void 0})}))})}})),i},jv.prototype._createEntry=function(e,t,n){var i=this._translate,r=this._bpmnReplace.replaceElement,o=e.label;return o&&"function"==typeof o&&(o=o(t)),n=n||function(){return r(t,e.target)},{label:i(o),className:e.className,action:n}},jv.prototype._getLoopCharacteristicsHeaderEntries=function(e){var t=this,n=this._translate;function i(n,i){if(i.active)t._modeling.updateProperties(e,{loopCharacteristics:void 0});else{var r=e.businessObject.get("loopCharacteristics");r&&Er(r,i.options.loopCharacteristics)?t._modeling.updateModdleProperties(e,r,{isSequential:i.options.isSequential}):(r=t._moddle.create(i.options.loopCharacteristics,{isSequential:i.options.isSequential}),t._modeling.updateProperties(e,{loopCharacteristics:r}))}}var r,o,s,a=Or(e).loopCharacteristics;return a&&(r=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:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!1}},"toggle-sequential-mi":{className:"bpmn-icon-sequential-mi-marker",title:n("Sequential multi-instance"),active:r,action:i,options:{loopCharacteristics:"bpmn:MultiInstanceLoopCharacteristics",isSequential:!0}},"toggle-loop":{className:"bpmn-icon-loop-marker",title:n("Loop"),active:o,action:i,options:{loopCharacteristics:"bpmn:StandardLoopCharacteristics"}}}},jv.prototype._getCollectionHeaderEntries=function(e){var t=this,n=this._translate,i=e.businessObject.dataObjectRef;if(!i)return{};var r=i.isCollection;return{"toggle-is-collection":{className:"bpmn-icon-parallel-mi-marker",title:n("Collection"),active:r,action:function(n,r){t._modeling.updateModdleProperties(e,i,{isCollection:!r.active})}}}},jv.prototype._getParticipantMultiplicityHeaderEntries=function(e){var t=this,n=this._bpmnFactory,i=this._translate;var r=e.businessObject.participantMultiplicity;return{"toggle-participant-multiplicity":{className:"bpmn-icon-parallel-mi-marker",title:i("Participant multiplicity"),active:!!r,action:function(i,r){var o;r.active||(o=n.create("bpmn:ParticipantMultiplicity")),t._modeling.updateProperties(e,{participantMultiplicity:o})}}}},jv.prototype._getNonInterruptingHeaderEntries=function(e){const t=this._translate,n=Or(e),i=this,r=Ep(e),o=Er(e,"bpmn:BoundaryEvent")?Iv["intermediate-event-non-interrupting"]:Iv["start-event-non-interrupting"],s=!n[r];return{"toggle-non-interrupting":{imageHtml:o,title:t("Toggle non-interrupting"),active:s,action:function(){i._modeling.updateProperties(e,{[r]:!!s})}}}};var Fv={__depends__:[Wl,Df,mc],__init__:["replaceMenuProvider"],replaceMenuProvider:["type",jv]};function Hv(e,t,n,i,r,o,s,a,l,c,h,u,p){e=e||{},i.registerProvider(this),this._contextPad=i,this._modeling=r,this._elementFactory=o,this._connect=s,this._create=a,this._popupMenu=l,this._canvas=c,this._rules=h,this._translate=u,this._eventBus=n,this._appendPreview=p,!1!==e.autoPlace&&(this._autoPlace=t.get("autoPlace",!1)),n.on("create.end",250,(function(e){var t=e.context.shape;if(bs(e)&&i.isOpen(t)){var n=i.getEntries(t);n.replace&&n.replace.action.click(e,t)}})),n.on("contextPad.close",(function(){p.cleanUp()}))}function Vv(e,t,n){var i=e.$instanceOf(t),r=!1;return y(e.eventDefinitions||[],(function(e){e.$type===n&&(r=!0)})),i&&r}Hv.$inject=["config.contextPad","injector","eventBus","contextPad","modeling","elementFactory","connect","create","popupMenu","canvas","rules","translate","appendPreview"],Hv.prototype.getMultiElementContextPadEntries=function(e){var t=this._modeling,n={};return this._isDeleteAllowed(e)&&z(n,{delete:{group:"edit",className:"bpmn-icon-trash",title:this._translate("Delete"),action:{click:function(e,n){t.removeElements(n.slice())}}}}),n},Hv.prototype._isDeleteAllowed=function(e){var t=this._rules.allowed("elements.delete",{elements:e});return c(t)?w(e,(e=>t.includes(e))):t},Hv.prototype.getContextPadEntries=function(e){var t=this._contextPad,n=this._modeling,i=this._elementFactory,r=this._connect,o=this._create,s=this._popupMenu,a=this._autoPlace,l=this._translate,c=this._appendPreview,h={};if("label"===e.type)return this._isDeleteAllowed([e])&&z(h,f()),h;var u=e.businessObject;function p(e,t){r.start(e,t)}function d(e,t){n.removeElements([t])}function f(){return{delete:{group:"edit",className:"bpmn-icon-trash",title:l("Delete"),action:{click:d}}}}function m(e,t,n,r){function s(t,n){var s=i.createShape(z({type:e},r));o.start(t,s,{source:n})}var l=a?function(t,n){var o=i.createShape(z({type:e},r));a.append(n,o)}:s,h=a?function(t,n){return c.create(n,e,r),()=>{c.cleanUp()}}:null;return{group:"model",className:t,title:n,action:{dragstart:s,click:l,hover:h}}}function g(e){return function(i,r){n.splitLane(r,e),t.open(r,!0)}}if(kr(u,["bpmn:Lane","bpmn:Participant"])&&Vr(e)){var v=Pu(e);z(h,{"lane-insert-above":{group:"lane-insert-above",className:"bpmn-icon-lane-insert-above",title:l("Add lane above"),action:{click:function(e,t){n.addLane(t,"top")}}}}),v.length<2&&((qr(e)?e.height>=120:e.width>=120)&&z(h,{"lane-divide-two":{group:"lane-divide",className:"bpmn-icon-lane-divide-two",title:l("Divide into two lanes"),action:{click:g(2)}}}),(qr(e)?e.height>=180:e.width>=180)&&z(h,{"lane-divide-three":{group:"lane-divide",className:"bpmn-icon-lane-divide-three",title:l("Divide into three lanes"),action:{click:g(3)}}})),z(h,{"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 Er(u,"bpmn:FlowNode")&&(Er(u,"bpmn:EventBasedGateway")?z(h,{"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"})}):Vv(u,"bpmn:BoundaryEvent","bpmn:CompensateEventDefinition")?z(h,{"append.compensation-activity":m("bpmn:Task","bpmn-icon-task",l("Append compensation activity"),{isForCompensation:!0})}):Er(u,"bpmn:EndEvent")||u.isForCompensation||Vv(u,"bpmn:IntermediateThrowEvent","bpmn:LinkEventDefinition")||Qr(u)||z(h,{"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")||z(h,{replace:{group:"edit",className:"bpmn-icon-screw-wrench",title:l("Change element"),action:{click:function(e,n){var i=z(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",i,{title:l("Change element"),width:300,search:!0})}}}}),Er(u,"bpmn:SequenceFlow")&&z(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),kr(u,["bpmn:FlowNode","bpmn:InteractionNode","bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(h,{"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:p,dragstart:p}}}),Er(u,"bpmn:TextAnnotation")&&z(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using association"),action:{click:p,dragstart:p}}}),kr(u,["bpmn:DataObjectReference","bpmn:DataStoreReference"])&&z(h,{connect:{group:"connect",className:"bpmn-icon-connection-multi",title:l("Connect using data input association"),action:{click:p,dragstart:p}}}),Er(u,"bpmn:Group")&&z(h,{"append.text-annotation":m("bpmn:TextAnnotation","bpmn-icon-text-annotation",l("Add text annotation"))}),this._isDeleteAllowed([e])&&z(h,f()),h};var qv={__depends__:[fv,wv,Aa,Rs,Bh,pf,Fv],__init__:["contextPadProvider"],contextPadProvider:["type",Hv]},Wv={horizontal:["x","width"],vertical:["y","height"]};function Qv(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:[]}))}Qv.$inject=["modeling","rules"],Qv.prototype.registerFilter=function(e){if("function"!=typeof e)throw new Error("the filter has to be a function");this._filters.push(e)},Qv.prototype.trigger=function(e,t){var n,i,r=this._modeling;if(!(e.length<3||(this._setOrientation(t),i=this._filterElements(e),(n=this._createGroups(i)).length<=2)))return r.distributeElements(n,this._axis,this._dimension),n},Qv.prototype._filterElements=function(e){var t=this._filters,n=this._axis,i=this._dimension,r=[].concat(e);return t.length?(y(t,(function(e){r=e(r,n,i)})),r):e},Qv.prototype._createGroups=function(e){var t=[],n=this,i=this._axis,r=this._dimension;if(!i)throw new Error('must have a defined "axis" and "dimension"');return y(A(e,i),(function(e,o){var s,a=n._findRange(e,i,r),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},Qv.prototype._setOrientation=function(e){var t=Wv[e];this._axis=t[0],this._dimension=t[1]},Qv.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)},Qv.prototype._findRange=function(e){var t=e[this._axis];return{min:t+5,max:t+e[this._dimension]-5}};var Gv={__init__:["distributeElements"],distributeElements:["type",Qv]};function Xv(e){Yl.call(this,e)}Xv.$inject=["eventBus"],e(Xv,Yl),Xv.prototype.init=function(){this.addRule("elements.distribute",(function(e){var t=e.elements;return!((t=pt(t=v(t,(function(e){var t=kr(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 Uv={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 Yv(e,t,n,i){this._distributeElements=t,this._translate=n,this._popupMenu=e,this._rules=i,e.registerProvider("align-elements",900,this)}Yv.$inject=["popupMenu","distributeElements","translate","rules"],Yv.prototype.getPopupMenuEntries=function(e){var t={};return this._isAllowed(e)&&z(t,this._getEntries(e)),t},Yv.prototype._isAllowed=function(e){return this._rules.allowed("elements.distribute",{elements:e})},Yv.prototype._getEntries=function(e){var t=this._distributeElements,n=this._translate,i=this._popupMenu;return{"distribute-elements-horizontal":{group:"distribute",title:n("Distribute elements horizontally"),className:"bjs-align-elements-menu-entry",imageHtml:Uv.horizontal,action:function(n,r){t.trigger(e,"horizontal"),i.close()}},"distribute-elements-vertical":{group:"distribute",title:n("Distribute elements vertically"),imageHtml:Uv.vertical,action:function(n,r){t.trigger(e,"vertical"),i.close()}}}};var Kv={__depends__:[Wl,Gv],__init__:["bpmnDistributeElements","distributeElementsMenuProvider"],bpmnDistributeElements:["type",Xv],distributeElementsMenuProvider:["type",Yv]},Zv="is not a registered action";function Jv(e,t){this._actions={};var n=this;e.on("diagram.init",(function(){n._registerDefaultActions(t),e.fire("editorActions.init",{editorActions:n})}))}function ey(e,t){return new Error(e+" "+t)}Jv.$inject=["eventBus","injector"],Jv.prototype._registerDefaultActions=function(e){var t=e.get("commandStack",!1),n=e.get("modeling",!1),i=e.get("selection",!1),r=e.get("zoomScroll",!1),o=e.get("copyPaste",!1),s=e.get("canvas",!1),a=e.get("rules",!1),l=e.get("keyboardMove",!1),h=e.get("keyboardMoveSelection",!1);t&&(this.register("undo",(function(){t.undo()})),this.register("redo",(function(){t.redo()}))),o&&i&&this.register("copy",(function(){var e=i.get();if(e.length)return o.copy(e)})),o&&this.register("paste",(function(){o.paste()})),r&&this.register("stepZoom",(function(e){r.stepZoom(e.value)})),s&&this.register("zoom",(function(e){s.zoom(e.value)})),n&&i&&a&&this.register("removeSelection",(function(){var e=i.get();if(e.length){var t,r=a.allowed("elements.delete",{elements:e});!1!==r&&(t=c(r)?r:e).length&&n.removeElements(t.slice())}})),l&&this.register("moveCanvas",(function(e){l.moveCanvas(e)})),h&&this.register("moveSelection",(function(e){h.moveSelection(e.direction,e.accelerated)}))},Jv.prototype.trigger=function(e,t){if(!this._actions[e])throw ey(e,Zv);return this._actions[e](t)},Jv.prototype.register=function(e,t){var n=this;if("string"==typeof e)return this._registerAction(e,t);y(e,(function(e,t){n._registerAction(t,e)}))},Jv.prototype._registerAction=function(e,t){if(this.isRegistered(e))throw ey(e,"is already registered");this._actions[e]=t},Jv.prototype.unregister=function(e){if(!this.isRegistered(e))throw ey(e,Zv);this._actions[e]=void 0},Jv.prototype.getActions=function(){return Object.keys(this._actions)},Jv.prototype.isRegistered=function(e){return!!this._actions[e]};var ty={__init__:["editorActions"],editorActions:["type",Jv]};function ny(e){e.invoke(Jv,this)}e(ny,Jv),ny.$inject=["injector"],ny.prototype._registerDefaultActions=function(e){Jv.prototype._registerDefaultActions.call(this,e);var t=e.get("canvas",!1),n=e.get("elementRegistry",!1),i=e.get("selection",!1),r=e.get("spaceTool",!1),o=e.get("lassoTool",!1),s=e.get("handTool",!1),a=e.get("globalConnect",!1),l=e.get("distributeElements",!1),c=e.get("alignElements",!1),h=e.get("directEditing",!1),u=e.get("searchPad",!1),p=e.get("modeling",!1),d=e.get("contextPad",!1);t&&n&&i&&this._registerAction("selectElements",(function(){var e=t.getRootElement(),r=n.filter((function(t){return t!==e}));return i.select(r),r})),r&&this._registerAction("spaceTool",(function(){r.toggle()})),o&&this._registerAction("lassoTool",(function(){o.toggle()})),s&&this._registerAction("handTool",(function(){s.toggle()})),a&&this._registerAction("globalConnectTool",(function(){a.toggle()})),i&&l&&this._registerAction("distributeElements",(function(e){var t=i.get(),n=e.type;t.length&&l.trigger(t,n)})),i&&c&&this._registerAction("alignElements",(function(e){var t=i.get(),n=[],r=e.type;t.length&&(n=v(t,(function(e){return!Er(e,"bpmn:Lane")})),c.trigger(n,r))})),i&&p&&this._registerAction("setColor",(function(e){var t=i.get();t.length&&p.setColor(t,e)})),i&&h&&this._registerAction("directEditing",(function(){var e=i.get();e.length&&h.activate(e[0])})),u&&this._registerAction("find",(function(){u.toggle()})),t&&p&&this._registerAction("moveToOrigin",(function(){var e,i,r=t.getRootElement();e=vt(i=Er(r,"bpmn:Collaboration")?n.filter((function(e){return Er(e.parent,"bpmn:Collaboration")})):n.filter((function(e){return e!==r&&!Er(e.parent,"bpmn:SubProcess")}))),p.moveElements(i,{x:-e.x,y:-e.y},r)})),i&&d&&this._registerAction("replaceElement",(function(e){d.triggerEntry("replace","click",e)}))};var iy={__depends__:[ty],editorActions:["type",ny]};function ry(e){e.on(["create.init","shape.move.init"],(function(e){var t=e.context;kr(e.shape,["bpmn:Participant","bpmn:SubProcess","bpmn:TextAnnotation"])&&(t.gridSnappingContext||(t.gridSnappingContext={}),t.gridSnappingContext.snapLocation="top-left")}))}ry.$inject=["eventBus"];var oy=10;function sy(e,t,n){return n||(n="round"),Math[n](e/t)*t}function ay(e,t,n){var i=!n||!1!==n.active;this._eventBus=t;var r=this;t.on("diagram.init",800,(function(){r.setActive(i)})),t.on(["create.move","create.end","bendpoint.move.move","bendpoint.move.end","connect.move","connect.end","connectionSegment.move.move","connectionSegment.move.end","resize.move","resize.end","shape.move.move","shape.move.end"],1200,(function(t){var n=t.originalEvent;if(!(!r.active||n&&zs(n))){var i=t.context,o=i.gridSnappingContext;o||(o=i.gridSnappingContext={}),["x","y"].forEach((function(n){var i={},o=function(e,t,n){var i=e.context,r=e.shape,o=i.gridSnappingContext,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(!r)return a[t];n.get(r.id)||(ly(t)?a[t]+=r[t]+r.width/2:a[t]+=r[t]+r.height/2);if(!s)return a[t];"x"===t?/left/.test(s)?a[t]-=r.width/2:/right/.test(s)&&(a[t]+=r.width/2):/top/.test(s)?a[t]-=r.height/2:/bottom/.test(s)&&(a[t]+=r.height/2);return a[t]}(t,n,e);o&&(i.offset=o);var s=function(e,t){var n=e.context,i=n.createConstraints,r=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;i&&(ly(t)?(s.x.min=i.left,s.x.max=i.right):(s.y.min=i.top,s.y.max=i.bottom));var l=r.min,c=r.max;l&&(ly(t)?hy(a)?s.x.max=l.left:s.x.min=l.right:cy(a)?s.y.max=l.top:s.y.min=l.bottom);c&&(ly(t)?hy(a)?s.x.min=c.left:s.x.max=c.right:cy(a)?s.y.min=c.top:s.y.max=c.bottom);return s[t]}(t,n);s&&z(i,s),_h(t,n)||r.snapEvent(t,n,i)}))}}))}function ly(e){return"x"===e}function cy(e){return-1!==e.indexOf("n")}function hy(e){return-1!==e.indexOf("w")}function uy(e,t){Vo.call(this,e),this._gridSnapping=t;var n=this;this.preExecute("shape.resize",(function(e){var t=e.context,i=(t.hints||{}).autoResize;if(i){var r=t.shape,o=t.newBounds;d(i)?t.newBounds=n.snapComplex(o,i):t.newBounds=n.snapSimple(r,o)}}))}ay.prototype.snapEvent=function(e,t,n){Eh(e,t,this.snapValue(e[t],n))},ay.prototype.getGridSpacing=function(){return oy},ay.prototype.snapValue=function(e,t){var n,i,r=0;return t&&t.offset&&(r=t.offset),e=sy(e+=r,oy),t&&t.min&&u(n=t.min)&&(n=sy(n+r,oy,"ceil"),e=Math.max(e,n)),t&&t.max&&u(i=t.max)&&(i=sy(i+r,oy,"floor"),e=Math.min(e,i)),e-=r},ay.prototype.isActive=function(){return this.active},ay.prototype.setActive=function(e){this.active=e,this._eventBus.fire("gridSnapping.toggle",{active:e})},ay.prototype.toggleActive=function(){this.setActive(!this.active)},ay.$inject=["elementRegistry","eventBus","config.gridSnapping"],uy.$inject=["eventBus","gridSnapping","modeling"],e(uy,Vo),uy.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},uy.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},uy.prototype.snapHorizontally=function(e,t){var n=this._gridSnapping,i=/w/.test(t),r=/e/.test(t),o={};return o.width=n.snapValue(e.width,{min:e.width}),r&&(i?(o.x=n.snapValue(e.x,{max:e.x}),o.width+=n.snapValue(e.x-o.x,{min:e.x-o.x})):e.x=e.x+e.width-o.width),z(e,o),e},uy.prototype.snapVertically=function(e,t){var n=this._gridSnapping,i=/n/.test(t),r=/s/.test(t),o={};return o.height=n.snapValue(e.height,{min:e.height}),i&&(r?(o.y=n.snapValue(e.y,{max:e.y}),o.height+=n.snapValue(e.y-o.y,{min:e.y-o.y})):e.y=e.y+e.height-o.height),z(e,o),e};function py(e,t){e.on(["spaceTool.move","spaceTool.end"],2e3,(function(e){var n,i=e.context;i.initialized&&("x"===i.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))}))}py.$inject=["eventBus","gridSnapping"];var dy={__depends__:[{__init__:["gridSnappingResizeBehavior","gridSnappingSpaceToolBehavior"],gridSnappingResizeBehavior:["type",uy],gridSnappingSpaceToolBehavior:["type",py]}],__init__:["gridSnapping"],gridSnapping:["type",ay]};function fy(e,t,n){e.on("autoPlace",2e3,(function(e){var i=e.source,r=xn(i),o=e.shape,s=pc(i,o,n);return["x","y"].forEach((function(e){var n={};s[e]!==r[e]&&(s[e]>r[e]?n.min=s[e]:n.max=s[e],Er(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}))}fy.$inject=["eventBus","gridSnapping","elementRegistry"];function my(e,t,n){t.on(["create.start","shape.move.start"],1750,(function(t){var i=t.context,r=i.shape,o=e.getRootElement();Er(r,"bpmn:Participant")&&Er(o,"bpmn:Process")&&o.children.length&&(i.createConstraints&&(r.width=n.snapValue(r.width,{min:r.width}),r.height=n.snapValue(r.height,{min:r.height})))}))}my.$inject=["canvas","eventBus","gridSnapping"];function gy(e,t,n){Vo.call(this,e),this._gridSnapping=t;var i=this;this.postExecuted(["connection.create","connection.layout"],3e3,(function(e){var t=e.context,r=t.connection,o=t.hints||{},s=r.waypoints;o.connectionStart||o.connectionEnd||!1===o.createElementsBehavior||function(e){return e.length>3}(s)&&n.updateWaypoints(r,i.snapMiddleSegments(s))}))}function vy(e,t,n){var i=Mt(t,n),r={};return function(e){return"h"===e}(i)&&(r.y=e.snapValue(t.y)),function(e){return"v"===e}(i)&&(r.x=e.snapValue(t.x)),("x"in r||"y"in r)&&(t=z({},t,r),n=z({},n,r)),[t,n]}gy.$inject=["eventBus","gridSnapping","modeling"],e(gy,Vo),gy.prototype.snapMiddleSegments=function(e){var t,n=this._gridSnapping;e=e.slice();for(var i=1;i<e.length-2;i++)t=vy(n,e[i],e[i+1]),e[i]=t[0],e[i+1]=t[1];return e};var yy={__depends__:[dy,{__init__:["gridSnappingAutoPlaceBehavior","gridSnappingParticipantBehavior","gridSnappingLayoutConnectionBehavior"],gridSnappingAutoPlaceBehavior:["type",fy],gridSnappingParticipantBehavior:["type",my],gridSnappingLayoutConnectionBehavior:["type",gy]}],__init__:["bpmnGridSnapping"],bpmnGridSnapping:["type",ry]};function by(e,t){this._interactionEvents=t;var n=this;e.on(["interactionEvents.createHit","interactionEvents.updateHit"],(function(e){var t=e.element,i=e.gfx;return Er(t,"bpmn:Lane")?n._createParticipantHit(t,i):Er(t,"bpmn:Participant")?Vr(t)?n._createParticipantHit(t,i):n._createDefaultHit(t,i):Er(t,"bpmn:SubProcess")?Vr(t)?n._createSubProcessHit(t,i):n._createDefaultHit(t,i):void 0}))}by.$inject=["eventBus","interactionEvents"],by.prototype._createDefaultHit=function(e,t){return this._interactionEvents.removeHits(t),this._interactionEvents.createDefaultHit(e,t),!0},by.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=qr(e)?{width:30,height:e.height}:{width:e.width,height:30};return this._interactionEvents.createBoxHit(t,"all",n),!0},by.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 xy={__init__:["bpmnInteractionEvents"],bpmnInteractionEvents:["type",by]};function wy(e){e.invoke(Qs,this)}e(wy,Qs),wy.$inject=["injector"],wy.prototype.registerBindings=function(e,t){function n(n,i){t.isRegistered(n)&&e.addListener(i)}Qs.prototype.registerBindings.call(this,e,t),n("selectElements",(function(n){var i=n.keyEvent;if(e.isKey(["a","A"],i)&&e.isCmd(i))return t.trigger("selectElements"),!0})),n("find",(function(n){var i=n.keyEvent;if(e.isKey(["f","F"],i)&&e.isCmd(i))return t.trigger("find"),!0})),n("spaceTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["s","S"],i)?(t.trigger("spaceTool"),!0):void 0})),n("lassoTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["l","L"],i)?(t.trigger("lassoTool"),!0):void 0})),n("handTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["h","H"],i)?(t.trigger("handTool"),!0):void 0})),n("globalConnectTool",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["c","C"],i)?(t.trigger("globalConnectTool"),!0):void 0})),n("directEditing",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["e","E"],i)?(t.trigger("directEditing"),!0):void 0})),n("replaceElement",(function(n){var i=n.keyEvent;if(!e.hasModifier(i))return e.isKey(["r","R"],i)?(t.trigger("replaceElement",i),!0):void 0}))};var _y={__depends__:[Gs],__init__:["keyboardBindings"],keyboardBindings:["type",wy]},Ey={moveSpeed:1,moveSpeedAccelerated:10},ky="left",Oy="right",Sy="down",Cy={ArrowLeft:ky,Left:ky,ArrowUp:"up",Up:"up",ArrowRight:Oy,Right:Oy,ArrowDown:Sy,Down:Sy},Py={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 Ay(e,t,n,i,r){var o=this;this._config=z({},Ey,e||{}),t.addListener(1500,(function(e){var n=e.keyEvent,i=Cy[n.key];if(i&&!t.isCmd(n)){var r=t.isShift(n);return o.moveSelection(i,r),!0}})),this.moveSelection=function(e,t){var o=r.get();if(o.length){var s=this._config[t?"moveSpeedAccelerated":"moveSpeed"],a=Py[e](s);i.allowed("elements.move",{shapes:o})&&n.moveElements(o,a)}}}Ay.$inject=["config.keyboardMoveSelection","keyboard","modeling","rules","selection"];var My={__depends__:[Gs,Rs],__init__:["keyboardMoveSelection"],keyboardMoveSelection:["type",Ay]};function Ry(e,t,n,i){this._dragging=i,this._rules=t;var r=this;function o(e,t){var n,i=e.shape,o=e.direction,s=e.resizeConstraints;e.delta=t,n=function(e,t,n){var i=n.x,r=n.y,o={x:e.x,y:e.y,width:e.width,height:e.height};return-1!==t.indexOf("n")?(o.y=e.y+r,o.height=e.height-r):-1!==t.indexOf("s")&&(o.height=e.height+r),-1!==t.indexOf("e")?o.width=e.width+i:-1!==t.indexOf("w")&&(o.x=e.x+i,o.width=e.width-i),o}(i,o,t),e.newBounds=function(e,t){if(!t)return e;var n=vn(e);return yn({top:xu("top",n,t),right:xu("right",n,t),bottom:xu("bottom",n,t),left:xu("left",n,t)})}(n,s),e.canExecute=r.canResize(e)}e.on("resize.start",(function(e){var t,n,i;t=e.context,n=t.resizeConstraints,i=t.minBounds,void 0===n&&(void 0===i&&(i=r.computeMinResizeBox(t)),t.resizeConstraints={min:vn(i)})})),e.on("resize.move",(function(e){var t={x:e.dx,y:e.dy};o(e.context,t)})),e.on("resize.end",(function(e){!function(e){var t=e.shape,i=e.canExecute,r=e.newBounds;if(i){if(!function(e,t){return e.x!==t.x||e.y!==t.y||e.width!==t.width||e.height!==t.height}(t,r=mn(r)))return;n.resizeShape(t,r)}}(e.context)}))}function Ty(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}function Dy(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"}Ry.prototype.canResize=function(e){var t=this._rules,n=I(e,["newBounds","shape","delta","direction"]);return t.allowed("shape.resize",n)},Ry.prototype.activate=function(e,t,n){var i,r,o=this._dragging;if("string"==typeof n&&(n={direction:n}),!(r=(i=z({shape:t},n)).direction))throw new Error("must provide a direction (n|w|s|e|nw|se|ne|sw)");o.init(e,Ty(t,r),"resize",{autoActivate:!0,cursor:Dy(r),data:{shape:t,context:i}})},Ry.prototype.computeMinResizeBox=function(e){var t=e.shape;return function(e,t,n,i){var r=vn(t),o={top:/n/.test(e)?r.bottom-n.height:r.top,left:/w/.test(e)?r.right-n.width:r.left,bottom:/s/.test(e)?r.top+n.height:r.bottom,right:/e/.test(e)?r.left+n.width:r.right},s=i?vn(i):o;return yn({top:vu(o.top,s.top),left:vu(o.left,s.left),bottom:gu(o.bottom,s.bottom),right:gu(o.right,s.right)})}(e.direction,t,e.minDimensions||{width:10,height:10},Eu(t,e.childrenBoxPadding))},Ry.$inject=["eventBus","rules","modeling","dragging"];var By="djs-resizing",Ly="resize-not-ok";function Ny(e,t,n){e.on("resize.move",500,(function(e){var i,r,o,s;i=e.context,r=i.shape,o=i.newBounds,(s=i.frame)||(s=i.frame=n.addFrame(r,t.getActiveLayer()),t.addMarker(r,By)),o.width>5&&ke(s,{x:o.x,width:o.width}),o.height>5&&ke(s,{y:o.y,height:o.height}),i.canExecute?Se(s).remove(Ly):Se(s).add(Ly)})),e.on("resize.cleanup",(function(e){var n,i;n=e.context,i=n.shape,n.frame&&qe(n.frame),t.removeMarker(i,By)}))}Ny.$inject=["eventBus","canvas","previewSupport"];var zy=-6,$y="djs-resizer",Iy=["n","w","s","e","nw","ne","se","sw"];function jy(e,t,n,i){this._resize=i,this._canvas=t;var r=this;e.on("selection.changed",(function(e){var t=e.newSelection;r.removeResizers(),1===t.length&&y(t,N(r.addResizer,r))})),e.on("shape.changed",(function(e){var t=e.element;n.isSelected(t)&&(r.removeResizers(),r.addResizer(t))}))}jy.prototype.makeDraggable=function(e,t,n){var i=this._resize;function r(t){ys(t)&&i.activate(t,e,n)}le.bind(t,"mousedown",r),le.bind(t,"touchstart",r)},jy.prototype._createResizer=function(e,t,n,i){var r=this._getResizersParent(),o=function(e){var t={x:0,y:0};-1!==e.indexOf("e")?t.x=6:-1!==e.indexOf("w")&&(t.x=zy);-1!==e.indexOf("s")?t.y=6:-1!==e.indexOf("n")&&(t.y=zy);return t}(i),s=De("g");Se(s).add($y),Se(s).add($y+"-"+e.id),Se(s).add($y+"-"+i),xe(r,s);var a=De("rect");ke(a,{x:-4+o.x,y:-4+o.y,width:8,height:8}),Se(a).add($y+"-visual"),xe(s,a);var l=De("rect");return ke(l,{x:-10+o.x,y:-10+o.y,width:20,height:20}),Se(l).add($y+"-hit"),xe(s,l),Yn(s,t,n),s},jy.prototype.createResizer=function(e,t){var n=Ty(e,t),i=this._createResizer(e,n.x,n.y,t);this.makeDraggable(e,i,t)},jy.prototype.addResizer=function(e){var t=this;!dn(e)&&this._resize.canResize({shape:e})&&y(Iy,(function(n){t.createResizer(e,n)}))},jy.prototype.removeResizers=function(){Pe(this._getResizersParent())},jy.prototype._getResizersParent=function(){return this._canvas.getLayer("resizers")},jy.$inject=["eventBus","canvas","selection","resize"];var Fy={__depends__:[Tc,Cc,Fh],__init__:["resize","resizePreview","resizeHandles"],resize:["type",Ry],resizePreview:["type",Ny],resizeHandles:["type",jy]};function Hy(e,t,n,i,r,o,s){function a(e,t){(t||kr(e,["bpmn:Task","bpmn:TextAnnotation","bpmn:Participant"])||Vy(e))&&i.activate(e)}this._bpmnFactory=t,this._canvas=n,this._modeling=r,this._textRenderer=s,i.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(){i.isActive()&&i.complete()})),e.on(["shape.remove","connection.remove"],2e3,(function(e){i.isActive(e.element)&&i.cancel()})),e.on(["commandStack.changed"],(function(e){i.isActive()&&i.cancel()})),e.on("directEditing.activate",(function(e){o.removeResizers()})),e.on("create.end",500,(function(e){var t=e.context,n=t.shape,i=e.context.canExecute;e.isTouch||i&&(t.hints&&!1===t.hints.createElementsBehavior||a(n))})),e.on("autoPlace.end",500,(function(e){a(e.shape)}))}function Vy(e){return Er(e,"bpmn:SubProcess")&&!Vr(e)}Hy.$inject=["eventBus","bpmnFactory","canvas","directEditing","modeling","resizeHandles","textRenderer"],Hy.prototype.activate=function(e){var t=to(e);if(void 0!==t){var n={text:t};z(n,this.getEditingBBox(e));var i={},r=n.style||{};return z(r,{backgroundColor:null,border:null}),(kr(e,["bpmn:Task","bpmn:Participant","bpmn:Lane","bpmn:CallActivity"])||Vy(e))&&z(i,{centerVertically:!0}),Yr(e)&&(z(i,{autoResize:!0}),z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),Er(e,"bpmn:TextAnnotation")&&(z(i,{resizable:!0,autoResize:!0}),z(r,{backgroundColor:"#ffffff",border:"1px solid #ccc"})),z(n,{options:i,style:r}),n}},Hy.prototype.getEditingBBox=function(e){var t=this._canvas,n=e.label||e,i=t.getAbsoluteBBox(n),r=i.x+i.width/2,o=i.y+i.height/2,s={x:i.x,y:i.y},a=t.zoom(),l=this._textRenderer.getDefaultStyle(),c=this._textRenderer.getExternalStyle(),h=c.fontSize*a,u=c.lineHeight,p=l.fontSize*a,d=l.lineHeight,f={fontFamily:this._textRenderer.getDefaultStyle().fontFamily,fontWeight:this._textRenderer.getDefaultStyle().fontWeight};if(Er(e,"bpmn:Lane")||function(e){return Er(e,"bpmn:Participant")&&Vr(e)}(e)){var m=qr(e);z(s,m?{width:i.height,height:30*a,x:i.x-i.height/2+15*a,y:o-30*a/2}:{width:i.width,height:30*a}),z(f,{fontSize:p+"px",lineHeight:d,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 Er(e,"bpmn:Participant")&&!Vr(e)}(e)){var g=qr(e);z(s,g?{width:i.width,height:i.height}:{width:i.height,height:i.width,x:r-i.height/2,y:o-i.width/2}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px",transform:g?null:"rotate(-90deg)"})}(kr(e,["bpmn:Task","bpmn:CallActivity"])||Vy(e))&&(z(s,{width:i.width,height:i.height}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"})),function(e){return Er(e,"bpmn:SubProcess")&&Vr(e)}(e)&&(z(s,{width:i.width,x:i.x}),z(f,{fontSize:p+"px",lineHeight:d,paddingTop:7*a+"px",paddingBottom:7*a+"px",paddingLeft:5*a+"px",paddingRight:5*a+"px"}));var v=90*a,y=7*a,b=4*a;if(n.labelTarget&&(z(s,{width:v,height:i.height+y+b,x:r-v/2,y:i.y-y}),z(f,{fontSize:h+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:b+"px"})),Yr(n)&&!Kr(n)&&!fn(n)){var x=Jr(e),w=t.getAbsoluteBBox({x:x.x,y:x.y,width:0,height:0}),_=h+y+b;z(s,{width:v,height:_,x:w.x-v/2,y:w.y-_/2}),z(f,{fontSize:h+"px",lineHeight:u,paddingTop:y+"px",paddingBottom:b+"px"})}return Er(e,"bpmn:TextAnnotation")&&(z(s,{width:i.width,height:i.height,minWidth:30*a,minHeight:10*a}),z(f,{textAlign:"left",paddingTop:5*a+"px",paddingBottom:7*a+"px",paddingLeft:7*a+"px",paddingRight:5*a+"px",fontSize:p+"px",lineHeight:d})),{bounds:s,style:f}},Hy.prototype.update=function(e,t,n,i){var r,o,s;Er(e,"bpmn:TextAnnotation")&&(o=this._canvas.getAbsoluteBBox(e),r={x:e.x,y:e.y,width:e.width/o.width*i.width,height:e.height/o.height*i.height}),(s=t)&&s.trim()||(t=null),this._modeling.updateLabel(e,t,r)};var qy="djs-element-hidden",Wy="djs-label-hidden";function Qy(e,t,n){var i,r,o,s=this,a=t.getDefaultLayer();e.on("directEditing.activate",(function(e){var l=e.active;if(Er(i=l.element.label||l.element,"bpmn:TextAnnotation")){r=t.getAbsoluteBBox(i),o=De("g");var c=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:i.height,position:{mx:0,my:0}}),h=s.path=De("path");ke(h,{d:c,strokeWidth:2,stroke:Gy(i)}),xe(o,h),xe(a,o),Kn(o,i.x,i.y)}Er(i,"bpmn:TextAnnotation")||i.labelTarget?t.addMarker(i,qy):(Er(i,"bpmn:Task")||Er(i,"bpmn:CallActivity")||Er(i,"bpmn:SubProcess")||Er(i,"bpmn:Participant")||Er(i,"bpmn:Lane"))&&t.addMarker(i,Wy)})),e.on("directEditing.resize",(function(e){if(Er(i,"bpmn:TextAnnotation")){var t=e.height,o=e.dy,a=Math.max(i.height/r.height*(t+o),0),l=n.getScaledPath("TEXT_ANNOTATION",{xScaleFactor:1,yScaleFactor:1,containerWidth:i.width,containerHeight:a,position:{mx:0,my:0}});ke(s.path,{d:l})}})),e.on(["directEditing.complete","directEditing.cancel"],(function(e){var n=e.active;n&&(t.removeMarker(n.element.label||n.element,qy),t.removeMarker(i,Wy)),i=void 0,r=void 0,o&&(qe(o),o=void 0)}))}function Gy(e,t){return Sr(e).get("stroke")||t||"black"}Qy.$inject=["eventBus","canvas","pathMap"];var Xy={__depends__:[Ho,Fy,wv],__init__:["labelEditingProvider","labelEditingPreview"],labelEditingProvider:["type",Hy],labelEditingPreview:["type",Qy]},Uy=new Bo("tt");function Yy(e,t){e.style.display=!1===t?"none":""}var Ky="djs-tooltip",Zy="."+Ky;function Jy(e,t){var n,i;this._eventBus=e,this._canvas=t,this._ids=Uy,this._tooltipDefaults={show:{minZoom:.7,maxZoom:5}},this._tooltips={},this._tooltipRoot=(n=t.getContainer(),X(i=me('<div class="djs-tooltip-container" />'),{position:"absolute",width:"0",height:"0"}),n.insertBefore(i,n.firstChild),i);var r=this;ue.bind(this._tooltipRoot,Zy,"mousedown",(function(e){e.stopPropagation()})),ue.bind(this._tooltipRoot,Zy,"mouseover",(function(e){r.trigger("mouseover",e)})),ue.bind(this._tooltipRoot,Zy,"mouseout",(function(e){r.trigger("mouseout",e)})),this._init()}Jy.$inject=["eventBus","canvas"],Jy.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=z({},this._tooltipDefaults,e,{id:t}),this._addTooltip(e),e.timeout&&this.setTimeout(e),t},Jy.prototype.trigger=function(e,t){var n=t.delegateTarget||t.target,i=this.get(U(n,"data-tooltip-id"));i&&("mouseover"===e&&i.timeout&&this.clearTimeout(i),"mouseout"===e&&i.timeout&&(i.timeout=1e3,this.setTimeout(i)))},Jy.prototype.get=function(e){return"string"!=typeof e&&(e=e.id),this._tooltips[e]},Jy.prototype.clearTimeout=function(e){if(e=this.get(e)){var t=e.removeTimer;t&&(clearTimeout(t),e.removeTimer=null)}},Jy.prototype.setTimeout=function(e){if(e=this.get(e)){this.clearTimeout(e);var t=this;e.removeTimer=setTimeout((function(){t.remove(e)}),e.timeout)}},Jy.prototype.remove=function(e){var t=this.get(e);t&&(be(t.html),be(t.htmlContainer),delete t.htmlContainer,delete this._tooltips[t.id])},Jy.prototype.show=function(){Yy(this._tooltipRoot)},Jy.prototype.hide=function(){Yy(this._tooltipRoot,!1)},Jy.prototype._updateRoot=function(e){var t=e.scale||1,n=e.scale||1,i="matrix("+t+",0,0,"+n+","+-1*e.x*t+","+-1*e.y*n+")";this._tooltipRoot.style.transform=i,this._tooltipRoot.style["-ms-transform"]=i},Jy.prototype._addTooltip=function(e){var t,n=e.id,i=e.html,r=this._tooltipRoot;i.get&&i.constructor.prototype.jquery&&(i=i.get(0)),d(i)&&(i=me(i)),X(t=me('<div data-tooltip-id="'+n+'" class="'+Ky+'">'),{position:"absolute"}),t.appendChild(i),e.type&&K(t).add("djs-tooltip-"+e.type),e.className&&K(t).add(e.className),e.htmlContainer=t,r.appendChild(t),this._tooltips[n]=e,this._updateTooltip(e)},Jy.prototype._updateTooltip=function(e){var t=e.position;!function(e,t,n){X(e,{left:t+"px",top:n+"px"})}(e.htmlContainer,t.x,t.y)},Jy.prototype._updateTooltipVisibilty=function(e){y(this._tooltips,(function(t){var n=t.show,i=t.htmlContainer,r=!0;n&&((n.minZoom>e.scale||n.maxZoom<e.scale)&&(r=!1),Yy(i,r))}))},Jy.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 eb={__init__:["tooltips"],tooltips:["type",Jy]};function tb(e,t,n){function i(e,n,i){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,r=t.shape;Er(t.target,"bpmn:Collaboration")&&(Er(r,"bpmn:FlowNode")?i(e,n("flow elements must be children of pools/participants")):Er(r,"bpmn:DataObjectReference")&&i(e,n("Data object must be placed within a pool/participant.")))}))}tb.$inject=["eventBus","tooltips","translate"];var nb={__depends__:[eb],__init__:["modelingFeedback"],modelingFeedback:["type",tb]};function ib(e,t){this._eventBus=e,this.offset=5;var n=t.cls("djs-outline",["no-fill"]),i=this;function r(e){var t=De("rect");return ke(t,z({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=i.getOutline(t)||r()),i.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=r()),i.updateConnectionOutline(o,t)}))}ib.prototype.updateShapeOutline=function(e,t){var n=!1,i=this._getProviders();i.length&&y(i,(function(i){n=n||i.updateOutline(t,e)})),n||ke(e,{x:-this.offset,y:-this.offset,width:t.width+2*this.offset,height:t.height+2*this.offset})},ib.prototype.updateConnectionOutline=function(e,t){var n=vt(t);ke(e,{x:n.x-this.offset,y:n.y-this.offset,width:n.width+2*this.offset,height:n.height+2*this.offset})},ib.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("outline.getProviders",e,(function(e){e.providers.push(t)}))},ib.prototype._getProviders=function(){var e=this._eventBus.createEvent({type:"outline.getProviders",providers:[]});return this._eventBus.fire(e),e.providers},ib.prototype.getOutline=function(e){var t;return y(this._getProviders(),(function(n){p(n.getOutline)&&(t=t||n.getOutline(e))})),t},ib.$inject=["eventBus","styles","elementRegistry"];function rb(e,t,n){this._canvas=t;var i=this;e.on("element.changed",(function(e){n.isSelected(e.element)&&i._updateMultiSelectionOutline(n.get())})),e.on("selection.changed",(function(e){var t=e.newSelection;i._updateMultiSelectionOutline(t)}))}rb.prototype._updateMultiSelectionOutline=function(e){var t=this._canvas.getLayer("selectionOutline");Pe(t);var n=e.length>1;if(Se(this._canvas.getContainer())[n?"add":"remove"]("djs-multi-select"),n){var i=function(e){return{x:e.x-6,y:e.y-6,width:e.width+12,height:e.height+12}}(vt(e)),r=De("rect");ke(r,z({rx:3},i)),Se(r).add("djs-selection-outline"),xe(t,r)}},rb.$inject=["eventBus","canvas","selection"];var ob={__depends__:[Rs],__init__:["outline","multiSelectionOutline"],outline:["type",ib],multiSelectionOutline:["type",rb]},sb=Math.round;function ab(e,t,n,i,r){function o(e,t,n,i){return r.allowed("elements.move",{shapes:e,delta:t,position:n,target:i})}function s(e,n,i,r){if(h(i)&&(r=i,i=!1),!n.waypoints&&n.parent&&!Se(e.target).has("djs-hit-no-move")){var o=function(e){return{x:e.x+sb(e.width/2),y:e.y+sb(e.height/2)}}(n);return t.init(e,o,"shape.move",{cursor:"grabbing",autoActivate:i,data:{shape:n,context:r||{}}}),!0}}e.on("shape.move.start",1500,(function(e){var t=e.context,n=e.shape,r=i.get().slice();-1===r.indexOf(n)&&(r=[n]),r=function(e){var t=S(e,"id");return v(e,(function(e){for(;e=e.parent;)if(t[e.id])return!1;return!0}))}(r),z(t,{shapes:r,validatedShapes:r,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,i=n.validatedShapes,r=e.hover,s={x:e.dx,y:e.dy};t=o(i,s,{x:e.x,y:e.y},r),n.delta=s,n.canExecute=t,n.target=null!==t?r:null})),e.on("shape.move.end",(function(e){var t=e.context,i=t.delta,r=t.canExecute,o="attach"===r,s=t.shapes;if(!1===r)return!1;i.x=sb(i.x),i.y=sb(i.y),0===i.x&&0===i.y||n.moveElements(s,i,t.target,{primaryShape:t.shape,attach:o})})),e.on("element.mousedown",(function(e){if(ys(e)){var t=ds(e);if(!t)throw new Error("must supply DOM mousedown event");return s(t,e.element)}})),this.start=s}ab.$inject=["eventBus","dragging","modeling","selection","rules"];var lb="djs-dragging",cb="drop-ok",hb="drop-not-ok",ub="new-parent",pb="attach-ok";function db(e,t,n,r){function o(e){var t=function(e){var t=v(e,(function(t){return!dn(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=gt(e,!0),n=t.flatMap((e=>(e.incoming||[]).concat(e.outgoing||[]))),i=t.concat(n);return[...new Set(i)]}function a(e,n){[pb,cb,hb,ub].forEach((function(i){i===n?t.addMarker(e,i):t.removeMarker(e,i)}))}e.on("shape.move.start",499,(function(e){var a,l=e.context,c=l.shapes,h=l.allDraggedElements,u=o(c);if(!l.dragGroup){var p=De("g");ke(p,n.cls("djs-drag-group",["no-events"])),xe(t.getActiveLayer(),p),l.dragGroup=p}u.forEach((function(e){r.addDragger(e,l.dragGroup)})),y(h=h?i([h,s(c)]):s(c),(function(e){t.addMarker(e,lb)})),l.allDraggedElements=h,l.differentParents=1!==(a=S(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,i=t.target,r=t.shape.parent,o=t.canExecute;i&&("attach"===o?a(i,pb):t.canExecute&&r&&i.id!==r.id?a(i,ub):a(i,t.canExecute?cb:hb)),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,i=n.allDraggedElements,r=n.dragGroup;y(i,(function(e){t.removeMarker(e,lb)})),r&&qe(r)})),this.makeDraggable=function(e,n,i){r.addDragger(n,e.dragGroup),i&&t.addMarker(n,lb),e.allDraggedElements?e.allDraggedElements.push(n):e.allDraggedElements=[n]}}db.$inject=["eventBus","canvas","styles","previewSupport"];var fb={__depends__:[ks,Rs,ob,Tc,Cc,Fh],__init__:["move","movePreview"],move:["type",ab],movePreview:["type",db]},mb=".djs-palette-toggle",gb=".entry",vb=mb+", "+gb,yb="djs-palette-",bb="open",xb="two-column";function wb(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 _b(e,t){var n=t.getPaletteEntries();return p(n)?n(e):(y(n,(function(t,n){e[n]=t})),e)}wb.$inject=["eventBus","canvas"],wb.prototype.registerProvider=function(e,t){t||(t=e,e=1e3),this._eventBus.on("palette.getProviders",e,(function(e){e.providers.push(t)})),this._rebuild()},wb.prototype.getEntries=function(){return this._getProviders().reduce(_b,{})},wb.prototype._rebuild=function(){this._diagramInitialized&&(this._getProviders().length&&(this._container||this._init(),this._update()))},wb.prototype._init=function(){var e=this,t=this._eventBus,n=this._getParentContainer(),i=this._container=me(wb.HTML_MARKUP);n.appendChild(i),K(n).add(yb+"shown"),ue.bind(i,vb,"click",(function(t){if(ge(t.delegateTarget,mb))return e.toggle();e.trigger("click",t)})),le.bind(i,"mousedown",(function(e){e.stopPropagation()})),ue.bind(i,gb,"dragstart",(function(t){e.trigger("dragstart",t)})),t.on("canvas.resized",this._layoutChanged,this),t.fire("palette.create",{container:i})},wb.prototype._getProviders=function(e){var t=this._eventBus.createEvent({type:"palette.getProviders",providers:[]});return this._eventBus.fire(t),t.providers},wb.prototype._toggleState=function(e){e=e||{};var t,n=this._getParentContainer(),i=this._container,r=this._eventBus,o=K(i),s=K(n);t="twoColumn"in e?e.twoColumn:this._needsCollapse(n.clientHeight,this._entries||{}),o.toggle(xb,t),s.toggle(yb+xb,t),"open"in e&&(o.toggle(bb,e.open),s.toggle(yb+bb,e.open)),r.fire("palette.changed",{twoColumn:t,open:this.isOpen()})},wb.prototype._update=function(){var e=ve(".djs-palette-entries",this._container),t=this._entries=this.getEntries();J(e),y(t,(function(t,n){var i=t.group||"default",r=ve("[data-group="+Go(i)+"]",e);r||(U(r=me('<div class="group"></div>'),"data-group",i),e.appendChild(r));var o=t.html||(t.separator?'<hr class="separator" />':'<div class="entry" draggable="true"></div>'),s=me(o);if(r.appendChild(s),!t.separator&&(U(s,"data-action",n),t.title&&U(s,"title",t.title),t.className&&function(e,t){var n=K(e);(c(t)?t:t.split(/\s+/g)).forEach((function(e){n.add(e)}))}(s,t.className),t.imageUrl)){var a=me("<img>");U(a,"src",t.imageUrl),s.appendChild(a)}})),this.open()},wb.prototype.trigger=function(e,t,n){var i,r,o=t.delegateTarget||t.target;return o?(i=U(o,"data-action"),r=t.originalEvent||t,this.triggerEntry(i,e,r,n)):t.preventDefault()},wb.prototype.triggerEntry=function(e,t,n,i){var r,o;if((r=this._entries[e])&&(o=r.action,!1!==this._eventBus.fire("palette.trigger",{entry:r,event:n}))){if(p(o)){if("click"===t)return o(n,i)}else if(o[t])return o[t](n,i);n.preventDefault()}},wb.prototype._layoutChanged=function(){this._toggleState({})},wb.prototype._needsCollapse=function(e,t){return e<46*Object.keys(t).length+50},wb.prototype.close=function(){this._toggleState({open:!1,twoColumn:!1})},wb.prototype.open=function(){this._toggleState({open:!0})},wb.prototype.toggle=function(){this.isOpen()?this.close():this.open()},wb.prototype.isActiveTool=function(e){return e&&this._activeTool===e},wb.prototype.updateToolHighlight=function(e){var t;this._toolsContainer||(t=ve(".djs-palette-entries",this._container),this._toolsContainer=ve("[data-group=tools]",t)),y(this._toolsContainer.children,(function(t){var n=t.getAttribute("data-action");if(n){var i=K(t);n=n.replace("-tool",""),i.contains("entry")&&n===e?i.add("highlighted-entry"):i.remove("highlighted-entry")}}))},wb.prototype.isOpen=function(){return K(this._container).has(bb)},wb.prototype._getParentContainer=function(){return this._canvas.getContainer()},wb.HTML_MARKUP='<div class="djs-palette"><div class="djs-palette-entries"></div><div class="djs-palette-toggle"></div></div>';var Eb={__init__:["palette"],palette:["type",wb]},kb="crosshair";function Ob(e,t,n,i,r,o,s){this._selection=r,this._dragging=n,this._mouse=s;var a=this,l=function(e){var n,i=t.getActiveLayer();ke(n=e.frame=De("rect"),{class:"djs-lasso-overlay",width:1,height:1,x:0,y:0}),xe(i,n)},c=function(e){var t=e.frame,n=e.bbox;ke(t,{x:n.x,y:n.y,width:n.width,height:n.height})},h=function(e){e.frame&&qe(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=Sb(e),r=i.filter((function(e){return e})),o=xs(e);a.select(r,n,o?t.selection:[])})),e.on("lasso.start",(function(e){var t=e.context;t.bbox=Sb(e),l(t),t.selection=r.get()})),e.on("lasso.move",(function(e){var t=e.context;t.bbox=Sb(e),c(t)})),e.on("lasso.cleanup",(function(e){var t=e.context;h(t)})),e.on("element.mousedown",1500,(function(e){if(xs(e))return a.activateLasso(e.originalEvent),!0}))}function Sb(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}}Ob.$inject=["eventBus","canvas","dragging","elementRegistry","selection","toolManager","mouse"],Ob.prototype.activateLasso=function(e,t){this._dragging.init(e,"lasso",{autoActivate:t,cursor:kb,data:{context:{}}})},Ob.prototype.activateSelection=function(e,t){this._dragging.init(e,"lasso.selection",{trapClick:!1,autoActivate:t,cursor:kb,data:{context:{}},keepSelection:!0})},Ob.prototype.select=function(e,t,n=[]){var i=yt(e,t);this._selection.select([...n,...O(i)])},Ob.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateSelection(e,!!e)},Ob.prototype.isActive=function(){var e=this._dragging.context();return e&&/^lasso/.test(e.prefix)};var Cb={__depends__:[Lf,ff],__init__:["lassoTool"],lassoTool:["type",Ob]},Pb=1500,Ab="grab";function Mb(e,t,n,i,r,o){this._dragging=n,this._mouse=o;var s=this,a=i.get("keyboard",!1);r.registerTool("hand",{tool:"hand",dragging:"hand.move"}),e.on("element.mousedown",Pb,(function(e){if(bs(e))return s.activateMove(e.originalEvent,!0),!1})),a&&a.addListener(Pb,(function(e){if(Rb(e.keyEvent)&&!s.isActive()){var t=s._mouse.getLastMoveEvent();s.activateMove(t,!!t)}}),"keyboard.keydown"),a&&a.addListener(Pb,(function(e){Rb(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!bs(t)&&n&&e.once("hand.move.ended",(function(e){s.activateHand(e.originalEvent,!0,!0)})),!1}))}function Rb(e){return $s("Space",e)}Mb.$inject=["eventBus","canvas","dragging","injector","toolManager","mouse"],Mb.prototype.activateMove=function(e,t,n){"object"==typeof t&&(n=t,t=!1),this._dragging.init(e,"hand.move",{autoActivate:t,cursor:Ab,data:{context:n||{}}})},Mb.prototype.activateHand=function(e,t,n){this._dragging.init(e,"hand",{trapClick:!1,autoActivate:t,cursor:Ab,data:{context:{reactivate:n}}})},Mb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();this.activateHand(e,!!e)},Mb.prototype.isActive=function(){var e=this._dragging.context();return!!e&&/^(hand|hand\.move)$/.test(e.prefix)};var Tb={__depends__:[Lf,ff],__init__:["handTool"],handTool:["type",Mb]},Db="connect-ok",Bb="connect-not-ok";function Lb(e,t,n,i,r,o,s){var a=this;this._dragging=t,this._rules=o,this._mouse=s,r.registerTool("global-connect",{tool:"global-connect",dragging:"global-connect.drag"}),e.on("global-connect.hover",(function(e){var t=e.context,n=e.hover,r=t.canStartConnect=a.canStartConnect(n);null!==r&&(t.startTarget=n,i.addMarker(n,r?Db:Bb))})),e.on(["global-connect.out","global-connect.cleanup"],(function(e){var t=e.context.startTarget,n=e.context.canStartConnect;t&&i.removeMarker(t,n?Db:Bb)})),e.on(["global-connect.ended"],(function(t){var i=t.context.startTarget,r={x:t.x,y:t.y};if(a.canStartConnect(i))return e.once("element.out",(function(){e.once(["connect.ended","connect.canceled"],(function(){e.fire("global-connect.drag.ended")})),n.start(null,i,r)})),!1}))}Lb.$inject=["eventBus","dragging","connect","canvas","toolManager","rules","mouse"],Lb.prototype.start=function(e,t){this._dragging.init(e,"global-connect",{autoActivate:t,trapClick:!1,data:{context:{}}})},Lb.prototype.toggle=function(){if(this.isActive())return this._dragging.cancel();var e=this._mouse.getLastMoveEvent();return this.start(e,!!e)},Lb.prototype.isActive=function(){var e=this._dragging.context();return e&&/^global-connect/.test(e.prefix)},Lb.prototype.canStartConnect=function(e){return this._rules.allowed("connection.start",{source:e})};var Nb={__depends__:[Bh,Tc,Cc,Lf,ff],globalConnect:["type",Lb]};function zb(e,t,n,i,r,o,s,a){this._palette=e,this._create=t,this._elementFactory=n,this._spaceTool=i,this._lassoTool=r,this._handTool=o,this._globalConnect=s,this._translate=a,e.registerProvider(this)}zb.$inject=["palette","create","elementFactory","spaceTool","lassoTool","handTool","globalConnect","translate"],zb.prototype.getPaletteEntries=function(){var e={},t=this._create,n=this._elementFactory,i=this._spaceTool,r=this._lassoTool,o=this._handTool,s=this._globalConnect,a=this._translate;function l(e,i,r,o,s){function a(i){var r=n.createShape(z({type:e},s));t.start(i,r)}return{group:i,className:r,title:o,action:{dragstart:a,click:a}}}function c(e){var i=n.createShape({type:"bpmn:SubProcess",x:0,y:0,isExpanded:!0}),r=n.createShape({type:"bpmn:StartEvent",x:40,y:82,parent:i});t.start(e,[i,r],{hints:{autoSelect:[i]}})}function h(e){t.start(e,n.createParticipantShape())}return z(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){r.activateSelection(e)}}},"space-tool":{group:"tools",className:"bpmn-icon-space-tool",title:a("Activate create/remove space tool"),action:{click:function(e){i.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:h,click:h}},"create.group":l("bpmn:Group","artifact","bpmn-icon-group",a("Create group"))}),e};var $b={__depends__:[Eb,pf,tm,Cb,Tb,Nb,Po],__init__:["paletteProvider"],paletteProvider:["type",zb]};function Ib(e,t,n,i,r){Vo.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){y(e.canExecute.replacements,(function(o){var s=o.oldElementId,a={type:o.newElementType};if(!e.visualReplacements[s]){var l=t.get(s);z(a,{x:l.x,y:l.y});var c=n.createShape(a);i.addShape(c,l.parent);var h=ve('[data-element-id="'+Go(l.id)+'"]',e.dragGroup);h&&ke(h,{display:"none"});var u=r.addDragger(c,e.dragGroup);e.visualReplacements[s]=u,i.removeShape(c)}}))}(o):function(e){var t=e.visualReplacements;y(t,(function(n,i){var r=ve('[data-element-id="'+Go(i)+'"]',e.dragGroup);r&&ke(r,{display:"inline"}),n.remove(),t[i]&&delete t[i]}))}(o)}))}Ib.$inject=["eventBus","elementRegistry","elementFactory","canvas","previewSupport"],e(Ib,Vo);var jb={__depends__:[Fh],__init__:["bpmnReplacePreview"],bpmnReplacePreview:["type",Ib]},Fb=40,Hb=20,Vb=10,qb=20,Wb=["x","y"],Qb=Math.abs;function Gb(e){e.on(["connect.hover","connect.move","connect.end"],1250,(function(e){var t=e.context,n=t.canExecute,i=t.start,r=t.hover,o=t.source,s=t.target;e.originalEvent&&zs(e.originalEvent)||(t.initialConnectionStart||(t.initialConnectionStart=t.connectionStart),n&&r&&function(e,t,n){Wb.forEach((function(i){var r=Yb(i,t);e[i]<t[i]+n?Eh(e,i,t[i]+n):e[i]>t[i]+r-n&&Eh(e,i,t[i]+r-n)}))}(e,r,function(e){return Er(e,"bpmn:Task")?Vb:Hb}(r)),r&&function(e,t){return _(t,(function(t){return Ub(e,t)}))}(n,["bpmn:Association","bpmn:DataInputAssociation","bpmn:DataOutputAssociation","bpmn:SequenceFlow"])?(t.connectionStart=wh(i),kr(r,["bpmn:Event","bpmn:Gateway"])&&Xb(e,wh(r)),kr(r,["bpmn:Task","bpmn:SubProcess"])&&function(e,t){var n=wh(t);Wb.forEach((function(i){(function(e,t,n){return e[n]>t[n]+qb&&e[n]<t[n]+Yb(n,t)-qb})(e,t,i)&&Eh(e,i,n[i])}))}(e,r),Er(o,"bpmn:BoundaryEvent")&&s===o.host&&function(e){var t=e.context,n=t.source,i=t.target;if(function(e){var t=e.hover,n=e.source;return t&&n&&t===n}(t))return;var r=wh(n),o=wn(r,i,-10),s=[];/top|bottom/.test(o)&&s.push("x");/left|right/.test(o)&&s.push("y");s.forEach((function(t){var n,i=e[t];Qb(i-r[t])<Fb&&(n=i>r[t]?r[t]+Fb:r[t]-Fb,Eh(e,t,n))}))}(e)):Ub(n,"bpmn:MessageFlow")?(Er(i,"bpmn:Event")&&(t.connectionStart=wh(i)),Er(r,"bpmn:Event")&&Xb(e,wh(r))):t.connectionStart=t.initialConnectionStart)}))}function Xb(e,t){Eh(e,"x",t.x),Eh(e,"y",t.y)}function Ub(e,t){return e&&e.type===t}function Yb(e,t){return"x"===e?t.width:t.height}function Kb(){this._targets={},this._snapOrigins={},this._snapLocations=[],this._defaultSnaps={}}function Zb(){this._snapValues={}}Gb.$inject=["eventBus"],Kb.prototype.getSnapOrigin=function(e){return this._snapOrigins[e]},Kb.prototype.setSnapOrigin=function(e,t){this._snapOrigins[e]=t,-1===this._snapLocations.indexOf(e)&&this._snapLocations.push(e)},Kb.prototype.addDefaultSnap=function(e,t){var n=this._defaultSnaps[e];n||(n=this._defaultSnaps[e]=[]),n.push(t)},Kb.prototype.getSnapLocations=function(){return this._snapLocations},Kb.prototype.setSnapLocations=function(e){this._snapLocations=e},Kb.prototype.pointsForTarget=function(e){var t=e.id||e,n=this._targets[t];return n||(n=this._targets[t]=new Zb).initDefaults(this._defaultSnaps),n},Zb.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)},Zb.prototype.snap=function(e,t,n,i){var r=this._snapValues[t];return r&&function(e,t,n){var i,r;for(n=void 0===n?10:n,i=0;i<t.length;i++)if(r=t[i],vh(r-e)<=n)return r}(e[n],r[n],i)},Zb.prototype.initDefaults=function(e){var t=this;y(e||{},(function(e,n){y(e,(function(e){t.add(n,e)}))}))};var Jb=1250;function ex(e,t,n){var i=this;this._elementRegistry=e,t.on(["create.start","shape.move.start"],(function(e){i.initSnap(e)})),t.on(["create.move","create.end","shape.move.move","shape.move.end"],Jb,(function(e){var t=e.context,r=t.shape,o=t.snapContext,s=t.target;if((!e.originalEvent||!zs(e.originalEvent))&&!_h(e)&&s){var a=o.pointsForTarget(s);a.initialized||((a=i.addSnapTargetPoints(a,r,s)).initialized=!0),n.snap(e,a)}})),t.on(["create.cleanup","shape.move.cleanup"],(function(){n.hide()}))}ex.$inject=["elementRegistry","eventBus","snapping"],ex.prototype.initSnap=function(e){var t,n=this._elementRegistry,i=e.context,r=i.shape,o=i.snapContext;o||(o=i.snapContext=new Kb);var s=(t=n.get(r.id)?wh(r,e):{x:e.x+wh(r).x,y:e.y+wh(r).y}).x-r.width/2,a=t.y-r.height/2,l=t.x+r.width/2,c=t.y+r.height/2;return o.setSnapOrigin("mid",{x:t.x-e.x,y:t.y-e.y}),fn(r)||(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},ex.prototype.addSnapTargetPoints=function(e,t,n){return y(this.getSnapTargets(t,n),(function(n){if(fn(n))fn(t)&&e.add("mid",wh(n));else if(dn(n)){if(n.waypoints.length<3)return;y(n.waypoints.slice(1,-1),(function(t){e.add("mid",t)}))}else e.add("mid",wh(n))})),u(t.x)&&u(t.y)?(this._elementRegistry.get(t.id)&&e.add("mid",wh(t)),e):e},ex.prototype.getSnapTargets=function(e,t){return kh(t).filter((function(e){return!e.hidden}))};function tx(e,t){t.invoke(ex,this),e.on(["create.move","create.end"],1500,nx),e.on(["create.move","create.end","shape.move.move","shape.move.end"],1500,(function(e){var t=e.context,n=t.canExecute,i=t.target;n&&("attach"===n||n.attach)&&!_h(e)&&function(e,t){var n,i=vn(t),r=md(e,t),o=e.context,s=o.shape;n=s.parent?{x:0,y:0}:xn(s);/top/.test(r)?Eh(e,"y",i.top-n.y):/bottom/.test(r)&&Eh(e,"y",i.bottom-n.y);/left/.test(r)?Eh(e,"x",i.left-n.x):/right/.test(r)&&Eh(e,"x",i.right-n.x)}(e,i)}))}function nx(e){var t=e.context.createConstraints;if(t){var n=t.top,i=t.right,r=t.bottom,o=t.left;(o&&o>=e.x||i&&i<=e.x)&&Eh(e,"x",e.x),(n&&n>=e.y||r&&r<=e.y)&&Eh(e,"y",e.y)}}function ix(e,t){return-1!==e.indexOf(t)}function rx(e,t,n){return t?{x:e.x-n.x,y:e.y-n.y}:{x:e.x,y:e.y}}e(tx,ex),tx.$inject=["eventBus","injector"],tx.prototype.initSnap=function(e){var t=ex.prototype.initSnap.call(this,e),n=e.shape,i=!!this._elementRegistry.get(n.id);return y(n.outgoing,(function(n){var r=n.waypoints[0];r=r.original||r,t.setSnapOrigin(n.id+"-docking",rx(r,i,e))})),y(n.incoming,(function(n){var r=n.waypoints[n.waypoints.length-1];r=r.original||r,t.setSnapOrigin(n.id+"-docking",rx(r,i,e))})),Er(n,"bpmn:Participant")&&t.setSnapLocations(["top-left","bottom-right","mid"]),t},tx.prototype.addSnapTargetPoints=function(e,t,n){ex.prototype.addSnapTargetPoints.call(this,e,t,n);var i=this.getSnapTargets(t,n);y(i,(function(n){var i;(function(e){if(Er(e,"bpmn:SubProcess")&&Vr(e))return!0;return Er(e,"bpmn:Participant")}(n)||(i="bpmn:TextAnnotation",[t,n].every((function(e){return Er(e,i)}))))&&(e.add("top-left",bh(n)),e.add("bottom-right",xh(n)))}));var r=this._elementRegistry;return y(t.incoming,(function(n){if(r.get(t.id)){ix(i,n.source)||e.add("mid",xn(n.source));var o=n.waypoints[0];e.add(n.id+"-docking",o.original||o)}})),y(t.outgoing,(function(n){if(r.get(t.id)){ix(i,n.target)||e.add("mid",xn(n.target));var o=n.waypoints[n.waypoints.length-1];e.add(n.id+"-docking",o.original||o)}})),Er(n,"bpmn:SequenceFlow")&&(e=this.addSnapTargetPoints(e,t,n.parent)),e},tx.prototype.getSnapTargets=function(e,t){return ex.prototype.getSnapTargets.call(this,e,t).filter((function(e){return!Er(e,"bpmn:Lane")}))};function ox(e,t){var n=this;e.on(["resize.start"],(function(e){n.initSnap(e)})),e.on(["resize.move","resize.end"],1250,(function(e){var i=e.context,r=i.shape,o=r.parent,s=i.direction,a=i.snapContext;if(!(e.originalEvent&&zs(e.originalEvent)||_h(e))){var l=a.pointsForTarget(o);l.initialized||((l=n.addSnapTargetPoints(l,r,o,s)).initialized=!0),function(e){return"n"===e||"s"===e}(s)&&Eh(e,"x",e.x),function(e){return"e"===e||"w"===e}(s)&&Eh(e,"y",e.y),t.snap(e,l)}})),e.on(["resize.cleanup"],(function(){t.hide()}))}function sx(e,t){var n=xn(e),i=vn(e),r={x:n.x,y:n.y};return-1!==t.indexOf("n")?r.y=i.top:-1!==t.indexOf("s")&&(r.y=i.bottom),-1!==t.indexOf("e")?r.x=i.right:-1!==t.indexOf("w")&&(r.x=i.left),r}ox.prototype.initSnap=function(e){var t=e.context,n=t.shape,i=t.direction,r=t.snapContext;r||(r=t.snapContext=new Kb);var o=sx(n,i);return r.setSnapOrigin("corner",{x:o.x-e.x,y:o.y-e.y}),r},ox.prototype.addSnapTargetPoints=function(e,t,n,i){return y(this.getSnapTargets(t,n),(function(t){e.add("corner",xh(t)),e.add("corner",bh(t))})),e.add("corner",sx(t,i)),e},ox.$inject=["eventBus","snapping"],ox.prototype.getSnapTargets=function(e,t){return kh(t).filter((function(t){return!(n=t,i=e,n.host===i||dn(t)||function(e){return!!e.hidden}(t)||fn(t));var n,i}))};function ax(e){this._canvas=e,this._asyncHide=L(N(this.hide,this),1e3)}ax.$inject=["canvas"],ax.prototype.snap=function(e,t){var n=e.context.snapContext,i=n.getSnapLocations(),r={x:_h(e,"x"),y:_h(e,"y")};y(i,(function(i){var o=n.getSnapOrigin(i),s={x:e.x+o.x,y:e.y+o.y};if(y(["x","y"],(function(e){var n;r[e]||void 0!==(n=t.snap(s,i,e,7))&&(r[e]={value:n,originValue:n-o[e]})})),r.x&&r.y)return!1})),this.showSnapLine("vertical",r.x&&r.x.value),this.showSnapLine("horizontal",r.y&&r.y.value),y(["x","y"],(function(t){var n=r[t];h(n)&&Eh(e,t,n.originValue)}))},ax.prototype._createLine=function(e){var t=this._canvas.getLayer("snap"),n=De("path");return ke(n,{d:"M0,0 L0,0"}),Se(n).add("djs-snap-line"),xe(t,n),{update:function(t){u(t)?ke(n,"horizontal"===e?{d:"M-100000,"+t+" L+100000,"+t,display:""}:{d:"M "+t+",-100000 L "+t+", +100000",display:""}):ke(n,{display:"none"})}}},ax.prototype._createSnapLines=function(){this._snapLines={horizontal:this._createLine("horizontal"),vertical:this._createLine("vertical")}},ax.prototype.showSnapLine=function(e,t){var n=this.getSnapLine(e);n&&n.update(t),this._asyncHide()},ax.prototype.getSnapLine=function(e){return this._snapLines||this._createSnapLines(),this._snapLines[e]},ax.prototype.hide=function(){y(this._snapLines,(function(e){e.update()}))};var lx={__depends__:[{__init__:["createMoveSnapping","resizeSnapping","snapping"],createMoveSnapping:["type",ex],resizeSnapping:["type",ox],snapping:["type",ax]}],__init__:["connectSnapping","createMoveSnapping"],connectSnapping:["type",Gb],createMoveSnapping:["type",tx]};function cx(e,t,n,i){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=i,this._container=this._getBoxHtml(),this._searchInput=ve(cx.INPUT_SELECTOR,this._container),this._resultsContainer=ve(cx.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 hx(e,t,n){var i=function(e){var t="";return e.forEach((function(e){var n=Uo(e.value||e.matched||e.normal),i=e.match||e.matched;t+=i?'<b class="'+cx.RESULT_HIGHLIGHT_CLASS+'">'+n+"</b>":n})),""!==t?t:null}(t),r=me(n);r.innerHTML=i,e.appendChild(r)}cx.$inject=["canvas","eventBus","selection","translate"],cx.prototype._bindEvents=function(){var e=this;function t(t,n,i,r){e._eventMaps.push({el:t,type:i,listener:ue.bind(t,n,i,r)})}t(document,"html","click",(function(t){e.close(!1)})),t(this._container,cx.INPUT_SELECTOR,"click",(function(e){e.stopPropagation(),e.delegateTarget.focus()})),t(this._container,cx.RESULT_SELECTOR,"mouseover",(function(t){t.stopPropagation(),e._scrollToNode(t.delegateTarget),e._preselect(t.delegateTarget)})),t(this._container,cx.RESULT_SELECTOR,"click",(function(t){t.stopPropagation(),e._select(t.delegateTarget)})),t(this._container,cx.INPUT_SELECTOR,"keydown",(function(e){$s("ArrowUp",e)&&e.preventDefault(),$s("ArrowDown",e)&&e.preventDefault()})),t(this._container,cx.INPUT_SELECTOR,"keyup",(function(t){if($s("Escape",t))return e.close();if($s("Enter",t)){var n=e._getCurrentResult();return n?e._select(n):e.close(!1)}return $s("ArrowUp",t)?e._scrollToDirection(!0):$s("ArrowDown",t)?e._scrollToDirection():void($s(["ArrowLeft","ArrowRight"],t)||e._search(t.delegateTarget.value))}))},cx.prototype._unbindEvents=function(){this._eventMaps.forEach((function(e){ue.unbind(e.el,e.type,e.listener)}))},cx.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,i=t._createResultNode(e,n);t._results[n]={element:e.element,node:i}}));var i=ve(cx.RESULT_SELECTOR,this._resultsContainer);this._scrollToNode(i),this._preselect(i)}else this._selection.select(null)}},cx.prototype._scrollToDirection=function(e){var t=this._getCurrentResult();if(t){var n=e?t.previousElementSibling:t.nextElementSibling;n&&(this._scrollToNode(n),this._preselect(n))}},cx.prototype._scrollToNode=function(e){if(e&&e!==this._getCurrentResult()){var t=e.offsetTop,n=this._resultsContainer.scrollTop,i=t-this._resultsContainer.clientHeight+e.clientHeight;t<n?this._resultsContainer.scrollTop=t:n<i&&(this._resultsContainer.scrollTop=i)}},cx.prototype._clearResults=function(){J(this._resultsContainer),this._results={},this._eventBus.fire("searchPad.cleared")},cx.prototype._getCurrentResult=function(){return ve(cx.RESULT_SELECTED_SELECTOR,this._resultsContainer)},cx.prototype._createResultNode=function(e,t){var n=me(cx.RESULT_HTML);return e.primaryTokens.length>0&&hx(n,e.primaryTokens,cx.RESULT_PRIMARY_HTML),hx(n,e.secondaryTokens,cx.RESULT_SECONDARY_HTML),U(n,cx.RESULT_ID_ATTRIBUTE,t),this._resultsContainer.appendChild(n),n},cx.prototype.registerProvider=function(e){this._searchProvider=e},cx.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"))},cx.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())},cx.prototype.toggle=function(){this.isOpen()?this.close():this.open()},cx.prototype.isOpen=function(){return this._open},cx.prototype._preselect=function(e){var t=this._getCurrentResult();if(e!==t){t&&K(t).remove(cx.RESULT_SELECTED_CLASS);var n=U(e,cx.RESULT_ID_ATTRIBUTE),i=this._results[n].element;K(e).add(cx.RESULT_SELECTED_CLASS),this._canvas.scrollToElement(i,{top:300}),this._selection.select(i),this._eventBus.fire("searchPad.preselected",i)}},cx.prototype._select=function(e){var t=U(e,cx.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)},cx.prototype._getBoxHtml=function(){const e=me(cx.BOX_HTML),t=ve(cx.INPUT_SELECTOR,e);return t&&t.setAttribute("aria-label",this._translate("Search in diagram")),e},cx.CONTAINER_SELECTOR=".djs-search-container",cx.INPUT_SELECTOR=".djs-search-input input",cx.RESULTS_CONTAINER_SELECTOR=".djs-search-results",cx.RESULT_SELECTOR=".djs-search-result",cx.RESULT_SELECTED_CLASS="djs-search-result-selected",cx.RESULT_SELECTED_SELECTOR="."+cx.RESULT_SELECTED_CLASS,cx.RESULT_ID_ATTRIBUTE="data-result-id",cx.RESULT_HIGHLIGHT_CLASS="djs-search-highlight",cx.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>',cx.RESULT_HTML='<div class="djs-search-result"></div>',cx.RESULT_PRIMARY_HTML='<div class="djs-search-result-primary"></div>',cx.RESULT_SECONDARY_HTML='<p class="djs-search-result-secondary"></p>';var ux={__depends__:[Po,jo,Rs],searchPad:["type",cx]};function px(e,t,n,i){this._elementRegistry=e,this._canvas=n,this._search=i,t.registerProvider(this)}function dx(e){const{item:{element:t},tokens:n}=e;return{element:t,primaryTokens:n.label,secondaryTokens:n.id}}px.$inject=["elementRegistry","searchPad","canvas","search"],px.prototype.find=function(e){var t=this._canvas.getRootElements(),n=this._elementRegistry.filter((function(e){return!fn(e)&&!t.includes(e)}));return this._search(n.map((e=>({element:e,label:to(e),id:e.id}))),e,{keys:["label","id"]}).map(dx)};var fx={__depends__:[ux,ql],__init__:["bpmnSearch"],bpmnSearch:["type",px]};const mx={width:36,height:50},gx={width:50,height:50};function vx(e,t,n){return De("path",{d:e,strokeWidth:2,transform:`translate(${t.x}, ${t.y})`,...n})}function yx(e,t){this._styles=t,e.registerProvider(this)}function bx(e,t){var n;return"bpmn:DataObjectReference"===t?n=mx:"bpmn:DataStoreReference"===t&&(n=gx),e.width===n.width&&e.height===n.height}yx.$inject=["outline","styles"],yx.prototype.getOutline=function(e){const t=this._styles.cls("djs-outline",["no-fill"]);var n;if(!fn(e))return Er(e,"bpmn:Gateway")?(z((n=De("rect")).style,{"transform-box":"fill-box",transform:"rotate(45deg)","transform-origin":"center"}),ke(n,z({x:2,y:2,rx:4,width:e.width-4,height:e.height-4},t))):kr(e,["bpmn:Task","bpmn:SubProcess","bpmn:Group","bpmn:CallActivity"])?ke(n=De("rect"),z({x:-5,y:-5,rx:14,width:e.width+10,height:e.height+10},t)):Er(e,"bpmn:EndEvent")?ke(n=De("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5+1},t)):Er(e,"bpmn:Event")?ke(n=De("circle"),z({cx:e.width/2,cy:e.height/2,r:e.width/2+5},t)):Er(e,"bpmn:DataObjectReference")&&bx(e,"bpmn:DataObjectReference")?n=vx("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):Er(e,"bpmn:DataStoreReference")&&bx(e,"bpmn:DataStoreReference")&&(n=vx("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},yx.prototype.updateOutline=function(e,t){if(!fn(e))return kr(e,["bpmn:SubProcess","bpmn:Group"])?(ke(t,{width:e.width+10,height:e.height+10}),!0):!!kr(e,["bpmn:Event","bpmn:Gateway","bpmn:DataStoreReference","bpmn:DataObjectReference"])};var xx={__depends__:[ob],__init__:["outlineProvider"],outlineProvider:["type",yx]};function wx(e){Hr.call(this,e)}e(wx,Hr),wx.Viewer=Ts,wx.NavigatedViewer=pa,wx.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>')},wx.prototype._interactionModules=[Ys,oa,ua],wx.prototype._modelingModules=[Zl,mc,Mc,xc,Ph,Bh,Nh,qv,kf,pf,Kv,iy,yy,xy,_y,My,Xy,uv,nb,fb,$b,jb,Fy,lx,fx,xx],wx.prototype._modules=[].concat(Ts.prototype._modules,wx.prototype._interactionModules,wx.prototype._modelingModules);var _x=new Bo,Ex={min:.2,max:4};function kx(e,t,n,i,r){var o=this;function s(e){o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),Sx(Ox({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=Bx(t);o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect()),e&&s(n);var r=Ox({x:n.x-o._state._svgClientRect.left,y:n.y-o._state._svgClientRect.top},o._svg,o._lastViewbox),a=i.viewbox(),h=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}}(r,a),u=o._viewportDom.getBoundingClientRect(),p={x:n.x-u.left+1,y:n.y-u.top+1};z(o._state,{cachedViewbox:a,initialDragPosition:{x:n.x,y:n.y},isDragging:!0,offsetViewport:h,offsetViewportDom:p,viewportClientRect:o._viewport.getBoundingClientRect(),parentClientRect:o._parent.getBoundingClientRect()}),le.bind(document,"mousemove",l),le.bind(document,"mouseup",c)}}function l(e){var t=Bx(e);if(o._state.isDragging){o._state._svgClientRect&&!Ax(o._state._svgClientRect)||(o._state._svgClientRect=o._svg.getBoundingClientRect());var n=o._state.offsetViewportDom,i=o._state.viewportClientRect,r=o._state.parentClientRect;z(o._viewportDom.style,{top:t.y-n.y-r.top+"px",left:t.x-n.x-r.left+"px"});var s=Rx(r,{top:t.y-n.y-r.top,left:t.x-n.x-r.left,width:i.width,height:i.height});z(o._overlay.style,{clipPath:s});var a=Ox({x:t.x-o._state._svgClientRect.left,y:t.y-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sx({x:a.x-o._state.offsetViewport.x,y:a.y-o._state.offsetViewport.y},o._canvas)}}function c(e){var t=Bx(e);o._state.isDragging&&(o._state.initialDragPosition.x===t.x&&o._state.initialDragPosition.y===t.y&&s(e),o._update(),z(o._state,{cachedViewbox:null,initialDragPosition:null,isDragging:!1,offsetViewport:null,offsetViewportDom:null}),le.unbind(document,"mousemove",l),le.unbind(document,"mouseup",c))}this._canvas=i,this._elementRegistry=r,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=_x.next(),this._init(),this.toggle(e&&e.open||!1),le.bind(this._viewportDom,"mousedown",a(!1)),le.bind(this._svg,"mousedown",a(!0)),le.bind(this._parent,"wheel",(function(e){if(e.preventDefault(),e.stopPropagation(),e.ctrlKey&&(o._state._svgClientRect&&!Ax(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,r,s,a,l,c=0===e.deltaMode?.02:.32,h=Math.sqrt(Math.pow(e.deltaY,2)+Math.pow(e.deltaX,2))*Mx(e.deltaY)*-c;if(o._state.zoomDelta+=h,Math.abs(o._state.zoomDelta)>.1){var u=h>0?1:-1,p=Math.log(i.zoom())/Math.log(10),d=(r=Ex,s=20,a=Math.log(r.min)/Math.log(10),l=Math.log(r.max)/Math.log(10),(Math.abs(a)+Math.abs(l))/s),f=Math.round(p/d)*d;f+=d*u;var m=Math.pow(10,f);i.zoom(function(e,t){return Math.max(e.min,Math.min(e.max,t))}(Ex,m),g),o._state.zoomDelta=0;var g=Ox({x:e.clientX-o._state._svgClientRect.left,y:e.clientY-o._state._svgClientRect.top},o._svg,o._lastViewbox);Sx(g,o._canvas),o._update()}}})),le.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 Ox(e,t,n){var i=t.getBoundingClientRect(),r=function(e,t){var n=e.width/e.height,i=z({},{x:e.x,y:e.y,width:e.width,height:e.height});if(n>t){var r=i.width*(1/t);z(i,{y:i.y-(r-i.height)/2,height:r})}else if(n<t){var o=i.height*t;z(i,{x:i.x-(o-i.width)/2,width:o})}return i}(n,i.width/i.height);return{x:Cx(e.x,0,i.width,r.x,r.x+r.width),y:Cx(e.y,0,i.height,r.y,r.y+r.height)}}function Sx(e,t){var n=t.viewbox(),i=n.width,r=n.height;t.viewbox({x:e.x-i/2,y:e.y-r/2,width:i,height:r})}function Cx(e,t,n,i,r){return(e-t)*(r-i)/(n-t)+i}function Px(e,t,n){var i=function(e){var t=ve(".children",e);t||xe(e,t=De("g",{class:"children"}));return t}(t),r=[].slice.call(i.childNodes)[n];r?t.insertBefore(e,r.nextSibling):t.appendChild(e)}function Ax(e){return 0===e.width&&0===e.height}kx.$inject=["config.minimap","injector","eventBus","canvas","elementRegistry"],kx.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 i=this._map=document.createElement("div");K(i).add("map"),t.appendChild(i);var r=this._svg=De("svg");ke(r,{width:"100%",height:"100%"}),xe(i,r),xe(r,this._elementsGroup=De("g"));var o=this._viewportGroup=De("g");xe(r,o);var s=this._viewport=De("rect");Se(s).add("viewport"),xe(o,s),le.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)},kx.prototype._update=function(){var e=this._canvas.viewbox(),t=e.inner,n=e.outer;if(Dx(e)){var i,r,o,s,a=n.width-t.width,l=n.height-t.height;t.width<n.width?(i=t.x-a/2,o=n.width,t.x+t.width<n.width&&(i=Math.min(0,t.x))):(i=t.x,o=t.width),t.height<n.height?(r=t.y-l/2,s=n.height,t.y+t.height<n.height&&(r=Math.min(0,t.y))):(r=t.y,s=t.height),i-=50,r-=50,o+=100,s+=100,this._lastViewbox={x:i,y:r,width:o,height:s},ke(this._svg,{viewBox:i+", "+r+", "+o+", "+s}),ke(this._viewport,{x:e.x,y:e.y,width:e.width,height:e.height});var c=this._state._parentClientRect=this._parent.getBoundingClientRect(),h=this._viewport.getBoundingClientRect(),u={top:h.top-c.top,left:h.left-c.left,width:h.width,height:h.height};z(this._viewportDom.style,{top:u.top+"px",left:u.left+"px",width:u.width+"px",height:u.height+"px"});var p=Rx(c,u);z(this._overlay.style,{clipPath:p})}},kx.prototype.open=function(){z(this._state,{isOpen:!0}),K(this._parent).add("open");var e=this._injector.get("translate",!1)||function(e){return e};U(this._toggle,"title",e("Close minimap")),this._update(),this._eventBus.fire("minimap.toggle",{open:!0})},kx.prototype.close=function(){z(this._state,{isOpen:!1}),K(this._parent).remove("open");var e=this._injector.get("translate",!1)||function(e){return e};U(this._toggle,"title",e("Open minimap")),this._eventBus.fire("minimap.toggle",{open:!1})},kx.prototype.toggle=function(e){var t=this.isOpen();void 0===e&&(e=!t),e!=t&&(e?this.open():this.close())},kx.prototype.isOpen=function(){return this._state.isOpen},kx.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)}},kx.prototype._updateElementId=function(e,t){try{var n=ve("#"+Go(this._prefixId(e.id)),this._elementsGroup);n&&(n.id=this._prefixId(t))}catch(e){console.warn("Minimap#_updateElementId errored",e)}},kx.prototype.isOnActivePlane=function(e){var t=this._canvas;return t.findRoot?t.findRoot(e)===t.getRootElement():!t.findPlane||t.findPlane(e)===t.getActivePlane()},kx.prototype._addElement=function(e){var t=this;if(this._removeElement(e),this.isOnActivePlane(e)){var n,i,r,o=this._createElement(e),s=ve("#"+Go(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 i=[].slice.call(n.childNodes),r=-1;return i.forEach((function(t,n){ve(".djs-element",t)===e&&(r=n)})),r}(this._elementRegistry.getGraphics(e),this._elementRegistry.getGraphics(e.parent));return"undefined"!==a&&s?s.childNodes.length>a?Px(o,s,a):Px(o,s,s.childNodes.length-1):this._elementsGroup.appendChild(o),!function(e){return e.waypoints}(e)?(i=e.x,r=e.y,s&&(i-=(n=e.parent).x,r-=n.y),ke(o,{transform:"translate("+i+" "+r+")"})):(i=0,r=0,void 0!==(n=e.parent).x&&void 0!==n.y&&(i=-n.x,r=-n.y),ke(o,{transform:"translate("+i+" "+r+")"})),e.children&&e.children.length&&e.children.forEach((function(e){t._addElement(e)})),o}}},kx.prototype._removeElement=function(e){var t=this._svg.getElementById(this._prefixId(e.id));t&&qe(t)},kx.prototype._createElement=function(e){var t,n=this._elementRegistry.getGraphics(e);if(n&&(t=Un(n))){var i=function(e){return ye("[id]",e).forEach((function(e){e.remove()})),e}(Ae(t));return ke(i,{id:this._prefixId(e.id)}),i}},kx.prototype._clear=function(){Pe(this._elementsGroup)},kx.prototype._prefixId=function(e){return"djs-minimap-"+e+"-"+this._minimapId};var Mx=Math.sign||function(e){return e>=0?1:-1};function Rx(e,t){return"polygon("+[Tx(t.left,t.top),Tx(t.left+t.width,t.top),Tx(t.left+t.width,t.top+t.height),Tx(t.left,t.top+t.height),Tx(t.left,e.height),Tx(e.width,e.height),Tx(e.width,0),Tx(0,0),Tx(0,e.height),Tx(t.left,e.height)].join(", ")+")"}function Tx(e,t){return e+"px "+t+"px"}function Dx(e){return w(e,(function(e){return h(e)?Dx(e):u(e)&&isFinite(e)}))}function Bx(e){return e.center?e.center:{x:e.clientX,y:e.clientY}}var Lx={__init__:["minimap"],minimap:["type",kx]},Nx=1e5,zx=1e5;function $x(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)}))}$x.prototype._init=function(){var e=ve("defs",this._canvas._svg);e||(e=De("defs"),xe(this._canvas._svg,e));var t=this._pattern=De("pattern"),n="djs-grid-pattern-"+Math.trunc(1e6*Math.random());ke(t,{id:n,width:oy,height:oy,patternUnits:"userSpaceOnUse"});var i=this._circle=De("circle");ke(i,{cx:.5,cy:.5,r:.5,fill:"#ccc"}),xe(t,i),xe(e,t),ke(this._gfx=De("rect"),{x:-Nx/2,y:-zx/2,width:Nx,height:zx,fill:`url(#${n})`})},$x.prototype._centerGridAroundViewbox=function(e){e||(e=this._canvas.viewbox());var t=xn(e);ke(this._gfx,{x:-Nx/2+sy(t.x,oy),y:-zx/2+sy(t.y,oy)})},$x.prototype.isVisible=function(){return this._visible},$x.prototype.toggle=function(e){if(void 0===e&&(e=!this._visible),e!==this._visible){var t=this._getParent();e?xe(t,this._gfx):Pe(t),this._visible=e}},$x.prototype._getParent=function(){return this._canvas.getLayer("djs-grid",-2)},$x.$inject=["canvas","eventBus"];var Ix={__init__:["grid"],grid:["type",$x]};function jx(e,t){var n,i,r=(e=e||{}).borderColor||"rgba(0,0,0,0.1)",o=e.crossColor||"#CCC",s=-1;xe(t.getLayer("djs-origin",-1),n=Vx("g",{"pointer-events":"none"})),!1!==e.showBorder&&xe(n,Vx("path",{class:Hx("border"),d:Fx(["M",-22,s,"H",-1e3,"M",22,s,"H",6e3,"M",s,-22,"V",-1e3,"M",s,22,"V",3e3]),fill:"none",stroke:r,"stroke-width":"2px","stroke-dasharray":"6, 6","shape-rendering":"crispedges"})),xe(n,Vx("path",{d:Fx(["M",-15,s,"H",15,"M",s,-15,"V",15]),class:Hx("cross"),fill:"none",stroke:o,"stroke-width":"2px","stroke-linecap":"round"})),(i=Vx("text",{x:-40,y:-10,fill:o,class:Hx("label")})).textContent="(0, 0)",xe(n,i)}function Fx(e){return e.join(" ")}function Hx(e){return"djs-origin-"+e}function Vx(e,t){var n=De(e);return ke(n,t),n}jx.$inject=["config.origin","canvas"];var qx={__init__:[jx]},Wx={offset:{x:150,y:75},tolerance:50,alignOnSave:!0};function Qx(e,t,n,i,r,o){function s(e,n){var i=n.offset,r=n.tolerance,o={};return["x","y"].forEach((function(n){var s=-e[n]+i[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)<r?0:s})),o}function a(){var t=r.viewbox().inner,n=r.getRootElement().children;if(n.length){var o=s(t,e);0===o.x&&0===o.y||i.execute("elements.alignToOrigin",{elements:n,delta:o})}}function l(e){return function(t){n.once("commandStack.changed",(function(){var n=t.delta,i=r.viewbox().scale;r.scroll({dx:e*n.x*i,dy:e*n.y*i})}))}}var c,h,p;e=function(e){var t=z({},Wx,e||{});return u(t.offset)&&(t.offset={x:t.offset,y:t.offset}),t}(e),i.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),h=n,((p=c&&c._eventBus)||h).on("saveXML.start",1250,a),p&&h.on("diagram.destroy",(function(){p.off("saveXML.start",a)}))),this.align=a,this.computeAdjustment=s,this._config=e}Qx.$inject=["config.alignToOrigin","injector","eventBus","commandStack","canvas","modeling"];var Gx={__init__:["alignToOrigin"],alignToOrigin:["type",Qx]};function Xx(e){function t(e){if(!e.labelTarget){var t=Or(e);Er(t,"bpmn:Participant")&&(t=t.processRef),Er(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)}))}))}Xx.$inject=["eventBus"];var Ux,Yx,Kx,Zx,Jx,ew,tw,nw,iw={__init__:[Xx]},rw={},ow=[],sw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,aw=Array.isArray;function lw(e,t){for(var n in t)e[n]=t[n];return e}function cw(e){var t=e.parentNode;t&&t.removeChild(e)}function hw(e,t,n){var i,r,o,s={};for(o in t)"key"==o?i=t[o]:"ref"==o?r=t[o]:s[o]=t[o];if(arguments.length>2&&(s.children=arguments.length>3?Ux.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 uw(e,s,i,r,null)}function uw(e,t,n,i,r){var o={type:e,props:t,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:null==r?++Kx:r,__i:-1,__u:0};return null==r&&null!=Yx.vnode&&Yx.vnode(o),o}function pw(e){return e.children}function dw(e,t){this.props=e,this.context=t}function fw(e,t){if(null==t)return e.__?fw(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?fw(e):null}function mw(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 mw(e)}}function gw(e){(!e.__d&&(e.__d=!0)&&Zx.push(e)&&!vw.__r++||Jx!==Yx.debounceRendering)&&((Jx=Yx.debounceRendering)||ew)(vw)}function vw(){var e,t,n,i,r,o,s,a,l;for(Zx.sort(tw);e=Zx.shift();)e.__d&&(t=Zx.length,i=void 0,o=(r=(n=e).__v).__e,a=[],l=[],(s=n.__P)&&((i=lw({},r)).__v=r.__v+1,Yx.vnode&&Yx.vnode(i),Sw(s,i,r,n.__n,void 0!==s.ownerSVGElement,32&r.__u?[o]:null,a,null==o?fw(r):o,!!(32&r.__u),l),i.__.__k[i.__i]=i,Cw(a,i,l),i.__e!=o&&mw(i)),Zx.length>t&&Zx.sort(tw));vw.__r=0}function yw(e,t,n,i,r,o,s,a,l,c,h){var u,p,d,f,m,g=i&&i.__k||ow,v=t.length;for(n.__d=l,function(e,t,n){var i,r,o,s,a,l=t.length,c=n.length,h=c,u=0;for(e.__k=[],i=0;i<l;i++)null!=(r=e.__k[i]=null==(r=t[i])||"boolean"==typeof r||"function"==typeof r?null:"string"==typeof r||"number"==typeof r||"bigint"==typeof r||r.constructor==String?uw(null,r,null,null,r):aw(r)?uw(pw,{children:r},null,null,null):void 0===r.constructor&&r.__b>0?uw(r.type,r.props,r.key,r.ref?r.ref:null,r.__v):r)?(r.__=e,r.__b=e.__b+1,a=ww(r,n,s=i+u,h),r.__i=a,o=null,-1!==a&&(h--,(o=n[a])&&(o.__u|=131072)),null==o||null===o.__v?(-1==a&&u--,"function"!=typeof r.type&&(r.__u|=65536)):a!==s&&(a===s+1?u++:a>s?h>l-s?u+=a-s:u--:u=a<s&&a==s-1?a-s:0,a!==i+u&&(r.__u|=65536))):(o=n[i])&&null==o.key&&o.__e&&(o.__e==e.__d&&(e.__d=fw(o)),Mw(o,o,!1),n[i]=null,h--);if(h)for(i=0;i<c;i++)null!=(o=n[i])&&!(131072&o.__u)&&(o.__e==e.__d&&(e.__d=fw(o)),Mw(o,o))}(n,t,g),l=n.__d,u=0;u<v;u++)null!=(d=n.__k[u])&&"boolean"!=typeof d&&"function"!=typeof d&&(p=-1===d.__i?rw:g[d.__i]||rw,d.__i=u,Sw(e,d,p,r,o,s,a,l,c,h),f=d.__e,d.ref&&p.ref!=d.ref&&(p.ref&&Aw(p.ref,null,d),h.push(d.ref,d.__c||f,d)),null==m&&null!=f&&(m=f),65536&d.__u||p.__k===d.__k?l=bw(d,l,e):"function"==typeof d.type&&void 0!==d.__d?l=d.__d:f&&(l=f.nextSibling),d.__d=void 0,d.__u&=-196609);n.__d=l,n.__e=m}function bw(e,t,n){var i,r;if("function"==typeof e.type){for(i=e.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=e,t=bw(i[r],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function xw(e,t){return t=t||[],null==e||"boolean"==typeof e||(aw(e)?e.some((function(e){xw(e,t)})):t.push(e)),t}function ww(e,t,n,i){var r=e.key,o=e.type,s=n-1,a=n+1,l=t[n];if(null===l||l&&r==l.key&&o===l.type)return n;if(i>(null==l||131072&l.__u?0:1))for(;s>=0||a<t.length;){if(s>=0){if((l=t[s])&&!(131072&l.__u)&&r==l.key&&o===l.type)return s;s--}if(a<t.length){if((l=t[a])&&!(131072&l.__u)&&r==l.key&&o===l.type)return a;a++}}return-1}function _w(e,t,n){"-"===t[0]?e.setProperty(t,null==n?"":n):e[t]=null==n?"":"number"!=typeof n||sw.test(t)?n:n+"px"}function Ew(e,t,n,i,r){var o;e:if("style"===t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof i&&(e.style.cssText=i=""),i)for(t in i)n&&t in n||_w(e.style,t,"");if(n)for(t in n)i&&n[t]===i[t]||_w(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?i?n.u=i.u:(n.u=Date.now(),e.addEventListener(t,o?Ow:kw,o)):e.removeEventListener(t,o?Ow:kw,o);else{if(r)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 kw(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Yx.event?Yx.event(e):e)}function Ow(e){return this.l[e.type+!0](Yx.event?Yx.event(e):e)}function Sw(e,t,n,i,r,o,s,a,l,c){var h,u,p,d,f,m,g,v,y,b,x,w,_,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]),(h=Yx.__b)&&h(t);e:if("function"==typeof O)try{if(v=t.props,y=(h=O.contextType)&&i[h.__c],b=h?y?y.props.value:h.__:i,n.__c?g=(u=t.__c=n.__c).__=u.__E:("prototype"in O&&O.prototype.render?t.__c=u=new O(v,b):(t.__c=u=new dw(v,b),u.constructor=O,u.render=Rw),y&&y.sub(u),u.props=v,u.state||(u.state={}),u.context=b,u.__n=i,p=u.__d=!0,u.__h=[],u._sb=[]),null==u.__s&&(u.__s=u.state),null!=O.getDerivedStateFromProps&&(u.__s==u.state&&(u.__s=lw({},u.__s)),lw(u.__s,O.getDerivedStateFromProps(v,u.__s))),d=u.props,f=u.state,u.__v=t,p)null==O.getDerivedStateFromProps&&null!=u.componentWillMount&&u.componentWillMount(),null!=u.componentDidMount&&u.__h.push(u.componentDidMount);else{if(null==O.getDerivedStateFromProps&&v!==d&&null!=u.componentWillReceiveProps&&u.componentWillReceiveProps(v,b),!u.__e&&(null!=u.shouldComponentUpdate&&!1===u.shouldComponentUpdate(v,u.__s,b)||t.__v===n.__v)){for(t.__v!==n.__v&&(u.props=v,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach((function(e){e&&(e.__=t)})),x=0;x<u._sb.length;x++)u.__h.push(u._sb[x]);u._sb=[],u.__h.length&&s.push(u);break e}null!=u.componentWillUpdate&&u.componentWillUpdate(v,u.__s,b),null!=u.componentDidUpdate&&u.__h.push((function(){u.componentDidUpdate(d,f,m)}))}if(u.context=b,u.props=v,u.__P=e,u.__e=!1,w=Yx.__r,_=0,"prototype"in O&&O.prototype.render){for(u.state=u.__s,u.__d=!1,w&&w(t),h=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,w&&w(t),h=u.render(u.props,u.state,u.context),u.state=u.__s}while(u.__d&&++_<25);u.state=u.__s,null!=u.getChildContext&&(i=lw(lw({},i),u.getChildContext())),p||null==u.getSnapshotBeforeUpdate||(m=u.getSnapshotBeforeUpdate(d,f)),yw(e,aw(k=null!=h&&h.type===pw&&null==h.key?h.props.children:h)?k:[k],t,n,i,r,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),Yx.__e(e,t,n)}else null==o&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=Pw(n.__e,t,n,i,r,o,s,l,c);(h=Yx.diffed)&&h(t)}function Cw(e,t,n){t.__d=void 0;for(var i=0;i<n.length;i++)Aw(n[i],n[++i],n[++i]);Yx.__c&&Yx.__c(t,e),e.some((function(t){try{e=t.__h,t.__h=[],e.some((function(e){e.call(t)}))}catch(e){Yx.__e(e,t.__v)}}))}function Pw(e,t,n,i,r,o,s,a,l){var c,h,u,p,d,f,m,g=n.props,v=t.props,y=t.type;if("svg"===y&&(r=!0),null!=o)for(c=0;c<o.length;c++)if((d=o[c])&&"setAttribute"in d==!!y&&(y?d.localName===y:3===d.nodeType)){e=d,o[c]=null;break}if(null==e){if(null===y)return document.createTextNode(v);e=r?document.createElementNS("http://www.w3.org/2000/svg",y):document.createElement(y,v.is&&v),o=null,a=!1}if(null===y)g===v||a&&e.data===v||(e.data=v);else{if(o=o&&Ux.call(e.childNodes),g=n.props||rw,!a&&null!=o)for(g={},c=0;c<e.attributes.length;c++)g[(d=e.attributes[c]).name]=d.value;for(c in g)d=g[c],"children"==c||("dangerouslySetInnerHTML"==c?u=d:"key"===c||c in v||Ew(e,c,null,d,r));for(c in v)d=v[c],"children"==c?p=d:"dangerouslySetInnerHTML"==c?h=d:"value"==c?f=d:"checked"==c?m=d:"key"===c||a&&"function"!=typeof d||g[c]===d||Ew(e,c,d,g[c],r);if(h)a||u&&(h.__html===u.__html||h.__html===e.innerHTML)||(e.innerHTML=h.__html),t.__k=[];else if(u&&(e.innerHTML=""),yw(e,aw(p)?p:[p],t,n,i,r&&"foreignObject"!==y,o,s,o?o[0]:n.__k&&fw(n,0),a,l),null!=o)for(c=o.length;c--;)null!=o[c]&&cw(o[c]);a||(c="value",void 0!==f&&(f!==e[c]||"progress"===y&&!f||"option"===y&&f!==g[c])&&Ew(e,c,f,g[c],!1),c="checked",void 0!==m&&m!==e[c]&&Ew(e,c,m,g[c],!1))}return e}function Aw(e,t,n){try{"function"==typeof e?e(t):e.current=t}catch(e){Yx.__e(e,n)}}function Mw(e,t,n){var i,r;if(Yx.unmount&&Yx.unmount(e),(i=e.ref)&&(i.current&&i.current!==e.__e||Aw(i,null,t)),null!=(i=e.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(e){Yx.__e(e,t)}i.base=i.__P=null,e.__c=void 0}if(i=e.__k)for(r=0;r<i.length;r++)i[r]&&Mw(i[r],t,n||"function"!=typeof e.type);n||null==e.__e||cw(e.__e),e.__=e.__e=e.__d=void 0}function Rw(e,t,n){return this.constructor(e,n)}function Tw(e,t,n){var i,r,o,s;Yx.__&&Yx.__(e,t),r=(i="function"==typeof n)?null:n&&n.__k||t.__k,o=[],s=[],Sw(t,e=(!i&&n||t).__k=hw(pw,null,[e]),r||rw,rw,void 0!==t.ownerSVGElement,!i&&n?[n]:r?null:t.firstChild?Ux.call(t.childNodes):null,o,!i&&n?n:r?r.__e:t.firstChild,i,s),Cw(o,e,s)}function Dw(e,t){var n={__c:t="__cC"+nw++,__:e,Consumer:function(e,t){return e.children(t)},Provider:function(e){var n,i;return this.getChildContext||(n=[],(i={})[t]=this,this.getChildContext=function(){return i},this.shouldComponentUpdate=function(e){this.props.value!==e.value&&n.some((function(e){e.__e=!0,gw(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}Ux=ow.slice,Yx={__e:function(e,t,n,i){for(var r,o,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((o=r.constructor)&&null!=o.getDerivedStateFromError&&(r.setState(o.getDerivedStateFromError(e)),s=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,i||{}),s=r.__d),s)return r.__E=r}catch(t){e=t}throw e}},Kx=0,dw.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=lw({},this.state),"function"==typeof e&&(e=e(lw({},n),this.props)),e&&lw(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),gw(this))},dw.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),gw(this))},dw.prototype.render=pw,Zx=[],ew="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,tw=function(e,t){return e.__v.__b-t.__v.__b},vw.__r=0,nw=0;var Bw,Lw,Nw,zw,$w=0,Iw=[],jw=[],Fw=Yx.__b,Hw=Yx.__r,Vw=Yx.diffed,qw=Yx.__c,Ww=Yx.unmount;function Qw(e,t){Yx.__h&&Yx.__h(Lw,e,$w||t),$w=0;var n=Lw.__H||(Lw.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({__V:jw}),n.__[e]}function Gw(e){return $w=1,Xw(a_,e)}function Xw(e,t,n){var i=Qw(Bw++,2);if(i.t=e,!i.__c&&(i.__=[n?n(t):a_(void 0,t),function(e){var t=i.__N?i.__N[0]:i.__[0],n=i.t(t,e);t!==n&&(i.__N=[n,i.__[1]],i.__c.setState({}))}],i.__c=Lw,!Lw.u)){var r=function(e,t,n){if(!i.__c.__H)return!0;var r=i.__c.__H.__.filter((function(e){return e.__c}));if(r.every((function(e){return!e.__N})))return!o||o.call(this,e,t,n);var s=!1;return r.forEach((function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(s=!0)}})),!(!s&&i.__c.props===e)&&(!o||o.call(this,e,t,n))};Lw.u=!0;var o=Lw.shouldComponentUpdate,s=Lw.componentWillUpdate;Lw.componentWillUpdate=function(e,t,n){if(this.__e){var i=o;o=void 0,r(e,t,n),o=i}s&&s.call(this,e,t,n)},Lw.shouldComponentUpdate=r}return i.__N||i.__}function Uw(e,t){var n=Qw(Bw++,3);!Yx.__s&&s_(n.__H,t)&&(n.__=e,n.i=t,Lw.__H.__h.push(n))}function Yw(e,t){var n=Qw(Bw++,4);!Yx.__s&&s_(n.__H,t)&&(n.__=e,n.i=t,Lw.__h.push(n))}function Kw(e){return $w=5,Zw((function(){return{current:e}}),[])}function Zw(e,t){var n=Qw(Bw++,7);return s_(n.__H,t)?(n.__V=e(),n.i=t,n.__h=e,n.__V):n.__}function Jw(e,t){return $w=8,Zw((function(){return e}),t)}function e_(e){var t=Lw.context[e.__c],n=Qw(Bw++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(Lw)),t.props.value):e.__}function t_(){for(var e;e=Iw.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(r_),e.__H.__h.forEach(o_),e.__H.__h=[]}catch(t){e.__H.__h=[],Yx.__e(t,e.__v)}}Yx.__b=function(e){Lw=null,Fw&&Fw(e)},Yx.__r=function(e){Hw&&Hw(e),Bw=0;var t=(Lw=e.__c).__H;t&&(Nw===Lw?(t.__h=[],Lw.__h=[],t.__.forEach((function(e){e.__N&&(e.__=e.__N),e.__V=jw,e.__N=e.i=void 0}))):(t.__h.forEach(r_),t.__h.forEach(o_),t.__h=[],Bw=0)),Nw=Lw},Yx.diffed=function(e){Vw&&Vw(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==Iw.push(t)&&zw===Yx.requestAnimationFrame||((zw=Yx.requestAnimationFrame)||i_)(t_)),t.__H.__.forEach((function(e){e.i&&(e.__H=e.i),e.__V!==jw&&(e.__=e.__V),e.i=void 0,e.__V=jw}))),Nw=Lw=null},Yx.__c=function(e,t){t.some((function(e){try{e.__h.forEach(r_),e.__h=e.__h.filter((function(e){return!e.__||o_(e)}))}catch(n){t.some((function(e){e.__h&&(e.__h=[])})),t=[],Yx.__e(n,e.__v)}})),qw&&qw(e,t)},Yx.unmount=function(e){Ww&&Ww(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach((function(e){try{r_(e)}catch(e){t=e}})),n.__H=void 0,t&&Yx.__e(t,n.__v))};var n_="function"==typeof requestAnimationFrame;function i_(e){var t,n=function(){clearTimeout(i),n_&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(n,100);n_&&(t=requestAnimationFrame(n))}function r_(e){var t=Lw,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),Lw=t}function o_(e){var t=Lw;e.__c=e.__(),Lw=t}function s_(e,t){return!e||e.length!==t.length||t.some((function(t,n){return t!==e[n]}))}function a_(e,t){return"function"==typeof t?t(e):t}function l_(e,t){for(var n in t)e[n]=t[n];return e}function c_(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var i in t)if("__source"!==i&&e[i]!==t[i])return!0;return!1}function h_(e){this.props=e}(h_.prototype=new dw).isPureReactComponent=!0,h_.prototype.shouldComponentUpdate=function(e,t){return c_(this.props,e)||c_(this.state,t)};var u_=Yx.__b;Yx.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),u_&&u_(e)};var p_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function d_(e){function t(t){var n=l_({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=p_,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var f_=Yx.__e;Yx.__e=function(e,t,n,i){if(e.then)for(var r,o=t;o=o.__;)if((r=o.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);f_(e,t,n,i)};var m_=Yx.unmount;function g_(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=l_({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c=null),e.__k=e.__k&&e.__k.map((function(e){return g_(e,t,n)}))),e}function v_(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map((function(e){return v_(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 y_(){this.__u=0,this.t=null,this.__b=null}function b_(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function x_(){this.u=null,this.o=null}Yx.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),m_&&m_(e)},(y_.prototype=new dw).__c=function(e,t){var n=t.__c,i=this;null==i.t&&(i.t=[]),i.t.push(n);var r=b_(i.__v),o=!1,s=function(){o||(o=!0,n.__R=null,r?r(a):a())};n.__R=s;var a=function(){if(! --i.__u){if(i.state.__a){var e=i.state.__a;i.__v.__k[0]=v_(e,e.__c.__P,e.__c.__O)}var t;for(i.setState({__a:i.__b=null});t=i.t.pop();)t.forceUpdate()}};i.__u++||32&t.__u||i.setState({__a:i.__b=i.__v.__k[0]}),e.then(s,s)},y_.prototype.componentWillUnmount=function(){this.t=[]},y_.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),i=this.__v.__k[0].__c;this.__v.__k[0]=g_(this.__b,n,i.__O=i.__P)}this.__b=null}var r=t.__a&&hw(pw,null,e.fallback);return r&&(r.__u&=-33),[hw(pw,null,t.__a?null:e.children),r]};var w_=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 __(e){return this.getChildContext=function(){return e.context},e.children}function E_(e){var t=this,n=e.i;t.componentWillUnmount=function(){Tw(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)}}),Tw(hw(__,{context:t.context},e.__v),t.l)}function k_(e,t){var n=hw(E_,{__v:e,i:t});return n.containerInfo=t,n}(x_.prototype=new dw).__a=function(e){var t=this,n=b_(t.__v),i=t.o.get(e);return i[0]++,function(r){var o=function(){t.props.revealOrder?(i.push(r),w_(t,e,i)):r()};n?n(o):o()}},x_.prototype.render=function(e){this.u=null,this.o=new Map;var t=xw(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},x_.prototype.componentDidUpdate=x_.prototype.componentDidMount=function(){var e=this;this.o.forEach((function(t,n){w_(e,n,t)}))};var O_="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,S_=/^(?: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]/,C_=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,P_=/[A-Z0-9]/g,A_="undefined"!=typeof document,M_=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};dw.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach((function(e){Object.defineProperty(dw.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})}));var R_=Yx.event;function T_(){}function D_(){return this.cancelBubble}function B_(){return this.defaultPrevented}Yx.event=function(e){return R_&&(e=R_(e)),e.persist=T_,e.isPropagationStopped=D_,e.isDefaultPrevented=B_,e.nativeEvent=e};var L_={enumerable:!1,configurable:!0,get:function(){return this.class}},N_=Yx.vnode;Yx.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,i={};for(var r in t){var o=t[r];if(!("value"===r&&"defaultValue"in t&&null==o||A_&&"children"===r&&"noscript"===n||"class"===r||"className"===r)){var s=r.toLowerCase();"defaultValue"===r&&"value"in t&&null==t.value?r="value":"download"===r&&!0===o?o="":"ondoubleclick"===s?r="ondblclick":"onchange"!==s||"input"!==n&&"textarea"!==n||M_(t.type)?"onfocus"===s?r="onfocusin":"onblur"===s?r="onfocusout":C_.test(r)?r=s:-1===n.indexOf("-")&&S_.test(r)?r=r.replace(P_,"-$&").toLowerCase():null===o&&(o=void 0):s=r="oninput","oninput"===s&&i[r=s]&&(r="oninputCapture"),i[r]=o}}"select"==n&&i.multiple&&Array.isArray(i.value)&&(i.value=xw(t.children).forEach((function(e){e.props.selected=-1!=i.value.indexOf(e.props.value)}))),"select"==n&&null!=i.defaultValue&&(i.value=xw(t.children).forEach((function(e){e.props.selected=i.multiple?-1!=i.defaultValue.indexOf(e.props.value):i.defaultValue==e.props.value}))),t.class&&!t.className?(i.class=t.class,Object.defineProperty(i,"className",L_)):(t.className&&!t.class||t.class&&t.className)&&(i.class=i.className=t.className),e.props=i}(e),e.$$typeof=O_,N_&&N_(e)};var z_=Yx.__r;Yx.__r=function(e){z_&&z_(e),e.__c};var $_=Yx.diffed;Yx.diffed=function(e){$_&&$_(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 I_=hw,j_=0;function F_(e,t,n,i,r,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:--j_,__i:-1,__u:0,__source:r,__self:o};if("function"==typeof e&&(s=e.defaultProps))for(a in s)void 0===l[a]&&(l[a]=s[a]);return Yx.vnode&&Yx.vnode(c),c}function H_(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var V_,q_={exports:{}};
|
|
172
172
|
/*!
|
|
173
173
|
Copyright (c) 2018 Jed Watson.
|
|
174
174
|
Licensed under the MIT License (MIT), see
|